aboutsummaryrefslogtreecommitdiff
path: root/ble/LinuxBluetooth.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ble/LinuxBluetooth.cpp')
-rw-r--r--ble/LinuxBluetooth.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/ble/LinuxBluetooth.cpp b/ble/LinuxBluetooth.cpp
index 9e7193f..3c4925c 100644
--- a/ble/LinuxBluetooth.cpp
+++ b/ble/LinuxBluetooth.cpp
@@ -307,7 +307,7 @@ void LinuxBluetoothGatt::writeHandle(uint16_t handle, const ByteBuffer &bytes) {
writeAndRead(buffer, buffer);
auto cursor = buffer.getPosition();
- buffer.setPosition(0);
+ buffer.setCursor(0);
AttPdu::parseWrite(buffer);
@@ -319,7 +319,7 @@ void LinuxBluetoothGatt::writeHandle(uint16_t handle, const ByteBuffer &bytes) {
}
}
-ByteBuffer LinuxBluetoothGatt::readValue(const BluetoothGattCharacteristicPtr &c, ByteBuffer &response) {
+ByteBuffer LinuxBluetoothGatt::readValue(const BluetoothGattCharacteristicPtr &c, ByteBuffer& response) {
uint8_t b[mtu];
ByteBuffer buffer{b, mtu};
@@ -328,7 +328,7 @@ ByteBuffer LinuxBluetoothGatt::readValue(const BluetoothGattCharacteristicPtr &c
writeAndRead(buffer, response);
auto cursor = response.getPosition();
- response.setPosition(0);
+ response.setCursor(0);
AttPdu::parseRead(response);
@@ -428,7 +428,7 @@ void LinuxBluetoothGatt::discoverServices() {
} while (startHandle != 0xffff);
}
-void LinuxBluetoothGatt::writeAndRead(const ByteBuffer &buffer, ByteBuffer &response) {
+void LinuxBluetoothGatt::writeAndRead(const ByteBuffer &buffer, ByteBuffer& response) {
// LOG_DEBUG("pdu size=" << out.getCursor());
auto to_be_written = buffer.getPosition();
@@ -447,8 +447,9 @@ void LinuxBluetoothGatt::writeAndRead(const ByteBuffer &buffer, ByteBuffer &resp
throw BluetoothException(&device, "read(): " + errnoAsString());
}
- response.setPosition(static_cast<size_t>(r));
+ response.setCursor(static_cast<size_t>(r));
LOG_DEBUG("read: " << r << " bytes: " << response.viewBeginningToCursor().toString());
+ response.setCursor(static_cast<size_t>(r));
}
void LinuxBluetoothGatt::writeL2cap(ByteBuffer &buffer) {
@@ -459,7 +460,7 @@ void LinuxBluetoothGatt::writeL2cap(ByteBuffer &buffer) {
throw BluetoothException(&device, "Expected to write " + to_string(to_be_written) + " but wrote only " +
to_string(written));
}
- buffer.setPosition(0);
+ buffer.setCursor(0);
}
AttVariant LinuxBluetoothGatt::processAvailableMessages(ByteBuffer &buffer) {