From d720fa36ad4768ed1b948a92ba5287c30093fbec Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 26 Jul 2015 18:33:15 +0200 Subject: o Overhaul of the bluetooth code. - Adding support for reading FLOAT (specified in IEEE 11073-20601) values from a bluetooth device. - More shared pointers to help keep track of the object's lifecycle. Makes sure that the connections are released back to Linux, Linux is way to sensitive with crashing applications. o Adding support for reading the temperature sensors from the SoilMoisture device. --- ble/BluetoothImpl.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'ble/BluetoothImpl.h') diff --git a/ble/BluetoothImpl.h b/ble/BluetoothImpl.h index 3f4615e..4627443 100644 --- a/ble/BluetoothImpl.h +++ b/ble/BluetoothImpl.h @@ -43,11 +43,11 @@ protected: // Shared classes -class DefaultBluetoothGattCharacteristic : LogSetup, public BluetoothGattCharacteristic { +class DefaultBluetoothGattCharacteristic : protected LogSetup, public BluetoothGattCharacteristic { public: DefaultBluetoothGattCharacteristic(BluetoothGattService &service, uint16_t handle, uuid_t uuid, uint8_t properties, uint16_t valueHandle) - : LogSetup("DefaultBluetoothGattCharacteristic"), service(service), handle(handle), uuid(uuid), + : LogSetup("BluetoothGattCharacteristic"), service(service), handle(handle), uuid(uuid), properties(properties), valueHandle(valueHandle) { } @@ -117,14 +117,14 @@ public: characteristics.push_back(characteristic); } - virtual const o findCharacteristic(uuid_t uuid) const { + virtual const o findCharacteristic(uuid_t uuid) const { for (auto c: characteristics) { if (memcmp(c->getUuid().data, uuid.data, 16) == 0) { - return o(*c); + return o(*c); } } - return o(); + return o(); } protected: @@ -187,7 +187,7 @@ protected: }; template -class DefaultBluetoothDevice : public BluetoothDevice { +class DefaultBluetoothDevice : protected LogSetup, public BluetoothDevice { public: virtual Mac const &getMac() override { @@ -199,7 +199,7 @@ public: } protected: - DefaultBluetoothDevice(A &adapter, Mac &mac) : + DefaultBluetoothDevice(A &adapter, Mac &mac) : LogSetup("BluetoothDevice"), adapter(adapter), mac(mac) { } @@ -233,9 +233,7 @@ protected: Mac &mac; }; -shared_ptr getAdapterImpl(int hciDevice); - -void shutdownImpl(); +shared_ptr getAdapterImpl(string name); } }; -- cgit v1.2.3