aws-crt-cpp
C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++.
MqttTypes.h
Go to the documentation of this file.
1 #pragma once
2 
7 #include <aws/crt/Types.h>
11 
12 #include <aws/mqtt/client.h>
13 #include <aws/mqtt/v5/mqtt5_client.h>
14 
15 #include <functional>
16 
17 namespace Aws
18 {
19  namespace Crt
20  {
21  namespace Mqtt
22  {
23  class MqttConnection;
24 
29  {
30  const char *hostName = nullptr;
31  uint32_t port = 0;
35  bool useWebsocket = false;
36  bool useTls = false;
37  bool enableMetrics = true;
39  Allocator *allocator = nullptr;
40  };
41 
53  using OnMessageReceivedHandler = std::function<void(
54  MqttConnection &connection,
55  const String &topic,
56  const ByteBuf &payload,
57  bool dup,
58  QOS qos,
59  bool retain)>;
60 
70  using OnSubAckHandler = std::function<
71  void(MqttConnection &connection, uint16_t packetId, const String &topic, QOS qos, int errorCode)>;
72 
82  using OnMultiSubAckHandler = std::function<void(
83  MqttConnection &connection,
84  uint16_t packetId,
85  const Vector<String> &topics,
86  QOS qos,
87  int errorCode)>;
88 
100  std::function<void(MqttConnection &connection, uint16_t packetId, int errorCode)>;
101 
106  {
107  /*
108  * Total number of operations submitted to the connection that have not yet been completed. Unacked
109  * operations are a subset of this.
110  */
112 
113  /*
114  * Total packet size of operations submitted to the connection that have not yet been completed. Unacked
115  * operations are a subset of this.
116  */
118 
119  /*
120  * Total number of operations that have been sent to the server and are waiting for a corresponding ACK
121  * before they can be completed.
122  */
124 
125  /*
126  * Total packet size of operations that have been sent to the server and are waiting for a corresponding
127  * ACK before they can be completed.
128  */
130  };
131  } // namespace Mqtt
132  } // namespace Crt
133 } // namespace Aws
Crt::Io::TlsConnectionOptions tlsConnectionOptions
Definition: MqttTypes.h:34
Definition: TlsOptions.h:389
bool useTls
Definition: MqttTypes.h:36
Allocator * allocator
Definition: MqttTypes.h:39
const char * hostName
Definition: MqttTypes.h:30
Io::SocketOptions socketOptions
Definition: MqttTypes.h:32
#define AWS_CRT_CPP_API
Definition: Exports.h:36
Crt::Optional< AWSIoTMetrics > sdkMetrics
Definition: MqttTypes.h:38
bool enableMetrics
Definition: MqttTypes.h:37
std::function< void(MqttConnection &connection, uint16_t packetId, const Vector< String > &topics, QOS qos, int errorCode)> OnMultiSubAckHandler
Definition: MqttTypes.h:87
aws_byte_buf ByteBuf
Definition: Types.h:30
std::basic_string< char, std::char_traits< char >, StlAllocator< char >> String
Definition: Types.h:45
std::function< void(MqttConnection &connection, const String &topic, const ByteBuf &payload, bool dup, QOS qos, bool retain)> OnMessageReceivedHandler
Definition: MqttTypes.h:59
aws_allocator Allocator
Definition: Allocator.h:14
uint64_t unackedOperationCount
Definition: MqttTypes.h:123
Definition: MqttTypes.h:28
std::function< void(MqttConnection &connection, uint16_t packetId, int errorCode)> OnOperationCompleteHandler
Definition: MqttTypes.h:100
std::function< void(MqttConnection &connection, uint16_t packetId, const String &topic, QOS qos, int errorCode)> OnSubAckHandler
Definition: MqttTypes.h:71
Crt::Io::TlsContext tlsContext
Definition: MqttTypes.h:33
Definition: Optional.h:18
std::vector< T, StlAllocator< T >> Vector
Definition: Types.h:53
uint64_t incompleteOperationCount
Definition: MqttTypes.h:111
aws_mqtt_qos QOS
Definition: Types.h:40
uint64_t incompleteOperationSize
Definition: MqttTypes.h:117
Definition: TlsOptions.h:317
uint32_t port
Definition: MqttTypes.h:31
bool useWebsocket
Definition: MqttTypes.h:35
uint64_t unackedOperationSize
Definition: MqttTypes.h:129
Definition: MqttConnection.h:157
Definition: SocketOptions.h:69
Definition: Allocator.h:10