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
e54d33e1
Commit
e54d33e1
authored
Sep 05, 2020
by
黄振令
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改内容】优化程序
【提交人】huang.zhenling
parent
af90a653
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
13 deletions
+30
-13
common/api/com_api.h
common/api/com_api.h
+1
-1
common/api/tcp_channel.c
common/api/tcp_channel.c
+1
-1
platform/zigbee/app/builder/Z3GatewayHost/rpc_api/src/rpc_interface_parse.c
...p/builder/Z3GatewayHost/rpc_api/src/rpc_interface_parse.c
+28
-11
No files found.
common/api/com_api.h
View file @
e54d33e1
...
@@ -40,7 +40,7 @@ typedef enum {
...
@@ -40,7 +40,7 @@ typedef enum {
typedef
void
ipc_cb
(
void
*
data
,
int
len
,
char
*
chalMark
);
typedef
void
ipc_cb
(
void
*
data
,
int
len
,
char
*
chalMark
);
int
kk_ipc_init
(
ipc_type
type
,
ipc_cb
cb
,
char
*
chalMark
,
char
*
ip
);
int
kk_ipc_init
(
ipc_type
type
,
ipc_cb
cb
,
char
*
chalMark
,
char
*
ip
);
int
kk_ipc_deinit
();
int
kk_ipc_deinit
(
ipc_type
type
);
int
kk_ipc_send
(
ipc_type
type
,
void
*
data
,
int
len
);
int
kk_ipc_send
(
ipc_type
type
,
void
*
data
,
int
len
);
int
kk_ipc_send_ex
(
ipc_type
type
,
void
*
data
,
int
len
,
char
*
chalMark
);
int
kk_ipc_send_ex
(
ipc_type
type
,
void
*
data
,
int
len
,
char
*
chalMark
);
...
...
common/api/tcp_channel.c
View file @
e54d33e1
...
@@ -338,7 +338,7 @@ static void read_cb(struct ev_loop *loop, struct ev_io *watcher, int revents)
...
@@ -338,7 +338,7 @@ static void read_cb(struct ev_loop *loop, struct ev_io *watcher, int revents)
free
(
watcher
);
free
(
watcher
);
}
else
{
}
else
{
//intf("READ:\r\n %s\r\n", buffer);
//intf("READ:\r\n %s\r\n", buffer);
printf
(
"read_cb deviceCode ip sock [%s][%s][%d]
"
,
tcp_ctrl
->
deviceCode
,
tcp_ctrl
->
ip
,
tcp_ctrl
->
sock
);
//printf("read_cb deviceCode ip sock [%s][%s][%d] \n
",tcp_ctrl->deviceCode,tcp_ctrl->ip, tcp_ctrl->sock);
if
(
g_cb
!=
NULL
){
if
(
g_cb
!=
NULL
){
g_cb
(
buffer
,
bytes
,
tcp_ctrl
->
deviceCode
);
g_cb
(
buffer
,
bytes
,
tcp_ctrl
->
deviceCode
);
}
}
...
...
platform/zigbee/app/builder/Z3GatewayHost/rpc_api/src/rpc_interface_parse.c
View file @
e54d33e1
...
@@ -459,17 +459,25 @@ int search_ccu(char devcode[33], char ip[16], int* port){
...
@@ -459,17 +459,25 @@ int search_ccu(char devcode[33], char ip[16], int* port){
void
*
_msg_topo_add
(){
void
*
_msg_topo_add
(){
char
msgFmt
[]
=
"{
\"
info
\"
:{
\"
msgtype
\"
:
\"
/thing/topo/add
\"
,
\"
productCode
\"
:
\"
%s
\"
,
\"
deviceCode
\"
:
\"
%s
\"
},\
char
msgFmt
[]
=
"{
\"
info
\"
:{
\"
msgtype
\"
:
\"
/thing/topo/add
\"
,
\"
productCode
\"
:
\"
%s
\"
,
\"
deviceCode
\"
:
\"
%s
\"
},\
\"
payload
\"
:{
\"
msgId
\"
:
\"
%d
\"
,
\"
version
\"
:
\"
1.0
\"
,
\"
params
\"
:{
\"
deviceCode
\"
:
\"
%s
\"
,
\"
productCode
\"
:
\"
%s
\"
,
\"
mac
\"
:
\"
%s
\"
}}}"
;
\"
payload
\"
:{
\"
msgId
\"
:
\"
%d
\"
,
\"
version
\"
:
\"
1.0
\"
,
\"
params
\"
:{
\"
deviceCode
\"
:
\"
%s
\"
,
\"
productCode
\"
:
\"
%s
\"
,
\"
mac
\"
:
\"
%s
\"
}}}"
;
char
msg
[
520
]
=
{
0
};
//char msg[520] = {0};
char
*
msg
=
NULL
;
char
*
macString
=
kk_get_gw_mac
();
char
*
macString
=
kk_get_gw_mac
();
if
(
macString
==
NULL
){
if
(
macString
==
NULL
){
printf
(
"[%s] get mac fail
\n
"
,
__FUNCTION__
);
printf
(
"[%s] get mac fail
\n
"
,
__FUNCTION__
);
return
NULL
;
return
NULL
;
}
}
msg
=
malloc
(
520
);
if
(
msg
==
NULL
){
printf
(
"[%s] msg malloc fail
\n
"
,
__FUNCTION__
);
return
NULL
;
}
sprintf
(
msg
,
msgFmt
,
GW_PRODUCT_CODE
,
macString
,
1
,
macString
,
GW_PRODUCT_CODE
,
macString
);
sprintf
(
msg
,
msgFmt
,
GW_PRODUCT_CODE
,
macString
,
1
,
macString
,
GW_PRODUCT_CODE
,
macString
);
cJSON
*
msgObj
=
cJSON_Parse
(
msg
);
//cJSON* msgObj = cJSON_Parse(msg);
char
*
outbuf
=
cJSON_Print
(
msgObj
);
//char* outbuf = cJSON_Print(msgObj);
cJSON_Delete
(
msgObj
);
//cJSON_Delete(msgObj);
return
outbuf
;
//return outbuf;
return
msg
;
}
}
...
@@ -480,18 +488,27 @@ void* _msg_event_property_post(char ip[16], int port){
...
@@ -480,18 +488,27 @@ void* _msg_event_property_post(char ip[16], int port){
\"
OnlineDetectionState
\"
:%d,
\"
SN
\"
:
\"
%s
\"
,
\"
IPAddress
\"
:
\"
%s
\"
,
\"
MACAddress
\"
:
\"
%s
\"
,
\"
Port
\"
:%d},\
\"
OnlineDetectionState
\"
:%d,
\"
SN
\"
:
\"
%s
\"
,
\"
IPAddress
\"
:
\"
%s
\"
,
\"
MACAddress
\"
:
\"
%s
\"
,
\"
Port
\"
:%d},\
\"
time
\"
:1524448722000,
\"
method
\"
:
\"
thing.event.property.post
\"
}\
\"
time
\"
:1524448722000,
\"
method
\"
:
\"
thing.event.property.post
\"
}\
}"
;
}"
;
char
msg
[
620
]
=
{
0
};
//char msg[620] = {0};
char
*
msg
=
NULL
;
char
*
macString
=
kk_get_gw_mac
();
char
*
macString
=
kk_get_gw_mac
();
if
(
macString
==
NULL
){
if
(
macString
==
NULL
){
printf
(
"[%s] get mac fail
\n
"
,
__FUNCTION__
);
printf
(
"[%s] get mac fail
\n
"
,
__FUNCTION__
);
return
NULL
;
return
NULL
;
}
}
msg
=
malloc
(
620
);
if
(
msg
==
NULL
){
printf
(
"[%s] msg malloc fail
\n
"
,
__FUNCTION__
);
return
NULL
;
}
sprintf
(
msg
,
msgFmt
,
GW_PRODUCT_CODE
,
macString
,
sprintf
(
msg
,
msgFmt
,
GW_PRODUCT_CODE
,
macString
,
1
,
0
,
0
,
0
,
"12345"
,
ip
,
macString
,
port
);
1
,
0
,
0
,
0
,
"12345"
,
ip
,
macString
,
port
);
cJSON
*
msgObj
=
cJSON_Parse
(
msg
);
//cJSON* msgObj = cJSON_Parse(msg);
char
*
outbuf
=
cJSON_Print
(
msgObj
);
//char* outbuf = cJSON_Print(msgObj);
cJSON_Delete
(
msgObj
);
//cJSON_Delete(msgObj);
return
outbuf
;
//return outbuf;
return
msg
;
}
}
...
...
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