Skip to content

Commit d50ebae

Browse files
alxelaxrlubos
authored andcommitted
net: openthread: rpc: split cmd and rsp error reports
Commit splits function about error reports on command and response error reports. Signed-off-by: Aleksandr Khromykh <[email protected]>
1 parent 77b3230 commit d50ebae

20 files changed

+92
-88
lines changed

subsys/net/openthread/rpc/client/ot_rpc_coap.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ static void ot_rpc_cmd_coap_resource_handler(const struct nrf_rpc_group *group,
333333
ot_rpc_decode_message_info(ctx, &message_info);
334334

335335
if (!nrf_rpc_decoding_done_and_check(group, ctx)) {
336-
ot_rpc_report_decoding_error(OT_RPC_CMD_COAP_RESOURCE_HANDLER);
336+
ot_rpc_report_cmd_decoding_error(OT_RPC_CMD_COAP_RESOURCE_HANDLER);
337337
return;
338338
}
339339

@@ -378,7 +378,7 @@ static void ot_rpc_cmd_coap_default_handler(const struct nrf_rpc_group *group,
378378
ot_rpc_decode_message_info(ctx, &message_info);
379379

380380
if (!nrf_rpc_decoding_done_and_check(group, ctx)) {
381-
ot_rpc_report_decoding_error(OT_RPC_CMD_COAP_DEFAULT_HANDLER);
381+
ot_rpc_report_cmd_decoding_error(OT_RPC_CMD_COAP_DEFAULT_HANDLER);
382382
return;
383383
}
384384

@@ -445,12 +445,12 @@ static void ot_rpc_cmd_coap_response_handler(const struct nrf_rpc_group *group,
445445
error = nrf_rpc_decode_uint(ctx);
446446

447447
if (!nrf_rpc_decoding_done_and_check(group, ctx)) {
448-
ot_rpc_report_decoding_error(OT_RPC_CMD_COAP_RESPONSE_HANDLER);
448+
ot_rpc_report_cmd_decoding_error(OT_RPC_CMD_COAP_RESPONSE_HANDLER);
449449
return;
450450
}
451451

452452
if (request_rep == 0 || request_rep > ARRAY_SIZE(requests)) {
453-
ot_rpc_report_decoding_error(OT_RPC_CMD_COAP_RESPONSE_HANDLER);
453+
ot_rpc_report_cmd_decoding_error(OT_RPC_CMD_COAP_RESPONSE_HANDLER);
454454
return;
455455
}
456456

subsys/net/openthread/rpc/client/ot_rpc_diag.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static void get_uint_t(int id, void *result, size_t result_size)
3636

3737
value = nrf_rpc_decode_uint(&ctx);
3838
if (!nrf_rpc_decoding_done_and_check(&ot_group, &ctx)) {
39-
ot_rpc_report_decoding_error(id);
39+
ot_rpc_report_rsp_decoding_error(id);
4040
return;
4141
}
4242

@@ -59,7 +59,7 @@ static int get_string(int id, char *buffer, size_t buffer_size)
5959
}
6060

6161
if (!nrf_rpc_decoding_done_and_check(&ot_group, &ctx)) {
62-
ot_rpc_report_decoding_error(id);
62+
ot_rpc_report_rsp_decoding_error(id);
6363
return 0;
6464
}
6565

@@ -93,7 +93,7 @@ const otExtAddress *otLinkGetExtendedAddress(otInstance *aInstance)
9393

9494
if (ret_size != sizeof(mac.m8)) {
9595
LOG_ERR("Received mac addr size is too short");
96-
ot_rpc_report_decoding_error(OT_RPC_CMD_LINK_GET_EXTENDED_ADDRESS);
96+
ot_rpc_report_rsp_decoding_error(OT_RPC_CMD_LINK_GET_EXTENDED_ADDRESS);
9797
}
9898

9999
return &mac;

subsys/net/openthread/rpc/client/ot_rpc_if.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ static void ot_rpc_cmd_if_receive(const struct nrf_rpc_group *group, struct nrf_
231231

232232
if (!nrf_rpc_decoding_done_and_check(group, ctx)) {
233233
NET_ERR("Failed to decode packet data");
234-
ot_rpc_report_decoding_error(OT_RPC_CMD_IF_RECEIVE);
234+
ot_rpc_report_cmd_decoding_error(OT_RPC_CMD_IF_RECEIVE);
235235
if (pkt) {
236236
net_pkt_unref(pkt);
237237
}

subsys/net/openthread/rpc/client/ot_rpc_instance.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static void ot_rpc_cmd_state_changed(const struct nrf_rpc_group *group,
129129
flags = nrf_rpc_decode_uint(ctx);
130130

131131
if (!nrf_rpc_decoding_done_and_check(group, ctx)) {
132-
ot_rpc_report_decoding_error(OT_RPC_CMD_STATE_CHANGED);
132+
ot_rpc_report_cmd_decoding_error(OT_RPC_CMD_STATE_CHANGED);
133133
return;
134134
}
135135

subsys/net/openthread/rpc/client/ot_rpc_ip6.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ bool otIp6IsEnabled(otInstance *aInstance)
153153
enabled = nrf_rpc_decode_bool(&ctx);
154154

155155
if (!nrf_rpc_decoding_done_and_check(&ot_group, &ctx)) {
156-
ot_rpc_report_decoding_error(OT_RPC_CMD_IP6_IS_ENABLED);
156+
ot_rpc_report_rsp_decoding_error(OT_RPC_CMD_IP6_IS_ENABLED);
157157
}
158158

159159
return enabled;

subsys/net/openthread/rpc/client/ot_rpc_link.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ uint32_t otLinkGetPollPeriod(otInstance *aInstance)
4040
poll_period = nrf_rpc_decode_uint(&ctx);
4141

4242
if (!nrf_rpc_decoding_done_and_check(&ot_group, &ctx)) {
43-
ot_rpc_report_decoding_error(OT_RPC_CMD_LINK_GET_POLL_PERIOD);
43+
ot_rpc_report_rsp_decoding_error(OT_RPC_CMD_LINK_GET_POLL_PERIOD);
4444
}
4545

4646
return poll_period;

subsys/net/openthread/rpc/client/ot_rpc_message.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ otMessage *otUdpNewMessage(otInstance *aInstance, const otMessageSettings *aSett
5151

5252
key = nrf_rpc_decode_uint(&ctx);
5353
if (!nrf_rpc_decoding_done_and_check(&ot_group, &ctx)) {
54-
ot_rpc_report_decoding_error(OT_RPC_CMD_UDP_NEW_MESSAGE);
54+
ot_rpc_report_rsp_decoding_error(OT_RPC_CMD_UDP_NEW_MESSAGE);
5555
return msg;
5656
}
5757

@@ -70,7 +70,7 @@ void otMessageFree(otMessage *aMessage)
7070
nrf_rpc_cbor_cmd_rsp_no_err(&ot_group, OT_RPC_CMD_MESSAGE_FREE, &ctx);
7171

7272
if (!nrf_rpc_decoding_done_and_check(&ot_group, &ctx)) {
73-
ot_rpc_report_decoding_error(OT_RPC_CMD_MESSAGE_FREE);
73+
ot_rpc_report_rsp_decoding_error(OT_RPC_CMD_MESSAGE_FREE);
7474
}
7575
}
7676

@@ -88,7 +88,7 @@ uint16_t otMessageGetLength(const otMessage *aMessage)
8888
ret = nrf_rpc_decode_uint(&ctx);
8989

9090
if (!nrf_rpc_decoding_done_and_check(&ot_group, &ctx)) {
91-
ot_rpc_report_decoding_error(OT_RPC_CMD_MESSAGE_GET_LENGTH);
91+
ot_rpc_report_rsp_decoding_error(OT_RPC_CMD_MESSAGE_GET_LENGTH);
9292
return 0;
9393
}
9494

@@ -109,7 +109,7 @@ uint16_t otMessageGetOffset(const otMessage *aMessage)
109109
ret = nrf_rpc_decode_uint(&ctx);
110110

111111
if (!nrf_rpc_decoding_done_and_check(&ot_group, &ctx)) {
112-
ot_rpc_report_decoding_error(OT_RPC_CMD_MESSAGE_GET_OFFSET);
112+
ot_rpc_report_rsp_decoding_error(OT_RPC_CMD_MESSAGE_GET_OFFSET);
113113
return 0;
114114
}
115115

@@ -142,7 +142,7 @@ uint16_t otMessageRead(const otMessage *aMessage, uint16_t aOffset, void *aBuf,
142142
}
143143

144144
if (!nrf_rpc_decoding_done_and_check(&ot_group, &ctx)) {
145-
ot_rpc_report_decoding_error(OT_RPC_CMD_MESSAGE_READ);
145+
ot_rpc_report_rsp_decoding_error(OT_RPC_CMD_MESSAGE_READ);
146146
return 0;
147147
}
148148

subsys/net/openthread/rpc/client/ot_rpc_netdata.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ otError otNetDataGet(otInstance *aInstance, bool aStable, uint8_t *aData, uint8_
3333
error = nrf_rpc_decode_uint(&ctx);
3434

3535
if (!nrf_rpc_decoding_done_and_check(&ot_group, &ctx)) {
36-
ot_rpc_report_decoding_error(OT_RPC_CMD_NETDATA_GET);
36+
ot_rpc_report_rsp_decoding_error(OT_RPC_CMD_NETDATA_GET);
3737
return OT_ERROR_FAILED;
3838
}
3939

@@ -55,7 +55,7 @@ otError otNetDataGetNextService(otInstance *aInstance, otNetworkDataIterator *aI
5555
error = nrf_rpc_decode_uint(&ctx);
5656

5757
if (!nrf_rpc_decoding_done_and_check(&ot_group, &ctx)) {
58-
ot_rpc_report_decoding_error(OT_RPC_CMD_NETDATA_GET_NEXT_SERVICE);
58+
ot_rpc_report_rsp_decoding_error(OT_RPC_CMD_NETDATA_GET_NEXT_SERVICE);
5959
return OT_ERROR_FAILED;
6060
}
6161

@@ -78,7 +78,7 @@ otError otNetDataGetNextOnMeshPrefix(otInstance *aInstance, otNetworkDataIterato
7878
error = nrf_rpc_decode_uint(&ctx);
7979

8080
if (!nrf_rpc_decoding_done_and_check(&ot_group, &ctx)) {
81-
ot_rpc_report_decoding_error(OT_RPC_CMD_NETDATA_GET_NEXT_ON_MESH_PREFIX);
81+
ot_rpc_report_rsp_decoding_error(OT_RPC_CMD_NETDATA_GET_NEXT_ON_MESH_PREFIX);
8282
return OT_ERROR_FAILED;
8383
}
8484

subsys/net/openthread/rpc/client/ot_rpc_srp_client.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ static void ot_rpc_cmd_srp_client_cb(const struct nrf_rpc_group *group,
354354
if (!service_prev_next) {
355355
/* Provided service pointer unknown to the client */
356356
nrf_rpc_cbor_decoding_done(&ot_group, ctx);
357-
ot_rpc_report_decoding_error(OT_RPC_CMD_SRP_CLIENT_CB);
357+
ot_rpc_report_cmd_decoding_error(OT_RPC_CMD_SRP_CLIENT_CB);
358358
return;
359359
}
360360

@@ -369,7 +369,7 @@ static void ot_rpc_cmd_srp_client_cb(const struct nrf_rpc_group *group,
369369
}
370370

371371
if (!nrf_rpc_decoding_done_and_check(group, ctx)) {
372-
ot_rpc_report_decoding_error(OT_RPC_CMD_SRP_CLIENT_CB);
372+
ot_rpc_report_cmd_decoding_error(OT_RPC_CMD_SRP_CLIENT_CB);
373373
return;
374374
}
375375

@@ -392,7 +392,7 @@ static void ot_rpc_cmd_srp_client_auto_start_cb(const struct nrf_rpc_group *grou
392392
addr.mPort = nrf_rpc_decode_uint(ctx);
393393

394394
if (!nrf_rpc_decoding_done_and_check(group, ctx)) {
395-
ot_rpc_report_decoding_error(OT_RPC_CMD_SRP_CLIENT_AUTO_START_CB);
395+
ot_rpc_report_cmd_decoding_error(OT_RPC_CMD_SRP_CLIENT_AUTO_START_CB);
396396
return;
397397
}
398398

subsys/net/openthread/rpc/client/ot_rpc_thread.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static void ot_rpc_thread_discover_cb_rpc_handler(const struct nrf_rpc_group *gr
4242
callback = (otHandleActiveScanResult)nrf_rpc_decode_callback_call(ctx);
4343

4444
if (!nrf_rpc_decoding_done_and_check(group, ctx)) {
45-
ot_rpc_report_decoding_error(OT_RPC_CMD_THREAD_DISCOVER_CB);
45+
ot_rpc_report_cmd_decoding_error(OT_RPC_CMD_THREAD_DISCOVER_CB);
4646
return;
4747
}
4848

@@ -117,7 +117,7 @@ otDeviceRole otThreadGetDeviceRole(otInstance *aInstance)
117117
role = nrf_rpc_decode_uint(&ctx);
118118

119119
if (!nrf_rpc_decoding_done_and_check(&ot_group, &ctx)) {
120-
ot_rpc_report_decoding_error(OT_RPC_CMD_THREAD_GET_DEVICE_ROLE);
120+
ot_rpc_report_rsp_decoding_error(OT_RPC_CMD_THREAD_GET_DEVICE_ROLE);
121121
}
122122

123123
return role;
@@ -166,7 +166,7 @@ otLinkModeConfig otThreadGetLinkMode(otInstance *aInstance)
166166
mode_mask = nrf_rpc_decode_uint(&ctx);
167167

168168
if (!nrf_rpc_decoding_done_and_check(&ot_group, &ctx)) {
169-
ot_rpc_report_decoding_error(OT_RPC_CMD_THREAD_GET_LINK_MODE);
169+
ot_rpc_report_rsp_decoding_error(OT_RPC_CMD_THREAD_GET_LINK_MODE);
170170
mode_mask = 0;
171171
}
172172

0 commit comments

Comments
 (0)