From 9042b87f32bcabcc671e393376d3fb96ad858caa Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 21 Jun 2015 16:58:18 +0200 Subject: ble-scan: o New tool to scan for devices. Requires root on linux :( Linux is also touchy if the program dies. BluetoothAdapter: o Adding getMac(). --- ble/BluetoothImpl.h | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'ble/BluetoothImpl.h') diff --git a/ble/BluetoothImpl.h b/ble/BluetoothImpl.h index 204b051..3f4615e 100644 --- a/ble/BluetoothImpl.h +++ b/ble/BluetoothImpl.h @@ -16,6 +16,7 @@ 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb \ }; +#define LOG_TRACE(body) LOG4CPLUS_TRACE(logger, body) #define LOG_DEBUG(body) LOG4CPLUS_DEBUG(logger, body) #define LOG_INFO(body) LOG4CPLUS_INFO(logger, body) #define LOG_WARN(body) LOG4CPLUS_WARN(logger, body) @@ -44,8 +45,10 @@ protected: class DefaultBluetoothGattCharacteristic : 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), properties(properties), valueHandle(valueHandle) { + DefaultBluetoothGattCharacteristic(BluetoothGattService &service, uint16_t handle, uuid_t uuid, uint8_t properties, + uint16_t valueHandle) + : LogSetup("DefaultBluetoothGattCharacteristic"), service(service), handle(handle), uuid(uuid), + properties(properties), valueHandle(valueHandle) { } virtual ~DefaultBluetoothGattCharacteristic() { @@ -81,7 +84,8 @@ protected: class DefaultBluetoothGattService : public BluetoothGattService { public: - DefaultBluetoothGattService(BluetoothDevice &device, const uuid_t uuid, const uint16_t handle, const uint16_t endGroupHandle) + DefaultBluetoothGattService(BluetoothDevice &device, const uuid_t uuid, const uint16_t handle, + const uint16_t endGroupHandle) : device(device), uuid(uuid), handle(handle), endGroupHandle(endGroupHandle) { } @@ -218,12 +222,18 @@ protected: class DefaultBluetoothAdapter : protected LogSetup, public BluetoothAdapter { public: protected: - DefaultBluetoothAdapter() : - LogSetup("BluetoothAdapter") { + DefaultBluetoothAdapter(Mac &mac) : + LogSetup("BluetoothAdapter"), mac(mac) { } + + Mac const &getMac() override { + return mac; + }; + + Mac &mac; }; -BluetoothAdapter &getAdapterImpl(int hciDevice); +shared_ptr getAdapterImpl(int hciDevice); void shutdownImpl(); -- cgit v1.2.3