Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
k-sdk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈伟灿
k-sdk
Commits
b46e8c98
Commit
b46e8c98
authored
Feb 11, 2022
by
陈伟灿
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'cwc' into 'master'
【修改内容】3028tsl文件修改;窗帘绑定修改 See merge request chenweican/k-sdk!184
parents
b1be5f3f
29dc40f7
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
449 additions
and
197 deletions
+449
-197
application/klansdk/kk_ccu_msg.c
application/klansdk/kk_ccu_msg.c
+18
-4
application/klansdk/kk_lan_ctrl.c
application/klansdk/kk_lan_ctrl.c
+5
-1
application/klansdk/kk_oldccu_msg.c
application/klansdk/kk_oldccu_msg.c
+25
-8
midware/midware/dm/kk_motor_bind_db.c
midware/midware/dm/kk_motor_bind_db.c
+74
-6
midware/midware/dm/kk_property_get_handle.c
midware/midware/dm/kk_property_get_handle.c
+1
-1
midware/midware/midware.c
midware/midware/midware.c
+174
-147
opcodeMapCfg/device_3005.json
opcodeMapCfg/device_3005.json
+1
-1
opcodeMapCfg/device_3006.json
opcodeMapCfg/device_3006.json
+1
-1
opcodeMapCfg/device_3012.json
opcodeMapCfg/device_3012.json
+1
-1
opcodeMapCfg/device_3026.json
opcodeMapCfg/device_3026.json
+1
-1
opcodeMapCfg/device_3027.json
opcodeMapCfg/device_3027.json
+1
-1
opcodeMapCfg/device_3067.json
opcodeMapCfg/device_3067.json
+18
-18
opcodeMapCfg/device_3068.json
opcodeMapCfg/device_3068.json
+80
-1
opcodeMapCfg/device_3088.json
opcodeMapCfg/device_3088.json
+1
-1
opcodeMapCfg/device_3089.json
opcodeMapCfg/device_3089.json
+1
-1
opcodeMapCfg/device_3147.json
opcodeMapCfg/device_3147.json
+1
-1
opcodeMapCfg/device_3148.json
opcodeMapCfg/device_3148.json
+1
-1
opcodeMapCfg/device_3154.json
opcodeMapCfg/device_3154.json
+1
-1
opcodeMapCfg/device_3155.json
opcodeMapCfg/device_3155.json
+1
-1
tsl/product_3028.json
tsl/product_3028.json
+43
-0
No files found.
application/klansdk/kk_ccu_msg.c
View file @
b46e8c98
...
...
@@ -16,7 +16,7 @@ static cJSON *string_int_type_convert(cJSON *n_id,cJSON *n_dataType);
static
cJSON
*
string_double_type_convert
(
cJSON
*
n_id
,
cJSON
*
n_dataType
);
static
cJSON
*
string_time_type_convert
(
cJSON
*
n_id
,
cJSON
*
n_dataType
);
static
cJSON
*
fit_type_convert
(
cJSON
*
n_id
,
cJSON
*
n_dataType
);
static
cJSON
*
string_type_convert
(
cJSON
*
n_id
,
cJSON
*
n_dataType
);
static
CONVERT_ITEM_S
convert_table
[]
=
{
{
"bool"
,
bool_type_convert
},
...
...
@@ -26,9 +26,22 @@ static CONVERT_ITEM_S convert_table[] = {
{
"string_int"
,
string_int_type_convert
},
{
"string_double"
,
string_double_type_convert
},
{
"string_time"
,
string_time_type_convert
},
{
"fit"
,
fit_type_convert
}
{
"fit"
,
fit_type_convert
},
{
"string"
,
string_type_convert
},
};
static
cJSON
*
string_type_convert
(
cJSON
*
n_id
,
cJSON
*
n_dataType
)
{
cJSON
*
args
=
NULL
;
char
buf
[
16
]
=
{
0
};
if
(
n_id
==
NULL
){
return
NULL
;
}
if
(
n_id
->
type
==
cJSON_Number
){
sprintf
(
buf
,
"%d"
,
n_id
->
valueint
);
args
=
cJSON_CreateString
(
buf
);
}
return
args
;
}
static
cJSON
*
bool_type_convert
(
cJSON
*
n_id
,
cJSON
*
n_dataType
)
{
cJSON
*
args
=
NULL
;
...
...
@@ -206,7 +219,8 @@ static cJSON *string_val_type_convert(int type,cJSON *n_id,cJSON *n_dataType)
if
(
type
==
1
){
val
.
dVal
=
(
n_id
->
valueint
>
0
)
?
1
:
0
;
}
else
{
val
.
iVal
=
(
n_id
->
valueint
>
0
)
?
1
:
0
;
//printf("n_id->valueint----------------->:%d\n",n_id->valueint);
val
.
iVal
=
(
n_id
->
valueint
>
0
)
?
n_id
->
valueint
:
0
;
}
}
else
if
(
strcmp
(
n_dataType
->
valuestring
,
"double"
)
==
0
)
{
if
(
type
==
1
){
...
...
application/klansdk/kk_lan_ctrl.c
View file @
b46e8c98
...
...
@@ -109,7 +109,11 @@ cJSON * kk_control_protocol_convert(kk_map_dev_node_t *devNode,int nodeId,cJSON
char
ch
[
33
];
if
(
strcmp
(
opcode
->
valuestring
,
"MOVE_TO_POS"
)
==
0
&&
strcmp
(
devNode
->
syn_opcode
,
"DOOYA_STATUS"
)
==
0
){
if
(
arg
->
type
==
cJSON_String
){
kk_record_motorPosition
(
atoi
(
arg
->
valuestring
));
}
}
kk_lan_db_channel_get
(
nodeId
,
&
channel
);
snprintf
(
ch
,
33
,
"%d"
,
channel
);
...
...
application/klansdk/kk_oldccu_msg.c
View file @
b46e8c98
...
...
@@ -97,7 +97,11 @@ cJSON * val_conver_new2old(cJSON *newccuItem,cJSON *oldccuItem,int syn_type)
return
ccu_value_convert
(
n_dataType
,
n_valueRange
,
o_dataType
,
o_valueRange
,
n_value
);
}
static
int
s_motorPostion
=
-
1
;
void
kk_record_motorPosition
(
int
value
){
s_motorPostion
=
value
;
debug_log
(
LOG_DEBUG_LEVEL
,
"s_motorPostion:%d
\n
"
,
s_motorPostion
);
}
//更新设备状态
static
int
_kk_lan_update_device_status
(
int
nodeId
,
cJSON
*
opcode
,
cJSON
*
arg
,
const
char
*
syn_opcode
)
{
...
...
@@ -116,6 +120,7 @@ static int _kk_lan_update_device_status(int nodeId,cJSON *opcode,cJSON *arg,cons
memset
(
valBuff
,
0
,
sizeof
(
valBuff
));
if
(
arg
->
type
==
cJSON_String
){
debug_log
(
LOG_CRIT_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
){
...
...
@@ -195,7 +200,7 @@ static int _kk_lan_sync_device_status(const char *deviceCode,kk_map_dev_node_t *
{
cJSON
*
msg
=
NULL
;
cJSON
*
arg
=
NULL
;
int
ignore
=
0
;
int
nodeId
=
-
1
;
char
nodeBuff
[
33
]
=
{
0
};
...
...
@@ -227,11 +232,23 @@ static int _kk_lan_sync_device_status(const char *deviceCode,kk_map_dev_node_t *
memset
(
nodeBuff
,
0
,
sizeof
(
nodeBuff
));
snprintf
(
nodeBuff
,
sizeof
(
nodeBuff
),
"%d"
,
nodeId
);
//printf("----------------------[%s][%d]\n",__FUNCTION__,__LINE__);
cJSON
*
motorPosCJSON
=
cJSON_GetObjectItem
(
arg
,
"motorPos"
);
//printf("----------------------[%s][%d]\n",__FUNCTION__,__LINE__);
if
(
motorPosCJSON
!=
NULL
&&
motorPosCJSON
->
type
==
cJSON_String
){
//窗帘电机上报的position与设置的不一致,忽略上报
//printf("----------------------[%s][%d]s_motorPostion:%d\n",__FUNCTION__,__LINE__,s_motorPostion);
//printf("----------------------[%s][%d]atoi(motorPosCJSON->valuestring):%d\n",__FUNCTION__,__LINE__,atoi(motorPosCJSON->valuestring));
if
(
s_motorPostion
!=
atoi
(
motorPosCJSON
->
valuestring
)
&&
s_motorPostion
!=
-
1
){
ignore
=
1
;
}
}
//printf("----------------------[%s][%d]\n",__FUNCTION__,__LINE__);
msg
=
old_ccu_msg_build_json
(
nodeBuff
,
devNode
->
syn_opcode
,
NULL
,
arg
);
send_msg_to_module
(
msg
);
if
(
!
ignore
){
send_msg_to_module
(
msg
);
s_motorPostion
=
-
1
;
}
cJSON_Delete
(
msg
);
return
0
;
}
...
...
@@ -289,7 +306,6 @@ static int kk_lan_property_convert(const char *deviceCode,kk_map_dev_node_t *dev
debug_log
(
LOG_DEBUG_LEVEL
,
"[err] cfg file.
\n
"
);
continue
;
}
n_dataType
=
cJSON_GetObjectItem
(
n_item
,
"dataType"
);
n_valueRange
=
cJSON_GetObjectItem
(
n_item
,
"valueRange"
);
...
...
@@ -356,8 +372,9 @@ static int kk_lan_property_convert(const char *deviceCode,kk_map_dev_node_t *dev
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
){
//printf("[%s][%d]\n",__FUNCTION__,__LINE__);
_kk_lan_update_device_status
(
nodeId
,
opcode
,
args
,
devNode
->
syn_opcode
);
//printf("[%s][%d]\n",__FUNCTION__,__LINE__);
}
...
...
midware/midware/dm/kk_motor_bind_db.c
View file @
b46e8c98
...
...
@@ -216,8 +216,76 @@ int kk_motor_bind_db_delete_ex(const char* panelDCode)
return
SUCCESS_RETURN
;
}
int
kk_motor_bind_db_find_byDeviceCode
(
const
char
*
panelDCode
,
struct
kk_motor_bind_info
*
info
,
int
max
)
{
int
listSize
=
0
;
sqlite3_stmt
*
stmt
;
char
*
sqlCmd
=
NULL
;
const
unsigned
char
*
motorDeviceCode
=
NULL
;
int
motor_ep
=
0
;
int
dummyId
=
-
1
;
struct
kk_motor_bind_info
*
pInfo
=
info
;
kk_motor_bind_ctx_t
*
ctx
=
_kk_motor_bind_get_ctx
();
const
char
*
searchCmd
=
"select * from PanelBindMotor where panelDCode = '%s';"
;
_kk_motor_bind_lock
();
sqlCmd
=
sqlite3_mprintf
(
searchCmd
,
panelDCode
);
INFO_PRINT
(
"Table searchCmd:%s
\n
"
,
sqlCmd
);
sqlite3_prepare_v2
(
ctx
->
pDb
,
sqlCmd
,
strlen
(
sqlCmd
),
&
stmt
,
NULL
);
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
motorDeviceCode
=
sqlite3_column_text
(
stmt
,
MOTOR_BIND_DB_MOTOR_DEVICECODE
);
motor_ep
=
sqlite3_column_int
(
stmt
,
MOTOR_BIND_DB_MOTOR_EP
);
dummyId
=
sqlite3_column_int
(
stmt
,
MOTOR_BIND_DB_DUMMYID
);
memcpy
(
pInfo
->
deviceCode
,
motorDeviceCode
,
strlen
(
motorDeviceCode
));
pInfo
->
epNum
=
motor_ep
;
pInfo
->
dummyId
=
dummyId
;
INFO_PRINT
(
"listSize=%d,motorDeviceCode=%s,motor_ep=%d,dummyId=%d
\n
"
,
listSize
,
motorDeviceCode
,
motor_ep
,
dummyId
);
if
(
++
listSize
>=
max
){
break
;
}
pInfo
++
;
}
sqlite3_finalize
(
stmt
);
_kk_motor_bind_unlock
();
return
listSize
;
}
int
kk_motor_bind_db_find_byMotorDeviceCode
(
const
char
*
motorCode
,
struct
kk_motor_bind_info
*
info
,
int
max
)
{
int
listSize
=
0
;
sqlite3_stmt
*
stmt
;
char
*
sqlCmd
=
NULL
;
const
unsigned
char
*
panelDeviceCode
=
NULL
;
int
motor_ep
=
0
;
int
dummyId
=
-
1
;
struct
kk_motor_bind_info
*
pInfo
=
info
;
kk_motor_bind_ctx_t
*
ctx
=
_kk_motor_bind_get_ctx
();
const
char
*
searchCmd
=
"select * from PanelBindMotor where motorDCode = '%s';"
;
_kk_motor_bind_lock
();
sqlCmd
=
sqlite3_mprintf
(
searchCmd
,
motorCode
);
INFO_PRINT
(
"Table searchCmd:%s
\n
"
,
sqlCmd
);
sqlite3_prepare_v2
(
ctx
->
pDb
,
sqlCmd
,
strlen
(
sqlCmd
),
&
stmt
,
NULL
);
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
panelDeviceCode
=
sqlite3_column_text
(
stmt
,
MOTOR_BIND_DB_PANEL_DEVICECODE
);
motor_ep
=
sqlite3_column_int
(
stmt
,
MOTOR_BIND_DB_MOTOR_EP
);
dummyId
=
sqlite3_column_int
(
stmt
,
MOTOR_BIND_DB_DUMMYID
);
memcpy
(
pInfo
->
deviceCode
,
panelDeviceCode
,
strlen
(
panelDeviceCode
));
pInfo
->
epNum
=
motor_ep
;
pInfo
->
dummyId
=
dummyId
;
INFO_PRINT
(
"listSize=%d,panelDeviceCode=%s,motor_ep=%d,dummyId=%d
\n
"
,
listSize
,
panelDeviceCode
,
motor_ep
,
dummyId
);
if
(
++
listSize
>=
max
){
break
;
}
pInfo
++
;
}
sqlite3_finalize
(
stmt
);
_kk_motor_bind_unlock
();
return
listSize
;
}
int
kk_motor_bind_db_find
(
const
char
*
panelDCode
,
int
panelEpNum
,
struct
kk_motor_bind_info
*
info
,
int
max
)
{
int
listSize
=
0
;
...
...
@@ -241,8 +309,7 @@ int kk_motor_bind_db_find(const char* panelDCode,int panelEpNum,struct kk_motor_
motorDeviceCode
=
sqlite3_column_text
(
stmt
,
MOTOR_BIND_DB_MOTOR_DEVICECODE
);
motor_ep
=
sqlite3_column_int
(
stmt
,
MOTOR_BIND_DB_MOTOR_EP
);
dummyId
=
sqlite3_column_int
(
stmt
,
MOTOR_BIND_DB_DUMMYID
);
memset
((
char
*
)
pInfo
,
0
,
sizeof
(
*
pInfo
));
snprintf
(
pInfo
->
deviceCode
,
sizeof
(
*
pInfo
),
"%s"
,
motorDeviceCode
);
memcpy
(
pInfo
->
deviceCode
,
motorDeviceCode
,
strlen
(
motorDeviceCode
));
pInfo
->
epNum
=
motor_ep
;
pInfo
->
dummyId
=
dummyId
;
INFO_PRINT
(
"listSize=%d,motorDeviceCode=%s,motor_ep=%d,dummyId=%d
\n
"
,
listSize
,
motorDeviceCode
,
motor_ep
,
dummyId
);
...
...
@@ -280,8 +347,7 @@ int kk_motor_bind_db_find_ex(int dummyId,struct kk_motor_bind_info* info,int max
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
motorDeviceCode
=
sqlite3_column_text
(
stmt
,
MOTOR_BIND_DB_MOTOR_DEVICECODE
);
motor_ep
=
sqlite3_column_int
(
stmt
,
MOTOR_BIND_DB_MOTOR_EP
);
memset
((
char
*
)
pInfo
,
0
,
sizeof
(
*
pInfo
));
snprintf
(
pInfo
->
deviceCode
,
sizeof
(
*
pInfo
),
"%s"
,
motorDeviceCode
);
memcpy
(
pInfo
->
deviceCode
,
motorDeviceCode
,
strlen
(
motorDeviceCode
));
pInfo
->
epNum
=
motor_ep
;
INFO_PRINT
(
"listSize=%d,motorDeviceCode=%s,motor_ep=%d
\n
"
,
listSize
,
motorDeviceCode
,
motor_ep
);
...
...
@@ -332,7 +398,8 @@ int kk_motor_bind_db_delete_by_deviceCode(const char* deviceCode)
int
rc
=
0
;
char
*
zErrMsg
=
0
;
kk_motor_bind_ctx_t
*
ctx
=
_kk_motor_bind_get_ctx
();
//printf("---------------------------->[%s][%d]\n",__FUNCTION__,__LINE__);
kk_service_delete_bind_2gw
(
deviceCode
,
1
);
_kk_motor_bind_lock
();
sqlCmd
=
sqlite3_mprintf
(
deleteCmd
,
deviceCode
);
...
...
@@ -346,7 +413,8 @@ int kk_motor_bind_db_delete_by_deviceCode(const char* deviceCode)
}
sqlite3_free
(
sqlCmd
);
_kk_motor_bind_unlock
();
//printf("---------------------------->[%s][%d]\n",__FUNCTION__,__LINE__);
kk_service_delete_bind_2gw
(
deviceCode
,
0
);
kk_motor_bind_db_delete_ex
(
deviceCode
);
return
SUCCESS_RETURN
;
...
...
midware/midware/dm/kk_property_get_handle.c
View file @
b46e8c98
...
...
@@ -51,7 +51,7 @@ static int kk_service_get_reply(char *deviceCode,char *productCode,char *msgId,d
cJSON_AddNumberToObject
(
paramInfo
,
"data"
,
(
double
)
param1
);
}
else
if
(
strcmp
(
type
,
"ChildLockState"
)
==
0
){
cJSON_AddNumberToObject
(
paramInfo
,
"ChildLockState"
,
(
int
)
param1
);
}
else
if
(
strcmp
(
type
,
"Power
Memory
"
)
==
0
){
}
else
if
(
strcmp
(
type
,
"Power
DownSave
"
)
==
0
){
cJSON_AddNumberToObject
(
paramInfo
,
"PowerMemory"
,
(
int
)
param1
);
cJSON_AddNumberToObject
(
paramInfo
,
"Mode"
,
(
int
)
1
);
}
else
if
(
strcmp
(
type
,
"Screensaver"
)
==
0
){
...
...
midware/midware/midware.c
View file @
b46e8c98
...
...
@@ -4,8 +4,8 @@
*
*文件名称: midware.c
*内容摘要: 数据中转中心,上对云端,下对网关,承上启下
*其他说明:
*当前版本:
*其他说明:
*当前版本:
*************************************************************/
...
...
@@ -44,24 +44,24 @@
#include "kk_motor_bind_db.h"
int
g_timezone
=
8
;
char
*
g_filerToPlatTable
[]
=
char
*
g_filerToPlatTable
[]
=
{
(
char
*
){
KK_REGISTER_TOPIC_REPLY
},
(
char
*
){
KK_ADD_TOPIC_REPLY
},
(
char
*
){
KK_LOGIN_TOPIC_REPLY
},
(
char
*
){
KK_THING_SERVICE_PROPERTY_GET
},
(
char
*
){
KK_THING_CLOUDSTATE_MSG
},
(
char
*
){
KK_THING_CLOUDHB_MSG
},
(
char
*
){
KK_LOGIN_TOPIC_REPLY
},
(
char
*
){
KK_THING_SERVICE_PROPERTY_GET
},
(
char
*
){
KK_THING_CLOUDSTATE_MSG
},
(
char
*
){
KK_THING_CLOUDHB_MSG
},
(
char
*
){
KK_THING_SERVICE_ADDSCENC
},
(
char
*
){
KK_THING_SERVICE_UPDATESCENC
},
(
char
*
){
KK_THING_SERVICE_DELETESCENC
},
(
char
*
){
KK_THING_SERVICE_UPDATESCENC
},
(
char
*
){
KK_THING_SERVICE_DELETESCENC
},
(
char
*
){
KK_THING_SERVICE_NEGATIVE
},
(
char
*
){
KK_THING_SERVICE_SYNCINFO
},
(
char
*
){
KK_THING_SERVICE_BINDSCENE
},
(
char
*
){
KK_THING_SERVICE_BINDSCENE
},
(
char
*
){
KK_THING_SERVICE_UNBINDSBUTTTON
},
(
char
*
){
KK_THING_SERVICE_ACTIVEBUTTON
},
(
char
*
){
KK_THING_SERVICE_HISTORYALARM
},
(
char
*
){
KK_THING_SERVICE_DEL_HISTORYALARM
},
(
char
*
){
KK_THING_SERVICE_DEL_HISTORYALARM
},
};
static
char
s_ccuid
[
DEVICE_CODE_LEN
]
=
{
0
};
static
char
s_Version
[
VERSION_MAXLEN
]
=
{
0
};
...
...
@@ -111,7 +111,7 @@ int HAL_GetVersion(_OU_ char *version)
}
int
HAL_Get_ccuid
(
_OU_
char
*
device_code
)
{
{
strncpy
(
device_code
,
s_ccuid
,
strlen
(
s_ccuid
));
printf
(
"HAL_Get_ccuid:%s
\n
"
,
s_ccuid
);
return
strlen
(
s_ccuid
);
...
...
@@ -208,7 +208,7 @@ void kk_print_long_data(char *data,int len)
pTmp
=
malloc
(
KK_PRINTF_PER_LEN
+
1
);
if
(
pTmp
==
NULL
){
return
;
}
}
while
(
1
)
{
memset
(
pTmp
,
0x0
,
KK_PRINTF_PER_LEN
+
1
);
...
...
@@ -261,15 +261,15 @@ void split(char *src,const char *separator,char **dest,int *num) {
if
(
src
==
NULL
||
strlen
(
src
)
==
0
)
return
;
if
(
separator
==
NULL
||
strlen
(
separator
)
==
0
)
return
;
return
;
pNext
=
strtok
(
src
,
separator
);
while
(
pNext
!=
NULL
)
{
*
dest
++
=
pNext
;
++
count
;
pNext
=
strtok
(
NULL
,
separator
);
}
pNext
=
strtok
(
NULL
,
separator
);
}
*
num
=
count
;
}
}
/************************************************************
*功能描述:属性参数校验
*输入参数:payload:消息内容
...
...
@@ -280,9 +280,9 @@ void split(char *src,const char *separator,char **dest,int *num) {
*************************************************************/
static
int
kk_property_set_data_check
(
cJSON
*
payload
,
const
char
*
deviceCode
){
cJSON
*
params
=
NULL
;
dm_mgr_dev_node_t
*
node
=
NULL
;
kk_tsl_data_t
*
property
=
NULL
;
cJSON
*
propertyItem
=
NULL
;
dm_mgr_dev_node_t
*
node
=
NULL
;
kk_tsl_data_t
*
property
=
NULL
;
cJSON
*
propertyItem
=
NULL
;
cJSON
*
epNum
=
NULL
;
int
epNumInt
=
1
;
int
num
=
0
;
...
...
@@ -308,7 +308,7 @@ static int kk_property_set_data_check(cJSON * payload,const char *deviceCode){
if
(
res
!=
SUCCESS_RETURN
)
{
ERROR_PRINT
(
" error res:%d
\n
"
,
res
);
}
}
char
tmpValue
[
16
]
=
{
0
};
sprintf
(
tmpValue
,
"%d"
,
level
);
kk_property_db_update_value
(
deviceCode
,
"SensorType"
,
tmpValue
);
...
...
@@ -346,12 +346,12 @@ static int kk_property_set_data_check(cJSON * payload,const char *deviceCode){
complex_struct
=
property
->
data_value
.
value
;
for
(
index
=
0
;
index
<
complex_struct
->
size
;
index
++
)
{
current_data
=
(
kk_tsl_data_t
*
)
complex_struct
->
value
+
index
;
cJSON
*
propertyItem_1
=
NULL
;
cJSON
*
propertyItem_1
=
NULL
;
propertyItem_1
=
cJSON_GetObjectItem
(
propertyItem
,
current_data
->
identifier
);
if
(
propertyItem_1
==
NULL
){
continue
;
}
if
(
current_data
->
data_value
.
type
!=
KK_TSL_DATA_TYPE_STRUCT
){
if
(
current_data
->
data_value
.
type
==
KK_TSL_DATA_TYPE_INT
){
value
=
propertyItem_1
->
valueint
;
...
...
@@ -362,7 +362,7 @@ static int kk_property_set_data_check(cJSON * payload,const char *deviceCode){
}
else
if
(
current_data
->
data_value
.
type
==
KK_TSL_DATA_TYPE_TEXT
){
if
(
strlen
(
propertyItem_1
->
valuestring
)
>
current_data
->
data_value
.
length
){
ERROR_PRINT
(
"ERROR !!!strlen(propertyItem_1->valuestring):%d,current_data->data_value.length:%d
\n
"
,
strlen
(
propertyItem_1
->
valuestring
),
current_data
->
data_value
.
length
);
return
INVALID_PARAMETER
;
}
...
...
@@ -375,7 +375,7 @@ static int kk_property_set_data_check(cJSON * payload,const char *deviceCode){
complex_struct_1
=
current_data
->
data_value
.
value
;
for
(
index_1
=
0
;
index_1
<
complex_struct_1
->
size
;
index_1
++
){
current_data_1
=
(
kk_tsl_data_t
*
)
complex_struct_1
->
value
+
index_1
;
cJSON
*
propertyItem_2
=
NULL
;
cJSON
*
propertyItem_2
=
NULL
;
propertyItem_2
=
cJSON_GetObjectItem
(
propertyItem_1
,
current_data_1
->
identifier
);
if
(
propertyItem_2
==
NULL
){
continue
;
...
...
@@ -389,7 +389,7 @@ static int kk_property_set_data_check(cJSON * payload,const char *deviceCode){
}
else
if
(
current_data_1
->
data_value
.
type
==
KK_TSL_DATA_TYPE_TEXT
){
if
(
strlen
(
propertyItem_2
->
valuestring
)
>
current_data_1
->
data_value
.
length
){
ERROR_PRINT
(
"ERROR !!!strlen(propertyItem_2->valuestring):%d,propertyItem_2->data_value.length:%d
\n
"
,
strlen
(
propertyItem_2
->
valuestring
),
current_data_1
->
data_value
.
length
);
return
INVALID_PARAMETER
;
}
...
...
@@ -429,12 +429,12 @@ static int kk_property_set_data_check(cJSON * payload,const char *deviceCode){
INFO_PRINT
(
"-----------------KK_TSL_DATA_TYPE_TEXT-------------------
\n
"
);
cJSON_AddStringToObject
(
params
,
property
->
identifier
,
propertyItem
->
valuestring
);
cJSON_DeleteItemFromObject
(
params
,
propertiesbuf
[
0
]);
}
}
else
if
(
property
->
data_value
.
type
==
KK_TSL_DATA_TYPE_ENUM
||
property
->
data_value
.
type
==
KK_TSL_DATA_TYPE_BOOL
){
INFO_PRINT
(
"-----------------KK_TSL_DATA_TYPE_ENUM-------------------
\n
"
);
cJSON_AddNumberToObject
(
params
,
property
->
identifier
,
propertyItem
->
valueint
);
cJSON_DeleteItemFromObject
(
params
,
propertiesbuf
[
0
]);
}
}
}
}
}
...
...
@@ -444,7 +444,7 @@ static int kk_property_set_data_check(cJSON * payload,const char *deviceCode){
//ERROR_PRINT("ERROR !!!property->accessMode:%s\n",property->accessMode);
//return INVALID_PARAMETER;
//}
//}
}
...
...
@@ -463,7 +463,7 @@ static int kk_property_set_data_check(cJSON * payload,const char *deviceCode){
static
int
kk_panel_bind_motor_delete
(
const
char
*
deviceCode
,
int
dummyId
)
{
int
res
=
0
;
dm_mgr_dev_node_t
*
node
=
NULL
;
dm_mgr_dev_node_t
*
node
=
NULL
;
dm_mgr_dev_node_t
*
gw_node
=
NULL
;
char
msgId
[
MSG_MAX_LEN
]
=
{
0
};
char
sceneId
[
33
]
=
{
0
};
...
...
@@ -503,7 +503,7 @@ static int kk_panel_bind_motor_delete(const char* deviceCode,int dummyId)
kk_sendData2gw
(
data
,
strlen
(
data
),
node
->
fatherDeviceCode
);
cJSON_Delete
(
root
);
free
(
data
);
//printf("---------------------------->[%s][%d]\n",__FUNCTION__,__LINE__);
return
0
;
}
...
...
@@ -512,7 +512,7 @@ static int kk_panel_bind_motor_delete(const char* deviceCode,int dummyId)
static
int
kk_panel_bind_motor_add_actions
(
const
char
*
deviceCode
,
cJSON
*
actions
,
int
dummyId
)
{
int
res
=
0
;
dm_mgr_dev_node_t
*
node
=
NULL
;
dm_mgr_dev_node_t
*
node
=
NULL
;
dm_mgr_dev_node_t
*
gw_node
=
NULL
;
char
msgId
[
MSG_MAX_LEN
]
=
{
0
};
char
sceneId
[
33
]
=
{
0
};
...
...
@@ -522,7 +522,7 @@ static int kk_panel_bind_motor_add_actions(const char* deviceCode,cJSON* actions
cJSON
*
info
=
cJSON_CreateObject
();
cJSON
*
payload
=
cJSON_CreateObject
();
cJSON
*
paras
=
cJSON_CreateObject
();
if
(
SUCCESS_RETURN
!=
dm_mgr_get_device_by_devicecode
((
char
*
)
deviceCode
,
&
node
)){
return
-
1
;
}
...
...
@@ -562,8 +562,9 @@ static int kk_panel_bind_motor_add(const char* deviceCode,int epNum,int dummyId)
cJSON
*
item
=
NULL
;
struct
kk_motor_bind_info
*
info
=
(
struct
kk_motor_bind_info
*
)
malloc
(
sizeof
(
struct
kk_motor_bind_info
)
*
KK_MOTOR_BIND_INFO_MAX
);
memset
(
info
,
0
,
sizeof
(
struct
kk_motor_bind_info
)
*
KK_MOTOR_BIND_INFO_MAX
);
int
info_size
=
kk_motor_bind_db_find_ex
(
dummyId
,
info
,
KK_MOTOR_BIND_INFO_MAX
);
cJSON
*
actionsAry
=
cJSON_CreateArray
();
item
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
item
,
"deviceCode"
,
deviceCode
);
...
...
@@ -579,8 +580,34 @@ static int kk_panel_bind_motor_add(const char* deviceCode,int epNum,int dummyId)
}
kk_panel_bind_motor_add_actions
(
deviceCode
,
actionsAry
,
dummyId
);
free
(
info
);
return
0
;
}
int
kk_service_delete_bind_2gw
(
char
*
deviceCode
,
int
type
)
//type 0:panel;1:motor
{
int
info_size
=
0
;
int
i
=
0
;
struct
kk_motor_bind_info
*
info
=
(
struct
kk_motor_bind_info
*
)
malloc
(
sizeof
(
struct
kk_motor_bind_info
)
*
KK_MOTOR_BIND_INFO_MAX
);
if
(
info
==
NULL
){
return
-
1
;
}
memset
(
info
,
0x0
,
sizeof
(
struct
kk_motor_bind_info
)
*
KK_MOTOR_BIND_INFO_MAX
);
if
(
type
==
0
){
//printf("---------------------------->[%s][%d]\n",__FUNCTION__,__LINE__);
info_size
=
kk_motor_bind_db_find_byDeviceCode
(
deviceCode
,
info
,
KK_MOTOR_BIND_INFO_MAX
);
}
else
{
//printf("---------------------------->[%s][%d]\n",__FUNCTION__,__LINE__);
info_size
=
kk_motor_bind_db_find_byMotorDeviceCode
(
deviceCode
,
info
,
KK_MOTOR_BIND_INFO_MAX
);
}
//printf("-------------------------info_size:%d--->[%s][%d]\n",info_size,__FUNCTION__,__LINE__);
for
(
i
=
0
;
i
<
info_size
;
i
++
){
kk_panel_bind_motor_delete
(
deviceCode
,
info
[
i
].
dummyId
);
}
free
(
info
);
info
=
NULL
;
return
0
;
}
int
kk_service_panel_bind_motor_handle
(
cJSON
*
deviceCode
,
cJSON
*
param
,
cJSON
*
msgId
,
int
act
)
{
int
i
;
...
...
@@ -612,7 +639,7 @@ int kk_service_panel_bind_motor_handle(cJSON *deviceCode,cJSON *param,cJSON * ms
}
if
((
actions
=
cJSON_GetObjectItem
(
param
,
"actions"
))
==
NULL
||
actions
->
type
!=
cJSON_Array
){
actions
->
type
!=
cJSON_Array
){
INFO_PRINT
(
"[ERR] actions
\n
"
);
return
-
1
;
}
...
...
@@ -621,16 +648,17 @@ int kk_service_panel_bind_motor_handle(cJSON *deviceCode,cJSON *param,cJSON * ms
if
(
act
==
KK_SERVICE_REBIND_MOTORS
){
struct
kk_motor_bind_info
*
info
=
(
struct
kk_motor_bind_info
*
)
malloc
(
sizeof
(
struct
kk_motor_bind_info
)
*
KK_MOTOR_BIND_INFO_MAX
);
memset
(
info
,
0x0
,
sizeof
(
struct
kk_motor_bind_info
)
*
KK_MOTOR_BIND_INFO_MAX
);
int
info_size
=
kk_motor_bind_db_find
(
panel_dCode
->
valuestring
,
panel_ep
,
info
,
KK_MOTOR_BIND_INFO_MAX
);
for
(
int
i
=
0
;
i
<
info_size
;
i
++
){
kk_panel_bind_motor_delete
(
panel_dCode
->
valuestring
,
info
[
i
].
dummyId
);
}
free
(
info
);
kk_motor_bind_db_delete_ex
(
panel_dCode
->
valuestring
);
}
actionCnt
=
cJSON_GetArraySize
(
actions
);
for
(
i
=
0
;
i
<
actionCnt
;
i
++
){
actionItem
=
cJSON_GetArrayItem
(
actions
,
i
);
...
...
@@ -638,7 +666,7 @@ int kk_service_panel_bind_motor_handle(cJSON *deviceCode,cJSON *param,cJSON * ms
INFO_PRINT
(
"[ERR] item
\n
"
);
continue
;
}
motor_dCode
=
cJSON_GetObjectItem
(
actionItem
,
"deviceCode"
);
if
(
motor_dCode
==
NULL
||
motor_dCode
->
type
!=
cJSON_String
){
INFO_PRINT
(
"[ERR] motor_dCode
\n
"
);
...
...
@@ -666,8 +694,9 @@ int kk_service_panel_bind_motor_handle(cJSON *deviceCode,cJSON *param,cJSON * ms
int
dummyId
=
kk_motor_bind_db_find_dummyId
(
panel_dCode
->
valuestring
,
panel_ep
,
motor_dCodeStr
,
motor_ep
);
if
(
dummyId
!=-
1
){
kk_panel_bind_motor_delete
(
panel_dCode
->
valuestring
,
dummyId
);
kk_motor_bind_db_delete
(
panel_dCode
->
valuestring
,
panel_ep
,
motor_dCodeStr
,
motor_ep
);
}
kk_motor_bind_db_delete
(
panel_dCode
->
valuestring
,
panel_ep
,
motor_dCodeStr
,
motor_ep
);
}
}
...
...
@@ -689,9 +718,9 @@ int kk_service_query_bind_motor(cJSON *deviceCode,cJSON *param,struct kk_motor_b
if
(
deviceCode
==
NULL
||
deviceCode
->
type
!=
cJSON_String
){
return
-
1
;
}
panel_dCode
=
deviceCode
;
if
(
param
!=
NULL
){
if
(
param
->
type
!=
cJSON_Object
){
return
-
1
;
...
...
@@ -707,7 +736,7 @@ int kk_service_query_bind_motor(cJSON *deviceCode,cJSON *param,struct kk_motor_b
}
info_size
=
kk_motor_bind_db_find
(
panel_dCode
->
valuestring
,
panel_ep
,
info
,
max
);
return
info_size
;
}
...
...
@@ -727,22 +756,22 @@ int kk_dm_device_subdev_filter(char *data)
WARNING_PRINT
(
"Error before: [%s]
\n
"
,
"cJSON_Parse"
);
return
-
1
;
}
if
((
info_root
=
cJSON_GetObjectItem
(
json
,
"info"
))
==
NULL
)
if
((
info_root
=
cJSON_GetObjectItem
(
json
,
"info"
))
==
NULL
)
return
-
1
;
if
((
typeJson
=
cJSON_GetObjectItem
(
info_root
,
"msgtype"
))
==
NULL
)
return
-
1
;
if
((
payload
=
cJSON_GetObjectItem
(
json
,
"payload"
))
==
NULL
)
if
((
payload
=
cJSON_GetObjectItem
(
json
,
"payload"
))
==
NULL
)
return
-
1
;
payload_Str
=
cJSON_Print
(
payload
);
if
((
deviceCode
=
cJSON_GetObjectItem
(
info_root
,
"deviceCode"
))
==
NULL
)
return
-
1
;
if
(
strcmp
(
typeJson
->
valuestring
,
KK_THING_SERVICE_REBIND_MOTORS
)
==
0
){
INFO_PRINT
(
"REBIND_MOTORS
\n
"
);
cJSON
*
msgId
=
cJSON_GetObjectItem
(
payload
,
"msgId"
);
cJSON
*
msgId
=
cJSON_GetObjectItem
(
payload
,
"msgId"
);
cJSON
*
paramStr
=
cJSON_GetObjectItem
(
payload
,
"params"
);
kk_service_panel_bind_motor_handle
(
deviceCode
,
paramStr
,
msgId
,
KK_SERVICE_REBIND_MOTORS
);
kk_service_common_reply
(
info_root
,
msgId
,
KK_THING_SERVICE_REBIND_MOTORS_REPLY
);
}
...
...
@@ -750,7 +779,7 @@ int kk_dm_device_subdev_filter(char *data)
INFO_PRINT
(
"ADDBIND_MOTOR
\n
"
);
deviceCode
=
cJSON_GetObjectItem
(
info_root
,
MSG_DEVICE_CODE_STR
);
cJSON
*
msgId
=
cJSON_GetObjectItem
(
payload
,
MSG_COMMON_MSGID
);
cJSON
*
msgId
=
cJSON_GetObjectItem
(
payload
,
MSG_COMMON_MSGID
);
cJSON
*
paramStr
=
cJSON_GetObjectItem
(
payload
,
MSG_PARAMS_STR
);
kk_service_panel_bind_motor_handle
(
deviceCode
,
paramStr
,
msgId
,
KK_SERVICE_ADDBIND_MOTORS
);
...
...
@@ -759,14 +788,14 @@ int kk_dm_device_subdev_filter(char *data)
INFO_PRINT
(
"UNBIND_MOTORS
\n
"
);
deviceCode
=
cJSON_GetObjectItem
(
info_root
,
MSG_DEVICE_CODE_STR
);
cJSON
*
msgId
=
cJSON_GetObjectItem
(
payload
,
MSG_COMMON_MSGID
);
cJSON
*
msgId
=
cJSON_GetObjectItem
(
payload
,
MSG_COMMON_MSGID
);
cJSON
*
paramStr
=
cJSON_GetObjectItem
(
payload
,
MSG_PARAMS_STR
);
kk_service_panel_bind_motor_handle
(
deviceCode
,
paramStr
,
msgId
,
KK_SERVICE_UNBIND_MOTORS
);
kk_service_common_reply
(
info_root
,
msgId
,
KK_THING_SERVICE_UNBIND_MOTORS_REPLY
);
}
else
if
(
strcmp
(
typeJson
->
valuestring
,
KK_THING_SERVICE_QUERY_BIND_MOTORS
)
==
0
){
INFO_PRINT
(
"QUERY_BIND_MOTORS
\n
"
);
cJSON
*
msgId
=
cJSON_GetObjectItem
(
payload
,
MSG_COMMON_MSGID
);
cJSON
*
msgId
=
cJSON_GetObjectItem
(
payload
,
MSG_COMMON_MSGID
);
cJSON
*
paramStr
=
cJSON_GetObjectItem
(
payload
,
MSG_PARAMS_STR
);
struct
kk_motor_bind_info
*
info
=
(
struct
kk_motor_bind_info
*
)
malloc
(
sizeof
(
struct
kk_motor_bind_info
)
*
KK_MOTOR_BIND_INFO_MAX
);
...
...
@@ -782,11 +811,11 @@ int kk_dm_device_subdev_filter(char *data)
kk_service_common_reply_ex
(
info_root
,
msgId
,
KK_THING_SERVICE_QUERY_BIND_MOTORS_REPLY
,
ary
);
free
(
info
);
}
else
{
return
-
1
;
}
return
0
;
}
...
...
@@ -800,7 +829,7 @@ static int kk_get_ccu_info_reply(cJSON *param,char *msgType)
if
(
param
==
NULL
){
return
INVALID_PARAMETER
;
}
cJSON
*
info
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
info
,
MSG_TYPE_STR
,
msgType
);
char
*
infff
=
cJSON_Print
(
info
);
...
...
@@ -848,7 +877,7 @@ void mid_cb(void* data, int len){
}
deviceCode
=
cJSON_GetObjectItem
(
info_root
,
MSG_DEVICE_CODE_STR
);
type
=
cJSON_GetObjectItem
(
info_root
,
MSG_TYPE_STR
);
if
(
deviceCode
==
NULL
||
type
==
NULL
){
ERROR_PRINT
(
" params [%s] or [%s] can't find
\n
"
,
MSG_DEVICE_CODE_STR
,
MSG_TYPE_STR
);
cJSON_Delete
(
json
);
...
...
@@ -860,7 +889,7 @@ void mid_cb(void* data, int len){
cJSON_Delete
(
json
);
return
;
}
if
(
strcmp
(
type
->
valuestring
,
KK_THING_SERVICE_GET_CCU_INFO
)
==
0
){
cJSON
*
param
=
dm_mgr_get_ccu_info
();
kk_get_ccu_info_reply
(
param
,
KK_THING_SERVICE_GET_CCU_INFO_REPLY
);
...
...
@@ -868,7 +897,7 @@ void mid_cb(void* data, int len){
return
;
}
/*****属性设置需要先检测设置参数是否超出物模型给定范围*******/
if
(
strcmp
(
type
->
valuestring
,
KK_THING_SERVICE_PROPERTY_SET
)
==
0
){
res
=
kk_property_set_data_check
(
payload
,
deviceCode
->
valuestring
);
...
...
@@ -959,7 +988,7 @@ void mid2p_cb(void* data, int len, char* chalMark){
ERROR_PRINT
(
"mid2p_cb malloc buf failed "
);
return
;
}
memcpy
(
buf
,
data
,
len
);
queue_msg
->
data
=
buf
;
memset
(
queue_msg
->
chalMark
,
0
,
sizeof
(
queue_msg
->
chalMark
));
...
...
@@ -973,7 +1002,7 @@ void mid2p_cb(void* data, int len, char* chalMark){
buf
=
NULL
;
return
;
}
//kk_ipc_send(IPC_MID2APP, data, len);
}
}
...
...
@@ -1017,7 +1046,7 @@ static int kk_alarm_notify_handle(dm_mgr_dev_node_t *node,char *identifier,char
cJSON_AddStringToObject
(
info
,
MSG_TYPE_STR
,
"/thing/event/alarmNotify"
);
cJSON_AddStringToObject
(
info
,
MSG_DEVICE_CODE_STR
,
node
->
deviceCode
);
cJSON_AddStringToObject
(
info
,
MSG_PRODUCT_CODE_STR
,
node
->
productCode
);
char
*
infff
=
cJSON_Print
(
info
);
char
*
infff
=
cJSON_Print
(
info
);
cJSON
*
payload
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
payload
,
"method"
,
"thing.event.alarmNotify"
);
...
...
@@ -1025,11 +1054,11 @@ static int kk_alarm_notify_handle(dm_mgr_dev_node_t *node,char *identifier,char
cJSON_AddStringToObject
(
payload
,
"identifier"
,
"alarmNotify"
);
char
msgId
[
64
]
=
{
0
};
iotx_report_id
(
msgId
);
cJSON_AddStringToObject
(
payload
,
"msgId"
,
msgId
);
cJSON_AddStringToObject
(
payload
,
"msgId"
,
msgId
);
//char timerStr[16] = {0};
//HAL_GetTime_s(timerStr);
cJSON_AddNumberToObject
(
payload
,
"time"
,
HAL_GetTime_ms
());
cJSON_AddNumberToObject
(
payload
,
"time"
,
HAL_GetTime_ms
());
cJSON
*
param
=
cJSON_CreateObject
();
if
(
strcmp
(
identifier
,
"BatteryAlarm"
)
==
0
){
cJSON_AddStringToObject
(
param
,
"LowBatteryState"
,
"1"
);
...
...
@@ -1054,7 +1083,7 @@ static int kk_alarm_notify_handle(dm_mgr_dev_node_t *node,char *identifier,char
}
else
if
(
strcmp
(
identifier
,
"SmokeSensorState"
)
==
0
&&
atoi
(
valueBuf
)
==
0
){
cJSON_AddStringToObject
(
param
,
"CommonAlarmState"
,
"0"
);
}
}
else
if
(
strcmp
(
identifier
,
"GasSensorState"
)
==
0
&&
atoi
(
valueBuf
)
==
0
){
cJSON_AddStringToObject
(
param
,
"CommonAlarmState"
,
"0"
);
}
...
...
@@ -1108,14 +1137,14 @@ static int kk_alarm_notify_handle(dm_mgr_dev_node_t *node,char *identifier,char
free
(
payload11
);
free
(
infff
);
cJSON_Delete
(
payload
);
cJSON_Delete
(
info
);
cJSON_Delete
(
info
);
return
0
;
}
static
int
kk_subDevice_property_save
(
cJSON
*
payload
,
char
*
deviceCode
,
int
type
)
{
dm_mgr_dev_node_t
*
node
=
NULL
;
kk_tsl_data_t
*
property
=
NULL
;
cJSON
*
propertyItem
=
NULL
;
cJSON
*
propertyItem
=
NULL
;
int
res
=
0
;
int
idx
=
0
;
int
epNumInt
=
0
;
...
...
@@ -1124,11 +1153,11 @@ static int kk_subDevice_property_save(cJSON *payload,char *deviceCode,int type)
cJSON
*
eps
=
cJSON_GetObjectItem
(
params
,
"eps"
);
if
(
eps
==
NULL
||
eps
->
type
!=
cJSON_Array
){
return
FAIL_RETURN
;
}
}
res
=
dm_mgr_get_device_by_devicecode
(
deviceCode
,
&
node
);
if
(
res
<
SUCCESS_RETURN
)
{
return
FAIL_RETURN
;
}
}
cJSON
*
client_list
=
eps
->
child
;
while
(
client_list
!=
NULL
){
cJSON
*
epNum
=
cJSON_GetObjectItem
(
client_list
,
"epNum"
);
...
...
@@ -1171,7 +1200,7 @@ static int kk_subDevice_property_save(cJSON *payload,char *deviceCode,int type)
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
);
...
...
@@ -1179,10 +1208,10 @@ static int kk_subDevice_property_save(cJSON *payload,char *deviceCode,int type)
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
);
}
}
}
}
}
client_list
=
client_list
->
next
;
}
...
...
@@ -1233,7 +1262,7 @@ static int kk_indoorAir_online_handle(dm_mgr_dev_node_t *node ,char *deviceCode,
continue
;
}
kk_indoorAir_db_insert
(
deviceCode
,
property
->
identifier
,
property
->
data_value
.
type
,
epNum
);
}
}
gwExist
=
kk_get_device_roomInfo
(
deviceCode
,
1
,
roomName
,
roomId
);
//获取网关房间信息
if
(
gwExist
){
char
name
[
128
]
=
{
0
};
...
...
@@ -1261,7 +1290,7 @@ static int kk_subAirSwitch_online_handle(dm_mgr_dev_node_t *node ,char *deviceCo
continue
;
}
kk_subAirSwitch_db_insert
(
deviceCode
,
property
->
identifier
,
property
->
data_value
.
type
,
epNum
);
}
}
gwExist
=
kk_get_device_roomInfo
(
deviceCode
,
1
,
roomName
,
roomId
);
//获取网关房间信息
if
(
gwExist
){
char
name
[
128
]
=
{
0
};
...
...
@@ -1289,7 +1318,7 @@ static int kk_subFreshair_online_handle(dm_mgr_dev_node_t *node ,char *deviceCod
continue
;
}
kk_subFreshAir_db_insert
(
deviceCode
,
property
->
identifier
,
property
->
data_value
.
type
,
epNum
);
}
}
gwExist
=
kk_get_device_roomInfo
(
deviceCode
,
1
,
roomName
,
roomId
);
//获取网关房间信息
if
(
gwExist
){
char
name
[
128
]
=
{
0
};
...
...
@@ -1330,18 +1359,18 @@ void kk_platMsg_handle(void* data, char* chalMark){
ERROR_PRINT
(
"msgType info_dcode or jsonPay params are error
\n
"
);
goto
error
;
}
//if (chalMark != NULL){
//if(strcmp(msgType->valuestring,"/thing/service/property/set_reply") != 0){
//dm_mgr_update_timestamp_by_devicecode(chalMark,HAL_Uptimes());
//}
//}
//printf("msgType->valuestring:%s [%s][%d]\n",msgType->valuestring,__FUNCTION__,__LINE__);
if
(
strcmp
(
msgType
->
valuestring
,
"/thing/service/property/get_reply"
)
!=
0
&&
if
(
strcmp
(
msgType
->
valuestring
,
"/thing/service/property/get_reply"
)
!=
0
&&
strcmp
(
msgType
->
valuestring
,
"/thing/service/property/set_reply"
)
!=
0
){
dm_mgr_update_timestamp_by_devicecode
(
info_dcode
->
valuestring
,
HAL_Uptimes
());
}
if
(
strcmp
(
msgType
->
valuestring
,
KK_THING_TOPO_ADD_MSG
)
==
0
){
jsonPay
=
cJSON_GetObjectItem
(
payload
,
MSG_PARAMS_STR
);
if
(
jsonPay
==
NULL
)
goto
error
;
...
...
@@ -1382,7 +1411,7 @@ void kk_platMsg_handle(void* data, char* chalMark){
res
=
dm_mgr_get_device_by_devicecode
(
devCode
->
valuestring
,
&
search_node
);
if
(
res
<
SUCCESS_RETURN
)
{
goto
error
;
}
}
if
(
strcmp
(
search_node
->
productType
,
KK_DM_AIR_GATEWAY_TYPE
)
==
0
){
cJSON
*
epNumJson
=
cJSON_GetObjectItem
(
jsonPay
,
"epNum"
);
if
(
epNumJson
==
NULL
)
goto
error
;
...
...
@@ -1408,7 +1437,7 @@ void kk_platMsg_handle(void* data, char* chalMark){
res
=
dm_mgr_get_device_by_devicecode
(
devCode
->
valuestring
,
&
search_node
);
if
(
res
<
SUCCESS_RETURN
)
{
goto
error
;
}
}
if
(
strcmp
(
search_node
->
productType
,
KK_DM_AIR_GATEWAY_TYPE
)
==
0
){
cJSON
*
epNumJson
=
cJSON_GetObjectItem
(
jsonPay
,
"epNum"
);
if
(
epNumJson
==
NULL
)
goto
error
;
...
...
@@ -1425,7 +1454,7 @@ void kk_platMsg_handle(void* data, char* chalMark){
kk_subFreshAir_db_update_online
((
char
*
)
search_node
->
deviceCode
,
0
,
epNumJson
->
valueint
);
_kk_subDevice_online_to_app
(
info
,
payload
);
}
}
}
else
if
(
strstr
(
msgType
->
valuestring
,
KK_THING_TOPO_BATCH_ADD_MSG
)
!=
NULL
){
kk_ipc_send
(
IPC_MID2APP
,
data
,
strlen
(
data
));
jsonPay
=
cJSON_GetObjectItem
(
payload
,
MSG_PARAMS_STR
);
...
...
@@ -1436,14 +1465,14 @@ void kk_platMsg_handle(void* data, char* chalMark){
while
(
item
!=
NULL
){
char
*
deviceCode
=
cJSON_GetObjectItem
(
item
,
MSG_DEVICE_CODE_STR
)
->
valuestring
;
char
*
productCode
=
cJSON_GetObjectItem
(
item
,
MSG_PRODUCT_CODE_STR
)
->
valuestring
;
char
*
mac_s
=
cJSON_GetObjectItem
(
item
,
MSG_DEVICE_MAC
)
->
valuestring
;
char
*
fatherMac
=
cJSON_GetObjectItem
(
item
,
MSG_DEVICE_PARENTCODE
)
->
valuestring
;
char
*
mac_s
=
cJSON_GetObjectItem
(
item
,
MSG_DEVICE_MAC
)
->
valuestring
;
char
*
fatherMac
=
cJSON_GetObjectItem
(
item
,
MSG_DEVICE_PARENTCODE
)
->
valuestring
;
version
=
cJSON_GetObjectItem
(
item
,
"version"
);
if
(
version
!=
NULL
){
memcpy
(
versionBuf
,
version
->
valuestring
,
strlen
(
version
->
valuestring
));
}
else
{
memcpy
(
versionBuf
,
"1.1.0"
,
strlen
(
"1.1.0"
));
}
}
kk_mid_subdev_batch_add
(
productCode
,
deviceCode
,
mac_s
,
fatherMac
,
versionBuf
);
item
=
item
->
next
;
}
...
...
@@ -1481,7 +1510,7 @@ void kk_platMsg_handle(void* data, char* chalMark){
kk_tsl_property_set_by_shadow
(
search_node
->
dev_shadow
,
outstr
,
strlen
(
outstr
)
+
1
);
proCode
=
cJSON_GetObjectItem
(
info
,
MSG_PRODUCT_CODE_STR
);
dm_msg_thing_property_post_by_identify
(
proCode
->
valuestring
,
info_dcode
->
valuestring
,
jsonPay
);
//如果带version,代表的是快照信息,快照信息不需要触发iftt
//如果带version,代表的是快照信息,快照信息不需要触发iftt
cJSON
*
version
=
cJSON_GetObjectItem
(
jsonPay
,
"version"
);
if
(
version
==
NULL
&&
is_BodySensor_dev
(
proCode
->
valuestring
)
==
0
){
kk_scene_iftt_check
(
info_dcode
->
valuestring
,
jsonPay
);
...
...
@@ -1497,13 +1526,13 @@ void kk_platMsg_handle(void* data, char* chalMark){
res
=
dm_mgr_get_device_by_devicecode
(
devCode
->
valuestring
,
&
node
);
if
(
res
<
SUCCESS_RETURN
)
{
goto
error
;
}
}
printf
(
"--------------------------------------->11111111111111111111113333
\n
"
);
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);
//dm_mgr_subdev_delete(devCode->valuestring);
}
else
if
(
strstr
(
msgType
->
valuestring
,
KK_THING_EVENT_MESSAGE
)
!=
NULL
&&
\
strstr
(
msgType
->
valuestring
,
KK_THING_EVENT_POST
)
!=
NULL
){
dm_mgr_dev_node_t
*
node
=
NULL
;
...
...
@@ -1533,9 +1562,9 @@ void kk_platMsg_handle(void* data, char* chalMark){
if
(
buttonId
==
NULL
||
buttonId
->
type
!=
cJSON_Number
){
ERROR_PRINT
(
"DATA ERROR!!!
\n
"
);
goto
error
;
}
}
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
"
);
for
(
idx
=
0
;
idx
<
node
->
dev_shadow
->
event_number
;
idx
++
){
...
...
@@ -1545,7 +1574,7 @@ void kk_platMsg_handle(void* data, char* chalMark){
INFO_PRINT
(
"eventItem->identifier = NULL
\n
"
);
continue
;
}
if
(
strcmp
(
eventItem
->
identifier
,
MSG_PROPERTY_STR
)
!=
0
&&
eventItem
->
output_data_number
>
0
){
int
index
=
0
;
...
...
@@ -1555,7 +1584,7 @@ void kk_platMsg_handle(void* data, char* chalMark){
}
for
(
index
=
0
;
index
<
eventItem
->
output_data_number
;
index
++
){
itemStr
=
cJSON_GetObjectItem
(
jsonPay
,
eventItem
->
identifier
);
itemData
=
eventItem
->
output_datas
+
index
;
itemData
=
eventItem
->
output_datas
+
index
;
cJSON
*
itemDataIdentifier
=
cJSON_GetObjectItem
(
jsonPay
,
itemData
->
identifier
);
if
(
itemDataIdentifier
!=
NULL
){
memset
(
tmpStr
,
0x0
,
sizeof
(
tmpStr
));
...
...
@@ -1564,7 +1593,7 @@ void kk_platMsg_handle(void* data, char* chalMark){
itemData
->
data_value
.
type
==
KK_TSL_DATA_TYPE_ENUM
||
itemData
->
data_value
.
type
==
KK_TSL_DATA_TYPE_BOOL
){
sprintf
(
valueBuf
,
"%d"
,
itemDataIdentifier
->
valueint
);
kk_tsl_set_value
(
kk_tsl_set_event_output_value
,
node
->
dev_shadow
,
tmpStr
,
&
itemDataIdentifier
->
valueint
,
NULL
);
kk_tsl_set_value
(
kk_tsl_set_event_output_value
,
node
->
dev_shadow
,
tmpStr
,
&
itemDataIdentifier
->
valueint
,
NULL
);
}
else
if
(
itemData
->
data_value
.
type
==
KK_TSL_DATA_TYPE_FLOAT
||
itemData
->
data_value
.
type
==
KK_TSL_DATA_TYPE_DOUBLE
){
...
...
@@ -1576,10 +1605,10 @@ void kk_platMsg_handle(void* data, char* chalMark){
itemData
->
data_value
.
type
==
KK_TSL_DATA_TYPE_DATE
){
sprintf
(
valueBuf
,
"%s"
,
itemDataIdentifier
->
valuestring
);
kk_tsl_set_value
(
kk_tsl_set_event_output_value
,
node
->
dev_shadow
,
tmpStr
,
NULL
,
itemDataIdentifier
->
valuestring
);
}
}
if
(
sensorDev
){
kk_alarm_notify_handle
(
node
,
itemData
->
identifier
,
valueBuf
);
//告警信息处理
}
}
INFO_PRINT
(
"kk_platMsg_handle data: event post
\n
"
);
dm_msg_thing_event_post
(
info_dcode
->
valuestring
,
eventItem
->
identifier
,
NULL
);
kk_scene_iftt_check
(
info_dcode
->
valuestring
,
jsonPay
);
...
...
@@ -1593,8 +1622,8 @@ void kk_platMsg_handle(void* data, char* chalMark){
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);
}
//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
);
}
...
...
@@ -1605,15 +1634,15 @@ void kk_platMsg_handle(void* data, char* chalMark){
else
if
(
strstr
(
msgType
->
valuestring
,
KK_THING_TOPO_BATCH_DELETE_MSG
)
!=
NULL
){
kk_ipc_send
(
IPC_MID2APP
,
data
,
strlen
(
data
));
jsonPay
=
cJSON_GetObjectItem
(
payload
,
MSG_PARAMS_STR
);
if
(
jsonPay
==
NULL
)
goto
error
;
if
(
jsonPay
==
NULL
)
goto
error
;
cJSON
*
devices
=
cJSON_GetObjectItem
(
jsonPay
,
MSG_TOPO_CHANGE_DEVICES_STR
);
cJSON
*
item
=
devices
->
child
;
while
(
item
!=
NULL
){
char
*
deviceCode
=
cJSON_GetObjectItem
(
item
,
MSG_DEVICE_CODE_STR
)
->
valuestring
;
dm_mgr_subdev_delete
(
deviceCode
);
item
=
item
->
next
;
}
}
}
else
if
(
strstr
(
msgType
->
valuestring
,
KK_THING_SERVICE_PROPERTY_GET_REPLY
)
!=
NULL
){
INFO_PRINT
(
"kk_platMsg_handle data: KK_THING_SERVICE_PROPERTY_GET_REPLY
\n
"
);
...
...
@@ -1679,11 +1708,11 @@ typedef struct {
int
permit_join
;
void
*
g_mid_dispatch_thread
;
void
*
g_ota_dispatch_thread
;
void
*
g_ccuProChg_dispatch_thread
;
void
*
g_ccuProChg_dispatch_thread
;
void
*
g_udp_dispatch_thread
;
int
g_mid_dispatch_thread_running
;
int
g_ota_dispatch_thread_running
;
int
g_ccuProChg_dispatch_thread_running
;
int
g_ccuProChg_dispatch_thread_running
;
int
g_udp_dispatch_thread_running
;
}
mid_ctx_t
;
#define MID_YIELD_TIMEOUT_MS (200)
...
...
@@ -1747,45 +1776,45 @@ void *ota_dispatch_yield(void *args)
void
*
udp_dispatch_yield
(
void
*
args
){
INFO_PRINT
(
"udp_dispatch_yield udp thread create
\n
"
);
// 绑定地址
struct
sockaddr_in
addrto
;
bzero
(
&
addrto
,
sizeof
(
struct
sockaddr_in
));
addrto
.
sin_family
=
AF_INET
;
addrto
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
addrto
.
sin_port
=
htons
(
UDP_LAN_PORT
);
// 绑定地址
struct
sockaddr_in
addrto
;
bzero
(
&
addrto
,
sizeof
(
struct
sockaddr_in
));
addrto
.
sin_family
=
AF_INET
;
addrto
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
addrto
.
sin_port
=
htons
(
UDP_LAN_PORT
);
// 发送地址
struct
sockaddr_in
addrto_host
;
bzero
(
&
addrto_host
,
sizeof
(
struct
sockaddr_in
));
addrto_host
.
sin_family
=
AF_INET
;
addrto_host
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
//addrto_host.sin_port = htons(UDP_LAN_PORT);
struct
sockaddr_in
addrto_host
;
bzero
(
&
addrto_host
,
sizeof
(
struct
sockaddr_in
));
addrto_host
.
sin_family
=
AF_INET
;
addrto_host
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
//addrto_host.sin_port = htons(UDP_LAN_PORT);
// 接收到的广播地址
struct
sockaddr_in
from
;
bzero
(
&
from
,
sizeof
(
struct
sockaddr_in
));
// 接收到的广播地址
struct
sockaddr_in
from
;
bzero
(
&
from
,
sizeof
(
struct
sockaddr_in
));
int
sock
=
-
1
;
int
sock_host
=
-
1
;
if
((
sock
=
socket
(
AF_INET
,
SOCK_DGRAM
,
0
))
==
-
1
)
int
sock
=
-
1
;
int
sock_host
=
-
1
;
if
((
sock
=
socket
(
AF_INET
,
SOCK_DGRAM
,
0
))
==
-
1
)
{
ERROR_PRINT
(
"socket error
\n
"
);
ERROR_PRINT
(
"socket error
\n
"
);
}
if
((
sock_host
=
socket
(
AF_INET
,
SOCK_DGRAM
,
0
))
==
-
1
)
if
((
sock_host
=
socket
(
AF_INET
,
SOCK_DGRAM
,
0
))
==
-
1
)
{
ERROR_PRINT
(
"socket error
\n
"
);
ERROR_PRINT
(
"socket error
\n
"
);
}
if
(
bind
(
sock
,(
struct
sockaddr
*
)
&
(
addrto
),
sizeof
(
struct
sockaddr_in
))
==
-
1
)
if
(
bind
(
sock
,(
struct
sockaddr
*
)
&
(
addrto
),
sizeof
(
struct
sockaddr_in
))
==
-
1
)
{
ERROR_PRINT
(
"bind error...
\n
"
);
ERROR_PRINT
(
"bind error...
\n
"
);
}
socklen_t
len
=
sizeof
(
struct
sockaddr_in
);
socklen_t
len
=
sizeof
(
struct
sockaddr_in
);
char
szOut
[
128
]
=
{
0
};
char
szDec
[
1024
]
=
{
0
};
char
szDec
[
1024
]
=
{
0
};
char
host_ip
[
32
]
=
{
0
};
char
mac
[
32
]
=
{
0
};
char
device_code
[
DEVICE_CODE_LEN
]
=
{
0
};
...
...
@@ -1803,17 +1832,17 @@ void *udp_dispatch_yield(void *args){
while
(
1
)
{
//从广播地址接受消息
//从广播地址接受消息
memset
(
szDec
,
0
,
sizeof
(
szDec
));
int
size
=
recvfrom
(
sock
,
szDec
,
sizeof
(
szDec
),
0
,
(
struct
sockaddr
*
)
&
from
,(
socklen_t
*
)
&
len
);
if
(
size
<=
0
)
int
size
=
recvfrom
(
sock
,
szDec
,
sizeof
(
szDec
),
0
,
(
struct
sockaddr
*
)
&
from
,(
socklen_t
*
)
&
len
);
if
(
size
<=
0
)
{
WARNING_PRINT
(
"read error....
\n
"
);
WARNING_PRINT
(
"read error....
\n
"
);
}
else
{
DEBUG_PRINT
(
"lan recmsg: %s
\n
"
,
szDec
);
//DEBUG_PRINT("udp client ip:%s ,port is :%d htons(UDP_LAN_PORT)=%d \n",inet_ntoa(from.sin_addr),from.sin_port, htons(UDP_LAN_PORT));
DEBUG_PRINT
(
"lan recmsg: %s
\n
"
,
szDec
);
//DEBUG_PRINT("udp client ip:%s ,port is :%d htons(UDP_LAN_PORT)=%d \n",inet_ntoa(from.sin_addr),from.sin_port, htons(UDP_LAN_PORT));
//"search_kk_ccu|deviceCode=1122334455667788;protocol=tcp"
if
(
strstr
(
szDec
,
"search_kk_ccu|"
)
!=
NULL
){
char
*
getConnet
=
szDec
+
strlen
(
"search_kk_ccu|"
);
...
...
@@ -1876,23 +1905,23 @@ void *udp_dispatch_yield(void *args){
// printf("[%s][%d]host_ip:%s\n",__FUNCTION__,__LINE__,host_ip);
// if(strcmp(inet_ntoa(from.sin_addr),host_ip) == 0){
sprintf
(
szOut
,
"search_kk_ccu_ack|deviceCode=%s;ip=%s;port=%d"
,
device_code
,
host_ip
,
16565
);
DEBUG_PRINT
(
"szOut:%s
\n
"
,
szOut
);
DEBUG_PRINT
(
"udp client ip:%s ,port is :%d
\n
"
,
inet_ntoa
(
from
.
sin_addr
),
from
.
sin_port
);
//sendto(sock, szOut, strlen(szOut), 0, (struct sockaddr*)&from,len);
DEBUG_PRINT
(
"szOut:%s
\n
"
,
szOut
);
DEBUG_PRINT
(
"udp client ip:%s ,port is :%d
\n
"
,
inet_ntoa
(
from
.
sin_addr
),
from
.
sin_port
);
//sendto(sock, szOut, strlen(szOut), 0, (struct sockaddr*)&from,len);
addrto_host
.
sin_addr
.
s_addr
=
inet_addr
(
inet_ntoa
(
from
.
sin_addr
));
addrto_host
.
sin_addr
.
s_addr
=
inet_addr
(
inet_ntoa
(
from
.
sin_addr
));
if
(
strlen
(
portStr
)
>
0
){
addrto_host
.
sin_port
=
htons
(
atoi
(
portStr
));
addrto_host
.
sin_port
=
htons
(
atoi
(
portStr
));
}
else
{
addrto_host
.
sin_port
=
htons
(
UDP_LAN_PORT_HOST
);
addrto_host
.
sin_port
=
htons
(
UDP_LAN_PORT_HOST
);
}
//addrto_host.sin_port = from.sin_port;
//addrto_host.sin_port = from.sin_port;
//if(strcmp(host_ip,inet_ntoa(from.sin_addr)) == 0)
//{
sendto
(
sock_host
,
szOut
,
strlen
(
szOut
),
0
,
(
struct
sockaddr
*
)
&
addrto_host
,
sizeof
(
addrto_host
));
sendto
(
sock_host
,
szOut
,
strlen
(
szOut
),
0
,
(
struct
sockaddr
*
)
&
addrto_host
,
sizeof
(
addrto_host
));
//}
//else
//{
...
...
@@ -1901,7 +1930,7 @@ void *udp_dispatch_yield(void *args){
// }
}
}
usleep
(
100000
);
usleep
(
100000
);
}
close
(
sock
);
...
...
@@ -2073,7 +2102,7 @@ int main(const int argc, const char **argv)
//IOT_Linkkit_Close(mid_ctx->master_devid);
return
-
1
;
}
mid_ctx
->
g_ota_dispatch_thread_running
=
1
;
res
=
pthread_create
((
pthread_t
*
)
&
mid_ctx
->
g_ota_dispatch_thread
,
NULL
,
ota_dispatch_yield
,
NULL
);
if
(
res
<
0
)
{
...
...
@@ -2089,7 +2118,7 @@ int main(const int argc, const char **argv)
//IOT_Linkkit_Close(mid_ctx->master_devid);
return
-
1
;
}
mid_ctx
->
g_ccuProChg_dispatch_thread_running
=
1
;
res
=
pthread_create
((
pthread_t
*
)
&
mid_ctx
->
g_ccuProChg_dispatch_thread
,
NULL
,
ccu_property_monitor
,
NULL
);
if
(
res
<
0
)
{
...
...
@@ -2097,8 +2126,6 @@ int main(const int argc, const char **argv)
return
-
1
;
}
//int ct = 0;
for
(;;)
{
usleep
(
200000
);
...
...
@@ -2106,6 +2133,6 @@ int main(const int argc, const char **argv)
BodySensorTrigger_check
();
}
}
opcodeMapCfg/device_3005.json
View file @
b46e8c98
{
"productCode"
:
"3005"
,
"operateType"
:
"100
3
"
,
"operateType"
:
"100
6
"
,
"channel"
:
1
,
"newccu"
:[
{
...
...
opcodeMapCfg/device_3006.json
View file @
b46e8c98
{
"productCode"
:
"3006"
,
"operateType"
:
"100
3
"
,
"operateType"
:
"100
6
"
,
"channel"
:
2
,
"newccu"
:[
{
...
...
opcodeMapCfg/device_3012.json
View file @
b46e8c98
{
"productCode"
:
"3012"
,
"operateType"
:
"100
3
"
,
"operateType"
:
"100
6
"
,
"channel"
:
1
,
"newccu"
:[
{
...
...
opcodeMapCfg/device_3026.json
View file @
b46e8c98
{
"productCode"
:
"3026"
,
"operateType"
:
"100
3
"
,
"operateType"
:
"100
6
"
,
"channel"
:
1
,
"newccu"
:[
{
...
...
opcodeMapCfg/device_3027.json
View file @
b46e8c98
{
"productCode"
:
"3027"
,
"operateType"
:
"100
3
"
,
"operateType"
:
"100
6
"
,
"channel"
:
2
,
"newccu"
:[
{
...
...
opcodeMapCfg/device_3067.json
View file @
b46e8c98
...
...
@@ -13,8 +13,8 @@
"valueRange"
:[
0
,
1
,
2
],
"value"
:
2
},{
"identifier"
:
"
motorPos
"
,
"opcodemap"
:
"
SWITCH
"
,
"identifier"
:
"
Position
"
,
"opcodemap"
:
"
MOVE_TO_POS
"
,
"dataType"
:
"int"
,
"channel"
:
"1"
,
"valueRange"
:[],
...
...
@@ -22,31 +22,31 @@
},{
"identifier"
:
"motorDir"
,
"opcodemap"
:
"SWITCH"
,
"dataType"
:
"
int
"
,
"dataType"
:
"
string
"
,
"channel"
:
"1"
,
"valueRange"
:[],
"value"
:
0
"value"
:
"0"
},{
"identifier"
:
"pullEnable"
,
"opcodemap"
:
"SWITCH"
,
"dataType"
:
"
int
"
,
"dataType"
:
"
string
"
,
"channel"
:
"1"
,
"valueRange"
:[],
"value"
:
0
"value"
:
"0"
},{
"identifier"
:
"motorStatus"
,
"opcodemap"
:
"SWITCH"
,
"dataType"
:
"
int
"
,
"dataType"
:
"
string
"
,
"channel"
:
"1"
,
"valueRange"
:[],
"value"
:
0
"value"
:
"0"
},{
"identifier"
:
"routeCfg"
,
"opcodemap"
:
"SWITCH"
,
"dataType"
:
"
int
"
,
"dataType"
:
"
string
"
,
"channel"
:
"1"
,
"valueRange"
:[],
"value"
:
0
"value"
:
"0"
}
],
"oldccu"
:[
...
...
@@ -59,17 +59,17 @@
"syn"
:
"switchStatus"
,
"synType"
:
"map"
},{
"opcode"
:
"
SWITCH
"
,
"identifiermap"
:
"
motorPos
"
,
"dataType"
:
"int"
,
"opcode"
:
"
MOVE_TO_POS
"
,
"identifiermap"
:
"
Position
"
,
"dataType"
:
"
string_
int"
,
"channel"
:
"1"
,
"valueRange"
:[],
"syn"
:
"motorPos"
,
"synType"
:
"
fit
"
"synType"
:
"
string
"
},{
"opcode"
:
"SWITCH"
,
"identifiermap"
:
"motorDir"
,
"dataType"
:
"
int
"
,
"dataType"
:
"
string
"
,
"channel"
:
"1"
,
"valueRange"
:[],
"syn"
:
"motorDir"
,
...
...
@@ -77,7 +77,7 @@
},{
"opcode"
:
"SWITCH"
,
"identifiermap"
:
"pullEnable"
,
"dataType"
:
"
int
"
,
"dataType"
:
"
string
"
,
"channel"
:
"1"
,
"valueRange"
:[],
"syn"
:
"pullEnable"
,
...
...
@@ -85,7 +85,7 @@
},{
"opcode"
:
"SWITCH"
,
"identifiermap"
:
"motorStatus"
,
"dataType"
:
"
int
"
,
"dataType"
:
"
string
"
,
"channel"
:
"1"
,
"valueRange"
:[],
"syn"
:
"motorStatus"
,
...
...
@@ -93,7 +93,7 @@
},{
"opcode"
:
"SWITCH"
,
"identifiermap"
:
"routeCfg"
,
"dataType"
:
"
int
"
,
"dataType"
:
"
string
"
,
"channel"
:
"1"
,
"valueRange"
:[],
"syn"
:
"routeCfg"
,
...
...
opcodeMapCfg/device_3068.json
View file @
b46e8c98
...
...
@@ -2,6 +2,8 @@
"productCode"
:
"3068"
,
"operateType"
:
"1003"
,
"channel"
:
1
,
"syn_type"
:
1
,
"syn_opcode"
:
"DOOYA_STATUS"
,
"newccu"
:[
{
"identifier"
:
"OperationMode"
,
...
...
@@ -10,6 +12,41 @@
"channel"
:
"1"
,
"valueRange"
:[
0
,
1
,
2
],
"value"
:
2
},{
"identifier"
:
"Position"
,
"opcodemap"
:
"MOVE_TO_POS"
,
"dataType"
:
"int"
,
"channel"
:
"1"
,
"valueRange"
:[],
"value"
:
0
},{
"identifier"
:
"motorDir"
,
"opcodemap"
:
"SWITCH"
,
"dataType"
:
"string"
,
"channel"
:
"1"
,
"valueRange"
:[],
"value"
:
"0"
},{
"identifier"
:
"pullEnable"
,
"opcodemap"
:
"SWITCH"
,
"dataType"
:
"string"
,
"channel"
:
"1"
,
"valueRange"
:[],
"value"
:
"0"
},{
"identifier"
:
"motorStatus"
,
"opcodemap"
:
"SWITCH"
,
"dataType"
:
"string"
,
"channel"
:
"1"
,
"valueRange"
:[],
"value"
:
"0"
},{
"identifier"
:
"routeCfg"
,
"opcodemap"
:
"SWITCH"
,
"dataType"
:
"string"
,
"channel"
:
"1"
,
"valueRange"
:[],
"value"
:
"0"
}
],
"oldccu"
:[
...
...
@@ -18,7 +55,49 @@
"identifiermap"
:
"OperationMode"
,
"dataType"
:
"map"
,
"channel"
:
"1"
,
"valueRange"
:[
"CLOSE"
,
"OPEN"
,
"STOP"
]
"valueRange"
:[
"CLOSE"
,
"OPEN"
,
"STOP"
],
"syn"
:
"switchStatus"
,
"synType"
:
"map"
},{
"opcode"
:
"MOVE_TO_POS"
,
"identifiermap"
:
"Position"
,
"dataType"
:
"string_int"
,
"channel"
:
"1"
,
"valueRange"
:[],
"syn"
:
"motorPos"
,
"synType"
:
"string"
},{
"opcode"
:
"SWITCH"
,
"identifiermap"
:
"motorDir"
,
"dataType"
:
"string"
,
"channel"
:
"1"
,
"valueRange"
:[],
"syn"
:
"motorDir"
,
"synType"
:
"fit"
},{
"opcode"
:
"SWITCH"
,
"identifiermap"
:
"pullEnable"
,
"dataType"
:
"string"
,
"channel"
:
"1"
,
"valueRange"
:[],
"syn"
:
"pullEnable"
,
"synType"
:
"fit"
},{
"opcode"
:
"SWITCH"
,
"identifiermap"
:
"motorStatus"
,
"dataType"
:
"string"
,
"channel"
:
"1"
,
"valueRange"
:[],
"syn"
:
"motorStatus"
,
"synType"
:
"fit"
},{
"opcode"
:
"SWITCH"
,
"identifiermap"
:
"routeCfg"
,
"dataType"
:
"string"
,
"channel"
:
"1"
,
"valueRange"
:[],
"syn"
:
"routeCfg"
,
"synType"
:
"fit"
}
]
...
...
opcodeMapCfg/device_3088.json
View file @
b46e8c98
{
"productCode"
:
"3088"
,
"operateType"
:
"100
3
"
,
"operateType"
:
"100
6
"
,
"channel"
:
1
,
"newccu"
:[
{
...
...
opcodeMapCfg/device_3089.json
View file @
b46e8c98
{
"productCode"
:
"3089"
,
"operateType"
:
"100
3
"
,
"operateType"
:
"100
6
"
,
"channel"
:
2
,
"newccu"
:[
{
...
...
opcodeMapCfg/device_3147.json
View file @
b46e8c98
{
"productCode"
:
"3147"
,
"operateType"
:
"100
3
"
,
"operateType"
:
"100
6
"
,
"channel"
:
1
,
"newccu"
:[
{
...
...
opcodeMapCfg/device_3148.json
View file @
b46e8c98
{
"productCode"
:
"3148"
,
"operateType"
:
"100
3
"
,
"operateType"
:
"100
6
"
,
"channel"
:
2
,
"newccu"
:[
{
...
...
opcodeMapCfg/device_3154.json
View file @
b46e8c98
{
"productCode"
:
"3154"
,
"operateType"
:
"100
3
"
,
"operateType"
:
"100
6
"
,
"channel"
:
1
,
"newccu"
:[
{
...
...
opcodeMapCfg/device_3155.json
View file @
b46e8c98
{
"productCode"
:
"3155"
,
"operateType"
:
"100
3
"
,
"operateType"
:
"100
6
"
,
"channel"
:
2
,
"newccu"
:[
{
...
...
tsl/product_3028.json
View file @
b46e8c98
...
...
@@ -36,6 +36,49 @@
}
},
"name"
:
"亮度"
},
{
"identifier"
:
"FadeTime"
,
"dataType"
:
{
"type"
:
"int"
,
"specs"
:
{
"min"
:
"10"
,
"max"
:
"50"
,
"unit"
:
"1/10s"
,
"unitName"
:
"1/10秒"
,
"step"
:
"10"
}
},
"name"
:
"渐变时间"
},
{
"identifier"
:
"LowBrightness"
,
"dataType"
:
{
"type"
:
"int"
,
"specs"
:
{
"min"
:
"10"
,
"max"
:
"90"
,
"unit"
:
"%"
,
"unitName"
:
"百分比"
,
"step"
:
"1"
}
},
"name"
:
"最低亮度"
},
{
"identifier"
:
"HighBrightness"
,
"dataType"
:
{
"type"
:
"int"
,
"specs"
:
{
"min"
:
"20"
,
"max"
:
"100"
,
"unit"
:
"%"
,
"unitName"
:
"百分比"
,
"step"
:
"1"
}
},
"name"
:
"最高亮度"
}
],
"method"
:
"thing.service.property.set"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment