From 4d2339c65548cf553891b049200e6a845de293e9 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Wed, 18 Feb 2015 23:03:57 +0100 Subject: o Successfully decoding GATT services. --- ByteBuffer.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'ByteBuffer.h') diff --git a/ByteBuffer.h b/ByteBuffer.h index a572097..b3e06cf 100644 --- a/ByteBuffer.h +++ b/ByteBuffer.h @@ -20,12 +20,12 @@ public: /** * Wrapping constructor, the size will be equal to the capacity. */ - ByteBuffer(const uint8_t *bytes, size_t capacity); + ByteBuffer(const std::shared_ptr bytes, size_t capacity); /** * Wrapping constructor. */ - ByteBuffer(const uint8_t *bytes, size_t capacity, size_t zero, size_t size); + ByteBuffer(const std::shared_ptr bytes, size_t capacity, size_t zero, size_t size); inline size_t getSize() const { // DF << "end=" << (uint64_t)end << ", zero=" << (uint64_t)zero << ", size=" << (end - zero); @@ -50,17 +50,17 @@ public: ptr += length; } - ByteBuffer &add8(uint8_t value); + ByteBuffer &write8(uint8_t value); - ByteBuffer &add16le(uint16_t value); + ByteBuffer &write16le(uint16_t value); - uint8_t get8(size_t index); + uint8_t get8(size_t index) const; - uint8_t get8(); + uint8_t read8(); - uint16_t get16le(); + uint16_t read16le(); - void copy(uint8_t *bytes, size_t length); + void copy(uint8_t *bytes, size_t length) const; /** * Creates a view from cursor to size. @@ -73,7 +73,7 @@ public: std::string toString() const; private: - ByteBuffer(const uint8_t *bytes, size_t capacity, const uint8_t *zero, const uint8_t *end); + ByteBuffer(const std::shared_ptr bytes, size_t capacity, const uint8_t *zero, const uint8_t *end); ByteBuffer view(uint8_t *ptr, const uint8_t *end) const; @@ -83,7 +83,7 @@ private: void assertCanAccessIndex(uint8_t *p) const; - const uint8_t *bytes; + const std::shared_ptr bytes; const size_t capacity; const uint8_t *zero; const uint8_t *end; -- cgit v1.2.3