AWS IoT Device SDK C++ v2  1.32.6
AWS IoT Device SDK C++ v2
Public Member Functions | Static Public Member Functions | Friends | List of all members
Aws::Crt::Mqtt5::Mqtt5Client Class Referencefinal

#include <Mqtt5Client.h>

Inheritance diagram for Aws::Crt::Mqtt5::Mqtt5Client:

Public Member Functions

std::shared_ptr< Mqtt5Clientgetptr ()
 
 operator bool () const noexcept
 
int LastError () const noexcept
 
bool Start () const noexcept
 
bool Stop () noexcept
 
bool Stop (std::shared_ptr< DisconnectPacket > disconnectPacket) noexcept
 
bool Publish (std::shared_ptr< PublishPacket > publishPacket, OnPublishCompletionHandler onPublishCompletionCallback=NULL) noexcept
 
bool Subscribe (std::shared_ptr< SubscribePacket > subscribePacket, OnSubscribeCompletionHandler onSubscribeCompletionCallback=NULL) noexcept
 
bool Unsubscribe (std::shared_ptr< UnsubscribePacket > unsubscribePacket, OnUnsubscribeCompletionHandler onUnsubscribeCompletionCallback=NULL) noexcept
 
const Mqtt5ClientOperationStatisticsGetOperationStatistics () noexcept
 
virtual ~Mqtt5Client ()
 

Static Public Member Functions

static std::shared_ptr< Mqtt5ClientNewMqtt5Client (const Mqtt5ClientOptions &options, Allocator *allocator=ApiAllocator()) noexcept
 

Friends

class Mqtt::MqttConnection
 

Detailed Description

An MQTT5 client. This is a move-only type. Unless otherwise specified, all function arguments need only to live through the duration of the function call.

Constructor & Destructor Documentation

◆ ~Mqtt5Client()

Aws::Crt::Mqtt5::Mqtt5Client::~Mqtt5Client ( )
virtual

Member Function Documentation

◆ GetOperationStatistics()

const Mqtt5ClientOperationStatistics & Aws::Crt::Mqtt5::Mqtt5Client::GetOperationStatistics ( )
noexcept

Get the statistics about the current state of the client's queue of operations

Returns
Mqtt5ClientOperationStatistics

◆ getptr()

std::shared_ptr<Mqtt5Client> Aws::Crt::Mqtt5::Mqtt5Client::getptr ( )
inline

Get shared poitner of the Mqtt5Client. Mqtt5Client is inherited to enable_shared_from_this to help with memory safety.

Returns
shared_ptr for the Mqtt5Client

◆ LastError()

int Aws::Crt::Mqtt5::Mqtt5Client::LastError ( ) const
noexcept
Returns
the value of the last aws error encountered by operations on this instance.

◆ NewMqtt5Client()

std::shared_ptr< Mqtt5Client > Aws::Crt::Mqtt5::Mqtt5Client::NewMqtt5Client ( const Mqtt5ClientOptions options,
Allocator allocator = ApiAllocator() 
)
staticnoexcept

Factory function for mqtt5 client

Parameters
optionsMqtt5 Client Options
allocatorallocator to use
Returns
a new mqtt5 client

◆ operator bool()

Aws::Crt::Mqtt5::Mqtt5Client::operator bool ( ) const
noexcept
Returns
true if the instance is in a valid state, false otherwise.

◆ Publish()

bool Aws::Crt::Mqtt5::Mqtt5Client::Publish ( std::shared_ptr< PublishPacket publishPacket,
OnPublishCompletionHandler  onPublishCompletionCallback = NULL 
)
noexcept

Tells the client to attempt to send a PUBLISH packet

Parameters
publishPacketpacket PUBLISH to send to the server
onPublishCompletionCallbackcallback on publish complete, default to NULL
Returns
true if the publish operation succeed otherwise false

◆ Start()

bool Aws::Crt::Mqtt5::Mqtt5Client::Start ( ) const
noexcept

Notifies the MQTT5 client that you want it to attempt to connect to the configured endpoint. The client will attempt to stay connected using the properties of the reconnect-related parameters from the client configuration.

Returns
bool: true if operation succeed, otherwise false.

◆ Stop() [1/2]

bool Aws::Crt::Mqtt5::Mqtt5Client::Stop ( )
noexcept

Notifies the MQTT5 client that you want it to transition to the stopped state, disconnecting any existing connection and stopping subsequent reconnect attempts.

Returns
bool: true if operation succeed, otherwise false

◆ Stop() [2/2]

bool Aws::Crt::Mqtt5::Mqtt5Client::Stop ( std::shared_ptr< DisconnectPacket disconnectPacket)
noexcept

Notifies the MQTT5 client that you want it to transition to the stopped state, disconnecting any existing connection and stopping subsequent reconnect attempts.

Parameters
disconnectPacket(optional) properties of a DISCONNECT packet to send as part of the shutdown process
Returns
bool: true if operation succeed, otherwise false

◆ Subscribe()

bool Aws::Crt::Mqtt5::Mqtt5Client::Subscribe ( std::shared_ptr< SubscribePacket subscribePacket,
OnSubscribeCompletionHandler  onSubscribeCompletionCallback = NULL 
)
noexcept

Tells the client to attempt to subscribe to one or more topic filters.

Parameters
subscribePacketSUBSCRIBE packet to send to the server
onSubscribeCompletionCallbackcallback on subscribe complete, default to NULL
Returns
true if the subscription operation succeed otherwise false

◆ Unsubscribe()

bool Aws::Crt::Mqtt5::Mqtt5Client::Unsubscribe ( std::shared_ptr< UnsubscribePacket unsubscribePacket,
OnUnsubscribeCompletionHandler  onUnsubscribeCompletionCallback = NULL 
)
noexcept

Tells the client to attempt to unsubscribe to one or more topic filters.

Parameters
unsubscribePacketUNSUBSCRIBE packet to send to the server
onUnsubscribeCompletionCallbackcallback on unsubscribe complete, default to NULL
Returns
true if the unsubscription operation succeed otherwise false

Friends And Related Function Documentation

◆ Mqtt::MqttConnection

friend class Mqtt::MqttConnection
friend

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