aboutsummaryrefslogtreecommitdiff
path: root/Bluetooth.h
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2015-02-19 00:04:06 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2015-02-19 00:04:06 +0100
commit5460c461809294bb302be8aa6e80533ec30e28e4 (patch)
treea171ce52d4f8908aeb9d13770965b9890608f738 /Bluetooth.h
parent4d2339c65548cf553891b049200e6a845de293e9 (diff)
downloadble-toys-5460c461809294bb302be8aa6e80533ec30e28e4.tar.gz
ble-toys-5460c461809294bb302be8aa6e80533ec30e28e4.tar.bz2
ble-toys-5460c461809294bb302be8aa6e80533ec30e28e4.tar.xz
ble-toys-5460c461809294bb302be8aa6e80533ec30e28e4.zip
o Reading characteristics, unable to parse just yet.
Diffstat (limited to 'Bluetooth.h')
-rw-r--r--Bluetooth.h27
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: