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
222a4bc1
Commit
222a4bc1
authored
Sep 17, 2020
by
尹佳钦
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://172.17.3.10:17001/chenweican/k-sdk
parents
e61338d5
a84179ef
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
80 additions
and
76 deletions
+80
-76
platform/zigbee/app/builder/Z3GatewayHost/ZB/dev_config_table/device_3001.json
...uilder/Z3GatewayHost/ZB/dev_config_table/device_3001.json
+5
-12
platform/zigbee/app/builder/Z3GatewayHost/ZB/dev_config_table/device_3002.json
...uilder/Z3GatewayHost/ZB/dev_config_table/device_3002.json
+12
-12
platform/zigbee/app/builder/Z3GatewayHost/ZB/dev_config_table/device_3003.json
...uilder/Z3GatewayHost/ZB/dev_config_table/device_3003.json
+18
-18
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.c
...m/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.c
+1
-19
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.h
...m/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.h
+20
-0
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.c
...bee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.c
+22
-14
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_zigbee_api.h
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_zigbee_api.h
+1
-1
platform/zigbee/app/builder/Z3GatewayHost/kk_test.h
platform/zigbee/app/builder/Z3GatewayHost/kk_test.h
+1
-0
No files found.
platform/zigbee/app/builder/Z3GatewayHost/ZB/dev_config_table/device_3001.json
View file @
222a4bc1
...
...
@@ -3,18 +3,11 @@
"config"
:[
{
"identity"
:
"PowerSwitch_1"
,
"endpoint"
:
18
,
"cluster"
:
"0x0011"
,
"attribute"
:
"0x0022"
,
"reportFunc"
:
"A"
,
"controlFunc"
:
"B"
},{
"identity"
:
"PowerSwitch_2"
,
"endpoint"
:
19
,
"cluster"
:
"0x0033"
,
"attribute"
:
"0x0044"
,
"reportFunc"
:
"C"
,
"controlFunc"
:
"D"
"endpoint"
:
1
,
"cluster"
:
"0x0006"
,
"attribute"
:
"0x0000"
,
"reportFunc"
:
"kk_tsl_report_global_onoff"
,
"controlFunc"
:
"zclOnOff"
}
]
}
platform/zigbee/app/builder/Z3GatewayHost/ZB/dev_config_table/device_3002.json
View file @
222a4bc1
...
...
@@ -2,19 +2,19 @@
"productCode"
:
"3002"
,
"config"
:[
{
"identity"
:
"
AAA
"
,
"endpoint"
:
1
1
,
"cluster"
:
"0x
1111
"
,
"attribute"
:
"0x
2222
"
,
"reportFunc"
:
"
zclOnOff_On
"
,
"controlFunc"
:
"zclOnOff
_On
"
"identity"
:
"
PowerSwitch_1
"
,
"endpoint"
:
1
,
"cluster"
:
"0x
0006
"
,
"attribute"
:
"0x
0000
"
,
"reportFunc"
:
"
kk_tsl_report_global_onoff
"
,
"controlFunc"
:
"zclOnOff"
},{
"identity"
:
"
BBB
"
,
"endpoint"
:
2
2
,
"cluster"
:
"0x
3333
"
,
"attribute"
:
"0x
4444
"
,
"reportFunc"
:
"
zclOnOff_O
ff"
,
"controlFunc"
:
"zclOnOff
_Off
"
"identity"
:
"
PowerSwitch_2
"
,
"endpoint"
:
2
,
"cluster"
:
"0x
0006
"
,
"attribute"
:
"0x
0000
"
,
"reportFunc"
:
"
kk_tsl_report_global_ono
ff"
,
"controlFunc"
:
"zclOnOff"
}
]
}
platform/zigbee/app/builder/Z3GatewayHost/ZB/dev_config_table/device_3003.json
View file @
222a4bc1
...
...
@@ -2,26 +2,26 @@
"productCode"
:
"3003"
,
"config"
:[
{
"identity"
:
"
AAA
"
,
"endpoint"
:
1
1
,
"cluster"
:
"0x
1111
"
,
"attribute"
:
"0x
2222
"
,
"reportFunc"
:
"
zclOnOff_On
"
,
"controlFunc"
:
"zclOnOff
_On
"
"identity"
:
"
PowerSwitch_1
"
,
"endpoint"
:
1
,
"cluster"
:
"0x
0006
"
,
"attribute"
:
"0x
0000
"
,
"reportFunc"
:
"
kk_tsl_report_global_onoff
"
,
"controlFunc"
:
"zclOnOff"
},{
"identity"
:
"
BBB
"
,
"endpoint"
:
2
2
,
"cluster"
:
"0x
3333
"
,
"attribute"
:
"0x
4444
"
,
"reportFunc"
:
"
zclOnOff_O
ff"
,
"controlFunc"
:
"zclOnOff
_Off
"
"identity"
:
"
PowerSwitch_2
"
,
"endpoint"
:
2
,
"cluster"
:
"0x
0006
"
,
"attribute"
:
"0x
0000
"
,
"reportFunc"
:
"
kk_tsl_report_global_ono
ff"
,
"controlFunc"
:
"zclOnOff"
},{
"identity"
:
"
CCCC
"
,
"endpoint"
:
3
3
,
"cluster"
:
"0x
5555
"
,
"attribute"
:
"0x
6666
"
,
"reportFunc"
:
"
zclOnOff_O
ff"
,
"controlFunc"
:
"zclOnOff
_Off
"
"identity"
:
"
PowerSwitch_3
"
,
"endpoint"
:
3
,
"cluster"
:
"0x
0006
"
,
"attribute"
:
"0x
0000
"
,
"reportFunc"
:
"
kk_tsl_report_global_ono
ff"
,
"controlFunc"
:
"zclOnOff"
}
]
}
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.c
View file @
222a4bc1
#include "kk_device_manager.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
...
...
@@ -417,24 +415,7 @@ char *kk_match_productCode(const char* modelId)
return
NULL
;
}
typedef
struct
kk_dev_config_item
{
char
*
identity
;
char
*
reportFuncName
;
char
*
controlFuncName
;
kk_rpc_report
*
reportFunc
;
kk_rpc_set
*
controlFunc
;
uint8_t
endpoint
;
uint16_t
cluster
;
uint16_t
attribute
;
struct
kk_dev_config_item
*
next
;
}
kk_dev_config_item
;
typedef
struct
kk_dev_config_map
{
char
*
productCode
;
kk_dev_config_item
item
;
struct
kk_dev_config_map
*
next
;
}
kk_dev_config_map
;
static
kk_dev_config_map
*
dev_config_map
=
NULL
;
#define KK_DEVICE_CONFIG_MAP_TABLE_FILE_PREFIX "./ZB/dev_config_table/device_%s.json"
...
...
@@ -449,6 +430,7 @@ kk_dev_config_item *kk_device_config_item_find_by_identity(kk_dev_config_map * m
if
(
!
strcmp
(
item
->
identity
,
identity
)){
return
item
;
}
item
=
item
->
next
;
}
return
NULL
;
}
...
...
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.h
View file @
222a4bc1
...
...
@@ -42,9 +42,29 @@ char *kk_match_productCode(const char* modelId);
bool
kk_device_config_map_add
(
const
char
*
productCode
);
typedef
int
(
*
kk_rpc_set
)(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
typedef
int
(
*
kk_rpc_report
)(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
typedef
struct
kk_dev_config_item
{
char
*
identity
;
char
*
reportFuncName
;
char
*
controlFuncName
;
kk_rpc_report
*
reportFunc
;
kk_rpc_set
*
controlFunc
;
uint8_t
endpoint
;
uint16_t
cluster
;
uint16_t
attribute
;
struct
kk_dev_config_item
*
next
;
}
kk_dev_config_item
;
typedef
struct
kk_dev_config_map
{
char
*
productCode
;
kk_dev_config_item
item
;
struct
kk_dev_config_map
*
next
;
}
kk_dev_config_map
;
...
...
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.c
View file @
222a4bc1
#include "kk_tsl_property_report.h"
#include "kk_tsl_zigbee_map.h"
#include "kk_device_manager.h"
const
char
*
kk_tsl_rpt_status_string
[]
=
{
"Success"
,
...
...
@@ -16,28 +17,35 @@ static int kk_tsl_report(EmberEUI64 mac,uint8_t EP,int status,uint16_t clusterId
char
*
Identify
;
sub_dev_node_t
*
node
=
NULL
;
kk_device_table_s
*
dev
;
kk_dev_config_map
*
dev_info
=
NULL
;
kk_dev_config_item
*
item
=
NULL
;
char
macString
[
RPC_EUI64_STRING_LENGTH
];
rpc_eui64ToString
(
mac
,
macString
);
root
=
rpc_cJSON_CreateObject
();
index
=
kk_get_tsl_index
(
EP
,
clusterId
,
attributeId
);
dev
=
kk_device_find_by_mac
(
mac
);
if
(
dev
==
NULL
){
return
tsl_rpt_err
;
}
printf
(
"[%s][%d]dev->productCode:%s
\n
"
,
__FUNCTION__
,
__LINE__
,
dev
->
productCode
);
dev_info
=
kk_device_config_find
(
dev
->
productCode
);
if
(
dev_info
==
NULL
){
return
tsl_rpt_err
;
}
if
(
index
<
0
){
dev
=
kk_device_find_by_mac
(
mac
);
if
(
dev
!=
NULL
){
index
=
kk_get_tsl_glb_index
(
dev
->
productCode
,
EP
,
clusterId
,
attributeId
);
}
if
(
index
<
0
){
return
tsl_rpt_err
;
}
else
{
Identify
=
g_tsl_zigbee_map_glb
[
index
].
map
.
Identity
;
item
=
&
dev_info
->
item
;
while
(
item
!=
NULL
){
if
(
EP
==
item
->
endpoint
&&
clusterId
==
item
->
cluster
&&
attributeId
==
item
->
attribute
){
Identify
=
item
->
identity
;
break
;
}
}
else
{
Identify
=
g_tsl_zigbee_map
[
index
].
Identity
;
item
=
item
->
next
;
}
rpc_cJSON_AddNumberToObject
(
root
,
Identify
,
status
);
kk_msg_report_property
(
root
,
mac
);
return
tsl_rpt_success
;
...
...
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_zigbee_api.h
View file @
222a4bc1
...
...
@@ -19,7 +19,7 @@ typedef struct{
void
kk_rpc_test
(
void
);
#define KK_RPC_SET_FUNCTION_TABLE {\
{
"zclOnOff
_On"
,
zclOnOff_On
},
\
{
"zclOnOff
"
,
kk_tsl_set_gloabl_OnOff
},
\
{
"zclOnOff_Off"
,
zclOnOff_Off
}
\
}
...
...
platform/zigbee/app/builder/Z3GatewayHost/kk_test.h
View file @
222a4bc1
...
...
@@ -14,6 +14,7 @@
#include "kk_device_table_db.h"
#define KK_REPORT_DEVICE_JOINED_TYPE "/thing/topo/add"
#define KK_REPORT_DEVICE_LEFT_TYPE "/thing/topo/delete"
#define KK_REPORT_ATTRIBUTE_TYPE "/thing/event/property/post"
...
...
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