Skip to content

Commit 532cb62

Browse files
committed
wip update sample folder structure
1 parent 0521606 commit 532cb62

14 files changed

Lines changed: 69 additions & 50 deletions

File tree

samples/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ project(aws-iot-device-sdk-cpp-v2-samples)
44

55
add_subdirectory(device_defender/basic_report)
66
add_subdirectory(device_defender/mqtt5_basic_report)
7-
add_subdirectory(fleet_provisioning/provision-basic)
8-
add_subdirectory(fleet_provisioning/provision-csr)
7+
add_subdirectory(service_clients/fleet_provisioning/provision-basic)
8+
add_subdirectory(service_clients/fleet_provisioning/provision-csr)
99
add_subdirectory(greengrass/ipc)
1010
add_subdirectory(greengrass/basic_discovery)
11-
add_subdirectory(jobs/jobs-sandbox)
11+
add_subdirectory(service_clients/jobs/jobs-sandbox)
1212
add_subdirectory(mqtt/mqtt5_x509)
1313
add_subdirectory(mqtt/mqtt5_aws_websocket)
1414
add_subdirectory(mqtt/mqtt5_custom_auth_signed)
1515
add_subdirectory(mqtt/mqtt5_custom_auth_unsigned)
1616
add_subdirectory(mqtt/mqtt5_pkcs11)
1717
add_subdirectory(secure_tunneling/secure_tunnel)
1818
add_subdirectory(secure_tunneling/tunnel_notification)
19-
add_subdirectory(shadow/shadow_sync)
19+
add_subdirectory(service_clients/shadow/shadow_sync)
2020
add_subdirectory(commands/commands-sandbox)

samples/README.md

Lines changed: 65 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,45 @@
1-
# Sample apps for the AWS IoT Device SDK for C++ v2
2-
3-
## MQTT5 Samples
4-
#### MQTT5 is the recommended MQTT Client. It has many benefits over MQTT311 outlined in the [MQTT5 User Guide](../documents/MQTT5_Userguide.md)
5-
* [Mqtt5 Pub-Sub](./mqtt5/mqtt5_pubsub/README.md)
6-
+ [Direct MQTT with X509-based mutual TLS](./mqtt5/mqtt5_pubsub/README.md#direct-mqtt-with-x509-based-mutual-tls)
7-
+ [MQTT over Websockets with Sigv4 authentication](./mqtt5/mqtt5_pubsub/README.md#mqtt-over-websockets-with-sigv4-authentication)
8-
+ [Direct MQTT with Custom Authentication](./mqtt5/mqtt5_pubsub/README.md#direct-mqtt-with-custom-authentication)
9-
+ [MQTT over Websockets with Cognito](./mqtt5/mqtt5_pubsub/README.md#mqtt-over-websockets-with-cognito)
10-
+ [HTTP Proxy](./mqtt5/mqtt5_pubsub/README.md#http-proxy)
11-
## Other Samples
12-
* [Jobs Sandbox](./jobs/jobs-sandbox/README.md)
13-
* [Shadow Sandbox](./shadow/shadow-sandbox/README.md)
14-
* [Basic Fleet Provisioning](./fleet_provisioning/provision-basic/README.md)
15-
* [CSR Fleet Provisioning](./fleet_provisioning/provision-csr/README.md)
16-
* [Commands Sandbox](./commands/commands-sandbox/README.md)
17-
* [Secure Tunnel](./secure_tunneling/secure_tunnel/README.md)
18-
* [Secure Tunnel Notification](./secure_tunneling/tunnel_notification/README.md)
19-
* [Cycle Pub-Sub](./pub_sub/cycle_pub_sub/README.md)
20-
* [Greengrass discovery](./greengrass/basic_discovery/README.md)
21-
* [Greengrass IPC](./greengrass/ipc/README.md)
22-
* [Mqtt5 Device Defender](./device_defender/mqtt5_basic_report/README.md)
23-
* [Mqtt311 Device Defender](./device_defender/basic_report/README.md)
24-
25-
## Build Instruction
1+
# Sample for the AWS IoT Device SDK v2 for C++
2+
This directory contains sample applications for [aws-iot-device-sdk-cpp-v2](../README.md).
3+
4+
### Table of Contents
5+
* [Samples](#samples)
6+
* [MQTT5 Client Samples](#mqtt5-client-samples)
7+
* [Service Client Samples](#service-client-samples)
8+
* [Greengrass Samples](#greengrass-samples)
9+
* [Instructions](#instructions)
10+
* [Sample Help](#sample-help)
11+
* [Enable Logging](#enable-logging)
12+
13+
14+
## Samples
15+
### MQTT5 Client Samples
16+
##### 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. |
32+
| [CSR Fleet Provisioning](./service_clients/fleet_provisioning/provision-csr/README.md) | Demonstrates CSR-based device certificate provisioning. |
33+
34+
35+
### Greengrass Samples
36+
##### Samples that interact with [AWS Greengrass](https://aws.amazon.com/greengrass/).
37+
| Greengrass Sample | Description |
38+
|--------|-------------|
39+
| [Greengrass Discovery](./greengrass/basic_discovery/README.md) | Discover and connect to a local Greengrass core. |
40+
| [Greengrass IPC](./greengrass/ipc/README.md) | Demonstrates Inter-Process Communication (IPC) with Greengrass components. |
41+
42+
## Instructions
2643

2744
First build and install aws-iot-devices-sdk-cpp-v2 with following instructions from [Installation](../README.md#Installation).
2845

@@ -53,13 +70,7 @@ cmake -B build -S . -DCMAKE_PREFIX_PATH="<absolute path sdk-cpp-workspace dir>"
5370
cmake --build build --config "<Release|RelWithDebInfo|Debug>"
5471
```
5572

56-
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`.
6374

6475
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:
6576

@@ -78,23 +89,31 @@ Note that building all the samples at once is currently only available in the V2
7889

7990
* `-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.
8091

81-
### Sample help
92+
## Sample help
8293

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:
8495

8596
```sh
86-
./build/mqtt5/mqtt5_pubsub/mqtt5_pubsub --help
97+
./build/mqtt/mqtt5_x509/mqtt5_x509 --help
8798
```
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:
94-
95-
```sh
96-
./build/basic-pub-sub --verbosity "Trace" --log_file "log.txt"
99+
will result in the following print output:
97100
```
101+
MQTT5 X509 Sample (mTLS)
102+
options:
103+
--help show this help message and exit
104+
required arguments:
105+
--endpoint IoT endpoint hostname
106+
--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
98118

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).

samples/fleet_provisioning/provision-basic/CMakeLists.txt renamed to samples/service_clients/fleet_provisioning/provision-basic/CMakeLists.txt

File renamed without changes.

samples/fleet_provisioning/provision-basic/README.md renamed to samples/service_clients/fleet_provisioning/provision-basic/README.md

File renamed without changes.

samples/fleet_provisioning/provision-basic/main.cpp renamed to samples/service_clients/fleet_provisioning/provision-basic/main.cpp

File renamed without changes.

samples/fleet_provisioning/provision-csr/CMakeLists.txt renamed to samples/service_clients/fleet_provisioning/provision-csr/CMakeLists.txt

File renamed without changes.

samples/fleet_provisioning/provision-csr/README.md renamed to samples/service_clients/fleet_provisioning/provision-csr/README.md

File renamed without changes.

samples/fleet_provisioning/provision-csr/main.cpp renamed to samples/service_clients/fleet_provisioning/provision-csr/main.cpp

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)