Myriota UltraLite SDK 2.4.0
Loading...
Searching...
No Matches
User message

Transmit message scheduling and queue management. More...

Classes

struct  MessageStatus_t
 Status information for a message in the uplink queue. More...
 

Macros

#define MAX_MESSAGE_SIZE   20
 Maximum size in bytes of individual transmit message.
 

Enumerations

enum  MessageTransmitStatus_t { TRANSMIT_PENDING , TRANSMIT_ONGOING , TRANSMIT_COMPLETE , TRANSMIT_EXPIRED }
 Message transmission status. More...
 

Functions

MYRIOTA_USER_API int ScheduleMessage (const uint8_t *Message, size_t MessageSize)
 Schedule a message of the given size for transmission.
 
MYRIOTA_USER_API int MessageSlotsFree (void)
 Returns the number of available slots in the internal queue.
 
MYRIOTA_USER_API size_t MessageBytesFree (void)
 Returns the number of bytes remaining in the internal queue.
 
MYRIOTA_USER_API int MessageSlotsMax (void)
 Returns the maximum number of message slots available in the internal message queue.
 
MYRIOTA_USER_API void SaveMessages (void)
 Save all messages in the message queue to module's persistent storage.
 
MYRIOTA_USER_API void MessageQueueClear (void)
 Clear all messages in the message queue.
 
MYRIOTA_USER_API int MessageQueueStatus (MessageStatus_t *status, const int status_count)
 Returns the status of messages in the message queue.
 
MYRIOTA_USER_API int MessageQueueDelete (const uint16_t message_id)
 Deletes a message from the message queue based on its message ID.
 

Detailed Description

Transmit message scheduling and queue management.

Macro Definition Documentation

◆ MAX_MESSAGE_SIZE

#define MAX_MESSAGE_SIZE   20

Maximum size in bytes of individual transmit message.

Deprecated:
This constant is DEPRECATED and should not be used.

Enumeration Type Documentation

◆ MessageTransmitStatus_t

Message transmission status.

Enumerator
TRANSMIT_PENDING 

Message not yet transmitted.

TRANSMIT_ONGOING 

Message is currently being transmitted.

TRANSMIT_COMPLETE 

Message fully transmitted.

TRANSMIT_EXPIRED 

Message expired before completion.

Function Documentation

◆ ScheduleMessage()

MYRIOTA_USER_API int ScheduleMessage ( const uint8_t *  Message,
size_t  MessageSize 
)

Schedule a message of the given size for transmission.

Calling ScheduleMessage when MessageSlotsFree returns 0 replaces an existing message in the queue, which may result in dropped messages. Message IDs are sequential unsigned 16-bit integers and start at zero. IDs are guaranteed to be unique across messages that are in the queue at any given time (IDs wrap after 65535).

Parameters
Message[in]Pointer to the message data.
MessageSizeSize of the message in bytes.
Returns
Message ID (>=0) if successfully scheduled, or <0 on failure.
See also
MessageSlotsFree(), MessageBytesFree(), MessageSlotsMax()

◆ MessageSlotsFree()

MYRIOTA_USER_API int MessageSlotsFree ( void  )

Returns the number of available slots in the internal queue.

Returns
The number of available slots in the internal queue, that is, the number of messages that can be scheduled with ScheduleMessage.

◆ MessageBytesFree()

MYRIOTA_USER_API size_t MessageBytesFree ( void  )

Returns the number of bytes remaining in the internal queue.

Returns
The number of bytes remaining in the internal queue, that is, the number of bytes that can be scheduled with ScheduleMessage.

◆ MessageSlotsMax()

MYRIOTA_USER_API int MessageSlotsMax ( void  )

Returns the maximum number of message slots available in the internal message queue.

Returns
The maximum number of message slots available in the internal message queue. This value represents the total capacity of the queue, independent of how many slots are currently free.

◆ SaveMessages()

MYRIOTA_USER_API void SaveMessages ( void  )

Save all messages in the message queue to module's persistent storage.

Saved messages will be transmitted after reset.

See also
MessageQueueClear()

◆ MessageQueueClear()

MYRIOTA_USER_API void MessageQueueClear ( void  )

Clear all messages in the message queue.

Clears the in-memory message queue, discarding all pending messages that have not yet been transmitted.

See also
SaveMessages(), ScheduleMessage()

◆ MessageQueueStatus()

MYRIOTA_USER_API int MessageQueueStatus ( MessageStatus_t *  status,
const int  status_count 
)

Returns the status of messages in the message queue.

Fills up to status_count entries in the status array.

Parameters
status[out]Pointer to an array of MessageStatus_t structures to be filled with message status information.
status_countThe maximum number of entries that can be written to the status array.
Returns
The number of entries written, or -1 if invalid input.

◆ MessageQueueDelete()

MYRIOTA_USER_API int MessageQueueDelete ( const uint16_t  message_id)

Deletes a message from the message queue based on its message ID.

Parameters
message_idThe ID of the message to delete.
Returns
0 if the message was successfully deleted, or -1 if the ID was not found.