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
e5013c9e
Commit
e5013c9e
authored
Feb 17, 2022
by
陈伟灿
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'cwc' into 'master'
【修改内容】修改场景设置所有空调包括风机盘管和空调线控器 See merge request chenweican/k-sdk!191
parents
62bf69e1
f0f4f45c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
8 deletions
+47
-8
midware/midware/dm/kk_sub_db.c
midware/midware/dm/kk_sub_db.c
+32
-5
midware/midware/scene/kk_scene_handle.c
midware/midware/scene/kk_scene_handle.c
+15
-3
No files found.
midware/midware/dm/kk_sub_db.c
View file @
e5013c9e
...
...
@@ -637,6 +637,8 @@ static productype_map_s producTypeMap[] = {
{
"LIGHT_DIMMER"
,
"lightPanel"
},
{
"SOCKET"
,
"outlet"
},
{
"AC_IndoorUnit"
,
"air conditioning gateway"
},
{
"AC_IndoorUnit"
,
"fanCoil"
},
{
"AC_IndoorUnit"
,
"airConditioning"
},
{
"FLOOR_HEATING"
,
"floorHeating"
},
{
"FRESH_AIR"
,
"freshAir"
},
{
"AIR_SWITCH"
,
"airswitch gateway"
},
...
...
@@ -722,7 +724,31 @@ static int _kk_indoor_air_handle(char* deviceCode, char *sceneId, char *property
}
return
0
;
}
static
int
_kk_airConditon_handle
(
char
*
deviceCode
,
char
*
sceneId
,
char
*
propertyName
,
char
*
propertyValue
,
char
*
type
,
int
delay
,
char
*
gwDeviceCode
,
char
*
roomId
)
{
int
res
=
0
;
int
allRoom
=
(
strcmp
(
roomId
,
"-1"
)
==
0
)
?
1
:
0
;
if
(
allRoom
==
1
){
if
(
kk_check_dev_exist_inRoom
(
deviceCode
,
"1"
)
==
0
){
INFO_PRINT
(
"do not handle the indoor air not in room!!!
\n
"
);
return
-
1
;
}
}
else
{
if
(
kk_check_dev_exist_roomId
(
deviceCode
,
"1"
,
roomId
)
==
0
){
INFO_PRINT
(
"do not handle the indoor air not in room!!!
\n
"
);
return
-
1
;;
}
}
if
(
strcmp
(
propertyName
,
"CustomAction"
)
==
0
){
kk_indoor_air_action_add
(
propertyValue
,
deviceCode
,
delay
,
gwDeviceCode
,
sceneId
,
type
,
1
);
kk_scene_insert_scene_action
(
type
,
deviceCode
,
1
,
propertyName
,
propertyValue
,
delay
,
sceneId
,
gwDeviceCode
);
}
else
{
_kk_indoor_air_info_handle
(
deviceCode
,
propertyName
,
propertyValue
,
1
,
delay
,
gwDeviceCode
,
sceneId
,
type
,
1
);
}
return
0
;
}
static
int
_kk_air_switch_handle
(
char
*
deviceCode
,
char
*
sceneId
,
char
*
propertyName
,
char
*
propertyValue
,
char
*
type
,
int
delay
,
char
*
gwDeviceCode
)
{
int
eplist
[
64
]
=
{
0
};
...
...
@@ -784,12 +810,9 @@ int kk_subDev_set_action_by_productType(const char *productType,const char *room
}
INFO_PRINT
(
"kk_subDev_set_action_by_productType called!!!
\n
"
);
size
=
kk_get_product_type_table_size
();
//printf("---------------------------->size:%d\n",size);
for
(
k
=
0
;
k
<
size
;
k
++
){
//printf("---------------------------->producTypeMap[k].type:%s\n",producTypeMap[k].type);
if
(
!
strcmp
(
productType
,
producTypeMap
[
k
].
type
)){
memcpy
(
typeArray
[
count
],
producTypeMap
[
k
].
maptype
,
strlen
(
producTypeMap
[
k
].
maptype
));
//printf("---------------------------->producTypeMap[k].maptype:%s\n",producTypeMap[k].maptype);
count
++
;
if
(
count
>=
10
){
break
;
...
...
@@ -803,7 +826,6 @@ int kk_subDev_set_action_by_productType(const char *productType,const char *room
devIsExsit
=
0
;
//INFO_PRINT("total_column = %d\n", sqlite3_column_count(stmt));
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
pDeviceCode
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_SUB_DEVICECODE
);
res
=
dm_mgr_get_device_by_devicecode
(
pDeviceCode
,
&
node
);
if
(
res
!=
SUCCESS_RETURN
)
{
...
...
@@ -817,6 +839,11 @@ int kk_subDev_set_action_by_productType(const char *productType,const char *room
_kk_air_switch_handle
(
pDeviceCode
,(
char
*
)
sceneId
,(
char
*
)
propertyName
,(
char
*
)
propertyValue
,(
char
*
)
type
,
delay
,
node
->
fatherDeviceCode
);
continue
;
}
else
if
(
strcmp
(
typeArray
[
k
],
"airConditioning"
)
==
0
||
strcmp
(
typeArray
[
k
],
"fanCoil"
)
==
0
){
//空调线控器和风机盘管
devIsExsit
=
1
;
_kk_airConditon_handle
(
pDeviceCode
,(
char
*
)
sceneId
,(
char
*
)
propertyName
,(
char
*
)
propertyValue
,(
char
*
)
type
,
delay
,
node
->
fatherDeviceCode
,(
char
*
)
roomId
);
continue
;
}
for
(
idx
=
0
;
idx
<
node
->
dev_shadow
->
property_number
;
idx
++
){
property
=
(
kk_tsl_data_t
*
)(
node
->
dev_shadow
->
properties
+
idx
);
if
(
property
==
NULL
){
...
...
midware/midware/scene/kk_scene_handle.c
View file @
e5013c9e
...
...
@@ -2656,15 +2656,20 @@ static int _kk_rebuild_device_active(char *sceneid)
int
epNum
=
0
;
int
isMuti
=
0
;
int
count
=
0
;
int
res
=
0
;
dm_mgr_dev_node_t
*
node
=
NULL
;
kk_scene_ctx_t
*
ctx
=
_kk_scene_get_ctx
();
sqlCmd
=
sqlite3_mprintf
(
"select * from SceneActionInfo WHERE sceneid = '%s' and active = '%d'"
,
sceneid
,
1
);
sqlite3_prepare_v2
(
ctx
->
pDb
,
sqlCmd
,
strlen
(
sqlCmd
),
&
stmt
,
NULL
);
cJSON
*
array
=
cJSON_CreateArray
();
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
count
++
;
pSceneType
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_SCENEACTION_TYPE
);
pDeviceCode
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_SCENEACTION_DEVICECODE
);
if
(
strcmp
(
pDeviceCode
,
""
)
==
0
){
continue
;
}
count
++
;
epNum
=
sqlite3_column_int
(
stmt
,
DB_SCENEACTION_EPNUM
);
gwDeviceCode
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_SCENEACTION_GWDEVICECODE
);
if
(
strcmp
(
pSceneType
,
"action/thing/group"
)
==
0
){
...
...
@@ -2682,7 +2687,6 @@ static int _kk_rebuild_device_active(char *sceneid)
memcpy
(
info
.
deviceCode
,
pDeviceCode
,
strlen
(
pDeviceCode
));
memcpy
(
info
.
propertyName
,
propertyName
,
strlen
(
propertyName
));
info
.
epNum
=
epNum
;
info
.
delay
=
idelay
;
isMuti
=
0
;
...
...
@@ -2699,8 +2703,16 @@ static int _kk_rebuild_device_active(char *sceneid)
}
}
else
if
(
strcmp
(
propertyName
,
"CustomAction"
)
==
0
){
//空调内机的场景属性
if
(
strstr
(
propertyValueStr
,
"{"
)
!=
NULL
&&
strstr
(
propertyValueStr
,
"}"
)
!=
NULL
){
res
=
dm_mgr_get_device_by_devicecode
(
pDeviceCode
,
&
node
);
if
(
res
!=
SUCCESS_RETURN
)
{
ERROR_PRINT
(
"ERROR [%s][%d] res:%d
\n
"
,
__FUNCTION__
,
__LINE__
,
res
);
continue
;
}
if
(
strcmp
(
node
->
productType
,
KK_DM_AIR_GATEWAY_TYPE
)
==
0
||
strcmp
(
node
->
productType
,
"airConditioning"
)
==
0
||
strcmp
(
node
->
productType
,
"fanCoil"
)
==
0
){
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