aboutsummaryrefslogtreecommitdiff
path: root/include/ble/Bluetooth.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/ble/Bluetooth.h')
-rw-r--r--include/ble/Bluetooth.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/include/ble/Bluetooth.h b/include/ble/Bluetooth.h
index d238377..8da602f 100644
--- a/include/ble/Bluetooth.h
+++ b/include/ble/Bluetooth.h
@@ -7,6 +7,7 @@
#include <stdexcept>
#include <vector>
#include <cstdint>
+#include <map>
#include "ByteBuffer.h"
@@ -115,7 +116,7 @@ public:
virtual void addCharacteristic(BluetoothGattCharacteristic *characteristic) = 0;
- virtual const boost::optional<BluetoothGattCharacteristic &> findCharacteristic(boost::uuids::uuid uuid) const = 0;
+ virtual const boost::optional<const BluetoothGattCharacteristic &> findCharacteristic(boost::uuids::uuid uuid) const = 0;
};
class BluetoothGatt {
@@ -165,9 +166,9 @@ public:
virtual void stopScan() = 0;
- virtual void runScan(std::function<void(BluetoothDevice &device)>) = 0;
+ virtual void runScan(std::function<void(const shared_ptr<BluetoothDevice> &device)>) = 0;
- virtual BluetoothDevice &getDevice(Mac &mac) = 0;
+ virtual shared_ptr <BluetoothDevice> getDevice(Mac &mac) = 0;
protected:
BluetoothAdapter();
@@ -185,6 +186,11 @@ public:
BluetoothSystem();
~BluetoothSystem();
+
+ shared_ptr<BluetoothAdapter> getAdapter(string name);
+
+private:
+ map<string, shared_ptr<BluetoothAdapter>> adapters;
};
enum AttPduType {
@@ -227,7 +233,7 @@ public:
static void makeWrite(ByteBuffer &req, uint16_t handle, const ByteBuffer &bytes);
private:
- static void checkType(ByteBuffer &bytes, AttPduType type);
+// static void checkType(ByteBuffer &bytes, AttPduType type);
static vector<AttributeData> parse(ByteBuffer &bytes, AttPduType type);
@@ -247,10 +253,6 @@ private:
AttributeData(uint16_t handle, ByteBuffer value);
};
-shared_ptr<BluetoothAdapter> getAdapter(int hciDevice);
-
-void shutdown();
-
boost::uuids::uuid makeUuid(const boost::uuids::uuid base, uint8_t a, uint8_t b);
}