@@ -305,6 +305,23 @@ static void tx_end(int err, void *cb_data)
305305 blob_cli_broadcast_tx_complete (& cli -> blob );
306306}
307307
308+ static int tx (struct bt_mesh_model * mod , struct bt_mesh_msg_ctx * ctx , struct net_buf_simple * buf ,
309+ const struct bt_mesh_send_cb * cb , struct bt_mesh_dfu_cli * cli )
310+ {
311+ int err ;
312+
313+ err = bt_mesh_model_send (mod , ctx , buf , cb , cli );
314+ if (err ) {
315+ LOG_ERR ("Send err: %d" , err );
316+ if (cb ) {
317+ cb -> end (err , cli );
318+ }
319+ return err ;
320+ }
321+
322+ return 0 ;
323+ }
324+
308325static int info_get (struct bt_mesh_dfu_cli * cli , struct bt_mesh_msg_ctx * ctx ,
309326 uint8_t idx , uint8_t max_count ,
310327 const struct bt_mesh_send_cb * cb )
@@ -314,7 +331,7 @@ static int info_get(struct bt_mesh_dfu_cli *cli, struct bt_mesh_msg_ctx *ctx,
314331 net_buf_simple_add_u8 (& buf , idx );
315332 net_buf_simple_add_u8 (& buf , max_count );
316333
317- return bt_mesh_model_send (cli -> mod , ctx , & buf , cb , cli );
334+ return tx (cli -> mod , ctx , & buf , cb , cli );
318335}
319336
320337static void send_info_get (struct bt_mesh_blob_cli * b , uint16_t dst )
@@ -352,7 +369,7 @@ static void send_update_start(struct bt_mesh_blob_cli *b, uint16_t dst)
352369 net_buf_simple_add_mem (& buf , cli -> xfer .slot -> metadata ,
353370 cli -> xfer .slot -> metadata_len );
354371
355- bt_mesh_model_send (cli -> mod , & ctx , & buf , & send_cb , cli );
372+ ( void ) tx (cli -> mod , & ctx , & buf , & send_cb , cli );
356373}
357374
358375static void send_update_get (struct bt_mesh_blob_cli * b , uint16_t dst )
@@ -363,7 +380,7 @@ static void send_update_get(struct bt_mesh_blob_cli *b, uint16_t dst)
363380 BT_MESH_MODEL_BUF_DEFINE (buf , BT_MESH_DFU_OP_UPDATE_GET , 0 );
364381 bt_mesh_model_msg_init (& buf , BT_MESH_DFU_OP_UPDATE_GET );
365382
366- bt_mesh_model_send (cli -> mod , & ctx , & buf , & send_cb , cli );
383+ ( void ) tx (cli -> mod , & ctx , & buf , & send_cb , cli );
367384}
368385
369386static void send_update_cancel (struct bt_mesh_blob_cli * b , uint16_t dst )
@@ -374,7 +391,7 @@ static void send_update_cancel(struct bt_mesh_blob_cli *b, uint16_t dst)
374391 BT_MESH_MODEL_BUF_DEFINE (buf , BT_MESH_DFU_OP_UPDATE_CANCEL , 0 );
375392 bt_mesh_model_msg_init (& buf , BT_MESH_DFU_OP_UPDATE_CANCEL );
376393
377- bt_mesh_model_send (cli -> mod , & ctx , & buf , & send_cb , cli );
394+ ( void ) tx (cli -> mod , & ctx , & buf , & send_cb , cli );
378395}
379396
380397static void send_update_apply (struct bt_mesh_blob_cli * b , uint16_t dst )
@@ -385,7 +402,7 @@ static void send_update_apply(struct bt_mesh_blob_cli *b, uint16_t dst)
385402 BT_MESH_MODEL_BUF_DEFINE (buf , BT_MESH_DFU_OP_UPDATE_APPLY , 0 );
386403 bt_mesh_model_msg_init (& buf , BT_MESH_DFU_OP_UPDATE_APPLY );
387404
388- bt_mesh_model_send (cli -> mod , & ctx , & buf , & send_cb , cli );
405+ ( void ) tx (cli -> mod , & ctx , & buf , & send_cb , cli );
389406}
390407
391408/*******************************************************************************
0 commit comments