From d88eee8fcf23e20ae76b3dd346b36af693849ccd Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 22 Nov 2018 19:30:14 +0100 Subject: o Working enabling of notifications. --- apps/SoilMoisture.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apps/SoilMoisture.cpp') diff --git a/apps/SoilMoisture.cpp b/apps/SoilMoisture.cpp index d7c03bb..3129564 100644 --- a/apps/SoilMoisture.cpp +++ b/apps/SoilMoisture.cpp @@ -95,7 +95,7 @@ SoilMoisture::SoilMoisture(const shared_ptr &gatt, temperatureCharacteristic(temperatureCharacteristic), lightCharacteristic(lightCharacteristic) {} void SoilMoisture::writeAndRead(const BluetoothGattCharacteristicPtr &c, ByteBuffer &buffer) { - buffer.setCursor(0); + buffer.setPosition(0); uint8_t expectedCode = buffer.peek8(0); @@ -137,7 +137,7 @@ string SoilMoisture::getName(uint8_t sensor) { writeAndRead(soilMoistureCharacteristic, buffer); size_t bytesLeft = buffer.getBytesLeft(); uint8_t bytes[bytesLeft]; - buffer.copy(bytes, bytesLeft); + buffer.copyTo(bytes, bytesLeft); if (bytesLeft == 0 || bytesLeft < (bytes[0] + 1)) { throw runtime_error("Bad response from device. buffer size: " + to_string(bytesLeft) + ", buffer[0]=" + -- cgit v1.2.3