@@ -151,7 +151,6 @@ static void ot_rpc_encode_network_diag_tlv(struct nrf_rpc_cbor_ctx *ctx,
151151 nrf_rpc_encode_uint64 (ctx , aNetworkDiagTlv -> mData .mMleCounters .mDetachedTime );
152152 nrf_rpc_encode_uint64 (ctx , aNetworkDiagTlv -> mData .mMleCounters .mChildTime );
153153 nrf_rpc_encode_uint64 (ctx , aNetworkDiagTlv -> mData .mMleCounters .mRouterTime );
154- nrf_rpc_encode_uint64 (ctx , aNetworkDiagTlv -> mData .mMleCounters .mParentChanges );
155154 nrf_rpc_encode_uint64 (ctx , aNetworkDiagTlv -> mData .mMleCounters .mLeaderTime );
156155 break ;
157156 case OT_NETWORK_DIAGNOSTIC_TLV_BATTERY_LEVEL :
@@ -310,61 +309,54 @@ static void ot_rpc_cmd_send_diagnostic_get(const struct nrf_rpc_group *group,
310309 struct nrf_rpc_cbor_ctx * ctx , void * handler_data )
311310{
312311 otIp6Address addr ;
313- otError error ;
314- uint8_t count ;
315- uint8_t tlvTypes [ 35 ] ;
312+ otError error = OT_ERROR_INVALID_ARGS ;
313+ size_t count ;
314+ const uint8_t * tlvTypes ;
316315
317316 nrf_rpc_decode_buffer (ctx , addr .mFields .m8 , OT_IP6_ADDRESS_SIZE );
318317
319- count = nrf_rpc_decode_uint (ctx );
318+ tlvTypes = nrf_rpc_decode_buffer_ptr_and_size (ctx , & count );
320319
321- zcbor_list_start_decode (ctx -> zs );
322- for (int i = 0 ; i < count ; i ++ ) {
323- tlvTypes [i ] = nrf_rpc_decode_uint (ctx );
320+ if (tlvTypes ) {
321+ openthread_api_mutex_lock (openthread_get_default_context ());
322+ error = otThreadSendDiagnosticGet (openthread_get_default_instance (), & addr ,
323+ tlvTypes , count , handle_receive_diagnostic_get ,
324+ NULL );
325+ openthread_api_mutex_unlock (openthread_get_default_context ());
324326 }
325- zcbor_list_end_decode (ctx -> zs );
326327
327328 if (!nrf_rpc_decoding_done_and_check (group , ctx )) {
328329 ot_rpc_report_cmd_decoding_error (OT_RPC_CMD_THREAD_SEND_DIAGNOSTIC_GET );
329330 return ;
330331 }
331332
332- openthread_api_mutex_lock (openthread_get_default_context ());
333- error = otThreadSendDiagnosticGet (openthread_get_default_instance (), & addr , tlvTypes , count ,
334- handle_receive_diagnostic_get , NULL );
335- openthread_api_mutex_unlock (openthread_get_default_context ());
336-
337333 nrf_rpc_rsp_send_uint (group , error );
338334}
339335
340336static void ot_rpc_cmd_send_diagnostic_reset (const struct nrf_rpc_group * group ,
341337 struct nrf_rpc_cbor_ctx * ctx , void * handler_data )
342338{
343339 otIp6Address addr ;
344- otError error ;
345- uint8_t count ;
346- uint8_t tlvTypes [ 35 ] ;
340+ otError error = OT_ERROR_INVALID_ARGS ;
341+ size_t count ;
342+ const uint8_t * tlvTypes ;
347343
348344 nrf_rpc_decode_buffer (ctx , addr .mFields .m8 , OT_IP6_ADDRESS_SIZE );
349345
350- count = nrf_rpc_decode_uint (ctx );
346+ tlvTypes = nrf_rpc_decode_buffer_ptr_and_size (ctx , & count );
351347
352- zcbor_list_start_decode (ctx -> zs );
353- for (int i = 0 ; i < count ; i ++ ) {
354- tlvTypes [i ] = nrf_rpc_decode_uint (ctx );
348+ if (tlvTypes ) {
349+ openthread_api_mutex_lock (openthread_get_default_context ());
350+ error = otThreadSendDiagnosticReset (openthread_get_default_instance (), & addr ,
351+ tlvTypes , count );
352+ openthread_api_mutex_unlock (openthread_get_default_context ());
355353 }
356- zcbor_list_end_decode (ctx -> zs );
357354
358355 if (!nrf_rpc_decoding_done_and_check (group , ctx )) {
359356 ot_rpc_report_cmd_decoding_error (OT_RPC_CMD_THREAD_SEND_DIAGNOSTIC_RESET );
360357 return ;
361358 }
362359
363- openthread_api_mutex_lock (openthread_get_default_context ());
364- error = otThreadSendDiagnosticReset (openthread_get_default_instance (), & addr , tlvTypes ,
365- count );
366- openthread_api_mutex_lock (openthread_get_default_context ());
367-
368360 nrf_rpc_rsp_send_uint (group , error );
369361}
370362
0 commit comments