mqtt_cpp
Public Member Functions | List of all members
MQTT_NS::packet_id_manager< PacketId > Class Template Reference

#include <packet_id_manager.hpp>

Public Member Functions

optional< packet_id_t > acquire_unique_id ()
 Acquire the new unique packet id. If all packet ids are already in use, then returns nullopt After acquiring the packet id, you can call acquired_* functions. The ownership of packet id is moved to the library. Or you can call release_packet_id to release it. More...
 
bool register_id (packet_id_t packet_id)
 Register packet_id to the library. After registering the packet_id, you can call acquired_* functions. The ownership of packet id is moved to the library. Or you can call release_packet_id to release it. More...
 
void release_id (packet_id_t packet_id)
 Release packet_id. More...
 
void clear ()
 Clear all packet ids. More...
 

Member Function Documentation

◆ acquire_unique_id()

template<typename PacketId >
optional<packet_id_t> MQTT_NS::packet_id_manager< PacketId >::acquire_unique_id ( )
inline

Acquire the new unique packet id. If all packet ids are already in use, then returns nullopt After acquiring the packet id, you can call acquired_* functions. The ownership of packet id is moved to the library. Or you can call release_packet_id to release it.

Returns
packet id

◆ clear()

template<typename PacketId >
void MQTT_NS::packet_id_manager< PacketId >::clear ( )
inline

Clear all packet ids.

◆ register_id()

template<typename PacketId >
bool MQTT_NS::packet_id_manager< PacketId >::register_id ( packet_id_t  packet_id)
inline

Register packet_id to the library. After registering the packet_id, you can call acquired_* functions. The ownership of packet id is moved to the library. Or you can call release_packet_id to release it.

Returns
If packet_id is successfully registerd then return true, otherwise return false.

◆ release_id()

template<typename PacketId >
void MQTT_NS::packet_id_manager< PacketId >::release_id ( packet_id_t  packet_id)
inline

Release packet_id.

Parameters
packet_idpacket id to release. only the packet_id gotten by acquire_unique_packet_id, or register_packet_id is permitted.

The documentation for this class was generated from the following file: