Commit 5604b305 authored by chen.weican's avatar chen.weican

【修改内容】一些bug修改

【提交人】陈伟灿
parent 9da143b4
......@@ -115,16 +115,15 @@ void KK_reset_sub_flag(void)
int KK_CCU_TOPIC_Subscribe(void)
{
char productCode[PRODUCT_CODE_LEN] = {0};
char deviceCode[MAC_ADDR_LEN] = {0};
if(s_ccu_topic_sub == 1){
INFO_PRINT("[%s][%d] already Subscribe\n",__FUNCTION__,__LINE__);
return -1;
//return -1;
}
char ccuid[32] = {0};
KK_Get_ccuid(ccuid);
s_ccu_topic_sub = 1;
HAL_GetProduct_Code(productCode);
HAL_Get_mac(deviceCode);
return _kk_ccu_topic_subscribe(productCode,ccuid);
}
......
......@@ -505,7 +505,7 @@ int kk_lan_device_delete_notify(cJSON *payload)
}
if((deviceCode = cJSON_GetObjectItem(params, "deviceCode"))==NULL||
params->type!=cJSON_String){
deviceCode->type!=cJSON_String){
debug_log(LOG_DEBUG,"[err] deviceCode.\n");
return -1;
}
......
......@@ -351,10 +351,10 @@ int kk_topo_delete_handle(cJSON *payload,cJSON *buf)
cJSON_AddItemToObject(rootData,"payload",payload);
char *pnewout=cJSON_Print(rootData);
kk_sendData2gw(pnewout, strlen(pnewout), node->fatherDeviceCode);//send to gw itself
dm_mgr_subdev_delete(deviceCode);
free(pnewout);
cJSON_Delete(rootData);
dm_mgr_subdev_delete(deviceCode);
item = item->next;
return SUCCESS_RETURN;
}
}
......@@ -1094,9 +1094,10 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
char *payload_Str = NULL;
cJSON *deviceCode = NULL;
json=cJSON_Parse(data);
_iotx_linkkit_mutex_lock();
if (json == NULL) {
WARNING_PRINT("Error before: [%s]\n","cJSON_Parse");
_iotx_linkkit_mutex_unlock();
return;
}
info_root = cJSON_GetObjectItem(json, MSG_INFO_STR);
......@@ -1370,6 +1371,7 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
directReturn:
free(payload_Str);
cJSON_Delete(json);
_iotx_linkkit_mutex_unlock();
}
/************************************************************
......
......@@ -228,8 +228,6 @@ static int _kk_check_door_induction_device(char *productCode){
int kk_property_db_insert(const char *deviceCode,const char *identifier,kk_tsl_data_type_e valuetype,int devtype)
{
printf("---------------------------------------->identifier:%s\n",identifier);
dm_mgr_dev_node_t *node = NULL;
int res = 0 ;
const char *insertCmd = "insert into PropertiesInfo (deviceCode,identifier,value,valueType,devType) \
......@@ -238,12 +236,10 @@ int kk_property_db_insert(const char *deviceCode,const char *identifier,kk_tsl_d
int rc = 0;
char *zErrMsg = 0;
kk_property_db_ctx_t *ctx = _kk_property_db_get_ctx();
printf("---------------------------------------->1\n");
if(_kk_check_property_exist(deviceCode,identifier) == 1)
{
return SUCCESS_RETURN;
}
printf("---------------------------------------->2\n");
_kk_property_db_lock();
//传感器类默认安防等级为离家安防
if(strcmp(identifier,"SensorType") == 0 && devtype == KK_DM_DEVICE_SUBDEV){
......@@ -251,12 +247,10 @@ int kk_property_db_insert(const char *deviceCode,const char *identifier,kk_tsl_d
if (res != SUCCESS_RETURN) {
return FAIL_RETURN;
}
printf("---------------------------------------->3\n");
if(_kk_check_human_induction_device(node->productCode) == 1 || //门磁和人体默认室外安防
_kk_check_door_induction_device(node->productCode) == 1){
sqlCmd = sqlite3_mprintf(insertCmd,deviceCode,identifier,"1",valuetype,devtype);
}else{
printf("---------------------------------------->\n");
sqlCmd = sqlite3_mprintf(insertCmd,deviceCode,identifier,"2",valuetype,devtype);//其他24小时警戒
}
}else{
......
......@@ -783,6 +783,7 @@ void kk_platMsg_handle(void* data, char* chalMark){
if(sceneSupportStr != NULL&&!strcmp(sceneSupportStr->valuestring,"1")){
kk_subDev_update_sceneSupport(1,devCode->valuestring);
}
kk_dm_gw_status_update_online(info_dcode->valuestring);
}else{
kk_mid_subdev_add(KK_DM_DEVICE_SUBDEV,proCode->valuestring,devCode->valuestring, mac->valuestring,info_dcode->valuestring);
}
......
#!/bin/sh
#filepath="/home/kk"
filepath="/app/nx5Apps"
if [ ! -f "/sbin/jq" ]
then
cp /app/ccuApps/jq /sbin
cp $filepath/jq /sbin
fi
if [ -f "/app/nx5Apps/syscfg.json" ]
if [ -f "$filepath/syscfg.json" ]
then
if [ ! -f "/data/syscfg.json" ]
then
cp /app/nx5Apps/syscfg.json /data
cp $filepath/syscfg.json /data
fi
embbedflag=`cat /data/syscfg.json|jq ."ccuembbed"`
#embbedflag="0"
......@@ -19,9 +21,9 @@ then
fi
fi
nanomsg_File="/app/ccuApps/lib/libnanomsg.so.5"
ev_File="/app/ccuApps/lib/libev.so.4"
sqlite_File="/app/ccuApps/lib/libsqlite3.so.0"
nanomsg_File="$filepath/lib/libnanomsg.so.5"
ev_File="$filepath/lib/libev.so.4"
sqlite_File="$filepath/lib/libsqlite3.so.0"
run_Dir="/data/kk"
tsl_Dir="${run_Dir}/tsl"
......@@ -38,36 +40,36 @@ if [ ! -d "$run_Dir" ]; then
fi
if [ ! -d "$tsl_Dir" ]; then
cp -rf /app/ccuApps/tsl ${run_Dir}/
cp -rf $filepath/tsl ${run_Dir}/
fi
if [ ! -d "$map_Dir" ]; then
cp -rf /app/ccuApps/map ${run_Dir}/
cp -rf $filepath/map ${run_Dir}/
fi
cd /app/ccuApps/lib
cd $filepath/lib
if [ ! -f "$nanomsg_File" ]; then
ln -sf /app/ccuApps/lib/libnanomsg.so /lib/libnanomsg.so.5
ln -sf $filepath/lib/libnanomsg.so /lib/libnanomsg.so.5
fi
if [ ! -f "$ev_File" ]; then
ln -sf /app/ccuApps/lib/libev.so /lib/libev.so.4
ln -sf $filepath/lib/libev.so /lib/libev.so.4
fi
if [ ! -f "$sqlite_File" ]; then
ln -sf /app/ccuApps/lib/libsqlite3.so /lib/libsqlite3.so.0
ln -sf $filepath/lib/libsqlite3.so /lib/libsqlite3.so.0
fi
export LD_LIBRARY_PATH=/app/ccuApps/lib
export LD_LIBRARY_PATH=$filepath/lib
/app/ccuApps/bin/kk_midware &
$filepath/bin/kk_midware &
sleep 3
/app/ccuApps/bin/kk_cloud &
$filepath/bin/kk_cloud &
sleep 1
#/home/kk/process_check.sh >/dev/null 2>&1 &
/app/ccuApps/bin/smarthome_z3gw_nx5 -r0 -l3 --device-def=/app/ccuApps/kk_device_def.json --db=/data/kk/kk_z3gw.db --uart=/dev/ttyS1&
$filepath/bin/smarthome_z3gw_nx5 -r0 -l3 --device-def=$filepath/kk_device_def.json --db=/data/kk/kk_z3gw.db --uart=/dev/ttyS1&
sleep 2
/app/ccuApps/bin/kk_lan &
$filepath/bin/kk_lan &
sleep 1
echo "*/1 * * * * /app/ccuApps/process_check.sh" > /etc/cron.d/ccu || { echo "ERROR:add ccu crontab rule failed."; exit 1;}
#echo "*/1 * * * * /app/ccuApps/process_check.sh" > /etc/cron.d/ccu || { echo "ERROR:add ccu crontab rule failed."; exit 1;}
ntpd -n -q -d -p stdtime.gov.hk &
exit 0
\ No newline at end of file
......@@ -210,6 +210,7 @@ package:
cp -rf $(TOP_DIR)/process_check.sh $(TOP_DIR)/$(releaseDir)/
cp -rf $(TOP_DIR)/onboot.sh $(TOP_DIR)/$(releaseDir)/
cp -rf $(TOP_DIR)/killall.sh $(TOP_DIR)/$(releaseDir)/
cp -rf $(TOP_DIR)/VERSION $(TOP_DIR)/$(releaseDir)/
cp -rf $(TOP_DIR)/opcodeMapCfg/* $(TOP_DIR)/$(releaseDir)/map
#cp -rf $(TOP_DIR)/platform/zigbee/app/builder/Z3GatewayHost/ZB/dev_config_table $(TOP_DIR)/$(releaseDir)/
......@@ -218,6 +219,7 @@ ifeq ($(CONFIG_MODEL),ubuntu)
cp -rf $(TOP_DIR)/common/nanomsg/libnanomsg_ubuntu.so $(TOP_DIR)/$(releaseDir)/lib/libnanomsg.so.5
cp -rf $(TOP_DIR)/common/ev/libev_ubuntu.so $(TOP_DIR)/$(releaseDir)/lib
else ifeq ($(CONFIG_MODEL),nx5)
cp -rf $(TOP_DIR)/jq $(TOP_DIR)/$(releaseDir)/
cp -rf $(TOP_DIR)/common/nanomsg/libnanomsg_nx5.so $(TOP_DIR)/$(releaseDir)/lib/libnanomsg.so
cp -rf $(TOP_DIR)/common/ev/libev_nx5.so $(TOP_DIR)/$(releaseDir)/lib/libev.so
cp -rf $(TOP_DIR)/common/sqlite/libsqlite3_nx5.so $(TOP_DIR)/$(releaseDir)/lib/libsqlite3.so
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment