#ifndef BLUETOOTH_IMPL_H #define BLUETOOTH_IMPL_H #include "Bluetooth.h" #include #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, const uint16_t handle, const uint16_t endGroupHandle) : device(device), uuid(uuid), handle(handle), endGroupHandle(endGroupHandle) { } virtual ~DefaultBluetoothGattService() { } BluetoothDevice& getDevice() const { return device; } uuid_t getUuid() const { return uuid; } uint16_t getHandle() const { return handle; } uint16_t getEndGroupHandle() const { return endGroupHandle; } vector::const_iterator getCharacteristics() const { return characteristics.begin(); } protected: BluetoothDevice &device; const uuid_t uuid; const uint16_t handle; const uint16_t endGroupHandle; const vector characteristics; }; class DefaultBluetoothDevice : public BluetoothDevice { public: virtual vector::const_iterator getServices() const { return services.begin(); }; protected: virtual ~DefaultBluetoothDevice() { for (auto s: services) { delete s; } } vector services; }; BluetoothAdapter &getAdapterImpl(int hciDevice); void shutdownImpl(); } }; #endif