Commit b73ec4c5 authored by 陈伟灿's avatar 陈伟灿

Merge branch 'cwc' into 'master'

【修改内容】增加窗帘绑定功能

See merge request chenweican/k-sdk!170
parents 4ed8fa53 23b72caf
......@@ -17,6 +17,7 @@
#include "kk_scene_handle.h"
#include "kk_area_handle.h"
#include "kk_sync_data.h"
#include "kk_motor_bind_db.h"
//const char DM_URI_SYS_PREFIX[] DM_READ_ONLY = "/sys/%s/%s/";
......@@ -1715,6 +1716,12 @@ int dm_mgr_subdev_delete(_IN_ char deviceCode[DEVICE_CODE_MAXLEN])
kk_scene_deleteall_panel_scene_info(deviceCode);//如果是情景面板,删除对应信息
/*房间信息中删除对应的设备*/
kk_room_dev_remove(deviceCode,NULL);
res = kk_motor_bind_db_delete_by_deviceCode(deviceCode);
if (res != SUCCESS_RETURN) {
ERROR_PRINT("ERROR [%s][%d] res:%d\n",__FUNCTION__,__LINE__,res);
return FAIL_RETURN;
}
res = kk_subDev_delete_by_dcode(deviceCode);//delete sub db data
if (res != SUCCESS_RETURN) {
......
......@@ -565,7 +565,7 @@ int dm_msg_request (_IN_ dm_msg_request_t *request,_IN_ int isAsync)
}
payload_len = strlen(DM_MSG_REQUEST) + 10 + strlen(DM_MSG_VERSION) + request->params_len + strlen(
request->method) + 1 + 20 + strlen(request->msgid);
request->method) + 1 + 50 + strlen(request->msgid);
payload = malloc(payload_len);
if (payload == NULL) {
return MEMORY_NOT_ENOUGH;
......@@ -1433,6 +1433,7 @@ int kk_msg_parse_productType(char *str,char *productType)
}
int kk_msg_execute_scene_set(const char* params,const char *fatherDeviceCode,int isUpdate)
{
int res = 0;
......
......@@ -137,6 +137,14 @@ typedef struct {
#define KK_THING_SERVICE_CLIENTONLINEPUSH "/thing/service/clientOnlinePush"
#define KK_THING_SERVICE_GETCLIENTINFO "/thing/service/getClientInfo"
#define KK_THING_SERVICE_GETCLIENTINFO_REPLY "/thing/service/getClientInfo_reply"
#define KK_THING_SERVICE_REBIND_MOTORS "/thing/service/rebindMotors"
#define KK_THING_SERVICE_REBIND_MOTORS_REPLY "/thing/service/rebindMotors_reply"
#define KK_THING_SERVICE_ADDBIND_MOTOR "/thing/service/addBindMotor"
#define KK_THING_SERVICE_ADDBIND_MOTOR_REPLY "/thing/service/addBindMotor_reply"
#define KK_THING_SERVICE_UNBIND_MOTORS "/thing/service/unBindMotors"
#define KK_THING_SERVICE_UNBIND_MOTORS_REPLY "/thing/service/unBindMotors_reply"
#define KK_THING_SERVICE_QUERY_BIND_MOTORS "/thing/service/queryBindMotors"
#define KK_THING_SERVICE_QUERY_BIND_MOTORS_REPLY "/thing/service/queryBindMotors_reply"
void kk_sendData2app(void *info, void *payload,int isAsync);
int dm_msg_thing_sub_register(_IN_ char productCode[DEVICE_CODE_MAXLEN], _IN_ char deviceCode[DEVICE_CODE_MAXLEN],
......
......@@ -497,7 +497,7 @@ static int kk_service_addRoom_handle(const char *deviceCode, cJSON *params,cJSON
}
return SUCCESS_RETURN;
}
static int kk_service_common_reply(cJSON *param,cJSON *msgId,char *msgType)
int kk_service_common_reply(cJSON *param,cJSON *msgId,char *msgType)
{
int res = 0;
int i = 0,num = 0;
......@@ -535,6 +535,45 @@ static int kk_service_common_reply(cJSON *param,cJSON *msgId,char *msgType)
cJSON_Delete(info);
return res;
}
int kk_service_common_reply_ex(cJSON *param,cJSON *msgId,char *msgType,cJSON *Item)
{
int res = 0;
int i = 0,num = 0;
SensorType_t *pList = NULL;
if(param == NULL || msgId == NULL){
return INVALID_PARAMETER;
}
cJSON *deviceCode = cJSON_GetObjectItem(param, MSG_DEVICE_CODE_STR);
if(deviceCode == NULL){
return FAIL_RETURN;
}
cJSON *productCode = cJSON_GetObjectItem(param, MSG_PRODUCT_CODE_STR);
if(productCode == NULL){
return FAIL_RETURN;
}
cJSON *info = cJSON_CreateObject();
cJSON_AddStringToObject(info, MSG_TYPE_STR, msgType);
cJSON_AddStringToObject(info, MSG_DEVICE_CODE_STR, deviceCode->valuestring);
cJSON_AddStringToObject(info, MSG_PRODUCT_CODE_STR, productCode->valuestring);
char *infff=cJSON_Print(info);
cJSON *payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "desc", "success");
cJSON_AddStringToObject(payload, "version", "1.0");
cJSON_AddStringToObject(payload, "code", "0");
cJSON_AddStringToObject(payload, "msgId", msgId->valuestring);
cJSON_AddItemToObject(payload, "params", Item);
char *payload11=cJSON_Print(payload);
kk_sendData2app(infff,payload11,0);
free(payload11);
free(infff);
cJSON_Delete(payload);
cJSON_Delete(info);
return res;
}
/************************************************************
*功能描述:更新房间处理函数
*输入参数:params:云端传下来JSON数据,主要包含房间名称
......
......@@ -12,4 +12,7 @@ void IOT_Linkkit_Yield(int timeout_ms);
int IOT_Linkkit_Close(int devid);
int kk_mid_subdev_add(int devType, char productCode[PRODUCT_CODE_MAXLEN], char deviceCode[DEVICE_CODE_MAXLEN],char mac[DEVICE_MAC_MAXLEN],char fatherDeviceCode[DEVICE_CODE_MAXLEN],char version[32]);
int kk_service_arming_set(char *state);
int kk_service_common_reply(cJSON *param,cJSON *msgId,char *msgType);
int kk_service_common_reply_ex(cJSON *param,cJSON *msgId,char *msgType,cJSON *Item);
#endif
This diff is collapsed.
#ifndef __KK_MOTOR_BIND_DB_H__
#define __KK_MOTOR_BIND_DB_H__
#include "cJSON.h"
enum{
MOTOR_BIND_DB_PANEL_DEVICECODE = 0,
MOTOR_BIND_DB_PANEL_EP,
MOTOR_BIND_DB_MOTOR_DEVICECODE,
MOTOR_BIND_DB_MOTOR_EP,
MOTOR_BIND_DB_DUMMYID,
};
struct kk_motor_bind_info{
int epNum;
int dummyId;
char deviceCode[32];
};
int kk_motor_bind_db_init(void);
int kk_motor_bind_db_insert(const char* panelDCode,int panelEpNum,const char* motorDCode,int motorEpNum,int dummyId);
int kk_motor_bind_db_delete(const char* panelDCode,int panelEpNum,const char* motorDCode,int motorEpNum);
int kk_motor_bind_db_delete_ex(const char* panelDCode);
int kk_motor_bind_db_find(const char* panelDCode,int panelEpNum,struct kk_motor_bind_info* info,int max);
int kk_motor_bind_db_find_ex(int dummyId,struct kk_motor_bind_info* info,int max);
int kk_motor_bind_db_find_dummyId(const char* panelDCode,int panelEpNum,const char* motorDCode,int motorEpNum);
int kk_motor_bind_db_delete_by_deviceCode(const char* deviceCode);
#endif
This diff is collapsed.
{
"productCode":"3095",
"operateType":"15003",
"channel":1,
"syn_type":1,
"syn_opcode":"FAN_COIL_STATUS",
"newccu":[
{
"identifier":"PowerSwitch",
"opcodemap":"SWITCH",
"dataType":"int",
"channel":"1",
"valueRange":[0,1],
"value": 0
},{
"identifier":"WorkMode",
"opcodemap":"FAN_COIL_SET_RUN_MODEL",
"dataType":"int",
"channel":"1",
"valueRange":[1,2,3,4],
"value": 1
},{
"identifier":"WindSpeed",
"opcodemap":"FAN_COIL_SET_FUN_SPEED",
"dataType":"int",
"channel":"1",
"valueRange":[0,2,3,4],
"value": 1
},{
"identifier":"Temperature",
"opcodemap":"FAN_COIL_SET_TEMPERATURE",
"dataType":"double",
"channel":"1",
"valueRange":[],
"value": 16
},{
"identifier":"TimingOffTime",
"opcodemap":"FAN_COIL_SET_DELAY_SWITCH_TASK",
"dataType":"double",
"channel":"1",
"valueRange":[],
"value": 0
},{
"identifier":"ChildLockState",
"opcodemap":"FAN_COIL_SET_LOCK_STATUS",
"dataType":"int",
"channel":"1",
"valueRange":[0,1],
"value": 0
},{
"identifier":"CurrentTemperature",
"opcodemap":"room_temperature",
"dataType":"double",
"channel":"1",
"valueRange":[],
"value": 22
},{
"identifier":"smart_model_id",
"opcodemap":"FAN_COIL_STATUS",
"dataType":"dummy",
"channel":"1",
"valueRange":[],
"value": 0
},{
"identifier":"smart_model_time_index",
"opcodemap":"FAN_COIL_STATUS",
"dataType":"dummy",
"channel":"1",
"valueRange":[],
"value": 0
},{
"identifier":"system_time",
"opcodemap":"FAN_COIL_STATUS",
"dataType":"dummy",
"channel":"1",
"valueRange":[],
"value": "1970-01-01 00:00:00"
},{
"identifier":"week_day",
"opcodemap":"FAN_COIL_STATUS",
"dataType":"dummy",
"channel":"1",
"valueRange":[],
"value": 0
},{
"identifier":"total_work_time",
"opcodemap":"FAN_COIL_STATUS",
"dataType":"dummy",
"channel":"1",
"valueRange":[],
"value": 0
},{
"identifier":"timing_boot",
"opcodemap":"FAN_COIL_STATUS",
"dataType":"dummy",
"channel":"1",
"valueRange":[],
"value": {
"enable ": false,
"time": "00:00"
}
}
],
"oldccu":[
{
"opcode":"SWITCH",
"identifiermap":"PowerSwitch",
"dataType":"map",
"channel":"1",
"valueRange":["OFF","ON"],
"syn":"on",
"synType":"bool"
},{
"opcode":"FAN_COIL_SET_RUN_MODEL",
"identifiermap":"WorkMode",
"dataType":"map",
"channel":"1",
"valueRange":["COLD","HOT","WIND","DEHUMIDIFICATION"],
"syn":"run_model",
"synType":"map"
},{
"opcode":"FAN_COIL_SET_FUN_SPEED",
"identifiermap":"WindSpeed",
"dataType":"map",
"channel":"1",
"valueRange":["AUTO","LOW","MID","HIGH"],
"syn":"fan_speed",
"synType":"map"
},{
"opcode":"FAN_COIL_SET_TEMPERATURE",
"identifiermap":"Temperature",
"dataType":"double",
"channel":"1",
"valueRange":[],
"syn":"setting_temperature",
"synType":"double"
},{
"opcode":"FAN_COIL_SET_DELAY_SWITCH_TASK",
"identifiermap":"TimingOffTime",
"dataType":"double",
"channel":"1",
"valueRange":[],
"syn":"timing_shutdown",
"synType":"timing_shutdown"
},{
"opcode":"FAN_COIL_SET_LOCK_STATUS",
"identifiermap":"ChildLockState",
"dataType":"double",
"channel":"1",
"valueRange":[],
"syn":"",
"synType":"dummy"
},{
"opcode":"room_temperature",
"identifiermap":"CurrentTemperature",
"dataType":"double",
"channel":"1",
"valueRange":[],
"syn":"room_temperature",
"synType":"double"
},{
"opcode":"FAN_COIL_STATUS",
"identifiermap":"smart_model_id",
"dataType":"double",
"channel":"1",
"valueRange":[],
"syn":"smart_model_id",
"synType":"double"
},{
"opcode":"FAN_COIL_STATUS",
"identifiermap":"smart_model_time_index",
"dataType":"double",
"channel":"1",
"valueRange":[],
"syn":"smart_model_time_index",
"synType":"double"
},{
"opcode":"FAN_COIL_STATUS",
"identifiermap":"system_time",
"dataType":"double",
"channel":"1",
"valueRange":[],
"syn":"system_time",
"synType":"map"
},{
"opcode":"FAN_COIL_STATUS",
"identifiermap":"week_day",
"dataType":"double",
"channel":"1",
"valueRange":[],
"syn":"week_day",
"synType":"int"
},{
"opcode":"FAN_COIL_STATUS",
"identifiermap":"total_work_time",
"dataType":"double",
"channel":"1",
"valueRange":[],
"syn":"total_work_time",
"synType":"int"
},{
"opcode":"FAN_COIL_STATUS",
"identifiermap":"timing_boot",
"dataType":"double",
"channel":"1",
"valueRange":[],
"syn":"timing_boot",
"synType":"def"
}
]
}
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