Skip to content

Commit f4100a5

Browse files
Damian-Nordicrlubos
authored andcommitted
nrf_rpc: detect reboot of the remote
Pull new nRF RPC API that can be used to detect reboot of the remote. Use the API in protocols_serialization client. Signed-off-by: Damian Krolik <[email protected]>
1 parent 33af323 commit f4100a5

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

samples/nrf_rpc/protocols_serialization/client/src/main.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,50 @@
99
#include <nrf_rpc.h>
1010

1111
LOG_MODULE_REGISTER(nrf_ps_client, CONFIG_NRF_PS_CLIENT_LOG_LEVEL);
12+
NRF_RPC_GROUP_DECLARE(ot_group);
13+
NRF_RPC_GROUP_DECLARE(bt_rpc_grp);
1214

1315
static void err_handler(const struct nrf_rpc_err_report *report)
1416
{
1517
LOG_ERR("nRF RPC error %d ocurred. See nRF RPC logs for more details", report->code);
1618
}
1719

20+
static void bound_handler(const struct nrf_rpc_group *group)
21+
{
22+
#ifdef CONFIG_OPENTHREAD_RPC_CLIENT
23+
static bool ot_group_initialized;
24+
25+
if (group == &ot_group) {
26+
if (ot_group_initialized) {
27+
LOG_WRN("OT RPC peer reset detected");
28+
/* The code to restore the state of OT on the server can be added here */
29+
} else {
30+
ot_group_initialized = true;
31+
}
32+
}
33+
#endif
34+
#ifdef CONFIG_BT_RPC_CLIENT
35+
static bool bt_group_initialized;
36+
37+
if (group == &bt_rpc_grp) {
38+
if (bt_group_initialized) {
39+
LOG_WRN("BT RPC peer reset detected");
40+
/* The code to restore the state of BT on the server can be added here */
41+
} else {
42+
bt_group_initialized = true;
43+
}
44+
}
45+
#endif
46+
}
47+
1848
int main(void)
1949
{
2050
int ret;
2151

2252
LOG_INF("Initializing RPC client");
2353

54+
nrf_rpc_set_bound_handler(bound_handler);
55+
2456
ret = nrf_rpc_init(err_handler);
2557

2658
if (ret != 0) {

west.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ manifest:
146146
- name: nrfxlib
147147
repo-path: sdk-nrfxlib
148148
path: nrfxlib
149-
revision: b3f964ad783cc0d32c27829faddc7836d6175993
149+
revision: 7777351c2babe02f49c10868c1a39104e42553b3
150150
- name: trusted-firmware-m
151151
repo-path: sdk-trusted-firmware-m
152152
path: modules/tee/tf-m/trusted-firmware-m

0 commit comments

Comments
 (0)