Commit 4f70a671 authored by chen.weican's avatar chen.weican

【修改内容】修改多控添加,更新和删除相关问题

【提交人】陈伟灿
parent b726b75b
......@@ -549,18 +549,17 @@ int kk_scene_action_add(const char *gwdeviceCode,const char *sceneId,kk_scene_ac
*其他说明:
*************************************************************/
int kk_scene_muticontrol_info_send(cJSON* action,const char *gwdeviceCode,const char *sceneId)
int kk_scene_muticontrol_info_send(cJSON* action,const char *gwdeviceCode,const char *sceneId,int isUpdate)
{
if(action == NULL || gwdeviceCode == NULL || sceneId == NULL){
return INVALID_PARAMETER;
}
cJSON *root=cJSON_CreateObject();
cJSON_AddStringToObject(root,MSG_SCENE_SCENEID,sceneId);
cJSON_AddStringToObject(root,MSG_SCENE_ACTIONS,action->valuestring);
cJSON_AddItemToObject(root,MSG_SCENE_ACTIONS,action);
char *out=cJSON_Print(root);
printf("kk_scene_muticontrol_info_send:%s\n",out);
kk_msg_execute_scene_set(out,gwdeviceCode);
cJSON_Delete(root);
kk_msg_execute_scene_set(out,gwdeviceCode,isUpdate);
free(out);
return SUCCESS_RETURN;
}
......@@ -906,15 +905,17 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
*功能描述:解析多控
*输入参数:sceneId:对应场景Id;
str:多控的CJSON字串
isUpdate:是否是编辑多控
*输出参数:无
*返 回 值: 0:成功;其他:失败
*其他说明:
*************************************************************/
int kk_scene_parse_scene_muticontrol(const cJSON* str,const char *sceneId)
{
int kk_scene_parse_scene_muticontrol(const cJSON* str,const char *sceneId,int isUpdate){
int res = 0;
cJSON *type = NULL;
cJSON *deviceCode = NULL;
dm_mgr_dev_node_t *node = NULL;
if(str == NULL){
ERROR_PRINT("kk_scene_parse_scene_muticontrol failed\n");
......@@ -925,10 +926,10 @@ int kk_scene_parse_scene_muticontrol(const cJSON* str,const char *sceneId)
if(action == NULL) return FAIL_RETURN;
cJSON * item = action->child;
while(item != NULL){
cJSON *type = cJSON_GetObjectItem(item,MSG_SCENE_TYPE);
type = cJSON_GetObjectItem(item,MSG_SCENE_TYPE);
if(type == NULL) return FAIL_RETURN;
if(!strcmp(type->valuestring,"action/thing/group")){
cJSON *deviceCode = cJSON_GetObjectItem(item,MSG_DEVICE_CODE_STR);
deviceCode = cJSON_GetObjectItem(item,MSG_DEVICE_CODE_STR);
if(deviceCode == NULL) return FAIL_RETURN;
res = dm_mgr_get_device_by_devicecode(deviceCode->valuestring,&node);
if (res != SUCCESS_RETURN) {
......@@ -940,7 +941,10 @@ int kk_scene_parse_scene_muticontrol(const cJSON* str,const char *sceneId)
item = item->next;
}
kk_scene_muticontrol_info_send(action,node->fatherDeviceCode,sceneId);
res = kk_scene_insert_scene_action(type->valuestring,deviceCode->valuestring,0,
"","",0,sceneId,node->fatherDeviceCode);
kk_scene_muticontrol_info_send(action,node->fatherDeviceCode,sceneId,isUpdate);
return SUCCESS_RETURN;
}
......@@ -962,7 +966,6 @@ int kk_scene_parse_addscene(const cJSON* args,char *sceneId,int isUpdate)
ERROR_PRINT("[%d]kk_scene_parse_addscene fail!!!\n",__LINE__);
return INVALID_PARAMETER;
}
cJSON *name = cJSON_GetObjectItem(args,MSG_SCENE_NAME);
if(name == NULL) return FAIL_RETURN;
cJSON *sceneType = cJSON_GetObjectItem(args,MSG_SCENE_SCENCTYPE);
......@@ -974,7 +977,7 @@ int kk_scene_parse_addscene(const cJSON* args,char *sceneId,int isUpdate)
}
/*多控直接下发给网关处理*/
if(enable->valueint == 1 && sceneType->valueint == DB_SCENETYPE_MUTICONTROL){
kk_scene_parse_scene_muticontrol(args,sceneId);
kk_scene_parse_scene_muticontrol(args,sceneId,isUpdate);
}
else{
res = kk_scene_insert_scene_info(name->valuestring,sceneType->valueint,enable->valueint,sceneId);
......
......@@ -45,289 +45,7 @@
"callType": "async",
"desc": "属性获取",
"method": "thing.service.property.get",
"inputData": ["LockState", "BackLockState", "Battery", "Volume", "Language"],
"outputData": [{
"identifier": "LockState",
"name": "门锁状态",
"dataType": {
"type": "enum",
"specs": {
"0": "关闭",
"1": "打开"
}
}
}, {
"identifier": "BackLockState",
"name": "门锁状态",
"dataType": {
"type": "enum",
"specs": {
"0": "关闭",
"1": "打开"
}
}
}, {
"identifier": "Battery",
"name": "电池电量",
"dataType": {
"type": "int",
"specs": {
"min": "0",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
}
}, {
"identifier": "Volume",
"name": "门锁音量",
"dataType": {
"type": "enum",
"specs": {
"0": "静音",
"1": "低音",
"2": "中音",
"3": "高音"
}
}
}, {
"identifier": "Language",
"name": "门锁语言",
"dataType": {
"type": "enum",
"specs": {
"0": "中文",
"1": "英文"
}
}
}]
}, {
"identifier": "OpenLock",
"name": "远程开锁",
"required": false,
"callType": "async",
"method": "thing.service.OpenLock",
"inputData": [{
"identifier": "Password",
"name": "密码",
"dataType": {
"type": "text",
"specs": {
"length": "126"
}
}
}],
"outputData": []
}, {
"identifier": "GetKeyList",
"name": "获取钥匙列表",
"required": true,
"callType": "async",
"method": "thing.service.GetKeyList",
"inputData": [{
"identifier": "KeyType",
"name": "开锁方式",
"dataType": {
"type": "enum",
"specs": {
"0": "全部",
"1": "指纹",
"2": "密码",
"3": "卡",
"4": "机械钥匙"
}
}
}],
"outputData": []
}, {
"identifier": "AddKey",
"name": "添加钥匙",
"required": true,
"callType": "async",
"method": "thing.service.AddKey",
"inputData": [{
"identifier": "KeyType",
"name": "开锁方式",
"dataType": {
"type": "enum",
"specs": {
"1": "指纹",
"2": "密码",
"3": "卡",
"4": "机械钥匙"
}
}
}, {
"identifier": "KeyRole",
"name": "用户权限",
"dataType": {
"type": "enum",
"specs": {
"1": "普通用户",
"2": "管理员",
"3": "劫持用户"
}
}
}, {
"identifier": "IsValid",
"name": "是否有效",
"dataType": {
"type": "bool",
"specs": {
"0": "无效",
"1": "有效"
}
}
}, {
"identifier": "KeyName",
"name": "钥匙昵称",
"dataType": {
"type": "text",
"specs": {
"length": "255"
}
}
}, {
"identifier": "KeyEffectiveTime",
"name": "生效时间",
"dataType": {
"type": "int",
"specs": {
"min": "1577808001",
"max": "32472115201"
}
}
}, {
"identifier": "KeyExpiryTime",
"name": "失效时间",
"dataType": {
"type": "int",
"specs": {
"min": "1577808001",
"max": "32472115201"
}
}
}],
"outputData": []
}, {
"identifier": "ModifyKey",
"name": "配置钥匙权限",
"required": false,
"callType": "async",
"method": "thing.service.ModifyKey",
"inputData": [{
"identifier": "KeyID",
"name": "钥匙ID",
"dataType": {
"type": "text",
"specs": {
"length": "10"
}
}
}, {
"identifier": "KeyType",
"name": "开锁方式",
"dataType": {
"type": "enum",
"specs": {
"1": "指纹",
"2": "密码",
"3": "卡",
"4": "机械钥匙"
}
}
}, {
"identifier": "KeyRole",
"name": "用户权限",
"dataType": {
"type": "enum",
"specs": {
"1": "普通用户",
"2": "管理员",
"3": "劫持用户"
}
}
}, {
"identifier": "IsValid",
"name": "是否有效",
"dataType": {
"type": "bool",
"specs": {
"0": "无效",
"1": "有效"
}
}
}, {
"identifier": "KeyName",
"name": "钥匙昵称",
"dataType": {
"type": "text",
"specs": {
"length": "255"
}
}
}, {
"identifier": "KeyEffectiveTime",
"name": "生效时间",
"dataType": {
"type": "int",
"specs": {
"min": "1577808001",
"max": "32472115201"
}
}
}, {
"identifier": "KeyExpiryTime",
"name": "失效时间",
"dataType": {
"type": "int",
"specs": {
"min": "1577808001",
"max": "32472115201"
}
}
}],
"outputData": []
}, {
"identifier": "DeleteKey",
"name": "删除钥匙",
"required": true,
"callType": "async",
"method": "thing.service.DeleteKey",
"inputData": [{
"identifier": "KeyID",
"name": "钥匙ID",
"dataType": {
"type": "text",
"specs": {
"length": "10"
}
}
}, {
"identifier": "KeyType",
"name": "开锁方式",
"dataType": {
"type": "enum",
"specs": {
"1": "指纹",
"2": "密码",
"3": "卡",
"4": "机械钥匙"
}
}
}, {
"identifier": "KeyRole",
"name": "用户权限",
"dataType": {
"type": "enum",
"specs": {
"1": "普通用户",
"2": "管理员",
"3": "劫持用户"
}
}
}],
"inputData": [],
"outputData": []
}],
"properties": [{
......
......@@ -45,289 +45,7 @@
"callType": "async",
"desc": "属性获取",
"method": "thing.service.property.get",
"inputData": ["LockState", "BackLockState", "Battery", "Volume", "Language"],
"outputData": [{
"identifier": "LockState",
"name": "门锁状态",
"dataType": {
"type": "enum",
"specs": {
"0": "关闭",
"1": "打开"
}
}
}, {
"identifier": "BackLockState",
"name": "门锁状态",
"dataType": {
"type": "enum",
"specs": {
"0": "关闭",
"1": "打开"
}
}
}, {
"identifier": "Battery",
"name": "电池电量",
"dataType": {
"type": "int",
"specs": {
"min": "0",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
}
}, {
"identifier": "Volume",
"name": "门锁音量",
"dataType": {
"type": "enum",
"specs": {
"0": "静音",
"1": "低音",
"2": "中音",
"3": "高音"
}
}
}, {
"identifier": "Language",
"name": "门锁语言",
"dataType": {
"type": "enum",
"specs": {
"0": "中文",
"1": "英文"
}
}
}]
}, {
"identifier": "OpenLock",
"name": "远程开锁",
"required": false,
"callType": "async",
"method": "thing.service.OpenLock",
"inputData": [{
"identifier": "Password",
"name": "密码",
"dataType": {
"type": "text",
"specs": {
"length": "126"
}
}
}],
"outputData": []
}, {
"identifier": "GetKeyList",
"name": "获取钥匙列表",
"required": true,
"callType": "async",
"method": "thing.service.GetKeyList",
"inputData": [{
"identifier": "KeyType",
"name": "开锁方式",
"dataType": {
"type": "enum",
"specs": {
"0": "全部",
"1": "指纹",
"2": "密码",
"3": "卡",
"4": "机械钥匙"
}
}
}],
"outputData": []
}, {
"identifier": "AddKey",
"name": "添加钥匙",
"required": true,
"callType": "async",
"method": "thing.service.AddKey",
"inputData": [{
"identifier": "KeyType",
"name": "开锁方式",
"dataType": {
"type": "enum",
"specs": {
"1": "指纹",
"2": "密码",
"3": "卡",
"4": "机械钥匙"
}
}
}, {
"identifier": "KeyRole",
"name": "用户权限",
"dataType": {
"type": "enum",
"specs": {
"1": "普通用户",
"2": "管理员",
"3": "劫持用户"
}
}
}, {
"identifier": "IsValid",
"name": "是否有效",
"dataType": {
"type": "bool",
"specs": {
"0": "无效",
"1": "有效"
}
}
}, {
"identifier": "KeyName",
"name": "钥匙昵称",
"dataType": {
"type": "text",
"specs": {
"length": "255"
}
}
}, {
"identifier": "KeyEffectiveTime",
"name": "生效时间",
"dataType": {
"type": "int",
"specs": {
"min": "1577808001",
"max": "32472115201"
}
}
}, {
"identifier": "KeyExpiryTime",
"name": "失效时间",
"dataType": {
"type": "int",
"specs": {
"min": "1577808001",
"max": "32472115201"
}
}
}],
"outputData": []
}, {
"identifier": "ModifyKey",
"name": "配置钥匙权限",
"required": false,
"callType": "async",
"method": "thing.service.ModifyKey",
"inputData": [{
"identifier": "KeyID",
"name": "钥匙ID",
"dataType": {
"type": "text",
"specs": {
"length": "10"
}
}
}, {
"identifier": "KeyType",
"name": "开锁方式",
"dataType": {
"type": "enum",
"specs": {
"1": "指纹",
"2": "密码",
"3": "卡",
"4": "机械钥匙"
}
}
}, {
"identifier": "KeyRole",
"name": "用户权限",
"dataType": {
"type": "enum",
"specs": {
"1": "普通用户",
"2": "管理员",
"3": "劫持用户"
}
}
}, {
"identifier": "IsValid",
"name": "是否有效",
"dataType": {
"type": "bool",
"specs": {
"0": "无效",
"1": "有效"
}
}
}, {
"identifier": "KeyName",
"name": "钥匙昵称",
"dataType": {
"type": "text",
"specs": {
"length": "255"
}
}
}, {
"identifier": "KeyEffectiveTime",
"name": "生效时间",
"dataType": {
"type": "int",
"specs": {
"min": "1577808001",
"max": "32472115201"
}
}
}, {
"identifier": "KeyExpiryTime",
"name": "失效时间",
"dataType": {
"type": "int",
"specs": {
"min": "1577808001",
"max": "32472115201"
}
}
}],
"outputData": []
}, {
"identifier": "DeleteKey",
"name": "删除钥匙",
"required": true,
"callType": "async",
"method": "thing.service.DeleteKey",
"inputData": [{
"identifier": "KeyID",
"name": "钥匙ID",
"dataType": {
"type": "text",
"specs": {
"length": "10"
}
}
}, {
"identifier": "KeyType",
"name": "开锁方式",
"dataType": {
"type": "enum",
"specs": {
"1": "指纹",
"2": "密码",
"3": "卡",
"4": "机械钥匙"
}
}
}, {
"identifier": "KeyRole",
"name": "用户权限",
"dataType": {
"type": "enum",
"specs": {
"1": "普通用户",
"2": "管理员",
"3": "劫持用户"
}
}
}],
"inputData": [],
"outputData": []
}],
"properties": [{
......
......@@ -143,7 +143,7 @@
}
}],
"identifier": "gasAlarm",
"method": "thing.event.alarm.post",
"method": "thing.event.gasAlarm.post",
"name": "gasAlarm",
"type": "alarm",
"required": true,
......@@ -164,8 +164,8 @@
}
}],
"identifier": "BatteryAlarm",
"method": "thing.event.alarm.post",
"name": "batteryAlarm",
"method": "thing.event.BatteryAlarm.post",
"name": "BatteryAlarm",
"type": "alarm",
"required": true,
"desc": "低电量告警"
......
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