aboutsummaryrefslogtreecommitdiff
path: root/ByteBuffer.h
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2015-02-18 23:03:57 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2015-02-18 23:11:43 +0100
commit4d2339c65548cf553891b049200e6a845de293e9 (patch)
tree296acd302b61ca1e4ff673d102283485a3b4c9fe /ByteBuffer.h
parent67478ec6b3f09c14195b8aea1099afb9bcaf9532 (diff)
downloadble-toys-4d2339c65548cf553891b049200e6a845de293e9.tar.gz
ble-toys-4d2339c65548cf553891b049200e6a845de293e9.tar.bz2
ble-toys-4d2339c65548cf553891b049200e6a845de293e9.tar.xz
ble-toys-4d2339c65548cf553891b049200e6a845de293e9.zip
o Successfully decoding GATT services.
Diffstat (limited to 'ByteBuffer.h')
-rw-r--r--ByteBuffer.h20
1 files changed, 10 insertions, 10 deletions
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<uint8_t> 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<uint8_t> 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<uint8_t> 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<uint8_t> bytes;
const size_t capacity;
const uint8_t *zero;
const uint8_t *end;