这是slp_model.h中部分代码:
#define ALARM_PLAN_STR_MAX_LEN 16
typedef struct _MSG_ALARM_CHN1_PLAN
{
SWITCH enabled;
char alarm_plan_1[5][ALARM_PLAN_STR_MAX_LEN + 1]; /* 0000-0000,000格式 */
S32 alarm_plan_num;
}MSG_ALARM_CHN1_PLAN, *PTR_MSG_ALARM_PLAN;
这是msg_alarm.c中部分代码:
LOCAL void msg_alarm_plan_data_model()
{
/*************************************************************************************/
/********* Desc of /msg_alarm_plan/chn1_msg_alarm_plan *******************************/
/*************************************************************************************/
DS_ARR_DESC(alarm_plan, OPT_TYPE_STRING, MSG_ALARM_CHN1_PLAN, alarm_plan_1);
DS_OPT_DESC chn1_msg_alarm_plan_options[] =
{
DS_SWITCH_OPT(MSG_ALARM_CHN1_PLAN, enabled, OPT_FLAG_NORM),
DS_ARR_OPT(MSG_ALARM_CHN1_PLAN, alarm_plan_1, OPT_FLAG_NORM, &alarm_plan),
DS_S32_OPT(MSG_ALARM_CHN1_PLAN, alarm_plan_num, OPT_FLAG_NORM),
};
DS_SEG_DESC chn1_msg_alarm_plan_segments[] =
{
DS_STRUCT_SEG("chn1_msg_alarm_plan", SEG_LIM_RW, SEG_GROUP_ROOT, MSG_ALARM_CHN1_PLAN, chn1_msg_alarm_plan_options),
};
DS_SECT_DESC chn1_msg_alarm_plan_sections[] =
{
DS_STRUCT_SECT("chn1_msg_alarm_plan", chn1_msg_alarm_plan_segments),
};
/*************************************************************************************/
/********* Desc of /msg_alarm_plan/arming_schedule_sound***************************************/
/*************************************************************************************/
DS_OPT_DESC arming_schedule_info_options[] =
{
DS_STR_OPT(ARMING_SCHEDULE, monday, OPT_FLAG_NORM),
DS_STR_OPT(ARMING_SCHEDULE, tuesday, OPT_FLAG_NORM),
DS_STR_OPT(ARMING_SCHEDULE, wednesday, OPT_FLAG_NORM),
DS_STR_OPT(ARMING_SCHEDULE, thursday, OPT_FLAG_NORM),
DS_STR_OPT(ARMING_SCHEDULE, friday, OPT_FLAG_NORM),
DS_STR_OPT(ARMING_SCHEDULE, saturday, OPT_FLAG_NORM),
DS_STR_OPT(ARMING_SCHEDULE, sunday, OPT_FLAG_NORM),
};
DS_SEG_DESC sound_arming_schedule_info_segments[] =
{
DS_STRUCT_SEG("arming_schedule_sound", SEG_LIM_RW, SEG_GROUP_ROOT, ARMING_SCHEDULE, arming_schedule_info_options),
};
DS_SECT_DESC sound_arming_schedule_sections[] =
{
DS_STRUCT_SECT("arming_schedule_sound", sound_arming_schedule_info_segments),
};
/*************************************************************************************/
/********* Desc of /msg_alarm_plan/arming_schedule_light***************************************/
/*************************************************************************************/
DS_SEG_DESC light_arming_schedule_info_segments[] =
{
DS_STRUCT_SEG("arming_schedule_light", SEG_LIM_RW, SEG_GROUP_ROOT, ARMING_SCHEDULE, arming_schedule_info_options),
};
DS_SECT_DESC light_arming_schedule_sections[] =
{
DS_STRUCT_SECT("arming_schedule_light", light_arming_schedule_info_segments),
};
DS_TBL_DESC msg_alarm_plan_tables[] =
{
DS_STRUCT_TBL("plan", TBL_ATTR_CFG, chn1_msg_alarm_plan_sections),
DS_STRUCT_TBL("plan", TBL_ATTR_CFG, sound_arming_schedule_sections),
DS_STRUCT_TBL("plan", TBL_ATTR_CFG, light_arming_schedule_sections),
};
DS_DAT_MON_DESC msg_alarm_plan_data_monitor[] =
{
DS_DAT_MON(MSG_ALARM_CHN1_PLAN_PATH, DATA_ATTRI_CHECK),
DS_DAT_MON(MSG_ALARM_PLAN_ARMING_SCHEDULE_SOUND_PATH, DATA_ATTRI_CHECK),
DS_DAT_MON(MSG_ALARM_PLAN_ARMING_SCHEDULE_LIGHT_PATH, DATA_ATTRI_CHECK),
};
DS_MOD_DESC msg_alarm_plan_module =
DS_STRUCT_MOD("msg_alarm_plan", msg_alarm_plan_init, msg_alarm_plan_check, NULL, msg_alarm_plan_start, NULL,
msg_alarm_plan_tables, msg_alarm_plan_data_monitor);
MODULE *module_node = ds_register_module("msg_alarm_plan", &msg_alarm_plan_module);
CAP_ASSERT(NULL != module_node);
}
CAP_INIT(msg_alarm_plan_data_model);
这是alarm_plan_ds.c中的代码:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include "slp_model.h"
#include "libds.h"
#include "msg_alarm.h"
#include "detection_utils.h"
#define MSG_ALARM_PLAN_MODULE_NAME "msg_alarm_plan"
#define MSG_ALARM_PLAN_TABLE_NAME "plan"
#define MSG_ALARM_PLAN_SECTION_NAME "chn1_msg_alarm_plan"
/* 存放从ds中读取的数据 */
LOCAL MSG_ALARM_CHN1_PLAN g_msg_alarm_plan = {FALSE, NULL, 0};
/* ds get回调函数 */
/* 从ds共享内存中读取,然后填入json字符串 */
S32 ds_cb_get_alarm_plan(struct _DS_HANDLE_CONTEXT *context, JSON_OBJPTR reply_obj)
{
S32 i = 0;
if (NULL == context || NULL == reply_obj)
{
MSG_ALARM_ERROR("ds_cb_get_alarm_plan: ptr is null");
return ERROR;
}
/* 从内存中读取并存入g_msg_alarm_plan结构体中 */
if (0 == ds_read(MSG_ALARM_CHN1_PLAN_PATH, &g_msg_alarm_plan, sizeof(MSG_ALARM_CHN1_PLAN)))
{
MSG_ALARM_ERROR("read from ds shm fail.");
return ERROR;
}
/* 将enabled配置写入json */
jso_add_string(reply_obj, "enabled", g_msg_alarm_plan.enabled ? "on" : "off");
/* 将alarm_plan_num配置写入json */
jso_add_int(reply_obj, "alarm_plan_num", g_msg_alarm_plan.alarm_plan_num);
JSON_OBJPTR alarm_plan_array = jso_new_array();
if(NULL == alarm_plan_array)
{
MSG_ALARM_ERROR("create new array object fail.");
return ERROR;
}
/* 将alarm_plan_1数组配置写入json */
for (i = 0; i < g_msg_alarm_plan.alarm_plan_num; i++)
{
jso_array_add(alarm_plan_array, jso_new_string(g_msg_alarm_plan.alarm_plan_1[i]));
}
jso_obj_add(reply_obj, "alarm_plan_1", alarm_plan_array);
/* 调试:打印json字符串 */
MSG_ALARM_DEBUG(" JSON %s",json_object_to_json_string(reply_obj));
return OK;
}
/* ds set回调函数 */
/* 解析json字符串,然后填入ds共享内存 */
S32 ds_cb_set_alarm_plan(struct _DS_HANDLE_CONTEXT *context, U8 method, const char* section_name, JSON_OBJPTR req_obj, BOOL is_table)
{
S32 i = 0;
S32 ret = OK;
const char *json_value_str = NULL;
if (NULL == context || NULL == section_name || NULL == req_obj)
{
MSG_ALARM_ERROR("ptr is null");
return ERROR;
}
/* 从json中获取enable配置值 */
json_value_str = jso_obj_get_string_origin(req_obj, "enabled");
if (NULL == json_value_str)
{
MSG_ALARM_ERROR("jso_obj_get_string_origin key-enable return NULL");
return ERROR;
}
g_msg_alarm_plan.enabled = 0;
if (0 == strcmp(json_value_str, "on"))
{
g_msg_alarm_plan.enabled = 1;
}
/* 从json中获取alarm_plan_num配置值 */
if (!jso_obj_get_int(req_obj, "alarm_plan_num", &g_msg_alarm_plan.alarm_plan_num))
{
MSG_ALARM_ERROR("jso_obj_get_int key-alarm_plan_num return -1");
return ERROR;
}
/* 如果传入太多,只取前最大plan个数 */
if (g_msg_alarm_plan.alarm_plan_num > ALARM_PLAN_SIZE)
{
MSG_ALARM_ERROR("set too many plans!");
g_msg_alarm_plan.alarm_plan_num = ALARM_PLAN_SIZE;
}
JSON_OBJPTR alarm_plan_array = jso_obj_get(req_obj, "alarm_plan_1");
JSON_OBJPTR alarm_plan_term = jso_new_string("");
if (!jso_is_array(alarm_plan_array))
{
MSG_ALARM_ERROR("key-alarm_plan_1 get non-array");
return ERROR;
}
/* 从json中获取alarm_plan_ch1配置值 */
for (i = 0; i < g_msg_alarm_plan.alarm_plan_num; i++)
{
alarm_plan_term = jso_array_get_idx(req_obj, i);
if (!jso_is_string(alarm_plan_term))
{
MSG_ALARM_ERROR("key-alarm_plan_1[] get non-string");
return ERROR;
}
jso_to_string(alarm_plan_term, g_msg_alarm_plan.alarm_plan_1[i], ALARM_PLAN_STR_MAX_LEN);
}
if (0 == ds_write(MSG_ALARM_CHN1_PLAN_PATH, &g_msg_alarm_plan, sizeof(MSG_ALARM_CHN1_PLAN)))
{
MSG_ALARM_ERROR("ds_write %s error", MSG_ALARM_CHN1_PLAN_PATH);
return ERROR;
}
ret = ds_save_usr_cfg();
MSG_ALARM_DEBUG("ds_save_usr_cfg() ret[%d]", ret);
/* 由于ds暂不支持listConfig的reload,所以这里手动调用 */
if (OK == ret)
{
alarm_plan_reload();
}
return OK;
}
/* ds del回调函数 */
/* 解析json字符串,然后删除ds共享内存结构体中对应的plan */
S32 ds_cb_del_alarm_plan(struct _DS_HANDLE_CONTEXT *context, U8 method, const char* section_name, JSON_OBJPTR req_obj, BOOL is_table)
{
S32 i = 0;
S32 ret = OK;
const char *json_value_str = NULL;
if (NULL == context || NULL == section_name || NULL == req_obj)
{
MSG_ALARM_ERROR("ptr is null");
return ERROR;
}
/* 从内存中读取并存入g_msg_alarm_plan结构体中 */
if (0 == ds_read(MSG_ALARM_CHN1_PLAN_PATH, &g_msg_alarm_plan, sizeof(MSG_ALARM_CHN1_PLAN)))
{
MSG_ALARM_ERROR("read from ds shm fail.");
return ERROR;
}
JSON_OBJPTR alarm_plan_array = jso_obj_get(req_obj, "alarm_plan_1");
JSON_OBJPTR alarm_plan_term = jso_new_string("");
if (!jso_is_array(alarm_plan_array))
{
MSG_ALARM_ERROR("key-alarm_plan_1 get non-array");
return ERROR;
}
/* 删的数量过多,清空plan数组 */
if (0 > (g_msg_alarm_plan.alarm_plan_num - jso_array_length(alarm_plan_array)))
{
for (i = 0; i < g_msg_alarm_plan.alarm_plan_num; i++ )
{
memset(g_msg_alarm_plan.alarm_plan_1[i], 0, ALARM_PLAN_STR_MAX_LEN);
}
MSG_ALARM_ERROR("delete too many plans.");
return ERROR;
}
/* 从json中获取enable配置值 */
json_value_str = jso_obj_get_string_origin(req_obj, "enabled");
if (NULL == json_value_str)
{
MSG_ALARM_ERROR("jso_obj_get_string_origin key-enable return NULL");
return ERROR;
}
if (!strcmp(json_value_str, "on"))
{
g_msg_alarm_plan.enabled = 1;
}
else if (!strcmp(json_value_str, "off"))
{
g_msg_alarm_plan.enabled = 0;
}
else
{
MSG_ALARM_ERROR("set wrong key-enable param");
return ERROR;
}
/* 从json中获取要删除的plan项并删除,并更新alarm_plan_num的值 */
for (i = 0; i < jso_array_length(alarm_plan_array); i++)
{
alarm_plan_term = jso_array_get_idx(req_obj, i);
if (!jso_is_string(alarm_plan_term))
{
MSG_ALARM_ERROR("key-alarm_plan_1[] get non-string");
return ERROR;
}
jso_to_string(alarm_plan_term, json_value_str, ALARM_PLAN_STR_MAX_LEN);
for (int j = 0; j < g_msg_alarm_plan.alarm_plan_num; j++)
{
if (!strncmp(json_value_str, g_msg_alarm_plan.alarm_plan_1[j], strlen(json_value_str)))
{
strncpy(g_msg_alarm_plan.alarm_plan_1[j], g_msg_alarm_plan.alarm_plan_1[g_msg_alarm_plan.alarm_plan_num - 1],
strlen(g_msg_alarm_plan.alarm_plan_1[g_msg_alarm_plan.alarm_plan_num - 1]));
memset(g_msg_alarm_plan.alarm_plan_1[g_msg_alarm_plan.alarm_plan_num - 1], 0, ALARM_PLAN_STR_MAX_LEN);
g_msg_alarm_plan.alarm_plan_num--;
break;
}
}
}
if (0 == ds_write(MSG_ALARM_CHN1_PLAN_PATH, &g_msg_alarm_plan, sizeof(MSG_ALARM_CHN1_PLAN)))
{
MSG_ALARM_ERROR("ds_write %s error", MSG_ALARM_CHN1_PLAN_PATH);
return ERROR;
}
ret = ds_save_usr_cfg();
MSG_ALARM_DEBUG("ds_save_usr_cfg() ret[%d]", ret);
/* 由于ds暂不支持listConfig的reload,所以这里手动调用 */
if (OK == ret)
{
msg_alarm_plan_reload();
}
return OK;
}
/* 注册ds get/set 回调函数 */
S32 registe_ds_cb()
{
S32 ret = OK;
if (ERROR == ds_register_get_json(MSG_ALARM_PLAN_MODULE_NAME, MSG_ALARM_PLAN_TABLE_NAME, MSG_ALARM_PLAN_SECTION_NAME, ds_cb_get_alarm_plan))
{
MSG_ALARM_ERROR("ds_register_get_json return error");
ret = ERROR;
}
if (ERROR == ds_register_set_json(MSG_ALARM_PLAN_MODULE_NAME, MSG_ALARM_PLAN_TABLE_NAME, MSG_ALARM_PLAN_SECTION_NAME, ds_cb_set_alarm_plan))
{
MSG_ALARM_ERROR("ds_register_set_json return error");
ret = ERROR;
}
if (ERROR == ds_register_del_json(MSG_ALARM_PLAN_MODULE_NAME, MSG_ALARM_PLAN_TABLE_NAME, ds_cb_del_alarm_plan))
{
MSG_ALARM_ERROR("ds_register_del_json return error");
ret = ERROR;
}
return ret;
}
/* 获取报警排程 */
PTR_MSG_ALARM_PLAN get_alarm_plan_cfg()
{
return &g_msg_alarm_plan;
}
/* 初始化 */
S32 alarm_plan_init()
{
S32 ret = OK;
/* 注册ds set/get/del回调函数 */
ret = registe_ds_cb();
if (ERROR == ret)
{
MSG_ALARM_ERROR("registe_ds_cb error");
return ret;
}
/* 初始化ds侦测报警排程结构体 */
g_msg_alarm_plan.enabled = FALSE;
g_msg_alarm_plan.alarm_plan_num = 0;
for(int i = 0; i < ALARM_PLAN_SIZE; i++)
{
memset(g_msg_alarm_plan.alarm_plan_1[i], 0, ALARM_PLAN_STR_MAX_LEN);
}
return ret;
}
发生以下错误:make
"make -C modules/msg_alarm MODULE_NAME=msg_alarm"
make[5]: Entering directory '/home/xyc/NVMP/nvmp/build_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/cap/modules/msg_alarm'
arm-AX620E-linux-uclibcgnueabihf-gcc -Os -pipe -D__LINUX_ARM_ARCH__=7 -march=armv7-a -mfloat-abi=hard -Wformat=0 -g -Wno-stringop-truncation -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Wno-sizeof-pointer-div -Wno-restrict -Wno-stringop-overflow -Wno-format-truncation -Wno-format-overflow -Wno-error -g -DMCU_DIGITAL_LIGHT_SENSOR -DMCU_DIGITAL_PIR_SENSOR -DCLOUD_IOT_SUPPORT -DTAPO_USR_DEF_AUDIO_ALARM -DAUDIO_SAMPLE_RATE=16000 -DTAPO_AUDIO_ALARM_SETTINGS -DOPTIONAL_ALARM_AUDIO -DTELEMETRY_SUPPORT -DIR_LED_USE_MCU_ADC -DTP_TAPO_BATTERY_CAM -DTAPO_CARE_SUPPORT -DCONFIG_TARGET_AX620Q -DCONFIG_OPT300X_I2C_ALIAS=\"/dev/i2c-0\" -DSET_FRAME_SUPPORT -DBATTERY_OPERATING_MODE_SUPPORT -DBATTERY_STATISTIC_SUPPORT -DFREQ_WAKE_ABNORMAL_POWER_SUPPORT -DHUB_MANAGE_SUPPORT -DAUDIO_G711_16K_SUPPORT -DNET_STATUS_CHANGE_BITRATE -DNET_STATUS_CHANGE_BITRATE_REALTIME -DBAT_CAPACITY_CURVE_OPTIMIZATION -DPIR_SENSITIVITY_DEF_TABLE=100,91,80,69,48,36,30,28,24,20 -DMCU_CONTROL_MOTOR -DIRCUT_SWITCH_BY_MCU_MSG -DMCU_UART_ALIAS=\"/dev/ttyS3\" -DMCU_UPGRADE_CLEAN_UART -DMAX_BAT_MODEL=2 -DLOWER_IR_BEFORE_POWER_OFF -DJPEG_STREAM_ENABLE -DPTZ_SUPPORT -DGET_SNAPSHOT_ACCURATE -DSNAPSHOT_JPEG_HEIGHT=360 -DWLAN_SUPPORT -DLINUX_VERSION=4.19.125 -DTP_TAPO_RESET_WIFI_SUPPORT -I/home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include -I/home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/include -I/home/xyc/NVMP/nvmp/../sdk/soc/AX620Q/uclibc-toolchain/arm-AX620E-linux-uclibcgnueabihf/arm-AX620E-linux-uclibcgnueabihf/libc/usr/include -Wall -Werror -ffunction-sections -fdata-sections -DMODULE_LIST="\"general_plan mcu_proxy osd image dn_switch cover video battery_manage msg_alarm hsr md_alarm ptd_alarm vd_alarm speaker sd_card record_plan alarm_clock audio_library detection_region ptz light_control\"" -DTSS_MODULE_LIST="\"\"" -I/home/xyc/NVMP/nvmp/build_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/cap -c -o alarm_plan_ds.o alarm_plan_ds.c
alarm_plan_ds.c:17:54: error: initialization of 'char' from 'void *' makes integer from pointer without a cast [-Werror=int-conversion]
LOCAL MSG_ALARM_CHN1_PLAN g_msg_alarm_plan = {FALSE, NULL, 0};
^~~~
alarm_plan_ds.c:17:54: note: (near initialization for 'g_msg_alarm_plan.alarm_plan_1[0]')
alarm_plan_ds.c:17:46: error: missing braces around initializer [-Werror=missing-braces]
LOCAL MSG_ALARM_CHN1_PLAN g_msg_alarm_plan = {FALSE, NULL, 0};
^
In file included from alarm_plan_ds.c:9:
alarm_plan_ds.c: In function 'ds_cb_get_alarm_plan':
msg_alarm.h:59:36: error: implicit declaration of function 'CAP_ERROR'; did you mean 'MC_ERROR'? [-Werror=implicit-function-declaration]
#define MSG_ALARM_ERROR(fmt, ...) CAP_ERROR("[MSG_ALARM]" fmt , ##__VA_ARGS__)
^~~~~~~~~
alarm_plan_ds.c:27:3: note: in expansion of macro 'MSG_ALARM_ERROR'
MSG_ALARM_ERROR("ds_cb_get_alarm_plan: ptr is null");
^~~~~~~~~~~~~~~
alarm_plan_ds.c:54:85: error: passing argument 1 of 'jso_new_string' makes pointer from integer without a cast [-Werror=int-conversion]
jso_array_add(alarm_plan_array, jso_new_string(g_msg_alarm_plan.alarm_plan_1[i]));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/json/json.h:26,
from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/libds.h:7,
from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/slp_model.h:7,
from alarm_plan_ds.c:7:
/home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/json/json_api.h:35:41: note: expected 'char *' but argument is of type 'char'
extern JSON_OBJPTR jso_new_string(char *str);
~~~~~~^~~
In file included from alarm_plan_ds.c:9:
msg_alarm.h:57:36: error: implicit declaration of function 'CAP_DEBUG'; did you mean 'MC_DEBUG'? [-Werror=implicit-function-declaration]
#define MSG_ALARM_DEBUG(fmt, ...) CAP_DEBUG("[MSG_ALARM]" fmt, ##__VA_ARGS__)
^~~~~~~~~
alarm_plan_ds.c:59:2: note: in expansion of macro 'MSG_ALARM_DEBUG'
MSG_ALARM_DEBUG(" JSON %s",json_object_to_json_string(reply_obj));
^~~~~~~~~~~~~~~
alarm_plan_ds.c: In function 'ds_cb_set_alarm_plan':
alarm_plan_ds.c:100:43: error: 'ALARM_PLAN_SIZE' undeclared (first use in this function); did you mean 'ALARM_STATE_IDLE'?
if (g_msg_alarm_plan.alarm_plan_num > ALARM_PLAN_SIZE)
^~~~~~~~~~~~~~~
ALARM_STATE_IDLE
alarm_plan_ds.c:100:43: note: each undeclared identifier is reported only once for each function it appears in
alarm_plan_ds.c:124:69: error: passing argument 2 of 'jso_to_string' makes pointer from integer without a cast [-Werror=int-conversion]
jso_to_string(alarm_plan_term, g_msg_alarm_plan.alarm_plan_1[i], ALARM_PLAN_STR_MAX_LEN);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/json/json.h:26,
from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/libds.h:7,
from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/slp_model.h:7,
from alarm_plan_ds.c:7:
/home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/json/json_api.h:40:49: note: expected 'char *' but argument is of type 'char'
extern int jso_to_string(JSON_OBJPTR obj, char *str_buf, int len);
~~~~~~^~~~~~~
alarm_plan_ds.c:139:3: error: implicit declaration of function 'alarm_plan_reload' [-Werror=implicit-function-declaration]
alarm_plan_reload();
^~~~~~~~~~~~~~~~~
alarm_plan_ds.c: In function 'ds_cb_del_alarm_plan':
alarm_plan_ds.c:180:49: error: passing argument 1 of 'memset' makes pointer from integer without a cast [-Werror=int-conversion]
memset(g_msg_alarm_plan.alarm_plan_1[i], 0, ALARM_PLAN_STR_MAX_LEN);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from alarm_plan_ds.c:3:
/home/xyc/NVMP/sdk/soc/AX620Q/uclibc-toolchain/arm-AX620E-linux-uclibcgnueabihf/arm-AX620E-linux-uclibcgnueabihf/sysroot/usr/include/string.h:58:14: note: expected 'void *' but argument is of type 'char'
extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
^~~~~~
alarm_plan_ds.c:218:40: error: passing argument 2 of 'jso_to_string' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
jso_to_string(alarm_plan_term, json_value_str, ALARM_PLAN_STR_MAX_LEN);
^~~~~~~~~~~~~~
In file included from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/json/json.h:26,
from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/libds.h:7,
from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/slp_model.h:7,
from alarm_plan_ds.c:7:
/home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/json/json_api.h:40:49: note: expected 'char *' but argument is of type 'const char *'
extern int jso_to_string(JSON_OBJPTR obj, char *str_buf, int len);
~~~~~~^~~~~~~
alarm_plan_ds.c:221:71: error: passing argument 2 of 'strncmp' makes pointer from integer without a cast [-Werror=int-conversion]
if (!strncmp(json_value_str, g_msg_alarm_plan.alarm_plan_1[j], strlen(json_value_str)))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from alarm_plan_ds.c:3:
/home/xyc/NVMP/sdk/soc/AX620Q/uclibc-toolchain/arm-AX620E-linux-uclibcgnueabihf/arm-AX620E-linux-uclibcgnueabihf/sysroot/usr/include/string.h:101:51: note: expected 'const char *' but argument is of type 'char'
extern int strncmp (const char *__s1, const char *__s2, size_t __n)
~~~~~~~~~~~~^~~~
alarm_plan_ds.c:224:61: error: passing argument 1 of 'strlen' makes pointer from integer without a cast [-Werror=int-conversion]
strlen(g_msg_alarm_plan.alarm_plan_1[g_msg_alarm_plan.alarm_plan_num - 1]));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from alarm_plan_ds.c:3:
/home/xyc/NVMP/sdk/soc/AX620Q/uclibc-toolchain/arm-AX620E-linux-uclibcgnueabihf/arm-AX620E-linux-uclibcgnueabihf/sysroot/usr/include/string.h:247:35: note: expected 'const char *' but argument is of type 'char'
extern size_t strlen (const char *__s)
~~~~~~~~~~~~^~~
alarm_plan_ds.c:223:54: error: passing argument 1 of 'strncpy' makes pointer from integer without a cast [-Werror=int-conversion]
strncpy(g_msg_alarm_plan.alarm_plan_1[j], g_msg_alarm_plan.alarm_plan_1[g_msg_alarm_plan.alarm_plan_num - 1],
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from alarm_plan_ds.c:3:
/home/xyc/NVMP/sdk/soc/AX620Q/uclibc-toolchain/arm-AX620E-linux-uclibcgnueabihf/arm-AX620E-linux-uclibcgnueabihf/sysroot/usr/include/string.h:86:14: note: expected 'char * restrict' but argument is of type 'char'
extern char *strncpy (char *__restrict __dest,
^~~~~~~
alarm_plan_ds.c:223:88: error: passing argument 2 of 'strncpy' makes pointer from integer without a cast [-Werror=int-conversion]
strncpy(g_msg_alarm_plan.alarm_plan_1[j], g_msg_alarm_plan.alarm_plan_1[g_msg_alarm_plan.alarm_plan_num - 1],
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from alarm_plan_ds.c:3:
/home/xyc/NVMP/sdk/soc/AX620Q/uclibc-toolchain/arm-AX620E-linux-uclibcgnueabihf/arm-AX620E-linux-uclibcgnueabihf/sysroot/usr/include/string.h:86:14: note: expected 'const char * restrict' but argument is of type 'char'
extern char *strncpy (char *__restrict __dest,
^~~~~~~
alarm_plan_ds.c:225:53: error: passing argument 1 of 'memset' makes pointer from integer without a cast [-Werror=int-conversion]
memset(g_msg_alarm_plan.alarm_plan_1[g_msg_alarm_plan.alarm_plan_num - 1], 0, ALARM_PLAN_STR_MAX_LEN);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from alarm_plan_ds.c:3:
/home/xyc/NVMP/sdk/soc/AX620Q/uclibc-toolchain/arm-AX620E-linux-uclibcgnueabihf/arm-AX620E-linux-uclibcgnueabihf/sysroot/usr/include/string.h:58:14: note: expected 'void *' but argument is of type 'char'
extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
^~~~~~
alarm_plan_ds.c:244:3: error: implicit declaration of function 'msg_alarm_plan_reload'; did you mean 'msg_alarm_type_filter'? [-Werror=implicit-function-declaration]
msg_alarm_plan_reload();
^~~~~~~~~~~~~~~~~~~~~
msg_alarm_type_filter
alarm_plan_ds.c: In function 'registe_ds_cb':
alarm_plan_ds.c:268:94: error: passing argument 3 of 'ds_register_del_json' from incompatible pointer type [-Werror=incompatible-pointer-types]
if (ERROR == ds_register_del_json(MSG_ALARM_PLAN_MODULE_NAME, MSG_ALARM_PLAN_TABLE_NAME, ds_cb_del_alarm_plan))
^~~~~~~~~~~~~~~~~~~~
In file included from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/libds.h:12,
from /home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/slp_model.h:7,
from alarm_plan_ds.c:7:
/home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/usr/include/ds_model.h:252:87: note: expected 'DEL_JSON' {aka 'int (*)(struct _DS_HANDLE_CONTEXT *, struct json_object *, enum _BOOL)'} but argument is of type 'S32 (*)(struct _DS_HANDLE_CONTEXT *, U8, const char *, struct json_object *, BOOL)' {aka 'int (*)(struct _DS_HANDLE_CONTEXT *, unsigned char, const char *, struct json_object *, enum _BOOL)'}
STATUS ds_register_del_json(const char *module_name, const char *table_name, DEL_JSON del_json);
~~~~~~~~~^~~~~~~~
alarm_plan_ds.c: In function 'alarm_plan_init':
alarm_plan_ds.c:299:24: error: 'ALARM_PLAN_SIZE' undeclared (first use in this function); did you mean 'ALARM_STATE_IDLE'?
for(int i = 0; i < ALARM_PLAN_SIZE; i++)
^~~~~~~~~~~~~~~
ALARM_STATE_IDLE
alarm_plan_ds.c:301:45: error: passing argument 1 of 'memset' makes pointer from integer without a cast [-Werror=int-conversion]
memset(g_msg_alarm_plan.alarm_plan_1[i], 0, ALARM_PLAN_STR_MAX_LEN);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from alarm_plan_ds.c:3:
/home/xyc/NVMP/sdk/soc/AX620Q/uclibc-toolchain/arm-AX620E-linux-uclibcgnueabihf/arm-AX620E-linux-uclibcgnueabihf/sysroot/usr/include/string.h:58:14: note: expected 'void *' but argument is of type 'char'
extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
^~~~~~
cc1: all warnings being treated as errors
<builtin>: recipe for target 'alarm_plan_ds.o' failed
make[5]: *** [alarm_plan_ds.o] Error 1
make[5]: Leaving directory '/home/xyc/NVMP/nvmp/build_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/cap/modules/msg_alarm'
Makefile:32: recipe for target 'build_modules' failed
make[4]: *** [build_modules] Error 2
make[4]: Leaving directory '/home/xyc/NVMP/nvmp/build_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/cap'
Makefile:758: recipe for target '/home/xyc/NVMP/nvmp/build_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/cap/.built' failed
make[3]: *** [/home/xyc/NVMP/nvmp/build_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/cap/.built] Error 2
make[3]: Leaving directory '/home/xyc/NVMP/nvmp/tp_package/cap'
package/Makefile:105: recipe for target 'package/tp_package/cap/compile' failed
make[2]: *** [package/tp_package/cap/compile] Error 2
make[2]: Leaving directory '/home/xyc/NVMP/nvmp'
package/Makefile:101: recipe for target '/home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/stamp/.package_compile' failed
make[1]: *** [/home/xyc/NVMP/nvmp/staging_dir/target-arm-AX620E-linux-uclibcgnueabihf-c668bv1/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/xyc/NVMP/nvmp'
/home/xyc/NVMP/nvmp/include/toplevel.mk:210: recipe for target 'world' failed
make: *** [world] Error 2