Unverified Commit 947ee6fd authored by Robert Byrnes's avatar Robert Byrnes Committed by GitHub

refactor(toString method): Add RSSI / serviceData (#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
parent d08e9005
...@@ -560,6 +560,17 @@ std::string BLEAdvertisedDevice::toString() { ...@@ -560,6 +560,17 @@ std::string BLEAdvertisedDevice::toString() {
res += ", txPower: "; res += ", txPower: ";
res += val; res += val;
} }
if (haveRSSI()) {
char val[4];
snprintf(val, sizeof(val), "%i", getRSSI());
res += ", rssi: ";
res += val;
}
if (haveServiceData()) {
for (int i=0; i <getServiceDataCount(); i++) {
res += ", serviceData: " + getServiceData(i);
}
}
return res; return res;
} // toString } // toString
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment