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
##### MQTT5 is the recommended MQTT Client. Additional information and usage instructions can be found in the [MQTT5 User Guide](../documents/MQTT5_Userguide.md). The samples below will create an MQTT5 client, connect using the selected method, subscribe to a topic, publish to the topic, and then disconnect.
17
+
| MQTT5 Client Sample | Description |
18
+
|--------|-------------|
19
+
| [X509-based mutual TLS](./mqtt/mqtt5_x509/README.md) | Demonstrates connecting to AWS IoT Core using X.509 certificates and private keys.
20
+
|[Websockets with Sigv4 authentication](./mqtt/mqtt5_aws_websocket/README.md)| Shows how to authenticate over websockets using AWS Signature Version 4 credentials. |
21
+
| [AWS Custom Authorizer Lambda Function](./mqtt/mqtt5_custom_auth_signed/README.md) | Examples of connecting with a signed and unsigned Lambda-backed custom authorizer.
22
+
|[PKCS11](./mqtt/mqtt5_pkcs11/README.md)| Demonstrates connecting using a hardware security module (HSM) or smartcard with PKCS#11. |
23
+
| [Other Connection Methods](../documents/MQTT5_Userguide.md#connecting-to-aws-iot-core) | More connection methods are available for review in the MQTT5 Userguide
24
+
25
+
### Service Client Samples
26
+
##### AWS offers a number of IoT related services using MQTT. The samples below demonstrate how to use the service clients provided by the SDK to interact with those services.
27
+
| Service Client Sample | Description |
28
+
|--------|-------------|
29
+
|[Shadow](./service_clients/shadow/shadow-sandbox/README.md)| Manage and sync device state using the IoT Device Shadow service. |
30
+
|[Jobs](./service_clients/jobs/jobs-sandbox/README.md)| Receive and execute remote operations sent from the Jobs service. |
31
+
|[Basic Fleet Provisioning](./service_clients/fleet_provisioning/provision-basic/README.md)| Provision a device using the Fleet Provisioning template. |
This will compile all the samples at once and place the executables under the `build` directory relative to their file path. To view the commands for a given sample, run the compiled program and pass `--help`. For example, with the MQTT5 PubSub sample:
57
-
58
-
```sh
59
-
./build/mqtt5/mqtt5_pubsub/mqtt5_pubsub --help
60
-
```
61
-
62
-
This will compile all of the samples at once. You can then find the samples in the `aws-iot-device-sdk-cpp-v2/samples/build` folder. For example, the MQTT5 PubSub sample will be located at `aws-iot-device-sdk-cpp-v2/samples/build/mqtt5/mqtt5_pubsub`.
73
+
This will compile all of the samples at once. You can then find the samples in the `aws-iot-device-sdk-cpp-v2/samples/build` folder. For example, the MQTT5 PubSub sample will be located at `aws-iot-device-sdk-cpp-v2/samples/build/mqtt/mqtt5_x509`.
63
74
64
75
For CMake versions that do not support the `-B` command, go to the `aws-iot-device-sdk-cpp-v2/samples` directory and run the following commands:
65
76
@@ -78,23 +89,31 @@ Note that building all the samples at once is currently only available in the V2
78
89
79
90
*`-DCMAKE_BUILD_TYPE` and `--config` needs to match the `CMAKE_BUILD_TYPE` when aws-iot-device-sdk-cpp-v2 built. `--config` is only REQUIRED for multi-configuration build tools.
80
91
81
-
###Sample help
92
+
## Sample help
82
93
83
-
All samples will show their options by passing in `--help`. For example:
94
+
All samples will show their options and arguments by passing in `--help`. For example:
84
95
85
96
```sh
86
-
./build/mqtt5/mqtt5_pubsub/mqtt5_pubsub --help
97
+
./build/mqtt/mqtt5_x509/mqtt5_x509 --help
87
98
```
88
-
89
-
Which will result in output showing all of the options that can be passed in at the command line, along with descriptions of what each does and whether or not they are optional or not.
90
-
91
-
### Enable logging in samples
92
-
93
-
To enable logging in the samples, you can pass in `--verbosity`, and optionally `--log_file`, to the sample:
--cert Path to the certificate file to use during mTLS connection establishment
107
+
--key Path to the private key file to use during mTLS connection establishment
108
+
optional arguments:
109
+
--client_id Client ID (default: mqtt5-sample-<uuid>)
110
+
--ca_file Path to optional CA bundle (PEM)
111
+
--topic Topic (default: test/topic)
112
+
--message Message payload (default: Hello from mqtt5 sample)
113
+
--count Messages to publish (0 = infinite) (default: 5)
114
+
```
115
+
The sample will not run without the required arguments and will notify you of missing arguments.
116
+
117
+
## Enable logging in samples
98
118
99
-
*`--verbosity`: The level of logging shown. Can be `Trace`, `Debug`, `Info`, `Warn`, `Error`, `Fatal` or `None`. Logging will not occur if this is not passed in with `None` or greater logging level.
100
-
*`--log_file`: The filepath to store the logs at. This is optional, and if undefined the logs will be printed to `stdout` instead.
119
+
Instructions to enable logging are available in the [FAQ](../documents/FAQ.md) under [How do I enable logging](../documents/FAQ.md#how-do-i-enable-logging).
0 commit comments