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
800ea9db
Commit
800ea9db
authored
Sep 30, 2020
by
黄振令
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改内容】串口连接的ncp网关,打开GATEWAY_TYPE_NCP,通过nanomsg连接,不需要局域网发现
parent
2cdff660
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
11 deletions
+66
-11
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_msg_report.h
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_msg_report.h
+8
-0
platform/zigbee/app/builder/Z3GatewayHost/rpc_api/src/rpc_interface_parse.c
...p/builder/Z3GatewayHost/rpc_api/src/rpc_interface_parse.c
+58
-11
No files found.
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_msg_report.h
View file @
800ea9db
...
...
@@ -32,6 +32,14 @@
#define GW2CCU_PROTOCOL "tcp"
//#define GATEWAY_TYPE_NCP
#ifdef GATEWAY_TYPE_NCP
#undef GW2CCU_PROTOCOL
#define GW2CCU_PROTOCOL "nanomsg"
#endif
...
...
platform/zigbee/app/builder/Z3GatewayHost/rpc_api/src/rpc_interface_parse.c
View file @
800ea9db
...
...
@@ -538,15 +538,63 @@ int kk_connect_check(){
void
ipcHandle
(
void
)
{
#ifdef GATEWAY_TYPE_NCP
kk_print_info
(
"Thread rpc Interface Parse create
\n
"
);
_init_param
(
&
my_server
);
char
*
macString
=
kk_get_gw_mac
();
if
(
macString
==
NULL
){
kk_print_error
(
"[%s] get mac fail, exit pthread !!!!!!!!!!!!!!!!!
\n
"
,
__FUNCTION__
);
return
;
}
kk_ipc_init
(
IPC_PLAT2MID
,
_cb
,
macString
,
"127.0.0.1"
);
kk_print_info
(
"sizeof(rpc_table)=%d,sizeof(rpc_table_s)=%d,%d
\n
"
,
sizeof
(
rpc_table
),
sizeof
(
rpc_table_s
),
sizeof
(
rpc_table
)
/
sizeof
(
rpc_table_s
));
for
(
int
i
=
0
;
i
<
sizeof
(
rpc_table
)
/
sizeof
(
rpc_table_s
);
i
++
){
kk_print_debug
(
"i=%d,%s
\r\n
"
,
i
,
rpc_table
[
i
].
name
);
jrpc_register_procedure
(
&
my_server
,
rpc_table
[
i
].
func
,
rpc_table
[
i
].
name
,
NULL
);
}
//send add gw to ccu
char
*
outbuf
=
_msg_topo_add
();
if
(
outbuf
==
NULL
){
kk_print_error
(
"[%s] topo add msg failed, exit
\n
"
,
__FUNCTION__
);
return
;
}
kk_print_info
(
"check nanomsg is connect(%d)
\n
"
,
kk_ipc_isconnect
(
IPC_PLAT2MID
));
kk_ipc_send
(
IPC_PLAT2MID
,
outbuf
,
strlen
(
outbuf
)
+
1
);
free
(
outbuf
);
char
*
postmsg
=
_msg_event_property_post
(
"127.0.0.1"
,
0
);
if
(
postmsg
==
NULL
){
kk_print_error
(
"[%s] property_post msg failed
\n
"
,
__FUNCTION__
);
return
;
}
kk_ipc_send
(
IPC_PLAT2MID
,
postmsg
,
strlen
(
postmsg
)
+
1
);
free
(
postmsg
);
//handle procidure
while
(
1
){
//
usleep
(
20000
);
}
#else
char
deviceCode
[
33
]
=
{
0
};
char
ip
[
16
]
=
{
0
};
int
port
=
0
;
emberAfAppPrint
(
"Thread rpc Interface Parse create
\n
"
);
kk_print_info
(
"Thread rpc Interface Parse create
\n
"
);
search_ccu
(
deviceCode
,
ip
,
&
port
);
_init_param
(
&
my_server
);
char
*
macString
=
kk_get_gw_mac
();
if
(
macString
==
NULL
){
printf
(
"[%s] get mac fail, exit pthread !!!!!!!!!!!!!!!!!
\n
"
,
__FUNCTION__
);
kk_print_error
(
"[%s] get mac fail, exit pthread !!!!!!!!!!!!!!!!!
\n
"
,
__FUNCTION__
);
return
;
}
if
(
strcmp
(
GW2CCU_PROTOCOL
,
"tcp"
)
==
0
){
...
...
@@ -555,9 +603,9 @@ void ipcHandle(void)
kk_ipc_init
(
IPC_PLAT2MID
,
_cb
,
macString
,
ip
);
}
emberAfAppPrint
(
"sizeof(rpc_table)=%d,sizeof(rpc_table_s)=%d,%d
\n
"
,
sizeof
(
rpc_table
),
sizeof
(
rpc_table_s
),
sizeof
(
rpc_table
)
/
sizeof
(
rpc_table_s
));
kk_print_info
(
"sizeof(rpc_table)=%d,sizeof(rpc_table_s)=%d,%d
\n
"
,
sizeof
(
rpc_table
),
sizeof
(
rpc_table_s
),
sizeof
(
rpc_table
)
/
sizeof
(
rpc_table_s
));
for
(
int
i
=
0
;
i
<
sizeof
(
rpc_table
)
/
sizeof
(
rpc_table_s
);
i
++
){
emberAfAppPrint
(
"i=%d,%s
\r\n
"
,
i
,
rpc_table
[
i
].
name
);
kk_print_info
(
"i=%d,%s
\r\n
"
,
i
,
rpc_table
[
i
].
name
);
jrpc_register_procedure
(
&
my_server
,
rpc_table
[
i
].
func
,
rpc_table
[
i
].
name
,
NULL
);
}
...
...
@@ -565,11 +613,11 @@ void ipcHandle(void)
char
*
outbuf
=
_msg_topo_add
();
if
(
outbuf
==
NULL
){
printf
(
"[%s] topo add msg failed, exit
\n
"
,
__FUNCTION__
);
kk_print_error
(
"[%s] topo add msg failed, exit
\n
"
,
__FUNCTION__
);
return
;
}
if
(
strcmp
(
GW2CCU_PROTOCOL
,
"tcp"
)
!=
0
){
printf
(
"check nanomsg is connect(%d)
\n
"
,
kk_ipc_isconnect
(
IPC_PLAT2MID
));
kk_print_info
(
"check nanomsg is connect(%d)
\n
"
,
kk_ipc_isconnect
(
IPC_PLAT2MID
));
}
kk_sendData2CCU
(
outbuf
,
strlen
(
outbuf
));
free
(
outbuf
);
...
...
@@ -585,9 +633,9 @@ void ipcHandle(void)
char
gwIp
[
17
]
=
{
0
};
HAL_Get_IP
(
gwIp
,
NULL
);
char
*
postmsg
=
_msg_event_property_post
(
gwIp
,
port
);
if
(
outbuf
==
NULL
){
if
(
postmsg
==
NULL
){
printf
(
"[%s] property_post msg failed
\n
"
,
__FUNCTION__
);
kk_print_error
(
"[%s] property_post msg failed
\n
"
,
__FUNCTION__
);
continue
;
}
kk_sendData2CCU
(
postmsg
,
strlen
(
postmsg
));
...
...
@@ -608,7 +656,7 @@ void ipcHandle(void)
outbuf
=
_msg_topo_add
();
if
(
outbuf
==
NULL
){
printf
(
"[%s] topo add msg failed, exit
\n
"
,
__FUNCTION__
);
kk_print_error
(
"[%s] topo add msg failed, exit
\n
"
,
__FUNCTION__
);
return
;
}
kk_sendData2CCU
(
outbuf
,
strlen
(
outbuf
));
...
...
@@ -619,8 +667,7 @@ void ipcHandle(void)
}
//jrpc_server_run(&my_server);
//jrpc_server_destroy(&my_server);
#endif
}
...
...
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