diff options
Diffstat (limited to 'Bluetooth.h')
-rw-r--r-- | Bluetooth.h | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/Bluetooth.h b/Bluetooth.h index 157ae0b..80e0193 100644 --- a/Bluetooth.h +++ b/Bluetooth.h @@ -9,8 +9,20 @@ namespace trygvis { namespace bluetooth { + using namespace std; -//using namespace boost; + +struct SpecUuid { +public: + SpecUuid(uint16_t value) : value(value) {} + uint16_t value; +}; + +namespace uuids { +static const SpecUuid PRIMARY_SERVICE = SpecUuid(0x2800); +static const SpecUuid SECONDARY_SERVICE = SpecUuid(0x2801); +static const SpecUuid CHARACTERISTIC = SpecUuid(0x2803); +} class BluetoothAdapter; @@ -78,6 +90,10 @@ public: virtual boost::uuids::uuid getUuid() const = 0; + virtual uint16_t getHandle() const = 0; + + virtual uint16_t getEndGroupHandle() const = 0; + virtual vector<BluetoothGattCharacteristic *>::const_iterator getCharacteristics() const = 0; }; @@ -136,12 +152,15 @@ public: static vector<AttributeData> parseReadByGroupType(ByteBuffer &bytes); - static void makeReadByGroupType(ByteBuffer &bytes, uint16_t startHandle, uint16_t endHandle, uint16_t uuid); + static vector<AttributeData> parseReadByType(ByteBuffer &bytes); + + static void makeReadByGroupType(ByteBuffer &bytes, uint16_t startHandle, uint16_t endHandle, SpecUuid uuid); - static void makeReadByType(ByteBuffer &bytes, uint16_t startHandle, uint16_t endHandle, uint16_t uuid); + static void makeReadByType(ByteBuffer &bytes, uint16_t startHandle, uint16_t endHandle, SpecUuid uuid); private: static void checkType(ByteBuffer &bytes, AttPduType type); + static vector<AttributeData> parse(ByteBuffer &bytes, AttPduType type); ByteBuffer &bytes; }; @@ -153,7 +172,7 @@ public: static AttributeData fromByteBuffer(ByteBuffer &value); const uint16_t handle; - const uint16_t groupEndHandle; + const uint16_t endGroupHandle; const ByteBuffer value; private: |