kmMqtt 0.0.1
MQTT Client Library
Loading...
Searching...
No Matches
kmMqtt::mqtt::SessionState Struct Reference

Public Member Functions

 SessionState (const char *clientId, std::uint32_t sessionExpiryInterval, std::uint32_t retryInterval=0U) noexcept
 Constructs a new SessionState object.
 SessionState (const SessionState &) noexcept
 Copy constructor.
ClientErrorCode addPrevSessionState (const SessionState &prevSessionState) noexcept
 Adds previous session state messages to the current session state.
ClientErrorCode addMessage (const std::uint16_t packetId, PublishMessageData publishMsgData) noexcept
 Adds a message to the session state.
void updateMessage (const std::uint16_t packetId, PublishMessageStatus newStatus) noexcept
 Updates the status of a message in the session state and any other relevant data.
void removeMessage (const std::uint16_t packetId) noexcept
 Removes a message from the session state by packet ID.
const MessageContainermessages () const noexcept
 Gets the message container for the session state (const).
void clear () noexcept
 Clears all messages from the session state.
std::string getClientId () const noexcept
 Gets the client identifier.

Constructor & Destructor Documentation

◆ SessionState() [1/2]

kmMqtt::mqtt::SessionState::SessionState ( const char * clientId,
std::uint32_t sessionExpiryInterval,
std::uint32_t retryInterval = 0U )
noexcept

Constructs a new SessionState object.

Parameters
clientIdThe client identifier.
sessionExpiryIntervalThe session expiry interval in seconds.
retryIntervalThe retry interval for message delivery attempts.

◆ SessionState() [2/2]

kmMqtt::mqtt::SessionState::SessionState ( const SessionState & )
noexcept

Copy constructor.

Parameters
otherThe SessionState object to copy from.

Member Function Documentation

◆ addMessage()

ClientErrorCode kmMqtt::mqtt::SessionState::addMessage ( const std::uint16_t packetId,
PublishMessageData publishMsgData )
noexcept

Adds a message to the session state.

Parameters
packetIdThe packet identifier.
publishMsgDataData for publish packet.

◆ addPrevSessionState()

ClientErrorCode kmMqtt::mqtt::SessionState::addPrevSessionState ( const SessionState & prevSessionState)
noexcept

Adds previous session state messages to the current session state.

Parameters
prevSessionStateThe previous session state to add messages from.
Returns
ClientErrorCode indicating success or failure.

◆ getClientId()

std::string kmMqtt::mqtt::SessionState::getClientId ( ) const
inlinenoexcept

Gets the client identifier.

Returns
The client identifier.

◆ messages()

const MessageContainer & kmMqtt::mqtt::SessionState::messages ( ) const
inlinenoexcept

Gets the message container for the session state (const).

Returns
Const reference to the MessageContainer.

◆ removeMessage()

void kmMqtt::mqtt::SessionState::removeMessage ( const std::uint16_t packetId)
noexcept

Removes a message from the session state by packet ID.

Parameters
packetIdThe packet identifier to remove.

◆ updateMessage()

void kmMqtt::mqtt::SessionState::updateMessage ( const std::uint16_t packetId,
PublishMessageStatus newStatus )
noexcept

Updates the status of a message in the session state and any other relevant data.

Parameters
packetIdThe packet identifier of the message to update.
newStatusThe new status to set for the message.

The documentation for this struct was generated from the following file:
  • D:/Dev/Repos/kmMqtt/include/public/kmMqtt/Mqtt/State/SessionState/SessionState.h