8000 Add retrieving raw advertising data · benjaminaigner/esp32-snippets@5ae9b98 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5ae9b98

Browse files
committed
Add retrieving raw advertising data
1 parent 9c796bb commit 5ae9b98

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

cpp_utils/BLEAdvertisedDevice.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ void BLEAdvertisedDevice::parseAdvertisement(uint8_t* payload) {
234234
uint8_t ad_type;
235235
uint8_t sizeConsumed = 0;
236236
bool finished = false;
237+
setPayload(payload);
237238

238239
while(!finished) {
239240
length = *payload; // Retrieve the length of the record.
@@ -506,7 +507,13 @@ std::string BLEAdvertisedDevice::toString() {
506507
return ss.str();
507508
} // toString
508509

510+
uint8_t* BLEAdvertisedDevice::getPayload() {
511+
return m_payload;
512+
}
509513

514+
void BLEAdvertisedDevice::setPayload(uint8_t* payload) {
515+
m_payload = payload;
516+
}
510517

511518

512519
#endif /* CONFIG_BT_ENABLED */

cpp_utils/BLEAdvertisedDevice.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ class BLEAdvertisedDevice {
3939
BLEUUID getServiceDataUUID();
4040
BLEUUID getServiceUUID();
4141
int8_t getTXPower();
42+
uint8_t* getPayload();
4243

4344

44-
bool isAdvertisingService(BLEUUID uuid);
45+
bool isAdvertisingService(BLEUUID uuid);
4546
bool haveAppearance();
4647
bool haveManufacturerData();
4748
bool haveName();
@@ -69,6 +70,7 @@ class BLEAdvertisedDevice {
6970
void setServiceUUID(const char* serviceUUID);
7071
void setServiceUUID(BLEUUID serviceUUID);
7172
void setTXPower(int8_t txPower);
73+
void setPayload(uint8_t* payload);
7274

7375

7476
bool m_haveAppearance;
@@ -92,6 +94,7 @@ class BLEAdvertisedDevice {
9294
int8_t m_txPower;
9395
std::string m_serviceData;
9496
BLEUUID m_serviceDataUUID;
97+
uint8_t* m_payload;
9598
};
9699

97100
/**

0 commit comments

Comments
 (0)
0