aboutsummaryrefslogtreecommitdiff
path: root/src/GattCharacteristic.h
diff options
context:
space:
mode:
authorPaul Nettle <nettle.paul@gmail.com>2017-09-27 19:37:25 -0500
committerPaul Nettle <nettle.paul@gmail.com>2017-09-27 19:37:25 -0500
commit6feca1dc60a7e3277c504e50b566f08760c69baa (patch)
tree0428042e2587dab5353536b2bf71e2c81e6a22d2 /src/GattCharacteristic.h
parentAdvertising name logged on startup. (diff)
downloadgobbledegook-6feca1dc60a7e3277c504e50b566f08760c69baa.tar.gz
gobbledegook-6feca1dc60a7e3277c504e50b566f08760c69baa.tar.bz2
gobbledegook-6feca1dc60a7e3277c504e50b566f08760c69baa.zip
Added a threaded worker that listens for HCI events, resolving a number of problem areas.
Diffstat (limited to 'src/GattCharacteristic.h')
-rw-r--r--src/GattCharacteristic.h8
1 files changed, 8 insertions, 0 deletions
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<typename T>
void sendChangeNotificationValue(GDBusConnection *pBusConnection, T value) const
{
+ if (HciAdapter::getInstance().getActiveConnectionCount() == 0)
+ {
+ return;
+ }
+
GVariant *pVariant = Utils::gvariantFromByteArray(value);
sendChangeNotificationVariant(pBusConnection, pVariant);
}