AWS IoT Device SDK C++ v2  1.32.6
AWS IoT Device SDK C++ v2
Classes | Typedefs
Aws::Crt::Mqtt Namespace Reference

Classes

class  MqttClient
 
class  MqttConnection
 
struct  MqttConnectionOperationStatistics
 
struct  MqttConnectionOptions
 
struct  OnConnectionClosedData
 
struct  OnConnectionFailureData
 
struct  OnConnectionSuccessData
 

Typedefs

using OnConnectionInterruptedHandler = std::function< void(MqttConnection &connection, int error)>
 
using OnConnectionResumedHandler = std::function< void(MqttConnection &connection, ReturnCode connectCode, bool sessionPresent)>
 
using OnConnectionCompletedHandler = std::function< void(MqttConnection &connection, int errorCode, ReturnCode returnCode, bool sessionPresent)>
 
using OnConnectionClosedHandler = std::function< void(MqttConnection &connection, OnConnectionClosedData *callbackData)>
 
using OnConnectionSuccessHandler = std::function< void(MqttConnection &connection, OnConnectionSuccessData *callbackData)>
 
using OnConnectionFailureHandler = std::function< void(MqttConnection &connection, OnConnectionFailureData *callbackData)>
 
using OnDisconnectHandler = std::function< void(MqttConnection &connection)>
 
using OnPublishReceivedHandler = std::function< void(MqttConnection &connection, const String &topic, const ByteBuf &payload)>
 
using OnWebSocketHandshakeInterceptComplete = std::function< void(const std::shared_ptr< Http::HttpRequest > &, int errorCode)>
 
using OnWebSocketHandshakeIntercept = std::function< void(std::shared_ptr< Http::HttpRequest > req, const OnWebSocketHandshakeInterceptComplete &onComplete)>
 
using OnMessageReceivedHandler = std::function< void(MqttConnection &connection, const String &topic, const ByteBuf &payload, bool dup, QOS qos, bool retain)>
 
using OnSubAckHandler = std::function< void(MqttConnection &connection, uint16_t packetId, const String &topic, QOS qos, int errorCode)>
 
using OnMultiSubAckHandler = std::function< void(MqttConnection &connection, uint16_t packetId, const Vector< String > &topics, QOS qos, int errorCode)>
 
using OnOperationCompleteHandler = std::function< void(MqttConnection &connection, uint16_t packetId, int errorCode)>
 
using QOS = aws_mqtt_qos
 
using ReturnCode = aws_mqtt_connect_return_code
 

Typedef Documentation

◆ OnConnectionClosedHandler

using Aws::Crt::Mqtt::OnConnectionClosedHandler = typedef std::function<void(MqttConnection &connection, OnConnectionClosedData *callbackData)>

Invoked when a connection is disconnected and shutdown successfully.

Note: Currently callbackData will always be nullptr, but this may change in the future to send additional data.

◆ OnConnectionCompletedHandler

using Aws::Crt::Mqtt::OnConnectionCompletedHandler = typedef std::function< void(MqttConnection &connection, int errorCode, ReturnCode returnCode, bool sessionPresent)>

Invoked when a connack message is received, or an error occurred.

◆ OnConnectionFailureHandler

using Aws::Crt::Mqtt::OnConnectionFailureHandler = typedef std::function<void(MqttConnection &connection, OnConnectionFailureData *callbackData)>

Invoked whenever the connection fails to connect.

This callback is invoked for every failed connect and every failed reconnect.

◆ OnConnectionInterruptedHandler

using Aws::Crt::Mqtt::OnConnectionInterruptedHandler = typedef std::function<void(MqttConnection &connection, int error)>

Invoked Upon Connection loss.

◆ OnConnectionResumedHandler

using Aws::Crt::Mqtt::OnConnectionResumedHandler = typedef std::function<void(MqttConnection &connection, ReturnCode connectCode, bool sessionPresent)>

Invoked Upon Connection resumed.

◆ OnConnectionSuccessHandler

using Aws::Crt::Mqtt::OnConnectionSuccessHandler = typedef std::function<void(MqttConnection &connection, OnConnectionSuccessData *callbackData)>

Invoked whenever the connection successfully connects.

This callback is invoked for every successful connect and every successful reconnect.

◆ OnDisconnectHandler

using Aws::Crt::Mqtt::OnDisconnectHandler = typedef std::function<void(MqttConnection &connection)>

Invoked when a disconnect message has been sent.

◆ OnMessageReceivedHandler

using Aws::Crt::Mqtt::OnMessageReceivedHandler = typedef std::function<void( MqttConnection &connection, const String &topic, const ByteBuf &payload, bool dup, QOS qos, bool retain)>

Invoked upon receipt of a Publish message on a subscribed topic.

Parameters
connectionThe connection object.
topicThe information channel to which the payload data was published.
payloadThe payload data.
dupDUP flag. If true, this might be re-delivery of an earlier attempt to send the message.
qosQuality of Service used to deliver the message.
retainRetain flag. If true, the message was sent as a result of a new subscription being made by the client.

◆ OnMultiSubAckHandler

using Aws::Crt::Mqtt::OnMultiSubAckHandler = typedef std::function<void( MqttConnection &connection, uint16_t packetId, const Vector<String> &topics, QOS qos, int errorCode)>

Invoked when a suback message for multiple topics is received.

Parameters
connectionThe connection object.
packetIdPacket ID of the corresponding subscribe request.
topicsThe information channels to which the payload data was published.
qosQuality of Service used to deliver the message.
errorCodeIndicating if an error occurred.

◆ OnOperationCompleteHandler

using Aws::Crt::Mqtt::OnOperationCompleteHandler = typedef std::function<void(MqttConnection &connection, uint16_t packetId, int errorCode)>

Invoked when an operation completes.

For QoS 0, this is when the packet is passed to the tls layer. For QoS 1 (and 2, in theory) this is when the final ACK packet is received from the server.

Parameters
connectionThe connection object.
packetIdPacket ID of the corresponding subscribe request.
errorCodeIndicating if an error occurred.

◆ OnPublishReceivedHandler

using Aws::Crt::Mqtt::OnPublishReceivedHandler = typedef std::function<void(MqttConnection &connection, const String &topic, const ByteBuf &payload)>
Deprecated:
Use OnMessageReceivedHandler

◆ OnSubAckHandler

using Aws::Crt::Mqtt::OnSubAckHandler = typedef std::function< void(MqttConnection &connection, uint16_t packetId, const String &topic, QOS qos, int errorCode)>

Invoked when a suback message is received.

Parameters
connectionThe connection object.
packetIdPacket ID of the corresponding subscribe request.
topicThe information channel to which the payload data was published.
qosQuality of Service used to deliver the message.
errorCodeIndicating if an error occurred.

◆ OnWebSocketHandshakeIntercept

using Aws::Crt::Mqtt::OnWebSocketHandshakeIntercept = typedef std::function< void(std::shared_ptr<Http::HttpRequest> req, const OnWebSocketHandshakeInterceptComplete &onComplete)>

Invoked during websocket handshake to give users opportunity to transform an http request for purposes such as signing/authorization etc... Returning from this function does not continue the websocket handshake since some work flows may be asynchronous. To accommodate that, onComplete must be invoked upon completion of the signing process.

◆ OnWebSocketHandshakeInterceptComplete

using Aws::Crt::Mqtt::OnWebSocketHandshakeInterceptComplete = typedef std::function<void(const std::shared_ptr<Http::HttpRequest> &, int errorCode)>

Callback for users to invoke upon completion of, presumably asynchronous, OnWebSocketHandshakeIntercept callback's initiated process.

◆ QOS

using Aws::Crt::Mqtt::QOS = typedef aws_mqtt_qos

◆ ReturnCode

using Aws::Crt::Mqtt::ReturnCode = typedef aws_mqtt_connect_return_code