Skip to content

Commit 55d5bf2

Browse files
tlossenpolldo
authored andcommitted
add access to raw advertisement data
1 parent 94ffe05 commit 55d5bf2

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/BLEDevice.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,17 @@ String BLEDevice::advertisedServiceUuid(int index) const
184184
return serviceUuid;
185185
}
186186

187+
int BLEDevice::advertisementData(uint8_t value[], int length)
188+
{
189+
if (_eirDataLength > length) return 0; // Check that buffer size is sufficient
190+
191+
if (_eirDataLength) {
192+
memcpy(value, _eirData, _eirDataLength);
193+
}
194+
195+
return _eirDataLength;
196+
}
197+
187198
int BLEDevice::rssi()
188199
{
189200
uint16_t handle = ATT.connectionHandle(_addressType, _address);

src/BLEDevice.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ class BLEDevice {
5959
String advertisedServiceUuid() const;
6060
String advertisedServiceUuid(int index) const;
6161

62+
int advertisementData(uint8_t value[], int length);
63+
6264
virtual int rssi();
6365

6466
bool connect();

0 commit comments

Comments
 (0)