File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
features/FEATURE_BLE/source/generic Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -2527,8 +2527,11 @@ ble_error_t GenericGap::setPeriodicAdvertisingPayload(
2527
2527
typedef pal::advertising_fragment_description_t op_t ;
2528
2528
2529
2529
const size_t hci_length = _pal_gap.get_maximum_hci_advertising_data_length ();
2530
+ size_t i = 0 ;
2531
+ size_t end = payload.size ();
2530
2532
2531
- for (size_t i = 0 , end = payload.size (); (i < end) || (i == 0 && end == 0 ); i += hci_length) {
2533
+ /* always do at least one iteration for empty payload */
2534
+ do {
2532
2535
// select the operation based on the index
2533
2536
op_t op (op_t ::INTERMEDIATE_FRAGMENT);
2534
2537
if (end < hci_length) {
@@ -2555,7 +2558,9 @@ ble_error_t GenericGap::setPeriodicAdvertisingPayload(
2555
2558
if (err) {
2556
2559
return err;
2557
2560
}
2558
- }
2561
+
2562
+ i += hci_length;
2563
+ } while (i < end);
2559
2564
2560
2565
return BLE_ERROR_NONE;
2561
2566
}
You can’t perform that action at this time.
0 commit comments