Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions nrf_rpc/include/nrf_rpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ enum nrf_rpc_err_src {
NRF_RPC_ERR_SRC_RECV, /**< @brief Error during receiving */
NRF_RPC_ERR_SRC_SEND, /**< @brief Error during sending */
NRF_RPC_ERR_SRC_REMOTE, /**< @brief Error reported be the remote */
NRF_RPC_ERR_SRC_REBOOT, /**< @brief Error due to reboot of the remote */
};

/* Helper nRF group structure declaration needed for callback definition. */
Expand Down
7 changes: 7 additions & 0 deletions nrf_rpc/nrf_rpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ struct internal_task {
const struct nrf_rpc_group *group;
bool send_reply;
bool signal_groups_init_event;
bool signal_reboot;
} group_init;

struct {
Expand Down Expand Up @@ -379,6 +380,11 @@ static void internal_tx_handler(void)
case NRF_RPC_TASK_GROUP_INIT: {
const struct nrf_rpc_group *group = task.group_init.group;

if (task.group_init.signal_reboot) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... Why should device send error instead of notifying application about rebooted remote and reply to remote?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nrf_rpc_err does notify the application about the error, and only sends the error in certain cases. But I would say, you probably will like #1583 approach more than this one :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the another one is better.

nrf_rpc_err(-NRF_ECONNRESET, NRF_RPC_ERR_SRC_REBOOT, group,
NRF_RPC_ID_UNKNOWN, NRF_RPC_PACKET_TYPE_INIT);
}

if (task.group_init.send_reply && group_init_send(group)) {
NRF_RPC_ERR("Failed to send group init packet for group id: %d strid: %s",
group->data->src_group_id, group->strid);
Expand Down Expand Up @@ -710,6 +716,7 @@ static int init_packet_handle(struct header *hdr, const struct nrf_rpc_group **g
internal_task.group_init.group = *group;
internal_task.group_init.send_reply = send_reply;
internal_task.group_init.signal_groups_init_event = signal_groups_init_event;
internal_task.group_init.signal_reboot = send_reply && !first_init;
nrf_rpc_os_thread_pool_send((const uint8_t *)&internal_task, sizeof(internal_task));
nrf_rpc_os_event_wait(&internal_task_consumed, NRF_RPC_OS_WAIT_FOREVER);
}
Expand Down
Loading