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
d0ce3d43
Commit
d0ce3d43
authored
Feb 15, 2022
by
chen.weican
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改内容】修改场景rebuild存在的问题
【提交人】陈伟灿
parent
159981b9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
25 deletions
+38
-25
midware/midware/dm/kk_sub_db.c
midware/midware/dm/kk_sub_db.c
+27
-21
midware/midware/dm/kk_sub_db.h
midware/midware/dm/kk_sub_db.h
+1
-0
midware/midware/scene/kk_scene_handle.c
midware/midware/scene/kk_scene_handle.c
+10
-4
No files found.
midware/midware/dm/kk_sub_db.c
View file @
d0ce3d43
...
...
@@ -636,10 +636,35 @@ static int _kk_indoor_air_info_handle(char* deviceCode,char* propertyName,char*
}
return
res
;
}
int
kk_indoor_air_action_add
(
char
*
propertyValue
,
char
*
deviceCode
,
int
delay
,
char
*
gwDeviceCode
,
char
*
sceneId
,
char
*
type
,
int
epnum
)
{
char
data
[
32
]
=
{
0
};
cJSON
*
json
=
cJSON_Parse
(
propertyValue
);
if
(
json
==
NULL
)
{
return
-
1
;
}
cJSON
*
Temperature
=
cJSON_GetObjectItem
(
json
,
"Temperature"
);
if
(
Temperature
==
NULL
)
{
cJSON_Delete
(
json
);
return
-
1
;}
memset
(
data
,
0x0
,
sizeof
(
data
));
sprintf
(
data
,
"%f"
,
Temperature
->
valuedouble
);
_kk_indoor_air_info_handle
(
deviceCode
,
"Temperature"
,
data
,
epnum
,
delay
,
gwDeviceCode
,
sceneId
,
type
,
0
);
cJSON
*
WindSpeed
=
cJSON_GetObjectItem
(
json
,
"WindSpeed"
);
if
(
WindSpeed
==
NULL
)
{
cJSON_Delete
(
json
);
return
-
1
;}
memset
(
data
,
0x0
,
sizeof
(
data
));
sprintf
(
data
,
"%d"
,
WindSpeed
->
valueint
);
_kk_indoor_air_info_handle
(
deviceCode
,
"WindSpeed"
,
data
,
epnum
,
delay
,
gwDeviceCode
,
sceneId
,
type
,
0
);
cJSON
*
WorkMode
=
cJSON_GetObjectItem
(
json
,
"WorkMode"
);
if
(
WorkMode
==
NULL
){
cJSON_Delete
(
json
);
return
-
1
;}
memset
(
data
,
0x0
,
sizeof
(
data
));
sprintf
(
data
,
"%d"
,
WorkMode
->
valueint
);
_kk_indoor_air_info_handle
(
deviceCode
,
"WorkMode"
,
data
,
epnum
,
delay
,
gwDeviceCode
,
sceneId
,
type
,
0
);
cJSON_Delete
(
json
);
return
0
;
}
static
int
_kk_indoor_air_handle
(
char
*
deviceCode
,
char
*
sceneId
,
char
*
propertyName
,
char
*
propertyValue
,
char
*
type
,
int
delay
,
char
*
gwDeviceCode
,
char
*
roomId
)
{
int
eplist
[
64
]
=
{
0
};
char
data
[
32
]
=
{
0
};
char
ep
[
8
]
=
{
0
};
int
res
=
0
;
int
i
=
0
;
...
...
@@ -660,26 +685,7 @@ static int _kk_indoor_air_handle(char* deviceCode, char *sceneId, char *property
}
}
if
(
strcmp
(
propertyName
,
"CustomAction"
)
==
0
){
cJSON
*
json
=
cJSON_Parse
(
propertyValue
);
if
(
json
==
NULL
)
{
return
-
1
;
}
cJSON
*
Temperature
=
cJSON_GetObjectItem
(
json
,
"Temperature"
);
if
(
Temperature
==
NULL
)
{
cJSON_Delete
(
json
);
return
-
1
;}
memset
(
data
,
0x0
,
sizeof
(
data
));
sprintf
(
data
,
"%f"
,
Temperature
->
valuedouble
);
_kk_indoor_air_info_handle
(
deviceCode
,
"Temperature"
,
data
,
eplist
[
i
],
delay
,
gwDeviceCode
,
sceneId
,
type
,
0
);
cJSON
*
WindSpeed
=
cJSON_GetObjectItem
(
json
,
"WindSpeed"
);
if
(
WindSpeed
==
NULL
)
{
cJSON_Delete
(
json
);
return
-
1
;}
memset
(
data
,
0x0
,
sizeof
(
data
));
sprintf
(
data
,
"%d"
,
WindSpeed
->
valueint
);
_kk_indoor_air_info_handle
(
deviceCode
,
"WindSpeed"
,
data
,
eplist
[
i
],
delay
,
gwDeviceCode
,
sceneId
,
type
,
0
);
cJSON
*
WorkMode
=
cJSON_GetObjectItem
(
json
,
"WorkMode"
);
if
(
WorkMode
==
NULL
){
cJSON_Delete
(
json
);
return
-
1
;}
memset
(
data
,
0x0
,
sizeof
(
data
));
sprintf
(
data
,
"%d"
,
WorkMode
->
valueint
);
_kk_indoor_air_info_handle
(
deviceCode
,
"WorkMode"
,
data
,
eplist
[
i
],
delay
,
gwDeviceCode
,
sceneId
,
type
,
0
);
cJSON_Delete
(
json
);
kk_indoor_air_action_add
(
propertyValue
,
deviceCode
,
delay
,
gwDeviceCode
,
sceneId
,
type
,
eplist
[
i
]);
kk_scene_insert_scene_action
(
type
,
deviceCode
,
eplist
[
i
],
propertyName
,
propertyValue
,
delay
,
sceneId
,
gwDeviceCode
);
}
else
{
...
...
midware/midware/dm/kk_sub_db.h
View file @
d0ce3d43
...
...
@@ -43,6 +43,7 @@ int kk_screenDev_delete_by_serialId(char *serialId);
int
kk_get_screenDev_list
(
ScreenDevInfo_t
*
list
);
int
kk_get_screenDev_info
(
ScreenDevInfo_t
*
devInfo
,
char
*
serialId
);
int
kk_subDev_getDeviceCodes_byProductType
(
DeviceCode_t
*
list
,
char
*
type
);
int
kk_indoor_air_action_add
(
char
*
propertyValue
,
char
*
deviceCode
,
int
delay
,
char
*
gwDeviceCode
,
char
*
sceneId
,
char
*
type
,
int
epnum
);
enum
{
DB_SUB_IDX
=
0
,
DB_SUB_ONLINE
,
...
...
midware/midware/scene/kk_scene_handle.c
View file @
d0ce3d43
...
...
@@ -2680,14 +2680,13 @@ static int _kk_rebuild_device_active(char *sceneid)
int
idelay
=
sqlite3_column_int
(
stmt
,
DB_SCENEACTION_DELAY
);
memcpy
(
info
.
deviceCode
,
pDeviceCode
,
strlen
(
pDeviceCode
));
memcpy
(
info
.
propertyName
,
propertyName
,
strlen
(
propertyName
));
memcpy
(
info
.
propertyValue
,
propertyValueStr
,
strlen
(
propertyValueStr
));
info
.
epNum
=
epNum
;
info
.
delay
=
idelay
;
isMuti
=
0
;
if
(
strcmp
(
propertyName
,
"LightStripSpecialAction"
)
!=
0
){
kk_scene_action_add
(
gwDeviceCode
,
sceneid
,
info
);
}
else
{
if
(
strcmp
(
propertyName
,
"LightStripSpecialAction"
)
==
0
){
if
(
strstr
(
propertyValueStr
,
"{"
)
!=
NULL
&&
strstr
(
propertyValueStr
,
"}"
)
!=
NULL
){
cJSON
*
propertyValueJson
=
cJSON_Parse
(
propertyValueStr
);
if
(
propertyValueJson
==
NULL
)
{
...
...
@@ -2697,6 +2696,13 @@ static int _kk_rebuild_device_active(char *sceneid)
_kk_scene_LightStripSpecialAction_handle
(
propertyValueJson
,
pDeviceCode
,
epNum
,
idelay
,(
char
*
)
sceneid
,
gwDeviceCode
);
cJSON_Delete
(
propertyValueJson
);
}
}
else
if
(
strcmp
(
propertyName
,
"CustomAction"
)
==
0
){
//空调内机的场景属性
if
(
strstr
(
propertyValueStr
,
"{"
)
!=
NULL
&&
strstr
(
propertyValueStr
,
"}"
)
!=
NULL
){
kk_indoor_air_action_add
(
propertyValueStr
,
pDeviceCode
,
idelay
,
gwDeviceCode
,
sceneid
,
"action/thing/setProperty"
,
epNum
);
}
}
else
{
memcpy
(
info
.
propertyValue
,
propertyValueStr
,
strlen
(
propertyValueStr
));
kk_scene_action_add
(
gwDeviceCode
,
sceneid
,
info
);
}
}
}
...
...
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