BlueToe
an alternative GATT/BLE implementation
|
class responsible to keep track of those characteristics that have outstanding notifications or indications. More...
#include <bluetoe/notification_queue.hpp>
Public Member Functions | |
template<class ... Args> | |
notification_queue (Args... mixin_arguments) | |
constructs an empty notification_queue_impl | |
bool | queue_notification (std::size_t index) |
queue the indexed characteristic for notification | |
bool | queue_indication (std::size_t index) |
queue the indexed characteristic for indication | |
void | indication_confirmed () |
to be called, when a ATT Handle Value Confirmation was received. | |
std::pair< details::notification_queue_entry_type, std::size_t > | dequeue_indication_or_confirmation () |
return a next notification or indication to be send. | |
void | clear_indications_and_confirmations () |
removes all entries from the queue | |
class responsible to keep track of those characteristics that have outstanding notifications or indications.
All operations on the queue must be reentrent / atomic!
Sizes | List of number of characteristics that have notifications and / or indications enabled by priorities. |
Mixin | a class to be mixed in, to allow empty base class optimizations |
For all function, index is an index into a list of all the characterstics with notifications / indications enable. The queue is implemented by an array that contains a few bits (2) per characteristic to store the requested (or queued) notifications / indications.
bluetoe::notification_queue< Sizes, Mixin >::notification_queue | ( | Args... | mixin_arguments | ) |
constructs an empty notification_queue_impl
All constructor arguments are ment to be passed to the derived Mixin.
std::pair< details::notification_queue_entry_type, std::size_t > bluetoe::notification_queue< Sizes, Mixin >::dequeue_indication_or_confirmation |
return a next notification or indication to be send.
For a returned notification, the function will remove the returned entry. For a returned indication, the function will change the entry to 'unconfirmed' and will not return any indications until indication_confirmed() is called for the returned index.
void bluetoe::notification_queue< Sizes, Mixin >::indication_confirmed |
to be called, when a ATT Handle Value Confirmation was received.
If not outstanding confirmation is registered, the function has not side effect.
bool bluetoe::notification_queue< Sizes, Mixin >::queue_indication | ( | std::size_t | index | ) |
queue the indexed characteristic for indication
Once a characteristic is queued for indication, the function dequeue_indication_or_confirmation() will return { indication, index } om a future call.
If the given characteristic was already queued for indication, the function will not have any side effects.
The function returns true, if the given characteristic was not already queued for indication or if a confirmations is still awaited.
bool bluetoe::notification_queue< Sizes, Mixin >::queue_notification | ( | std::size_t | index | ) |
queue the indexed characteristic for notification
Once a characteristic is queued for notification, the function dequeue_indication_or_confirmation() will return { notification, index } on a future call.
If the given characteristic was already queued for notification, the function will not have any side effects.
The function returns true, if the given characteristic was not already queued for notifications.