未验证 提交 947ee6fd 编写于 作者: R Robert Byrnes 提交者: 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
上级 d08e9005
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册