Commit 93d95f0b authored by 陈伟灿's avatar 陈伟灿

Merge branch 'cwc' into 'master'

Cwc

See merge request chenweican/k-sdk!118
parents 4d9d15b7 298ae08d
...@@ -62,7 +62,7 @@ static int kk_info_get(char *str) ...@@ -62,7 +62,7 @@ static int kk_info_get(char *str)
cJSON_AddItemToObject(args, "ccu", ccu); cJSON_AddItemToObject(args, "ccu", ccu);
cJSON_AddStringToObject(ccu, "id", &ccuid[4]); cJSON_AddStringToObject(ccu, "id", &ccuid[4]);
cJSON_AddStringToObject(ccu, "version", version); cJSON_AddStringToObject(ccu, "version", "1.1.1");
cJSON_AddStringToObject(ccu, "name", "kk_new_ccu"); cJSON_AddStringToObject(ccu, "name", "kk_new_ccu");
//INFO_PRINT("---222kk_get_cloud_status():%d\n",kk_get_cloud_status()); //INFO_PRINT("---222kk_get_cloud_status():%d\n",kk_get_cloud_status());
//if(kk_get_gw_status() == DEVICE_OFFLINE){ //if(kk_get_gw_status() == DEVICE_OFFLINE){
......
...@@ -115,16 +115,15 @@ void KK_reset_sub_flag(void) ...@@ -115,16 +115,15 @@ void KK_reset_sub_flag(void)
int KK_CCU_TOPIC_Subscribe(void) int KK_CCU_TOPIC_Subscribe(void)
{ {
char productCode[PRODUCT_CODE_LEN] = {0}; char productCode[PRODUCT_CODE_LEN] = {0};
char deviceCode[MAC_ADDR_LEN] = {0};
if(s_ccu_topic_sub == 1){ if(s_ccu_topic_sub == 1){
INFO_PRINT("[%s][%d] already Subscribe\n",__FUNCTION__,__LINE__); INFO_PRINT("[%s][%d] already Subscribe\n",__FUNCTION__,__LINE__);
return -1; //return -1;
} }
char ccuid[32] = {0}; char ccuid[32] = {0};
KK_Get_ccuid(ccuid); KK_Get_ccuid(ccuid);
s_ccu_topic_sub = 1; s_ccu_topic_sub = 1;
HAL_GetProduct_Code(productCode); HAL_GetProduct_Code(productCode);
HAL_Get_mac(deviceCode);
return _kk_ccu_topic_subscribe(productCode,ccuid); return _kk_ccu_topic_subscribe(productCode,ccuid);
} }
......
...@@ -198,8 +198,8 @@ int devOpen(char *dev) ...@@ -198,8 +198,8 @@ int devOpen(char *dev)
if(fd == -1) if(fd == -1)
{ {
SERIAL_LOG_ERR("devOpen %s\n ",dev); //SERIAL_LOG_ERR("devOpen %s\n ",dev);
perror("devOpen"); //perror("devOpen");
return -1; return -1;
} }
......
...@@ -115,7 +115,27 @@ cJSON * kk_control_protocol_convert(kk_map_dev_node_t *devNode,int nodeId,cJSON ...@@ -115,7 +115,27 @@ cJSON * kk_control_protocol_convert(kk_map_dev_node_t *devNode,int nodeId,cJSON
return params; return params;
} }
static int kk_guard_ctrl_handle(int status)
{
char ccuid[33]={0};
kk_lan_get_ccuid(ccuid);
cJSON *root = cJSON_CreateObject();
cJSON *params = cJSON_CreateObject();
cJSON_AddStringToObject(params,"epNum","1");
if(status == 0){ //
cJSON_AddStringToObject(params,"ArmingState","0");
}else if(status == 2){ //ڼ
cJSON_AddStringToObject(params,"ArmingState","2");
}else{ //
cJSON_AddStringToObject(params,"ArmingState","1");
}
cJSON *info = property_info_build("/thing/service/property/set",KK_CCU_PRODUCTID,ccuid);
cJSON *payload = property_payload_build("thing.service.property.set","1","v1.0",params);
cJSON_AddItemToObject(root,INFO_STRING,info);
cJSON_AddItemToObject(root,PAYLOAD_STRING,payload);
kk_ipc_send_json(root);
return 0;
}
static int kk_indoorAir_ctrl_handle(char *epNum,cJSON *arg) static int kk_indoorAir_ctrl_handle(char *epNum,cJSON *arg)
{ {
kk_map_dev_node_t *dev = NULL; kk_map_dev_node_t *dev = NULL;
...@@ -202,6 +222,17 @@ int kk_ccu_opcode_handle(cJSON *root) ...@@ -202,6 +222,17 @@ int kk_ccu_opcode_handle(cJSON *root)
kk_indoorAir_ctrl_handle(nodeId->valuestring,arg); kk_indoorAir_ctrl_handle(nodeId->valuestring,arg);
return 0; return 0;
}else if(strcmp(requester->valuestring,"HJ_Server") == 0){
if(strcmp(opcode->valuestring,"ARMING_IN_HOME") == 0){
kk_guard_ctrl_handle(2);
return 0;
}else if(strcmp(opcode->valuestring,"ARMING_LEAVE_HOME") == 0){
kk_guard_ctrl_handle(0);
return 0;
}else if(strcmp(opcode->valuestring,"DISARMING") == 0){
kk_guard_ctrl_handle(1);
return 0;
}
} }
} }
......
...@@ -315,7 +315,7 @@ void *kk_vp_manage_thread(void *arg) ...@@ -315,7 +315,7 @@ void *kk_vp_manage_thread(void *arg)
break; break;
case UPDATING_8009_CONFIG_FILE_INFO: case UPDATING_8009_CONFIG_FILE_INFO:
debug_log(LOG_INFO_LEVEL,"updating...\n"); //debug_log(LOG_INFO,"updating...\n");
sleep(1); sleep(1);
//todo :超时取消 //todo :超时取消
break; break;
......
...@@ -67,7 +67,7 @@ int send_msg_to_module(cJSON *root) ...@@ -67,7 +67,7 @@ int send_msg_to_module(cJSON *root)
} }
if((msg = cJSON_Print(root))!=NULL){ if((msg = cJSON_Print(root))!=NULL){
debug_log(LOG_INFO_LEVEL,"[lan->module]\n%s\n",msg); debug_log(LOG_INFO,"[lan->module]\n%s\n",msg);
cJSON_Minify(msg); cJSON_Minify(msg);
kk_send_data_to_sdk(msg); kk_send_data_to_sdk(msg);
free(msg); free(msg);
...@@ -90,14 +90,13 @@ cJSON * val_conver_new2old(cJSON *newccuItem,cJSON *oldccuItem,int syn_type) ...@@ -90,14 +90,13 @@ cJSON * val_conver_new2old(cJSON *newccuItem,cJSON *oldccuItem,int syn_type)
if(newccuItem==NULL||newccuItem->type!=cJSON_Object|| if(newccuItem==NULL||newccuItem->type!=cJSON_Object||
oldccuItem==NULL||oldccuItem->type!=cJSON_Object){ oldccuItem==NULL||oldccuItem->type!=cJSON_Object){
debug_log(LOG_DEBUG_LEVEL,"[err] para.\n"); debug_log(LOG_DEBUG,"[err] para.\n");
return NULL; return NULL;
} }
o_valueRange = cJSON_GetObjectItem(oldccuItem,"valueRange"); o_valueRange = cJSON_GetObjectItem(oldccuItem,"valueRange");
n_valueRange = cJSON_GetObjectItem(newccuItem,"valueRange"); n_valueRange = cJSON_GetObjectItem(newccuItem,"valueRange");
n_dataType = cJSON_GetObjectItem(newccuItem,DATATYPE_STRING); n_dataType = cJSON_GetObjectItem(newccuItem,DATATYPE_STRING);
n_value = cJSON_GetObjectItem(newccuItem,"value"); n_value = cJSON_GetObjectItem(newccuItem,"value");
...@@ -106,7 +105,6 @@ cJSON * val_conver_new2old(cJSON *newccuItem,cJSON *oldccuItem,int syn_type) ...@@ -106,7 +105,6 @@ cJSON * val_conver_new2old(cJSON *newccuItem,cJSON *oldccuItem,int syn_type)
}else{ }else{
o_dataType = cJSON_GetObjectItem(oldccuItem,DATATYPE_STRING); o_dataType = cJSON_GetObjectItem(oldccuItem,DATATYPE_STRING);
} }
return ccu_value_convert(n_dataType,n_valueRange,o_dataType,o_valueRange,n_value); return ccu_value_convert(n_dataType,n_valueRange,o_dataType,o_valueRange,n_value);
} }
...@@ -115,37 +113,17 @@ static int _kk_lan_update_device_status(int nodeId,cJSON *opcode,cJSON *arg) ...@@ -115,37 +113,17 @@ static int _kk_lan_update_device_status(int nodeId,cJSON *opcode,cJSON *arg)
{ {
cJSON *msg = NULL; cJSON *msg = NULL;
char nodeBuff[33] = {0}; char nodeBuff[33] = {0};
char valBuff[33] = {0};
if(opcode==NULL||opcode->type!=cJSON_String|| if(opcode==NULL||opcode->type!=cJSON_String||
arg==NULL){ arg==NULL||arg->type!=cJSON_String){
debug_log(LOG_DEBUG_LEVEL,"[err] para.\n"); debug_log(LOG_DEBUG,"[err] para.\n");
return -1; return -1;
} }
memset(nodeBuff,0,sizeof(nodeBuff)); debug_log(LOG_FOCUS,"nodeId=%d,opcode=%s,arg=%s\n",nodeId,opcode->valuestring,arg->valuestring);
snprintf(nodeBuff,32,"%d",nodeId);
memset(nodeBuff,0,sizeof(nodeBuff)); memset(nodeBuff,0,sizeof(nodeBuff));
memset(valBuff,0,sizeof(valBuff)); snprintf(nodeBuff,32,"%d",nodeId);
if(arg->type==cJSON_String){
debug_log(LOG_FOCUS_LEVEL,"nodeId=%d,opcode=%s,arg=%s\n",nodeId,opcode->valuestring,arg->valuestring);
snprintf(valBuff,sizeof(valBuff),"%s",arg->valuestring);
}else if(arg->type==cJSON_Number){
if(((int)(arg->valuedouble*10))%10==0){
debug_log(LOG_FOCUS_LEVEL,"nodeId=%d,opcode=%s,arg=%d\n",nodeId,opcode->valuestring,arg->valueint);
snprintf(valBuff,sizeof(valBuff),"%d",arg->valueint);
}else{
debug_log(LOG_FOCUS_LEVEL,"nodeId=%d,opcode=%s,arg=%f\n",nodeId,opcode->valuestring,arg->valuedouble);
snprintf(valBuff,sizeof(valBuff),"%f",arg->valuedouble);
}
}else if(arg->type==cJSON_True){
snprintf(valBuff,sizeof(valBuff),"%s","true");
}else if(arg->type==cJSON_True){
snprintf(valBuff,sizeof(valBuff),"%s","false");
}
msg = old_ccu_msg_build(nodeBuff,opcode->valuestring,"success",arg->valuestring); msg = old_ccu_msg_build(nodeBuff,opcode->valuestring,"success",arg->valuestring);
send_msg_to_module(msg); send_msg_to_module(msg);
...@@ -161,7 +139,7 @@ static int _kk_lan_check_channel(cJSON *channelObj,cJSON *epNumObj) ...@@ -161,7 +139,7 @@ static int _kk_lan_check_channel(cJSON *channelObj,cJSON *epNumObj)
if(channelObj!=NULL && epNumObj!=NULL){ if(channelObj!=NULL && epNumObj!=NULL){
if(epNumObj->type!=cJSON_String){ if(epNumObj->type!=cJSON_String){
debug_log(LOG_INFO_LEVEL,"[err] epNumObj.\n"); debug_log(LOG_INFO,"[err] epNumObj.\n");
return -1; return -1;
} }
if(strlen(channelObj->valuestring)!=strlen(epNumObj->valuestring) || if(strlen(channelObj->valuestring)!=strlen(epNumObj->valuestring) ||
...@@ -173,13 +151,13 @@ static int _kk_lan_check_channel(cJSON *channelObj,cJSON *epNumObj) ...@@ -173,13 +151,13 @@ static int _kk_lan_check_channel(cJSON *channelObj,cJSON *epNumObj)
}else{ }else{
if(channelObj==NULL){ if(channelObj==NULL){
if(epNumObj->type!=cJSON_String){ if(epNumObj->type!=cJSON_String){
debug_log(LOG_INFO_LEVEL,"[err] epNumObj.\n"); debug_log(LOG_INFO,"[err] epNumObj.\n");
return -1; return -1;
} }
channel = atoi(epNumObj->valuestring); channel = atoi(epNumObj->valuestring);
}else if(epNumObj==NULL){ }else if(epNumObj==NULL){
if(channelObj->type!=cJSON_String){ if(channelObj->type!=cJSON_String){
debug_log(LOG_INFO_LEVEL,"[err] channelObj.\n"); debug_log(LOG_INFO,"[err] channelObj.\n");
return -1; return -1;
} }
channel = atoi(channelObj->valuestring); channel = atoi(channelObj->valuestring);
...@@ -205,15 +183,15 @@ static int _kk_lan_sync_device_status(const char *deviceCode,kk_map_dev_node_t * ...@@ -205,15 +183,15 @@ static int _kk_lan_sync_device_status(const char *deviceCode,kk_map_dev_node_t *
} }
if((arg =_kk_sync_devicestatus_arg_build(devNode))==NULL){ if((arg =_kk_sync_devicestatus_arg_build(devNode))==NULL){
debug_log(LOG_DEBUG_LEVEL,"[err] arg.\n"); debug_log(LOG_DEBUG,"[err] arg.\n");
return -1; return -1;
} }
if((nodeId = kk_lan_db_node_get(deviceCode,1))==-1){ if((nodeId = kk_lan_db_node_get(deviceCode,1))==-1){
debug_log(LOG_DEBUG_LEVEL,"[err] nodeId.\n"); debug_log(LOG_DEBUG,"[err] nodeId.\n");
return -1; return -1;
} }
debug_log(LOG_FOCUS_LEVEL,"[sync] device status.\n"); debug_log(LOG_FOCUS,"[sync] device status.\n");
memset(nodeBuff,0,sizeof(nodeBuff)); memset(nodeBuff,0,sizeof(nodeBuff));
snprintf(nodeBuff,sizeof(nodeBuff),"%d",nodeId); snprintf(nodeBuff,sizeof(nodeBuff),"%d",nodeId);
...@@ -243,8 +221,7 @@ static int kk_lan_property_convert(const char *deviceCode,kk_map_dev_node_t *dev ...@@ -243,8 +221,7 @@ static int kk_lan_property_convert(const char *deviceCode,kk_map_dev_node_t *dev
cJSON *n_id = NULL; cJSON *n_id = NULL;
int o_item_size=0,n_item_size=0; cJSON *item_size = NULL;
int item_size = 0;
cJSON *epsAry = NULL,*epAryItem = NULL,*epAryEpNumObj = NULL; cJSON *epsAry = NULL,*epAryItem = NULL,*epAryEpNumObj = NULL;
...@@ -254,33 +231,27 @@ static int kk_lan_property_convert(const char *deviceCode,kk_map_dev_node_t *dev ...@@ -254,33 +231,27 @@ static int kk_lan_property_convert(const char *deviceCode,kk_map_dev_node_t *dev
if(deviceCode==NULL||devNode==NULL|| if(deviceCode==NULL||devNode==NULL||
params==NULL||params->type!=cJSON_Object){ params==NULL||params->type!=cJSON_Object){
debug_log(LOG_DEBUG_LEVEL,"[err] para.\n"); debug_log(LOG_DEBUG,"[err] para.\n");
return -1; return -1;
} }
oldccu = devNode->oldccu; oldccu = devNode->oldccu;
newccu = devNode->newccu; newccu = devNode->newccu;
o_item_size = cJSON_GetArraySize(oldccu); item_size = cJSON_GetArraySize(newccu);
n_item_size = cJSON_GetArraySize(newccu);
item_size = (n_item_size>o_item_size)?n_item_size:o_item_size;
for(i=0;i<item_size;i++){ for(i=0;i<item_size;i++){
n_item = cJSON_GetArrayItem(newccu,i); n_item = cJSON_GetArrayItem(newccu,i);
if((o_item = cJSON_GetArrayItem(oldccu,i))==NULL|| if((o_item = cJSON_GetArrayItem(oldccu,i))==NULL||
o_item->type!=cJSON_Object){ o_item->type!=cJSON_Object){
debug_log(LOG_INFO_LEVEL,"[err] para.i=%d\n",i); debug_log(LOG_INFO,"[err] para.\n");
continue ; continue ;
} }
if((n_id = cJSON_GetObjectItem(n_item,"identifier"))==NULL|| if((n_id = cJSON_GetObjectItem(n_item,"identifier"))==NULL||
n_id->type!=cJSON_String){ n_id->type!=cJSON_String){
debug_log(LOG_DEBUG_LEVEL,"[err] cfg file.\n"); debug_log(LOG_DEBUG,"[err] cfg file.\n");
continue; continue;
} }
...@@ -292,18 +263,16 @@ static int kk_lan_property_convert(const char *deviceCode,kk_map_dev_node_t *dev ...@@ -292,18 +263,16 @@ static int kk_lan_property_convert(const char *deviceCode,kk_map_dev_node_t *dev
o_dataType = cJSON_GetObjectItem(o_item,"dataType"); o_dataType = cJSON_GetObjectItem(o_item,"dataType");
o_valueRange = cJSON_GetObjectItem(o_item,"valueRange"); o_valueRange = cJSON_GetObjectItem(o_item,"valueRange");
if(n_dataType==NULL||n_dataType->type!=cJSON_String|| if(n_dataType==NULL||n_dataType->type!=cJSON_String||
o_dataType==NULL||o_dataType->type!=cJSON_String){ o_dataType==NULL||o_dataType->type!=cJSON_String){
debug_log(LOG_DEBUG_LEVEL,"[err] dataType.\n"); debug_log(LOG_DEBUG,"[err] dataType.\n");
continue; continue;
} }
channelObj = cJSON_GetObjectItem(o_item,"channel"); channelObj = cJSON_GetObjectItem(o_item,"channel");
epNumObj = cJSON_GetObjectItem(params,"epNum"); epNumObj = cJSON_GetObjectItem(params,"epNum");
if((channel = _kk_lan_check_channel(channelObj,epNumObj))==-1){ if((channel = _kk_lan_check_channel(channelObj,epNumObj))==-1){
debug_log(LOG_DEBUG_LEVEL,"[channel] %d.\n",channel); debug_log(LOG_DEBUG,"[channel] %d.\n",channel);
continue; continue;
} }
...@@ -314,12 +283,12 @@ static int kk_lan_property_convert(const char *deviceCode,kk_map_dev_node_t *dev ...@@ -314,12 +283,12 @@ static int kk_lan_property_convert(const char *deviceCode,kk_map_dev_node_t *dev
epAryEpNumObj = cJSON_GetObjectItem(epAryItem,"epNum"); epAryEpNumObj = cJSON_GetObjectItem(epAryItem,"epNum");
if(epAryEpNumObj==NULL||epAryEpNumObj->type!=cJSON_String ||channel!=atoi(epAryEpNumObj->valuestring)){ if(epAryEpNumObj==NULL||epAryEpNumObj->type!=cJSON_String ||channel!=atoi(epAryEpNumObj->valuestring)){
debug_log(LOG_NORMAL_LEVEL,"[epsAry match] next.\n"); debug_log(LOG_NORMAL,"[epsAry match] next.\n");
continue ; continue ;
} }
if((valObj=cJSON_GetObjectItem(epAryItem,n_id->valuestring))==NULL){ if((valObj=cJSON_GetObjectItem(epAryItem,n_id->valuestring))==NULL){
debug_log(LOG_NORMAL_LEVEL,"[epsAry match] next.\n"); debug_log(LOG_NORMAL,"[epsAry match] next.\n");
continue ; continue ;
}else{ }else{
mFlag = 1; mFlag = 1;
...@@ -331,40 +300,35 @@ static int kk_lan_property_convert(const char *deviceCode,kk_map_dev_node_t *dev ...@@ -331,40 +300,35 @@ static int kk_lan_property_convert(const char *deviceCode,kk_map_dev_node_t *dev
} }
}else{ }else{
if((valObj=cJSON_GetObjectItem(params,n_id->valuestring))==NULL){ if((valObj=cJSON_GetObjectItem(params,n_id->valuestring))==NULL){
debug_log(LOG_NORMAL_LEVEL,"[match] next.\n"); debug_log(LOG_NORMAL,"[match] next.\n");
continue ; continue ;
} }
} }
if((nodeId = kk_lan_db_node_get(deviceCode,channel))==-1){ if((nodeId = kk_lan_db_node_get(deviceCode,channel))==-1){
debug_log(LOG_DEBUG_LEVEL,"[err] not find node.\n"); debug_log(LOG_DEBUG,"[err] not find node.\n");
continue; continue;
} }
if((opcode = cJSON_GetObjectItem(n_item,"opcodemap"))==NULL|| if((opcode = cJSON_GetObjectItem(n_item,"opcodemap"))==NULL||
opcode->type!=cJSON_String){ opcode->type!=cJSON_String){
debug_log(LOG_DEBUG_LEVEL,"[err] cfg file.\n"); debug_log(LOG_DEBUG,"[err] cfg file.\n");
continue; continue;
} }
kk_lan_replace_val_to_obj(n_item,valObj,"value"); kk_lan_replace_val_to_obj(n_item,valObj,"value");
if((args = ccu_value_convert(n_dataType,n_valueRange,o_dataType,o_valueRange,valObj))!=NULL){ if((args = ccu_value_convert(n_dataType,n_valueRange,o_dataType,o_valueRange,valObj))!=NULL){
_kk_lan_update_device_status(nodeId,opcode,args); _kk_lan_update_device_status(nodeId,opcode,args);
//todo : //todo :
//cJSON_Delete(args); //cJSON_Delete(args);
} }
} }
_kk_lan_sync_device_status(deviceCode,devNode); _kk_lan_sync_device_status(deviceCode,devNode);
...@@ -399,7 +363,7 @@ int kk_lan_property_post_deal(const char *deviceCode,cJSON *payload) ...@@ -399,7 +363,7 @@ int kk_lan_property_post_deal(const char *deviceCode,cJSON *payload)
cJSON *params = NULL; cJSON *params = NULL;
kk_map_dev_node_t *dev = NULL; kk_map_dev_node_t *dev = NULL;
debug_log(LOG_FOCUS_LEVEL,"[property post] deviceCode(%s).\n",deviceCode); debug_log(LOG_FOCUS,"[property post] deviceCode(%s).\n",deviceCode);
if(kk_map_dev_search_by_deviceCode(deviceCode, &dev)==0){ if(kk_map_dev_search_by_deviceCode(deviceCode, &dev)==0){
params = cJSON_GetObjectItem(payload,"params"); params = cJSON_GetObjectItem(payload,"params");
...@@ -410,7 +374,7 @@ int kk_lan_property_post_deal(const char *deviceCode,cJSON *payload) ...@@ -410,7 +374,7 @@ int kk_lan_property_post_deal(const char *deviceCode,cJSON *payload)
return kk_lan_property_convert(deviceCode,dev,params); return kk_lan_property_convert(deviceCode,dev,params);
} }
}else{ }else{
debug_log(LOG_DEBUG_LEVEL,"[err] not find deviceCode(%s).\n",deviceCode); debug_log(LOG_DEBUG,"[err] not find deviceCode(%s).\n",deviceCode);
return -1; return -1;
} }
return 0; return 0;
...@@ -422,12 +386,12 @@ int kk_lan_property_syn_deal(const char *deviceCode,cJSON *properties) ...@@ -422,12 +386,12 @@ int kk_lan_property_syn_deal(const char *deviceCode,cJSON *properties)
cJSON *params = NULL; cJSON *params = NULL;
kk_map_dev_node_t *dev = NULL; kk_map_dev_node_t *dev = NULL;
debug_log(LOG_FOCUS_LEVEL,"[property syn] deviceCode(%s).\n",deviceCode); debug_log(LOG_FOCUS,"[property syn] deviceCode(%s).\n",deviceCode);
if(kk_map_dev_search_by_deviceCode(deviceCode, &dev)==0){ if(kk_map_dev_search_by_deviceCode(deviceCode, &dev)==0){
return kk_lan_property_convert(deviceCode,dev,properties); return kk_lan_property_convert(deviceCode,dev,properties);
}else{ }else{
debug_log(LOG_DEBUG_LEVEL,"[err] not find deviceCode(%s).\n",deviceCode); debug_log(LOG_DEBUG,"[err] not find deviceCode(%s).\n",deviceCode);
return -1; return -1;
} }
return 0; return 0;
...@@ -436,7 +400,7 @@ int kk_lan_property_syn_deal(const char *deviceCode,cJSON *properties) ...@@ -436,7 +400,7 @@ int kk_lan_property_syn_deal(const char *deviceCode,cJSON *properties)
//添加场景通知 //添加场景通知
void kk_lan_add_scene_notify(const char* scene_id) void kk_lan_add_scene_notify(const char* scene_id)
{ {
debug_log(LOG_FOCUS_LEVEL,"[notify] add scene(%s).\n",scene_id); debug_log(LOG_FOCUS,"[notify] add scene(%s).\n",scene_id);
kk_handle_sync_info(); kk_handle_sync_info();
} }
...@@ -444,7 +408,7 @@ void kk_lan_add_scene_notify(const char* scene_id) ...@@ -444,7 +408,7 @@ void kk_lan_add_scene_notify(const char* scene_id)
//删除场景通知 //删除场景通知
void kk_lan_delete_scene_notify(const char* scene_id) void kk_lan_delete_scene_notify(const char* scene_id)
{ {
debug_log(LOG_FOCUS_LEVEL,"[notify] delete scene(%s).\n",scene_id); debug_log(LOG_FOCUS,"[notify] delete scene(%s).\n",scene_id);
cJSON *msg = old_ccu_msg_build(scene_id,"DELETE_SCENE",SUCCESS_STR,WILDCARD_CHARACTER_STR); cJSON *msg = old_ccu_msg_build(scene_id,"DELETE_SCENE",SUCCESS_STR,WILDCARD_CHARACTER_STR);
send_msg_to_module(msg); send_msg_to_module(msg);
...@@ -458,7 +422,7 @@ int kk_lan_arming_status_notify(int type) ...@@ -458,7 +422,7 @@ int kk_lan_arming_status_notify(int type)
{ {
cJSON *msg = NULL; cJSON *msg = NULL;
debug_log(LOG_FOCUS_LEVEL,"[notify] arming status(%d).\n",type); debug_log(LOG_FOCUS,"[notify] arming status(%d).\n",type);
if(type==0){ if(type==0){
msg = old_ccu_msg_build(WILDCARD_CHARACTER_STR,GUARD_STATUS_ARMING_LEAVE_HOME,SUCCESS_STR,WILDCARD_CHARACTER_STR); msg = old_ccu_msg_build(WILDCARD_CHARACTER_STR,GUARD_STATUS_ARMING_LEAVE_HOME,SUCCESS_STR,WILDCARD_CHARACTER_STR);
...@@ -469,7 +433,7 @@ int kk_lan_arming_status_notify(int type) ...@@ -469,7 +433,7 @@ int kk_lan_arming_status_notify(int type)
}else if(type==3){ }else if(type==3){
msg = old_ccu_msg_build(WILDCARD_CHARACTER_STR,ARMING_STATUS_GUARD_ZONE,SUCCESS_STR,WILDCARD_CHARACTER_STR); msg = old_ccu_msg_build(WILDCARD_CHARACTER_STR,ARMING_STATUS_GUARD_ZONE,SUCCESS_STR,WILDCARD_CHARACTER_STR);
}else{ }else{
debug_log(LOG_DEBUG_LEVEL,"[err] unknow type(%d).\n",type); debug_log(LOG_DEBUG,"[err] unknow type(%d).\n",type);
return -1; return -1;
} }
...@@ -487,11 +451,11 @@ static int _kk_lan_delete_node(const char *deviceCode,const char *nodeid) ...@@ -487,11 +451,11 @@ static int _kk_lan_delete_node(const char *deviceCode,const char *nodeid)
kk_map_dev_node_t *dev; kk_map_dev_node_t *dev;
if(deviceCode==NULL||nodeid==NULL){ if(deviceCode==NULL||nodeid==NULL){
debug_log(LOG_DEBUG_LEVEL,"[err] params.\n"); debug_log(LOG_DEBUG,"[err] params.\n");
return -1; return -1;
} }
debug_log(LOG_FOCUS_LEVEL,"[del dev node] id(%s).\n",nodeid); debug_log(LOG_FOCUS,"[del dev node] id(%s).\n",nodeid);
arg = cJSON_CreateObject(); arg = cJSON_CreateObject();
_deviceCode_switchto_mac(deviceCode,mac); _deviceCode_switchto_mac(deviceCode,mac);
...@@ -512,7 +476,7 @@ static int _kk_lan_delete_device(const char *deviceCode) ...@@ -512,7 +476,7 @@ static int _kk_lan_delete_device(const char *deviceCode)
num = kk_lan_db_node_get_all(deviceCode,list); num = kk_lan_db_node_get_all(deviceCode,list);
debug_log(LOG_FOCUS_LEVEL,"[del dev] deviceCode(%s)/node num(%d).\n",deviceCode,num); debug_log(LOG_FOCUS,"[del dev] deviceCode(%s)/node num(%d).\n",deviceCode,num);
for(i=0;i<num;i++){ for(i=0;i<num;i++){
memset(nodeId,0,sizeof(nodeId)); memset(nodeId,0,sizeof(nodeId));
...@@ -536,13 +500,13 @@ int kk_lan_device_delete_notify(cJSON *payload) ...@@ -536,13 +500,13 @@ int kk_lan_device_delete_notify(cJSON *payload)
if((params = cJSON_GetObjectItem(payload,"params"))==NULL|| if((params = cJSON_GetObjectItem(payload,"params"))==NULL||
params->type!=cJSON_Object){ params->type!=cJSON_Object){
debug_log(LOG_DEBUG_LEVEL,"[err] params.\n"); debug_log(LOG_DEBUG,"[err] params.\n");
return -1; return -1;
} }
if((deviceCode = cJSON_GetObjectItem(params, "deviceCode"))==NULL|| if((deviceCode = cJSON_GetObjectItem(params, "deviceCode"))==NULL||
deviceCode->type!=cJSON_String){ deviceCode->type!=cJSON_String){
debug_log(LOG_DEBUG_LEVEL,"[err] deviceCode.\n"); debug_log(LOG_DEBUG,"[err] deviceCode.\n");
return -1; return -1;
} }
......
...@@ -1239,7 +1239,52 @@ int dm_msg_thing_property_post_by_identify(char *deviceCode,cJSON *params) ...@@ -1239,7 +1239,52 @@ int dm_msg_thing_property_post_by_identify(char *deviceCode,cJSON *params)
return SUCCESS_RETURN; return SUCCESS_RETURN;
} }
int kk_msg_cloud_status_notify(const char *deviceCode,const char *productCode)
{
char *method = "thing.service.cloudStatus";
char *req_info = NULL,*payload = NULL;
int req_info_len = 0,payload_len = 0;
char msgId[MSG_MAX_LEN] = {0};
req_info_len = strlen(DM_MSG_INFO)+10+strlen(deviceCode)+strlen(productCode)+strlen(KK_THING_SERVICE_CLOUDSTATUS)+1;
req_info = malloc(req_info_len);
if (req_info == NULL) {
return MEMORY_NOT_ENOUGH;
}
memset(req_info, 0, req_info_len);
snprintf(req_info, req_info_len, DM_MSG_INFO, KK_THING_SERVICE_CLOUDSTATUS,productCode, deviceCode);
cJSON *params=cJSON_CreateObject();
cJSON_AddNumberToObject(params, "status", 1);
char *paramStr = cJSON_Print(params);
payload_len = strlen(DM_MSG_REQUEST) + 10 + strlen(DM_MSG_VERSION) + strlen(paramStr) + strlen(
method) + 1 + 20 + sizeof(msgId);
payload = malloc(payload_len);
if (payload == NULL) {
free(req_info);
return MEMORY_NOT_ENOUGH;
}
memset(payload, 0, payload_len);
iotx_report_id(msgId);
//sprintf(msgId,"%d",iotx_report_id());
snprintf(payload, payload_len, DM_MSG_REQUEST, msgId,
DM_MSG_VERSION, paramStr,HAL_GetTime(), method);
cJSON *root=cJSON_CreateObject();
cJSON* infoObj = cJSON_Parse(req_info);
cJSON* payloadObj = cJSON_Parse(payload);
cJSON_AddItemToObject(root, "info", infoObj);
cJSON_AddItemToObject(root, "payload",payloadObj);
void *buf = cJSON_Print(root);
printf("------------------------------------------------------->333\n");
kk_sendData2gw(buf, strlen(buf), deviceCode);
free(paramStr);
free(buf);
free(req_info);
free(payload);
cJSON_Delete(params);
cJSON_Delete(root);
return SUCCESS_RETURN;
}
int kk_msg_execute_property_set(const char *productCode,const char *deviceCode,const char* params,const char *fatherDeviceCode) int kk_msg_execute_property_set(const char *productCode,const char *deviceCode,const char* params,const char *fatherDeviceCode)
{ {
char *method = "thing.service.property.set"; char *method = "thing.service.property.set";
......
...@@ -85,7 +85,7 @@ const char DM_MSG_INFO[] DM_READ_ONLY; ...@@ -85,7 +85,7 @@ const char DM_MSG_INFO[] DM_READ_ONLY;
#define KK_THING_SERVICE_SYNCINFO "/thing/service/syncinfo" #define KK_THING_SERVICE_SYNCINFO "/thing/service/syncinfo"
#define KK_THING_SERVICE_SYNCDEVICEINFO "/thing/service/syncDeviceInfo" #define KK_THING_SERVICE_SYNCDEVICEINFO "/thing/service/syncDeviceInfo"
#define KK_THING_SERVICE_SYNCDEVICEINFO_REPLY "/thing/service/syncDeviceInfo_reply" #define KK_THING_SERVICE_SYNCDEVICEINFO_REPLY "/thing/service/syncDeviceInfo_reply"
#define KK_THING_SERVICE_CLOUDSTATUS "/thing/service/cloudStatus"
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
static int s_gateway_add_flag = 0;
typedef struct { typedef struct {
int msgid; int msgid;
...@@ -351,10 +351,10 @@ int kk_topo_delete_handle(cJSON *payload,cJSON *buf) ...@@ -351,10 +351,10 @@ int kk_topo_delete_handle(cJSON *payload,cJSON *buf)
cJSON_AddItemToObject(rootData,"payload",payload); cJSON_AddItemToObject(rootData,"payload",payload);
char *pnewout=cJSON_Print(rootData); char *pnewout=cJSON_Print(rootData);
kk_sendData2gw(pnewout, strlen(pnewout), node->fatherDeviceCode);//send to gw itself kk_sendData2gw(pnewout, strlen(pnewout), node->fatherDeviceCode);//send to gw itself
free(pnewout);
cJSON_Delete(rootData);
dm_mgr_subdev_delete(deviceCode); dm_mgr_subdev_delete(deviceCode);
item = item->next; free(pnewout);
//cJSON_Delete(rootData);
return SUCCESS_RETURN;
} }
} }
...@@ -1094,9 +1094,10 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data) ...@@ -1094,9 +1094,10 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
char *payload_Str = NULL; char *payload_Str = NULL;
cJSON *deviceCode = NULL; cJSON *deviceCode = NULL;
json=cJSON_Parse(data); json=cJSON_Parse(data);
_iotx_linkkit_mutex_lock();
if (json == NULL) { if (json == NULL) {
WARNING_PRINT("Error before: [%s]\n","cJSON_Parse"); WARNING_PRINT("Error before: [%s]\n","cJSON_Parse");
_iotx_linkkit_mutex_unlock();
return; return;
} }
info_root = cJSON_GetObjectItem(json, MSG_INFO_STR); info_root = cJSON_GetObjectItem(json, MSG_INFO_STR);
...@@ -1195,7 +1196,8 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data) ...@@ -1195,7 +1196,8 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
node->isOffline = KK_DEV_ONLINE; node->isOffline = KK_DEV_ONLINE;
dm_mgr_upstream_thing_sub_register(KK_DM_DEVICE_CCU_DEVICEID); dm_mgr_upstream_thing_sub_register(KK_DM_DEVICE_CCU_DEVICEID);
iotx_dm_dev_online(KK_DM_DEVICE_CCU_DEVICEID);//first online,report the online status iotx_dm_dev_online(KK_DM_DEVICE_CCU_DEVICEID);//first online,report the online status
usleep(200000); if(s_gateway_add_flag == 0)
kk_subDev_check_auth(KK_DM_DEVICE_GATEWAY);
dm_msg_ccu_property_post(node); dm_msg_ccu_property_post(node);
dm_mgr_resubscribe(); dm_mgr_resubscribe();
} }
...@@ -1370,6 +1372,7 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data) ...@@ -1370,6 +1372,7 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
directReturn: directReturn:
free(payload_Str); free(payload_Str);
cJSON_Delete(json); cJSON_Delete(json);
_iotx_linkkit_mutex_unlock();
} }
/************************************************************ /************************************************************
...@@ -1765,7 +1768,15 @@ int kk_mid_subdev_add(int devType, char productCode[PRODUCT_CODE_MAXLEN], char d ...@@ -1765,7 +1768,15 @@ int kk_mid_subdev_add(int devType, char productCode[PRODUCT_CODE_MAXLEN], char d
} }
kk_subDev_update_productType(node->productType,deviceCode); kk_subDev_update_productType(node->productType,deviceCode);
} }
if(devType == KK_DM_DEVICE_GATEWAY){//如果还没有连上云,网关topo add不处理
if(s_CloudStatus){
//kk_subDev_update_auth(1,deviceCode);
s_gateway_add_flag = 1;
}else{
ERROR_PRINT("Cloud is not connected!!!!!!!!\n");
return FAIL_RETURN;
}
}
_iotx_linkkit_mutex_lock(); _iotx_linkkit_mutex_lock();
res = _iotx_linkkit_slave_connect(devid); res = _iotx_linkkit_slave_connect(devid);
if (res != SUCCESS_RETURN) { if (res != SUCCESS_RETURN) {
......
...@@ -228,8 +228,6 @@ static int _kk_check_door_induction_device(char *productCode){ ...@@ -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) 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; dm_mgr_dev_node_t *node = NULL;
int res = 0 ; int res = 0 ;
const char *insertCmd = "insert into PropertiesInfo (deviceCode,identifier,value,valueType,devType) \ 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 ...@@ -238,12 +236,10 @@ int kk_property_db_insert(const char *deviceCode,const char *identifier,kk_tsl_d
int rc = 0; int rc = 0;
char *zErrMsg = 0; char *zErrMsg = 0;
kk_property_db_ctx_t *ctx = _kk_property_db_get_ctx(); kk_property_db_ctx_t *ctx = _kk_property_db_get_ctx();
printf("---------------------------------------->1\n");
if(_kk_check_property_exist(deviceCode,identifier) == 1) if(_kk_check_property_exist(deviceCode,identifier) == 1)
{ {
return SUCCESS_RETURN; return SUCCESS_RETURN;
} }
printf("---------------------------------------->2\n");
_kk_property_db_lock(); _kk_property_db_lock();
//传感器类默认安防等级为离家安防 //传感器类默认安防等级为离家安防
if(strcmp(identifier,"SensorType") == 0 && devtype == KK_DM_DEVICE_SUBDEV){ 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 ...@@ -251,12 +247,10 @@ int kk_property_db_insert(const char *deviceCode,const char *identifier,kk_tsl_d
if (res != SUCCESS_RETURN) { if (res != SUCCESS_RETURN) {
return FAIL_RETURN; return FAIL_RETURN;
} }
printf("---------------------------------------->3\n");
if(_kk_check_human_induction_device(node->productCode) == 1 || //门磁和人体默认室外安防 if(_kk_check_human_induction_device(node->productCode) == 1 || //门磁和人体默认室外安防
_kk_check_door_induction_device(node->productCode) == 1){ _kk_check_door_induction_device(node->productCode) == 1){
sqlCmd = sqlite3_mprintf(insertCmd,deviceCode,identifier,"1",valuetype,devtype); sqlCmd = sqlite3_mprintf(insertCmd,deviceCode,identifier,"1",valuetype,devtype);
}else{ }else{
printf("---------------------------------------->\n");
sqlCmd = sqlite3_mprintf(insertCmd,deviceCode,identifier,"2",valuetype,devtype);//其他24小时警戒 sqlCmd = sqlite3_mprintf(insertCmd,deviceCode,identifier,"2",valuetype,devtype);//其他24小时警戒
} }
}else{ }else{
......
...@@ -385,7 +385,36 @@ int kk_subDev_update_auth(int isAuth,const char *deviceCode) ...@@ -385,7 +385,36 @@ int kk_subDev_update_auth(int isAuth,const char *deviceCode)
_kk_subDb_unlock(); _kk_subDb_unlock();
return SUCCESS_RETURN; return SUCCESS_RETURN;
} }
/************************************************************
*功能描述:更新设备注册标记
*输入参数:deviceCode:设备deviceCode
isAuth:1,已注册;0,未注册
*输出参数:无
*返 回 值:0:成功;其他:失败
*其他说明:
*************************************************************/
int kk_subDev_check_auth(int devType)
{
char *sqlCmd = NULL;
sqlite3_stmt *stmt;
int rc = 0;
char *zErrMsg = 0;
const char *searchCmd = "select * from SubDeviceInfo WHERE devType = '%d';";
kk_subDb_ctx_t *ctx = _kk_subDb_get_ctx();
printf("------------------------------------------------------->111\n");
sqlCmd = sqlite3_mprintf(searchCmd,devType);
sqlite3_prepare_v2(ctx->pDb, sqlCmd, strlen(sqlCmd), &stmt, NULL);
while(sqlite3_step(stmt) == SQLITE_ROW){
printf("------------------------------------------------------->222\n");
char *pDeviceCode = (char*)sqlite3_column_text(stmt, DB_SUB_DEVICECODE);
char *pProductCode = (char*)sqlite3_column_text(stmt, DB_SUB_PRODUCTCODE);
kk_msg_cloud_status_notify(pProductCode,pDeviceCode);
//kk_subDev_update_auth(1,pDeviceCode);
}
sqlite3_finalize(stmt);
sqlite3_free(sqlCmd);
return SUCCESS_RETURN;
}
/************************************************************ /************************************************************
*功能描述:更新内场景支持,此接口只针对网关设备有效 *功能描述:更新内场景支持,此接口只针对网关设备有效
*输入参数:deviceCode:设备deviceCode *输入参数:deviceCode:设备deviceCode
......
...@@ -15,7 +15,6 @@ int kk_subDev_update_auth(int isAuth,const char *deviceCode); ...@@ -15,7 +15,6 @@ int kk_subDev_update_auth(int isAuth,const char *deviceCode);
int kk_subDev_update_sceneSupport(int sceneSupport,const char *deviceCode); int kk_subDev_update_sceneSupport(int sceneSupport,const char *deviceCode);
int kk_subDev_delete_by_dcode(char deviceCode[DEVICE_CODE_MAXLEN]); int kk_subDev_delete_by_dcode(char deviceCode[DEVICE_CODE_MAXLEN]);
int kk_subDev_update_productType(char *productType,const char *deviceCode); int kk_subDev_update_productType(char *productType,const char *deviceCode);
int kk_subDev_update_auth(int isAuth,const char *deviceCode);
int kk_subDev_send_property_get_from_db(void); int kk_subDev_send_property_get_from_db(void);
int kk_subDev_send_property_get(const char *fatherDeviceCode); int kk_subDev_send_property_get(const char *fatherDeviceCode);
...@@ -24,6 +23,7 @@ int kk_subDev_set_action_by_productType(const char *productType,const char *scen ...@@ -24,6 +23,7 @@ int kk_subDev_set_action_by_productType(const char *productType,const char *scen
int kk_subDev_update_offline(int isOffline,const char *deviceCode); int kk_subDev_update_offline(int isOffline,const char *deviceCode);
int kk_subDev_getSensors_reply(SensorType_t*list); int kk_subDev_getSensors_reply(SensorType_t*list);
int kk_load_subDevice(void); int kk_load_subDevice(void);
int kk_subDev_check_auth(int devType);
enum{ enum{
DB_SUB_IDX = 0, DB_SUB_IDX = 0,
DB_SUB_ONLINE, DB_SUB_ONLINE,
......
...@@ -783,6 +783,7 @@ void kk_platMsg_handle(void* data, char* chalMark){ ...@@ -783,6 +783,7 @@ void kk_platMsg_handle(void* data, char* chalMark){
if(sceneSupportStr != NULL&&!strcmp(sceneSupportStr->valuestring,"1")){ if(sceneSupportStr != NULL&&!strcmp(sceneSupportStr->valuestring,"1")){
kk_subDev_update_sceneSupport(1,devCode->valuestring); kk_subDev_update_sceneSupport(1,devCode->valuestring);
} }
kk_dm_gw_status_update_online(info_dcode->valuestring);
}else{ }else{
kk_mid_subdev_add(KK_DM_DEVICE_SUBDEV,proCode->valuestring,devCode->valuestring, mac->valuestring,info_dcode->valuestring); kk_mid_subdev_add(KK_DM_DEVICE_SUBDEV,proCode->valuestring,devCode->valuestring, mac->valuestring,info_dcode->valuestring);
} }
......
#!/bin/sh #!/bin/sh
#filepath="/home/kk"
filepath="/app/ccuApps"
if [ ! -f "/sbin/jq" ] if [ ! -f "/sbin/jq" ]
then then
cp /app/ccuApps/jq /sbin cp $filepath/jq /sbin
fi fi
if [ -f "/app/nx5Apps/syscfg.json" ] if [ -f "/app/nx5Apps/syscfg.json" ]
then then
...@@ -19,9 +21,9 @@ then ...@@ -19,9 +21,9 @@ then
fi fi
fi fi
nanomsg_File="/app/ccuApps/lib/libnanomsg.so.5" nanomsg_File="$filepath/lib/libnanomsg.so.5"
ev_File="/app/ccuApps/lib/libev.so.4" ev_File="$filepath/lib/libev.so.4"
sqlite_File="/app/ccuApps/lib/libsqlite3.so.0" sqlite_File="$filepath/lib/libsqlite3.so.0"
run_Dir="/data/kk" run_Dir="/data/kk"
tsl_Dir="${run_Dir}/tsl" tsl_Dir="${run_Dir}/tsl"
...@@ -38,36 +40,36 @@ if [ ! -d "$run_Dir" ]; then ...@@ -38,36 +40,36 @@ if [ ! -d "$run_Dir" ]; then
fi fi
if [ ! -d "$tsl_Dir" ]; then if [ ! -d "$tsl_Dir" ]; then
cp -rf /app/ccuApps/tsl ${run_Dir}/ cp -rf $filepath/tsl ${run_Dir}/
fi fi
if [ ! -d "$map_Dir" ]; then if [ ! -d "$map_Dir" ]; then
cp -rf /app/ccuApps/map ${run_Dir}/ cp -rf $filepath/map ${run_Dir}/
fi fi
cd /app/ccuApps/lib cd $filepath/lib
if [ ! -f "$nanomsg_File" ]; then 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 fi
if [ ! -f "$ev_File" ]; then 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 fi
if [ ! -f "$sqlite_File" ]; then 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 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 sleep 3
/app/ccuApps/bin/kk_cloud & $filepath/bin/kk_cloud &
sleep 1 sleep 5
#/home/kk/process_check.sh >/dev/null 2>&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 sleep 2
/app/ccuApps/bin/kk_lan & $filepath/bin/kk_lan --uart=/dev/ttyS3&
sleep 1 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 & ntpd -n -q -d -p stdtime.gov.hk &
exit 0 exit 0
\ No newline at end of file
...@@ -210,6 +210,7 @@ package: ...@@ -210,6 +210,7 @@ package:
cp -rf $(TOP_DIR)/process_check.sh $(TOP_DIR)/$(releaseDir)/ cp -rf $(TOP_DIR)/process_check.sh $(TOP_DIR)/$(releaseDir)/
cp -rf $(TOP_DIR)/onboot.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)/VERSION $(TOP_DIR)/$(releaseDir)/
cp -rf $(TOP_DIR)/opcodeMapCfg/* $(TOP_DIR)/$(releaseDir)/map 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)/ #cp -rf $(TOP_DIR)/platform/zigbee/app/builder/Z3GatewayHost/ZB/dev_config_table $(TOP_DIR)/$(releaseDir)/
...@@ -218,6 +219,7 @@ ifeq ($(CONFIG_MODEL),ubuntu) ...@@ -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/nanomsg/libnanomsg_ubuntu.so $(TOP_DIR)/$(releaseDir)/lib/libnanomsg.so.5
cp -rf $(TOP_DIR)/common/ev/libev_ubuntu.so $(TOP_DIR)/$(releaseDir)/lib cp -rf $(TOP_DIR)/common/ev/libev_ubuntu.so $(TOP_DIR)/$(releaseDir)/lib
else ifeq ($(CONFIG_MODEL),nx5) 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/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/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 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