aboutsummaryrefslogtreecommitdiff
path: root/BluetoothImpl.h
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2015-02-18 23:03:57 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2015-02-18 23:11:43 +0100
commit4d2339c65548cf553891b049200e6a845de293e9 (patch)
tree296acd302b61ca1e4ff673d102283485a3b4c9fe /BluetoothImpl.h
parent67478ec6b3f09c14195b8aea1099afb9bcaf9532 (diff)
downloadble-toys-4d2339c65548cf553891b049200e6a845de293e9.tar.gz
ble-toys-4d2339c65548cf553891b049200e6a845de293e9.tar.bz2
ble-toys-4d2339c65548cf553891b049200e6a845de293e9.tar.xz
ble-toys-4d2339c65548cf553891b049200e6a845de293e9.zip
o Successfully decoding GATT services.
Diffstat (limited to 'BluetoothImpl.h')
-rw-r--r--BluetoothImpl.h77
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();