You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[Detecting connection loss (tldr use keepAliveTimeSecs and pingTimeoutMs)](#connection-loss)
9
10
*[How to use a Pre-Built aws-crt-cpp (Most useful for development of this package)](#prebuilt-aws-crt-cpp)
11
+
*[How to use USE_EXTERNAL_DEPS_SOURCES to build with external dependencies](#use-external-deps-source)
10
12
*[I am experiencing deadlocks](#i-am-experiencing-deadlocks)
11
-
*[How do debug in VSCode?](#how-do-debug-in-vscode)
13
+
*[How to debug in VSCode?](#how-to-debug-in-vscode)
12
14
*[What certificates do I need?](#what-certificates-do-i-need)
13
15
*[Where can I find MQTT 311 Samples?](#where-can-i-find-mqtt-311-samples)
14
16
*[I still have more questions about this sdk?](#i-still-have-more-questions-about-this-sdk)
15
17
16
18
### Where should I start?
17
19
18
-
If you are just getting started make sure you [install this sdk](https://github.com/aws/aws-iot-device-sdk-cpp-v2#installation) and then build and run the [basic PubSub](https://github.com/aws/aws-iot-device-sdk-cpp-v2/tree/main/samples#basic-mqtt-pub-sub)
20
+
If you are just getting started, make sure you [install this SDK](https://github.com/aws/aws-iot-device-sdk-cpp-v2#installation) and then build and run the [X509 PubSub](https://github.com/aws/aws-iot-device-sdk-cpp-v2/tree/main/samples/mqtt/mqtt5_x509) sample.
**LogLevel**: LogLevel has the following options: `Trace`, `Debug`, `Info`, `Warn`, `Error`, `Fatal`, or `None`. Defaults to `Warn`.
30
32
31
-
You can also enable [CloudWatch logging](https://docs.aws.amazon.com/iot/latest/developerguide/cloud-watch-logs.html) for IoT which will provide you with additional information that is not available on the client side sdk.
33
+
You can also enable [CloudWatch logging](https://docs.aws.amazon.com/iot/latest/developerguide/cloud-watch-logs.html) for IoT which will provide you with additional information that is not available on the client side SDK.
34
+
35
+
### How do I get more information from an error code?
36
+
37
+
When you encounter error codes in the SDK, you can use `ErrorDebugString()` to get a human-readable error message:
This function converts error codes into descriptive strings that help identify the specific issue.
32
46
33
47
### I keep getting AWS_ERROR_MQTT_UNEXPECTED_HANGUP
34
48
35
-
This could be many different things but it most likely is a policy issue. Start with using a super permissive IAM policy called AWSIOTFullAccess which looks like this:
49
+
This could be many different things, but it is most likely a policy issue. Start by using a super permissive IAM policy called AWSIOTFullAccess which looks like this:
36
50
37
51
``` json
38
52
{
@@ -52,8 +66,8 @@ This could be many different things but it most likely is a policy issue. Start
52
66
After getting it working make sure to only allow the actions and resources that you need. More info about IoT IAM policies can be found [here](https://docs.aws.amazon.com/iot/latest/developerguide/security_iam_service-with-iam.html).
53
67
54
68
55
-
### Dependencies are bad.
56
-
If you get the following Error:
69
+
### Dependencies are bad
70
+
If you get the following error:
57
71
```
58
72
CMake Error at CMakeLists.txt:46 (include):
59
73
include could not find load file:
@@ -76,20 +90,53 @@ There are 3 mechanisms for detecting connection loss:
76
90
77
91
### How to use a Pre-Built aws-crt-cpp (Most useful for development of this package) <aname="prebuilt-aws-crt-cpp"></a>
78
92
93
+
Turning off the `BUILD_DEPS` option allows you to use your own pre-built AWS CRT dependencies instead of the bundled submodules. This is useful when you want to share dependencies across multiple projects (for example, sharing the aws-crt-cpp dependency with aws-sdk-cpp).
### How to use USE_EXTERNAL_DEPS_SOURCES to build with external dependencies <aname="use-external-deps-source"></a>
103
+
104
+
The `USE_EXTERNAL_DEPS_SOURCES` option allows you to use your own external source directories for AWS CRT dependencies instead of the bundled submodules.
105
+
**Build Steps:**
106
+
1.**Configure build options** - Update your CMakeLists.txt to set the required flags. Set `BUILD_DEPS` to `OFF` and `USE_EXTERNAL_DEPS_SOURCES` to `ON`:
107
+
```cmake
108
+
option(BUILD_DEPS "Builds aws common runtime dependencies as part of build. Turn off if you want to control your dependency chain." OFF)
109
+
option(USE_EXTERNAL_DEPS_SOURCES "Use dependencies provided by add_subdirectory command" ON)
110
+
```
111
+
112
+
2. **Set up CMake module path** - The aws-crt-cpp library requires certain CMake modules that are defined in aws-c-common. Add it to your CMake modules:
3. **Add required dependencies** - The following three dependencies are required as a minimum. You can also add other source dependencies as needed. Add them using `add_subdirectory` (or higher-level commands that use `add_subdirectory`, like `FetchContent`):
- **Missing submodules**: While using `FetchContent` or `ExternalProject_Add`, remember to set `GIT_SUBMODULES_RECURSE` to make sure the library pulls the submodules.
130
+
131
+
132
+
86
133
### I am experiencing deadlocks
87
134
88
135
You MUST NOT perform blocking operations on any callback, or you will cause a deadlock. For example: in the on_publish_received callback, do not send a publish, and then wait for the future to complete within the callback. The Client cannot do work until your callback returns, so the thread will be stuck.
89
136
90
-
### How do debug in VSCode?
137
+
### How to debug in VSCode?
91
138
92
-
Here is an example launch.json file to run the pubsub sample
139
+
Here is an example launch.json file to run the x509 pubsub sample:
93
140
``` json
94
141
{
95
142
// Use IntelliSense to learn about possible attributes.
@@ -98,15 +145,14 @@ Here is an example launch.json file to run the pubsub sample
@@ -127,10 +173,10 @@ Here is an example launch.json file to run the pubsub sample
127
173
* You should have generated/downloaded private and public keys that will be used to verify that communications are coming from you
128
174
* When using samples you only need the private key and it will look like this: `--key abcde12345-private.pem.key`
129
175
130
-
### Where can I find MQTT 311 Samples?
131
-
The MQTT 311 Samples can be found in the v1.40.0 samples folder [here](https://github.com/aws/aws-iot-device-sdk-cpp-v2/tree/v1.40.0/samples)
176
+
### Where can I find MQTT 3.1.1 Samples?
177
+
The MQTT 3.1.1 samples can be found in the v1.40.0 samples folder [here](https://github.com/aws/aws-iot-device-sdk-cpp-v2/tree/v1.40.0/samples)
132
178
133
-
### I still have more questions about this sdk?
179
+
### I still have more questions about this SDK?
134
180
135
181
*[Here](https://docs.aws.amazon.com/iot/latest/developerguide/what-is-aws-iot.html) are the AWS IoT Core docs for more details about IoT Core
136
182
*[Here](https://docs.aws.amazon.com/greengrass/v2/developerguide/what-is-iot-greengrass.html) are the AWS IoT Greengrass v2 docs for more details about greengrass
0 commit comments