aboutsummaryrefslogtreecommitdiff
path: root/ble/Bluetooth.h
diff options
context:
space:
mode:
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;