AWS IoT Device SDK C++ v2  1.34.0
AWS IoT Device SDK C++ v2
Public Member Functions | Static Public Member Functions | List of all members
Aws::Iot::Mqtt5ClientBuilder Class Referencefinal

#include <Mqtt5Client.h>

Public Member Functions

Mqtt5ClientBuilderWithHostName (Crt::String hostname)
 
Mqtt5ClientBuilderWithPort (uint32_t port) noexcept
 
Mqtt5ClientBuilderWithBootstrap (Crt::Io::ClientBootstrap *bootStrap) noexcept
 
Mqtt5ClientBuilderWithCertificateAuthority (const char *caPath) noexcept
 
Mqtt5ClientBuilderWithCertificateAuthority (const Crt::ByteCursor &cert) noexcept
 
Mqtt5ClientBuilderWithSocketOptions (Crt::Io::SocketOptions socketOptions) noexcept
 
Mqtt5ClientBuilderWithHttpProxyOptions (const Crt::Http::HttpClientConnectionProxyOptions &proxyOptions) noexcept
 
Mqtt5ClientBuilderWithCustomAuthorizer (const Iot::Mqtt5CustomAuthConfig &config) noexcept
 
Mqtt5ClientBuilderWithConnectOptions (std::shared_ptr< ConnectPacket > packetConnect) noexcept
 
Mqtt5ClientBuilderWithSessionBehavior (ClientSessionBehaviorType sessionBehavior) noexcept
 
Mqtt5ClientBuilderWithClientExtendedValidationAndFlowControl (ClientExtendedValidationAndFlowControl clientExtendedValidationAndFlowControl) noexcept
 
Mqtt5ClientBuilderWithOfflineQueueBehavior (ClientOperationQueueBehaviorType offlineQueueBehavior) noexcept
 
Mqtt5ClientBuilderWithReconnectOptions (ReconnectOptions reconnectOptions) noexcept
 
Mqtt5ClientBuilderWithTopicAliasingOptions (TopicAliasingOptions topicAliasingOptions) noexcept
 
Mqtt5ClientBuilderWithMinConnectedTimeToResetReconnectDelayMs (uint64_t minConnectedTimeToResetReconnectDelayMs) noexcept
 
Mqtt5ClientBuilderWithPingTimeoutMs (uint32_t pingTimeoutMs) noexcept
 
Mqtt5ClientBuilderWithConnackTimeoutMs (uint32_t connackTimeoutMs) noexcept
 
Mqtt5ClientBuilderWithAckTimeoutSec (uint32_t ackTimeoutSec) noexcept
 
Mqtt5ClientBuilderWithAckTimeoutSeconds (uint32_t ackTimeoutSec) noexcept
 
Mqtt5ClientBuilderWithSdkName (const Crt::String &sdkName)
 
Mqtt5ClientBuilderWithSdkVersion (const Crt::String &sdkVersion)
 
std::shared_ptr< Mqtt5ClientBuild () noexcept
 
 operator bool () const noexcept
 
int LastError () const noexcept
 
virtual ~Mqtt5ClientBuilder ()
 
 Mqtt5ClientBuilder (const Mqtt5ClientBuilder &)=delete
 
 Mqtt5ClientBuilder (Mqtt5ClientBuilder &&)=delete
 
Mqtt5ClientBuilderoperator= (const Mqtt5ClientBuilder &)=delete
 
Mqtt5ClientBuilderoperator= (Mqtt5ClientBuilder &&)=delete
 
Mqtt5ClientBuilderWithClientConnectionSuccessCallback (OnConnectionSuccessHandler callback) noexcept
 
Mqtt5ClientBuilderWithClientConnectionFailureCallback (OnConnectionFailureHandler callback) noexcept
 
Mqtt5ClientBuilderWithClientDisconnectionCallback (OnDisconnectionHandler callback) noexcept
 
Mqtt5ClientBuilderWithClientStoppedCallback (OnStoppedHandler callback) noexcept
 
Mqtt5ClientBuilderWithClientAttemptingConnectCallback (OnAttemptingConnectHandler callback) noexcept
 
Mqtt5ClientBuilderWithPublishReceivedCallback (OnPublishReceivedHandler callback) noexcept
 

Static Public Member Functions

static Mqtt5ClientBuilderNewMqtt5ClientBuilderWithMtlsFromPath (const Crt::String hostName, const char *certPath, const char *pkeyPath, Crt::Allocator *allocator=Crt::ApiAllocator()) noexcept
 
static Mqtt5ClientBuilderNewMqtt5ClientBuilderWithMtlsFromMemory (const Crt::String hostName, const Crt::ByteCursor &certPath, const Crt::ByteCursor &pkeyPath, Crt::Allocator *allocator=Crt::ApiAllocator()) noexcept
 
static Mqtt5ClientBuilderNewMqtt5ClientBuilderWithMtlsPkcs11 (const Crt::String hostName, const Crt::Io::TlsContextPkcs11Options &pkcs11Options, Crt::Allocator *allocator=Crt::ApiAllocator()) noexcept
 
static Mqtt5ClientBuilderNewMqtt5ClientBuilderWithMtlsPkcs12 (const Crt::String hostName, const struct Pkcs12Options &options, Crt::Allocator *allocator=Crt::ApiAllocator()) noexcept
 
static Mqtt5ClientBuilderNewMqtt5ClientBuilderWithWindowsCertStorePath (const Crt::String hostName, const char *windowsCertStorePath, Crt::Allocator *allocator=Crt::ApiAllocator()) noexcept
 
static Mqtt5ClientBuilderNewMqtt5ClientBuilderWithWebsocket (const Crt::String hostName, const WebsocketConfig &config, Crt::Allocator *allocator=Crt::ApiAllocator()) noexcept
 
static Mqtt5ClientBuilderNewMqtt5ClientBuilderWithCustomAuthorizer (const Crt::String hostName, const Mqtt5CustomAuthConfig &customAuthConfig, Crt::Allocator *allocator) noexcept
 
static Mqtt5ClientBuilderNewMqtt5ClientBuilderWithCustomAuthorizerWebsocket (const Crt::String hostName, const Mqtt5CustomAuthConfig &customAuthConfig, const WebsocketConfig &config, Crt::Allocator *allocator) noexcept
 

Detailed Description

Represents a unique configuration for mqtt5 client and connection. Helps to setup Mqtt5ClientOptionsBuilder for mqtt5 client.

Constructor & Destructor Documentation

◆ ~Mqtt5ClientBuilder()

virtual Aws::Iot::Mqtt5ClientBuilder::~Mqtt5ClientBuilder ( )
inlinevirtual

◆ Mqtt5ClientBuilder() [1/2]

Aws::Iot::Mqtt5ClientBuilder::Mqtt5ClientBuilder ( const Mqtt5ClientBuilder )
delete

◆ Mqtt5ClientBuilder() [2/2]

Aws::Iot::Mqtt5ClientBuilder::Mqtt5ClientBuilder ( Mqtt5ClientBuilder &&  )
delete

Member Function Documentation

◆ Build()

std::shared_ptr< Mqtt5Client > Aws::Iot::Mqtt5ClientBuilder::Build ( )
noexcept

Builds a client configuration object from the set options.

Returns
a new client connection config instance

◆ LastError()

int Aws::Iot::Mqtt5ClientBuilder::LastError ( ) const
inlinenoexcept
Returns
the value of the last aws error encountered by operations on this instance.

◆ NewMqtt5ClientBuilderWithCustomAuthorizer()

Mqtt5ClientBuilder * Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithCustomAuthorizer ( const Crt::String  hostName,
const Mqtt5CustomAuthConfig customAuthConfig,
Crt::Allocator allocator 
)
staticnoexcept

Sets the builder up for connection using authorization configuration.

Parameters
hostName- AWS IoT endpoint to connect to
customAuthConfigcustom authorization configuration information
allocatormemory allocator to use

Mqtt5ClientBuilder

◆ NewMqtt5ClientBuilderWithCustomAuthorizerWebsocket()

Mqtt5ClientBuilder * Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithCustomAuthorizerWebsocket ( const Crt::String  hostName,
const Mqtt5CustomAuthConfig customAuthConfig,
const WebsocketConfig config,
Crt::Allocator allocator 
)
staticnoexcept

Sets the builder up for connection using authorization configuration using Websockets.

Parameters
hostName- AWS IoT endpoint to connect to
customAuthConfigcustom authorization configuration information
configwebsocket configuration information
allocatormemory allocator to use

Mqtt5ClientBuilder

◆ NewMqtt5ClientBuilderWithMtlsFromMemory()

Mqtt5ClientBuilder * Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromMemory ( const Crt::String  hostName,
const Crt::ByteCursor certPath,
const Crt::ByteCursor pkeyPath,
Crt::Allocator allocator = Crt::ApiAllocator() 
)
staticnoexcept

Sets the builder up for MTLS using cert and pkey. These are in-memory buffers and must be in the PEM format.

Parameters
hostName- AWS IoT endpoint to connect to
certPathbuffer containing the X509 certificate in a PEM format
pkeyPathbuffer containing the private key in a PEM format
allocatormemory allocator to use
Returns
Mqtt5ClientBuilder

◆ NewMqtt5ClientBuilderWithMtlsFromPath()

Mqtt5ClientBuilder * Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath ( const Crt::String  hostName,
const char *  certPath,
const char *  pkeyPath,
Crt::Allocator allocator = Crt::ApiAllocator() 
)
staticnoexcept

Set the builder up for MTLS using certPath and pkeyPath. These are files on disk and must be in the PEM format.

Parameters
hostName- AWS IoT endpoint to connect to
certPathpath to the X509 certificate (pem file) to use
pkeyPathpath to the private key (pem file) to use
allocatormemory allocator to use
Returns
Mqtt5ClientBuilder

◆ NewMqtt5ClientBuilderWithMtlsPkcs11()

Mqtt5ClientBuilder * Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsPkcs11 ( const Crt::String  hostName,
const Crt::Io::TlsContextPkcs11Options pkcs11Options,
Crt::Allocator allocator = Crt::ApiAllocator() 
)
staticnoexcept

Sets the builder up for MTLS, using a PKCS#11 library for private key operations.

NOTE: This only works on Unix devices.

Parameters
hostName- AWS IoT endpoint to connect to
pkcs11OptionsPKCS#11 options
allocatormemory allocator to use
Returns
Mqtt5ClientBuilder

◆ NewMqtt5ClientBuilderWithMtlsPkcs12()

Mqtt5ClientBuilder * Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsPkcs12 ( const Crt::String  hostName,
const struct Pkcs12Options options,
Crt::Allocator allocator = Crt::ApiAllocator() 
)
staticnoexcept

Sets the builder up for MTLS, using a PKCS#12 file for private key operations.

NOTE: This only works on MacOS devices.

Parameters
hostName- AWS IoT endpoint to connect to
optionsThe PKCS12 options to use.
allocator- memory allocator to use
Returns
Mqtt5ClientBuilder

◆ NewMqtt5ClientBuilderWithWebsocket()

Mqtt5ClientBuilder * Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithWebsocket ( const Crt::String  hostName,
const WebsocketConfig config,
Crt::Allocator allocator = Crt::ApiAllocator() 
)
staticnoexcept

Sets the builder up for Websocket connection.

Parameters
hostName- AWS IoT endpoint to connect to
configwebsocket configuration information
allocatormemory allocator to use

Mqtt5ClientBuilder

◆ NewMqtt5ClientBuilderWithWindowsCertStorePath()

Mqtt5ClientBuilder * Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithWindowsCertStorePath ( const Crt::String  hostName,
const char *  windowsCertStorePath,
Crt::Allocator allocator = Crt::ApiAllocator() 
)
staticnoexcept

Sets the builder up for MTLS, using a certificate in a Windows certificate store.

NOTE: This only works on Windows.

Parameters
hostName- AWS IoT endpoint to connect to
windowsCertStorePathPath to certificate in a Windows certificate store. The path must use backslashes and end with the certificate's thumbprint. Example: CurrentUser\MY\A11F8A9B5DF5B98BA3508FBCA575D09570E0D2C6
allocatormemory allocator to use
Returns
Mqtt5ClientBuilder

◆ operator bool()

Aws::Iot::Mqtt5ClientBuilder::operator bool ( ) const
inlineexplicitnoexcept
Returns
true if the instance is in a valid state, false otherwise.

◆ operator=() [1/2]

Mqtt5ClientBuilder& Aws::Iot::Mqtt5ClientBuilder::operator= ( const Mqtt5ClientBuilder )
delete

◆ operator=() [2/2]

Mqtt5ClientBuilder& Aws::Iot::Mqtt5ClientBuilder::operator= ( Mqtt5ClientBuilder &&  )
delete

◆ WithAckTimeoutSec()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithAckTimeoutSec ( uint32_t  ackTimeoutSec)
noexcept

Sets Operation Timeout(Seconds). Time interval to wait for an ack after sending a QoS 1+ PUBLISH, SUBSCRIBE, or UNSUBSCRIBE before failing the operation.

Parameters
ackTimeoutSec
Returns
this option object

◆ WithAckTimeoutSeconds()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithAckTimeoutSeconds ( uint32_t  ackTimeoutSec)
noexcept
Deprecated:
the function is deprecated, please use Mqtt5ClientBuilder::WithAckTimeoutSec(uint32_t)

Sets Operation Timeout(Seconds). Time interval to wait for an ack after sending a QoS 1+ PUBLISH, SUBSCRIBE, or UNSUBSCRIBE before failing the operation.

Parameters
ackTimeoutSec
Returns
this option object

◆ WithBootstrap()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithBootstrap ( Crt::Io::ClientBootstrap bootStrap)
noexcept

Set booststrap for mqtt5 client

Parameters
bootStrapbootstrap used for mqtt5 client. The default ClientBootstrap see Aws::Crt::ApiHandle::GetOrCreateStaticDefaultClientBootstrap.
Returns
this option object

◆ WithCertificateAuthority() [1/2]

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithCertificateAuthority ( const char *  caPath)
noexcept

Sets the certificate authority for the endpoint you're connecting to. This is a path to a file on disk and must be in PEM format.

Parameters
caPathpath to the CA file in PEM format
Returns
this builder object

◆ WithCertificateAuthority() [2/2]

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithCertificateAuthority ( const Crt::ByteCursor cert)
noexcept

Sets the certificate authority for the endpoint you're connecting to. This is an in-memory buffer and must be in PEM format.

Parameters
certbuffer containing the CA certificate in a PEM format
Returns
this builder object

◆ WithClientAttemptingConnectCallback()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithClientAttemptingConnectCallback ( OnAttemptingConnectHandler  callback)
noexcept

Setup callback handler trigged when client begins an attempt to connect to the remote endpoint.

Parameters
callback
Returns
this option object

◆ WithClientConnectionFailureCallback()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithClientConnectionFailureCallback ( OnConnectionFailureHandler  callback)
noexcept

Setup callback trigged when client fails to establish an MQTT connection

Parameters
callback
Returns
this option object

◆ WithClientConnectionSuccessCallback()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithClientConnectionSuccessCallback ( OnConnectionSuccessHandler  callback)
noexcept

Setup callback trigged when client successfully establishes an MQTT connection

Parameters
callback
Returns
this option object

◆ WithClientDisconnectionCallback()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithClientDisconnectionCallback ( OnDisconnectionHandler  callback)
noexcept

Setup callback handler trigged when client's current MQTT connection is closed

Parameters
callback
Returns
this option object

◆ WithClientExtendedValidationAndFlowControl()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithClientExtendedValidationAndFlowControl ( ClientExtendedValidationAndFlowControl  clientExtendedValidationAndFlowControl)
noexcept

Sets client extended validation and flow control, additional controls for client behavior with respect to operation validation and flow control; these checks go beyond the base MQTT5 spec to respect limits of specific MQTT brokers.

Parameters
clientExtendedValidationAndFlowControl
Returns
this option object

◆ WithClientStoppedCallback()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithClientStoppedCallback ( OnStoppedHandler  callback)
noexcept

Setup callback handler trigged when client reaches the "Stopped" state

Parameters
callback
Returns
this option object

◆ WithConnackTimeoutMs()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithConnackTimeoutMs ( uint32_t  connackTimeoutMs)
noexcept

Sets Connack Timeout (ms). Time interval to wait after sending a CONNECT request for a CONNACK to arrive. If one does not arrive, the connection will be shut down.

Parameters
connackTimeoutMs
Returns
this option object

◆ WithConnectOptions()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithConnectOptions ( std::shared_ptr< ConnectPacket packetConnect)
noexcept

Sets mqtt5 connection options

Parameters
packetConnectpackage connection options
Returns
this option object

◆ WithCustomAuthorizer()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithCustomAuthorizer ( const Iot::Mqtt5CustomAuthConfig config)
noexcept

Sets the custom authorizer settings. This function will modify the username, port, and TLS options.

Returns
this builder object

◆ WithHostName()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithHostName ( Crt::String  hostname)

Sets the host to connect to.

Parameters
hostnameendpoint to connect to
Returns
this option object

◆ WithHttpProxyOptions()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithHttpProxyOptions ( const Crt::Http::HttpClientConnectionProxyOptions proxyOptions)
noexcept

Sets http proxy options.

Parameters
proxyOptionshttp proxy configuration for connection establishment
Returns
this option object

◆ WithMinConnectedTimeToResetReconnectDelayMs()

Mqtt5ClientBuilder& Aws::Iot::Mqtt5ClientBuilder::WithMinConnectedTimeToResetReconnectDelayMs ( uint64_t  minConnectedTimeToResetReconnectDelayMs)
noexcept

Sets minConnectedTimeToResetReconnectDelayMs, amount of time that must elapse with an established connection before the reconnect delay is reset to the minimum. This helps alleviate bandwidth-waste in fast reconnect cycles due to permission failures on operations.

Parameters
minConnectedTimeToResetReconnectDelayMs
Returns
this option object

◆ WithOfflineQueueBehavior()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithOfflineQueueBehavior ( ClientOperationQueueBehaviorType  offlineQueueBehavior)
noexcept

Sets OfflineQueueBehavior, controls how disconnects affect the queued and in-progress operations tracked by the client. Also controls how new operations are handled while the client is not connected. In particular, if the client is not connected, then any operation that would be failed on disconnect (according to these rules) will also be rejected.

Parameters
offlineQueueBehavior
Returns
this option object

◆ WithPingTimeoutMs()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithPingTimeoutMs ( uint32_t  pingTimeoutMs)
noexcept

Sets ping timeout (ms). Time interval to wait after sending a PINGREQ for a PINGRESP to arrive. If one does not arrive, the client will close the current connection.

Parameters
pingTimeoutMs
Returns
this option object

◆ WithPort()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithPort ( uint32_t  port)
noexcept

Set port to connect to

Parameters
portport to connect to
Returns
this option object

◆ WithPublishReceivedCallback()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithPublishReceivedCallback ( OnPublishReceivedHandler  callback)
noexcept

Setup callback handler trigged when an MQTT PUBLISH packet is received by the client

Parameters
callback
Returns
this option object

◆ WithReconnectOptions()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithReconnectOptions ( ReconnectOptions  reconnectOptions)
noexcept

Sets ReconnectOptions. Reconnect options includes retryJitterMode, min reconnect delay time and max reconnect delay time

Parameters
reconnectOptions
Returns
this option object

◆ WithSdkName()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithSdkName ( const Crt::String sdkName)

Overrides the default SDK Name to send as a metric in the MQTT CONNECT packet.

Parameters
sdkNamestring to use as the SDK name parameter in the connection string
Returns
this builder object

◆ WithSdkVersion()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithSdkVersion ( const Crt::String sdkVersion)

Overrides the default SDK Version to send as a metric in the MQTT CONNECT packet.

Parameters
sdkVersionstring to use as the SDK version parameter in the connection string
Returns
this builder object

◆ WithSessionBehavior()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithSessionBehavior ( ClientSessionBehaviorType  sessionBehavior)
noexcept

Sets session behavior. Overrides how the MQTT5 client should behave with respect to MQTT sessions.

Parameters
sessionBehaviorhow the MQTT5 client should behave with respect to MQTT sessions.
Returns
this option object

◆ WithSocketOptions()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithSocketOptions ( Crt::Io::SocketOptions  socketOptions)
noexcept

Overrides the socket properties of the underlying MQTT connections made by the client. Leave undefined to use defaults (no TCP keep alive, 10 second socket timeout).

Parameters
socketOptions- The socket properties of the underlying MQTT connections made by the client
Returns
- The Mqtt5ClientBuilder

◆ WithTopicAliasingOptions()

Mqtt5ClientBuilder & Aws::Iot::Mqtt5ClientBuilder::WithTopicAliasingOptions ( TopicAliasingOptions  topicAliasingOptions)
noexcept

Sets the topic aliasing behavior that the client should use.

Parameters
topicAliasingOptionstopic aliasing behavior options to use
Returns
this builder object

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