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
a66362ff
Commit
a66362ff
authored
Sep 04, 2020
by
尹佳钦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文件结构整理
parent
f4929f7d
Changes
13
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
441 additions
and
550 deletions
+441
-550
platform/zigbee/app/builder/Z3GatewayHost/Makefile
platform/zigbee/app/builder/Z3GatewayHost/Makefile
+2
-1
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_control.c
...m/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_control.c
+0
-1
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_control.h
...m/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_control.h
+0
-25
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.c
...m/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.c
+1
-1
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.c
...bee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.c
+134
-0
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.h
...bee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.h
+42
-0
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.c
...zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.c
+189
-0
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.h
...zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.h
+32
-0
platform/zigbee/app/builder/Z3GatewayHost/kk_test.c
platform/zigbee/app/builder/Z3GatewayHost/kk_test.c
+5
-456
platform/zigbee/app/builder/Z3GatewayHost/kk_test.h
platform/zigbee/app/builder/Z3GatewayHost/kk_test.h
+5
-25
platform/zigbee/app/builder/Z3GatewayHost/kk_tsl_zigbee_map.c
...form/zigbee/app/builder/Z3GatewayHost/kk_tsl_zigbee_map.c
+15
-31
platform/zigbee/app/builder/Z3GatewayHost/kk_tsl_zigbee_map.h
...form/zigbee/app/builder/Z3GatewayHost/kk_tsl_zigbee_map.h
+15
-9
platform/zigbee/app/builder/Z3GatewayHost/rpc_api/src/rpc_interface_parse.c
...p/builder/Z3GatewayHost/rpc_api/src/rpc_interface_parse.c
+1
-1
No files found.
platform/zigbee/app/builder/Z3GatewayHost/Makefile
View file @
a66362ff
...
@@ -281,8 +281,9 @@ APPLICATION_FILES= \
...
@@ -281,8 +281,9 @@ APPLICATION_FILES= \
./ZB/zb_device_id.c
\
./ZB/zb_device_id.c
\
./ZB/kk_device_manager.c
\
./ZB/kk_device_manager.c
\
./ZB/kk_product_code.c
\
./ZB/kk_product_code.c
\
./ZB/kk_device_control.c
\
./ZB/kk_zigbee_api.c
\
./ZB/kk_zigbee_api.c
\
./ZB/kk_tsl_property_report.c
\
./ZB/kk_tsl_property_set.c
\
./kk_test.c
\
./kk_test.c
\
./kk_sub_tsl.c
\
./kk_sub_tsl.c
\
./kk_tsl_zigbee_map.c
\
./kk_tsl_zigbee_map.c
\
...
...
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_control.c
deleted
100644 → 0
View file @
f4929f7d
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_control.h
deleted
100644 → 0
View file @
f4929f7d
#ifndef __KK_DEVICE_CONTROL_H
#define __KK_DEVICE_CONTROL_H
#endif
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.c
View file @
a66362ff
...
@@ -220,7 +220,7 @@ static void kk_device_table_load(void)
...
@@ -220,7 +220,7 @@ static void kk_device_table_load(void)
FILE
*
fp
;
FILE
*
fp
;
int
i
;
int
i
;
EmberEUI64
mac
;
EmberEUI64
mac
;
uint16_t
nodeId
;
//to do:诡异
uint16_t
nodeId
;
uint16_t
deviceId
;
uint16_t
deviceId
;
uint16_t
len
;
uint16_t
len
;
char
pCode
[
33
];
char
pCode
[
33
];
...
...
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.c
0 → 100644
View file @
a66362ff
#include "kk_tsl_property_report.h"
const
char
*
kk_tsl_rpt_status_string
[]
=
{
"Success"
,
"Error"
,
"Invaild Value"
,
"Invaild Len"
,
"Invaild Type"
};
static
int
kk_tsl_report
(
EmberEUI64
mac
,
uint8_t
EP
,
int
status
,
uint16_t
clusterId
,
uint16_t
attributeId
)
{
cJSON
*
root
;
int
index
;
sub_dev_node_t
*
node
=
NULL
;
char
macString
[
RPC_EUI64_STRING_LENGTH
];
rpc_eui64ToString
(
mac
,
macString
);
root
=
rpc_cJSON_CreateObject
();
index
=
kk_get_tsl_index
(
EP
,
clusterId
,
attributeId
);
if
(
index
<
0
)
return
tsl_rpt_err
;
rpc_cJSON_AddNumberToObject
(
root
,
g_tsl_zigbee_map
[
index
].
Identity
,
status
);
kk_rpc_report_status
(
root
,
mac
);
return
tsl_rpt_success
;
}
void
kk_tsl_report_attribute
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
)
{
int
i
,
j
,
num
,
status
;
UTIL_LOG_INFO
(
"
\n
********************kk tsl report attribute********************
\n
"
);
emberAfDebugPrint
(
"mac:"
);
emberAfGetEui64
(
eui64
);
emberAfPrintBigEndianEui64
(
eui64
);
emberAfDebugPrintln
(
",ep:%d,clu:0x%04X,attr:0x%04X,dataType=0x%02x,len=%d,data:"
,
EP
,
clusterId
,
attributeId
,
dataType
,
len
);
emberAfDebugPrintBuffer
(
data
,
len
,
true
);
num
=
kk_get_tsl_num
();
for
(
i
=
0
;
i
<
num
;
i
++
){
if
(
g_tsl_zigbee_map
[
i
].
clusterId
==
clusterId
&&
g_tsl_zigbee_map
[
i
].
attributeId
==
attributeId
&&
g_tsl_zigbee_map
[
i
].
zigbee_report
!=
NULL
){
status
=
g_tsl_zigbee_map
[
i
].
zigbee_report
(
eui64
,
EP
,
clusterId
,
attributeId
,
dataType
,
len
,
data
);
emberAfDebugPrintln
(
"report status:%s"
,
kk_tsl_rpt_status_string
[
status
]);
return
;
}
}
}
int
kk_tsl_report_global_onoff
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
)
{
uint8_t
OnOff
;
emberAfAppPrintln
(
"[tsl report:Gloabl] OnOff~~~~~~~~~"
);
if
(
dataType
==
ZCL_BOOLEAN_ATTRIBUTE_TYPE
){
if
(
len
==
1
){
OnOff
=
data
[
0
];
if
(
OnOff
==
0
||
OnOff
==
1
){
kk_tsl_report
(
eui64
,
EP
,
OnOff
,
clusterId
,
attributeId
);
return
tsl_rpt_success
;
}
return
tsl_rpt_invaild_val
;
}
return
tsl_rpt_invaild_len
;
}
return
tsl_rpt_invaild_type
;
}
int
kk_tsl_report_windowCovering_mode
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
)
{
uint8_t
mode
;
emberAfAppPrintln
(
"[tsl report:Window Covering] Mode~~~~~~~~~"
);
if
(
dataType
==
ZCL_BITMAP8_ATTRIBUTE_TYPE
){
if
(
len
==
1
){
if
(
data
[
0
]
&
BIT
(
1
)){
mode
=
WC_calibration_mode
;
}
else
if
(
data
[
0
]
&
BIT
(
0
)){
mode
=
WC_reversed_dir
;
}
else
{
mode
=
WC_normal_dir
;
}
kk_tsl_report
(
eui64
,
EP
,
mode
,
clusterId
,
attributeId
);
return
tsl_rpt_success
;
}
return
tsl_rpt_invaild_len
;
}
return
tsl_rpt_invaild_type
;
}
int
kk_tsl_report_windowCovering_position
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
)
{
uint8_t
position
;
emberAfAppPrintln
(
"[tsl report:Window Covering] Position~~~~~~~~~"
);
if
(
dataType
==
ZCL_INT8U_ATTRIBUTE_TYPE
){
if
(
len
==
1
){
position
=
data
[
0
];
kk_tsl_report
(
eui64
,
EP
,
position
,
clusterId
,
attributeId
);
return
tsl_rpt_success
;
}
return
tsl_rpt_invaild_len
;
}
return
tsl_rpt_invaild_type
;
}
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.h
0 → 100644
View file @
a66362ff
#ifndef __KK_TSL_PROPERTY_REPORT_H
#define __KK_TSL_PROPERTY_REPORT_H
#include "kk_test.h"
typedef
enum
{
tsl_rpt_success
=
0
,
tsl_rpt_err
=
-
1
,
tsl_rpt_invaild_val
=
-
2
,
tsl_rpt_invaild_len
=
-
3
,
tsl_rpt_invaild_type
=
-
4
,
}
kk_tsl_rpt_status
;
void
kk_tsl_report_attribute
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_tsl_report_global_onoff
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_tsl_report_windowCovering_mode
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_tsl_report_windowCovering_position
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
#endif
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.c
0 → 100644
View file @
a66362ff
#include "kk_tsl_property_set.h"
//emberAfAppPrintln("[tsl report:Gloabl] OnOff~~~~~~~~~");
//cJSON *rpc_Control(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
;
int
res
=
0
;
rpc_nwk_info_s
info
;
EmberStatus
status
;
int
index
=
0
;
int
num
;
cJSON
*
propertyItem
=
NULL
;
EmberEUI64
eui64
;
EmberNodeId
nodeId
=
EMBER_AF_PLUGIN_DEVICE_TABLE_NULL_NODE_ID
;
UTIL_LOG_INFO
(
"
\n
********************kk tsl property operation********************
\n
"
);
if
(
params
==
NULL
){
set_json_error_type
(
ctx
,
JRPC_INVALID_PARAMS
,
MSG_INVALID_PARAMS
);
goto
error_return
;
}
else
{
res
=
kk_sub_tsl_get_device_by_mac
(
mac
->
valuestring
,
&
node
);
if
(
res
!=
SUCCESS_RETURN
)
{
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
set_json_error_type
(
ctx
,
JRPC_INVALID_PARAMS
,
MSG_INVALID_PARAMS
);
goto
error_return
;
}
num
=
kk_get_tsl_num
();
for
(
index
=
0
;
index
<
num
;
index
++
){
propertyItem
=
rpc_cJSON_GetObjectItem
(
params
,
g_tsl_zigbee_map
[
index
].
Identity
);
if
(
propertyItem
!=
NULL
)
{
int
value
=
0
;
if
(
propertyItem
->
type
!=
cJSON_Number
){
value
=
rpc_get_u8
(
propertyItem
->
valuestring
);
}
else
{
value
=
propertyItem
->
valueint
;
}
if
(
rpc_get_mac
(
mac
->
valuestring
,
eui64
)
==
false
){
set_json_error_type
(
ctx
,
JRPC_INVALID_PARAMS
,
MSG_INVALID_PARAMS
);
goto
error_return
;
}
nodeId
=
emberAfDeviceTableGetNodeIdFromEui64
(
eui64
);
emberAfDebugPrint
(
"mac:"
);
emberAfPrintBigEndianEui64
(
eui64
);
emberAfDebugPrintln
(
",node:0x%04X"
,
nodeId
);
res
=
g_tsl_zigbee_map
[
index
].
zigbee_set
(
ctx
,
mac
->
valuestring
,
g_tsl_zigbee_map
[
index
].
endpoint
,
&
value
);
if
(
res
<
0
)
{
set_json_error_type
(
ctx
,
JRPC_INVALID_PARAMS
,
MSG_INVALID_PARAMS
);
goto
error_return
;
}
else
{
return
rpc_cJSON_CreateNumber
(
res
);
}
}
}
}
error_return:
return
rpc_cJSON_CreateNull
();
}
int
kk_tsl_set_windowCovering_OperationMode
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
)
{
uint8_t
Operation
=
0
;
EmberStatus
status
=
0
;
Operation
=
*
(
uint8_t
*
)
data
;
emberAfAppPrintln
(
"[tsl set:Window Covering Operation Mode],mode=0x%02x"
,
Operation
);
if
(
node
==
EMBER_AF_PLUGIN_DEVICE_TABLE_NULL_NODE_ID
){
if
(
ctx
)
set_json_error_type
(
ctx
,
JRPC_INVALID_PARAMS
,
MSG_INVALID_PARAMS
);
goto
error_return
;
}
if
(
Operation
==
0
){
status
=
WindowCover_UpOpen
(
node
,
ep
);
emberAfAppPrintln
(
"Up/Open"
);
}
else
if
(
Operation
==
1
){
status
=
WindowCover_DownClose
(
node
,
ep
);
emberAfAppPrintln
(
"Down/Close"
);
}
else
if
(
Operation
==
2
){
status
=
WindowCover_Stop
(
node
,
ep
);
emberAfAppPrintln
(
"Stop"
);
}
else
{
if
(
ctx
)
set_json_error_type
(
ctx
,
JRPC_INVALID_PARAMS
,
MSG_INVALID_PARAMS
);
goto
error_return
;
}
emberAfAppPrintln
(
"status=0x%02x"
,
status
);
return
status
;
error_return:
return
-
1
;
}
int
kk_tsl_set_windowCovering_mode
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
)
{
uint8_t
mode
=
0
;
uint8_t
WCmode
=
0
;
EmberStatus
status
=
0
;
mode
=
*
(
uint8_t
*
)
data
;
emberAfAppPrintln
(
"[tsl set:Window Covering Run Mode],mode=0x%02x"
,
mode
);
if
(
mode
==
WC_calibration_mode
){
WCmode
|=
BIT
(
1
);
status
=
zclGWrite
(
node
,
1
,
ep
,
false
,
ZCL_WINDOW_COVERING_CLUSTER_ID
,
ZCL_MODE_ATTRIBUTE_ID
,
ZCL_BITMAP8_ATTRIBUTE_TYPE
,
1
,
WCmode
,
true
);
emberAfAppPrintln
(
"Calibration Mode"
);
}
else
if
(
mode
==
WC_reversed_dir
){
WCmode
|=
BIT
(
0
);
status
=
zclGWrite
(
node
,
1
,
ep
,
false
,
ZCL_WINDOW_COVERING_CLUSTER_ID
,
ZCL_MODE_ATTRIBUTE_ID
,
ZCL_BITMAP8_ATTRIBUTE_TYPE
,
1
,
WCmode
,
true
);
emberAfAppPrintln
(
"Dir:reversed"
);
}
else
if
(
mode
==
WC_normal_dir
){
WCmode
=
0
;
status
=
zclGWrite
(
node
,
1
,
ep
,
false
,
ZCL_WINDOW_COVERING_CLUSTER_ID
,
ZCL_MODE_ATTRIBUTE_ID
,
ZCL_BITMAP8_ATTRIBUTE_TYPE
,
1
,
WCmode
,
true
);
emberAfAppPrintln
(
"Dir:Normal"
);
}
else
{
if
(
ctx
)
set_json_error_type
(
ctx
,
JRPC_INVALID_PARAMS
,
MSG_INVALID_PARAMS
);
goto
error_return
;
}
emberAfAppPrintln
(
"status=0x%02x"
,
status
);
return
status
;
error_return:
return
-
1
;
}
int
kk_tsl_set_windowCovering_position
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
)
{
uint8_t
position
=
0
;
EmberStatus
status
=
0
;
position
=
*
(
uint8_t
*
)
data
;
emberAfAppPrintln
(
"[tsl set:Window Covering Position],position=0x%02x"
,
position
);
status
=
WindowCover_GotoLiftPercentage
(
node
,
ep
,
position
);
emberAfAppPrintln
(
"status=0x%02x"
,
status
);
return
status
;
error_return:
return
-
1
;
}
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.h
0 → 100644
View file @
a66362ff
#ifndef __KK_TSL_PROPERTY_SET_H
#define __KK_TSL_PROPERTY_SET_H
#include "kk_test.h"
cJSON
*
kk_tsl_property_operation
(
jrpc_context
*
ctx
,
cJSON
*
params
,
cJSON
*
id
,
cJSON
*
mac
);
int
kk_tsl_set_windowCovering_OperationMode
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
int
kk_tsl_set_windowCovering_mode
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
int
kk_tsl_set_windowCovering_position
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
#endif
platform/zigbee/app/builder/Z3GatewayHost/kk_test.c
View file @
a66362ff
This diff is collapsed.
Click to expand it.
platform/zigbee/app/builder/Z3GatewayHost/kk_test.h
View file @
a66362ff
...
@@ -8,6 +8,8 @@
...
@@ -8,6 +8,8 @@
#include "zb_device_id.h"
#include "zb_device_id.h"
#include "kk_device_manager.h"
#include "kk_device_manager.h"
#include "kk_zigbee_api.h"
#include "kk_zigbee_api.h"
#include "kk_tsl_property_report.h"
#include "kk_tsl_property_set.h"
#define KK_REPORT_DEVICE_JOINED_TYPE "/thing/topo/add"
#define KK_REPORT_DEVICE_JOINED_TYPE "/thing/topo/add"
#define KK_REPORT_DEVICE_LEFT_TYPE "/thing/topo/delete"
#define KK_REPORT_DEVICE_LEFT_TYPE "/thing/topo/delete"
...
@@ -26,28 +28,12 @@
...
@@ -26,28 +28,12 @@
#define GW_DEVICE_CODE "1122334455667788"
#define GW_DEVICE_CODE "1122334455667788"
#define KK_EP(x) (x)
#define KK_DUMMY_EP KK_EP(0)
#define KK_PRIMARY_EP KK_EP(1)
#define KK_DUMMY_CLUSTER_ID 0xffff
#define KK_DUMMY_ATTRIBUTE_ID 0xffff
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
);
int
kk_zcl_onoff_set
(
jrpc_context
*
ctx
,
const
char
*
mac
,
unsigned
char
ep
,
void
*
data
);
int
kk_zcl_onoff_set
(
jrpc_context
*
ctx
,
const
char
*
mac
,
unsigned
char
ep
,
void
*
data
);
int
kk_zcl_windowCovering_OperationMode_set
(
jrpc_context
*
ctx
,
const
char
*
mac
,
unsigned
char
ep
,
void
*
data
);
int
kk_zcl_windowCovering_mode_set
(
jrpc_context
*
ctx
,
const
char
*
mac
,
unsigned
char
ep
,
void
*
data
);
int
kk_zcl_windowCovering_position_set
(
jrpc_context
*
ctx
,
const
char
*
mac
,
unsigned
char
ep
,
void
*
data
);
int
kk_report_global_onoff_attribute
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_report_windowCovering_mode_attribute
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_report_windowCovering_position_attribute
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
...
@@ -57,18 +43,12 @@ int kk_sendData2CCU(char* data, int len);
...
@@ -57,18 +43,12 @@ int kk_sendData2CCU(char* data, int len);
int
rpc_nwkPermitJoin
(
jrpc_context
*
ctx
,
const
char
*
mac
,
unsigned
char
ep
,
void
*
data
);
int
rpc_nwkPermitJoin
(
jrpc_context
*
ctx
,
const
char
*
mac
,
unsigned
char
ep
,
void
*
data
);
void
kk_dispatch_report_attribute
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
#define RPC_KK_TEST_FUNCTION_TABLE \
#define RPC_KK_TEST_FUNCTION_TABLE \
{(rpc_function*)
rpc_Control
,"/thing/service/property/set"},\
{(rpc_function*)
kk_tsl_property_operation
,"/thing/service/property/set"},\
{(rpc_function*)
rpc_Control
,KK_READ_ATTRIBUTE_METHOD}
{(rpc_function*)
kk_tsl_property_operation
,KK_READ_ATTRIBUTE_METHOD}
...
...
platform/zigbee/app/builder/Z3GatewayHost/kk_tsl_zigbee_map.c
View file @
a66362ff
...
@@ -3,44 +3,28 @@
...
@@ -3,44 +3,28 @@
#include "kk_product_code.h"
#include "kk_product_code.h"
kk_tsl_zigbee_map_t
g_tsl_zigbee_map
[]
=
{
{
kk_tsl_zigbee_map_t
g_tsl_zigbee_map
[]
=
{
ZIGBEE_COO_PRODUCT_CODE
,
{
"NetChannelState"
,
KK_DUMMY_EP
,
rpc_nwkPermitJoin
,
0xffff
,
0xffff
,
NULL
},
1
,
{
"OperationMode"
,
KK_PRIMARY_EP
,
kk_tsl_set_windowCovering_OperationMode
,
ZCL_ON_OFF_CLUSTER_ID
,
ZCL_ON_OFF_ATTRIBUTE_ID
,
kk_tsl_report_global_onoff
},
//开
{
{
"WorkMode"
,
KK_PRIMARY_EP
,
kk_tsl_set_windowCovering_mode
,
ZCL_WINDOW_COVERING_CLUSTER_ID
,
ZCL_MODE_ATTRIBUTE_ID
,
kk_tsl_report_windowCovering_mode
},
{
KK_TSL_DATA_TYPE_TEXT
,
"NetChannelState"
,
KK_DUMMY_EP
,
rpc_nwkPermitJoin
,
0
,
0
,
NULL
},
{
"Position"
,
KK_PRIMARY_EP
,
kk_tsl_set_windowCovering_position
,
ZCL_WINDOW_COVERING_CLUSTER_ID
,
ZCL_CURRENT_LIFT_PERCENTAGE_ATTRIBUTE_ID
,
kk_tsl_report_windowCovering_position
},
}
},
{
TEST_PRODUCT_CODE
,
3
,
{
{
KK_TSL_DATA_TYPE_TEXT
,
"OperationMode"
,
KK_PRIMARY_EP
,
kk_zcl_windowCovering_OperationMode_set
,
ZCL_ON_OFF_CLUSTER_ID
,
ZCL_ON_OFF_ATTRIBUTE_ID
,
kk_report_global_onoff_attribute
},
//开
{
KK_TSL_DATA_TYPE_TEXT
,
"WorkMode"
,
KK_PRIMARY_EP
,
kk_zcl_windowCovering_mode_set
,
ZCL_WINDOW_COVERING_CLUSTER_ID
,
ZCL_MODE_ATTRIBUTE_ID
,
kk_report_windowCovering_mode_attribute
},
{
KK_TSL_DATA_TYPE_TEXT
,
"Position"
,
KK_PRIMARY_EP
,
kk_zcl_windowCovering_position_set
,
ZCL_WINDOW_COVERING_CLUSTER_ID
,
ZCL_CURRENT_LIFT_PERCENTAGE_ATTRIBUTE_ID
,
kk_report_windowCovering_position_attribute
},
}
},
};
};
int
kk_
find_ctrl_obj
(
const
char
*
productCode
)
int
kk_
get_tsl_index
(
unsigned
char
EP
,
unsigned
short
clusterId
,
unsigned
short
attributeId
)
{
{
int
map_num
=
sizeof
(
g_tsl_zigbee_map
)
/
sizeof
(
kk_tsl_zigbee_map_t
)
;
int
i
;
int
index
=
0
;
for
(
i
ndex
=
0
;
index
<
map_num
;
index
++
)
for
(
i
=
0
;
i
<
sizeof
(
g_tsl_zigbee_map
)
/
sizeof
(
kk_tsl_zigbee_map_t
);
i
++
){
{
if
(
EP
==
g_tsl_zigbee_map
[
i
].
endpoint
&&
if
(
!
strcmp
(
productCode
,
g_tsl_zigbee_map
[
index
].
productCode
))
clusterId
==
g_tsl_zigbee_map
[
i
].
clusterId
&&
{
attributeId
==
g_tsl_zigbee_map
[
i
].
attributeId
)
{
return
i
ndex
;
return
i
;
}
}
}
}
return
-
1
;
return
-
1
;
}
}
int
kk_get_tsl_num
(
void
)
int
kk_get_Identity_Num
(
int
index
)
{
return
g_tsl_zigbee_map
[
index
].
num
;
}
int
kk_get_map_Num
(
void
)
{
{
return
sizeof
(
g_tsl_zigbee_map
)
/
sizeof
(
kk_tsl_zigbee_map_t
);
return
sizeof
(
g_tsl_zigbee_map
)
/
sizeof
(
kk_tsl_zigbee_map_t
);
}
}
...
...
platform/zigbee/app/builder/Z3GatewayHost/kk_tsl_zigbee_map.h
View file @
a66362ff
...
@@ -3,25 +3,31 @@
...
@@ -3,25 +3,31 @@
#include "RPC_API.h"
#include "RPC_API.h"
#include "kk_tsl_common.h"
#include "kk_tsl_common.h"
#define
PROPERTIES_MAX_NUM 20
#define
KK_EP(x) (x)
typedef
int
(
*
zigbee_property_set
)(
jrpc_context
*
ctx
,
const
char
*
mac
,
unsigned
char
ep
,
void
*
data
);
#define KK_DUMMY_EP KK_EP(0)
#define KK_PRIMARY_EP KK_EP(1)
#define KK_DUMMY_CLUSTER_ID 0xffff
#define KK_DUMMY_ATTRIBUTE_ID 0xffff
typedef
int
(
*
zigbee_property_set
)(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
typedef
int
(
*
kk_zigbee_property_report
)(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
typedef
int
(
*
kk_zigbee_property_report
)(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
typedef
struct
{
typedef
struct
{
int
type
;
char
*
Identity
;
char
*
Identity
;
unsigned
char
endpoint
;
unsigned
char
endpoint
;
zigbee_property_set
zigbee_set
;
zigbee_property_set
zigbee_set
;
unsigned
short
clusterId
;
unsigned
short
clusterId
;
unsigned
short
attributeId
;
unsigned
short
attributeId
;
kk_zigbee_property_report
zigbee_report
;
kk_zigbee_property_report
zigbee_report
;
}
kk_zigbee_ctrl_map_t
;
typedef
struct
{
char
*
productCode
;
int
num
;
kk_zigbee_ctrl_map_t
zigbee_ctrl
[
PROPERTIES_MAX_NUM
];
}
kk_tsl_zigbee_map_t
;
}
kk_tsl_zigbee_map_t
;
extern
kk_tsl_zigbee_map_t
g_tsl_zigbee_map
[];
int
kk_get_tsl_index
(
unsigned
char
EP
,
unsigned
short
clusterId
,
unsigned
short
attributeId
);
int
kk_get_tsl_num
(
void
);
#endif
#endif
platform/zigbee/app/builder/Z3GatewayHost/rpc_api/src/rpc_interface_parse.c
View file @
a66362ff
...
@@ -632,7 +632,7 @@ bool rpc_ReportAttributesCallback(EmberAfClusterId clusterId,
...
@@ -632,7 +632,7 @@ bool rpc_ReportAttributesCallback(EmberAfClusterId clusterId,
if
(
emberAfDeviceTableGetEui64FromNodeId
(
nodeId
,
nodeEui64
)){
if
(
emberAfDeviceTableGetEui64FromNodeId
(
nodeId
,
nodeEui64
)){
emberAfAppPrintln
(
"nodeId=0x%x"
,
nodeId
);
emberAfAppPrintln
(
"nodeId=0x%x"
,
nodeId
);
kk_
dispatch
_report_attribute
(
nodeEui64
,
ep
,
clusterId
,
attributeId
,
dataType
,
dataLen
,
dataPtr
);
kk_
tsl
_report_attribute
(
nodeEui64
,
ep
,
clusterId
,
attributeId
,
dataType
,
dataLen
,
dataPtr
);
}
}
...
...
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