From 9c095ce3c2165ae9fb976b007ba5c14602d06a0b Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Fri, 20 Feb 2015 23:35:31 +0100 Subject: wip --- ble/Bluetooth.cpp | 14 ++++++++++++++ ble/Bluetooth.h | 11 +++++++++++ ble/LinuxBluetooth.cpp | 2 -- 3 files changed, 25 insertions(+), 2 deletions(-) (limited to 'ble') diff --git a/ble/Bluetooth.cpp b/ble/Bluetooth.cpp index b135282..4ceb3b6 100644 --- a/ble/Bluetooth.cpp +++ b/ble/Bluetooth.cpp @@ -165,6 +165,13 @@ BluetoothAdapter::BluetoothAdapter() { BluetoothAdapter::~BluetoothAdapter() { } +BluetoothSystem::BluetoothSystem() { +} + +BluetoothSystem::~BluetoothSystem() { + shutdown(); +} + /* map adapters; @@ -189,5 +196,12 @@ void shutdown() { shutdownImpl(); } +uuid_t makeUuid(const uuid_t base, uint8_t a, uint8_t b) { + uuid_t copy = base; + copy.data[2] = a; + copy.data[3] = b; + return copy; +} + } }; diff --git a/ble/Bluetooth.h b/ble/Bluetooth.h index e47ff3e..e7b163b 100644 --- a/ble/Bluetooth.h +++ b/ble/Bluetooth.h @@ -149,6 +149,15 @@ protected: virtual ~BluetoothAdapter(); }; +/** + * RAII support. + */ +class BluetoothSystem { +public: + BluetoothSystem(); + ~BluetoothSystem(); +}; + enum AttPduType { ERROR = 0x00, INVALID_HANDLE = 0x01, @@ -200,6 +209,8 @@ BluetoothAdapter &getAdapter(int hciDevice); void shutdown(); +boost::uuids::uuid makeUuid(const boost::uuids::uuid base, uint8_t a, uint8_t b); + } } diff --git a/ble/LinuxBluetooth.cpp b/ble/LinuxBluetooth.cpp index 4b7f0e0..b687807 100644 --- a/ble/LinuxBluetooth.cpp +++ b/ble/LinuxBluetooth.cpp @@ -19,8 +19,6 @@ namespace trygvis { namespace bluetooth { namespace linux { -typedef boost::uuids::uuid uuid_t; - using namespace uuids; class LinuxBluetoothDevice; -- cgit v1.2.3