aboutsummaryrefslogtreecommitdiff
path: root/Bluetooth.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Bluetooth.cpp')
-rw-r--r--Bluetooth.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/Bluetooth.cpp b/Bluetooth.cpp
index 737f04f..5dca8fa 100644
--- a/Bluetooth.cpp
+++ b/Bluetooth.cpp
@@ -119,17 +119,13 @@ namespace trygvis {
AttributeData* AttributeData::fromByteBuffer(ByteBuffer &bytes, uint8_t length) {
uint16_t handle = bytes.get16le();
- uint8_t* value = new uint8_t[length];
- bytes.copy(value, length);
- return new AttributeData(handle, value);
+ return new AttributeData(handle, bytes.view(length));
}
- AttributeData::AttributeData(uint16_t handle, uint8_t *bytes) : handle(handle), bytes(bytes) {
-
+ AttributeData::AttributeData(uint16_t handle, ByteBuffer bytes) : handle(handle), value(value) {
}
AttributeData::~AttributeData() {
- delete bytes;
}
// -----------------------------------------------------------------------