ZigBee Queue Resources
The ZigBee Queue resources are concerned with creating and operating queues for passing messages from one task to another. These resources are provided in the header file ZQueue.h.
The ZigBee Queue functions are described in Section 10.1.1.
The ZigBee Queue structures are described in Section 10.1.2.
ZigBee queue functions
The ZigBee Queue functions are listed below.
Function page
Parent topic:ZigBee queue functions
ZQ_vQueueCreate
void ZQ_vQueueCreate(tszQueue *psQueueHandle,
const uint32 uiQueueLength,
const uint32 uiItemSize,
uint8 *pu8StartQueue);
Description
This function creates a message queue for use by the application or stack (message queues are described in Section 6.9.1). The size of the queue and the size of a message in the queue must be specified, as well as the location in memory where the queue should start. A unique handle must also be given to the queue, where this handle is a pointer to a tszQueue
structure that contains up-to-date information about the queue.
Parameters
psQueueHandle Handle of message queue - this is a pointer to a
tszQueue
structure (see Section 10.1.2.1).uiQueueLength Size of the queue in terms of the number of messages that it can hold.
uiItemSize Size of a message in the queue, in bytes.
pu8StartQueue Pointer to the start of the message queue.
Parent topic:ZQ_vQueueCreate
Returns
None
Parent topic:ZQ_vQueueCreate
Parent topic:ZigBee queue functions
ZQ_bQueueSend
bool_t ZQ_bQueueSend(void *pvQueueHandle,
const void *pvItemToQueue);
Description
This function submits a message to the specified message queue. The return code indicates whether the message was successfully added to the queue.
Parent topic:ZQ_bQueueSend
Parameters
pvQueueHandle Handle of message queue
pvItemToQueue Pointer to the message to be added to the queue
Parent topic:ZQ_bQueueSend
Returns
Boolean indicating the outcome of the operation:
TRUE - message successfully added to the queue
FALSE - message not added to the queue
Parent topic:ZQ_bQueueSend
Parent topic:ZigBee queue functions
ZQ_bQueueReceive
ZQ_bQueueReceive(void *pvQueueHandle,
void *pvItemFromQueue);
Description
This function obtains a message from the specified message queue. The return code indicates whether a message was successfully obtained from the queue.
Parent topic:ZQ_bQueueReceive
Parameters
pvQueueHandle: Handle of message queue
pvItemFromQueue: Pointer to memory location to receive the obtained message
Parent topic:ZQ_bQueueReceive
Returns
Boolean indicating the outcome of the operation:
TRUE - message successfully obtained from the queue.
FALSE - message not obtained from the queue.
Parent topic:ZQ_bQueueReceive
Parent topic:ZigBee queue functions
ZQ_bQueueIsEmpty
bool_t ZQ_bQueueIsEmpty(void *pvQueueHandle);
Description
This function checks whether the specified message queue is empty. The return code indicates whether the queue is empty.
Parent topic:ZQ_bQueueIsEmpty
Parameters
pvQueueHandle Handle of message queue
Parent topic:ZQ_bQueueIsEmpty
Returns
Boolean indicating the outcome of the operation:
TRUE - message queue is empty.
FALSE - message queue is not empty.
Parent topic:ZQ_bQueueIsEmpty
Parent topic:ZigBee queue functions
ZQ_u32QueueGetQueueSize
bool_t ZQ_bQueueIsEmpty(void *pvQueueHandle);
Description
This function obtains the capacity of the specified message queue. The return code indicates the size of the queue in terms of the number of messages that it can hold.
Parent topic:ZQ_u32QueueGetQueueSize
Parameters
pvQueueHandle Handle of message queue
Parent topic:ZQ_u32QueueGetQueueSize
Returns
The capacity of the queue in terms of the number of messages that it can hold.
Parent topic:ZQ_u32QueueGetQueueSize
Parent topic:ZigBee queue functions
ZQ_u32QueueGetQueueMessageWaiting
uint32 ZQ_u32QueueGetQueueMessageWaiting(
void *pu8QueueHandle);
Description
This function obtains the number of messages that are currently waiting in the specified message queue.
Parent topic:ZQ_u32QueueGetQueueMessageWaiting
Parameters
pvQueueHandle Handle of message queue
Parent topic:ZQ_u32QueueGetQueueMessageWaiting
Returns
Number of messages waiting in the queue
Parent topic:ZQ_u32QueueGetQueueMessageWaiting
Parent topic:ZigBee queue functions
Parent topic:ZigBee Queue Resources
ZigBee queue structures
tszQueue
The ZigBee queue structure tszQueue
is shown below.
typedef struct
{
uint32 u32Length;
uint32 u32ItemSize;
uint32 u32MessageWaiting;
void *pvHead;
void *pvWriteTo;
void *pvReadFrom;
}tszQueue;
where:
u32Length
is the size of the queue in terms of the number of messages that it can holdu32ItemSize
is the size of a message, in bytesu32MessageWaiting
is the number of messages currently in the queuepvHead
is a pointer to the beginning of the queue storage areapvWriteTo
is a pointer to the next free place in the storage area where a new message can be writtenpvReadFrom
is a pointer to the next message to be read from the storage area
Parent topic:ZigBee queue structures
Parent topic:ZigBee Queue Resources
Parent topic:General ZPS Resources