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
750d9a30
Commit
750d9a30
authored
Sep 11, 2021
by
陈伟灿
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'cwc' into 'master'
Cwc See merge request chenweican/k-sdk!129
parents
c5f15f21
e95c0add
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
107 additions
and
34 deletions
+107
-34
application/kcloud/mqtt_api.c
application/kcloud/mqtt_api.c
+13
-9
application/klansdk/kk_oldccu_msg.c
application/klansdk/kk_oldccu_msg.c
+1
-1
midware/midware/area/kk_area_handle.c
midware/midware/area/kk_area_handle.c
+1
-1
midware/midware/dm/kk_dm_msg.h
midware/midware/dm/kk_dm_msg.h
+1
-0
midware/midware/dm/kk_linkkit.c
midware/midware/dm/kk_linkkit.c
+58
-0
midware/midware/dm/kk_property_db.c
midware/midware/dm/kk_property_db.c
+3
-2
midware/midware/dm/kk_property_db.h
midware/midware/dm/kk_property_db.h
+1
-0
midware/midware/dm/kk_sync_data.c
midware/midware/dm/kk_sync_data.c
+4
-5
midware/midware/scene/kk_scene_handle.c
midware/midware/scene/kk_scene_handle.c
+25
-16
No files found.
application/kcloud/mqtt_api.c
View file @
750d9a30
...
@@ -114,13 +114,15 @@ void onConnectFailure(void* context, MQTTAsync_failureData* response)
...
@@ -114,13 +114,15 @@ void onConnectFailure(void* context, MQTTAsync_failureData* response)
}
}
void
onConnect
(
void
*
context
,
MQTTAsync_successData
*
response
)
void
onConnect
(
void
*
context
,
MQTTAsync_successData
*
response
)
{
{
INFO_PRINT
(
"Successful connection
\n
"
);
INFO_PRINT
(
"-----------Successful connection
\n
"
);
s_cloudStatus
=
DEVICE_ONLINE
;
kk_remove_disconnect_flag
();
kk_remove_disconnect_flag
();
KK_Send_CloudState
(
s_cloudStatus
);
if
(
s_cloudStatus
!=
DEVICE_ONLINE
){
s_cloudStatus
=
DEVICE_ONLINE
;
KK_Send_CloudState
(
s_cloudStatus
);
}
}
}
...
@@ -145,15 +147,18 @@ static void onDeliveryComplete(void* context, MQTTAsync_token token)
...
@@ -145,15 +147,18 @@ static void onDeliveryComplete(void* context, MQTTAsync_token token)
}
}
static
void
onConnectBuild
(
void
*
context
,
char
*
cause
)
static
void
onConnectBuild
(
void
*
context
,
char
*
cause
)
{
{
INFO_PRINT
(
"onConnectBuild:%s
\n
"
,
cause
);
INFO_PRINT
(
"
----
onConnectBuild:%s
\n
"
,
cause
);
//rc = KK_Client_Gateway_Subscribe();
//rc = KK_Client_Gateway_Subscribe();
//if(rc != 0)
//if(rc != 0)
//{
//{
//ERROR_PRINT("KK_MQTT_SubTopic ERROR rc = %d\n",rc);
//ERROR_PRINT("KK_MQTT_SubTopic ERROR rc = %d\n",rc);
//}
//}
s_cloudStatus
=
DEVICE_ONLINE
;
kk_remove_disconnect_flag
();
kk_remove_disconnect_flag
();
KK_Send_CloudState
(
s_cloudStatus
);
if
(
s_cloudStatus
!=
DEVICE_ONLINE
){
s_cloudStatus
=
DEVICE_ONLINE
;
INFO_PRINT
(
"--11--onConnectBuild:%s
\n
"
,
cause
);
KK_Send_CloudState
(
s_cloudStatus
);
}
}
}
static
void
onDisConnected
(
void
*
context
,
MQTTProperties
*
properties
,
enum
MQTTReasonCodes
reasonCode
)
static
void
onDisConnected
(
void
*
context
,
MQTTProperties
*
properties
,
enum
MQTTReasonCodes
reasonCode
)
{
{
...
@@ -242,7 +247,7 @@ MQTTAsync KK_MQTT_Connect(void)
...
@@ -242,7 +247,7 @@ MQTTAsync KK_MQTT_Connect(void)
/*Set the mqtt callback*/
/*Set the mqtt callback*/
mqtt_set_callbacks
();
mqtt_set_callbacks
();
conn_opts
.
keepAliveInterval
=
6
0
;
conn_opts
.
keepAliveInterval
=
3
0
;
conn_opts
.
connectTimeout
=
CONNECT_TIMEOUT
;
conn_opts
.
connectTimeout
=
CONNECT_TIMEOUT
;
conn_opts
.
automaticReconnect
=
AUTO_CONN
;
conn_opts
.
automaticReconnect
=
AUTO_CONN
;
conn_opts
.
minRetryInterval
=
1
;
conn_opts
.
minRetryInterval
=
1
;
...
@@ -269,7 +274,6 @@ int KK_MQTT_SubTopic(char *topicName)
...
@@ -269,7 +274,6 @@ int KK_MQTT_SubTopic(char *topicName)
MQTTAsync_responseOptions
opts
=
MQTTAsync_responseOptions_initializer
;
MQTTAsync_responseOptions
opts
=
MQTTAsync_responseOptions_initializer
;
int
rc
;
int
rc
;
opts
.
onSuccess
=
onOptSuccess
;
opts
.
onSuccess
=
onOptSuccess
;
opts
.
onFailure
=
onOptFail
;
opts
.
onFailure
=
onOptFail
;
opts
.
context
=
(
void
*
)
OPT_SUB
;
opts
.
context
=
(
void
*
)
OPT_SUB
;
...
...
application/klansdk/kk_oldccu_msg.c
View file @
750d9a30
...
@@ -67,7 +67,7 @@ int send_msg_to_module(cJSON *root)
...
@@ -67,7 +67,7 @@ int send_msg_to_module(cJSON *root)
}
}
if
((
msg
=
cJSON_Print
(
root
))
!=
NULL
){
if
((
msg
=
cJSON_Print
(
root
))
!=
NULL
){
debug_log
(
LOG_INFO_LEVEL
,
"[lan->module]
\n
%s
\n
"
,
msg
);
//
debug_log(LOG_INFO_LEVEL,"[lan->module]\n%s\n",msg);
cJSON_Minify
(
msg
);
cJSON_Minify
(
msg
);
kk_send_data_to_sdk
(
msg
);
kk_send_data_to_sdk
(
msg
);
...
...
midware/midware/area/kk_area_handle.c
View file @
750d9a30
...
@@ -539,7 +539,7 @@ kk_dev_list_t* kk_get_room_deviceCode(const char* roomId)
...
@@ -539,7 +539,7 @@ kk_dev_list_t* kk_get_room_deviceCode(const char* roomId)
sqlite3_stmt
*
stmt
;
sqlite3_stmt
*
stmt
;
char
*
sqlCmd
=
NULL
;
char
*
sqlCmd
=
NULL
;
kk_area_ctx_t
*
ctx
=
_kk_area_get_ctx
();
kk_area_ctx_t
*
ctx
=
_kk_area_get_ctx
();
const
char
*
searchCmd
=
"select * from AreaDevInfo;"
;
const
char
*
searchCmd
=
"select * from AreaDevInfo
where epNum = 1
;"
;
_kk_area_lock
();
_kk_area_lock
();
sqlCmd
=
sqlite3_mprintf
(
searchCmd
,
roomId
);
sqlCmd
=
sqlite3_mprintf
(
searchCmd
,
roomId
);
sqlite3_prepare_v2
(
ctx
->
pDb
,
sqlCmd
,
strlen
(
sqlCmd
),
&
stmt
,
NULL
);
sqlite3_prepare_v2
(
ctx
->
pDb
,
sqlCmd
,
strlen
(
sqlCmd
),
&
stmt
,
NULL
);
...
...
midware/midware/dm/kk_dm_msg.h
View file @
750d9a30
...
@@ -87,6 +87,7 @@ const char DM_MSG_INFO[] DM_READ_ONLY;
...
@@ -87,6 +87,7 @@ const char DM_MSG_INFO[] DM_READ_ONLY;
#define KK_THING_SERVICE_SYNCDEVICEINFO "/thing/service/syncDeviceInfo"
#define KK_THING_SERVICE_SYNCDEVICEINFO "/thing/service/syncDeviceInfo"
#define KK_THING_SERVICE_SYNCDEVICEINFO_REPLY "/thing/service/syncDeviceInfo_reply"
#define KK_THING_SERVICE_SYNCDEVICEINFO_REPLY "/thing/service/syncDeviceInfo_reply"
#define KK_THING_SERVICE_CLOUDSTATUS "/thing/service/cloudStatus"
#define KK_THING_SERVICE_CLOUDSTATUS "/thing/service/cloudStatus"
#define KK_THING_SERVICE_EXECUTEDNDMODE "/thing/service/executeDNDMode"
...
...
midware/midware/dm/kk_linkkit.c
View file @
750d9a30
...
@@ -639,6 +639,57 @@ static int kk_service_execute_action(cJSON *action,dm_mgr_dev_node_t *node)
...
@@ -639,6 +639,57 @@ static int kk_service_execute_action(cJSON *action,dm_mgr_dev_node_t *node)
}
}
/************************************************************
*功能描述:设置房间勿让模式
*输入参数:params:云端下发数据,包含房间号等
*输出参数:无
*返 回 值: 0:成功;其他:失败
*其他说明:
*************************************************************/
static
int
kk_service_executeDNDMode_handle
(
cJSON
*
params
)
{
int
res
=
0
;
char
roomIdStr
[
16
]
=
{
0
};
kk_dev_list_t
*
pList
=
NULL
;
dm_mgr_dev_node_t
*
search_node
=
NULL
;
if
(
params
==
NULL
){
return
INVALID_PARAMETER
;
}
cJSON
*
roomId
=
cJSON_GetObjectItem
(
params
,
MSG_AREA_ROOM_ROOMID
);
if
(
roomId
==
NULL
||
roomId
->
type
!=
cJSON_Number
){
ERROR_PRINT
(
"DATA ERROR!!!
\n
"
);
return
INVALID_PARAMETER
;
}
sprintf
(
roomIdStr
,
"%d"
,
roomId
->
valueint
);
pList
=
kk_get_room_deviceCode
(
roomIdStr
);
while
(
pList
!=
NULL
){
res
=
kk_check_property_exist
(
pList
->
deviceCode
,
"NoDisturbMode"
);
if
(
res
!=
1
)
{
pList
=
pList
->
next
;
continue
;
}
res
=
dm_mgr_get_device_by_devicecode
(
pList
->
deviceCode
,
&
search_node
);
if
(
res
!=
SUCCESS_RETURN
)
{
pList
=
pList
->
next
;
continue
;
}
cJSON
*
DNDMode
=
cJSON_GetObjectItem
(
params
,
"DNDMode"
);
if
(
DNDMode
!=
NULL
&&
DNDMode
->
type
==
cJSON_Number
){
cJSON
*
param
=
cJSON_CreateObject
();
cJSON_AddNumberToObject
(
param
,
"NoDisturbMode"
,
DNDMode
->
valueint
);
char
*
paramstr
=
cJSON_Print
(
param
);
kk_msg_execute_property_set
(
search_node
->
productCode
,
search_node
->
deviceCode
,
paramstr
,
search_node
->
fatherDeviceCode
);
free
(
paramstr
);
usleep
(
200000
);
}
pList
=
pList
->
next
;
}
kk_free_room_dev_list
();
return
SUCCESS_RETURN
;
}
/************************************************************
/************************************************************
*功能描述:批量执行房间设备处理
*功能描述:批量执行房间设备处理
*输入参数:params:云端下发数据,包含房间号,productCode等
*输入参数:params:云端下发数据,包含房间号,productCode等
...
@@ -1465,6 +1516,13 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
...
@@ -1465,6 +1516,13 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
INFO_PRINT
(
"TOPO CHANGE
\n
"
);
INFO_PRINT
(
"TOPO CHANGE
\n
"
);
kk_topo_delete_handle
(
payload
,
info_root
);
kk_topo_delete_handle
(
payload
,
info_root
);
//kk_sendData2gw(data, strlen(data), deviceCode->valuestring);//send to gw itself
//kk_sendData2gw(data, strlen(data), deviceCode->valuestring);//send to gw itself
}
else
if
(
strcmp
(
typeJson
->
valuestring
,
KK_THING_SERVICE_EXECUTEDNDMODE
)
==
0
){
INFO_PRINT
(
"EXECUREDNDMODE
\n
"
);
cJSON
*
msgId
=
cJSON_GetObjectItem
(
payload
,
MSG_COMMON_MSGID
);
kk_service_common_reply
(
info_root
,
msgId
,
"/thing/service/executeDNDMode_reply"
);
cJSON
*
paramStr
=
cJSON_GetObjectItem
(
payload
,
MSG_PARAMS_STR
);
kk_service_executeDNDMode_handle
(
paramStr
);
}
}
else
{
else
{
INFO_PRINT
(
"Error msgtype!!!
\n
"
);
INFO_PRINT
(
"Error msgtype!!!
\n
"
);
...
...
midware/midware/dm/kk_property_db.c
View file @
750d9a30
...
@@ -154,7 +154,7 @@ int kk_property_db_init(void)
...
@@ -154,7 +154,7 @@ int kk_property_db_init(void)
*返 回 值: 1:已经存在;0:不存在
*返 回 值: 1:已经存在;0:不存在
*其他说明:
*其他说明:
*************************************************************/
*************************************************************/
static
int
_
kk_check_property_exist
(
const
char
*
deviceCode
,
const
char
*
identifier
)
int
kk_check_property_exist
(
const
char
*
deviceCode
,
const
char
*
identifier
)
{
{
int
isExist
=
0
;
int
isExist
=
0
;
sqlite3_stmt
*
stmt
;
sqlite3_stmt
*
stmt
;
...
@@ -179,6 +179,7 @@ static int _kk_check_property_exist(const char* deviceCode,const char* identifie
...
@@ -179,6 +179,7 @@ static int _kk_check_property_exist(const char* deviceCode,const char* identifie
_kk_property_db_unlock
();
_kk_property_db_unlock
();
return
isExist
;
return
isExist
;
}
}
char
*
human_induction_device
[]
=
{
char
*
human_induction_device
[]
=
{
(
char
*
){
"3049"
},
(
char
*
){
"3049"
},
(
char
*
){
"3042"
},
(
char
*
){
"3042"
},
...
@@ -236,7 +237,7 @@ int kk_property_db_insert(const char *deviceCode,const char *identifier,kk_tsl_d
...
@@ -236,7 +237,7 @@ int kk_property_db_insert(const char *deviceCode,const char *identifier,kk_tsl_d
int
rc
=
0
;
int
rc
=
0
;
char
*
zErrMsg
=
0
;
char
*
zErrMsg
=
0
;
kk_property_db_ctx_t
*
ctx
=
_kk_property_db_get_ctx
();
kk_property_db_ctx_t
*
ctx
=
_kk_property_db_get_ctx
();
if
(
_
kk_check_property_exist
(
deviceCode
,
identifier
)
==
1
)
if
(
kk_check_property_exist
(
deviceCode
,
identifier
)
==
1
)
{
{
return
SUCCESS_RETURN
;
return
SUCCESS_RETURN
;
}
}
...
...
midware/midware/dm/kk_property_db.h
View file @
750d9a30
...
@@ -56,5 +56,6 @@ int kk_property_delete_lockkeys(char deviceCode[DEVICE_CODE_MAXLEN],char *keyId)
...
@@ -56,5 +56,6 @@ int kk_property_delete_lockkeys(char deviceCode[DEVICE_CODE_MAXLEN],char *keyId)
int
kk_indoorAir_db_insert
(
const
char
*
deviceCode
,
const
char
*
identifier
,
kk_tsl_data_type_e
valuetype
,
int
epNum
);
int
kk_indoorAir_db_insert
(
const
char
*
deviceCode
,
const
char
*
identifier
,
kk_tsl_data_type_e
valuetype
,
int
epNum
);
int
kk_indoorAir_db_update_value
(
const
char
*
deviceCode
,
const
char
*
identifier
,
const
char
*
value
,
int
epNum
);
int
kk_indoorAir_db_update_value
(
const
char
*
deviceCode
,
const
char
*
identifier
,
const
char
*
value
,
int
epNum
);
int
kk_indoorAir_query_epnums
(
const
char
*
deviceCode
,
int
epList
[]);
int
kk_indoorAir_query_epnums
(
const
char
*
deviceCode
,
int
epList
[]);
int
kk_check_property_exist
(
const
char
*
deviceCode
,
const
char
*
identifier
);
#endif
#endif
midware/midware/dm/kk_sync_data.c
View file @
750d9a30
...
@@ -436,21 +436,20 @@ static int kk_get_properties_info_obj(char *deviceCode)
...
@@ -436,21 +436,20 @@ static int kk_get_properties_info_obj(char *deviceCode)
sqlite3_prepare_v2
(
ctx
->
pDb
,
sqlCmd
,
strlen
(
sqlCmd
),
&
stmt
,
NULL
);
sqlite3_prepare_v2
(
ctx
->
pDb
,
sqlCmd
,
strlen
(
sqlCmd
),
&
stmt
,
NULL
);
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
propertyStr
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_IDENTIFITER
);
propertyStr
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_IDENTIFITER
);
valueType
=
sqlite3_column_int
(
stmt
,
DB_VALUETYPE
);
valueType
=
sqlite3_column_int
(
stmt
,
DB_VALUETYPE
);
valueStr
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_VALUE
);
valueStr
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_VALUE
);
if
(
strstr
(
propertyStr
,
"."
)
!=
NULL
){
if
(
strstr
(
propertyStr
,
"."
)
!=
NULL
){
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
//
printf("[%s][%d]\n",__FUNCTION__,__LINE__);
char
*
propertiesbuf
[
DEVICE_PROPERTY_NAME_MAX
]
=
{
0
};
char
*
propertiesbuf
[
DEVICE_PROPERTY_NAME_MAX
]
=
{
0
};
kk_split
(
propertyStr
,
"."
,
propertiesbuf
,
&
num
);
kk_split
(
propertyStr
,
"."
,
propertiesbuf
,
&
num
);
if
(
num
==
2
){
if
(
num
==
2
){
if
(
strcmp
(
propertiesbuf
[
0
],
pFinal
)
!=
0
){
if
(
strcmp
(
propertiesbuf
[
0
],
pFinal
)
!=
0
){
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
//
printf("[%s][%d]\n",__FUNCTION__,__LINE__);
memcpy
(
pFinal
,
propertiesbuf
[
0
],
strlen
(
propertiesbuf
[
0
]));
memcpy
(
pFinal
,
propertiesbuf
[
0
],
strlen
(
propertiesbuf
[
0
]));
subObj
=
cJSON_CreateObject
();
subObj
=
cJSON_CreateObject
();
}
}
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
//
printf("[%s][%d]\n",__FUNCTION__,__LINE__);
if
(
strlen
(
pFinal
)
>
0
&&
subObj
!=
NULL
){
if
(
strlen
(
pFinal
)
>
0
&&
subObj
!=
NULL
){
if
(
valueType
==
KK_TSL_DATA_TYPE_TEXT
){
if
(
valueType
==
KK_TSL_DATA_TYPE_TEXT
){
cJSON_AddStringToObject
(
subObj
,
propertiesbuf
[
1
],
valueStr
);
cJSON_AddStringToObject
(
subObj
,
propertiesbuf
[
1
],
valueStr
);
...
@@ -467,7 +466,7 @@ static int kk_get_properties_info_obj(char *deviceCode)
...
@@ -467,7 +466,7 @@ static int kk_get_properties_info_obj(char *deviceCode)
//printf("---------------------------------------->pFinal:%s,num:%d\n",pFinal,epNumInt);
//printf("---------------------------------------->pFinal:%s,num:%d\n",pFinal,epNumInt);
}
}
else
{
else
{
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
//
printf("[%s][%d]\n",__FUNCTION__,__LINE__);
if
(
valueType
==
KK_TSL_DATA_TYPE_TEXT
){
if
(
valueType
==
KK_TSL_DATA_TYPE_TEXT
){
cJSON_AddStringToObject
(
obj
,
propertyStr
,
valueStr
);
cJSON_AddStringToObject
(
obj
,
propertyStr
,
valueStr
);
}
else
if
(
valueType
==
KK_TSL_DATA_TYPE_INT
||
}
else
if
(
valueType
==
KK_TSL_DATA_TYPE_INT
||
...
...
midware/midware/scene/kk_scene_handle.c
View file @
750d9a30
...
@@ -206,7 +206,11 @@ void *kk_scene_yield(void *args)
...
@@ -206,7 +206,11 @@ void *kk_scene_yield(void *args)
INFO_PRINT
(
"[%s][%d] actionDelayInfo->starttime:%ld
\n
"
,
__FUNCTION__
,
__LINE__
,
actionDelayInfo
->
starttime
);
INFO_PRINT
(
"[%s][%d] actionDelayInfo->starttime:%ld
\n
"
,
__FUNCTION__
,
__LINE__
,
actionDelayInfo
->
starttime
);
if
(
current_time
>=
actionDelayInfo
->
starttime
){
if
(
current_time
>=
actionDelayInfo
->
starttime
){
INFO_PRINT
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
INFO_PRINT
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
kk_scene_send_action_msg
(
actionDelayInfo
->
action
);
if
(
strcmp
(
actionDelayInfo
->
action
->
propertyName
,
"ArmingState"
)
==
0
){
kk_service_arming_set
(
actionDelayInfo
->
action
->
propertyValue
);
}
else
{
kk_scene_send_action_msg
(
actionDelayInfo
->
action
);
}
if
(
actionDelayInfo
==
p_delay_action_list
){
if
(
actionDelayInfo
==
p_delay_action_list
){
pTemp
=
p_delay_action_list
;
pTemp
=
p_delay_action_list
;
p_delay_action_list
=
p_delay_action_list
->
next
;
p_delay_action_list
=
p_delay_action_list
->
next
;
...
@@ -897,8 +901,9 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
...
@@ -897,8 +901,9 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
cJSON
*
productType
;
cJSON
*
productType
;
cJSON
*
deviceCode
;
cJSON
*
deviceCode
;
cJSON
*
epNum
;
cJSON
*
epNum
;
int
ArmingStateFlag
=
0
;
int
iepnum
;
int
iepnum
;
char
propertyValueStr
[
64
]
=
{
0
};
char
propertyValueStr
[
255
]
=
{
0
};
printf
(
"----->kk_scene_parse_scene_action
\r\n
"
);
printf
(
"----->kk_scene_parse_scene_action
\r\n
"
);
...
@@ -948,6 +953,15 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
...
@@ -948,6 +953,15 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
propertyValue
->
valuestring
,
type
->
valuestring
,
idelay
);
propertyValue
->
valuestring
,
type
->
valuestring
,
idelay
);
}
}
else
{
else
{
memset
(
propertyValueStr
,
0x0
,
sizeof
(
propertyValueStr
));
if
(
propertyValue
->
type
==
cJSON_Number
){
snprintf
(
propertyValueStr
,
sizeof
(
propertyValueStr
),
"%d"
,
propertyValue
->
valueint
);
}
else
{
memcpy
(
propertyValueStr
,
propertyValue
->
valuestring
,
strlen
(
propertyValue
->
valuestring
));
}
if
(
strcmp
(
propertyName
->
valuestring
,
"ArmingState"
)
==
0
){
ArmingStateFlag
=
1
;
}
deviceCode
=
cJSON_GetObjectItem
(
item
,
MSG_DEVICE_CODE_STR
);
deviceCode
=
cJSON_GetObjectItem
(
item
,
MSG_DEVICE_CODE_STR
);
if
(
deviceCode
==
NULL
)
return
FAIL_RETURN
;
if
(
deviceCode
==
NULL
)
return
FAIL_RETURN
;
epNum
=
cJSON_GetObjectItem
(
item
,
MSG_SCENE_EPNUM
);
epNum
=
cJSON_GetObjectItem
(
item
,
MSG_SCENE_EPNUM
);
...
@@ -970,23 +984,13 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
...
@@ -970,23 +984,13 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
continue
;
continue
;
}
}
if
(
kk_subDev_check_scene_support
(
node
->
fatherDeviceCode
)
==
1
){
if
(
kk_subDev_check_scene_support
(
node
->
fatherDeviceCode
)
==
1
&&
ArmingStateFlag
==
0
){
kk_scene_action_detail_t
info
=
{
0
};
kk_scene_action_detail_t
info
=
{
0
};
memcpy
(
info
.
deviceCode
,
node
->
deviceCode
,
strlen
(
node
->
deviceCode
));
memcpy
(
info
.
deviceCode
,
node
->
deviceCode
,
strlen
(
node
->
deviceCode
));
memcpy
(
info
.
propertyValue
,
propertyValueStr
,
strlen
(
propertyValueStr
));
memcpy
(
info
.
propertyName
,
propertyName
->
valuestring
,
strlen
(
propertyName
->
valuestring
));
memcpy
(
info
.
propertyName
,
propertyName
->
valuestring
,
strlen
(
propertyName
->
valuestring
));
if
(
propertyValue
->
type
==
cJSON_Number
){
snprintf
(
propertyValueStr
,
64
,
"%d"
,
propertyValue
->
valueint
);
memcpy
(
info
.
propertyValue
,
propertyValueStr
,
strlen
(
propertyValueStr
));
}
else
{
memcpy
(
info
.
propertyValue
,
propertyValue
->
valuestring
,
strlen
(
propertyValue
->
valuestring
));
}
info
.
epNum
=
iepnum
;
info
.
epNum
=
iepnum
;
info
.
delay
=
idelay
;
info
.
delay
=
idelay
;
...
@@ -1006,7 +1010,8 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
...
@@ -1006,7 +1010,8 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
}
}
item
=
item
->
next
;
item
=
item
->
next
;
}
}
if
(
propertySetType
){
//场景设置布防不需要下发到网关
if
(
propertySetType
&&
ArmingStateFlag
==
0
){
kk_scene_action_info_send
(
isUpdate
);
kk_scene_action_info_send
(
isUpdate
);
}
}
return
SUCCESS_RETURN
;
return
SUCCESS_RETURN
;
...
@@ -1749,7 +1754,11 @@ static int kk_scene_start_action(const char *deviceCode,const char *propertyName
...
@@ -1749,7 +1754,11 @@ static int kk_scene_start_action(const char *deviceCode,const char *propertyName
memcpy
(
actionInfo
->
propertyName
,
propertyName
,
strlen
(
propertyName
));
memcpy
(
actionInfo
->
propertyName
,
propertyName
,
strlen
(
propertyName
));
memcpy
(
actionInfo
->
propertyValue
,
valueS
,
strlen
(
valueS
));
memcpy
(
actionInfo
->
propertyValue
,
valueS
,
strlen
(
valueS
));
if
(
delay
==
0
){
if
(
delay
==
0
){
kk_scene_send_action_msg
(
actionInfo
);
if
(
strcmp
(
propertyName
,
"ArmingState"
)
==
0
){
kk_service_arming_set
(
valueS
);
}
else
{
kk_scene_send_action_msg
(
actionInfo
);
}
}
else
{
}
else
{
INFO_PRINT
(
"[%s][%d]delay:%d
\n
"
,
__FUNCTION__
,
__LINE__
,
delay
);
INFO_PRINT
(
"[%s][%d]delay:%d
\n
"
,
__FUNCTION__
,
__LINE__
,
delay
);
kk_scene_push_action_list
(
actionInfo
,
delay
);
kk_scene_push_action_list
(
actionInfo
,
delay
);
...
...
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