@@ -223,42 +223,21 @@ void ot_rpc_decode_message_info(struct nrf_rpc_cbor_ctx *ctx, otMessageInfo *aMe
223223 aMessageInfo -> mMulticastLoop = nrf_rpc_decode_bool (ctx );
224224}
225225
226- bool ot_rpc_encode_service_config (struct nrf_rpc_cbor_ctx * ctx , const otServiceConfig * config )
226+ void ot_rpc_encode_service_config (struct nrf_rpc_cbor_ctx * ctx , const otServiceConfig * config )
227227{
228228
229229 if (config == NULL ) {
230- return zcbor_nil_put (ctx -> zs , NULL );
231- }
232-
233- if (!zcbor_uint_encode (ctx -> zs , & config -> mServiceId , sizeof (config -> mServiceId ))) {
234- return false;
235- }
236-
237- if (!zcbor_uint_encode (ctx -> zs , & config -> mEnterpriseNumber ,
238- sizeof (config -> mEnterpriseNumber ))) {
239- return false;
240- }
241-
242- if (!zcbor_bstr_encode_ptr (ctx -> zs , (const char * )& config -> mServiceData ,
243- config -> mServiceDataLength )) {
244- return false;
245- }
246-
247- if (!zcbor_bool_put (ctx -> zs , config -> mServerConfig .mStable )) {
248- return false;
249- }
250-
251- if (!zcbor_bstr_encode_ptr (ctx -> zs , (const char * )& config -> mServerConfig .mServerData ,
252- config -> mServerConfig .mServerDataLength )) {
253- return false;
254- }
255-
256- if (!zcbor_uint_encode (ctx -> zs , & config -> mServerConfig .mRloc16 ,
257- sizeof (config -> mServerConfig .mRloc16 ))) {
258- return false;
230+ nrf_rpc_encode_null (ctx );
231+ return ;
259232 }
260233
261- return true;
234+ nrf_rpc_encode_uint (ctx , config -> mServiceId );
235+ nrf_rpc_encode_uint (ctx , config -> mEnterpriseNumber );
236+ nrf_rpc_encode_buffer (ctx , config -> mServiceData , config -> mServiceDataLength );
237+ nrf_rpc_encode_bool (ctx , config -> mServerConfig .mStable );
238+ nrf_rpc_encode_buffer (ctx , config -> mServerConfig .mServerData ,
239+ config -> mServerConfig .mServerDataLength );
240+ nrf_rpc_encode_uint (ctx , config -> mServerConfig .mRloc16 );
262241}
263242
264243void ot_rpc_decode_service_config (struct nrf_rpc_cbor_ctx * ctx , otServiceConfig * config )
@@ -293,72 +272,28 @@ void ot_rpc_decode_service_config(struct nrf_rpc_cbor_ctx *ctx, otServiceConfig
293272 config -> mServerConfig .mRloc16 = nrf_rpc_decode_uint (ctx );
294273}
295274
296- bool ot_rpc_encode_border_router_config (struct nrf_rpc_cbor_ctx * ctx ,
275+ void ot_rpc_encode_border_router_config (struct nrf_rpc_cbor_ctx * ctx ,
297276 const otBorderRouterConfig * config )
298277{
299- signed int tmp ;
300-
301278 if (config == NULL ) {
302- return zcbor_nil_put (ctx -> zs , NULL );
303- }
304-
305- if (!zcbor_bstr_encode_ptr (ctx -> zs , (const char * )config -> mPrefix .mPrefix .mFields .m8 ,
306- OT_IP6_ADDRESS_SIZE )) {
307- return false;
308- }
309-
310- if (!zcbor_uint_encode (ctx -> zs , & config -> mPrefix .mLength ,
311- sizeof (config -> mPrefix .mLength ))) {
312- return false;
313- }
314-
315- tmp = config -> mPreference ;
316-
317- if (!zcbor_int_encode (ctx -> zs , & tmp , sizeof (tmp ))) {
318- return false;
319- }
320-
321- if (!zcbor_bool_put (ctx -> zs , config -> mPreferred )) {
322- return false;
323- }
324-
325- if (!zcbor_bool_put (ctx -> zs , config -> mSlaac )) {
326- return false;
327- }
328-
329- if (!zcbor_bool_put (ctx -> zs , config -> mDhcp )) {
330- return false;
331- }
332-
333- if (!zcbor_bool_put (ctx -> zs , config -> mConfigure )) {
334- return false;
335- }
336-
337- if (!zcbor_bool_put (ctx -> zs , config -> mDefaultRoute )) {
338- return false;
339- }
340-
341- if (!zcbor_bool_put (ctx -> zs , config -> mOnMesh )) {
342- return false;
343- }
344-
345- if (!zcbor_bool_put (ctx -> zs , config -> mStable )) {
346- return false;
347- }
348-
349- if (!zcbor_bool_put (ctx -> zs , config -> mNdDns )) {
350- return false;
351- }
352-
353- if (!zcbor_bool_put (ctx -> zs , config -> mDp )) {
354- return false;
355- }
356-
357- if (!zcbor_uint_encode (ctx -> zs , & config -> mRloc16 , sizeof (config -> mRloc16 ))) {
358- return false;
279+ nrf_rpc_encode_null (ctx );
280+ return ;
359281 }
360282
361- return true;
283+ nrf_rpc_encode_buffer (ctx , config -> mPrefix .mPrefix .mFields .m8 ,
284+ OT_IP6_ADDRESS_SIZE );
285+ nrf_rpc_encode_uint (ctx , config -> mPrefix .mLength );
286+ nrf_rpc_encode_int (ctx , config -> mPreference );
287+ nrf_rpc_encode_bool (ctx , config -> mPreferred );
288+ nrf_rpc_encode_bool (ctx , config -> mSlaac );
289+ nrf_rpc_encode_bool (ctx , config -> mDhcp );
290+ nrf_rpc_encode_bool (ctx , config -> mConfigure );
291+ nrf_rpc_encode_bool (ctx , config -> mDefaultRoute );
292+ nrf_rpc_encode_bool (ctx , config -> mOnMesh );
293+ nrf_rpc_encode_bool (ctx , config -> mStable );
294+ nrf_rpc_encode_bool (ctx , config -> mNdDns );
295+ nrf_rpc_encode_bool (ctx , config -> mDp );
296+ nrf_rpc_encode_uint (ctx , config -> mRloc16 );
362297}
363298
364299void ot_rpc_decode_border_router_config (struct nrf_rpc_cbor_ctx * ctx , otBorderRouterConfig * config )
0 commit comments