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
807f44b4
Commit
807f44b4
authored
Sep 14, 2020
by
chen.weican
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改内容】z3端支持二级identify的数据解析和上报
【提交人】陈伟灿
parent
9957d53d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
272 additions
and
178 deletions
+272
-178
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.c
...bee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.c
+204
-168
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.c
...zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.c
+68
-10
No files found.
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.c
View file @
807f44b4
...
@@ -8,20 +8,40 @@ const char *kk_tsl_rpt_status_string[] = {
...
@@ -8,20 +8,40 @@ const char *kk_tsl_rpt_status_string[] = {
"Invaild Len"
,
"Invaild Len"
,
"Invaild Type"
"Invaild Type"
};
};
static
cJSON
*
kk_check_identify
(
const
char
*
identify
,
cJSON
*
root
,
int
index
,
int
status
)
{
int
rev
=
0
,
startIdx
=
0
;
char
*
Identify_str
;
char
tmp_Identity
[
64
]
=
{
0
};
rev
=
kk_tsl_utils_memtok
(
identify
,
"."
,
1
,
&
startIdx
);
if
(
!
rev
){
cJSON
*
str
=
NULL
;
str
=
rpc_cJSON_CreateObject
();
Identify_str
=
identify
+
1
+
startIdx
;
memset
(
tmp_Identity
,
0x0
,
sizeof
(
tmp_Identity
));
memcpy
(
tmp_Identity
,
identify
,
startIdx
);
rpc_cJSON_AddNumberToObject
(
str
,
Identify_str
,
status
);
rpc_cJSON_AddItemToObject
(
root
,
tmp_Identity
,
str
);
return
root
;
}
return
NULL
;
}
static
int
kk_tsl_report
(
EmberEUI64
mac
,
uint8_t
EP
,
int
status
,
uint16_t
clusterId
,
uint16_t
attributeId
)
static
int
kk_tsl_report
(
EmberEUI64
mac
,
uint8_t
EP
,
int
status
,
uint16_t
clusterId
,
uint16_t
attributeId
)
{
{
cJSON
*
root
;
cJSON
*
root
,
*
root_tmp
;
int
index
;
int
index
;
char
*
Identify
;
char
*
Identify
;
sub_dev_node_t
*
node
=
NULL
;
sub_dev_node_t
*
node
=
NULL
;
kk_device_table_s
*
dev
;
kk_device_table_s
*
dev
;
char
macString
[
RPC_EUI64_STRING_LENGTH
];
char
macString
[
RPC_EUI64_STRING_LENGTH
];
rpc_eui64ToString
(
mac
,
macString
);
rpc_eui64ToString
(
mac
,
macString
);
root
=
rpc_cJSON_CreateObject
();
root
=
rpc_cJSON_CreateObject
();
index
=
kk_get_tsl_index
(
EP
,
clusterId
,
attributeId
);
index
=
kk_get_tsl_index
(
EP
,
clusterId
,
attributeId
);
if
(
index
<
0
){
if
(
index
<
0
){
dev
=
kk_device_find_by_mac
(
mac
);
dev
=
kk_device_find_by_mac
(
mac
);
if
(
dev
!=
NULL
){
if
(
dev
!=
NULL
){
...
@@ -31,14 +51,30 @@ static int kk_tsl_report(EmberEUI64 mac,uint8_t EP,int status,uint16_t clusterId
...
@@ -31,14 +51,30 @@ static int kk_tsl_report(EmberEUI64 mac,uint8_t EP,int status,uint16_t clusterId
if
(
index
<
0
){
if
(
index
<
0
){
return
tsl_rpt_err
;
return
tsl_rpt_err
;
}
else
{
}
else
{
root_tmp
=
kk_check_identify
(
g_tsl_zigbee_map_glb
[
index
].
map
.
Identity
,
root
,
index
,
status
);
if
(
root_tmp
!=
NULL
){
kk_rpc_report_status
(
root_tmp
,
mac
);
//rpc_cJSON_Delete(root_tmp);
return
tsl_rpt_success
;
}
else
{
Identify
=
g_tsl_zigbee_map_glb
[
index
].
map
.
Identity
;
Identify
=
g_tsl_zigbee_map_glb
[
index
].
map
.
Identity
;
}
}
}
}
else
{
}
else
{
root_tmp
=
kk_check_identify
(
g_tsl_zigbee_map
[
index
].
Identity
,
root
,
index
,
status
);
if
(
root_tmp
!=
NULL
){
kk_rpc_report_status
(
root_tmp
,
mac
);
//rpc_cJSON_Delete(root_tmp);
return
tsl_rpt_success
;
}
else
{
Identify
=
g_tsl_zigbee_map
[
index
].
Identity
;
Identify
=
g_tsl_zigbee_map
[
index
].
Identity
;
}
}
}
rpc_cJSON_AddNumberToObject
(
root
,
Identify
,
status
);
rpc_cJSON_AddNumberToObject
(
root
,
Identify
,
status
);
kk_rpc_report_status
(
root
,
mac
);
kk_rpc_report_status
(
root
,
mac
);
//rpc_cJSON_Delete(root);
return
tsl_rpt_success
;
return
tsl_rpt_success
;
}
}
...
...
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.c
View file @
807f44b4
...
@@ -40,11 +40,32 @@ cJSON *kk_topo_change_operation(jrpc_context * ctx, cJSON *params, cJSON *id,cJS
...
@@ -40,11 +40,32 @@ cJSON *kk_topo_change_operation(jrpc_context * ctx, cJSON *params, cJSON *id,cJS
error_return:
error_return:
return
rpc_cJSON_CreateNull
();
return
rpc_cJSON_CreateNull
();
}
}
int
kk_tsl_utils_memtok
(
_IN_
char
*
input
,
_IN_
char
delimiter
,
_IN_
int
index
,
_OU_
int
*
offset
)
{
int
item_index
=
0
;
int
count
=
0
;
int
input_len
=
0
;
if
(
input
==
NULL
||
offset
==
NULL
)
{
return
-
1
;
}
input_len
=
strlen
(
input
);
for
(
item_index
=
0
;
item_index
<
input_len
;
item_index
++
)
{
if
(
input
[
item_index
]
==
delimiter
&&
(
item_index
+
1
)
<
input_len
)
{
count
++
;
if
(
count
==
index
)
{
*
offset
=
item_index
;
return
0
;
}
}
}
return
-
1
;
}
cJSON
*
kk_tsl_property_operation
(
jrpc_context
*
ctx
,
cJSON
*
params
,
cJSON
*
id
,
cJSON
*
mac
)
cJSON
*
kk_tsl_property_operation
(
jrpc_context
*
ctx
,
cJSON
*
params
,
cJSON
*
id
,
cJSON
*
mac
)
{
{
sub_dev_node_t
*
node
=
NULL
;
sub_dev_node_t
*
node
=
NULL
;
int
res
=
0
;
int
res
=
0
,
rev
=
0
;
rpc_nwk_info_s
info
;
rpc_nwk_info_s
info
;
EmberStatus
status
;
EmberStatus
status
;
int
index
=
0
;
int
index
=
0
;
...
@@ -52,8 +73,11 @@ cJSON *kk_tsl_property_operation(jrpc_context * ctx, cJSON *params, cJSON *id,cJ
...
@@ -52,8 +73,11 @@ cJSON *kk_tsl_property_operation(jrpc_context * ctx, cJSON *params, cJSON *id,cJ
int
num
;
int
num
;
uint8_t
findFlag
=
0xff
;
uint8_t
findFlag
=
0xff
;
cJSON
*
propertyItem
=
NULL
;
cJSON
*
propertyItem
=
NULL
;
cJSON
*
propertyItem1
=
NULL
;
EmberEUI64
eui64
;
EmberEUI64
eui64
;
EmberNodeId
nodeId
=
EMBER_AF_PLUGIN_DEVICE_TABLE_NULL_NODE_ID
;
EmberNodeId
nodeId
=
EMBER_AF_PLUGIN_DEVICE_TABLE_NULL_NODE_ID
;
int
startIdx
=
0
;
char
tmp_Identity
[
64
]
=
{
0
};
UTIL_LOG_INFO
(
"
\n
********************kk tsl property operation********************
\n
"
);
UTIL_LOG_INFO
(
"
\n
********************kk tsl property operation********************
\n
"
);
if
(
params
==
NULL
){
if
(
params
==
NULL
){
...
@@ -69,15 +93,48 @@ cJSON *kk_tsl_property_operation(jrpc_context * ctx, cJSON *params, cJSON *id,cJ
...
@@ -69,15 +93,48 @@ cJSON *kk_tsl_property_operation(jrpc_context * ctx, cJSON *params, cJSON *id,cJ
num
=
kk_get_tsl_num
();
num
=
kk_get_tsl_num
();
for
(
index
=
0
;
index
<
num
;
index
++
){
for
(
index
=
0
;
index
<
num
;
index
++
){
rev
=
kk_tsl_utils_memtok
(
g_tsl_zigbee_map
[
index
].
Identity
,
"."
,
1
,
&
startIdx
);
if
(
!
rev
){
memset
(
tmp_Identity
,
0x0
,
sizeof
(
tmp_Identity
));
memcpy
(
tmp_Identity
,
g_tsl_zigbee_map
[
index
].
Identity
,
startIdx
);
propertyItem1
=
rpc_cJSON_GetObjectItem
(
params
,
tmp_Identity
);
if
(
propertyItem1
!=
NULL
){
propertyItem
=
rpc_cJSON_GetObjectItem
(
propertyItem1
,
g_tsl_zigbee_map
[
index
].
Identity
+
startIdx
+
1
);
if
(
propertyItem
!=
NULL
){
findFlag
=
1
;
break
;
}
}
}
else
{
propertyItem
=
rpc_cJSON_GetObjectItem
(
params
,
g_tsl_zigbee_map
[
index
].
Identity
);
propertyItem
=
rpc_cJSON_GetObjectItem
(
params
,
g_tsl_zigbee_map
[
index
].
Identity
);
if
(
propertyItem
!=
NULL
){
if
(
propertyItem
!=
NULL
){
findFlag
=
1
;
findFlag
=
1
;
break
;
break
;
}
}
}
}
}
if
(
findFlag
==
0xff
){
if
(
findFlag
==
0xff
){
num
=
kk_get_tsl_glb_num
();
num
=
kk_get_tsl_glb_num
();
for
(
index
=
0
;
index
<
num
;
index
++
){
for
(
index
=
0
;
index
<
num
;
index
++
){
rev
=
kk_tsl_utils_memtok
(
g_tsl_zigbee_map_glb
[
index
].
map
.
Identity
,
"."
,
1
,
&
startIdx
);
if
(
!
rev
){
memset
(
tmp_Identity
,
0x0
,
sizeof
(
tmp_Identity
));
memcpy
(
tmp_Identity
,
g_tsl_zigbee_map_glb
[
index
].
map
.
Identity
,
startIdx
);
propertyItem1
=
rpc_cJSON_GetObjectItem
(
params
,
tmp_Identity
);
if
(
propertyItem1
!=
NULL
){
propertyItem
=
rpc_cJSON_GetObjectItem
(
propertyItem1
,
g_tsl_zigbee_map_glb
[
index
].
map
.
Identity
+
startIdx
+
1
);
if
(
propertyItem
!=
NULL
){
findFlag
=
2
;
break
;
}
}
}
else
{
propertyItem
=
rpc_cJSON_GetObjectItem
(
params
,
g_tsl_zigbee_map_glb
[
index
].
map
.
Identity
);
propertyItem
=
rpc_cJSON_GetObjectItem
(
params
,
g_tsl_zigbee_map_glb
[
index
].
map
.
Identity
);
if
(
propertyItem
!=
NULL
){
if
(
propertyItem
!=
NULL
){
findFlag
=
2
;
findFlag
=
2
;
...
@@ -85,6 +142,7 @@ cJSON *kk_tsl_property_operation(jrpc_context * ctx, cJSON *params, cJSON *id,cJ
...
@@ -85,6 +142,7 @@ cJSON *kk_tsl_property_operation(jrpc_context * ctx, cJSON *params, cJSON *id,cJ
}
}
}
}
}
}
}
if
(
findFlag
!=
0xff
)
if
(
findFlag
!=
0xff
)
{
{
...
...
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