AWS IoT Device SDK C++ v2  1.34.0
AWS IoT Device SDK C++ v2
Public Member Functions | List of all members
Aws::Crt::Mqtt5::ConnectPacket Class Reference

#include <Mqtt5Packets.h>

Inheritance diagram for Aws::Crt::Mqtt5::ConnectPacket:
Aws::Crt::Mqtt5::IPacket

Public Member Functions

 ConnectPacket (Allocator *allocator=ApiAllocator()) noexcept
 
PacketType getType () override
 
ConnectPacketWithKeepAliveIntervalSec (uint16_t keepAliveInteralSeconds) noexcept
 
ConnectPacketWithClientId (Crt::String clientId) noexcept
 
ConnectPacketWithUserName (Crt::String username) noexcept
 
ConnectPacketWithPassword (ByteCursor password) noexcept
 
ConnectPacketWithSessionExpiryIntervalSec (uint32_t sessionExpiryIntervalSeconds) noexcept
 
ConnectPacketWithRequestResponseInformation (bool requestResponseInformation) noexcept
 
ConnectPacketWithRequestProblemInformation (bool requestProblemInformation) noexcept
 
ConnectPacketWithReceiveMaximum (uint16_t receiveMaximum) noexcept
 
ConnectPacketWithMaximumPacketSizeBytes (uint32_t maximumPacketSizeBytes) noexcept
 
ConnectPacketWithWillDelayIntervalSec (uint32_t willDelayIntervalSeconds) noexcept
 
ConnectPacketWithWill (std::shared_ptr< PublishPacket > will) noexcept
 
ConnectPacketWithUserProperties (const Vector< UserProperty > &userProperties) noexcept
 
ConnectPacketWithUserProperties (Vector< UserProperty > &&userProperties) noexcept
 
ConnectPacketWithUserProperty (UserProperty &&property) noexcept
 
uint16_t getKeepAliveIntervalSec () const noexcept
 
const Crt::StringgetClientId () const noexcept
 
const Crt::Optional< Crt::String > & getUsername () const noexcept
 
const Crt::Optional< Crt::ByteCursor > & getPassword () const noexcept
 
const Crt::Optional< uint32_t > & getSessionExpiryIntervalSec () const noexcept
 
const Crt::Optional< bool > & getRequestResponseInformation () const noexcept
 
const Crt::Optional< bool > & getRequestProblemInformation () const noexcept
 
const Crt::Optional< uint16_t > & getReceiveMaximum () const noexcept
 
const Crt::Optional< uint32_t > & getMaximumPacketSizeBytes () const noexcept
 
const Crt::Optional< uint32_t > & getMaximumPacketSizeToServer () const noexcept
 
const Crt::Optional< uint32_t > & getWillDelayIntervalSec () const noexcept
 
const Crt::Optional< std::shared_ptr< PublishPacket > > & getWill () const noexcept
 
const Crt::Vector< UserProperty > & getUserProperties () const noexcept
 
bool initializeRawOptions (aws_mqtt5_packet_connect_view &raw_options, Allocator *allocator) noexcept
 
virtual ~ConnectPacket ()
 
 ConnectPacket (const ConnectPacket &)=delete
 
 ConnectPacket (ConnectPacket &&) noexcept=delete
 
ConnectPacketoperator= (const ConnectPacket &)=delete
 
ConnectPacketoperator= (ConnectPacket &&) noexcept=delete
 

Detailed Description

Data model of an MQTT5 CONNECT packet.

Constructor & Destructor Documentation

◆ ConnectPacket() [1/3]

Aws::Crt::Mqtt5::ConnectPacket::ConnectPacket ( Allocator allocator = ApiAllocator())
noexcept

◆ ~ConnectPacket()

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

◆ ConnectPacket() [2/3]

Aws::Crt::Mqtt5::ConnectPacket::ConnectPacket ( const ConnectPacket )
delete

◆ ConnectPacket() [3/3]

Aws::Crt::Mqtt5::ConnectPacket::ConnectPacket ( ConnectPacket &&  )
deletenoexcept

Member Function Documentation

◆ getClientId()

const Crt::String & Aws::Crt::Mqtt5::ConnectPacket::getClientId ( ) const
noexcept

A unique string identifying the client to the server. Used to restore session state between connections.

If left empty, the broker will auto-assign a unique client id. When reconnecting, the mqtt5 client will always use the auto-assigned client id.

See MQTT5 Client Identifier

Returns
A unique string identifying the client to the server.

◆ getKeepAliveIntervalSec()

uint16_t Aws::Crt::Mqtt5::ConnectPacket::getKeepAliveIntervalSec ( ) const
noexcept

The maximum time interval, in seconds, that is permitted to elapse between the point at which the client finishes transmitting one MQTT packet and the point it starts sending the next. The client will use PINGREQ packets to maintain this property.

If the responding CONNACK contains a keep alive property value, then that is the negotiated keep alive value. Otherwise, the keep alive sent by the client is the negotiated value.

See MQTT5 Keep Alive

Returns
The maximum time interval, in seconds, that is permitted to elapse between the point at which the client finishes transmitting one MQTT packet and the point it starts sending the next.

◆ getMaximumPacketSizeBytes()

const Crt::Optional< uint32_t > & Aws::Crt::Mqtt5::ConnectPacket::getMaximumPacketSizeBytes ( ) const
noexcept
Deprecated:
The function is deprecated, please use ConnectPacket::getMaximumPacketSizeToServer()

Notifies the server of the maximum packet size the client is willing to handle. If omitted or null, then no limit beyond the natural limits of MQTT packet size is requested.

See MQTT5 Maximum Packet Size

Returns
The maximum packet size the client is willing to handle

◆ getMaximumPacketSizeToServer()

const Crt::Optional< uint32_t > & Aws::Crt::Mqtt5::ConnectPacket::getMaximumPacketSizeToServer ( ) const
noexcept

Notifies the server of the maximum packet size the client is willing to handle. If omitted or null, then no limit beyond the natural limits of MQTT packet size is requested.

See MQTT5 Maximum Packet Size

Returns
The maximum packet size the client is willing to handle

◆ getPassword()

const Crt::Optional< Crt::ByteCursor > & Aws::Crt::Mqtt5::ConnectPacket::getPassword ( ) const
noexcept

Opaque binary data that the server may use for client authentication and authorization.

See MQTT5 Password

Returns
Opaque binary data that the server may use for client authentication and authorization.

◆ getReceiveMaximum()

const Crt::Optional< uint16_t > & Aws::Crt::Mqtt5::ConnectPacket::getReceiveMaximum ( ) const
noexcept

Notifies the server of the maximum number of in-flight QoS 1 and 2 messages the client is willing to handle. If omitted or null, then no limit is requested.

See MQTT5 Receive Maximum

Returns
The maximum number of in-flight QoS 1 and 2 messages the client is willing to handle.

◆ getRequestProblemInformation()

const Crt::Optional< bool > & Aws::Crt::Mqtt5::ConnectPacket::getRequestProblemInformation ( ) const
noexcept

If true, requests that the server send additional diagnostic information (via response string or user properties) in DISCONNECT or CONNACK packets from the server.

See MQTT5 Request Problem Information

Returns
If true, requests that the server send additional diagnostic information (via response string or user properties) in DISCONNECT or CONNACK packets from the server.

◆ getRequestResponseInformation()

const Crt::Optional< bool > & Aws::Crt::Mqtt5::ConnectPacket::getRequestResponseInformation ( ) const
noexcept

If true, requests that the server send response information in the subsequent CONNACK. This response information may be used to set up request-response implementations over MQTT, but doing so is outside the scope of the MQTT5 spec and client.

See MQTT5 Request Response Information

Returns
If true, requests that the server send response information in the subsequent CONNACK.

◆ getSessionExpiryIntervalSec()

const Crt::Optional< uint32_t > & Aws::Crt::Mqtt5::ConnectPacket::getSessionExpiryIntervalSec ( ) const
noexcept

A time interval, in seconds, that the client requests the server to persist this connection's MQTT session state for. Has no meaning if the client has not been configured to rejoin sessions. Must be non-zero in order to successfully rejoin a session.

If the responding CONNACK contains a session expiry property value, then that is the negotiated session expiry value. Otherwise, the session expiry sent by the client is the negotiated value.

See MQTT5 Session Expiry Interval

Returns
A time interval, in seconds, that the client requests the server to persist this connection's MQTT session state for.

◆ getType()

PacketType Aws::Crt::Mqtt5::ConnectPacket::getType ( )
inlineoverridevirtual

◆ getUsername()

const Crt::Optional< Crt::String > & Aws::Crt::Mqtt5::ConnectPacket::getUsername ( ) const
noexcept

A string value that the server may use for client authentication and authorization.

See MQTT5 User Name

Returns
A string value that the server may use for client authentication and authorization.

◆ getUserProperties()

const Crt::Vector< UserProperty > & Aws::Crt::Mqtt5::ConnectPacket::getUserProperties ( ) const
noexcept

List of MQTT5 user properties included with the packet.

See MQTT5 User Property

Returns
List of MQTT5 user properties included with the packet.

◆ getWill()

const Crt::Optional< std::shared_ptr< PublishPacket > > & Aws::Crt::Mqtt5::ConnectPacket::getWill ( ) const
noexcept

The definition of a message to be published when the connection's session is destroyed by the server or when the will delay interval has elapsed, whichever comes first. If null, then nothing will be sent.

See MQTT5 Will

Returns
The message to be published when the connection's session is destroyed by the server or when the will delay interval has elapsed, whichever comes first.

◆ getWillDelayIntervalSec()

const Crt::Optional< uint32_t > & Aws::Crt::Mqtt5::ConnectPacket::getWillDelayIntervalSec ( ) const
noexcept

A time interval, in seconds, that the server should wait (for a session reconnection) before sending the will message associated with the connection's session. If omitted or null, the server will send the will when the associated session is destroyed. If the session is destroyed before a will delay interval has elapsed, then the will must be sent at the time of session destruction.

See MQTT5 Will Delay Interval

Returns
A time interval, in seconds, that the server should wait (for a session reconnection) before sending the will message associated with the connection's session.

◆ initializeRawOptions()

bool Aws::Crt::Mqtt5::ConnectPacket::initializeRawOptions ( aws_mqtt5_packet_connect_view &  raw_options,
Allocator allocator 
)
noexcept

Intended for internal use only. Initializes the C aws_mqtt5_packet_connack_view from PacketConnect

Parameters
raw_options- output parameter containing low level client options to be passed to the C
allocator- memory Allocator

◆ operator=() [1/2]

ConnectPacket& Aws::Crt::Mqtt5::ConnectPacket::operator= ( ConnectPacket &&  )
deletenoexcept

◆ operator=() [2/2]

ConnectPacket& Aws::Crt::Mqtt5::ConnectPacket::operator= ( const ConnectPacket )
delete

◆ WithClientId()

ConnectPacket & Aws::Crt::Mqtt5::ConnectPacket::WithClientId ( Crt::String  clientId)
noexcept

Sets the unique string identifying the client to the server. Used to restore session state between connections.

If left empty, the broker will auto-assign a unique client id. When reconnecting, the mqtt5 client will always use the auto-assigned client id.

See MQTT5 Client Identifier

Parameters
clientIdA unique string identifying the client to the server.
Returns
The ConnectPacket Object after setting the client ID.

◆ WithKeepAliveIntervalSec()

ConnectPacket & Aws::Crt::Mqtt5::ConnectPacket::WithKeepAliveIntervalSec ( uint16_t  keepAliveInteralSeconds)
noexcept

Sets the maximum time interval, in seconds, that is permitted to elapse between the point at which the client finishes transmitting one MQTT packet and the point it starts sending the next. The client will use PINGREQ packets to maintain this property.

If the responding CONNACK contains a keep alive property value, then that is the negotiated keep alive value. Otherwise, the keep alive sent by the client is the negotiated value.

See MQTT5 Keep Alive

NOTE: The keepAliveIntervalSeconds HAS to be larger than the pingTimeoutMs time set in the Mqtt5ClientOptions.

Parameters
keepAliveInteralSecondsthe maximum time interval, in seconds, that is permitted to elapse between the point at which the client finishes transmitting one MQTT packet and the point it starts sending the next.
Returns
The ConnectPacket Object after setting the keep alive interval.

◆ WithMaximumPacketSizeBytes()

ConnectPacket & Aws::Crt::Mqtt5::ConnectPacket::WithMaximumPacketSizeBytes ( uint32_t  maximumPacketSizeBytes)
noexcept

Sets the maximum packet size the client is willing to handle. If omitted, then no limit beyond the natural limits of MQTT packet size is requested.

See MQTT5 Maximum Packet Size

Parameters
maximumPacketSizeBytesThe maximum packet size the client is willing to handle
Returns
The ConnectPacket Object after setting the maximum packet size.

◆ WithPassword()

ConnectPacket & Aws::Crt::Mqtt5::ConnectPacket::WithPassword ( Crt::ByteCursor  password)
noexcept

Sets the opaque binary data that the server may use for client authentication and authorization.

See MQTT5 Password

Parameters
passwordOpaque binary data that the server may use for client authentication and authorization.
Returns
The ConnectPacket Object after setting the password.

◆ WithReceiveMaximum()

ConnectPacket & Aws::Crt::Mqtt5::ConnectPacket::WithReceiveMaximum ( uint16_t  receiveMaximum)
noexcept

Sets the maximum number of in-flight QoS 1 and 2 messages the client is willing to handle. If omitted, then no limit is requested.

See MQTT5 Receive Maximum

Parameters
receiveMaximumThe maximum number of in-flight QoS 1 and 2 messages the client is willing to handle.
Returns
The ConnectPacket Object after setting the receive maximum.

◆ WithRequestProblemInformation()

ConnectPacket & Aws::Crt::Mqtt5::ConnectPacket::WithRequestProblemInformation ( bool  requestProblemInformation)
noexcept

Sets whether requests that the server send additional diagnostic information (via response string or user properties) in DISCONNECT or CONNACK packets from the server.

See MQTT5 Request Problem Information

Parameters
requestProblemInformationIf true, requests that the server send additional diagnostic information (via response string or user properties) in DISCONNECT or CONNACK packets from the server.
Returns
The ConnectPacket Object after setting the request problem information.

◆ WithRequestResponseInformation()

ConnectPacket & Aws::Crt::Mqtt5::ConnectPacket::WithRequestResponseInformation ( bool  requestResponseInformation)
noexcept

Sets whether requests that the server send response information in the subsequent CONNACK. This response information may be used to set up request-response implementations over MQTT, but doing so is outside the scope of the MQTT5 spec and client.

See MQTT5 Request Response Information

Parameters
requestResponseInformationIf true, requests that the server send response information in the subsequent CONNACK.
Returns
The ConnectPacket Object after setting the request response information.

◆ WithSessionExpiryIntervalSec()

ConnectPacket & Aws::Crt::Mqtt5::ConnectPacket::WithSessionExpiryIntervalSec ( uint32_t  sessionExpiryIntervalSeconds)
noexcept

Sets the time interval, in seconds, that the client requests the server to persist this connection's MQTT session state for. Has no meaning if the client has not been configured to rejoin sessions. Must be non-zero in order to successfully rejoin a session.

If the responding CONNACK contains a session expiry property value, then that is the negotiated session expiry value. Otherwise, the session expiry sent by the client is the negotiated value.

See MQTT5 Session Expiry Interval

Parameters
sessionExpiryIntervalSecondsA time interval, in seconds, that the client requests the server to persist this connection's MQTT session state for.
Returns
The ConnectPacket Object after setting the session expiry interval.

◆ WithUserName()

ConnectPacket & Aws::Crt::Mqtt5::ConnectPacket::WithUserName ( Crt::String  username)
noexcept

Sets the string value that the server may use for client authentication and authorization.

See MQTT5 User Name

Parameters
usernameThe string value that the server may use for client authentication and authorization.
Returns
The ConnectPacket Object after setting the username.

◆ WithUserProperties() [1/2]

ConnectPacket & Aws::Crt::Mqtt5::ConnectPacket::WithUserProperties ( const Vector< UserProperty > &  userProperties)
noexcept

Sets the list of MQTT5 user properties included with the packet.

See MQTT5 User Property

Parameters
userPropertiesList of MQTT5 user properties included with the packet.
Returns
The ConnectPacket Object after setting the user properties.

◆ WithUserProperties() [2/2]

ConnectPacket & Aws::Crt::Mqtt5::ConnectPacket::WithUserProperties ( Vector< UserProperty > &&  userProperties)
noexcept

Sets the list of MQTT5 user properties included with the packet.

See MQTT5 User Property

Parameters
userPropertiesList of MQTT5 user properties included with the packet.
Returns
The ConnectPacket Object after setting the user properties.

◆ WithUserProperty()

ConnectPacket & Aws::Crt::Mqtt5::ConnectPacket::WithUserProperty ( UserProperty &&  property)
noexcept

Put a MQTT5 user property to the back of the packet user property vector/list

See MQTT5 User Property

Parameters
propertyset of userProperty of MQTT5 user properties included with the packet.
Returns
The ConnectPacket Object after setting the user property

◆ WithWill()

ConnectPacket & Aws::Crt::Mqtt5::ConnectPacket::WithWill ( std::shared_ptr< PublishPacket will)
noexcept

Sets the definition of a message to be published when the connection's session is destroyed by the server or when the will delay interval has elapsed, whichever comes first. If null, then nothing will be sent.

See MQTT5 Will

Parameters
willThe message to be published when the connection's session is destroyed by the server or when the will delay interval has elapsed, whichever comes first.
Returns
The ConnectPacket Object after setting the will message.

◆ WithWillDelayIntervalSec()

ConnectPacket & Aws::Crt::Mqtt5::ConnectPacket::WithWillDelayIntervalSec ( uint32_t  willDelayIntervalSeconds)
noexcept

Sets the time interval, in seconds, that the server should wait (for a session reconnection) before sending the will message associated with the connection's session. If omitted, the server will send the will when the associated session is destroyed. If the session is destroyed before a will delay interval has elapsed, then the will must be sent at the time of session destruction.

See MQTT5 Will Delay Interval

Parameters
willDelayIntervalSecondsA time interval, in seconds, that the server should wait (for a session reconnection) before sending the will message associated with the connection's session.
Returns
The ConnectPacket Object after setting the will message delay interval.

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