From 6feca1dc60a7e3277c504e50b566f08760c69baa Mon Sep 17 00:00:00 2001 From: Paul Nettle Date: Wed, 27 Sep 2017 19:37:25 -0500 Subject: Added a threaded worker that listens for HCI events, resolving a number of problem areas. --- src/GattCharacteristic.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/GattCharacteristic.h') diff --git a/src/GattCharacteristic.h b/src/GattCharacteristic.h index 3815b2a..7284631 100644 --- a/src/GattCharacteristic.h +++ b/src/GattCharacteristic.h @@ -40,6 +40,7 @@ #include "Utils.h" #include "TickEvent.h" #include "GattInterface.h" +#include "HciAdapter.h" namespace ggk { @@ -207,9 +208,16 @@ struct GattCharacteristic : GattInterface // // This is a helper method that accepts common types. For custom types, there is a form that accepts a `GVariant *`, called // `sendChangeNotificationVariant()`. + // + // If there are no connections, this method returns doing nothing. template void sendChangeNotificationValue(GDBusConnection *pBusConnection, T value) const { + if (HciAdapter::getInstance().getActiveConnectionCount() == 0) + { + return; + } + GVariant *pVariant = Utils::gvariantFromByteArray(value); sendChangeNotificationVariant(pBusConnection, pVariant); } -- cgit v1.2.3