File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -27,13 +27,10 @@ void setup() {
2727 beacon.setSignalPower (0xC5 ); // Optional
2828 beacon.setProximityUUID (BLEUUID (iBeaconUUID)); // Unlike Bluedroid, you do not need to reverse endianness here
2929
30- // Extract beacon data
31- NimBLEBeacon::BeaconData beaconData = beacon.getData ();
32-
3330 // Create advertisement data
3431 NimBLEAdvertisementData beaconAdvertisementData;
3532 beaconAdvertisementData.setFlags (0x04 ); // BR_EDR_NOT_SUPPORTED
36- beaconAdvertisementData.setManufacturerData (reinterpret_cast < const uint8_t *>(&beaconData), sizeof (NimBLEBeacon::BeaconData ));
33+ beaconAdvertisementData.setManufacturerData (beacon. getData ( ));
3734
3835 // Start advertising
3936 NimBLEAdvertising *advertising = NimBLEDevice::getAdvertising ();
Original file line number Diff line number Diff line change 2424class NimBLEUUID ;
2525
2626# include < cstdint>
27+ # include < vector>
2728
2829/* *
2930 * @brief Representation of a beacon.
@@ -40,6 +41,10 @@ class NimBLEBeacon {
4041 uint16_t major{};
4142 uint16_t minor{};
4243 int8_t signalPower{};
44+ operator std::vector<uint8_t > () const {
45+ return std::vector<uint8_t >(reinterpret_cast <const uint8_t *>(this ),
46+ reinterpret_cast <const uint8_t *>(this ) + sizeof (BeaconData));
47+ }
4348 } __attribute__((packed));
4449
4550 const BeaconData& getData ();
You can’t perform that action at this time.
0 commit comments