aboutsummaryrefslogtreecommitdiff
path: root/apps/SoilMoisture.cpp
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2018-09-05 14:14:42 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2018-09-05 14:14:42 +0200
commit91e54cf9150b37036447d423857d2bd18e4bf02b (patch)
tree7738db9a61cb6385f0abc6359b5b89aaa1ff104d /apps/SoilMoisture.cpp
parent25d82b0c52120c81cfed5bc1f245408f08203b7b (diff)
downloadble-toys-91e54cf9150b37036447d423857d2bd18e4bf02b.tar.gz
ble-toys-91e54cf9150b37036447d423857d2bd18e4bf02b.tar.bz2
ble-toys-91e54cf9150b37036447d423857d2bd18e4bf02b.tar.xz
ble-toys-91e54cf9150b37036447d423857d2bd18e4bf02b.zip
Major overhaul of BLE code:
o Starting to remove shared_ptr. The code shouldn't be shared between threads, any thread safety will have to be built on the outside. o Better service discovery, don't fail when there are multiple requests that have to be done. o AttributeData was buggy, now it is just less than ideal. o Much better ByteBuffer. Now it is a simple view + cursor.
Diffstat (limited to 'apps/SoilMoisture.cpp')
-rw-r--r--apps/SoilMoisture.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/apps/SoilMoisture.cpp b/apps/SoilMoisture.cpp
index d92752d..03aeb00 100644
--- a/apps/SoilMoisture.cpp
+++ b/apps/SoilMoisture.cpp
@@ -19,6 +19,7 @@ const Uuid temperature_characteristic = makeUuid(bluetooth_base_uuid, 0x2a, 0x1e
const Uuid light_characteristic = makeUuid(trygvis_io_base_uuid, 0x00, 0x12);
using namespace trygvis::bluetooth;
+using std::to_string;
static
ByteBuffer createGetSensorCount() {
@@ -97,7 +98,7 @@ SoilMoisture::SoilMoisture(const shared_ptr<BluetoothGatt> &gatt,
ByteBuffer SoilMoisture::writeAndRead(const BluetoothGattCharacteristicPtr &c, ByteBuffer &requestBytes) {
requestBytes.setCursor(0);
- uint8_t expectedCode = requestBytes.get8(0);
+ uint8_t expectedCode = requestBytes.peek8(0);
gatt->writeValue(c, requestBytes);