RockBLOCK 9704 C Library
Doxygen documentation for the RockBLOCK 9704 C Library.
Loading...
Searching...
No Matches
Classes | Macros | Functions
imt_queue.h File Reference
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  imt_t
 Represents a single message in the queue. More...
 
struct  imt_queue_t
 Circular buffer structure to hold queued messages. More...
 

Macros

#define IMT_QUEUE_SIZE   1U
 Number of messages allowed in the internal message queue.
 
#define IMT_CRC_SIZE   2U
 Number of bytes reserved for CRC at the end of the payload.
 
#define IMT_PAYLOAD_SIZE   100000U + IMT_CRC_SIZE
 Maximum payload size of a single message with the CRC added on.
 

Functions

bool imtQueueMoAdd (const uint16_t topic, const char *data, const size_t length)
 Add an outgoing mobile-originated (MO) message to the queue.
 
bool imtQueueMtAdd (const uint16_t topic, const uint16_t id, const size_t length)
 Add an incoming mobile-terminated (MT) message to the queue.
 
bool imtQueueMoRemove (void)
 Remove an outgoing mobile-originated (MO) message from the queue.
 
bool imtQueueMtRemove (void)
 Remove an outgoing mobile-terminated (MT) message from the queue.
 
imt_timtQueueMoGetFirst (void)
 Get the address of the head of the MO queue.
 
imt_timtQueueMtGetFirst (void)
 Get the address of the head of the MT queue.
 
imt_timtQueueMtGetLast (void)
 Get the address of the latest message in the MT queue.
 
void imtQueueMtLock (bool lock)
 Lock or unlock the MT queue to prevent messages from getting discarded if full.
 
void imtQueueInit (void)
 Used to initialise both outgoing and incoming queues.
 
size_t imtQueueSize (imt_queue_t *queue)
 Inline function used to get the current size of the selected queue.
 

Macro Definition Documentation

◆ IMT_CRC_SIZE

#define IMT_CRC_SIZE   2U

Number of bytes reserved for CRC at the end of the payload.

◆ IMT_PAYLOAD_SIZE

#define IMT_PAYLOAD_SIZE   100000U + IMT_CRC_SIZE

Maximum payload size of a single message with the CRC added on.

◆ IMT_QUEUE_SIZE

#define IMT_QUEUE_SIZE   1U

Number of messages allowed in the internal message queue.

Function Documentation

◆ imtQueueInit()

void imtQueueInit ( void  )

Used to initialise both outgoing and incoming queues.

◆ imtQueueMoAdd()

bool imtQueueMoAdd ( const uint16_t  topic,
const char *  data,
const size_t  length 
)

Add an outgoing mobile-originated (MO) message to the queue.

Parameters
topicMessage topic ID.
dataPointer to the message payload.
lengthMessage payload length in bytes.
Returns
Bool indicating success or failure to add the message to the queue.

◆ imtQueueMoGetFirst()

imt_t * imtQueueMoGetFirst ( void  )

Get the address of the head of the MO queue.

Returns
Pointer to the next message in the queue, NULL if queue is empty.

◆ imtQueueMoRemove()

bool imtQueueMoRemove ( void  )

Remove an outgoing mobile-originated (MO) message from the queue.

Returns
Bool indicating success or failure to remove the message from the queue.

◆ imtQueueMtAdd()

bool imtQueueMtAdd ( const uint16_t  topic,
const uint16_t  id,
const size_t  length 
)

Add an incoming mobile-terminated (MT) message to the queue.

Parameters
topicMessage topic ID.
idUnique identifier of the message assigned by the modem.
lengthMessage payload length in bytes.
Returns
Bool indicating success or failure to add the message to the queue.

◆ imtQueueMtGetFirst()

imt_t * imtQueueMtGetFirst ( void  )

Get the address of the head of the MT queue.

Returns
Pointer to the next message in the queue, NULL if queue is empty.

◆ imtQueueMtGetLast()

imt_t * imtQueueMtGetLast ( void  )

Get the address of the latest message in the MT queue.

Returns
Pointer to the last message in the queue, NULL if queue is empty.

◆ imtQueueMtLock()

void imtQueueMtLock ( bool  lock)

Lock or unlock the MT queue to prevent messages from getting discarded if full.

Parameters
lockCalled with true to lock the queue and false to unlock the queue.
Note
This is set to false by default.

◆ imtQueueMtRemove()

bool imtQueueMtRemove ( void  )

Remove an outgoing mobile-terminated (MT) message from the queue.

Returns
Bool indicating success or failure to remove the message from the queue.

◆ imtQueueSize()

size_t imtQueueSize ( imt_queue_t queue)
inline

Inline function used to get the current size of the selected queue.

Parameters
queuePointer to the selected queue.
Returns
size_t of the current queue size.