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:
parent
d08e9005b3
commit
947ee6fd62
1 changed files with 11 additions and 0 deletions
|
|
@ -560,6 +560,17 @@ std::string BLEAdvertisedDevice::toString() {
|
|||
res += ", txPower: ";
|
||||
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;
|
||||
} // toString
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue