Commit faeb96b8 authored by chen.weican's avatar chen.weican

【修改内容】1,增加软件多控机制

【提交人】陈伟灿
parent 652f80d7
...@@ -175,8 +175,6 @@ static int mqtt_start(void) ...@@ -175,8 +175,6 @@ static int mqtt_start(void)
count = 0; count = 0;
WARNING_PRINT("---------------------------------->CONNECT FAIL!!!\n"); WARNING_PRINT("---------------------------------->CONNECT FAIL!!!\n");
break; break;
//INFO_PRINT("i am send now\n");
//KK_MQTT_SendMsg(TOPIC,"hello my world",2);
} }
}else{ }else{
if(count > 0){ if(count > 0){
...@@ -199,7 +197,7 @@ static int mqtt_start_ex(int isdefault) ...@@ -199,7 +197,7 @@ static int mqtt_start_ex(int isdefault)
MQTTAsync mqttClient; MQTTAsync mqttClient;
int rc = 0; int rc = 0;
if(isdefault){ if(isdefault){
mqttClient = kk_connect_default(); //mqttClient = kk_connect_default();
}else{ }else{
mqttClient = kk_mqtt_connect(); mqttClient = kk_mqtt_connect();
} }
...@@ -213,13 +211,10 @@ static int mqtt_start_ex(int isdefault) ...@@ -213,13 +211,10 @@ static int mqtt_start_ex(int isdefault)
if(kk_get_cloud_status() == 0){ if(kk_get_cloud_status() == 0){
//printf("------------------------------>count:%d\n",count); //printf("------------------------------>count:%d\n",count);
count++; count++;
if(count>500) if(count>50){
{
count = 0; count = 0;
WARNING_PRINT("---------------------------------->CONNECT FAIL!!!\n"); WARNING_PRINT("---------------------------------->CONNECT FAIL!!!\n");
break; break;
//INFO_PRINT("i am send now\n");
//KK_MQTT_SendMsg(TOPIC,"hello my world",2);
} }
}else{ }else{
if(count > 0){ if(count > 0){
...@@ -319,8 +314,8 @@ int main(int argc, char* argv[]) ...@@ -319,8 +314,8 @@ int main(int argc, char* argv[])
#endif #endif
kk_ipc_init(IPC_APP2MID,(ipc_cb*)KK_Data_FromDev,NULL,NULL); kk_ipc_init(IPC_APP2MID,(ipc_cb*)KK_Data_FromDev,NULL,NULL);
#if 1 #if 1
kk_dl_config();
again: again:
kk_dl_config();
rc = kk_register_auth_get(); rc = kk_register_auth_get();
if(rc == 0){ if(rc == 0){
rc = mqtt_start_ex(0); rc = mqtt_start_ex(0);
......
...@@ -477,6 +477,7 @@ static int _kk_parse_auth_dl_host(cJSON *authInfo,char *url){ ...@@ -477,6 +477,7 @@ static int _kk_parse_auth_dl_host(cJSON *authInfo,char *url){
} }
static int _kk_get_auth_dl_host(char *buf,char *url){ static int _kk_get_auth_dl_host(char *buf,char *url){
cJSON *authInfo = NULL; cJSON *authInfo = NULL;
int ret = 0;
if(buf == NULL || url == NULL){ if(buf == NULL || url == NULL){
return -1; return -1;
} }
...@@ -490,9 +491,9 @@ static int _kk_get_auth_dl_host(char *buf,char *url){ ...@@ -490,9 +491,9 @@ static int _kk_get_auth_dl_host(char *buf,char *url){
}else{ }else{
authInfo = cJSON_GetObjectItem(data,"mqtt_auth_entry"); authInfo = cJSON_GetObjectItem(data,"mqtt_auth_entry");
} }
_kk_parse_auth_dl_host(authInfo,url); ret = _kk_parse_auth_dl_host(authInfo,url);
cJSON_Delete(configObj); cJSON_Delete(configObj);
return 0; return ret;
} }
static int s_getAuthSize = 0; static int s_getAuthSize = 0;
size_t receive_auth_data(void *buffer, size_t size, size_t nmemb, FILE *file){ size_t receive_auth_data(void *buffer, size_t size, size_t nmemb, FILE *file){
...@@ -531,16 +532,8 @@ int kk_register_auth_get(){ ...@@ -531,16 +532,8 @@ int kk_register_auth_get(){
static int s_count = 0; static int s_count = 0;
CURL* curl; CURL* curl;
ret = kk_check_config_file(KK_CONFIG_FILE_PATH,&configData); ret = kk_check_config_file(KK_CONFIG_FILE_PATH,&configData);
defaultCon:
if(ret != 0){
defaultFlag = 1;
ret = kk_check_config_file(KK_DEFAULT_CONFIG_FILE_PATH,&configData);
}
if(ret == 0){ if(ret == 0){
ret = _kk_get_auth_dl_host(configData,url); ret = _kk_get_auth_dl_host(configData,url);
if(ret == -2 && defaultFlag == 0){
goto defaultCon;
}
if(ret == 0){ if(ret == 0){
again: again:
s_count++; s_count++;
......
...@@ -10,7 +10,6 @@ static const char* OPT_SEND = "MQTTAsync_sendMessage"; ...@@ -10,7 +10,6 @@ static const char* OPT_SEND = "MQTTAsync_sendMessage";
static const char* OPT_SUB = "MQTTAsync_subscribe"; static const char* OPT_SUB = "MQTTAsync_subscribe";
static const char* OPT_UNSUB = "MQTTAsync_unsubscribe"; static const char* OPT_UNSUB = "MQTTAsync_unsubscribe";
static MQTTAsync s_Client; static MQTTAsync s_Client;
static int s_mqttStop = 0;
static int s_cloudStatus = DEVICE_OFFLINE; static int s_cloudStatus = DEVICE_OFFLINE;
static char *kk_will_message_create(char *ccuid,cJSON*payload) static char *kk_will_message_create(char *ccuid,cJSON*payload)
...@@ -50,7 +49,6 @@ static void connlost(void *context, char *cause) ...@@ -50,7 +49,6 @@ static void connlost(void *context, char *cause)
if(context == NULL || cause == NULL) if(context == NULL || cause == NULL)
{ {
ERROR_PRINT("PARAM ERROR\n"); ERROR_PRINT("PARAM ERROR\n");
s_mqttStop = 1;
s_cloudStatus = DEVICE_OFFLINE; s_cloudStatus = DEVICE_OFFLINE;
kk_write_disconnect_flag(); kk_write_disconnect_flag();
KK_Send_CloudState(s_cloudStatus); KK_Send_CloudState(s_cloudStatus);
...@@ -75,7 +73,7 @@ static void connlost(void *context, char *cause) ...@@ -75,7 +73,7 @@ static void connlost(void *context, char *cause)
cJSON* willPayload = cJSON_CreateObject(); cJSON* willPayload = cJSON_CreateObject();
message = kk_will_message_create(ccuid,willPayload); message = kk_will_message_create(ccuid,willPayload);
conn_opts.keepAliveInterval = 20; conn_opts.keepAliveInterval = 20;
conn_opts.cleansession = 1; conn_opts.cleansession = 0;
will_opts.retained = 0; //retained = 1 时, broker会一直保留消息,这里不需要,使用默认的0就行 will_opts.retained = 0; //retained = 1 时, broker会一直保留消息,这里不需要,使用默认的0就行
will_opts.topicName = topicBuf; will_opts.topicName = topicBuf;
will_opts.message = message; will_opts.message = message;
...@@ -83,7 +81,6 @@ static void connlost(void *context, char *cause) ...@@ -83,7 +81,6 @@ static void connlost(void *context, char *cause)
if ((rc = MQTTAsync_connect(client, &conn_opts)) != MQTTASYNC_SUCCESS) if ((rc = MQTTAsync_connect(client, &conn_opts)) != MQTTASYNC_SUCCESS)
{ {
ERROR_PRINT("Failed to start connect, return code %d\n", rc); ERROR_PRINT("Failed to start connect, return code %d\n", rc);
s_mqttStop = 1;
} }
free(message); free(message);
cJSON_Delete(willPayload); cJSON_Delete(willPayload);
...@@ -92,13 +89,11 @@ static void connlost(void *context, char *cause) ...@@ -92,13 +89,11 @@ static void connlost(void *context, char *cause)
void onDisconnectFailure(void* context, MQTTAsync_failureData* response) void onDisconnectFailure(void* context, MQTTAsync_failureData* response)
{ {
WARNING_PRINT("Disconnect failed\n"); WARNING_PRINT("Disconnect failed\n");
s_mqttStop = 1;
} }
void onDisconnect(void* context, MQTTAsync_successData* response) void onDisconnect(void* context, MQTTAsync_successData* response)
{ {
WARNING_PRINT("Successful disconnection\n"); WARNING_PRINT("Successful disconnection\n");
s_mqttStop = 1;
} }
void onSendFailure(void* context, MQTTAsync_failureData* response) void onSendFailure(void* context, MQTTAsync_failureData* response)
...@@ -136,7 +131,6 @@ void onSend(void* context, MQTTAsync_successData* response) ...@@ -136,7 +131,6 @@ void onSend(void* context, MQTTAsync_successData* response)
extern void KK_reset_sub_flag(void); extern void KK_reset_sub_flag(void);
void onConnectFailure(void* context, MQTTAsync_failureData* response) void onConnectFailure(void* context, MQTTAsync_failureData* response)
{ {
s_mqttStop = 1;
if(response == NULL) if(response == NULL)
{ {
ERROR_PRINT("PARAM ERROR\n"); ERROR_PRINT("PARAM ERROR\n");
...@@ -299,7 +293,7 @@ MQTTAsync KK_MQTT_Connect(void) ...@@ -299,7 +293,7 @@ MQTTAsync KK_MQTT_Connect(void)
//conn_opts.password = PASSWORD; //conn_opts.password = PASSWORD;
conn_opts.username = usrname; conn_opts.username = usrname;
conn_opts.password = token; conn_opts.password = token;
conn_opts.cleansession = 1; conn_opts.cleansession = 0;
conn_opts.onSuccess = onConnect; conn_opts.onSuccess = onConnect;
conn_opts.onFailure = onConnectFailure; conn_opts.onFailure = onConnectFailure;
conn_opts.context = s_Client; conn_opts.context = s_Client;
...@@ -357,7 +351,7 @@ MQTTAsync KK_MQTT_Connect_ex(char *usrname,char*pwd,char*cliendId,char*host,char ...@@ -357,7 +351,7 @@ MQTTAsync KK_MQTT_Connect_ex(char *usrname,char*pwd,char*cliendId,char*host,char
//conn_opts.password = PASSWORD; //conn_opts.password = PASSWORD;
conn_opts.username = usrname; conn_opts.username = usrname;
conn_opts.password = pwd; conn_opts.password = pwd;
conn_opts.cleansession = 1; conn_opts.cleansession = 0;
conn_opts.onSuccess = onConnect; conn_opts.onSuccess = onConnect;
conn_opts.onFailure = onConnectFailure; conn_opts.onFailure = onConnectFailure;
conn_opts.context = s_Client; conn_opts.context = s_Client;
......
...@@ -73,37 +73,50 @@ int kk_alarm_notify_handle(dm_mgr_dev_node_t *node,char *identifier,char *valueB ...@@ -73,37 +73,50 @@ int kk_alarm_notify_handle(dm_mgr_dev_node_t *node,char *identifier,char *valueB
HAL_Get_ccuid(ccuid); HAL_Get_ccuid(ccuid);
kk_property_db_get_value(node->deviceCode,"SensorType",&currentValue); kk_property_db_get_value(node->deviceCode,"SensorType",&currentValue);
INFO_PRINT("------------------------->currentValue:%d\n",currentValue); //INFO_PRINT("------------------------->currentValue:%d\n",currentValue);
INFO_PRINT("------------------------->armingstate:%d\n",atoi(armingstate)); //INFO_PRINT("------------------------->valueBuf:%s\n",valueBuf);
INFO_PRINT("------------------------->valueBuf:%s\n",valueBuf); //INFO_PRINT("------------------------->identifier:%s\n",identifier);
INFO_PRINT("------------------------->identifier:%s\n",identifier);
kk_property_db_get_value(ccuid,KK_TSL_CCU_ARMINGSTATE_IDENTIFIER,armingstate); kk_property_db_get_value(ccuid,KK_TSL_CCU_ARMINGSTATE_IDENTIFIER,armingstate);
if(strcmp(node->productCode,"3064") == 0){//门锁强报警
currentValue = SUB_ARMING_ALL_STATE;
}
cJSON *info = cJSON_CreateObject(); cJSON *info = cJSON_CreateObject();
cJSON_AddStringToObject(info, MSG_TYPE_STR, "/thing/event/alarmNotify");
cJSON_AddStringToObject(info, MSG_DEVICE_CODE_STR, node->deviceCode); cJSON_AddStringToObject(info, MSG_DEVICE_CODE_STR, node->deviceCode);
cJSON_AddStringToObject(info, MSG_PRODUCT_CODE_STR, node->productCode); cJSON_AddStringToObject(info, MSG_PRODUCT_CODE_STR, node->productCode);
char *infff=cJSON_Print(info);
cJSON *payload = cJSON_CreateObject(); cJSON *payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "method", "thing.event.alarmNotify");
cJSON_AddStringToObject(payload, "version", "1.0"); cJSON_AddStringToObject(payload, "version", "1.0");
cJSON_AddStringToObject(payload, "identifier", "alarmNotify");
char msgId[64] = {0}; char msgId[64] = {0};
iotx_report_id(msgId); iotx_report_id(msgId);
cJSON_AddStringToObject(payload, "msgId", msgId); cJSON_AddStringToObject(payload, "msgId", msgId);
//char timerStr[16] = {0}; //char timerStr[16] = {0};
//HAL_GetTime_s(timerStr); //HAL_GetTime_s(timerStr);
cJSON_AddNumberToObject(payload, "time", HAL_GetTime_ms()); cJSON_AddNumberToObject(payload, "time", HAL_GetTime_ms());
cJSON *param = cJSON_CreateObject(); cJSON *param = cJSON_CreateObject();
if(strcmp(identifier,"BatteryAlarm") == 0){ if(strcmp(identifier,"BatteryAlarm") == 0){
if(atoi(valueBuf) == 1){
cJSON_AddStringToObject(param, "LowBatteryState", "1"); cJSON_AddStringToObject(param, "LowBatteryState", "1");
//needSave = 1; cJSON_AddStringToObject(info, MSG_TYPE_STR, "/thing/event/BatteryAlarm/post");
cJSON_AddStringToObject(payload, "method", "thing.event.BatteryAlarm.post");
cJSON_AddStringToObject(payload, "identifier", "BatteryAlarm");
}else{
cJSON_Delete(param);
cJSON_Delete(payload);
cJSON_Delete(info);
return 0;
}
}else if(strcmp(identifier,"DismantleState") == 0){ }else if(strcmp(identifier,"DismantleState") == 0){
if(atoi(valueBuf) == 1){ if(atoi(valueBuf) == 1){
if(strcmp(node->productCode,"3064") == 0){//门锁防拆特殊处理
cJSON_AddStringToObject(param, "DismantleState", valueBuf); cJSON_AddStringToObject(param, "DismantleState", valueBuf);
cJSON_AddStringToObject(info, MSG_TYPE_STR, "/thing/event/LockTamperAlarm/post");
cJSON_AddStringToObject(payload, "method", "thing.event.LockTamperAlarm.post");
cJSON_AddStringToObject(payload, "identifier", "LockTamperAlarm");
}else{
cJSON_AddStringToObject(param, "DismantleState", valueBuf);
cJSON_AddStringToObject(info, MSG_TYPE_STR, "/thing/event/alarmNotify");
cJSON_AddStringToObject(payload, "method", "thing.event.alarmNotify");
cJSON_AddStringToObject(payload, "identifier", "alarmNotify");
}
}else{ }else{
cJSON_Delete(param); cJSON_Delete(param);
cJSON_Delete(payload); cJSON_Delete(payload);
...@@ -115,6 +128,9 @@ int kk_alarm_notify_handle(dm_mgr_dev_node_t *node,char *identifier,char *valueB ...@@ -115,6 +128,9 @@ int kk_alarm_notify_handle(dm_mgr_dev_node_t *node,char *identifier,char *valueB
//cJSON_AddStringToObject(param, "CommonAlarmState", valueBuf); //cJSON_AddStringToObject(param, "CommonAlarmState", valueBuf);
// } // }
else{ else{
cJSON_AddStringToObject(info, MSG_TYPE_STR, "/thing/event/alarmNotify");
cJSON_AddStringToObject(payload, "method", "thing.event.alarmNotify");
cJSON_AddStringToObject(payload, "identifier", "alarmNotify");
if(atoi(valueBuf) == 1){ if(atoi(valueBuf) == 1){
cJSON_AddStringToObject(param, "CommonAlarmState", "1"); cJSON_AddStringToObject(param, "CommonAlarmState", "1");
}else{ }else{
...@@ -127,6 +143,7 @@ int kk_alarm_notify_handle(dm_mgr_dev_node_t *node,char *identifier,char *valueB ...@@ -127,6 +143,7 @@ int kk_alarm_notify_handle(dm_mgr_dev_node_t *node,char *identifier,char *valueB
} }
cJSON_AddItemToObject(payload, "params", param); cJSON_AddItemToObject(payload, "params", param);
char *payload11=cJSON_Print(payload); char *payload11=cJSON_Print(payload);
char *infff=cJSON_Print(info);
if(currentValue == SUB_ARMING_ALL_STATE)//24小时警戒 if(currentValue == SUB_ARMING_ALL_STATE)//24小时警戒
{ {
INFO_PRINT("payload11: %s\n",payload11); INFO_PRINT("payload11: %s\n",payload11);
......
...@@ -1288,9 +1288,9 @@ static int kk_service_addScreen_handle(cJSON *info,cJSON *msgId,cJSON *params) ...@@ -1288,9 +1288,9 @@ static int kk_service_addScreen_handle(cJSON *info,cJSON *msgId,cJSON *params)
if(devtype == NULL) return INVALID_PARAMETER; if(devtype == NULL) return INVALID_PARAMETER;
kk_service_addScreen_handle_reply(info,msgId,serialid->valuestring); kk_service_addScreen_handle_reply(info,msgId,serialid->valuestring);
if(strcmp(mac_head,"01:01") == 0){//moore4c mac if(strcmp(mac_head,"01:01") == 0){//moore4c mac
kk_screenDev_insert_db(devtype->valueint,serialid->valuestring,ip->valuestring,&str_mac[6],version->valuestring,""); kk_screenDev_insert_db(devtype->valueint,serialid->valuestring,ip->valuestring,&str_mac[6],version->valuestring,"","MOORE4C");
}else{ }else{
kk_screenDev_insert_db(devtype->valueint,serialid->valuestring,ip->valuestring,str_mac,version->valuestring,""); kk_screenDev_insert_db(devtype->valueint,serialid->valuestring,ip->valuestring,str_mac,version->valuestring,"","MOORE4S");
} }
kk_service_client_online_push(info,msgId,serialid->valuestring); kk_service_client_online_push(info,msgId,serialid->valuestring);
return SUCCESS_RETURN; return SUCCESS_RETURN;
......
...@@ -838,7 +838,41 @@ int kk_indoorAir_db_insert(const char *deviceCode,const char *identifier,kk_tsl_ ...@@ -838,7 +838,41 @@ int kk_indoorAir_db_insert(const char *deviceCode,const char *identifier,kk_tsl_
_kk_property_db_unlock(); _kk_property_db_unlock();
return SUCCESS_RETURN; return SUCCESS_RETURN;
} }
/************************************************************
*功能描述: 获取空调内机属性值
*输入参数: deviceCode:设备deviceCode
identifier:属性名称
*输出参数: value:属性值,返回的是字串
*返 回 值: 0:成功;其他:失败
*其他说明:
*************************************************************/
int kk_indoorair_property_db_get_value_directly(const char *deviceCode,const char *identifier,char* value,int ep)
{
char *sqlCmd = NULL;
//int rc = 0;
//char *zErrMsg = 0;
int epNum = 0;
sqlite3_stmt *stmt;
char *valueStr = "";
kk_property_db_ctx_t *ctx = _kk_property_db_get_ctx();
_kk_property_db_lock();
sqlCmd = sqlite3_mprintf("select * from indoorAirProperties WHERE deviceCode= '%s' and identifier = '%s'",deviceCode,identifier);
sqlite3_prepare_v2(ctx->pDb, sqlCmd, strlen(sqlCmd), &stmt, NULL);
while(sqlite3_step(stmt) == SQLITE_ROW){
valueStr = (char*)sqlite3_column_text(stmt, DB_INDOORAIR_VALUE);
epNum = sqlite3_column_int(stmt, DB_INDOORAIR_EPNUM);
if(ep == epNum){
memcpy(value,valueStr, strlen(valueStr));
}
}
sqlite3_free(sqlCmd);
_kk_property_db_unlock();
sqlite3_finalize(stmt);
return SUCCESS_RETURN;
}
/************************************************************ /************************************************************
*功能描述: 查询空调内机数量 *功能描述: 查询空调内机数量
*输入参数: deviceCode:设备deviceCode *输入参数: deviceCode:设备deviceCode
...@@ -1062,11 +1096,11 @@ int kk_property_db_get_value(const char *deviceCode,const char *identifier,void* ...@@ -1062,11 +1096,11 @@ int kk_property_db_get_value(const char *deviceCode,const char *identifier,void*
*(int*)value = value_int; *(int*)value = value_int;
} }
else if(valueType == KK_TSL_DATA_TYPE_FLOAT){ else if(valueType == KK_TSL_DATA_TYPE_FLOAT){
float value_float = atoi(valueStr); float value_float = atof(valueStr);
*(float*)value = value_float; *(float*)value = value_float;
} }
else if(valueType == KK_TSL_DATA_TYPE_DOUBLE){ else if(valueType == KK_TSL_DATA_TYPE_DOUBLE){
double value_double = atoi(valueStr); double value_double = atof(valueStr);
*(double*)value = value_double; *(double*)value = value_double;
} }
else{ else{
......
...@@ -90,5 +90,6 @@ int kk_subFreshAir_get_online(const char *deviceCode,int ep); ...@@ -90,5 +90,6 @@ int kk_subFreshAir_get_online(const char *deviceCode,int ep);
int kk_indoorAir_db_update_online(const char *deviceCode,int online,int epNum); int kk_indoorAir_db_update_online(const char *deviceCode,int online,int epNum);
int kk_subFreshAir_db_update_online(const char *deviceCode,int online,int epNum); int kk_subFreshAir_db_update_online(const char *deviceCode,int online,int epNum);
int kk_subAirSwitch_db_update_online(const char *deviceCode,int online,int epNum); int kk_subAirSwitch_db_update_online(const char *deviceCode,int online,int epNum);
int kk_indoorair_property_db_get_value_directly(const char *deviceCode,const char *identifier,char* value,int ep);
#endif #endif
...@@ -311,6 +311,29 @@ int kk_LockUser_insert_db(char *keyId,char *keyType,char *keyRole,char *keyName, ...@@ -311,6 +311,29 @@ int kk_LockUser_insert_db(char *keyId,char *keyType,char *keyRole,char *keyName,
_kk_subDb_unlock(); _kk_subDb_unlock();
return SUCCESS_RETURN; return SUCCESS_RETURN;
} }
int kk_delete_LockUser_info_byId(const char *id)
{
const char *deleteCmd = "delete from LockUserInfo where keyId = '%s';";
char *sqlCmd = NULL;
int rc = 0;
char *zErrMsg = 0;
kk_subDb_ctx_t *ctx = _kk_subDb_get_ctx();
_kk_subDb_lock();
sqlCmd = sqlite3_mprintf(deleteCmd,id);
INFO_PRINT("Table delete data 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 delete data successfully\n");
}
sqlite3_free(sqlCmd);
_kk_subDb_unlock();
return SUCCESS_RETURN;
}
/************************************************************ /************************************************************
*功能描述:获取屏类列表 *功能描述:获取屏类列表
*输入参数:deviceCode:设备deviceCode *输入参数:deviceCode:设备deviceCode
...@@ -820,6 +843,20 @@ int kk_indoor_air_action_add(char *propertyValue,char* deviceCode,int delay,char ...@@ -820,6 +843,20 @@ int kk_indoor_air_action_add(char *propertyValue,char* deviceCode,int delay,char
if (json == NULL) { if (json == NULL) {
return -1; return -1;
} }
cJSON* WorkMode = cJSON_GetObjectItem(json, "WorkMode");
if(WorkMode == NULL){ cJSON_Delete(json);return -1;}
memset(data,0x0,sizeof(data));
if(WorkMode->type == cJSON_String){
memcpy(data,WorkMode->valuestring,strlen(WorkMode->valuestring));
}else{
sprintf(data,"%d",WorkMode->valueint);
}
if(mutiDev){
_kk_indoor_air_info_handle(deviceCode,"WorkMode_1",data,epnum,delay,gwDeviceCode,sceneId,type,0);
}else{
_kk_indoor_air_info_handle(deviceCode,"WorkMode",data,epnum,delay,gwDeviceCode,sceneId,type,0);
}
cJSON* Temperature = cJSON_GetObjectItem(json, "Temperature"); cJSON* Temperature = cJSON_GetObjectItem(json, "Temperature");
if(Temperature == NULL) { cJSON_Delete(json);return -1;} if(Temperature == NULL) { cJSON_Delete(json);return -1;}
memset(data,0x0,sizeof(data)); memset(data,0x0,sizeof(data));
...@@ -848,21 +885,6 @@ int kk_indoor_air_action_add(char *propertyValue,char* deviceCode,int delay,char ...@@ -848,21 +885,6 @@ int kk_indoor_air_action_add(char *propertyValue,char* deviceCode,int delay,char
_kk_indoor_air_info_handle(deviceCode,"WindSpeed",data,epnum,delay,gwDeviceCode,sceneId,type,0); _kk_indoor_air_info_handle(deviceCode,"WindSpeed",data,epnum,delay,gwDeviceCode,sceneId,type,0);
} }
cJSON* WorkMode = cJSON_GetObjectItem(json, "WorkMode");
if(WorkMode == NULL){ cJSON_Delete(json);return -1;}
memset(data,0x0,sizeof(data));
if(WorkMode->type == cJSON_String){
memcpy(data,WorkMode->valuestring,strlen(WorkMode->valuestring));
}else{
sprintf(data,"%d",WorkMode->valueint);
}
if(mutiDev){
_kk_indoor_air_info_handle(deviceCode,"WorkMode_1",data,epnum,delay,gwDeviceCode,sceneId,type,0);
}else{
_kk_indoor_air_info_handle(deviceCode,"WorkMode",data,epnum,delay,gwDeviceCode,sceneId,type,0);
}
cJSON_Delete(json); cJSON_Delete(json);
return 0; return 0;
} }
...@@ -1265,7 +1287,7 @@ int kk_screenDev_update(int devType,char *serialId, \ ...@@ -1265,7 +1287,7 @@ int kk_screenDev_update(int devType,char *serialId, \
*其他说明: *其他说明:
*************************************************************/ *************************************************************/
int kk_screenDev_insert_db(int devType,char *serialId, \ int kk_screenDev_insert_db(int devType,char *serialId, \
char *ip,char *mac,char *version,char *expand) char *ip,char *mac,char *version,char *expand,char *name)
{ {
const char *insertCmd = "insert into ScreenDeviceInfo (isOffline,type,serialId,deviceIp,deviceName,mac,version,roomId,roomName,expand) \ const char *insertCmd = "insert into ScreenDeviceInfo (isOffline,type,serialId,deviceIp,deviceName,mac,version,roomId,roomName,expand) \
values ('%d','%d','%s','%s','%s','%s','%s','%s','%s','%s');"; values ('%d','%d','%s','%s','%s','%s','%s','%s','%s','%s');";
...@@ -1281,11 +1303,7 @@ int kk_screenDev_insert_db(int devType,char *serialId, \ ...@@ -1281,11 +1303,7 @@ int kk_screenDev_insert_db(int devType,char *serialId, \
return SUCCESS_RETURN; return SUCCESS_RETURN;
} }
_kk_subDb_lock(); _kk_subDb_lock();
#ifdef CONFIG_A133_PLATFORM sqlCmd = sqlite3_mprintf(insertCmd,1,devType,serialId,ip,name,mac,version,"","",expand);
sqlCmd = sqlite3_mprintf(insertCmd,1,devType,serialId,ip,"MOOR4S",mac,version,"","",expand);
#else
sqlCmd = sqlite3_mprintf(insertCmd,1,devType,serialId,ip,"MOOR4C",mac,version,"","",expand);
#endif
rc = sqlite3_exec(ctx->pDb, sqlCmd, NULL, NULL, &zErrMsg); rc = sqlite3_exec(ctx->pDb, sqlCmd, NULL, NULL, &zErrMsg);
if( rc != SQLITE_OK ){ if( rc != SQLITE_OK ){
......
...@@ -43,7 +43,7 @@ int kk_subDev_getSensors_reply(SensorType_t*list); ...@@ -43,7 +43,7 @@ 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); int kk_subDev_check_auth(int devType);
int kk_screenDev_insert_db(int devType,char *serialId, \ int kk_screenDev_insert_db(int devType,char *serialId, \
char *ip,char *mac,char *version,char *expand); char *ip,char *mac,char *version,char *expand,char *name);
int kk_screenDev_update_room(char *serialId,char *roomid,char *roomname,char* name); int kk_screenDev_update_room(char *serialId,char *roomid,char *roomname,char* name);
int kk_screenDev_delete_by_serialId(char *serialId); int kk_screenDev_delete_by_serialId(char *serialId);
int kk_get_screenDev_list(ScreenDevInfo_t*list); int kk_get_screenDev_list(ScreenDevInfo_t*list);
...@@ -55,6 +55,7 @@ int kk_subDev_find_fatherDeviceCode(const char *deviceCode,char *fatherDeviceCod ...@@ -55,6 +55,7 @@ int kk_subDev_find_fatherDeviceCode(const char *deviceCode,char *fatherDeviceCod
int kk_LockUser_insert_db(char *keyId,char *keyType,char*keyRole,char *keyName,char* deviceCode); int kk_LockUser_insert_db(char *keyId,char *keyType,char*keyRole,char *keyName,char* deviceCode);
int kk_get_LockUser_list(LockKeyInfo_t *list,const char *deviceCode); int kk_get_LockUser_list(LockKeyInfo_t *list,const char *deviceCode);
int kk_delete_LockUser_info(const char *deviceCode); int kk_delete_LockUser_info(const char *deviceCode);
int kk_delete_LockUser_info_byId(const char *id);
enum{ enum{
DB_SUB_IDX = 0, DB_SUB_IDX = 0,
DB_SUB_ONLINE, DB_SUB_ONLINE,
......
...@@ -326,13 +326,11 @@ static int kk_property_set_data_check(cJSON * payload,const char *deviceCode){ ...@@ -326,13 +326,11 @@ static int kk_property_set_data_check(cJSON * payload,const char *deviceCode){
}else{ }else{
epNumInt = 1; epNumInt = 1;
} }
//printf("----------------->epNumInt:%d\n",epNumInt);
for(idx = 0; idx < node->dev_shadow->property_number; idx++){ for(idx = 0; idx < node->dev_shadow->property_number; idx++){
property = (kk_tsl_data_t *)(node->dev_shadow->properties + idx); property = (kk_tsl_data_t *)(node->dev_shadow->properties + idx);
if(property == NULL){ if(property == NULL){
continue; continue;
} }
//printf("----------------->property->identifier:%s\n",property->identifier);
memset(propertiesTmp,0x0,sizeof(propertiesTmp)); memset(propertiesTmp,0x0,sizeof(propertiesTmp));
memcpy(propertiesTmp,property->identifier,strlen(property->identifier)); memcpy(propertiesTmp,property->identifier,strlen(property->identifier));
split(propertiesTmp,"_",propertiesbuf,&num); split(propertiesTmp,"_",propertiesbuf,&num);
...@@ -996,8 +994,9 @@ void mid_cb(void* data, int len){ ...@@ -996,8 +994,9 @@ void mid_cb(void* data, int len){
cJSON_Delete(json); cJSON_Delete(json);
return; return;
} }
#if 0
if(strcmp(gw_node->productType,KK_DM_AIR_SWITCH_GATEWAY_TYPE) == 0){ if(strcmp(gw_node->productType,KK_DM_AIR_SWITCH_GATEWAY_TYPE) == 0){
res = _kk_handle_airswitch_property(gw_node->fatherDeviceCode,info_root,payload);//空开epnum 传的是数组,无语 res = _kk_handle_airswitch_property(gw_node->fatherDeviceCode,info_root,payload);
if(res != 0){ if(res != 0){
cJSON * rootData=cJSON_CreateObject(); cJSON * rootData=cJSON_CreateObject();
char *info_rootS=cJSON_Print(info_root); char *info_rootS=cJSON_Print(info_root);
...@@ -1011,7 +1010,9 @@ void mid_cb(void* data, int len){ ...@@ -1011,7 +1010,9 @@ void mid_cb(void* data, int len){
free(payloadS); free(payloadS);
free(pnewout); free(pnewout);
} }
}else{ }else
#endif
{
cJSON * rootData=cJSON_CreateObject(); cJSON * rootData=cJSON_CreateObject();
char *info_rootS=cJSON_Print(info_root); char *info_rootS=cJSON_Print(info_root);
char *payloadS = cJSON_Print(payload); char *payloadS = cJSON_Print(payload);
...@@ -1093,7 +1094,67 @@ void gw2mid_cb(void* data, int len, char* chalMark){ ...@@ -1093,7 +1094,67 @@ void gw2mid_cb(void* data, int len, char* chalMark){
mid2p_cb(data,len,chalMark); mid2p_cb(data,len,chalMark);
} }
} }
static int _kk_subDevice_property_single_save(cJSON *params,char *deviceCode,int type)
{
int res = 0;
int epNumInt = 0;
dm_mgr_dev_node_t *node = NULL;
kk_tsl_data_t *property = NULL;
cJSON *propertyItem = NULL;
int idx = 0;
res = dm_mgr_get_device_by_devicecode(deviceCode,&node);
if (res < SUCCESS_RETURN) {
return FAIL_RETURN;
}
cJSON *epNum = cJSON_GetObjectItem(params, "epNum");
if(epNum == NULL) return FAIL_RETURN;
if(epNum->type == cJSON_Number){
epNumInt = epNum->valueint;
}else if(epNum->type == cJSON_String){
epNumInt = atoi(epNum->valuestring);
}
for(idx = 0; idx < node->dev_shadow->property_number; idx++){
property = (kk_tsl_data_t *)(node->dev_shadow->properties + idx);
if(property == NULL){
continue;
}
propertyItem = cJSON_GetObjectItem(params, property->identifier);
if(propertyItem != NULL){
if(property->data_value.type == KK_TSL_DATA_TYPE_INT ||property->data_value.type == KK_TSL_DATA_TYPE_ENUM
||property->data_value.type == KK_TSL_DATA_TYPE_BOOL){
char valBuf[16] = {0};
int value = propertyItem->valueint;
sprintf(valBuf,"%d",value);
if(type == 0){
kk_indoorAir_db_update_value(deviceCode,property->identifier,valBuf,epNumInt);
}else if(type == 1){
kk_subAirSwitch_db_update_value(deviceCode,property->identifier,valBuf,epNumInt);
}else if(type == 2){
kk_subFreshAir_db_update_value(deviceCode,property->identifier,valBuf,epNumInt);
}
}else if(property->data_value.type == KK_TSL_DATA_TYPE_FLOAT || property->data_value.type == KK_TSL_DATA_TYPE_DOUBLE){
char valBuf[16] = {0};
sprintf(valBuf,"%f",propertyItem->valuedouble);
if(type == 0){
kk_indoorAir_db_update_value(deviceCode,property->identifier,valBuf,epNumInt);
}else if(type == 1){
kk_subAirSwitch_db_update_value(deviceCode,property->identifier,valBuf,epNumInt);
}else if(type == 2){
kk_subFreshAir_db_update_value(deviceCode,property->identifier,valBuf,epNumInt);
}
}else if(property->data_value.type == KK_TSL_DATA_TYPE_TEXT ){
if(type == 0){
kk_indoorAir_db_update_value(deviceCode,property->identifier,propertyItem->valuestring,epNumInt);
}else if(type == 1){
kk_subAirSwitch_db_update_value(deviceCode,property->identifier,propertyItem->valuestring,epNumInt);
}else if(type == 2){
kk_subFreshAir_db_update_value(deviceCode,property->identifier,propertyItem->valuestring,epNumInt);
}
}
}
}
return 0;
}
static int kk_subDevice_property_save(cJSON *payload,char *deviceCode,int type) static int kk_subDevice_property_save(cJSON *payload,char *deviceCode,int type)
{ {
dm_mgr_dev_node_t *node = NULL; dm_mgr_dev_node_t *node = NULL;
...@@ -1106,7 +1167,8 @@ static int kk_subDevice_property_save(cJSON *payload,char *deviceCode,int type) ...@@ -1106,7 +1167,8 @@ static int kk_subDevice_property_save(cJSON *payload,char *deviceCode,int type)
if(params == NULL) return FAIL_RETURN; if(params == NULL) return FAIL_RETURN;
cJSON *eps = cJSON_GetObjectItem(params, "eps"); cJSON *eps = cJSON_GetObjectItem(params, "eps");
if(eps == NULL || eps->type != cJSON_Array){ if(eps == NULL || eps->type != cJSON_Array){
return FAIL_RETURN; //return FAIL_RETURN;
return _kk_subDevice_property_single_save(params,deviceCode,type);
} }
res = dm_mgr_get_device_by_devicecode(deviceCode,&node); res = dm_mgr_get_device_by_devicecode(deviceCode,&node);
if (res < SUCCESS_RETURN) { if (res < SUCCESS_RETURN) {
...@@ -1174,6 +1236,15 @@ static int kk_subDevice_property_save(cJSON *payload,char *deviceCode,int type) ...@@ -1174,6 +1236,15 @@ static int kk_subDevice_property_save(cJSON *payload,char *deviceCode,int type)
/*type : 0,air condition gw;1,air switch gw;2,fresh air switch*/ /*type : 0,air condition gw;1,air switch gw;2,fresh air switch*/
static int kk_subDevice_property_handle(cJSON *info,cJSON *payload,char *deviceCode,int type) static int kk_subDevice_property_handle(cJSON *info,cJSON *payload,char *deviceCode,int type)
{ {
int snapshot = 0;
cJSON * jsonPay = cJSON_GetObjectItem(payload, MSG_PARAMS_STR);
if(jsonPay == NULL){
return -1;
}
cJSON *eps = cJSON_GetObjectItem(jsonPay, "eps");
if(eps != NULL){
snapshot = 1;
}
kk_subDevice_property_save(payload,deviceCode,type); kk_subDevice_property_save(payload,deviceCode,type);
cJSON_AddStringToObject(payload, MSG_DEVICE_CODE_STR, deviceCode); cJSON_AddStringToObject(payload, MSG_DEVICE_CODE_STR, deviceCode);
char *payload11=cJSON_Print(payload); char *payload11=cJSON_Print(payload);
...@@ -1181,6 +1252,9 @@ static int kk_subDevice_property_handle(cJSON *info,cJSON *payload,char *deviceC ...@@ -1181,6 +1252,9 @@ static int kk_subDevice_property_handle(cJSON *info,cJSON *payload,char *deviceC
kk_sendData2app(infff,payload11,0); kk_sendData2app(infff,payload11,0);
free(payload11); free(payload11);
free(infff); free(infff);
if(!snapshot){//快照信息不处理
kk_scene_iftt_check(deviceCode,jsonPay);
}
return 0; return 0;
} }
static int _kk_subDevice_online_to_app(cJSON *info,cJSON *payload) static int _kk_subDevice_online_to_app(cJSON *info,cJSON *payload)
...@@ -1452,14 +1526,14 @@ void kk_platMsg_handle(void* data, char* chalMark){ ...@@ -1452,14 +1526,14 @@ void kk_platMsg_handle(void* data, char* chalMark){
} }
else{ else{
/*插座类设备保存功率历史记录*/ /*插座类设备保存功率历史记录*/
if(strcmp(search_node->productType ,"outlet") == 0){ //if(strcmp(search_node->productType ,"outlet") == 0){
cJSON *power = cJSON_GetObjectItem(jsonPay,"Power"); //cJSON *power = cJSON_GetObjectItem(jsonPay,"Power");
if(power != NULL){ //if(power != NULL){
char buf[16] = {0}; //char buf[16] = {0};
sprintf(buf,"%f",power->valuedouble); //sprintf(buf,"%f",power->valuedouble);
kk_history_insert_Outlet_info(info_dcode->valuestring,buf,"",HAL_GetTime()); //kk_history_insert_Outlet_info(info_dcode->valuestring,buf,"",HAL_GetTime());
} //}
} //}
char* outstr = cJSON_Print(payload); char* outstr = cJSON_Print(payload);
kk_tsl_property_set_by_shadow(search_node->dev_shadow, outstr, strlen(outstr)+1); kk_tsl_property_set_by_shadow(search_node->dev_shadow, outstr, strlen(outstr)+1);
proCode = cJSON_GetObjectItem(info, MSG_PRODUCT_CODE_STR); proCode = cJSON_GetObjectItem(info, MSG_PRODUCT_CODE_STR);
...@@ -1507,7 +1581,9 @@ void kk_platMsg_handle(void* data, char* chalMark){ ...@@ -1507,7 +1581,9 @@ void kk_platMsg_handle(void* data, char* chalMark){
dm_mgr_set_dev_onoffline(node,0); dm_mgr_set_dev_onoffline(node,0);
} }
/*如果是传感器类设备,事件上报的同时需要记录数据到数据库*/ /*如果是传感器类设备,事件上报的同时需要记录数据到数据库*/
if(strcmp(node->productType ,"sensor") == 0){ if(strcmp(node->productType ,"sensor" ) == 0 ||
strcmp(node->productType ,"Doorlock" ) == 0 ||
strcmp(node->productType ,"siren" ) == 0){
sensorDev = 1; sensorDev = 1;
} }
if(strcmp(msgType->valuestring, "/thing/event/SceneRecall/post") == 0){ if(strcmp(msgType->valuestring, "/thing/event/SceneRecall/post") == 0){
...@@ -1520,7 +1596,7 @@ void kk_platMsg_handle(void* data, char* chalMark){ ...@@ -1520,7 +1596,7 @@ void kk_platMsg_handle(void* data, char* chalMark){
sprintf(btnId,"%d",buttonId->valueint); sprintf(btnId,"%d",buttonId->valueint);
kk_scene_execute_quickpanel(btnId,info_dcode->valuestring); kk_scene_execute_quickpanel(btnId,info_dcode->valuestring);
} }
INFO_PRINT("-------------------kk_platMsg_handle event post enters \n"); INFO_PRINT("-------------------kk_platMsg_handle event post enters:%s \n",msgType->valuestring);
for(idx = 0; idx < node->dev_shadow->event_number; idx++){ for(idx = 0; idx < node->dev_shadow->event_number; idx++){
eventItem = node->dev_shadow->events + idx; eventItem = node->dev_shadow->events + idx;
if(eventItem != NULL){ if(eventItem != NULL){
...@@ -1572,7 +1648,9 @@ void kk_platMsg_handle(void* data, char* chalMark){ ...@@ -1572,7 +1648,9 @@ void kk_platMsg_handle(void* data, char* chalMark){
} }
if(pack==0){ if(pack==0){
INFO_PRINT("kk_platMsg_handle data: event post,eventItem->identifier:%s\n",eventItem->identifier); INFO_PRINT("kk_platMsg_handle data: event post,eventItem->identifier:%s\n",eventItem->identifier);
if(strcmp(eventItem->identifier,"TamperAlarm") != 0){//TamperAlarm不需要上报,否则APP显示会有问题 if(strcmp(eventItem->identifier,"TamperAlarm") == 0 || strcmp(eventItem->identifier,"sirenAlarm") == 0){//TamperAlarm不需要上报,否则APP显示会有问题
}else{
dm_msg_thing_event_post(info_dcode->valuestring,eventItem->identifier,NULL); dm_msg_thing_event_post(info_dcode->valuestring,eventItem->identifier,NULL);
} }
kk_scene_iftt_check(info_dcode->valuestring,jsonPay); kk_scene_iftt_check(info_dcode->valuestring,jsonPay);
...@@ -1598,6 +1676,13 @@ void kk_platMsg_handle(void* data, char* chalMark){ ...@@ -1598,6 +1676,13 @@ void kk_platMsg_handle(void* data, char* chalMark){
kk_LockUser_insert_db(keyId->valuestring,KeyTypeBuf,KeyRoleBuf,"",info_dcode->valuestring); kk_LockUser_insert_db(keyId->valuestring,KeyTypeBuf,KeyRoleBuf,"",info_dcode->valuestring);
} }
} }
if(strcmp(eventItem->identifier,"KeyDeletedNotification") == 0)
{
cJSON * keyId = cJSON_GetObjectItem(jsonPay, "KeyID");
if(keyId != NULL){
kk_delete_LockUser_info_byId(keyId->valuestring);
}
}
if(strcmp(eventItem->identifier,"LockOpenNotification") == 0){ if(strcmp(eventItem->identifier,"LockOpenNotification") == 0){
kk_scene_iftt_check(info_dcode->valuestring,jsonPay); kk_scene_iftt_check(info_dcode->valuestring,jsonPay);
} }
...@@ -1605,16 +1690,11 @@ void kk_platMsg_handle(void* data, char* chalMark){ ...@@ -1605,16 +1690,11 @@ void kk_platMsg_handle(void* data, char* chalMark){
} }
else if(strcmp(eventItem->identifier,MSG_PROPERTY_STR) != 0 && else if(strcmp(eventItem->identifier,MSG_PROPERTY_STR) != 0 &&
eventItem->output_data_number == 0){ eventItem->output_data_number == 0){
itemStr = cJSON_GetObjectItem(jsonPay, eventItem->identifier); if(strcmp(eventItem->identifier,"DoorBell") != 0){//门铃事件不处理;
if(itemStr != NULL){
if(sensorDev){
//kk_history_insert_sensor_info(info_dcode->valuestring,eventItem->identifier,"",HAL_GetTime());
}
//kk_tsl_set_value(kk_tsl_set_event_output_value,dev_shadow,eventItem->identifier,&itemStr->valueint,NULL);
dm_msg_thing_event_post(info_dcode->valuestring,eventItem->identifier,NULL); dm_msg_thing_event_post(info_dcode->valuestring,eventItem->identifier,NULL);
} }
} }
} }
} }
} }
......
This diff is collapsed.
#ifndef __KK_MUTICTRL_HANDLE_H__
#define __KK_MUTICTRL_HANDLE_H__
#include "cJSON.h"
int kk_virtual_mutictrl_check(const char*deviceCode,cJSON *param);
int kk_manual_mutictrl_execute(const char*deviceCode,cJSON *param);
#endif
\ No newline at end of file
This diff is collapsed.
...@@ -96,15 +96,12 @@ int kk_pollution_condition_check(char *deviceCode,int grade) ...@@ -96,15 +96,12 @@ int kk_pollution_condition_check(char *deviceCode,int grade)
char currentValue[64] = {0}; char currentValue[64] = {0};
num = sizeof(g_pollutionMap)/sizeof(kk_pollution_t); num = sizeof(g_pollutionMap)/sizeof(kk_pollution_t);
for(i = 0; i < num; i++){ for(i = 0; i < num; i++){
printf("------------->g_pollutionMap[i].identifier:%s\n",g_pollutionMap[i].identifier);
memset(currentValue,0x0,sizeof(currentValue)); memset(currentValue,0x0,sizeof(currentValue));
kk_property_db_get_value_directly(deviceCode,g_pollutionMap[i].identifier,currentValue); kk_property_db_get_value_directly(deviceCode,g_pollutionMap[i].identifier,currentValue);
if(strcmp(currentValue,"") == 0){ if(strcmp(currentValue,"") == 0){
continue; continue;
} }
printf("------------->currentValue:%s\n",currentValue);
ret = kk_pollution_level_check(g_pollutionMap[i].levelMap,atoi(currentValue),4); ret = kk_pollution_level_check(g_pollutionMap[i].levelMap,atoi(currentValue),4);
printf("------------->ret:%d\n",ret);
if(ret != -1){ if(ret != -1){
if(grade == 1){ if(grade == 1){
if(ret == 1){ if(ret == 1){
...@@ -131,7 +128,6 @@ int kk_pm25_condition_check(char *deviceCode) ...@@ -131,7 +128,6 @@ int kk_pm25_condition_check(char *deviceCode)
int i = 0; int i = 0;
int ret = 0; int ret = 0;
char currentValue[64] = {0}; char currentValue[64] = {0};
kk_property_db_get_value_directly(deviceCode,"PM2.5",currentValue); kk_property_db_get_value_directly(deviceCode,"PM2.5",currentValue);
if(strcmp(currentValue,"") == 0){ if(strcmp(currentValue,"") == 0){
return 0; return 0;
......
...@@ -280,7 +280,7 @@ ...@@ -280,7 +280,7 @@
} }
} }
], ],
"identifier": "Alarm", "identifier": "sirenAlarm",
"method": "thing.event.sirenAlarm.post", "method": "thing.event.sirenAlarm.post",
"name": "sirenAlarm", "name": "sirenAlarm",
"type": "alarm", "type": "alarm",
......
{ {
"schema": "https://iot-ap.ikonke.com/model/product_3064.json", "schema": "https://iot-ap.ikonke.com/model/product_3064.json",
"productType": "Doorlock", "productType": "Doorlock",
"version": "1.2", "version": "1.3",
"profile": { "profile": {
"heartbeat": "1200", "heartbeat": "1200",
"productCode": "3064", "productCode": "3064",
...@@ -366,6 +366,14 @@ ...@@ -366,6 +366,14 @@
"type": "alert", "type": "alert",
"required": true, "required": true,
"desc": "低电量告警" "desc": "低电量告警"
},
{
"identifier": "MultipleOpenLockFailedAlarm",
"method": "thing.event.MultipleOpenLockFailedAlarm.post",
"name": "MultipleOpenLockFailedAlarm",
"type": "alarm",
"required": true,
"desc": "暴力破解告警"
} }
] ]
} }
\ No newline at end of file
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