This module includes functions that manipulate OpenThread message buffers. More...
Data Structures | |
| struct | otMessage |
| struct | otBufferInfo |
| struct | otMessageSettings |
| struct | otMessageQueue |
Typedefs | |
| typedef struct otMessage | otMessage |
| typedef struct otBufferInfo | otBufferInfo |
| typedef enum otMessagePriority | otMessagePriority |
| typedef struct otMessageSettings | otMessageSettings |
Enumerations | |
| enum | otMessagePriority { OT_MESSAGE_PRIORITY_LOW = 0, OT_MESSAGE_PRIORITY_NORMAL = 1, OT_MESSAGE_PRIORITY_HIGH = 2 } |
Detailed Description
This module includes functions that manipulate OpenThread message buffers.
Typedef Documentation
◆ otBufferInfo
| typedef struct otBufferInfo otBufferInfo |
This structure represents the message buffer information.
◆ otMessage
◆ otMessagePriority
| typedef enum otMessagePriority otMessagePriority |
This enumeration defines the OpenThread message priority levels.
◆ otMessageSettings
| typedef struct otMessageSettings otMessageSettings |
This structure represents a message settings.
Enumeration Type Documentation
◆ otMessagePriority
| enum otMessagePriority |
Function Documentation
◆ otMessageAppend()
Append bytes to a message.
- Parameters
-
[in] aMessage A pointer to a message buffer. [in] aBuf A pointer to the data to append. [in] aLength Number of bytes to append.
- Return values
-
OT_ERROR_NONE Successfully appended to the message OT_ERROR_NO_BUFS No available buffers to grow the message.
◆ otMessageFree()
| void otMessageFree | ( | otMessage * | aMessage | ) |
Free an allocated message buffer.
- Parameters
-
[in] aMessage A pointer to a message buffer.
◆ otMessageGetBufferInfo()
| void otMessageGetBufferInfo | ( | otInstance * | aInstance, |
| otBufferInfo * | aBufferInfo | ||
| ) |
Get the Message Buffer information.
- Parameters
-
[in] aInstance A pointer to the OpenThread instance. [out] aBufferInfo A pointer where the message buffer information is written.
◆ otMessageGetLength()
| uint16_t otMessageGetLength | ( | const otMessage * | aMessage | ) |
Get the message length in bytes.
- Parameters
-
[in] aMessage A pointer to a message buffer.
- Returns
- The message length in bytes.
◆ otMessageGetOffset()
| uint16_t otMessageGetOffset | ( | const otMessage * | aMessage | ) |
Get the message offset in bytes.
- Parameters
-
[in] aMessage A pointer to a message buffer.
- Returns
- The message offset value.
◆ otMessageGetRss()
| int8_t otMessageGetRss | ( | const otMessage * | aMessage | ) |
This function returns the average RSS (received signal strength) associated with the message.
- Returns
- The average RSS value (in dBm) or OT_RADIO_RSSI_INVALID if no average RSS is available.
◆ otMessageIsLinkSecurityEnabled()
| bool otMessageIsLinkSecurityEnabled | ( | const otMessage * | aMessage | ) |
This function indicates whether or not link security is enabled for the message.
- Parameters
-
[in] aMessage A pointer to a message buffer.
- Return values
-
TRUE If link security is enabled. FALSE If link security is not enabled.
◆ otMessageQueueDequeue()
| otError otMessageQueueDequeue | ( | otMessageQueue * | aQueue, |
| otMessage * | aMessage | ||
| ) |
This function removes a message from the given message queue.
- Parameters
-
[in] aQueue A pointer to the message queue. [in] aMessage The message to remove.
- Return values
-
OT_ERROR_NONE Successfully removed the message from the queue. OT_ERROR_NOT_FOUND The message is not enqueued in this queue.
◆ otMessageQueueEnqueue()
| otError otMessageQueueEnqueue | ( | otMessageQueue * | aQueue, |
| otMessage * | aMessage | ||
| ) |
This function adds a message to the end of the given message queue.
- Parameters
-
[in] aQueue A pointer to the message queue. [in] aMessage The message to add.
- Return values
-
OT_ERROR_NONE Successfully added the message to the queue. OT_ERROR_ALREADY The message is already enqueued in a queue.
◆ otMessageQueueEnqueueAtHead()
| otError otMessageQueueEnqueueAtHead | ( | otMessageQueue * | aQueue, |
| otMessage * | aMessage | ||
| ) |
This function adds a message at the head/front of the given message queue.
- Parameters
-
[in] aQueue A pointer to the message queue. [in] aMessage The message to add.
- Return values
-
OT_ERROR_NONE Successfully added the message to the queue. OT_ERROR_ALREADY The message is already enqueued in a queue.
◆ otMessageQueueGetHead()
| otMessage* otMessageQueueGetHead | ( | otMessageQueue * | aQueue | ) |
This function returns a pointer to the message at the head of the queue.
- Parameters
-
[in] aQueue A pointer to a message queue.
- Returns
- A pointer to the message at the head of queue or NULL if queue is empty.
◆ otMessageQueueGetNext()
| otMessage* otMessageQueueGetNext | ( | otMessageQueue * | aQueue, |
| const otMessage * | aMessage | ||
| ) |
This function returns a pointer to the next message in the queue by iterating forward (from head to tail).
- Parameters
-
[in] aQueue A pointer to a message queue. [in] aMessage A pointer to current message buffer.
- Returns
- A pointer to the next message in the queue after
aMessageor NULL ifaMessage is the tail of queue. NULL is returned ifaMessageis not in the queueaQueue`.
◆ otMessageQueueInit()
| void otMessageQueueInit | ( | otMessageQueue * | aQueue | ) |
Initialize the message queue.
This function MUST be called once and only once for a otMessageQueue instance before any other otMessageQueue functions. The behavior is undefined if other queue APIs are used with an otMessageQueue before it being initialized or if it is initialized more than once.
- Parameters
-
[in] aQueue A pointer to a message queue.
◆ otMessageRead()
| uint16_t otMessageRead | ( | const otMessage * | aMessage, |
| uint16_t | aOffset, | ||
| void * | aBuf, | ||
| uint16_t | aLength | ||
| ) |
Read bytes from a message.
- Parameters
-
[in] aMessage A pointer to a message buffer. [in] aOffset An offset in bytes. [in] aBuf A pointer to a buffer that message bytes are read to. [in] aLength Number of bytes to read.
- Returns
- The number of bytes read.
◆ otMessageSetDirectTransmission()
| void otMessageSetDirectTransmission | ( | otMessage * | aMessage, |
| bool | aEnabled | ||
| ) |
This function sets/forces the message to be forwarded using direct transmission. Default setting for a new message is false.
- Parameters
-
[in] aMessage A pointer to a message buffer. [in] aEnabled If true, the message is forced to use direct transmission. Iffalse, the message follows the normal procedure.
◆ otMessageSetLength()
Set the message length in bytes.
- Parameters
-
[in] aMessage A pointer to a message buffer. [in] aLength A length in bytes.
- Return values
-
OT_ERROR_NONE Successfully set the message length. OT_ERROR_NO_BUFS No available buffers to grow the message.
◆ otMessageSetOffset()
Set the message offset in bytes.
- Parameters
-
[in] aMessage A pointer to a message buffer. [in] aOffset An offset in bytes.
- Return values
-
OT_ERROR_NONE Successfully set the message offset. OT_ERROR_INVALID_ARGS The offset is beyond the message length.
◆ otMessageWrite()
| int otMessageWrite | ( | otMessage * | aMessage, |
| uint16_t | aOffset, | ||
| const void * | aBuf, | ||
| uint16_t | aLength | ||
| ) |
Write bytes to a message.
- Parameters
-
[in] aMessage A pointer to a message buffer. [in] aOffset An offset in bytes. [in] aBuf A pointer to a buffer that message bytes are written from. [in] aLength Number of bytes to write.
- Returns
- The number of bytes written.