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
This commit is contained in:
Robert Byrnes 2022-12-19 13:52:35 +00:00 committed by GitHub
parent d08e9005b3
commit 947ee6fd62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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