Skip to content

Commit 947ee6f

Browse files
authored
refactor(toString method): Add RSSI / serviceData (espressif#7561)
* refactor(toString method): Add RSSI / serviceData These are key characteristics of the BLE advertising packet. Really useful, adding to this method allows data to be easily obtained and passed over TCP/IP for processing. * fix: remove line 565 bug
1 parent d08e900 commit 947ee6f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Diff for: libraries/BLE/src/BLEAdvertisedDevice.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,17 @@ std::string BLEAdvertisedDevice::toString() {
560560
res += ", txPower: ";
561561
res += val;
562562
}
563+
if (haveRSSI()) {
564+
char val[4];
565+
snprintf(val, sizeof(val), "%i", getRSSI());
566+
res += ", rssi: ";
567+
res += val;
568+
}
569+
if (haveServiceData()) {
570+
for (int i=0; i <getServiceDataCount(); i++) {
571+
res += ", serviceData: " + getServiceData(i);
572+
}
573+
}
563574
return res;
564575
} // toString
565576

0 commit comments

Comments
 (0)