From 947ee6fd62e6d87007207d89f1d16a7ea644a2b9 Mon Sep 17 00:00:00 2001 From: Robert Byrnes <59289145+RobertByrnes@users.noreply.github.com> Date: Mon, 19 Dec 2022 13:52:35 +0000 Subject: [PATCH] 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 --- libraries/BLE/src/BLEAdvertisedDevice.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libraries/BLE/src/BLEAdvertisedDevice.cpp b/libraries/BLE/src/BLEAdvertisedDevice.cpp index b1303aad5..f266877e7 100644 --- a/libraries/BLE/src/BLEAdvertisedDevice.cpp +++ b/libraries/BLE/src/BLEAdvertisedDevice.cpp @@ -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