From 041bbe24b39190ac0b624b2709fc38dea17ad0a7 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 12 Feb 2015 17:22:59 +0100 Subject: o wip. --- Bluetooth.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'Bluetooth.cpp') 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; } // ----------------------------------------------------------------------- -- cgit v1.2.3