BlueToe
an alternative GATT/BLE implementation
Loading...
Searching...
No Matches
Public Member Functions | List of all members
bluetoe::notification_queue< Sizes, Mixin > Class Template Reference

class responsible to keep track of those characteristics that have outstanding notifications or indications. More...

#include <bluetoe/notification_queue.hpp>

Inheritance diagram for bluetoe::notification_queue< Sizes, Mixin >:

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
 

Detailed Description

template<typename Sizes, class Mixin>
class bluetoe::notification_queue< Sizes, Mixin >

class responsible to keep track of those characteristics that have outstanding notifications or indications.

All operations on the queue must be reentrent / atomic!

Parameters
SizesList of number of characteristics that have notifications and / or indications enabled by priorities.
Mixina 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.

Constructor & Destructor Documentation

◆ notification_queue()

template<typename Sizes , class Mixin >
template<class ... Args>
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.

Member Function Documentation

◆ dequeue_indication_or_confirmation()

template<typename Sizes , class 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.

◆ indication_confirmed()

template<typename Sizes , class Mixin >
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.

◆ queue_indication()

template<typename Sizes , class Mixin >
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.

Precondition
index < Size

◆ queue_notification()

template<typename Sizes , class Mixin >
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.

Precondition
index < Size

The documentation for this class was generated from the following file: