aboutsummaryrefslogtreecommitdiff
path: root/ble/Bluetooth.h
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2015-02-21 10:28:00 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2015-02-21 10:28:00 +0100
commit7c9f266cdb37e215279208198dfe009dc66c5daa (patch)
tree131334cd6e14c5d14e2a07c06aff9920744fb246 /ble/Bluetooth.h
parent9c095ce3c2165ae9fb976b007ba5c14602d06a0b (diff)
downloadble-toys-7c9f266cdb37e215279208198dfe009dc66c5daa.tar.gz
ble-toys-7c9f266cdb37e215279208198dfe009dc66c5daa.tar.bz2
ble-toys-7c9f266cdb37e215279208198dfe009dc66c5daa.tar.xz
ble-toys-7c9f266cdb37e215279208198dfe009dc66c5daa.zip
o Creating a class to access GATT.
Diffstat (limited to 'ble/Bluetooth.h')
-rw-r--r--ble/Bluetooth.h39
1 files changed, 28 insertions, 11 deletions
diff --git a/ble/Bluetooth.h b/ble/Bluetooth.h
index e7b163b..1dd5022 100644
--- a/ble/Bluetooth.h
+++ b/ble/Bluetooth.h
@@ -15,7 +15,9 @@ using namespace std;
struct SpecUuid {
public:
- SpecUuid(uint16_t value) : value(value) {}
+ SpecUuid(uint16_t value) : value(value) {
+ }
+
uint16_t value;
};
@@ -109,18 +111,18 @@ public:
virtual const vector<BluetoothGattCharacteristic *> getCharacteristics() const = 0;
- virtual void addCharacteristic(BluetoothGattCharacteristic* characteristic) = 0;
+ virtual void addCharacteristic(BluetoothGattCharacteristic *characteristic) = 0;
+
+ virtual const boost::optional<BluetoothGattCharacteristic *> findCharacteristic(boost::uuids::uuid uuid) const = 0;
};
-class BluetoothDevice {
+class BluetoothGatt {
public:
- BluetoothDevice();
+ BluetoothGatt();
- virtual ~BluetoothDevice();
-
- virtual Mac const &mac() = 0;
+ virtual ~BluetoothGatt();
- virtual BluetoothAdapter &adapter() = 0;
+// virtual BluetoothDevice &getDevice() = 0;
virtual void connect() = 0;
@@ -130,7 +132,20 @@ public:
virtual const vector<BluetoothGattService *> getServices() const = 0;
- virtual const boost::optional<BluetoothGattService*> findService(boost::uuids::uuid uuid) const = 0;
+ virtual const boost::optional<BluetoothGattService *> findService(boost::uuids::uuid uuid) const = 0;
+};
+
+class BluetoothDevice {
+public:
+ BluetoothDevice();
+
+ virtual ~BluetoothDevice();
+
+ virtual Mac const &getMac() = 0;
+
+ virtual BluetoothAdapter &getAdapter() = 0;
+
+ virtual BluetoothGatt &connectGatt() = 0;
};
class BluetoothAdapter {
@@ -150,11 +165,12 @@ protected:
};
/**
- * RAII support.
- */
+* RAII support.
+*/
class BluetoothSystem {
public:
BluetoothSystem();
+
~BluetoothSystem();
};
@@ -187,6 +203,7 @@ public:
private:
static void checkType(ByteBuffer &bytes, AttPduType type);
+
static vector<AttributeData> parse(ByteBuffer &bytes, AttPduType type);
ByteBuffer &bytes;