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
5bd87730
Commit
5bd87730
authored
Oct 22, 2020
by
尹佳钦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
b7f0c6d5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
77 additions
and
45 deletions
+77
-45
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.c
...m/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.c
+6
-2
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.c
...bee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.c
+2
-0
platform/zigbee/app/builder/Z3GatewayHost/kk_test.c
platform/zigbee/app/builder/Z3GatewayHost/kk_test.c
+0
-1
platform/zigbee/app/builder/Z3GatewayHost/rpc_api/inc/rpc_interface_parse.h
...p/builder/Z3GatewayHost/rpc_api/inc/rpc_interface_parse.h
+1
-1
platform/zigbee/app/builder/Z3GatewayHost/rpc_api/src/rpc_interface_parse.c
...p/builder/Z3GatewayHost/rpc_api/src/rpc_interface_parse.c
+64
-37
platform/zigbee/app/builder/Z3GatewayHost/yjq_ezsp.c
platform/zigbee/app/builder/Z3GatewayHost/yjq_ezsp.c
+2
-2
platform/zigbee/protocol/zigbee/app/framework/util/af-main-host.c
.../zigbee/protocol/zigbee/app/framework/util/af-main-host.c
+2
-2
No files found.
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.c
View file @
5bd87730
...
...
@@ -494,9 +494,13 @@ void kk_device_config_item_report(EmberEUI64 eui64,uint8_t EP,EmberAfClusterId c
kk_rpc_report
func
;
pCode
=
kk_device_find_productCode
(
eui64
);
cfgMap
=
kk_device_config_find
(
pCode
);
if
(
cfgMap
==
NULL
)
return
;
if
(
cfgMap
==
NULL
)
{
emberAfDebugPrintln
(
"cfgMap==NULL!"
);
return
;
}
item
=
&
cfgMap
->
item
;
while
(
item
!=
NULL
){
...
...
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.c
View file @
5bd87730
...
...
@@ -62,12 +62,14 @@ static int kk_tsl_report(EmberEUI64 mac,uint8_t EP,int status,uint16_t clusterId
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
();
dev
=
kk_device_find_by_mac
(
mac
);
if
(
dev
==
NULL
){
printf
(
"mac:%s not find in zb dev table!!!
\n
"
,
macString
);
return
tsl_rpt_err
;
}
printf
(
"[%s][%d]dev->productCode:%s
\n
"
,
__FUNCTION__
,
__LINE__
,
dev
->
productCode
);
...
...
platform/zigbee/app/builder/Z3GatewayHost/kk_test.c
View file @
5bd87730
...
...
@@ -205,7 +205,6 @@ void emberAfMainTickCallback(void)
unsigned
int
time
=
halCommonGetInt32uMillisecondTick
();
kk_sub_dev_manage
();
ncp_queue_tick
();
if
((
time
-
last_time
)
>=
3000
){
last_time
=
time
;
...
...
platform/zigbee/app/builder/Z3GatewayHost/rpc_api/inc/rpc_interface_parse.h
View file @
5bd87730
...
...
@@ -9,7 +9,7 @@
void
ipcHandle
(
void
);
void
get_prey
_handle
(
void
);
void
ncp_queue
_handle
(
void
);
void
rpc_reportDevices
(
void
);
...
...
platform/zigbee/app/builder/Z3GatewayHost/rpc_api/src/rpc_interface_parse.c
View file @
5bd87730
...
...
@@ -72,31 +72,49 @@ rpc_table_s rpc_table[]={
void
kk_tsl_msg_ack
(
c
har
*
productCode
,
char
*
deviceCode
)
void
kk_tsl_msg_ack
(
c
onst
char
*
id
,
const
char
*
ackMsgType
,
const
char
*
productCode
,
const
char
*
deviceCode
)
{
cJSON
*
root
=
rpc_cJSON_CreateObject
();
cJSON
*
info
=
rpc_cJSON_CreateObject
();
cJSON
*
payload
=
rpc_cJSON_CreateObject
();
cJSON
*
data
=
rpc_cJSON_CreateObject
();
rpc_cJSON_AddItemToObject
(
root
,
"info"
,
info
);
rpc_cJSON_AddItemToObject
(
root
,
"payload"
,
payload
);
rpc_cJSON_AddStringToObject
(
info
,
"msgType"
,
"/thing/service/property/get_reply"
);
rpc_cJSON_AddStringToObject
(
info
,
"msgType"
,
ackMsgType
);
rpc_cJSON_AddStringToObject
(
info
,
"productCode"
,
productCode
);
rpc_cJSON_AddStringToObject
(
info
,
"deviceCode"
,
deviceCode
);
rpc_cJSON_AddStringToObject
(
payload
,
"msgId"
,
"*******"
);
rpc_cJSON_AddStringToObject
(
payload
,
"msgId"
,
id
);
rpc_cJSON_AddNullToObject
(
payload
,
"code"
);
rpc_cJSON_AddItemToObject
(
payload
,
"data"
,
data
);
jrpc_send_msg
(
root
);
rpc_cJSON_Delete
(
root
);
}
static
int
send_result_resp
(
cJSON
*
result
,
cJSON
*
id
)
{
static
int
kk_tsl_send_msg_ack
(
const
char
*
msgType
,
const
char
*
productCode
,
const
char
*
deviceCode
,
const
char
*
id
)
{
cJSON
*
root
=
rpc_cJSON_CreateObject
();
cJSON
*
info
=
rpc_cJSON_CreateObject
();
cJSON
*
payload
=
rpc_cJSON_CreateObject
();
rpc_cJSON_AddItemToObject
(
root
,
"info"
,
info
);
rpc_cJSON_AddItemToObject
(
root
,
"payload"
,
payload
);
rpc_cJSON_AddStringToObject
(
info
,
"msgType"
,
"/thing/service/property/get_reply"
);
rpc_cJSON_AddStringToObject
(
info
,
"productCode"
,
productCode
);
rpc_cJSON_AddStringToObject
(
info
,
"deviceCode"
,
deviceCode
);
rpc_cJSON_AddStringToObject
(
payload
,
"msgId"
,
"*******"
);
return
0
;
}
static
int
send_result_resp
(
int
code
,
char
*
message
,
cJSON
*
id
)
{
}
static
int
send_error_resp
(
int
code
,
char
*
message
,
cJSON
*
id
)
{
...
...
@@ -164,7 +182,7 @@ static int invoke_procedure(struct jrpc_server *server,
if
(
ctx
.
error_code
)
return
send_error_resp
(
ctx
.
error_code
,
ctx
.
error_message
,
id
);
else
return
send_result_resp
(
returned
,
id
);
return
0
;
//
send_result_resp(returned, id);
}
}
...
...
@@ -191,7 +209,7 @@ static int eval_request(struct jrpc_server *server, cJSON *root) {
if
(
strcmp
(
msgType
->
valuestring
,
"/thing/service/property/get"
)
==
0
)
kk_tsl_msg_ack
(
productCode
->
valuestring
,
deviceCode
->
valuestring
);
kk_tsl_msg_ack
(
id
,
msgType
->
valuestring
,
productCode
->
valuestring
,
deviceCode
->
valuestring
);
return
invoke_procedure
(
server
,
msgType
->
valuestring
,
params
,
id_copy
,
deviceCode
);
...
...
@@ -206,19 +224,7 @@ static int eval_request(struct jrpc_server *server, cJSON *root) {
#define KK_THING_OTA_DEVICE_UPGRADE "/ota/device/upgrade"
void
ncp_queue_tick
(
void
)
{
cJSON
*
root
=
NULL
;
char
*
str
;
if
(
ncp_queue_dequeue
(
REV_MSG
,
&
root
)
==
0
){
str
=
rpc_cJSON_Print
(
root
);
printf
(
"Dequeue cJson = %s
\n
"
,
str
);
free
(
str
);
eval_request
(
&
my_server
,
root
);
rpc_cJSON_Delete
(
root
);
}
}
void
_cb
(
void
*
data
,
int
len
,
char
*
chlmark
){
if
(
data
!=
NULL
){
printf
(
"plat_cb: %s [%d]RECEIVED
\r\n
"
,
data
,
len
);
...
...
@@ -530,26 +536,50 @@ int kk_connect_check(){
}
}
void
get_prey_handle
(
void
)
static
void
_msg_deal_from_mid
(
void
)
{
cJSON
*
root
=
NULL
;
char
*
str
;
if
(
ncp_queue_dequeue
(
REV_MSG
,
&
root
)
==
0
){
str
=
rpc_cJSON_Print
(
root
);
printf
(
"Dequeue cJson = %s
\n
"
,
str
);
free
(
str
);
eval_request
(
&
my_server
,
root
);
rpc_cJSON_Delete
(
root
);
}
}
static
void
_get_prey_from_dev
(
void
)
{
get_property_data_s
*
data
;
EmberStatus
status
;
while
(
1
){
if
(
ncp_queue_dequeue
(
GET_PROPERTY
,
&
data
)
==
0
){
printf
(
"
\n
================dequeue==================
\n
"
);
printf
(
"node = 0x%04X,ep=%d,clu=0x%04X,len=%d
\n
"
,
data
->
node
,
data
->
ep
,
data
->
clu
,
data
->
len
);
for
(
int
i
=
0
;
i
<
data
->
len
;
i
++
){
printf
(
"attr=0x%04X
\n
"
,
data
->
attr
[
i
]);
}
status
=
zclGReadAttrs
(
data
->
node
,
1
,
data
->
ep
,
false
,
data
->
clu
,
data
->
len
,
data
->
attr
,
true
);
free
(
data
->
attr
);
free
(
data
);
if
(
ncp_queue_dequeue
(
GET_PROPERTY
,
&
data
)
==
0
){
printf
(
"
\n
================dequeue==================
\n
"
);
printf
(
"node = 0x%04X,ep=%d,clu=0x%04X,len=%d
\n
"
,
data
->
node
,
data
->
ep
,
data
->
clu
,
data
->
len
);
for
(
int
i
=
0
;
i
<
data
->
len
;
i
++
){
printf
(
"attr=0x%04X
\n
"
,
data
->
attr
[
i
]);
}
status
=
zclGReadAttrs
(
data
->
node
,
1
,
data
->
ep
,
false
,
data
->
clu
,
data
->
len
,
data
->
attr
,
true
);
free
(
data
->
attr
);
free
(
data
);
}
}
void
ncp_queue_handle
(
void
)
{
UTIL_LOG_INFO
(
"
\n
ncp_queue_handle start~~~~~~~~~~~~~~~~~~~~
\n
"
);
while
(
1
){
_msg_deal_from_mid
();
_get_prey_from_dev
();
usleep
(
100000
);
}
UTIL_LOG_WARNING
(
"
\n
ncp_queue_handle end!!!!!!!!!!!!!!!!!!!
\n
"
);
}
void
ipcHandle
(
void
)
...
...
@@ -728,10 +758,7 @@ static void rpc_send_message(cJSON *data,char *method)
jrpc_send_msg
(
item
);
}
void
rpc_read_attribute_response
(
cJSON
*
data
)
{
rpc_send_message
(
data
,
"read_attribute_response"
);
}
void
rpc_report_attribute
(
cJSON
*
data
)
{
...
...
@@ -921,6 +948,7 @@ bool rpc_ReadAttributesResponseCallback(EmberAfClusterId clusterId,
uint8_t
*
dataPtr
=
&
bufferTemp
[
ATTRIBUTE_BUFFER_REPORT_DATA_TYPE
+
1
+
1
+
typeSize
];
rpc_cJSON_AddDataToObject
(
item_attr
,
dataPtr
,
dataLen
);
UTIL_LOG_INFO
(
"
\n
kk_device_config_item_report~~~~~~~~~~~~~~~~~~~~
\n
"
);
kk_device_config_item_report
(
nodeEui64
,
ep
,
clusterId
,
attributeId
,
dataType
,
dataLen
,
dataPtr
);
kk_read_attr_response
(
nodeId
,
...
...
@@ -949,7 +977,6 @@ bool rpc_ReadAttributesResponseCallback(EmberAfClusterId clusterId,
i
=
i
+
bufferSize
;
}
rpc_read_attribute_response
(
item
);
return
false
;
}
...
...
platform/zigbee/app/builder/Z3GatewayHost/yjq_ezsp.c
View file @
5bd87730
...
...
@@ -95,7 +95,7 @@ extern void test_123(int val);
extern
void
kk_ota_test111
();
extern
void
kk_ota_test123123123
();
extern
void
aaaBBB
();
extern
void
kk_tsl_msg_ack
(
c
har
*
productCode
,
char
*
deviceCode
);
extern
void
kk_tsl_msg_ack
(
c
onst
char
*
id
,
const
char
*
ackMsgType
,
const
char
*
productCode
,
const
char
*
deviceCode
);
void
kk_message_process
(
char
*
messageString
)
{
...
...
@@ -122,7 +122,7 @@ void kk_message_process(char *messageString)
}
if
(
MEMCOMPARE
(
messageString
,
"AT+TEST
\r\n
"
,
len
)
==
0
){
aaaBBB
();
kk_tsl_msg_ack
(
"123"
,
"456"
);
kk_tsl_msg_ack
(
"
666"
,
"/thing/event/property/post_reply"
,
"
123"
,
"456"
);
}
}
...
...
platform/zigbee/protocol/zigbee/app/framework/util/af-main-host.c
View file @
5bd87730
...
...
@@ -534,7 +534,7 @@ void chip_reset()
void
emberAfMainInit
(
void
)
{
chip_reset
();
//
chip_reset();
}
int
emberAfMain
(
MAIN_FUNCTION_PARAMETERS
)
...
...
@@ -599,7 +599,7 @@ int emberAfMain(MAIN_FUNCTION_PARAMETERS)
pthread_t
prey_tid
;
//pthread_create(&tid, NULL, rpcInterfaceParse, NULL);
pthread_create
(
&
tid
,
NULL
,
ipcHandle
,
NULL
);
pthread_create
(
&
prey_tid
,
NULL
,
get_prey
_handle
,
NULL
);
pthread_create
(
&
prey_tid
,
NULL
,
ncp_queue
_handle
,
NULL
);
// initialize the ZCL framework ,(plug in) ,mqtt init is here
emAfInit
();
...
...
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