Zigbee Protocol Controller 1.6.0
zigpc::gateway::RequestQueue Class Reference

The singleton ZigbeeHost Request Queue responsible for storing and dispatching calls. More...

#include <zigpc_gateway_request_queue.hpp>

Classes

class  Entry
 Base class used in the RequestQueue to invoke ZigbeeHost API calls. More...
 

Public Member Functions

 RequestQueue ()
 
 RequestQueue (RequestQueue &other)=delete
 
void operator= (const RequestQueue &)=delete
 
void stopDispatching ()
 Prevent sending any ZigbeeHost requests due to the NCP being reset. More...
 
void startDispatching (void)
 Configure queue to allow sending ZigbeeHost requests. More...
 
void enqueue (std::shared_ptr< Entry > call)
 Store call data to the queue that is used to dispatch calls to EmberAf/ZigbeeHost API. More...
 
sl_status_t dispatch (void)
 Dispatch a EmberAf/ZigbeeHost call from the queue. More...
 

Static Public Member Functions

static RequestQueuegetInstance ()
 Retrieve singleton instance. More...
 

Static Public Attributes

static const size_t DEFER_CYCLES_DEFAULT = 1U
 Number of cycles to defer under normal circumstances. This is used to increase/decrease the number of times zigbeeHostTick() is called per 1 ZigbeeHost API call. More...
 
static const size_t DEFER_CYCLES_START_BACKOFF = 20U
 Number of cycles to defer when the queue is allowed to send requests either on init or post reset. More...
 
static const size_t DEFER_CYCLES_LOST_CONNECTION = 50U
 Number of cycles to defer when a return status is indicative of a lost connection to the NCP. More...
 
static const size_t DEFER_CYCLES_MESSAGE_LIMIT_REACHED = 10U
 Number of defer cycles when too many messages are in-flight on the network. More...
 

Private Attributes

std::queue< std::shared_ptr< Entry > > queue
 
size_t defer_cycles = 0U
 
bool dispatching_allowed = false
 

Detailed Description

The singleton ZigbeeHost Request Queue responsible for storing and dispatching calls.

Constructor & Destructor Documentation

◆ RequestQueue() [1/2]

zigpc::gateway::RequestQueue::RequestQueue ( )

◆ RequestQueue() [2/2]

zigpc::gateway::RequestQueue::RequestQueue ( RequestQueue other)
delete

Member Function Documentation

◆ dispatch()

sl_status_t zigpc::gateway::RequestQueue::dispatch ( void  )

Dispatch a EmberAf/ZigbeeHost call from the queue.

This dispatch routine is responsible for sending calls to the EmberAf/ZigbeeHost API.

NOTE: If dispatching a EmberAf/ZigbeeHost call returns SL_STATUS_ZIGBEE_MAX_MESSAGE_LIMIT_REACHED , the call data is assumed to have failed since there are too many messages in-flight on the Zigbee network. To rectify this, the call is not dequeued and and call-defer-cycle counter is increased to defer making any calls for that many iterations.

Returns
sl_status_t SL_STATUS_OK on EmberAf/ZigbeeHost call success, SL_STATUS_TRANSMIT_BUSY if there are too many messages on the Zigbee network, or SL_STATUS_FAIL if the EmberAf/ZigbeeHost call failed.

◆ enqueue()

void zigpc::gateway::RequestQueue::enqueue ( std::shared_ptr< Entry call)

Store call data to the queue that is used to dispatch calls to EmberAf/ZigbeeHost API.

Parameters
callShared pointer to ZigbeeHost derived call data.

◆ getInstance()

static RequestQueue & zigpc::gateway::RequestQueue::getInstance ( )
static

Retrieve singleton instance.

Returns
RequestQueue&

◆ operator=()

void zigpc::gateway::RequestQueue::operator= ( const RequestQueue )
delete

◆ startDispatching()

void zigpc::gateway::RequestQueue::startDispatching ( void  )

Configure queue to allow sending ZigbeeHost requests.

NOTE: This must be called after initializing the queue.

◆ stopDispatching()

void zigpc::gateway::RequestQueue::stopDispatching ( )

Prevent sending any ZigbeeHost requests due to the NCP being reset.

Member Data Documentation

◆ defer_cycles

size_t zigpc::gateway::RequestQueue::defer_cycles = 0U
private

Number of cycles to defer before dispatching ZigbeeHost request(default=0U)

◆ DEFER_CYCLES_DEFAULT

const size_t zigpc::gateway::RequestQueue::DEFER_CYCLES_DEFAULT = 1U
static

Number of cycles to defer under normal circumstances. This is used to increase/decrease the number of times zigbeeHostTick() is called per 1 ZigbeeHost API call.

◆ DEFER_CYCLES_LOST_CONNECTION

const size_t zigpc::gateway::RequestQueue::DEFER_CYCLES_LOST_CONNECTION = 50U
static

Number of cycles to defer when a return status is indicative of a lost connection to the NCP.

NOTE: This value is chosen arbitrarily based on experimentation.

◆ DEFER_CYCLES_MESSAGE_LIMIT_REACHED

const size_t zigpc::gateway::RequestQueue::DEFER_CYCLES_MESSAGE_LIMIT_REACHED = 10U
static

Number of defer cycles when too many messages are in-flight on the network.

◆ DEFER_CYCLES_START_BACKOFF

const size_t zigpc::gateway::RequestQueue::DEFER_CYCLES_START_BACKOFF = 20U
static

Number of cycles to defer when the queue is allowed to send requests either on init or post reset.

NOTE: This value is chosen arbitrarily based on experimentation.

◆ dispatching_allowed

bool zigpc::gateway::RequestQueue::dispatching_allowed = false
private

Indicate if Requests can be dispatched to ZigbeeHost layer (default=FALSE)

◆ queue

std::queue<std::shared_ptr<Entry> > zigpc::gateway::RequestQueue::queue
private

ZigbeeHost call data


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