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
a483ce81
Commit
a483ce81
authored
Aug 27, 2021
by
尹佳钦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【20210827】局域网设备属性同步时,添加对属性的eps数组内属性的解析
parent
c811884f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
31 deletions
+38
-31
application/klansdk/kk_oldccu_msg.c
application/klansdk/kk_oldccu_msg.c
+38
-31
No files found.
application/klansdk/kk_oldccu_msg.c
View file @
a483ce81
...
...
@@ -224,8 +224,8 @@ static int kk_lan_property_convert(const char *deviceCode,kk_map_dev_node_t *dev
cJSON
*
item_size
=
NULL
;
cJSON
*
epsAry
=
NULL
,
*
epAryItem
=
NULL
,
*
epAryEpNumObj
=
NULL
;
int
j
,
mFlag
=
0
,
epsArySize
=
0
;
...
...
@@ -255,11 +255,8 @@ static int kk_lan_property_convert(const char *deviceCode,kk_map_dev_node_t *dev
continue
;
}
if
((
valObj
=
cJSON_GetObjectItem
(
params
,
n_id
->
valuestring
))
==
NULL
){
debug_log
(
LOG_NORMAL
,
"[match] next.
\n
"
);
continue
;
}
n_dataType
=
cJSON_GetObjectItem
(
n_item
,
"dataType"
);
n_valueRange
=
cJSON_GetObjectItem
(
n_item
,
"valueRange"
);
...
...
@@ -275,9 +272,40 @@ static int kk_lan_property_convert(const char *deviceCode,kk_map_dev_node_t *dev
channelObj
=
cJSON_GetObjectItem
(
o_item
,
"channel"
);
epNumObj
=
cJSON_GetObjectItem
(
params
,
"epNum"
);
if
((
channel
=
_kk_lan_check_channel
(
channelObj
,
epNumObj
))
==-
1
){
debug_log
(
LOG_DEBUG
,
"[channel] %d.
\n
"
,
channel
);
continue
;
}
if
((
epsAry
=
cJSON_GetObjectItem
(
params
,
"eps"
))
!=
NULL
&&
epsAry
->
type
==
cJSON_Array
){
epsArySize
=
cJSON_GetArraySize
(
epsAry
);
for
(
j
=
0
;
j
<
epsArySize
;
j
++
){
epAryItem
=
cJSON_GetArrayItem
(
epsAry
,
j
);
epAryEpNumObj
=
cJSON_GetObjectItem
(
epAryItem
,
"epNum"
);
if
(
epAryEpNumObj
==
NULL
||
epAryEpNumObj
->
type
!=
cJSON_String
||
channel
!=
atoi
(
epAryEpNumObj
->
valuestring
)){
debug_log
(
LOG_NORMAL
,
"[epsAry match] next.
\n
"
);
continue
;
}
if
((
valObj
=
cJSON_GetObjectItem
(
epAryItem
,
n_id
->
valuestring
))
==
NULL
){
debug_log
(
LOG_NORMAL
,
"[epsAry match] next.
\n
"
);
continue
;
}
else
{
mFlag
=
1
;
break
;
}
}
if
(
mFlag
!=
1
){
continue
;
}
}
else
{
if
((
valObj
=
cJSON_GetObjectItem
(
params
,
n_id
->
valuestring
))
==
NULL
){
debug_log
(
LOG_NORMAL
,
"[match] next.
\n
"
);
continue
;
}
}
if
((
nodeId
=
kk_lan_db_node_get
(
deviceCode
,
channel
))
==-
1
){
debug_log
(
LOG_DEBUG
,
"[err] not find node.
\n
"
);
continue
;
...
...
@@ -308,25 +336,9 @@ static int kk_lan_property_convert(const char *deviceCode,kk_map_dev_node_t *dev
return
0
;
}
static
int
attr_indoorAir_report
(
cJSON
*
params
)
{
int
k
=
0
;
if
(
params
==
NULL
){
return
-
1
;
}
cJSON
*
epsAry
=
cJSON_GetObjectItem
(
params
,
"eps"
);
if
(
epsAry
==
NULL
){
return
-
1
;
}
int
epsize
=
cJSON_GetArraySize
(
epsAry
);
for
(
k
=
0
;
k
<
epsize
;
k
++
){
char
tmpIdx
[
4
]
=
{
0
};
cJSON
*
infoItem
=
cJSON_GetArrayItem
(
epsAry
,
k
);
if
(
infoItem
==
NULL
)
continue
;
kk_send_indoorAir_status
(
infoItem
);
}
return
0
;
}
//属性状态上报处理
int
kk_lan_property_post_deal
(
const
char
*
deviceCode
,
cJSON
*
payload
)
{
...
...
@@ -337,12 +349,7 @@ int kk_lan_property_post_deal(const char *deviceCode,cJSON *payload)
if
(
kk_map_dev_search_by_deviceCode
(
deviceCode
,
&
dev
)
==
0
){
params
=
cJSON_GetObjectItem
(
payload
,
"params"
);
if
(
strcmp
(
dev
->
productCode
,
"3062"
)
==
0
){
attr_indoorAir_report
(
params
);
}
else
{
return
kk_lan_property_convert
(
deviceCode
,
dev
,
params
);
}
return
kk_lan_property_convert
(
deviceCode
,
dev
,
params
);
}
else
{
debug_log
(
LOG_DEBUG
,
"[err] not find deviceCode(%s).
\n
"
,
deviceCode
);
return
-
1
;
...
...
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