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
3be6986c
Commit
3be6986c
authored
Sep 27, 2021
by
尹佳钦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、场景动作所有类型触发,根据房间触发执行
2、人体红外场景支持无人几分钟触发场景 3、离线语音面板场景bug修复
parent
e872556d
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
287 additions
and
51 deletions
+287
-51
application/klansdk/kk_data_handle.c
application/klansdk/kk_data_handle.c
+3
-0
application/klansdk/kk_voice_panel_cfg.c
application/klansdk/kk_voice_panel_cfg.c
+2
-2
application/klansdk/kk_voice_panel_handle.c
application/klansdk/kk_voice_panel_handle.c
+21
-6
application/klansdk/kk_voice_panel_handle.h
application/klansdk/kk_voice_panel_handle.h
+1
-0
midware/midware/area/kk_area_handle.c
midware/midware/area/kk_area_handle.c
+1
-0
midware/midware/area/kk_area_handle.h
midware/midware/area/kk_area_handle.h
+0
-1
midware/midware/dm/dm_fota.c
midware/midware/dm/dm_fota.c
+3
-3
midware/midware/dm/dm_ota.c
midware/midware/dm/dm_ota.c
+3
-2
midware/midware/dm/kk_dm_mng.c
midware/midware/dm/kk_dm_mng.c
+1
-1
midware/midware/dm/kk_linkkit.c
midware/midware/dm/kk_linkkit.c
+4
-4
midware/midware/dm/kk_sub_db.c
midware/midware/dm/kk_sub_db.c
+49
-29
midware/midware/midware.c
midware/midware/midware.c
+16
-1
midware/midware/scene/kk_scene_handle.c
midware/midware/scene/kk_scene_handle.c
+183
-2
No files found.
application/klansdk/kk_data_handle.c
View file @
3be6986c
...
@@ -825,6 +825,9 @@ void KK_Data_FromMid(void* str,int len)
...
@@ -825,6 +825,9 @@ void KK_Data_FromMid(void* str,int len)
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/event/addSceneNotification/post"
)
!=
NULL
){
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/event/addSceneNotification/post"
)
!=
NULL
){
INFO_PRINT
(
"addSceneNotification handle!!!"
);
INFO_PRINT
(
"addSceneNotification handle!!!"
);
kk_lan_scene_handle
(
payload
,
1
);
kk_lan_scene_handle
(
payload
,
1
);
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/event/updateSceneNotification/post"
)
!=
NULL
){
INFO_PRINT
(
"updateSceneNotification handle!!!"
);
kk_lan_scene_handle
(
payload
,
1
);
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/event/deleteSceneNotification/post"
)
!=
NULL
){
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/event/deleteSceneNotification/post"
)
!=
NULL
){
INFO_PRINT
(
"deleteSceneNotification handle!!!"
);
INFO_PRINT
(
"deleteSceneNotification handle!!!"
);
kk_lan_scene_handle
(
payload
,
0
);
kk_lan_scene_handle
(
payload
,
0
);
...
...
application/klansdk/kk_voice_panel_cfg.c
View file @
3be6986c
...
@@ -167,7 +167,7 @@ static _OUT cJSON *kk_vp_sync_scences(_IN cJSON *data)
...
@@ -167,7 +167,7 @@ static _OUT cJSON *kk_vp_sync_scences(_IN cJSON *data)
VP_SCENE_ITEM
*
pSceneList
=
NULL
;
VP_SCENE_ITEM
*
pSceneList
=
NULL
;
VP_SCENE_ITEM
*
pScene
=
NULL
;
VP_SCENE_ITEM
*
pScene
=
NULL
;
//
if
((
scenes
=
cJSON_GetObjectItem
(
data
,
SCENES_STR
))
==
NULL
||
if
((
scenes
=
cJSON_GetObjectItem
(
data
,
SCENES_STR
))
==
NULL
||
scenes
->
type
!=
cJSON_Array
){
scenes
->
type
!=
cJSON_Array
){
////printf("[%s][%d]\n",__FUNCTION__,__LINE__);
////printf("[%s][%d]\n",__FUNCTION__,__LINE__);
...
@@ -208,7 +208,7 @@ static _OUT cJSON *kk_vp_sync_scences(_IN cJSON *data)
...
@@ -208,7 +208,7 @@ static _OUT cJSON *kk_vp_sync_scences(_IN cJSON *data)
snprintf
(
pScene
->
id
,
sizeof
(
pScene
->
id
)
-
1
,
"%d"
,
map_id
);
snprintf
(
pScene
->
id
,
sizeof
(
pScene
->
id
)
-
1
,
"%d"
,
map_id
);
snprintf
(
pScene
->
type
,
sizeof
(
pScene
->
type
)
-
1
,
"%d"
,
sceneType
->
valueint
);
snprintf
(
pScene
->
type
,
sizeof
(
pScene
->
type
)
-
1
,
"%d"
,
sceneType
->
valueint
);
snprintf
(
pScene
->
name
,
sizeof
(
pScene
->
name
)
-
1
,
"%s"
,
sceneName
->
valuestring
);
snprintf
(
pScene
->
name
,
sizeof
(
pScene
->
name
)
-
1
,
"%s"
,
sceneName
->
valuestring
);
//printf("[%s][%d]\n",__FUNCTION__,__LINE__
);
debug_log
(
LOG_NOTICE_LEVEL
,
"[%d]map_id=%d.
\n
"
,
i
,
map_id
);
}
}
}
}
vp_scene_id_map_save
();
vp_scene_id_map_save
();
...
...
application/klansdk/kk_voice_panel_handle.c
View file @
3be6986c
...
@@ -168,6 +168,8 @@ void vp_scene_id_map_deinit(void)
...
@@ -168,6 +168,8 @@ void vp_scene_id_map_deinit(void)
VP_SCENE_MAP
*
pNext
=
NULL
;
VP_SCENE_MAP
*
pNext
=
NULL
;
VP_SCENE_MAP
*
pScene
=
vp_scene_map
;
VP_SCENE_MAP
*
pScene
=
vp_scene_map
;
debug_log
(
LOG_NOTICE_LEVEL
,
"vp_scene_id_map_deinit.
\n
"
);
while
(
pScene
!=
NULL
){
while
(
pScene
!=
NULL
){
pNext
=
pScene
->
next
;
pNext
=
pScene
->
next
;
if
(
pScene
!=
NULL
){
if
(
pScene
!=
NULL
){
...
@@ -183,7 +185,7 @@ void vp_scene_id_map_deinit(void)
...
@@ -183,7 +185,7 @@ void vp_scene_id_map_deinit(void)
int
vp_scene_id_item_add
(
int
scene_id
)
int
vp_scene_id_item_add
(
int
scene_id
)
{
{
VP_SCENE_MAP
*
ptr
=
NULL
;
VP_SCENE_MAP
*
ptr
=
NULL
,
*
pre
=
NULL
;
VP_SCENE_MAP
*
pScene
=
NULL
;
VP_SCENE_MAP
*
pScene
=
NULL
;
pScene
=
malloc
(
sizeof
(
VP_SCENE_MAP
));
pScene
=
malloc
(
sizeof
(
VP_SCENE_MAP
));
...
@@ -197,7 +199,13 @@ int vp_scene_id_item_add(int scene_id)
...
@@ -197,7 +199,13 @@ int vp_scene_id_item_add(int scene_id)
if
(
vp_scene_map
==
NULL
){
if
(
vp_scene_map
==
NULL
){
vp_scene_map
=
pScene
;
vp_scene_map
=
pScene
;
}
else
{
}
else
{
vp_scene_map
->
next
=
pScene
;
ptr
=
vp_scene_map
;
while
(
ptr
){
pre
=
ptr
;
ptr
=
ptr
->
next
;
}
ptr
=
pre
;
ptr
->
next
=
pScene
;
}
}
return
pScene
->
map_id
;
return
pScene
->
map_id
;
...
@@ -205,9 +213,9 @@ int vp_scene_id_item_add(int scene_id)
...
@@ -205,9 +213,9 @@ int vp_scene_id_item_add(int scene_id)
int
vp_scene_id_item_load
(
int
scene_id
,
uint16_t
map_id
)
int
vp_scene_id_item_load
(
int
scene_id
,
uint16_t
map_id
)
{
{
VP_SCENE_MAP
*
ptr
=
NULL
;
VP_SCENE_MAP
*
ptr
=
NULL
,
*
pre
=
NULL
;
VP_SCENE_MAP
*
pScene
=
NULL
;
VP_SCENE_MAP
*
pScene
=
NULL
;
pScene
=
malloc
(
sizeof
(
VP_SCENE_MAP
));
pScene
=
malloc
(
sizeof
(
VP_SCENE_MAP
));
memset
(
pScene
,
0
,
sizeof
(
VP_SCENE_MAP
));
memset
(
pScene
,
0
,
sizeof
(
VP_SCENE_MAP
));
...
@@ -217,11 +225,18 @@ int vp_scene_id_item_load(int scene_id,uint16_t map_id)
...
@@ -217,11 +225,18 @@ int vp_scene_id_item_load(int scene_id,uint16_t map_id)
debug_log
(
LOG_DEBUG_LEVEL
,
"[vp scene map load]%d->%d
\n
"
,
pScene
->
raw_id
,
pScene
->
map_id
);
debug_log
(
LOG_DEBUG_LEVEL
,
"[vp scene map load]%d->%d
\n
"
,
pScene
->
raw_id
,
pScene
->
map_id
);
if
(
vp_scene_map
==
NULL
){
if
(
vp_scene_map
==
NULL
){
vp_scene_map
=
pScene
;
vp_scene_map
=
pScene
;
}
else
{
}
else
{
vp_scene_map
->
next
=
pScene
;
ptr
=
vp_scene_map
;
while
(
ptr
){
pre
=
ptr
;
ptr
=
ptr
->
next
;
}
ptr
=
pre
;
ptr
->
next
=
pScene
;
}
}
return
pScene
->
map_id
;
return
pScene
->
map_id
;
...
@@ -230,7 +245,7 @@ int vp_scene_id_item_load(int scene_id,uint16_t map_id)
...
@@ -230,7 +245,7 @@ int vp_scene_id_item_load(int scene_id,uint16_t map_id)
#define VP_SCENE_ID_STRING "scene_id"
#define VP_SCENE_ID_STRING "scene_id"
#define VP_SCENE_ID_RAW_STRING "CCU"
#define VP_SCENE_ID_RAW_STRING "CCU"
#define VP_SCENE_ID_MAP_STRING "VP"
#define VP_SCENE_ID_MAP_STRING "VP"
#define VP_SCENE_ID_FILE "scene_id_map.json"
cJSON
*
vp_scene_id_map_file_build
(
void
)
cJSON
*
vp_scene_id_map_file_build
(
void
)
{
{
...
...
application/klansdk/kk_voice_panel_handle.h
View file @
3be6986c
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#define VP_CONFIG_FILE_MD5 "/data/kk/voice_data.MD5"
#define VP_CONFIG_FILE_MD5 "/data/kk/voice_data.MD5"
#define VP_CONFIG_FILE_TAR_GZ "/data/kk/voice_data.tar.gz"
#define VP_CONFIG_FILE_TAR_GZ "/data/kk/voice_data.tar.gz"
#define VP_OTA_FILE_BZIP "/data/kk/kk_voice.bzip"
#define VP_OTA_FILE_BZIP "/data/kk/kk_voice.bzip"
#define VP_SCENE_ID_FILE "/data/kk/scene_id_map.json"
...
...
midware/midware/area/kk_area_handle.c
View file @
3be6986c
...
@@ -534,6 +534,7 @@ cJSON *kk_get_roomIds_ary(void)
...
@@ -534,6 +534,7 @@ cJSON *kk_get_roomIds_ary(void)
kk_dev_list_t
*
kk_get_room_deviceCode
(
const
char
*
roomId
)
kk_dev_list_t
*
kk_get_room_deviceCode
(
const
char
*
roomId
)
{
{
sqlite3_stmt
*
stmt
;
sqlite3_stmt
*
stmt
;
...
...
midware/midware/area/kk_area_handle.h
View file @
3be6986c
...
@@ -36,6 +36,5 @@ int kk_get_room_armingstate(const char* roomId);
...
@@ -36,6 +36,5 @@ int kk_get_room_armingstate(const char* roomId);
int
kk_get_roomId_by_deviceCode
(
const
char
*
deviceCode
,
const
char
*
epNum
,
char
*
roomId
,
int
size
);
int
kk_get_roomId_by_deviceCode
(
const
char
*
deviceCode
,
const
char
*
epNum
,
char
*
roomId
,
int
size
);
int
kk_get_device_roomInfo
(
const
char
*
deviceCode
,
int
epNum
,
char
*
roomName
,
char
*
roomId
);
int
kk_get_device_roomInfo
(
const
char
*
deviceCode
,
int
epNum
,
char
*
roomName
,
char
*
roomId
);
int
kk_room_reset_armingstate
(
void
);
int
kk_room_reset_armingstate
(
void
);
cJSON
*
kk_get_roomIds_ary
(
void
);
#endif
#endif
midware/midware/dm/dm_fota.c
View file @
3be6986c
...
@@ -29,11 +29,11 @@ int dm_fota_init(void)
...
@@ -29,11 +29,11 @@ int dm_fota_init(void)
int
dm_fota_deinit
(
void
)
int
dm_fota_deinit
(
void
)
{
{
dm_fota_ctx_t
*
ctx
=
_dm_fota_get_ctx
();
dm_fota_ctx_t
*
ctx
=
_dm_fota_get_ctx
();
memset
(
ctx
,
0
,
sizeof
(
dm_fota_ctx_t
));
memset
(
ctx
,
0
,
sizeof
(
dm_fota_ctx_t
));
return
SUCCESS_RETURN
;
return
SUCCESS_RETURN
;
}
}
static
int
_dm_fota_send_new_config_to_user
(
void
*
ota_handle
)
static
int
_dm_fota_send_new_config_to_user
(
void
*
ota_handle
)
...
...
midware/midware/dm/dm_ota.c
View file @
3be6986c
...
@@ -194,7 +194,7 @@ int kk_publishProgress(int process,int state)
...
@@ -194,7 +194,7 @@ int kk_publishProgress(int process,int state)
cJSON_AddStringToObject
(
info
,
MSG_DEVICE_CODE_STR
,
ccuID
);
cJSON_AddStringToObject
(
info
,
MSG_DEVICE_CODE_STR
,
ccuID
);
cJSON_AddStringToObject
(
info
,
MSG_PRODUCT_CODE_STR
,
productCode
);
cJSON_AddStringToObject
(
info
,
MSG_PRODUCT_CODE_STR
,
productCode
);
char
*
infff
=
cJSON_Print
(
info
);
char
*
infff
=
cJSON_Print
(
info
);
printf
(
"kk_publishProgress,process=%d,state=%d
\n
"
,
process
,
state
);
cJSON
*
payload
=
cJSON_CreateObject
();
cJSON
*
payload
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
payload
,
"desc"
,
"success"
);
cJSON_AddStringToObject
(
payload
,
"desc"
,
"success"
);
cJSON_AddStringToObject
(
payload
,
"version"
,
"1.0"
);
cJSON_AddStringToObject
(
payload
,
"version"
,
"1.0"
);
...
@@ -224,11 +224,12 @@ int progress_callback(void *clientp, double dltotal, double dlnow, double ultota
...
@@ -224,11 +224,12 @@ int progress_callback(void *clientp, double dltotal, double dlnow, double ultota
{
{
#if 1
#if 1
char
processBuf
[
12
]
=
{
0
};
char
processBuf
[
12
]
=
{
0
};
//
printf("progress_callback clientp:%s,dltotal:%g,dlnow:%g,ultotal:%g,ulnow:%g\n",clientp,dltotal,dlnow,ultotal,ulnow);
printf
(
"progress_callback clientp:%s,dltotal:%g,dlnow:%g,ultotal:%g,ulnow:%g
\n
"
,
clientp
,
dltotal
,
dlnow
,
ultotal
,
ulnow
);
if
(
dlnow
>
0
){
if
(
dlnow
>
0
){
int
process
=
(
int
)
dlnow
*
100
.
0
/
dltotal
;
int
process
=
(
int
)
dlnow
*
100
.
0
/
dltotal
;
if
(
process
%
10
==
0
){
if
(
process
%
10
==
0
){
//sprintf(processBuf,"%d",process);
//sprintf(processBuf,"%d",process);
printf
(
"progress_callback ,process:%d
\n
"
,
process
);
INFO_PRINT
(
"progress_callback ,process:%d
\n
"
,
process
);
INFO_PRINT
(
"progress_callback ,process:%d
\n
"
,
process
);
kk_publishProgress
(
process
,
OTA_STATE_DOWNLOAD_ING
);
kk_publishProgress
(
process
,
OTA_STATE_DOWNLOAD_ING
);
//lua_event_notify((char*)"ota_process",(char*)"process", processBuf);
//lua_event_notify((char*)"ota_process",(char*)"process", processBuf);
...
...
midware/midware/dm/kk_dm_mng.c
View file @
3be6986c
...
@@ -1078,7 +1078,7 @@ int dm_mgr_upstream_thing_topo_add(_IN_ int devid)
...
@@ -1078,7 +1078,7 @@ int dm_mgr_upstream_thing_topo_add(_IN_ int devid)
return
INVALID_PARAMETER
;
return
INVALID_PARAMETER
;
}
}
res
=
dm_mgr_search_dev_by_devid
(
devid
,
&
node
);
res
=
dm_mgr_search_dev_by_devid
(
devid
,
&
node
);
if
(
res
!=
SUCCESS_RETURN
)
{
if
(
res
!=
SUCCESS_RETURN
)
{
ERROR_PRINT
(
"ERROR res:%d
\n
"
,
res
);
ERROR_PRINT
(
"ERROR res:%d
\n
"
,
res
);
...
...
midware/midware/dm/kk_linkkit.c
View file @
3be6986c
...
@@ -1920,10 +1920,10 @@ int kk_mid_subdev_add(int devType, char productCode[PRODUCT_CODE_MAXLEN], char d
...
@@ -1920,10 +1920,10 @@ int kk_mid_subdev_add(int devType, char productCode[PRODUCT_CODE_MAXLEN], char d
if
(
TSL_ALREADY_EXIST
==
res
){
if
(
TSL_ALREADY_EXIST
==
res
){
//todo
//todo
}
else
{
}
else
{
res
=
kk_subDev_insert_db
(
devType
,
productCode
,
deviceCode
,
fatherDeviceCode
,
mac
,
"1.1.0"
,
heartbeat
);
res
=
kk_subDev_insert_db
(
devType
,
productCode
,
deviceCode
,
fatherDeviceCode
,
mac
,
"1.1.0"
,
heartbeat
);
if
(
res
!=
SUCCESS_RETURN
)
{
if
(
res
!=
SUCCESS_RETURN
)
{
return
FAIL_RETURN
;
return
FAIL_RETURN
;
}
}
res
=
dm_mgr_get_device_by_devicecode
(
deviceCode
,
&
node
);
res
=
dm_mgr_get_device_by_devicecode
(
deviceCode
,
&
node
);
if
(
res
!=
SUCCESS_RETURN
)
{
if
(
res
!=
SUCCESS_RETURN
)
{
return
FAIL_RETURN
;
return
FAIL_RETURN
;
...
...
midware/midware/dm/kk_sub_db.c
View file @
3be6986c
...
@@ -401,9 +401,11 @@ int kk_subDev_check_auth(int devType)
...
@@ -401,9 +401,11 @@ int kk_subDev_check_auth(int devType)
char
*
zErrMsg
=
0
;
char
*
zErrMsg
=
0
;
const
char
*
searchCmd
=
"select * from SubDeviceInfo WHERE devType = '%d';"
;
const
char
*
searchCmd
=
"select * from SubDeviceInfo WHERE devType = '%d';"
;
kk_subDb_ctx_t
*
ctx
=
_kk_subDb_get_ctx
();
kk_subDb_ctx_t
*
ctx
=
_kk_subDb_get_ctx
();
printf
(
"------------------------------------------------------->111
\n
"
);
sqlCmd
=
sqlite3_mprintf
(
searchCmd
,
devType
);
sqlCmd
=
sqlite3_mprintf
(
searchCmd
,
devType
);
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
){
printf
(
"------------------------------------------------------->222
\n
"
);
char
*
pDeviceCode
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_SUB_DEVICECODE
);
char
*
pDeviceCode
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_SUB_DEVICECODE
);
char
*
pProductCode
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_SUB_PRODUCTCODE
);
char
*
pProductCode
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_SUB_PRODUCTCODE
);
kk_msg_cloud_status_notify
(
pDeviceCode
,
pProductCode
);
kk_msg_cloud_status_notify
(
pDeviceCode
,
pProductCode
);
...
@@ -650,7 +652,7 @@ static int _kk_indoor_air_handle(char* deviceCode, char *sceneId, char *property
...
@@ -650,7 +652,7 @@ static int _kk_indoor_air_handle(char* deviceCode, char *sceneId, char *property
}
}
return
0
;
return
0
;
}
}
int
kk_subDev_set_action_by_productType
(
c
har
*
productType
,
char
*
sceneId
,
char
*
propertyName
,
char
*
propertyValue
,
char
*
type
,
int
delay
)
int
kk_subDev_set_action_by_productType
(
c
onst
char
*
productType
,
const
char
*
roomId
,
const
char
*
sceneId
,
const
char
*
propertyName
,
const
char
*
propertyValue
,
const
char
*
type
,
int
delay
)
{
{
int
res
=
0
;
int
res
=
0
;
sqlite3_stmt
*
stmt
;
sqlite3_stmt
*
stmt
;
...
@@ -659,13 +661,15 @@ int kk_subDev_set_action_by_productType(char *productType,char *sceneId,char *pr
...
@@ -659,13 +661,15 @@ int kk_subDev_set_action_by_productType(char *productType,char *sceneId,char *pr
dm_mgr_dev_node_t
*
node
=
NULL
;
dm_mgr_dev_node_t
*
node
=
NULL
;
kk_subDb_ctx_t
*
ctx
=
_kk_subDb_get_ctx
();
kk_subDb_ctx_t
*
ctx
=
_kk_subDb_get_ctx
();
const
char
*
searchCmd
=
"select * from SubDeviceInfo WHERE productType= '%s'"
;
const
char
*
searchCmd
=
"select * from SubDeviceInfo WHERE productType= '%s'"
;
int
idx
=
0
;
int
idx
=
0
;
//
int gw_support_scene = 0;
int
gw_support_scene
=
0
;
kk_tsl_data_t
*
property
=
NULL
;
kk_tsl_data_t
*
property
=
NULL
;
int
k
=
0
,
count
=
0
;
int
k
=
0
,
count
=
0
;
char
typeArray
[
10
][
32
]
=
{
0
};
char
typeArray
[
10
][
32
]
=
{
0
};
int
size
=
0
;
int
size
=
0
;
char
*
pStart
=
NULL
;
char
*
pStart
=
NULL
;
int
allRoom
=
(
strcmp
(
roomId
,
"-1"
)
==
0
)
?
1
:
0
;
if
(
productType
==
NULL
){
if
(
productType
==
NULL
){
ERROR_PRINT
(
"ERROR [%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
ERROR_PRINT
(
"ERROR [%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
...
@@ -691,11 +695,11 @@ int kk_subDev_set_action_by_productType(char *productType,char *sceneId,char *pr
...
@@ -691,11 +695,11 @@ int kk_subDev_set_action_by_productType(char *productType,char *sceneId,char *pr
sqlite3_prepare_v2
(
ctx
->
pDb
,
sqlCmd
,
strlen
(
sqlCmd
),
&
stmt
,
NULL
);
sqlite3_prepare_v2
(
ctx
->
pDb
,
sqlCmd
,
strlen
(
sqlCmd
),
&
stmt
,
NULL
);
//INFO_PRINT("total_column = %d\n", sqlite3_column_count(stmt));
//INFO_PRINT("total_column = %d\n", sqlite3_column_count(stmt));
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
pDeviceCode
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_SUB_DEVICECODE
);
pDeviceCode
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_SUB_DEVICECODE
);
res
=
dm_mgr_get_device_by_devicecode
(
pDeviceCode
,
&
node
);
res
=
dm_mgr_get_device_by_devicecode
(
pDeviceCode
,
&
node
);
if
(
res
!=
SUCCESS_RETURN
)
{
if
(
res
!=
SUCCESS_RETURN
)
{
continue
;
continue
;
}
}
if
(
strcmp
(
typeArray
[
k
],
"air conditioning gateway"
)
==
0
){
if
(
strcmp
(
typeArray
[
k
],
"air conditioning gateway"
)
==
0
){
_kk_indoor_air_handle
(
pDeviceCode
,
sceneId
,
propertyName
,
propertyValue
,
type
,
delay
,
node
->
fatherDeviceCode
);
_kk_indoor_air_handle
(
pDeviceCode
,
sceneId
,
propertyName
,
propertyValue
,
type
,
delay
,
node
->
fatherDeviceCode
);
continue
;
continue
;
...
@@ -707,18 +711,33 @@ int kk_subDev_set_action_by_productType(char *productType,char *sceneId,char *pr
...
@@ -707,18 +711,33 @@ int kk_subDev_set_action_by_productType(char *productType,char *sceneId,char *pr
}
}
char
*
ptr
=
strstr
(
property
->
identifier
,
propertyName
);
char
*
ptr
=
strstr
(
property
->
identifier
,
propertyName
);
if
(
ptr
!=
NULL
&&
(
ptr
-
property
->
identifier
==
0
)
){
if
(
ptr
!=
NULL
&&
(
ptr
-
property
->
identifier
==
0
)
){
kk_scene_action_detail_t
info
=
{
0
};
if
(
gw_support_scene
){
memcpy
(
info
.
deviceCode
,
node
->
deviceCode
,
strlen
(
node
->
deviceCode
));
kk_scene_action_detail_t
info
=
{
0
};
memcpy
(
info
.
propertyName
,
property
->
identifier
,
strlen
(
property
->
identifier
));
memcpy
(
info
.
deviceCode
,
node
->
deviceCode
,
strlen
(
node
->
deviceCode
));
memcpy
(
info
.
propertyValue
,
propertyValue
,
strlen
(
propertyValue
));
memcpy
(
info
.
propertyName
,
property
->
identifier
,
strlen
(
property
->
identifier
));
//printf("------------------->property->identifier:%s\n",property->identifier);
memcpy
(
info
.
propertyValue
,
propertyValue
,
strlen
(
propertyValue
));
pStart
=
strstr
(
property
->
identifier
,
"_"
);
//printf("------------------->property->identifier:%s\n",property->identifier);
if
(
pStart
!=
NULL
){
pStart
=
strstr
(
property
->
identifier
,
"_"
);
//printf("------------------->num:%s\n",pStart+1);
if
(
pStart
!=
NULL
){
info
.
epNum
=
atoi
(
pStart
+
1
);
//printf("------------------->num:%s\n",pStart+1);
}
else
{
info
.
epNum
=
atoi
(
pStart
+
1
);
info
.
epNum
=
1
;
}
else
{
}
info
.
epNum
=
1
;
}
if
(
allRoom
==
0
){
char
roomName
[
256
]
=
{
0
};
char
roomIdStr
[
10
]
=
{
0
};
if
(
kk_get_device_roomInfo
(
pDeviceCode
,
info
.
epNum
,
roomName
,
roomIdStr
)
==
0
){
continue
;
}
if
(
strcmp
(
roomIdStr
,
roomId
)
!=
0
){
continue
;
}
}
if
(
strcmp
(
node
->
productCode
,
"3098"
)
==
0
&&
info
.
epNum
!=
1
){
//风机盘管多合一只处理第一路
if
(
strcmp
(
node
->
productCode
,
"3098"
)
==
0
&&
info
.
epNum
!=
1
){
//风机盘管多合一只处理第一路
continue
;
continue
;
}
}
...
@@ -728,16 +747,17 @@ int kk_subDev_set_action_by_productType(char *productType,char *sceneId,char *pr
...
@@ -728,16 +747,17 @@ int kk_subDev_set_action_by_productType(char *productType,char *sceneId,char *pr
else
if
(
strcmp
(
node
->
productCode
,
"3099"
)
==
0
&&
info
.
epNum
!=
3
){
//新风多合一只处理第三路
else
if
(
strcmp
(
node
->
productCode
,
"3099"
)
==
0
&&
info
.
epNum
!=
3
){
//新风多合一只处理第三路
continue
;
continue
;
}
}
info
.
delay
=
delay
;
kk_scene_action_add
(
node
->
fatherDeviceCode
,
sceneId
,
info
);
info
.
delay
=
delay
;
res
=
kk_scene_insert_scene_action
(
type
,
node
->
deviceCode
,
info
.
epNum
,
kk_scene_action_add
(
node
->
fatherDeviceCode
,
sceneId
,
info
);
property
->
identifier
,
propertyValue
,
info
.
delay
,
sceneId
,
node
->
fatherDeviceCode
);
res
=
kk_scene_insert_scene_action
(
type
,
node
->
deviceCode
,
info
.
epNum
,
if
(
res
!=
SUCCESS_RETURN
){
property
->
identifier
,
propertyValue
,
info
.
delay
,
sceneId
,
node
->
fatherDeviceCode
);
INFO_PRINT
(
"kk_subDev_set_action_by_productType fail!!!
\n
"
);
if
(
res
!=
SUCCESS_RETURN
){
//return res;
INFO_PRINT
(
"kk_subDev_set_action_by_productType fail!!!
\n
"
);
continue
;
//return res;
}
continue
;
}
}
}
}
}
}
...
...
midware/midware/midware.c
View file @
3be6986c
...
@@ -871,9 +871,17 @@ void kk_platMsg_handle(void* data, char* chalMark){
...
@@ -871,9 +871,17 @@ void kk_platMsg_handle(void* data, char* chalMark){
kk_history_insert_Outlet_info
(
info_dcode
->
valuestring
,
buf
,
""
,
HAL_GetTime
());
kk_history_insert_Outlet_info
(
info_dcode
->
valuestring
,
buf
,
""
,
HAL_GetTime
());
}
}
}
}
kk_tsl_property_set_by_shadow
(
search_node
->
dev_shadow
,
outstr
,
strlen
(
outstr
)
+
1
);
kk_tsl_property_set_by_shadow
(
search_node
->
dev_shadow
,
outstr
,
strlen
(
outstr
)
+
1
);
dm_msg_thing_property_post_by_identify
(
info_dcode
->
valuestring
,
jsonPay
);
dm_msg_thing_property_post_by_identify
(
info_dcode
->
valuestring
,
jsonPay
);
kk_scene_iftt_check
(
info_dcode
->
valuestring
,
jsonPay
);
proCode
=
cJSON_GetObjectItem
(
info
,
MSG_PRODUCT_CODE_STR
);
if
(
strcmp
(
proCode
->
valuestring
,
"3053"
)
&&
strcmp
(
proCode
->
valuestring
,
"3042"
)){
kk_scene_iftt_check
(
info_dcode
->
valuestring
,
jsonPay
);
}
free
(
outstr
);
free
(
outstr
);
}
}
}
else
if
(
strstr
(
msgType
->
valuestring
,
KK_THING_TOPO_DELETE_MSG
)
!=
NULL
){
}
else
if
(
strstr
(
msgType
->
valuestring
,
KK_THING_TOPO_DELETE_MSG
)
!=
NULL
){
...
@@ -1368,6 +1376,9 @@ int main(const int argc, const char **argv)
...
@@ -1368,6 +1376,9 @@ int main(const int argc, const char **argv)
//kk_tsl_t *dev_shadow[30] = {NULL};
//kk_tsl_t *dev_shadow[30] = {NULL};
mid_ctx_t
*
mid_ctx
=
kk_mid_get_ctx
();
mid_ctx_t
*
mid_ctx
=
kk_mid_get_ctx
();
openlog
(
"midware"
,
LOG_PID
,
LOG_USER
);
openlog
(
"midware"
,
LOG_PID
,
LOG_USER
);
memset
(
mid_ctx
,
0
,
sizeof
(
mid_ctx_t
));
memset
(
mid_ctx
,
0
,
sizeof
(
mid_ctx_t
));
HAL_Ccuid_version
();
HAL_Ccuid_version
();
...
@@ -1396,6 +1407,7 @@ int main(const int argc, const char **argv)
...
@@ -1396,6 +1407,7 @@ int main(const int argc, const char **argv)
//IOT_Linkkit_Close(mid_ctx->master_devid);
//IOT_Linkkit_Close(mid_ctx->master_devid);
return
-
1
;
return
-
1
;
}
}
mid_ctx
->
g_ota_dispatch_thread_running
=
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
);
res
=
pthread_create
((
pthread_t
*
)
&
mid_ctx
->
g_ota_dispatch_thread
,
NULL
,
ota_dispatch_yield
,
NULL
);
if
(
res
<
0
)
{
if
(
res
<
0
)
{
...
@@ -1419,10 +1431,13 @@ int main(const int argc, const char **argv)
...
@@ -1419,10 +1431,13 @@ int main(const int argc, const char **argv)
return
-
1
;
return
-
1
;
}
}
bodySensor_load
();
//int ct = 0;
//int ct = 0;
for
(;;)
{
for
(;;)
{
usleep
(
200000
);
usleep
(
200000
);
kk_platMsg_dispatch
();
kk_platMsg_dispatch
();
BodySensorTrigger_check
();
}
}
}
}
midware/midware/scene/kk_scene_handle.c
View file @
3be6986c
...
@@ -584,6 +584,179 @@ int kk_scene_action_add(const char *gwdeviceCode,const char *sceneId,kk_scene_ac
...
@@ -584,6 +584,179 @@ int kk_scene_action_add(const char *gwdeviceCode,const char *sceneId,kk_scene_ac
free
(
out
);
free
(
out
);
return
SUCCESS_RETURN
;
return
SUCCESS_RETURN
;
}
}
typedef
struct
BodySensorNoActive
{
char
deviceCode
[
DEVICE_CODE_LEN
];
int
ep
;
time_t
alarm_time
;
time_t
report_time
;
int
noActive_time
;
//minute
int
scene_id
;
struct
BodySensorNoActive
*
next
;
}
BodySensorNoActive
;
static
BodySensorNoActive
*
pBodySensor
=
NULL
;
int
bodySensor_insert
(
const
char
*
deviceCode
,
int
ep
,
int
noActive_time
,
int
scene_id
)
{
BodySensorNoActive
*
ptr
=
NULL
,
*
pre
=
NULL
;
if
(
deviceCode
==
NULL
){
return
0
;
}
if
(
pBodySensor
==
NULL
){
pBodySensor
=
(
BodySensorNoActive
*
)
malloc
(
sizeof
(
BodySensorNoActive
));
memset
(
pBodySensor
,
0
,
sizeof
(
BodySensorNoActive
));
snprintf
(
pBodySensor
->
deviceCode
,
sizeof
(
pBodySensor
->
deviceCode
),
"%s"
,
deviceCode
);
pBodySensor
->
ep
=
ep
;
pBodySensor
->
noActive_time
=
noActive_time
;
pBodySensor
->
scene_id
=
scene_id
;
}
else
{
ptr
=
pBodySensor
;
while
(
ptr
){
pre
=
ptr
;
ptr
=
ptr
->
next
;
}
ptr
=
(
BodySensorNoActive
*
)
malloc
(
sizeof
(
BodySensorNoActive
));
memset
(
ptr
,
0
,
sizeof
(
BodySensorNoActive
));
snprintf
(
ptr
->
deviceCode
,
sizeof
(
ptr
->
deviceCode
),
"%s"
,
deviceCode
);
ptr
->
ep
=
ep
;
ptr
->
noActive_time
=
noActive_time
;
ptr
->
scene_id
=
scene_id
;
pre
->
next
=
ptr
;
}
return
1
;
}
int
bodySensor_load
(
void
)
{
int
res
=
FAIL_RETURN
;
char
*
sqlCmd
=
NULL
;
char
*
sceneId
=
NULL
;
char
*
propertyName
=
NULL
;
char
*
deviceCode
=
NULL
;
char
*
compareValue
=
NULL
;
int
epNum
=
0
;
int
sceneType
=
0
,
isEnable
=
0
;
sqlite3_stmt
*
stmt
;
kk_scene_ctx_t
*
ctx
=
_kk_scene_get_ctx
();
printf
(
"-------2222222---------------->
\n
"
);
sqlCmd
=
sqlite3_mprintf
(
"select * from SceneTriggerInfo WHERE propertyName='%s'"
,
"BodySensorNoActive"
);
sqlite3_prepare_v2
(
ctx
->
pDb
,
sqlCmd
,
strlen
(
sqlCmd
),
&
stmt
,
NULL
);
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
printf
(
"-------333333---------------->
\n
"
);
sceneId
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_SCENETRIGGER_SCENEID
);
deviceCode
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_SCENETRIGGER_DEVICECODE
);
epNum
=
sqlite3_column_int
(
stmt
,
DB_SCENETRIGGER_EPNUM
);
compareValue
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_SCENETRIGGER_COMPAREVALUE
);
DEBUG_PRINT
(
"deviceCode=%s,epNum=%d,BodySensorNoActive=%s,sceneId=%d
\n
"
,
deviceCode
,
epNum
,
compareValue
,
atoi
(
sceneId
));
bodySensor_insert
(
deviceCode
,
epNum
,
atoi
(
compareValue
),
atoi
(
sceneId
));
}
sqlite3_finalize
(
stmt
);
sqlite3_free
(
sqlCmd
);
return
res
;
}
int
kk_scene_query_body_sensor_trigger_info
(
const
char
*
deviceCode
,
int
scene_id
)
{
int
res
=
FAIL_RETURN
;
char
*
sqlCmd
=
NULL
;
char
*
sceneId
=
NULL
;
char
*
identifier
=
NULL
;
char
*
compareType
=
NULL
;
char
*
compareValue
=
NULL
;
int
propertyValueType
=
0
;
int
isAnd
=
0
;
int
sceneType
=
0
,
isEnable
=
0
;
sqlite3_stmt
*
stmt
;
kk_scene_ctx_t
*
ctx
=
_kk_scene_get_ctx
();
sqlCmd
=
sqlite3_mprintf
(
"select * from SceneTriggerInfo WHERE deviceCode='%s' and sceneId='%d'"
,
deviceCode
,
scene_id
);
sqlite3_prepare_v2
(
ctx
->
pDb
,
sqlCmd
,
strlen
(
sqlCmd
),
&
stmt
,
NULL
);
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
sceneId
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_SCENETRIGGER_SCENEID
);
identifier
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_SCENETRIGGER_PROPERTYNAME
);
compareType
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_SCENETRIGGER_COMPARETYPE
);
compareValue
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_SCENETRIGGER_COMPAREVALUE
);
isAnd
=
sqlite3_column_int
(
stmt
,
DB_SCENETRIGGER_ISAND
);
res
=
kk_scene_get_scene_info
(
sceneId
,
&
sceneType
,
&
isEnable
);
if
(
res
==
SUCCESS_RETURN
&&
isEnable
&&
isAnd
==
0
){
propertyValueType
=
kk_dm_get_property_type
(
deviceCode
,
identifier
);
INFO_PRINT
(
"[%d]kk_scene_check_condition enter!!!
\n
"
,
__LINE__
);
res
=
kk_scene_check_condition
(
sceneId
);
if
(
res
==
SUCCESS_RETURN
){
res
=
kk_scene_check_trigger_condition
(
sceneId
);
if
(
res
==
SUCCESS_RETURN
){
/*check是否时场景嵌套类型*/
res
=
kk_scene_execute_action
(
sceneId
,
NULL
);
}
}
}
}
sqlite3_finalize
(
stmt
);
sqlite3_free
(
sqlCmd
);
return
res
;
}
int
BodySensorTrigger_check
(
void
)
{
BodySensorNoActive
*
ptr
=
NULL
;
time_t
cur_time
=
time
(
NULL
);
ptr
=
pBodySensor
;
while
(
ptr
){
if
(
ptr
->
report_time
!=
0
&&
cur_time
>=
ptr
->
report_time
){
ptr
->
report_time
=
0
;
DEBUG_PRINT
(
"
\n\n
------------------>222
\n\n
"
);
kk_scene_query_body_sensor_trigger_info
(
ptr
->
deviceCode
,
ptr
->
scene_id
);
//上报
}
ptr
=
ptr
->
next
;
}
}
int
BodySensorTrigger_report
(
const
char
*
deviceCode
,
int
ep
,
cJSON
*
param
)
{
BodySensorNoActive
*
ptr
=
pBodySensor
;
int
flag
=
0
;
cJSON
*
item
=
cJSON_GetObjectItem
(
param
,
"MotionAlarmState"
);
printf
(
"
\n\n
------------------>param=%s
\n\n
"
,
cJSON_Print
(
param
));
if
(
item
==
NULL
||
item
->
type
!=
cJSON_Number
||
item
->
valueint
!=
1
){
return
0
;
}
while
(
ptr
){
if
(
!
strcmp
(
ptr
->
deviceCode
,
deviceCode
)){
if
(
ptr
->
noActive_time
){
ptr
->
alarm_time
=
time
(
NULL
);
ptr
->
report_time
=
ptr
->
alarm_time
+
(
ptr
->
noActive_time
*
60
);
printf
(
"
\n\n
------------------>111,ptr->alarm_time=%d,ptr->report_time=%d
\n\n
"
,
ptr
->
alarm_time
,
ptr
->
report_time
);
}
else
{
printf
(
"
\n\n
------------------>000
\n\n
"
);
//...
}
flag
=
1
;
}
ptr
=
ptr
->
next
;
}
return
flag
;
}
/************************************************************
/************************************************************
*功能描述:解析场景触发条件的具体内容,解析后保存到数据库
*功能描述:解析场景触发条件的具体内容,解析后保存到数据库
*输入参数:type:触发类型;
*输入参数:type:触发类型;
...
@@ -629,6 +802,10 @@ static int kk_scene_parse_trigger_detail(const char *type,const cJSON *item,cons
...
@@ -629,6 +802,10 @@ static int kk_scene_parse_trigger_detail(const char *type,const cJSON *item,cons
if
(
!
strcmp
(
compareValue
->
valuestring
,
"0"
)){
if
(
!
strcmp
(
compareValue
->
valuestring
,
"0"
)){
res
=
kk_scene_insert_scene_trigger
(
type
,
deviceCode
->
valuestring
,
ep
,
res
=
kk_scene_insert_scene_trigger
(
type
,
deviceCode
->
valuestring
,
ep
,
"MotionAlarmState"
,
compareType
->
valuestring
,
"1"
,
sceneId
,
isAnd
);
"MotionAlarmState"
,
compareType
->
valuestring
,
"1"
,
sceneId
,
isAnd
);
}
else
{
bodySensor_insert
(
deviceCode
->
valuestring
,
ep
,
atoi
(
compareValue
->
valuestring
),
atoi
(
sceneId
));
res
=
kk_scene_insert_scene_trigger
(
type
,
deviceCode
->
valuestring
,
ep
,
propertyName
->
valuestring
,
compareType
->
valuestring
,
compareValue
->
valuestring
,
sceneId
,
isAnd
);
}
}
}
else
{
}
else
{
res
=
kk_scene_insert_scene_trigger
(
type
,
deviceCode
->
valuestring
,
ep
,
res
=
kk_scene_insert_scene_trigger
(
type
,
deviceCode
->
valuestring
,
ep
,
...
@@ -923,6 +1100,7 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
...
@@ -923,6 +1100,7 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
cJSON
*
propertyName
;
cJSON
*
propertyName
;
cJSON
*
propertyValue
;
cJSON
*
propertyValue
;
cJSON
*
productType
;
cJSON
*
productType
;
cJSON
*
roomId
;
cJSON
*
deviceCode
;
cJSON
*
deviceCode
;
cJSON
*
epNum
;
cJSON
*
epNum
;
int
ArmingStateFlag
=
0
;
int
ArmingStateFlag
=
0
;
...
@@ -969,18 +1147,19 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
...
@@ -969,18 +1147,19 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
propertyValue
=
cJSON_GetObjectItem
(
item
,
MSG_SCENE_PROPERTYVALUE
);
propertyValue
=
cJSON_GetObjectItem
(
item
,
MSG_SCENE_PROPERTYVALUE
);
if
(
propertyValue
==
NULL
)
return
FAIL_RETURN
;
if
(
propertyValue
==
NULL
)
return
FAIL_RETURN
;
productType
=
cJSON_GetObjectItem
(
item
,
MSG_PRODUCT_TYPE_STR
);
productType
=
cJSON_GetObjectItem
(
item
,
MSG_PRODUCT_TYPE_STR
);
roomId
=
cJSON_GetObjectItem
(
item
,
MSG_AREA_ROOM_ROOMID
);
if
(
productType
!=
NULL
){
if
(
productType
!=
NULL
){
delay
=
cJSON_GetObjectItem
(
item
,
MSG_SCENE_DELAY
);
delay
=
cJSON_GetObjectItem
(
item
,
MSG_SCENE_DELAY
);
if
(
delay
==
NULL
)
return
FAIL_RETURN
;
if
(
delay
==
NULL
)
return
FAIL_RETURN
;
int
idelay
=
delay
->
valueint
;
int
idelay
=
delay
->
valueint
;
if
(
propertyValue
->
type
==
cJSON_String
){
if
(
propertyValue
->
type
==
cJSON_String
){
kk_subDev_set_action_by_productType
(
productType
->
valuestring
,
(
char
*
)
sceneId
,
propertyName
->
valuestring
,
kk_subDev_set_action_by_productType
(
productType
->
valuestring
,
roomId
->
valuestring
,
sceneId
,
propertyName
->
valuestring
,
propertyValue
->
valuestring
,
type
->
valuestring
,
idelay
);
propertyValue
->
valuestring
,
type
->
valuestring
,
idelay
);
}
else
{
}
else
{
printf
(
"1111
\r\n
"
);
printf
(
"1111
\r\n
"
);
char
*
str
=
cJSON_PrintUnformatted
(
propertyValue
);
char
*
str
=
cJSON_PrintUnformatted
(
propertyValue
);
printf
(
"222
\r\n
"
);
printf
(
"222
\r\n
"
);
kk_subDev_set_action_by_productType
(
productType
->
valuestring
,
(
char
*
)
sceneId
,
propertyName
->
valuestring
,
kk_subDev_set_action_by_productType
(
productType
->
valuestring
,
roomId
->
valuestring
,
sceneId
,
propertyName
->
valuestring
,
str
,
type
->
valuestring
,
idelay
);
str
,
type
->
valuestring
,
idelay
);
printf
(
"333
\r\n
"
);
printf
(
"333
\r\n
"
);
free
(
str
);
free
(
str
);
...
@@ -1032,6 +1211,7 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
...
@@ -1032,6 +1211,7 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
memcpy
(
info
.
propertyName
,
propertyName
->
valuestring
,
strlen
(
propertyName
->
valuestring
));
memcpy
(
info
.
propertyName
,
propertyName
->
valuestring
,
strlen
(
propertyName
->
valuestring
));
}
}
if
(
propertyValue
->
type
==
cJSON_Number
){
if
(
propertyValue
->
type
==
cJSON_Number
){
snprintf
(
propertyValueStr
,
sizeof
(
propertyValueStr
),
"%d"
,
propertyValue
->
valueint
);
snprintf
(
propertyValueStr
,
sizeof
(
propertyValueStr
),
"%d"
,
propertyValue
->
valueint
);
}
else
if
(
propertyValue
->
type
==
cJSON_String
){
}
else
if
(
propertyValue
->
type
==
cJSON_String
){
snprintf
(
propertyValueStr
,
sizeof
(
propertyValueStr
),
"%s"
,
propertyValue
->
valuestring
);
snprintf
(
propertyValueStr
,
sizeof
(
propertyValueStr
),
"%s"
,
propertyValue
->
valuestring
);
...
@@ -2089,6 +2269,7 @@ int kk_scene_query_trigger_info(const char *deviceCode,cJSON *param)
...
@@ -2089,6 +2269,7 @@ int kk_scene_query_trigger_info(const char *deviceCode,cJSON *param)
int
kk_scene_iftt_check
(
const
char
*
deviceCode
,
cJSON
*
param
)
int
kk_scene_iftt_check
(
const
char
*
deviceCode
,
cJSON
*
param
)
{
{
INFO_PRINT
(
"deviceCode:%s
\n
"
,
deviceCode
);
INFO_PRINT
(
"deviceCode:%s
\n
"
,
deviceCode
);
BodySensorTrigger_report
(
deviceCode
,
1
,
param
);
return
kk_scene_query_trigger_info
(
deviceCode
,
param
);
return
kk_scene_query_trigger_info
(
deviceCode
,
param
);
}
}
...
...
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