diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/SoilMoisture.cpp | 2 | ||||
-rw-r--r-- | apps/ble-scan.cpp | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/apps/SoilMoisture.cpp b/apps/SoilMoisture.cpp index fcf81bd..3de85d2 100644 --- a/apps/SoilMoisture.cpp +++ b/apps/SoilMoisture.cpp @@ -95,7 +95,7 @@ SoilMoisture::SoilMoisture(const BluetoothGattPtr &gatt, temperatureCharacteristic(temperatureCharacteristic), lightCharacteristic(lightCharacteristic) {} void SoilMoisture::writeAndRead(const BluetoothGattCharacteristicPtr &c, ByteBuffer &buffer) { - buffer.setPosition(0); + buffer.setCursor(0); uint8_t expectedCode = buffer.peek8(0); diff --git a/apps/ble-scan.cpp b/apps/ble-scan.cpp index b148752..6d271da 100644 --- a/apps/ble-scan.cpp +++ b/apps/ble-scan.cpp @@ -64,7 +64,11 @@ public: cout << "Stopped. Found " << seen_devices.size() << " devices." << endl; - for_each(begin(seen_devices), end(seen_devices), [&](auto mac) { cout << mac.str() << endl; }); + vector<Mac> devices(seen_devices.cbegin(), seen_devices.cend()); + std::sort(devices.begin(), devices.end(), [](const Mac& a, const Mac& b) { + return a < b; + }); + for_each(begin(devices), end(devices), [&](auto mac) { cout << " " << mac.str() << endl; }); return EXIT_SUCCESS; } catch (std::runtime_error &ex) { |