diff options
author | Paul Nettle <nettle.paul@gmail.com> | 2018-01-08 07:42:09 -0600 |
---|---|---|
committer | Paul Nettle <nettle.paul@gmail.com> | 2018-01-08 07:42:09 -0600 |
commit | a7a0a74aa8d2a817ea9250dd3b93edf19ad0549e (patch) | |
tree | cab73cb12fe42abe84613ef8dec6248afed5109e /src/GattCharacteristic.h | |
parent | Cleaned up the deinitialization process to avoid inadvertent calls to shutdown (diff) | |
download | gobbledegook-a7a0a74aa8d2a817ea9250dd3b93edf19ad0549e.tar.gz gobbledegook-a7a0a74aa8d2a817ea9250dd3b93edf19ad0549e.tar.bz2 gobbledegook-a7a0a74aa8d2a817ea9250dd3b93edf19ad0549e.zip |
Improved handling of connection counts dealing with latent disconnects on startup. This includes a change to change to the behavior of change notifications for values, they no longer check for an active connection before transmitting - this is now up to the caller.HEADmaster
Diffstat (limited to 'src/GattCharacteristic.h')
-rw-r--r-- | src/GattCharacteristic.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/GattCharacteristic.h b/src/GattCharacteristic.h index 7284631..97322cc 100644 --- a/src/GattCharacteristic.h +++ b/src/GattCharacteristic.h @@ -202,6 +202,9 @@ struct GattCharacteristic : GattInterface // // This is a generalized method that accepts a `GVariant *`. A templated version is available that supports common types called // `sendChangeNotificationValue()`. + // + // The caller may choose to consult HciAdapter::getInstance().getActiveConnectionCount() in order to determine if there are any + // active connections before sending a change notification. void sendChangeNotificationVariant(GDBusConnection *pBusConnection, GVariant *pNewValue) const; // Sends a change notification to subscribers to this characteristic @@ -209,15 +212,11 @@ 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. + // The caller may choose to consult HciAdapter::getInstance().getActiveConnectionCount() in order to determine if there are any + // active connections before sending a change notification. template<typename T> void sendChangeNotificationValue(GDBusConnection *pBusConnection, T value) const { - if (HciAdapter::getInstance().getActiveConnectionCount() == 0) - { - return; - } - GVariant *pVariant = Utils::gvariantFromByteArray(value); sendChangeNotificationVariant(pBusConnection, pVariant); } |