diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-02-12 17:22:59 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-02-12 17:22:59 +0100 |
commit | 041bbe24b39190ac0b624b2709fc38dea17ad0a7 (patch) | |
tree | af09babb7ae7ff1ab6ed4a7973bfccdd1b8d51f9 /Bluetooth.cpp | |
parent | b55df0b8e46f46fea4d69f98a729cd237d77a6ed (diff) | |
download | ble-toys-041bbe24b39190ac0b624b2709fc38dea17ad0a7.tar.gz ble-toys-041bbe24b39190ac0b624b2709fc38dea17ad0a7.tar.bz2 ble-toys-041bbe24b39190ac0b624b2709fc38dea17ad0a7.tar.xz ble-toys-041bbe24b39190ac0b624b2709fc38dea17ad0a7.zip |
o wip.
Diffstat (limited to 'Bluetooth.cpp')
-rw-r--r-- | Bluetooth.cpp | 8 |
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; } // ----------------------------------------------------------------------- |