diff options
Diffstat (limited to 'BluetoothImpl.h')
-rw-r--r-- | BluetoothImpl.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/BluetoothImpl.h b/BluetoothImpl.h index ba44853..3d3ce29 100644 --- a/BluetoothImpl.h +++ b/BluetoothImpl.h @@ -1,9 +1,86 @@ #ifndef BLUETOOTH_IMPL_H #define BLUETOOTH_IMPL_H +#include "Bluetooth.h" +#include <boost/uuid/uuid_io.hpp> + +#define BLUETOOTH_UUID_INITIALIZER \ + { \ + 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, \ + 0x10, 0x00, \ + 0x80, 0x00, \ + 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb \ + }; + namespace trygvis { namespace bluetooth { +typedef boost::uuids::uuid uuid_t; + +class DefaultBluetoothGattCharacteristic : public BluetoothGattCharacteristic { +public: + DefaultBluetoothGattCharacteristic(BluetoothGattService& service, uuid_t uuid) : service(service), uuid(uuid) { + } + + virtual ~DefaultBluetoothGattCharacteristic() { + } + + const uuid_t getUuid() const { + return uuid; + }; + + BluetoothGattService& getService() const { + return service; + }; + +protected: + BluetoothGattService& service; + uuid_t uuid; +}; + +class DefaultBluetoothGattService : public BluetoothGattService { +public: + DefaultBluetoothGattService(BluetoothDevice& device, const uuid_t uuid) : + device(device), uuid(uuid) { + } + + virtual ~DefaultBluetoothGattService() { + } + + BluetoothDevice& getDevice() const { + return device; + } + + uuid_t getUuid() const { + return uuid; + } + + vector<BluetoothGattCharacteristic* >::const_iterator getCharacteristics() const { + return characteristics.begin(); + } + +protected: + BluetoothDevice &device; + const uuid_t uuid; + const vector<BluetoothGattCharacteristic*> characteristics; +}; + +class DefaultBluetoothDevice : public BluetoothDevice { +public: + virtual vector<BluetoothGattService*>::const_iterator getServices() const { + return services.begin(); + }; + +protected: + virtual ~DefaultBluetoothDevice() { + for (auto s: services) { + delete s; + } + } + vector<BluetoothGattService*> services; +}; + BluetoothAdapter &getAdapterImpl(int hciDevice); void shutdownImpl(); |