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
8d64d301
Commit
8d64d301
authored
Aug 11, 2020
by
尹佳钦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2020/8/11 提交
parent
6e247767
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
1 deletion
+54
-1
platform/zigbee/app/builder/Z3GatewayHost/kk_test.c
platform/zigbee/app/builder/Z3GatewayHost/kk_test.c
+50
-0
platform/zigbee/app/builder/Z3GatewayHost/kk_test.h
platform/zigbee/app/builder/Z3GatewayHost/kk_test.h
+4
-1
No files found.
platform/zigbee/app/builder/Z3GatewayHost/kk_test.c
View file @
8d64d301
...
...
@@ -71,6 +71,56 @@ bool kk_rpc_report_LightStatus(EmberEUI64 mac,bool LightStatus)
kk_rpc_report_status
(
root
,
mac
);
}
cJSON
*
rpc_read_attribue
(
jrpc_context
*
ctx
,
cJSON
*
params
,
cJSON
*
id
,
cJSON
*
mac
)
{
rpc_nwk_info_s
info
;
EmberStatus
status
;
if
(
params
==
NULL
){
emberAfCorePrintln
(
"
\r\n
params == NULL
\r\n
"
);
set_json_error_type
(
ctx
,
JRPC_INVALID_PARAMS
,
MSG_INVALID_PARAMS
);
goto
error_return
;
}
else
{
cJSON
*
LightStatus_item
=
rpc_cJSON_GetObjectItem
(
params
,
"LightStatus"
);
uint8_t
LightStatus
=
rpc_get_u8
(
LightStatus_item
->
valuestring
);
uint8_t
eui64
[
EUI64_SIZE
];
bool
flag
=
rpc_get_mac
(
mac
->
valuestring
,
eui64
);
emberAfCorePrintBuffer
(
eui64
,
EUI64_SIZE
,
true
);
for
(
int
i
=
0
;
i
<
EUI64_SIZE
;
i
++
){
emberAfCorePrintln
(
"i=%d,val=%02x"
,
i
,
eui64
[
i
]);
}
EmberNodeId
node
=
emberAfDeviceTableGetNodeIdFromEui64
(
eui64
);
if
(
node
==
0xffff
){
emberAfCorePrintln
(
"
\r\n
not find device!
\r\n
"
);
set_json_error_type
(
ctx
,
JRPC_INVALID_PARAMS
,
MSG_INVALID_PARAMS
);
goto
error_return
;
}
emberAfCorePrintln
(
"
\r\n
node=0x%02X,LightStatus=%d
\r\n
"
,
node
,
LightStatus
);
if
(
flag
){
EmberStatus
status
;
if
(
LightStatus
==
1
){
status
=
zclOnOff_On
(
node
,
1
);
emberAfCorePrintln
(
"
\r\n
zclOnOff_On
\r\n
"
);
}
else
if
(
LightStatus
==
0
){
status
=
zclOnOff_Off
(
node
,
1
);
emberAfCorePrintln
(
"
\r\n
zclOnOff_Off
\r\n
"
);
}
else
{
set_json_error_type
(
ctx
,
JRPC_INVALID_PARAMS
,
MSG_INVALID_PARAMS
);
goto
error_return
;
}
}
else
{
emberAfCorePrintln
(
"
\r\n
22222
\r\n
"
);
set_json_error_type
(
ctx
,
JRPC_INVALID_PARAMS
,
MSG_INVALID_PARAMS
);
goto
error_return
;
}
return
rpc_cJSON_CreateNumber
(
status
);
}
error_return:
return
rpc_cJSON_CreateNull
();
}
cJSON
*
rpc_Control
(
jrpc_context
*
ctx
,
cJSON
*
params
,
cJSON
*
id
,
cJSON
*
mac
)
...
...
platform/zigbee/app/builder/Z3GatewayHost/kk_test.h
View file @
8d64d301
...
...
@@ -9,16 +9,19 @@
#define KK_REPORT_DEVICE_JOINED_METHOD "thing.topo.add"
#define KK_REPORT_DEVICE_LEAVE_METHOD "thing.topo.leave"
#define KK_REPORT_ATTRIBUTE_METHOD "thing.service.property.report"
#define KK_READ_ATTRIBUTE_METHOD "thing.service.property.get"
cJSON
*
rpc_Control
(
jrpc_context
*
ctx
,
cJSON
*
params
,
cJSON
*
id
,
cJSON
*
mac
);
cJSON
*
rpc_read_attribue
(
jrpc_context
*
ctx
,
cJSON
*
params
,
cJSON
*
id
,
cJSON
*
mac
);
#define RPC_KK_TEST_FUNCTION_TABLE \
{(rpc_function*)rpc_Control,"thing.service.property.set"},\
{(rpc_function*)rpc_Control,KK_READ_ATTRIBUTE_METHOD},\
{(rpc_function*)rpc_nwkPermitJoin,"thing.service.NetChannelState.set"}
...
...
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