paho-mqtt-cpp
MQTT C++ Client for POSIX and Windows
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Friends
mqtt::delivery_token Class Reference

#include <delivery_token.h>

Inheritance diagram for mqtt::delivery_token:
mqtt::token

Public Types

using ptr_t = std::shared_ptr<delivery_token>
 
using const_ptr_t = std::shared_ptr<delivery_token>
 
using weak_ptr_t = std::weak_ptr<delivery_token>
 
- Public Types inherited from mqtt::token
enum  Type {
  CONNECT , SUBSCRIBE , PUBLISH , UNSUBSCRIBE ,
  DISCONNECT
}
 
using ptr_t = std::shared_ptr<token>
 
using const_ptr_t = std::shared_ptr<const token>
 
using weak_ptr_t = std::weak_ptr<token>
 

Public Member Functions

 delivery_token (iasync_client &cli)
 
 delivery_token (iasync_client &cli, const_message_ptr msg)
 
 delivery_token (iasync_client &cli, const_message_ptr msg, void *userContext, iaction_listener &cb)
 
virtual const_message_ptr get_message () const
 
- Public Member Functions inherited from mqtt::token
 token (Type typ, iasync_client &cli)
 
 token (Type typ, iasync_client &cli, void *userContext, iaction_listener &cb)
 
 token (Type typ, iasync_client &cli, const string &topic)
 
 token (Type typ, iasync_client &cli, const string &topic, void *userContext, iaction_listener &cb)
 
 token (Type typ, iasync_client &cli, const_string_collection_ptr topics)
 
 token (Type typ, iasync_client &cli, const_string_collection_ptr topics, void *userContext, iaction_listener &cb)
 
 token (Type typ, iasync_client &cli, MQTTAsync_token tok)
 
virtual ~token ()
 
Type get_type () const
 
virtual iaction_listenerget_action_callback () const
 
virtual iasync_clientget_client () const
 
virtual int get_message_id () const
 
virtual const_string_collection_ptr get_topics () const
 
virtual void * get_user_context () const
 
virtual bool is_complete () const
 
virtual int get_return_code () const
 
virtual void set_action_callback (iaction_listener &listener)
 
virtual void set_user_context (void *userContext)
 
void set_num_expected (size_t n)
 
ReasonCode get_reason_code () const
 
virtual void wait ()
 
virtual bool try_wait ()
 
virtual bool wait_for (long timeout)
 
template<class Rep , class Period >
bool wait_for (const std::chrono::duration< Rep, Period > &relTime)
 
template<class Clock , class Duration >
bool wait_until (const std::chrono::time_point< Clock, Duration > &absTime)
 
connect_response get_connect_response () const
 
subscribe_response get_subscribe_response () const
 
unsubscribe_response get_unsubscribe_response () const
 

Static Public Member Functions

static ptr_t create (iasync_client &cli)
 
static ptr_t create (iasync_client &cli, const_message_ptr msg)
 
static ptr_t create (iasync_client &cli, const_message_ptr msg, void *userContext, iaction_listener &cb)
 
- Static Public Member Functions inherited from mqtt::token
static ptr_t create (Type typ, iasync_client &cli)
 
static ptr_t create (Type typ, iasync_client &cli, void *userContext, iaction_listener &cb)
 
static ptr_t create (Type typ, iasync_client &cli, const string &topic)
 
static ptr_t create (Type typ, iasync_client &cli, const string &topic, void *userContext, iaction_listener &cb)
 
static ptr_t create (Type typ, iasync_client &cli, const_string_collection_ptr topics)
 
static ptr_t create (Type typ, iasync_client &cli, const_string_collection_ptr topics, void *userContext, iaction_listener &cb)
 

Friends

class async_client
 

Detailed Description

Provides a mechanism to track the delivery progress of a message. Used to track the the delivery progress of a message when a publish is executed in a non-blocking manner (run in the background) action.

Member Typedef Documentation

◆ ptr_t

using mqtt::delivery_token::ptr_t = std::shared_ptr<delivery_token>

Smart/shared pointer to an object of this class

◆ const_ptr_t

Smart/shared pointer to a const object of this class

◆ weak_ptr_t

Weak pointer to an object of this class

Constructor & Destructor Documentation

◆ delivery_token() [1/3]

mqtt::delivery_token::delivery_token ( iasync_client & cli)
inline

Creates an empty delivery token connected to a particular client.

Parameters
cliThe asynchronous client object.

◆ delivery_token() [2/3]

mqtt::delivery_token::delivery_token ( iasync_client & cli,
const_message_ptr msg )
inline

Creates a delivery token connected to a particular client.

Parameters
cliThe asynchronous client object.
msgThe message being tracked.

◆ delivery_token() [3/3]

mqtt::delivery_token::delivery_token ( iasync_client & cli,
const_message_ptr msg,
void * userContext,
iaction_listener & cb )
inline

Creates a delivery token connected to a particular client.

Parameters
cliThe asynchronous client object.
msgThe message data.
userContextoptional object used to pass context to the callback. Use nullptr if not required.
cbcallback optional listener that will be notified when message delivery has completed to the requested quality of service

Member Function Documentation

◆ create() [1/3]

static ptr_t mqtt::delivery_token::create ( iasync_client & cli)
inlinestatic

Creates an empty delivery token connected to a particular client.

Parameters
cliThe asynchronous client object.

◆ create() [2/3]

static ptr_t mqtt::delivery_token::create ( iasync_client & cli,
const_message_ptr msg )
inlinestatic

Creates a delivery token connected to a particular client.

Parameters
cliThe asynchronous client object.
msgThe message data.

◆ create() [3/3]

static ptr_t mqtt::delivery_token::create ( iasync_client & cli,
const_message_ptr msg,
void * userContext,
iaction_listener & cb )
inlinestatic

Creates a delivery token connected to a particular client.

Parameters
cliThe asynchronous client object.
msgThe message data.
userContextoptional object used to pass context to the callback. Use nullptr if not required.
cbcallback optional listener that will be notified when message delivery has completed to the requested quality of service

◆ get_message()

virtual const_message_ptr mqtt::delivery_token::get_message ( ) const
inlinevirtual

Gets the message associated with this token.

Returns
The message associated with this token.

Friends And Related Symbol Documentation

◆ async_client

friend class async_client
friend

Client has special access.


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