Commit 2a66f954 authored by 陈伟灿's avatar 陈伟灿

Merge branch 'cwc' into 'master'

【修改内容】修改不同的ccuid,网关topoadd后数据不对应的BUG

See merge request chenweican/k-sdk!189
parents 13e09dd3 728f1529
...@@ -262,6 +262,13 @@ int dm_mgr_device_create(_IN_ int dev_type,_IN_ char productCode[PRODUCT_CODE_MA ...@@ -262,6 +262,13 @@ int dm_mgr_device_create(_IN_ int dev_type,_IN_ char productCode[PRODUCT_CODE_MA
if (mac != NULL) { if (mac != NULL) {
memcpy(node->mac, mac, strlen(mac)); memcpy(node->mac, mac, strlen(mac));
} }
if (dev_type == KK_DM_DEVICE_GATEWAY && fatherDeviceCode != NULL) {
if(strcmp(node->fatherDeviceCode,fatherDeviceCode) != 0){
memset(node->fatherDeviceCode,0x0,sizeof(node->fatherDeviceCode));
memcpy(node->fatherDeviceCode, fatherDeviceCode, strlen(fatherDeviceCode));
kk_subDev_update_fatherDeviceCode(fatherDeviceCode,deviceCode);
}
}
return TSL_ALREADY_EXIST; return TSL_ALREADY_EXIST;
} }
......
...@@ -375,7 +375,35 @@ int kk_subDev_update_productType(char *productType,const char *deviceCode) ...@@ -375,7 +375,35 @@ int kk_subDev_update_productType(char *productType,const char *deviceCode)
//_kk_subDb_unlock(); //_kk_subDb_unlock();
return SUCCESS_RETURN; return SUCCESS_RETURN;
} }
/************************************************************
*功能描述:更新设备类型
*输入参数:deviceCode:设备deviceCode
productType:设备类型
*输出参数:无
*返 回 值:0:成功;其他:失败
*其他说明:
*************************************************************/
int kk_subDev_update_fatherDeviceCode(char *fatherDeviceCode,const char *deviceCode)
{
char *sqlCmd = NULL;
int rc = 0;
char *zErrMsg = 0;
kk_subDb_ctx_t *ctx = _kk_subDb_get_ctx();
//_kk_subDb_lock();
sqlCmd = sqlite3_mprintf("UPDATE SubDeviceInfo SET fatherDeviceCode='%s' WHERE deviceCode= '%s'",fatherDeviceCode,deviceCode);
INFO_PRINT("kk_subDev_update_fatherDeviceCode sqlCmd:%s\n",sqlCmd);
rc = sqlite3_exec(ctx->pDb, sqlCmd, NULL, NULL, &zErrMsg);
if( rc != SQLITE_OK ){
ERROR_PRINT("SQL error: %s\n", zErrMsg);
sqlite3_free(zErrMsg);
}else{
//INFO_PRINT("Table updata data successfully\n");
}
sqlite3_free(sqlCmd);
//_kk_subDb_unlock();
return SUCCESS_RETURN;
}
/************************************************************ /************************************************************
*功能描述:更新设备注册标记 *功能描述:更新设备注册标记
*输入参数:deviceCode:设备deviceCode *输入参数:deviceCode:设备deviceCode
......
...@@ -44,6 +44,7 @@ int kk_get_screenDev_list(ScreenDevInfo_t*list); ...@@ -44,6 +44,7 @@ int kk_get_screenDev_list(ScreenDevInfo_t*list);
int kk_get_screenDev_info(ScreenDevInfo_t *devInfo,char*serialId); int kk_get_screenDev_info(ScreenDevInfo_t *devInfo,char*serialId);
int kk_subDev_getDeviceCodes_byProductType(DeviceCode_t *list,char *type); int kk_subDev_getDeviceCodes_byProductType(DeviceCode_t *list,char *type);
int kk_indoor_air_action_add(char *propertyValue,char* deviceCode,int delay,char*gwDeviceCode,char *sceneId,char *type,int epnum); int kk_indoor_air_action_add(char *propertyValue,char* deviceCode,int delay,char*gwDeviceCode,char *sceneId,char *type,int epnum);
int kk_subDev_update_fatherDeviceCode(char *fatherDeviceCode,const char *deviceCode);
enum{ enum{
DB_SUB_IDX = 0, DB_SUB_IDX = 0,
DB_SUB_ONLINE, DB_SUB_ONLINE,
......
...@@ -1527,7 +1527,6 @@ void kk_platMsg_handle(void* data, char* chalMark){ ...@@ -1527,7 +1527,6 @@ void kk_platMsg_handle(void* data, char* chalMark){
if (res < SUCCESS_RETURN) { if (res < SUCCESS_RETURN) {
goto error; goto error;
} }
printf("--------------------------------------->11111111111111111111113333\n");
dm_mgr_update_timestamp_by_devicecode(node->deviceCode,0); dm_mgr_update_timestamp_by_devicecode(node->deviceCode,0);
dm_mgr_set_dev_onoffline(node,1); dm_mgr_set_dev_onoffline(node,1);
//kk_ipc_send(IPC_MID2APP,data,strlen(data)+1); //kk_ipc_send(IPC_MID2APP,data,strlen(data)+1);
......
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