parent
817bb900aa
commit
392a974d43
|
@ -1,5 +1,5 @@
|
|||
cmake_minimum_required(VERSION 3.10)
|
||||
project(drivers) # 工程名字,随你怎么叫都行
|
||||
project(secgateway) # 工程名字,随你怎么叫都行
|
||||
|
||||
set(PLAT_CFG_DIR "./Platform/user/configm/config-server")
|
||||
#include(kernel_config.cmake) # 一堆的 add_definitions(xxx),就不细说了
|
||||
|
@ -17,11 +17,10 @@ aux_source_directory(${PLAT_CFG_DIR}/object_manager DIR_SRCS)
|
|||
aux_source_directory(${PLAT_CFG_DIR}/web_config DIR_SRCS)
|
||||
|
||||
|
||||
|
||||
set(MY_ANDROID_ROOT_DIR "./kernel/linux-4.14.83") # 定义一个变量,方便后面使用
|
||||
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -nostdinc") # C 编译器设置
|
||||
|
||||
add_executable(drivers ${DIR_SRCS} Platform/user/configm/config-server/object_manager/object_manager.h Platform/user/configm/config-server/object_manager/object_manager.c) # dummy target,没有这个的话external libraries就是空的,
|
||||
add_executable(object ${DIR_SRCS}) # dummy target,没有这个的话external libraries就是空的,
|
||||
# 弄一个main.c糊弄糊弄Clion
|
||||
|
||||
include_directories(
|
||||
|
|
|
@ -1,14 +1,40 @@
|
|||
//
|
||||
// Created by xajhu on 2019/10/10 0010.
|
||||
//
|
||||
#include "object_manager.h"
|
||||
#include "configm.h"
|
||||
//#include <sqlite3.h>
|
||||
|
||||
#include "object_manager.h"
|
||||
#include "log.h"
|
||||
#include "ret_errno.h"
|
||||
|
||||
//#define OBJECT_DB ("~/database/object.db")
|
||||
|
||||
//#define FIRMWARE_TBL_SQL_CMD ("CREATE TABLE IF NOT EXISTS %s (" \
|
||||
"ID INTEGER PRIMARY KEY AUTOINCREMENT," \
|
||||
"name TEXT UNIQUE NOT NULL," \
|
||||
"desc TEXT NOT NULL DEFAULT (\'\')," \
|
||||
"prio INTEGER NOT NULL DEFAULT (0)," \
|
||||
"type INTEGER NOT NULL," \
|
||||
"prio INTEGER NOT NULL);")
|
||||
|
||||
|
||||
//static sqlite3 *g_obj_db = NULL;
|
||||
|
||||
ret_code object_config_init()
|
||||
{
|
||||
#if 0
|
||||
int rc = 0;
|
||||
char* err_msg = NULL;
|
||||
|
||||
IHW_InitLOG("obj", NULL, TRUE);
|
||||
|
||||
rc = sqlite3_open_v2(OBJECT_DB, &g_obj_db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
|
||||
|
||||
if(rc != SQLITE_OK) {
|
||||
LOG_EX(LOG_Error, "Init database %s error: %d\n", OBJECT_DB, rc);
|
||||
return -RET_NOTFOUND;
|
||||
}
|
||||
#endif
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
|
@ -16,6 +42,7 @@ ret_code object_config_chk(uint source, uint *config_type,
|
|||
pointer input, int *input_len,
|
||||
pointer output, int *output_len)
|
||||
{
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -967,6 +967,7 @@ static void test_add_object(void)
|
|||
pObjKItem->objs.svr_obj[0].pro_type = 1;
|
||||
pObjKItem->objs.svr_obj[0].str_val = strdup("10010-10011");
|
||||
object_add(pObjItem, pObjKItem);
|
||||
free(pObjKItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1063,6 +1064,9 @@ static void test_mod_object(void)
|
|||
|
||||
if (pAdd) {
|
||||
if (pAdd->pCtx) {
|
||||
for (i = 0; i < pAdd->n_obj; i++) {
|
||||
free(pAdd->pCtx[i].pObj);
|
||||
}
|
||||
free(pAdd->pCtx);
|
||||
}
|
||||
|
||||
|
@ -1103,6 +1107,8 @@ static void test_mod_object(void)
|
|||
retCtx.data[i].name = pAdd->pCtx[i].pObj->name;
|
||||
retCtx.data[i].ret_code = ret;
|
||||
retCtx.data[i].mesg = get_err_message(ret);
|
||||
|
||||
free(pAdd->pCtx[i].pObj);
|
||||
}
|
||||
|
||||
dump_object();
|
||||
|
@ -1873,7 +1879,6 @@ int main(int argc, char **argv)
|
|||
test_search_object(optarg);
|
||||
break;
|
||||
|
||||
|
||||
case 'j':
|
||||
test_configm_object(optarg);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue