@@ -434,6 +434,13 @@ void bt_mesh_adv_friend_ready(void)
434
434
}
435
435
}
436
436
437
+ static void adv_sent (struct bt_mesh_ext_adv * ext_adv )
438
+ {
439
+ atomic_set_bit (ext_adv -> flags , ADV_FLAG_SENT );
440
+
441
+ bt_mesh_wq_submit (& ext_adv -> work );
442
+ }
443
+
437
444
int bt_mesh_adv_terminate (struct bt_mesh_adv * adv )
438
445
{
439
446
int err ;
@@ -458,9 +465,7 @@ int bt_mesh_adv_terminate(struct bt_mesh_adv *adv)
458
465
/* Do not call `cb:end`, since this user action */
459
466
adv -> ctx .cb = NULL ;
460
467
461
- atomic_set_bit (ext_adv -> flags , ADV_FLAG_SENT );
462
-
463
- bt_mesh_wq_submit (& ext_adv -> work );
468
+ adv_sent (ext_adv );
464
469
465
470
return 0 ;
466
471
}
@@ -502,8 +507,7 @@ static struct bt_mesh_ext_adv *adv_instance_find(struct bt_le_ext_adv *instance)
502
507
return NULL ;
503
508
}
504
509
505
- static void adv_sent (struct bt_le_ext_adv * instance ,
506
- struct bt_le_ext_adv_sent_info * info )
510
+ static void ext_adv_set_sent (struct bt_le_ext_adv * instance , struct bt_le_ext_adv_sent_info * info )
507
511
{
508
512
struct bt_mesh_ext_adv * ext_adv = adv_instance_find (instance );
509
513
@@ -517,17 +521,15 @@ static void adv_sent(struct bt_le_ext_adv *instance,
517
521
return ;
518
522
}
519
523
520
- atomic_set_bit (ext_adv -> flags , ADV_FLAG_SENT );
521
-
522
- bt_mesh_wq_submit (& ext_adv -> work );
524
+ adv_sent (ext_adv );
523
525
}
524
526
525
527
int bt_mesh_adv_enable (void )
526
528
{
527
529
int err ;
528
530
529
531
static const struct bt_le_ext_adv_cb adv_cb = {
530
- .sent = adv_sent ,
532
+ .sent = ext_adv_set_sent ,
531
533
};
532
534
533
535
if (advs [0 ].instance ) {
@@ -536,8 +538,7 @@ int bt_mesh_adv_enable(void)
536
538
}
537
539
538
540
for (int i = 0 ; i < ARRAY_SIZE (advs ); i ++ ) {
539
- err = bt_le_ext_adv_create (& advs [i ].adv_param , & adv_cb ,
540
- & advs [i ].instance );
541
+ err = bt_le_ext_adv_create (& advs [i ].adv_param , & adv_cb , & advs [i ].instance );
541
542
if (err ) {
542
543
return err ;
543
544
}
@@ -565,11 +566,6 @@ int bt_mesh_adv_disable(void)
565
566
return err ;
566
567
}
567
568
568
- /* `adv_sent` is called to finish transmission of an adv buffer that was pushed to
569
- * the host before the advertiser was stopped, but did not finish.
570
- */
571
- adv_sent (advs [i ].instance , NULL );
572
-
573
569
err = bt_le_ext_adv_delete (advs [i ].instance );
574
570
if (err ) {
575
571
LOG_ERR ("Failed to delete adv %d" , err );
@@ -579,6 +575,11 @@ int bt_mesh_adv_disable(void)
579
575
advs [i ].instance = NULL ;
580
576
581
577
atomic_clear_bit (advs [i ].flags , ADV_FLAG_SUSPENDING );
578
+
579
+ /* `adv_sent` is called to finish transmission of an adv buffer that was pushed to
580
+ * the host before the advertiser was stopped, but did not finish.
581
+ */
582
+ adv_sent (& advs [i ]);
582
583
}
583
584
584
585
return 0 ;
0 commit comments