Skip to content

Commit 2640c44

Browse files
lazdh2zero
authored andcommitted
Support passing data directly from NimBLEBeacon.getData() to NimBLEAdvertisementData.setManufacturerData()
1 parent fec2d7a commit 2640c44

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/NimBLEBeacon.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
class 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();

0 commit comments

Comments
 (0)