Skip to content

Commit 0fba3ec

Browse files
committed
BLE_Button: Fix advertising settings
Need to use the object private and persistent _adv_data_builder rather than a local one in the start_advertising function.
1 parent 7474513 commit 0fba3ec

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

Diff for: BLE_Button/source/main.cpp

+3-7
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,9 @@ class BatteryDemo : ble::Gap::EventHandler {
7575
ble::adv_interval_t(ble::millisecond_t(1000))
7676
);
7777

78-
uint8_t adv_buffer[ble::LEGACY_ADVERTISING_MAX_SIZE];
79-
80-
ble::AdvertisingDataBuilder adv_data_builder(adv_buffer);
81-
82-
adv_data_builder.setFlags();
83-
adv_data_builder.setLocalServiceList(mbed::make_Span(&_button_uuid, 1));
84-
adv_data_builder.setName(DEVICE_NAME);
78+
_adv_data_builder.setFlags();
79+
_adv_data_builder.setLocalServiceList(mbed::make_Span(&_button_uuid, 1));
80+
_adv_data_builder.setName(DEVICE_NAME);
8581

8682
/* Setup advertising */
8783

0 commit comments

Comments
 (0)