aboutsummaryrefslogtreecommitdiff
path: root/BluetoothImpl.h
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2015-02-20 22:56:22 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2015-02-20 22:56:22 +0100
commite44813dddbf5ba063d29ae1e40862e7a7cbb6f43 (patch)
tree67009d481b8b106af6937a5f386fe4e2e15b1fcc /BluetoothImpl.h
parentb6f080193d71334e8afea95ae26afbc03c27fac3 (diff)
downloadble-toys-e44813dddbf5ba063d29ae1e40862e7a7cbb6f43.tar.gz
ble-toys-e44813dddbf5ba063d29ae1e40862e7a7cbb6f43.tar.bz2
ble-toys-e44813dddbf5ba063d29ae1e40862e7a7cbb6f43.tar.xz
ble-toys-e44813dddbf5ba063d29ae1e40862e7a7cbb6f43.zip
Reorganizing the source code:
o Moving main to apps/ o Moving the library sources to ble/ o Creating cmake files for each piece.
Diffstat (limited to 'BluetoothImpl.h')
-rw-r--r--BluetoothImpl.h147
1 files changed, 0 insertions, 147 deletions
diff --git a/BluetoothImpl.h b/BluetoothImpl.h
deleted file mode 100644
index 3fad164..0000000
--- a/BluetoothImpl.h
+++ /dev/null
@@ -1,147 +0,0 @@
-#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, uint16_t handle, uuid_t uuid, uint8_t properties, uint16_t valueHandle)
- : service(service), handle(handle), uuid(uuid), properties(properties), valueHandle(valueHandle) {
- }
-
- virtual ~DefaultBluetoothGattCharacteristic() {
- }
-
- BluetoothGattService &getService() const {
- return service;
- }
-
- uint16_t getHandle() const {
- return handle;
- }
-
- const uuid_t getUuid() const {
- return uuid;
- }
-
- uint8_t getProperties() const {
- return properties;
- }
-
- uint16_t getValueHandle() const {
- return valueHandle;
- }
-
-protected:
- BluetoothGattService &service;
- uint16_t handle;
- uuid_t uuid;
- uint8_t properties;
- uint16_t valueHandle;
-};
-
-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) {
- DF;
- }
-
- virtual ~DefaultBluetoothGattService() {
- DF;
- removeCharacteristics();
- }
-
- virtual BluetoothDevice &getDevice() const {
- return device;
- }
-
- virtual uuid_t getUuid() const {
- return uuid;
- }
-
- virtual uint16_t getHandle() const {
- return handle;
- }
-
- virtual uint16_t getEndGroupHandle() const {
- return endGroupHandle;
- }
-
- virtual const vector<BluetoothGattCharacteristic *> getCharacteristics() const {
- return characteristics;
- }
-
- virtual void addCharacteristic(BluetoothGattCharacteristic *characteristic) {
- characteristics.push_back(characteristic);
- }
-
-protected:
- BluetoothDevice &device;
- const uuid_t uuid;
- const uint16_t handle;
- const uint16_t endGroupHandle;
- vector<BluetoothGattCharacteristic *> characteristics;
-
- void removeCharacteristics() {
- DF;
- for (auto &c: characteristics) {
- delete c;
- }
- characteristics.clear();
- }
-};
-
-class DefaultBluetoothDevice : public BluetoothDevice {
-public:
- virtual const vector<BluetoothGattService *> getServices() const {
- return services;
- };
-
- virtual void addService(BluetoothGattService *service) {
- services.push_back(service);
- }
-
-protected:
- DefaultBluetoothDevice() {
- DF;
- }
-
- virtual ~DefaultBluetoothDevice() {
- DF;
- removeServices();
- }
-
- void removeServices() {
- for (auto s: services) {
- delete s;
- }
- services.clear();
- }
-
- vector<BluetoothGattService *> services;
-};
-
-BluetoothAdapter &getAdapterImpl(int hciDevice);
-
-void shutdownImpl();
-
-}
-};
-
-#endif