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>
10 
11 #include <aws/mqtt/client.h>
12 #include <aws/mqtt/v5/mqtt5_client.h>
13 
14 #include <functional>
15 
16 namespace Aws
17 {
18  namespace Crt
19  {
20  namespace Mqtt
21  {
22  class MqttConnection;
23 
28  {
29  const char *hostName = nullptr;
30  uint32_t port = 0;
34  bool useWebsocket = false;
35  bool useTls = false;
36  bool enableMetrics = true;
37  Allocator *allocator = nullptr;
38  };
39 
51  using OnMessageReceivedHandler = std::function<void(
52  MqttConnection &connection,
53  const String &topic,
54  const ByteBuf &payload,
55  bool dup,
56  QOS qos,
57  bool retain)>;
58 
68  using OnSubAckHandler = std::function<
69  void(MqttConnection &connection, uint16_t packetId, const String &topic, QOS qos, int errorCode)>;
70 
80  using OnMultiSubAckHandler = std::function<void(
81  MqttConnection &connection,
82  uint16_t packetId,
83  const Vector<String> &topics,
84  QOS qos,
85  int errorCode)>;
86 
98  std::function<void(MqttConnection &connection, uint16_t packetId, int errorCode)>;
99 
104  {
105  /*
106  * Total number of operations submitted to the connection that have not yet been completed. Unacked
107  * operations are a subset of this.
108  */
110 
111  /*
112  * Total packet size of operations submitted to the connection that have not yet been completed. Unacked
113  * operations are a subset of this.
114  */
116 
117  /*
118  * Total number of operations that have been sent to the server and are waiting for a corresponding ACK
119  * before they can be completed.
120  */
122 
123  /*
124  * Total packet size of operations that have been sent to the server and are waiting for a corresponding
125  * ACK before they can be completed.
126  */
128  };
129  } // namespace Mqtt
130  } // namespace Crt
131 } // namespace Aws
Crt::Io::TlsConnectionOptions tlsConnectionOptions
Definition: MqttTypes.h:33
Definition: TlsOptions.h:349
bool useTls
Definition: MqttTypes.h:35
Allocator * allocator
Definition: MqttTypes.h:37
const char * hostName
Definition: MqttTypes.h:29
Io::SocketOptions socketOptions
Definition: MqttTypes.h:31
#define AWS_CRT_CPP_API
Definition: Exports.h:36
bool enableMetrics
Definition: MqttTypes.h:36
std::function< void(MqttConnection &connection, uint16_t packetId, const Vector< String > &topics, QOS qos, int errorCode)> OnMultiSubAckHandler
Definition: MqttTypes.h:85
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:57
aws_allocator Allocator
Definition: Allocator.h:14
uint64_t unackedOperationCount
Definition: MqttTypes.h:121
Definition: MqttTypes.h:27
std::function< void(MqttConnection &connection, uint16_t packetId, int errorCode)> OnOperationCompleteHandler
Definition: MqttTypes.h:98
std::function< void(MqttConnection &connection, uint16_t packetId, const String &topic, QOS qos, int errorCode)> OnSubAckHandler
Definition: MqttTypes.h:69
Crt::Io::TlsContext tlsContext
Definition: MqttTypes.h:32
std::vector< T, StlAllocator< T >> Vector
Definition: Types.h:53
uint64_t incompleteOperationCount
Definition: MqttTypes.h:109
aws_mqtt_qos QOS
Definition: Types.h:40
uint64_t incompleteOperationSize
Definition: MqttTypes.h:115
Definition: TlsOptions.h:292
uint32_t port
Definition: MqttTypes.h:30
bool useWebsocket
Definition: MqttTypes.h:34
uint64_t unackedOperationSize
Definition: MqttTypes.h:127
Definition: MqttConnection.h:157
Definition: SocketOptions.h:47
Definition: Allocator.h:10