Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… into mqtt5_dd
  • Loading branch information
xiazhvera committed Oct 18, 2023
2 parents 19c0667 + a3392e6 commit b2336f8
Show file tree
Hide file tree
Showing 29 changed files with 1,961 additions and 57 deletions.
3 changes: 3 additions & 0 deletions .builder/actions/build_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ def run(self, env):
'samples/greengrass/basic_discovery',
'samples/greengrass/ipc',
'samples/fleet_provisioning/fleet_provisioning',
'samples/fleet_provisioning/mqtt5_fleet_provisioning',
'samples/jobs/describe_job_execution',
'samples/jobs/mqtt5_describe_job_execution',
'samples/mqtt/basic_connect',
'samples/mqtt/custom_authorizer_connect',
'samples/mqtt/pkcs11_connect',
Expand All @@ -33,6 +35,7 @@ def run(self, env):
'samples/secure_tunneling/secure_tunnel',
'samples/secure_tunneling/tunnel_notification',
'samples/shadow/shadow_sync',
'samples/shadow/mqtt5_shadow_sync',
]

defender_samples = []
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,9 @@ jobs:
- name: run Shadow sample
run: |
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_shadow_cfg.json
- name: run Mqtt5 Shadow sample
run: |
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_shadow_mqtt5_cfg.json
- name: configure AWS credentials (Jobs)
uses: aws-actions/configure-aws-credentials@v1
with:
Expand All @@ -521,6 +524,9 @@ jobs:
- name: run Jobs sample
run: |
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_jobs_cfg.json
- name: run Mqtt5 Jobs sample
run: |
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_jobs_mqtt5_cfg.json
- name: configure AWS credentials (Fleet provisioning)
uses: aws-actions/configure-aws-credentials@v1
with:
Expand All @@ -532,6 +538,12 @@ jobs:
Sample_UUID=$(python3 -c "import uuid; print (uuid.uuid4())")
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_fleet_provisioning_cfg.json --input_uuid ${Sample_UUID}
python3 ${{ env.CI_UTILS_FOLDER }}/delete_iot_thing_ci.py --thing_name "Fleet_Thing_${Sample_UUID}" --region "us-east-1"
- name: run Mqtt5 Fleet Provisioning sample
run: |
echo "Generating UUID for IoT thing"
Sample_UUID=$(python3 -c "import uuid; print (uuid.uuid4())")
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_fleet_provisioning_mqtt5_cfg.json --input_uuid ${Sample_UUID}
python3 ${{ env.CI_UTILS_FOLDER }}/delete_iot_thing_ci.py --thing_name "Fleet_Thing_${Sample_UUID}" --region "us-east-1"
- name: configure AWS credentials (Secure tunneling)
uses: aws-actions/configure-aws-credentials@v1
with:
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/ci_run_fleet_provisioning_mqtt5_cfg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"language": "CPP",
"sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/fleet_provisioning/mqtt5_fleet_provisioning/mqtt5-fleet-provisioning",
"sample_region": "us-east-1",
"sample_main_class": "",
"arguments": [
{
"name": "--endpoint",
"secret": "ci/endpoint"
},
{
"name": "--cert",
"secret": "ci/FleetProvisioning/cert",
"filename": "tmp_certificate.pem"
},
{
"name": "--key",
"secret": "ci/FleetProvisioning/key",
"filename": "tmp_key.pem"
},
{
"name": "--template_name",
"data": "CI_FleetProvisioning_Template"
},
{
"name": "--template_parameters",
"data": "{\"SerialNumber\":\"$INPUT_UUID\"}"
}
]
}
30 changes: 30 additions & 0 deletions .github/workflows/ci_run_jobs_mqtt5_cfg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"language": "CPP",
"sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/jobs/mqtt5_describe_job_execution/mqtt5-describe-job-execution",
"sample_region": "us-east-1",
"sample_main_class": "",
"arguments": [
{
"name": "--endpoint",
"secret": "ci/endpoint"
},
{
"name": "--cert",
"secret": "ci/Jobs/cert",
"filename": "tmp_certificate.pem"
},
{
"name": "--key",
"secret": "ci/Jobs/key",
"filename": "tmp_key.pem"
},
{
"name": "--thing_name",
"data": "CI_Jobs_Thing"
},
{
"name": "--job_id",
"data": "CI_Jobs_Thing_Job_1"
}
]
}
30 changes: 30 additions & 0 deletions .github/workflows/ci_run_shadow_mqtt5_cfg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"language": "CPP",
"sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/shadow/mqtt5_shadow_sync/mqtt5-shadow-sync",
"sample_region": "us-east-1",
"sample_main_class": "",
"arguments": [
{
"name": "--endpoint",
"secret": "ci/endpoint"
},
{
"name": "--cert",
"secret": "ci/Shadow/cert",
"filename": "tmp_certificate.pem"
},
{
"name": "--key",
"secret": "ci/Shadow/key",
"filename": "tmp_key.pem"
},
{
"name": "--thing_name",
"data": "CI_Shadow_Thing"
},
{
"name": "--is_ci",
"data": "true"
}
]
}
63 changes: 13 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,15 @@
# AWS IoT Device SDK for C++ v2

This document provides information about the AWS IoT device SDK for C++ V2.

If you have any issues or feature requests, please file an issue or pull request.

This SDK is built on the AWS Common Runtime, a collection of libraries
([aws-c-common](https://github.com/awslabs/aws-c-common),
[aws-c-io](https://github.com/awslabs/aws-c-io),
[aws-c-mqtt](https://github.com/awslabs/aws-c-mqtt),
[aws-c-http](https://github.com/awslabs/aws-c-http),
[aws-c-cal](https://github.com/awslabs/aws-c-cal),
[aws-c-auth](https://github.com/awslabs/aws-c-auth),
[s2n](https://github.com/awslabs/s2n)...) written in C to be
cross-platform, high-performance, secure, and reliable. The libraries are bound
to C++ by the [aws-crt-cpp](https://github.com/awslabs/aws-crt-cpp) package.
This document provides information about the AWS IoT device SDK for C++ V2. This SDK is built on the [AWS Common Runtime](https://docs.aws.amazon.com/sdkref/latest/guide/common-runtime.html)

__Jump To:__

* [Installation](#installation)
* [Samples](./samples)
* [Getting Help](#getting-help)
* [FAQ](./documents/FAQ.md)
* [Giving Feedback and Contributions](#giving-feedback-and-contributions)
* [API Docs](https://aws.github.io/aws-iot-device-sdk-cpp-v2/)
* [MQTT5 User Guide](./documents/MQTT5_Userguide.md)
* [Secure Tunnel User Guide](./documents/Secure_Tunnel_Userguide.md)


## Installation
Expand All @@ -38,22 +24,20 @@ __Jump To:__

### Build from source

#### MacOS and Linux

``` sh
# Create a workspace directory to hold all the SDK files
mkdir sdk-workspace
cd sdk-workspace
# Clone the repository
git clone --recursive https://github.com/aws/aws-iot-device-sdk-cpp-v2.git
# Ensure all submodules are properly updated
cd aws-iot-device-sdk-cpp-v2
git submodule update --init --recursive
cd ..
# Make a build directory for the SDK. Can use any name.
# If working with multiple SDKs, using a SDK-specific name is helpful.
mkdir aws-iot-device-sdk-cpp-v2-build
cd aws-iot-device-sdk-cpp-v2-build
# continue with the build steps below based on OS
```

#### MacOS and Linux
```sh
# Generate the SDK build files.
# -DCMAKE_INSTALL_PREFIX needs to be the absolute/full path to the directory.
# (Example: "/Users/example/sdk-workspace/).
Expand All @@ -64,25 +48,11 @@ cmake --build . --target install
```

#### Windows

``` sh
# Create a workspace directory to hold all the SDK files
mkdir sdk-workspace
cd sdk-cpp-workspace
# Clone the repository
git clone --recursive https://github.com/aws/aws-iot-device-sdk-cpp-v2.git
# Ensure all submodules are properly updated
cd aws-iot-device-sdk-cpp-v2
git submodule update --init --recursive
cd ..
# Make a build directory for the SDK. Can use any name.
# If working with multiple SDKs, using a SDK-specific name is helpful.
mkdir aws-iot-device-sdk-cpp-v2-build
cd aws-iot-device-sdk-cpp-v2-build
# Generate the SDK build files.
# -DCMAKE_INSTALL_PREFIX needs to be the absolute/full path to the directory.
# (Example: "C:/users/example/sdk-workspace/).
cmake -DCMAKE_INSTALL_PREFIX="<absolute path sdk-cpp-workspace dir>" ../aws-iot-device-sdk-cpp-v2
cmake -DCMAKE_INSTALL_PREFIX="<absolute path sdk-workspace dir>" ../aws-iot-device-sdk-cpp-v2
# Build and install the library. Once installed, you can develop with the SDK and run the samples
# -config can be "Release", "RelWithDebInfo", or "Debug"
cmake --build . --target install --config "Debug"
Expand Down Expand Up @@ -115,32 +85,25 @@ existing `libcrypto`, instead of building its own copy.

## Getting Help

The best way to interact with our team is through GitHub. You can [open an issue](https://github.com/aws/aws-iot-device-sdk-cpp-v2/issues) and choose from one of our templates for guidance, bug reports, or feature requests. You may also find help on community resources such as [StackOverFlow](https://stackoverflow.com/questions/tagged/aws-iot) with the tag #aws-iot or If you have a support plan with [AWS Support](https://aws.amazon.com/premiumsupport/), you can also create a new support case.
The best way to interact with our team is through GitHub. You can open a [discussion](https://github.com/aws/aws-iot-device-sdk-cpp-v2/discussions) for guidance questions or an [issue](https://github.com/aws/aws-iot-device-sdk-cpp-v2/issues/new/choose) for bug reports, or feature requests. You may also find help on community resources such as [StackOverFlow](https://stackoverflow.com/questions/tagged/aws-iot) with the tag [#aws-iot](https://stackoverflow.com/questions/tagged/aws-iot) or if you have a support plan with [AWS Support](https://aws.amazon.com/premiumsupport/), you can also create a new support case.

Please make sure to check out our resources too before opening an issue:

* Our [FAQ](./documents/FAQ.md)
* [FAQ](./documents/FAQ.md)
* [API Docs](https://aws.github.io/aws-iot-device-sdk-cpp-v2/)
* Our [Developer Guide](https://docs.aws.amazon.com/iot/latest/developerguide/what-is-aws-iot.html) ([source](https://github.com/awsdocs/aws-iot-docs))
* [IoT Guide](https://docs.aws.amazon.com/iot/latest/developerguide/what-is-aws-iot.html) ([source](https://github.com/awsdocs/aws-iot-docs))
* Check for similar [Issues](https://github.com/aws/aws-iot-device-sdk-cpp-v2/issues)
* [AWS IoT Core Documentation](https://docs.aws.amazon.com/iot/)
* [Dev Blog](https://aws.amazon.com/blogs/?awsf.blog-master-iot=category-internet-of-things%23amazon-freertos%7Ccategory-internet-of-things%23aws-greengrass%7Ccategory-internet-of-things%23aws-iot-analytics%7Ccategory-internet-of-things%23aws-iot-button%7Ccategory-internet-of-things%23aws-iot-device-defender%7Ccategory-internet-of-things%23aws-iot-device-management%7Ccategory-internet-of-things%23aws-iot-platform)
* Integration with AWS IoT Services such as
[Device Shadow](https://docs.aws.amazon.com/iot/latest/developerguide/iot-device-shadows.html)
and [Jobs](https://docs.aws.amazon.com/iot/latest/developerguide/iot-jobs.html)
is provided by code that been generated from a model of the service.

## Giving Feedback and Contributions

We need your help in making this SDK great. Please participate in the community and contribute to this effort by submitting issues, participating in discussion forums and submitting pull requests through the following channels.

* [Secure Tunnel User Guide](./documents/Secure_Tunnel_Userguide.md)
* [Contributions Guidelines](./documents/CONTRIBUTING.md)
* Articulate your feature request or upvote existing ones on our [Issues](https://github.com/aws/aws-iot-device-sdk-cpp-v2/issues?q=is%3Aissue+is%3Aopen+label%3Afeature-request) page.
* Create discussion questions [here](https://github.com/aws/aws-iot-device-sdk-cpp-v2/discussions)
* Find a bug open an [issue](https://github.com/aws/aws-iot-device-sdk-cpp-v2/issues)

## License

This library is licensed under the [Apache 2.0 License](./documents/LICENSE).

Latest released version: v1.29.1
Latest released version: v1.30.0
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.29.1
1.30.0
4 changes: 3 additions & 1 deletion identity/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# This file is generated

cmake_minimum_required(VERSION 3.1)

project(IotIdentity-cpp LANGUAGES CXX)
if (DEFINED SIMPLE_VERSION)
message("Identity version is ${SIMPLE_VERSION}")
message("IotIdentity version is ${SIMPLE_VERSION}")
set(PROJECT_VERSION ${SIMPLE_VERSION})
endif()

Expand Down
2 changes: 2 additions & 0 deletions identity/cmake/iotidentity-cpp-config.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is generated

include(CMakeFindDependencyMacro)

find_dependency(aws-crt-cpp)
Expand Down
2 changes: 2 additions & 0 deletions identity/include/aws/iotidentity/IotIdentityClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <aws/crt/StlAllocator.h>
#include <aws/crt/Types.h>

#include <aws/crt/mqtt/Mqtt5Client.h>
#include <aws/crt/mqtt/MqttClient.h>

namespace Aws
Expand Down Expand Up @@ -60,6 +61,7 @@ namespace Aws
{
public:
IotIdentityClient(const std::shared_ptr<Aws::Crt::Mqtt::MqttConnection> &connection);
IotIdentityClient(const std::shared_ptr<Aws::Crt::Mqtt5::Mqtt5Client> &mqtt5Client);

operator bool() const noexcept;
int GetLastError() const noexcept;
Expand Down
5 changes: 5 additions & 0 deletions identity/source/IotIdentityClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ namespace Aws
{
}

IotIdentityClient::IotIdentityClient(const std::shared_ptr<Aws::Crt::Mqtt5::Mqtt5Client> &mqtt5Client)
{
m_connection = Aws::Crt::Mqtt::MqttConnection::NewConnectionFromMqtt5Client(mqtt5Client);
}

IotIdentityClient::operator bool() const noexcept { return m_connection && *m_connection; }

int IotIdentityClient::GetLastError() const noexcept { return aws_last_error(); }
Expand Down
4 changes: 1 addition & 3 deletions jobs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ else ()
target_compile_options(IotJobs-cpp PRIVATE -Wall -Wno-long-long -pedantic -Werror)
endif ()

if (CMAKE_BUILD_TYPE STREQUAL "" OR CMAKE_BUILD_TYPE MATCHES Debug)
target_compile_definitions(IotJobs-cpp PRIVATE "-DDEBUG_BUILD")
endif ()
target_compile_definitions(IotJobs-cpp PRIVATE $<$<CONFIG:Debug>:DEBUG_BUILD>)

if (BUILD_SHARED_LIBS)
target_compile_definitions(IotJobs-cpp PUBLIC "-DAWS_IOTJOBS_USE_IMPORT_EXPORT")
Expand Down
2 changes: 2 additions & 0 deletions jobs/include/aws/iotjobs/IotJobsClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <aws/crt/StlAllocator.h>
#include <aws/crt/Types.h>

#include <aws/crt/mqtt/Mqtt5Client.h>
#include <aws/crt/mqtt/MqttClient.h>

namespace Aws
Expand Down Expand Up @@ -80,6 +81,7 @@ namespace Aws
{
public:
IotJobsClient(const std::shared_ptr<Aws::Crt::Mqtt::MqttConnection> &connection);
IotJobsClient(const std::shared_ptr<Aws::Crt::Mqtt5::Mqtt5Client> &mqtt5Client);

operator bool() const noexcept;
int GetLastError() const noexcept;
Expand Down
5 changes: 5 additions & 0 deletions jobs/source/IotJobsClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ namespace Aws
{
}

IotJobsClient::IotJobsClient(const std::shared_ptr<Aws::Crt::Mqtt5::Mqtt5Client> &mqtt5Client)
{
m_connection = Aws::Crt::Mqtt::MqttConnection::NewConnectionFromMqtt5Client(mqtt5Client);
}

IotJobsClient::operator bool() const noexcept { return m_connection && *m_connection; }

int IotJobsClient::GetLastError() const noexcept { return aws_last_error(); }
Expand Down
3 changes: 3 additions & 0 deletions samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ add_subdirectory(device_defender/basic_report)
add_subdirectory(greengrass/ipc)
add_subdirectory(greengrass/basic_discovery)
add_subdirectory(fleet_provisioning/fleet_provisioning)
add_subdirectory(fleet_provisioning/mqtt5_fleet_provisioning)
add_subdirectory(jobs/describe_job_execution)
add_subdirectory(jobs/mqtt5_describe_job_execution)
add_subdirectory(mqtt/basic_connect)
add_subdirectory(mqtt/custom_authorizer_connect)
add_subdirectory(mqtt/pkcs11_connect)
Expand All @@ -22,3 +24,4 @@ add_subdirectory(pub_sub/cycle_pub_sub)
add_subdirectory(secure_tunneling/secure_tunnel)
add_subdirectory(secure_tunneling/tunnel_notification)
add_subdirectory(shadow/shadow_sync)
add_subdirectory(shadow/mqtt5_shadow_sync)
2 changes: 1 addition & 1 deletion samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ cmake --build . --config "<Release|RelWithDebInfo|Debug>"
Change directory to the `aws-iot-device-sdk-cpp-v2/samples` directory and then run the following commands:

```sh
cmake -B build -S . -DCMAKE_PREFIX_PATH="<absolute path sdk-cpp-workspace dir>" -DCMAKE_BUILD_TYPE="<Release|RelWithDebInfo|Debug>" .
cmake -B build -S . -DCMAKE_PREFIX_PATH="<absolute path sdk-cpp-workspace dir>" -DCMAKE_BUILD_TYPE="<Release|RelWithDebInfo|Debug>"
cmake --build build --config "<Release|RelWithDebInfo|Debug>"
```

Expand Down
Loading

0 comments on commit b2336f8

Please sign in to comment.