diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a0da81330..a09ac6dec 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,15 +9,12 @@ on: jobs: clang-format: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 # latest steps: - - name: Checkout Sources - uses: actions/checkout@v1 + - name: Checkout Sources + uses: actions/checkout@v4 - - name: clang-format lint - uses: DoozyX/clang-format-lint-action@v0.13 - with: - # List of extensions to check - extensions: cpp,h - clangFormatVersion: 11.1.0 + - name: clang-format lint + run: | + ./format-check.py diff --git a/devicedefender/source/DeviceDefender.cpp b/devicedefender/source/DeviceDefender.cpp index 03eb3c1cb..af43c2e99 100644 --- a/devicedefender/source/DeviceDefender.cpp +++ b/devicedefender/source/DeviceDefender.cpp @@ -25,7 +25,7 @@ namespace Aws public: Crt::Allocator *m_allocator; - virtual ~CustomMetricBase(){}; + virtual ~CustomMetricBase() {}; }; /** @@ -97,9 +97,10 @@ namespace Aws CustomMetricNumberList *metric = (CustomMetricNumberList *)data; Crt::Vector function_data = Crt::Vector(); int returnValue = metric->m_metricFunction(&function_data); - std::for_each(function_data.begin(), function_data.end(), [output](double &i) { - aws_array_list_push_back(output, &i); - }); + std::for_each( + function_data.begin(), + function_data.end(), + [output](double &i) { aws_array_list_push_back(output, &i); }); return returnValue; } @@ -116,10 +117,14 @@ namespace Aws CustomMetricStringList *metric = (CustomMetricStringList *)data; Crt::Vector function_data = Crt::Vector(); int returnValue = metric->m_metricFunction(&function_data); - std::for_each(function_data.begin(), function_data.end(), [output, metric](Crt::String &i) { - aws_string *tmp_str = aws_string_new_from_c_str(metric->m_allocator, i.c_str()); - aws_array_list_push_back(output, &tmp_str); - }); + std::for_each( + function_data.begin(), + function_data.end(), + [output, metric](Crt::String &i) + { + aws_string *tmp_str = aws_string_new_from_c_str(metric->m_allocator, i.c_str()); + aws_array_list_push_back(output, &tmp_str); + }); return returnValue; } @@ -134,10 +139,14 @@ namespace Aws CustomMetricIpList *metric = (CustomMetricIpList *)data; Crt::Vector function_data = Crt::Vector(); int returnValue = metric->m_metricFunction(&function_data); - std::for_each(function_data.begin(), function_data.end(), [output, metric](Crt::String &i) { - aws_string *tmp_str = aws_string_new_from_c_str(metric->m_allocator, i.c_str()); - aws_array_list_push_back(output, &tmp_str); - }); + std::for_each( + function_data.begin(), + function_data.end(), + [output, metric](Crt::String &i) + { + aws_string *tmp_str = aws_string_new_from_c_str(metric->m_allocator, i.c_str()); + aws_array_list_push_back(output, &tmp_str); + }); return returnValue; } @@ -184,7 +193,10 @@ namespace Aws } } - ReportTaskStatus ReportTask::GetStatus() noexcept { return this->m_status; } + ReportTaskStatus ReportTask::GetStatus() noexcept + { + return this->m_status; + } int ReportTask::StartTask() noexcept { diff --git a/devicedefender/tests/DeviceDefenderMetricsTest.cpp b/devicedefender/tests/DeviceDefenderMetricsTest.cpp index 0d819ca00..17ef0deec 100644 --- a/devicedefender/tests/DeviceDefenderMetricsTest.cpp +++ b/devicedefender/tests/DeviceDefenderMetricsTest.cpp @@ -43,7 +43,8 @@ static int s_TestDeviceDefenderCustomMetricSuccess(Aws::Crt::Allocator *allocato std::condition_variable cv; bool taskStopped = false; - auto onCancelled = [&](void *a) -> void { + auto onCancelled = [&](void *a) -> void + { auto *data = reinterpret_cast(a); *data = true; taskStopped = true; @@ -60,7 +61,8 @@ static int s_TestDeviceDefenderCustomMetricSuccess(Aws::Crt::Allocator *allocato // ================ // Add the custom metrics - std::function local_metric_number_func = [](double *output) { + std::function local_metric_number_func = [](double *output) + { *output = 10; return AWS_OP_SUCCESS; }; @@ -69,32 +71,35 @@ static int s_TestDeviceDefenderCustomMetricSuccess(Aws::Crt::Allocator *allocato task->RegisterCustomMetricNumber("CustomNumberTwo", std::move(global_metric_number_func_ref)); std::function *)> local_metric_number_list_func = - [](Aws::Crt::Vector *output) { - output->push_back(101); - output->push_back(102); - output->push_back(103); - return AWS_OP_SUCCESS; - }; + [](Aws::Crt::Vector *output) + { + output->push_back(101); + output->push_back(102); + output->push_back(103); + return AWS_OP_SUCCESS; + }; task->RegisterCustomMetricNumberList("CustomNumberList", std::move(local_metric_number_list_func)); std::function *)> local_metric_str_list_func = - [](Aws::Crt::Vector *output) { - output->push_back("One Fish"); - output->push_back("Two Fish"); - output->push_back("Red Fish"); - output->push_back("Blue Fish"); - return AWS_OP_SUCCESS; - }; + [](Aws::Crt::Vector *output) + { + output->push_back("One Fish"); + output->push_back("Two Fish"); + output->push_back("Red Fish"); + output->push_back("Blue Fish"); + return AWS_OP_SUCCESS; + }; task->RegisterCustomMetricStringList("CustomStringList", std::move(local_metric_str_list_func)); std::function *)> local_metric_ip_list_func = - [](Aws::Crt::Vector *output) { - output->push_back("192.0.2.0"); - output->push_back("198.51.100.0"); - output->push_back("203.0.113.0"); - output->push_back("233.252.0.0"); - return AWS_OP_SUCCESS; - }; + [](Aws::Crt::Vector *output) + { + output->push_back("192.0.2.0"); + output->push_back("198.51.100.0"); + output->push_back("203.0.113.0"); + output->push_back("233.252.0.0"); + return AWS_OP_SUCCESS; + }; task->RegisterCustomMetricIpAddressList("CustomIPList", std::move(local_metric_ip_list_func)); // ================ @@ -146,7 +151,8 @@ static int s_TestDeviceDefenderCustomMetricFail(Aws::Crt::Allocator *allocator, std::condition_variable cv; bool taskStopped = false; - auto onCancelled = [&](void *a) -> void { + auto onCancelled = [&](void *a) -> void + { auto *data = reinterpret_cast(a); *data = true; taskStopped = true; @@ -162,7 +168,8 @@ static int s_TestDeviceDefenderCustomMetricFail(Aws::Crt::Allocator *allocator, std::shared_ptr task = taskBuilder.Build(); // Add the error custom metric - std::function number_metric_func = [](double *output) { + std::function number_metric_func = [](double *output) + { *output = 10; return AWS_OP_ERR; }; @@ -220,7 +227,8 @@ static int s_TestMqtt5DeviceDefenderCustomMetricSuccess(Aws::Crt::Allocator *all std::condition_variable cv; bool taskStopped = false; - auto onCancelled = [&](void *a) -> void { + auto onCancelled = [&](void *a) -> void + { auto *data = reinterpret_cast(a); *data = true; taskStopped = true; @@ -237,7 +245,8 @@ static int s_TestMqtt5DeviceDefenderCustomMetricSuccess(Aws::Crt::Allocator *all // ================ // Add the custom metrics - std::function local_metric_number_func = [](double *output) { + std::function local_metric_number_func = [](double *output) + { *output = 10; return AWS_OP_SUCCESS; }; @@ -246,32 +255,35 @@ static int s_TestMqtt5DeviceDefenderCustomMetricSuccess(Aws::Crt::Allocator *all task->RegisterCustomMetricNumber("CustomNumberTwo", std::move(global_metric_number_func_ref)); std::function *)> local_metric_number_list_func = - [](Aws::Crt::Vector *output) { - output->push_back(101); - output->push_back(102); - output->push_back(103); - return AWS_OP_SUCCESS; - }; + [](Aws::Crt::Vector *output) + { + output->push_back(101); + output->push_back(102); + output->push_back(103); + return AWS_OP_SUCCESS; + }; task->RegisterCustomMetricNumberList("CustomNumberList", std::move(local_metric_number_list_func)); std::function *)> local_metric_str_list_func = - [](Aws::Crt::Vector *output) { - output->push_back("One Fish"); - output->push_back("Two Fish"); - output->push_back("Red Fish"); - output->push_back("Blue Fish"); - return AWS_OP_SUCCESS; - }; + [](Aws::Crt::Vector *output) + { + output->push_back("One Fish"); + output->push_back("Two Fish"); + output->push_back("Red Fish"); + output->push_back("Blue Fish"); + return AWS_OP_SUCCESS; + }; task->RegisterCustomMetricStringList("CustomStringList", std::move(local_metric_str_list_func)); std::function *)> local_metric_ip_list_func = - [](Aws::Crt::Vector *output) { - output->push_back("192.0.2.0"); - output->push_back("198.51.100.0"); - output->push_back("203.0.113.0"); - output->push_back("233.252.0.0"); - return AWS_OP_SUCCESS; - }; + [](Aws::Crt::Vector *output) + { + output->push_back("192.0.2.0"); + output->push_back("198.51.100.0"); + output->push_back("203.0.113.0"); + output->push_back("233.252.0.0"); + return AWS_OP_SUCCESS; + }; task->RegisterCustomMetricIpAddressList("CustomIPList", std::move(local_metric_ip_list_func)); // ================ @@ -333,7 +345,8 @@ static int s_TestMqtt5DeviceDefenderCustomMetricFail(Aws::Crt::Allocator *alloca std::condition_variable cv; bool taskStopped = false; - auto onCancelled = [&](void *a) -> void { + auto onCancelled = [&](void *a) -> void + { auto *data = reinterpret_cast(a); *data = true; taskStopped = true; @@ -349,7 +362,8 @@ static int s_TestMqtt5DeviceDefenderCustomMetricFail(Aws::Crt::Allocator *alloca std::shared_ptr task = taskBuilder.Build(); // Add the error custom metric - std::function number_metric_func = [](double *output) { + std::function number_metric_func = [](double *output) + { *output = 10; return AWS_OP_ERR; }; diff --git a/devicedefender/tests/DeviceDefenderTest.cpp b/devicedefender/tests/DeviceDefenderTest.cpp index cb75c418c..d3305c7c8 100644 --- a/devicedefender/tests/DeviceDefenderTest.cpp +++ b/devicedefender/tests/DeviceDefenderTest.cpp @@ -46,7 +46,8 @@ static int s_TestDeviceDefenderResourceSafety(Aws::Crt::Allocator *allocator, vo std::condition_variable cv; bool taskStopped = false; - auto onCancelled = [&](void *a) -> void { + auto onCancelled = [&](void *a) -> void + { auto *data = reinterpret_cast(a); *data = true; taskStopped = true; @@ -177,7 +178,8 @@ static int s_TestMqtt5DeviceDefenderResourceSafety(Aws::Crt::Allocator *allocato std::condition_variable cv; bool taskStopped = false; - auto onCancelled = [&](void *a) -> void { + auto onCancelled = [&](void *a) -> void + { auto *data = reinterpret_cast(a); *data = true; taskStopped = true; diff --git a/discovery/source/ConnectivityInfo.cpp b/discovery/source/ConnectivityInfo.cpp index 1cc10ce95..cf0df44e3 100644 --- a/discovery/source/ConnectivityInfo.cpp +++ b/discovery/source/ConnectivityInfo.cpp @@ -31,7 +31,10 @@ namespace Aws } } - ConnectivityInfo::ConnectivityInfo(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + ConnectivityInfo::ConnectivityInfo(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } ConnectivityInfo &ConnectivityInfo::operator=(const Crt::JsonView &doc) { diff --git a/discovery/source/DiscoverResponse.cpp b/discovery/source/DiscoverResponse.cpp index 513da4b92..a581d45e5 100644 --- a/discovery/source/DiscoverResponse.cpp +++ b/discovery/source/DiscoverResponse.cpp @@ -22,7 +22,10 @@ namespace Aws } } - DiscoverResponse::DiscoverResponse(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + DiscoverResponse::DiscoverResponse(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } DiscoverResponse &DiscoverResponse::operator=(const Crt::JsonView &doc) { diff --git a/discovery/source/DiscoveryClient.cpp b/discovery/source/DiscoveryClient.cpp index b0a5566f6..c3a01e237 100644 --- a/discovery/source/DiscoveryClient.cpp +++ b/discovery/source/DiscoveryClient.cpp @@ -119,7 +119,8 @@ namespace Aws bool res = m_connectionManager->AcquireConnection( [this, callbackContext, thingName, onDiscoverResponse]( - std::shared_ptr connection, int errorCode) { + std::shared_ptr connection, int errorCode) + { if (errorCode) { onDiscoverResponse(nullptr, errorCode, 0); @@ -164,15 +165,14 @@ namespace Aws [](Crt::Http::HttpStream &, aws_http_header_block, const Crt::Http::HttpHeader *, std::size_t) { }; requestOptions.onIncomingHeadersBlockDone = - [callbackContext](Crt::Http::HttpStream &stream, aws_http_header_block) { - callbackContext->responseCode = stream.GetResponseStatusCode(); - }; + [callbackContext](Crt::Http::HttpStream &stream, aws_http_header_block) + { callbackContext->responseCode = stream.GetResponseStatusCode(); }; requestOptions.onIncomingBody = - [callbackContext](Crt::Http::HttpStream &, const Crt::ByteCursor &data) { - callbackContext->ss.write(reinterpret_cast(data.ptr), data.len); - }; + [callbackContext](Crt::Http::HttpStream &, const Crt::ByteCursor &data) + { callbackContext->ss.write(reinterpret_cast(data.ptr), data.len); }; requestOptions.onStreamComplete = [request, connection, callbackContext, onDiscoverResponse]( - Crt::Http::HttpStream &, int errorCode) { + Crt::Http::HttpStream &, int errorCode) + { if (!errorCode && callbackContext->responseCode == 200) { Crt::JsonObject jsonObject(callbackContext->ss.str()); diff --git a/discovery/source/GGCore.cpp b/discovery/source/GGCore.cpp index cb8547987..3bf17e1a0 100644 --- a/discovery/source/GGCore.cpp +++ b/discovery/source/GGCore.cpp @@ -29,7 +29,10 @@ namespace Aws } } - GGCore::GGCore(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + GGCore::GGCore(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } GGCore &GGCore::operator=(const Crt::JsonView &doc) { diff --git a/discovery/source/GGGroup.cpp b/discovery/source/GGGroup.cpp index b1fa4d034..7cdd495ff 100644 --- a/discovery/source/GGGroup.cpp +++ b/discovery/source/GGGroup.cpp @@ -38,7 +38,10 @@ namespace Aws } } - GGGroup::GGGroup(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + GGGroup::GGGroup(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } GGGroup &GGGroup::operator=(const Crt::JsonView &doc) { diff --git a/eventstream_rpc/include/aws/eventstreamrpc/EventStreamClient.h b/eventstream_rpc/include/aws/eventstreamrpc/EventStreamClient.h index 4b4904729..a48bcc997 100644 --- a/eventstream_rpc/include/aws/eventstreamrpc/EventStreamClient.h +++ b/eventstream_rpc/include/aws/eventstreamrpc/EventStreamClient.h @@ -127,9 +127,9 @@ namespace Aws void PrependHeaders(Crt::List &&headers); void SetPayload(const Crt::Optional &payload) noexcept; void SetPayload(Crt::Optional &&payload); - const Crt::List &GetHeaders() const &noexcept; + const Crt::List &GetHeaders() const & noexcept; Crt::List &&GetHeaders() &&; - const Crt::Optional &GetPayload() const &noexcept; + const Crt::Optional &GetPayload() const & noexcept; Crt::Optional &&GetPayload() &&; private: diff --git a/eventstream_rpc/source/EventStreamClient.cpp b/eventstream_rpc/source/EventStreamClient.cpp index d5e816702..b1f8ce8f2 100644 --- a/eventstream_rpc/source/EventStreamClient.cpp +++ b/eventstream_rpc/source/EventStreamClient.cpp @@ -113,13 +113,25 @@ namespace Aws return *this; } - const Crt::List &MessageAmendment::GetHeaders() const &noexcept { return m_headers; } + const Crt::List &MessageAmendment::GetHeaders() const & noexcept + { + return m_headers; + } - Crt::List &&MessageAmendment::GetHeaders() && { return std::move(m_headers); } + Crt::List &&MessageAmendment::GetHeaders() && + { + return std::move(m_headers); + } - const Crt::Optional &MessageAmendment::GetPayload() const &noexcept { return m_payload; } + const Crt::Optional &MessageAmendment::GetPayload() const & noexcept + { + return m_payload; + } - Crt::Optional &&MessageAmendment::GetPayload() && { return std::move(m_payload); } + Crt::Optional &&MessageAmendment::GetPayload() && + { + return std::move(m_payload); + } void MessageAmendment::AddHeader(EventStreamHeader &&header) noexcept { @@ -139,7 +151,10 @@ namespace Aws } } - void MessageAmendment::SetPayload(Crt::Optional &&payload) { m_payload = std::move(payload); } + void MessageAmendment::SetPayload(Crt::Optional &&payload) + { + m_payload = std::move(payload); + } MessageAmendment::~MessageAmendment() noexcept { @@ -257,7 +272,10 @@ namespace Aws void ConnectionLifecycleHandler::OnConnectCallback() {} - void ConnectionLifecycleHandler::OnDisconnectCallback(RpcError error) { (void)error; } + void ConnectionLifecycleHandler::OnDisconnectCallback(RpcError error) + { + (void)error; + } Crt::String RpcError::StatusToString() { @@ -1123,7 +1141,10 @@ namespace Aws { } - void OperationError::SerializeToJsonObject(Crt::JsonObject &payloadObject) const { (void)payloadObject; } + void OperationError::SerializeToJsonObject(Crt::JsonObject &payloadObject) const + { + (void)payloadObject; + } AbstractShapeBase::AbstractShapeBase() noexcept : m_allocator(nullptr) {} @@ -1211,7 +1232,10 @@ namespace Aws rhs.m_rpcError = {EVENT_STREAM_RPC_UNINITIALIZED, 0}; } - TaggedResult::operator bool() const noexcept { return m_responseType == OPERATION_RESPONSE; } + TaggedResult::operator bool() const noexcept + { + return m_responseType == OPERATION_RESPONSE; + } AbstractShapeBase *TaggedResult::GetOperationResponse() const noexcept { @@ -1540,7 +1564,10 @@ namespace Aws } } - void ClientOperation::WithLaunchMode(std::launch mode) noexcept { m_asyncLaunchMode = mode; } + void ClientOperation::WithLaunchMode(std::launch mode) noexcept + { + m_asyncLaunchMode = mode; + } std::future ClientOperation::Close(OnMessageFlushCallback onMessageFlushCallback) noexcept { diff --git a/eventstream_rpc/tests/EchoTestRpcClient.cpp b/eventstream_rpc/tests/EchoTestRpcClient.cpp index 508e13fcb..05fe07477 100644 --- a/eventstream_rpc/tests/EchoTestRpcClient.cpp +++ b/eventstream_rpc/tests/EchoTestRpcClient.cpp @@ -28,11 +28,20 @@ namespace Awstest return m_connection.Connect(connectionConfig, &lifecycleHandler, m_clientBootstrap); } - void EchoTestRpcClient::Close() noexcept { m_connection.Close(); } + void EchoTestRpcClient::Close() noexcept + { + m_connection.Close(); + } - void EchoTestRpcClient::WithLaunchMode(std::launch mode) noexcept { m_asyncLaunchMode = mode; } + void EchoTestRpcClient::WithLaunchMode(std::launch mode) noexcept + { + m_asyncLaunchMode = mode; + } - EchoTestRpcClient::~EchoTestRpcClient() noexcept { Close(); } + EchoTestRpcClient::~EchoTestRpcClient() noexcept + { + Close(); + } std::shared_ptr EchoTestRpcClient::NewGetAllProducts() noexcept { diff --git a/eventstream_rpc/tests/EchoTestRpcModel.cpp b/eventstream_rpc/tests/EchoTestRpcModel.cpp index c0737ce68..3cb4f9c6b 100644 --- a/eventstream_rpc/tests/EchoTestRpcModel.cpp +++ b/eventstream_rpc/tests/EchoTestRpcModel.cpp @@ -36,7 +36,10 @@ namespace Awstest const char *Product::MODEL_NAME = "awstest#Product"; - Aws::Crt::String Product::GetModelName() const noexcept { return Product::MODEL_NAME; } + Aws::Crt::String Product::GetModelName() const noexcept + { + return Product::MODEL_NAME; + } Aws::Crt::ScopedResource Product::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -84,7 +87,10 @@ namespace Awstest const char *Pair::MODEL_NAME = "awstest#Pair"; - Aws::Crt::String Pair::GetModelName() const noexcept { return Pair::MODEL_NAME; } + Aws::Crt::String Pair::GetModelName() const noexcept + { + return Pair::MODEL_NAME; + } Aws::Crt::ScopedResource Pair::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -140,7 +146,10 @@ namespace Awstest const char *Customer::MODEL_NAME = "awstest#Customer"; - Aws::Crt::String Customer::GetModelName() const noexcept { return Customer::MODEL_NAME; } + Aws::Crt::String Customer::GetModelName() const noexcept + { + return Customer::MODEL_NAME; + } Aws::Crt::ScopedResource Customer::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -343,7 +352,10 @@ namespace Awstest const char *MessageData::MODEL_NAME = "awstest#MessageData"; - Aws::Crt::String MessageData::GetModelName() const noexcept { return MessageData::MODEL_NAME; } + Aws::Crt::String MessageData::GetModelName() const noexcept + { + return MessageData::MODEL_NAME; + } Aws::Crt::ScopedResource MessageData::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -419,7 +431,10 @@ namespace Awstest const char *EchoStreamingMessage::MODEL_NAME = "awstest#EchoStreamingMessage"; - Aws::Crt::String EchoStreamingMessage::GetModelName() const noexcept { return EchoStreamingMessage::MODEL_NAME; } + Aws::Crt::String EchoStreamingMessage::GetModelName() const noexcept + { + return EchoStreamingMessage::MODEL_NAME; + } Aws::Crt::ScopedResource EchoStreamingMessage::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -468,7 +483,10 @@ namespace Awstest const char *ServiceError::MODEL_NAME = "awstest#ServiceError"; - Aws::Crt::String ServiceError::GetModelName() const noexcept { return ServiceError::MODEL_NAME; } + Aws::Crt::String ServiceError::GetModelName() const noexcept + { + return ServiceError::MODEL_NAME; + } Aws::Crt::ScopedResource ServiceError::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -566,7 +584,10 @@ namespace Awstest const char *GetAllProductsRequest::MODEL_NAME = "awstest#GetAllProductsRequest"; - Aws::Crt::String GetAllProductsRequest::GetModelName() const noexcept { return GetAllProductsRequest::MODEL_NAME; } + Aws::Crt::String GetAllProductsRequest::GetModelName() const noexcept + { + return GetAllProductsRequest::MODEL_NAME; + } Aws::Crt::ScopedResource GetAllProductsRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -707,7 +728,10 @@ namespace Awstest const char *EchoStreamingResponse::MODEL_NAME = "awstest#EchoStreamingResponse"; - Aws::Crt::String EchoStreamingResponse::GetModelName() const noexcept { return EchoStreamingResponse::MODEL_NAME; } + Aws::Crt::String EchoStreamingResponse::GetModelName() const noexcept + { + return EchoStreamingResponse::MODEL_NAME; + } Aws::Crt::ScopedResource EchoStreamingResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -745,7 +769,10 @@ namespace Awstest const char *EchoStreamingRequest::MODEL_NAME = "awstest#EchoStreamingRequest"; - Aws::Crt::String EchoStreamingRequest::GetModelName() const noexcept { return EchoStreamingRequest::MODEL_NAME; } + Aws::Crt::String EchoStreamingRequest::GetModelName() const noexcept + { + return EchoStreamingRequest::MODEL_NAME; + } Aws::Crt::ScopedResource EchoStreamingRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -791,7 +818,10 @@ namespace Awstest const char *EchoMessageResponse::MODEL_NAME = "awstest#EchoMessageResponse"; - Aws::Crt::String EchoMessageResponse::GetModelName() const noexcept { return EchoMessageResponse::MODEL_NAME; } + Aws::Crt::String EchoMessageResponse::GetModelName() const noexcept + { + return EchoMessageResponse::MODEL_NAME; + } Aws::Crt::ScopedResource EchoMessageResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -837,7 +867,10 @@ namespace Awstest const char *EchoMessageRequest::MODEL_NAME = "awstest#EchoMessageRequest"; - Aws::Crt::String EchoMessageRequest::GetModelName() const noexcept { return EchoMessageRequest::MODEL_NAME; } + Aws::Crt::String EchoMessageRequest::GetModelName() const noexcept + { + return EchoMessageRequest::MODEL_NAME; + } Aws::Crt::ScopedResource EchoMessageRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, diff --git a/eventstream_rpc/tests/EventStreamClientTest.cpp b/eventstream_rpc/tests/EventStreamClientTest.cpp index 232afc202..b0301ab13 100644 --- a/eventstream_rpc/tests/EventStreamClientTest.cpp +++ b/eventstream_rpc/tests/EventStreamClientTest.cpp @@ -506,7 +506,8 @@ static int s_TestStressClient(struct aws_allocator *allocator, void *ctx) Awstest::EchoTestRpcClient client(*testContext->clientBootstrap, allocator); auto connectedStatus = client.Connect(lifecycleHandler); ASSERT_TRUE(connectedStatus.get().baseStatus == EVENT_STREAM_RPC_SUCCESS); - auto invokeOperation = [&](void) -> int { + auto invokeOperation = [&](void) -> int + { auto echoMessage = client.NewEchoMessage(); messageData.SetStringMessage(expectedMessage); echoMessageRequest.SetMessage(messageData); diff --git a/format-check.py b/format-check.py new file mode 100755 index 000000000..8dcc21958 --- /dev/null +++ b/format-check.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 +import argparse +import os +from pathlib import Path +import re +from subprocess import list2cmdline, run +from tempfile import NamedTemporaryFile + +CLANG_FORMAT_VERSION = '18.1.6' + +INCLUDE_REGEX = re.compile(r'.*(include|source|tests)/.*\.(cpp|h)$') +EXCLUDE_REGEX = re.compile(r'^$') + +arg_parser = argparse.ArgumentParser(description="Check with clang-format") +arg_parser.add_argument('-i', '--inplace-edit', action='store_true', + help="Edit files inplace") +args = arg_parser.parse_args() + +os.chdir(Path(__file__).parent) + +check_dirs = ['deviceadvisor', 'devicedefender', 'discovery', 'eventstream_rpc', 'greengrass_ipc', 'identity', 'iotdevicecommon', 'jobs', 'shadow', 'samples', 'secure_tunneling'] + +filepaths_file = NamedTemporaryFile(delete=False) +for check_dir in check_dirs: + # create file containing list of all files to format + + for dirpath, dirnames, filenames in os.walk(check_dir): + for filename in filenames: + + # our regexes expect filepath to use forward slash + filepath = Path(dirpath, filename).as_posix() + + if not INCLUDE_REGEX.match(filepath): + continue + if EXCLUDE_REGEX.match(filepath): + continue + + filepaths_file.write(f"{filepath}\n".encode()) + +filepaths_file.close() + +# use pipx to run clang-format from PyPI +# this is a simple way to run the same clang-format version regardless of OS +cmd = ['pipx', 'run', f'clang-format=={CLANG_FORMAT_VERSION}', + f'--files={filepaths_file.name}'] +if args.inplace_edit: + cmd += ['-i'] +else: + cmd += ['--Werror', '--dry-run'] + +print(f"{Path.cwd()}$ {list2cmdline(cmd)}") +if run(cmd).returncode: + exit(1) diff --git a/format-check.sh b/format-check.sh deleted file mode 100755 index 0899f8975..000000000 --- a/format-check.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -if [[ -z $CLANG_FORMAT ]] ; then - CLANG_FORMAT=clang-format -fi - -if NOT type $CLANG_FORMAT 2> /dev/null ; then - echo "No appropriate clang-format found." - exit 1 -fi - -FAIL=0 -SOURCE_FILES=`find deviceadvisor devicedefender discovery eventstream_rpc greengrass_ipc identity iotdevicecommon jobs shadow samples secure_tunneling -type f \( -name '*.h' -o -name '*.cpp' \)` -for i in $SOURCE_FILES -do - $CLANG_FORMAT -output-replacements-xml $i | grep -c " /dev/null - if [ $? -ne 1 ] - then - echo "$i failed clang-format check." - FAIL=1 - fi -done - -exit $FAIL diff --git a/greengrass_ipc/source/GreengrassCoreIpcClient.cpp b/greengrass_ipc/source/GreengrassCoreIpcClient.cpp index 5d75d1240..a1db24d5a 100644 --- a/greengrass_ipc/source/GreengrassCoreIpcClient.cpp +++ b/greengrass_ipc/source/GreengrassCoreIpcClient.cpp @@ -58,11 +58,20 @@ namespace Aws return m_connection.Connect(connectionConfig, &lifecycleHandler, m_clientBootstrap); } - void GreengrassCoreIpcClient::Close() noexcept { m_connection.Close(); } + void GreengrassCoreIpcClient::Close() noexcept + { + m_connection.Close(); + } - void GreengrassCoreIpcClient::WithLaunchMode(std::launch mode) noexcept { m_asyncLaunchMode = mode; } + void GreengrassCoreIpcClient::WithLaunchMode(std::launch mode) noexcept + { + m_asyncLaunchMode = mode; + } - GreengrassCoreIpcClient::~GreengrassCoreIpcClient() noexcept { Close(); } + GreengrassCoreIpcClient::~GreengrassCoreIpcClient() noexcept + { + Close(); + } std::shared_ptr GreengrassCoreIpcClient::NewSubscribeToIoTCore( std::shared_ptr streamHandler) noexcept diff --git a/greengrass_ipc/source/GreengrassCoreIpcModel.cpp b/greengrass_ipc/source/GreengrassCoreIpcModel.cpp index a3f9331eb..10d686a57 100644 --- a/greengrass_ipc/source/GreengrassCoreIpcModel.cpp +++ b/greengrass_ipc/source/GreengrassCoreIpcModel.cpp @@ -38,7 +38,10 @@ namespace Aws const char *UserProperty::MODEL_NAME = "aws.greengrass#UserProperty"; - Aws::Crt::String UserProperty::GetModelName() const noexcept { return UserProperty::MODEL_NAME; } + Aws::Crt::String UserProperty::GetModelName() const noexcept + { + return UserProperty::MODEL_NAME; + } Aws::Crt::ScopedResource UserProperty::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -81,7 +84,10 @@ namespace Aws const char *MessageContext::MODEL_NAME = "aws.greengrass#MessageContext"; - Aws::Crt::String MessageContext::GetModelName() const noexcept { return MessageContext::MODEL_NAME; } + Aws::Crt::String MessageContext::GetModelName() const noexcept + { + return MessageContext::MODEL_NAME; + } Aws::Crt::ScopedResource MessageContext::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -412,7 +418,10 @@ namespace Aws const char *BinaryMessage::MODEL_NAME = "aws.greengrass#BinaryMessage"; - Aws::Crt::String BinaryMessage::GetModelName() const noexcept { return BinaryMessage::MODEL_NAME; } + Aws::Crt::String BinaryMessage::GetModelName() const noexcept + { + return BinaryMessage::MODEL_NAME; + } Aws::Crt::ScopedResource BinaryMessage::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -465,7 +474,10 @@ namespace Aws const char *JsonMessage::MODEL_NAME = "aws.greengrass#JsonMessage"; - Aws::Crt::String JsonMessage::GetModelName() const noexcept { return JsonMessage::MODEL_NAME; } + Aws::Crt::String JsonMessage::GetModelName() const noexcept + { + return JsonMessage::MODEL_NAME; + } Aws::Crt::ScopedResource JsonMessage::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -632,7 +644,10 @@ namespace Aws const char *MQTTMessage::MODEL_NAME = "aws.greengrass#MQTTMessage"; - Aws::Crt::String MQTTMessage::GetModelName() const noexcept { return MQTTMessage::MODEL_NAME; } + Aws::Crt::String MQTTMessage::GetModelName() const noexcept + { + return MQTTMessage::MODEL_NAME; + } Aws::Crt::ScopedResource MQTTMessage::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -888,7 +903,10 @@ namespace Aws const char *CertificateUpdate::MODEL_NAME = "aws.greengrass#CertificateUpdate"; - Aws::Crt::String CertificateUpdate::GetModelName() const noexcept { return CertificateUpdate::MODEL_NAME; } + Aws::Crt::String CertificateUpdate::GetModelName() const noexcept + { + return CertificateUpdate::MODEL_NAME; + } Aws::Crt::ScopedResource CertificateUpdate::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -1004,7 +1022,10 @@ namespace Aws const char *Metric::MODEL_NAME = "aws.greengrass#Metric"; - Aws::Crt::String Metric::GetModelName() const noexcept { return Metric::MODEL_NAME; } + Aws::Crt::String Metric::GetModelName() const noexcept + { + return Metric::MODEL_NAME; + } Aws::Crt::ScopedResource Metric::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -1128,7 +1149,10 @@ namespace Aws const char *LocalDeployment::MODEL_NAME = "aws.greengrass#LocalDeployment"; - Aws::Crt::String LocalDeployment::GetModelName() const noexcept { return LocalDeployment::MODEL_NAME; } + Aws::Crt::String LocalDeployment::GetModelName() const noexcept + { + return LocalDeployment::MODEL_NAME; + } Aws::Crt::ScopedResource LocalDeployment::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -1270,7 +1294,10 @@ namespace Aws const char *ComponentDetails::MODEL_NAME = "aws.greengrass#ComponentDetails"; - Aws::Crt::String ComponentDetails::GetModelName() const noexcept { return ComponentDetails::MODEL_NAME; } + Aws::Crt::String ComponentDetails::GetModelName() const noexcept + { + return ComponentDetails::MODEL_NAME; + } Aws::Crt::ScopedResource ComponentDetails::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -1338,7 +1365,10 @@ namespace Aws const char *MQTTCredential::MODEL_NAME = "aws.greengrass#MQTTCredential"; - Aws::Crt::String MQTTCredential::GetModelName() const noexcept { return MQTTCredential::MODEL_NAME; } + Aws::Crt::String MQTTCredential::GetModelName() const noexcept + { + return MQTTCredential::MODEL_NAME; + } Aws::Crt::ScopedResource MQTTCredential::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -1399,7 +1429,10 @@ namespace Aws const char *RunWithInfo::MODEL_NAME = "aws.greengrass#RunWithInfo"; - Aws::Crt::String RunWithInfo::GetModelName() const noexcept { return RunWithInfo::MODEL_NAME; } + Aws::Crt::String RunWithInfo::GetModelName() const noexcept + { + return RunWithInfo::MODEL_NAME; + } Aws::Crt::ScopedResource RunWithInfo::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -1662,7 +1695,10 @@ namespace Aws const char *IoTCoreMessage::MODEL_NAME = "aws.greengrass#IoTCoreMessage"; - Aws::Crt::String IoTCoreMessage::GetModelName() const noexcept { return IoTCoreMessage::MODEL_NAME; } + Aws::Crt::String IoTCoreMessage::GetModelName() const noexcept + { + return IoTCoreMessage::MODEL_NAME; + } Aws::Crt::ScopedResource IoTCoreMessage::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -1934,7 +1970,10 @@ namespace Aws const char *CertificateOptions::MODEL_NAME = "aws.greengrass#CertificateOptions"; - Aws::Crt::String CertificateOptions::GetModelName() const noexcept { return CertificateOptions::MODEL_NAME; } + Aws::Crt::String CertificateOptions::GetModelName() const noexcept + { + return CertificateOptions::MODEL_NAME; + } Aws::Crt::ScopedResource CertificateOptions::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -2106,7 +2145,10 @@ namespace Aws const char *PublishMessage::MODEL_NAME = "aws.greengrass#PublishMessage"; - Aws::Crt::String PublishMessage::GetModelName() const noexcept { return PublishMessage::MODEL_NAME; } + Aws::Crt::String PublishMessage::GetModelName() const noexcept + { + return PublishMessage::MODEL_NAME; + } Aws::Crt::ScopedResource PublishMessage::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -2179,7 +2221,10 @@ namespace Aws const char *SecretValue::MODEL_NAME = "aws.greengrass#SecretValue"; - Aws::Crt::String SecretValue::GetModelName() const noexcept { return SecretValue::MODEL_NAME; } + Aws::Crt::String SecretValue::GetModelName() const noexcept + { + return SecretValue::MODEL_NAME; + } Aws::Crt::ScopedResource SecretValue::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -2237,7 +2282,10 @@ namespace Aws const char *CredentialDocument::MODEL_NAME = "aws.greengrass#CredentialDocument"; - Aws::Crt::String CredentialDocument::GetModelName() const noexcept { return CredentialDocument::MODEL_NAME; } + Aws::Crt::String CredentialDocument::GetModelName() const noexcept + { + return CredentialDocument::MODEL_NAME; + } Aws::Crt::ScopedResource CredentialDocument::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -2333,7 +2381,10 @@ namespace Aws const char *ServiceError::MODEL_NAME = "aws.greengrass#ServiceError"; - Aws::Crt::String ServiceError::GetModelName() const noexcept { return ServiceError::MODEL_NAME; } + Aws::Crt::String ServiceError::GetModelName() const noexcept + { + return ServiceError::MODEL_NAME; + } Aws::Crt::ScopedResource ServiceError::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -2376,7 +2427,10 @@ namespace Aws const char *UnauthorizedError::MODEL_NAME = "aws.greengrass#UnauthorizedError"; - Aws::Crt::String UnauthorizedError::GetModelName() const noexcept { return UnauthorizedError::MODEL_NAME; } + Aws::Crt::String UnauthorizedError::GetModelName() const noexcept + { + return UnauthorizedError::MODEL_NAME; + } Aws::Crt::ScopedResource UnauthorizedError::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -2521,7 +2575,10 @@ namespace Aws const char *InvalidTokenError::MODEL_NAME = "aws.greengrass#InvalidTokenError"; - Aws::Crt::String InvalidTokenError::GetModelName() const noexcept { return InvalidTokenError::MODEL_NAME; } + Aws::Crt::String InvalidTokenError::GetModelName() const noexcept + { + return InvalidTokenError::MODEL_NAME; + } Aws::Crt::ScopedResource InvalidTokenError::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -2662,7 +2719,10 @@ namespace Aws const char *ConflictError::MODEL_NAME = "aws.greengrass#ConflictError"; - Aws::Crt::String ConflictError::GetModelName() const noexcept { return ConflictError::MODEL_NAME; } + Aws::Crt::String ConflictError::GetModelName() const noexcept + { + return ConflictError::MODEL_NAME; + } Aws::Crt::ScopedResource ConflictError::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -2888,7 +2948,10 @@ namespace Aws const char *UpdateStateResponse::MODEL_NAME = "aws.greengrass#UpdateStateResponse"; - Aws::Crt::String UpdateStateResponse::GetModelName() const noexcept { return UpdateStateResponse::MODEL_NAME; } + Aws::Crt::String UpdateStateResponse::GetModelName() const noexcept + { + return UpdateStateResponse::MODEL_NAME; + } Aws::Crt::ScopedResource UpdateStateResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -2962,7 +3025,10 @@ namespace Aws const char *UpdateStateRequest::MODEL_NAME = "aws.greengrass#UpdateStateRequest"; - Aws::Crt::String UpdateStateRequest::GetModelName() const noexcept { return UpdateStateRequest::MODEL_NAME; } + Aws::Crt::String UpdateStateRequest::GetModelName() const noexcept + { + return UpdateStateRequest::MODEL_NAME; + } Aws::Crt::ScopedResource UpdateStateRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -7211,9 +7277,9 @@ namespace Aws std::future SubscribeToConfigurationUpdateOperation::GetResult() noexcept { - return std::async(m_asyncLaunchMode, [this]() { - return SubscribeToConfigurationUpdateResult(GetOperationResult().get()); - }); + return std::async( + m_asyncLaunchMode, + [this]() { return SubscribeToConfigurationUpdateResult(GetOperationResult().get()); }); } SubscribeToConfigurationUpdateOperation::SubscribeToConfigurationUpdateOperation( @@ -7516,9 +7582,9 @@ namespace Aws std::future SubscribeToValidateConfigurationUpdatesOperation:: GetResult() noexcept { - return std::async(m_asyncLaunchMode, [this]() { - return SubscribeToValidateConfigurationUpdatesResult(GetOperationResult().get()); - }); + return std::async( + m_asyncLaunchMode, + [this]() { return SubscribeToValidateConfigurationUpdatesResult(GetOperationResult().get()); }); } SubscribeToValidateConfigurationUpdatesOperation::SubscribeToValidateConfigurationUpdatesOperation( @@ -8003,9 +8069,9 @@ namespace Aws std::future SubscribeToCertificateUpdatesOperation::GetResult() noexcept { - return std::async(m_asyncLaunchMode, [this]() { - return SubscribeToCertificateUpdatesResult(GetOperationResult().get()); - }); + return std::async( + m_asyncLaunchMode, + [this]() { return SubscribeToCertificateUpdatesResult(GetOperationResult().get()); }); } SubscribeToCertificateUpdatesOperation::SubscribeToCertificateUpdatesOperation( @@ -8418,9 +8484,9 @@ namespace Aws std::future SendConfigurationValidityReportOperation:: GetResult() noexcept { - return std::async(m_asyncLaunchMode, [this]() { - return SendConfigurationValidityReportResult(GetOperationResult().get()); - }); + return std::async( + m_asyncLaunchMode, + [this]() { return SendConfigurationValidityReportResult(GetOperationResult().get()); }); } SendConfigurationValidityReportOperation::SendConfigurationValidityReportOperation( diff --git a/identity/source/CreateKeysAndCertificateRequest.cpp b/identity/source/CreateKeysAndCertificateRequest.cpp index 6761a1f29..fa29f2d2b 100644 --- a/identity/source/CreateKeysAndCertificateRequest.cpp +++ b/identity/source/CreateKeysAndCertificateRequest.cpp @@ -18,7 +18,10 @@ namespace Aws (void)doc; } - void CreateKeysAndCertificateRequest::SerializeToObject(Aws::Crt::JsonObject &object) const { (void)object; } + void CreateKeysAndCertificateRequest::SerializeToObject(Aws::Crt::JsonObject &object) const + { + (void)object; + } CreateKeysAndCertificateRequest::CreateKeysAndCertificateRequest(const Crt::JsonView &doc) { diff --git a/identity/source/ErrorResponse.cpp b/identity/source/ErrorResponse.cpp index ac8d83742..f835e0555 100644 --- a/identity/source/ErrorResponse.cpp +++ b/identity/source/ErrorResponse.cpp @@ -51,7 +51,10 @@ namespace Aws } } - ErrorResponse::ErrorResponse(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + ErrorResponse::ErrorResponse(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } ErrorResponse &ErrorResponse::operator=(const Crt::JsonView &doc) { diff --git a/identity/source/IotIdentityClient.cpp b/identity/source/IotIdentityClient.cpp index 2b25fba33..f9aa762cd 100644 --- a/identity/source/IotIdentityClient.cpp +++ b/identity/source/IotIdentityClient.cpp @@ -31,9 +31,15 @@ namespace Aws m_connection = Aws::Crt::Mqtt::MqttConnection::NewConnectionFromMqtt5Client(mqtt5Client); } - IotIdentityClient::operator bool() const noexcept { return m_connection && *m_connection; } + IotIdentityClient::operator bool() const noexcept + { + return m_connection && *m_connection; + } - int IotIdentityClient::GetLastError() const noexcept { return aws_last_error(); } + int IotIdentityClient::GetLastError() const noexcept + { + return aws_last_error(); + } bool IotIdentityClient::SubscribeToCreateCertificateFromCsrAccepted( const Aws::Iotidentity::CreateCertificateFromCsrSubscriptionRequest &request, @@ -47,7 +53,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -61,13 +68,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotidentity::CreateCertificateFromCsrResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotidentity::CreateCertificateFromCsrResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -99,7 +106,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -113,13 +121,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotidentity::ErrorResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotidentity::ErrorResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -151,7 +159,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -165,13 +174,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotidentity::CreateKeysAndCertificateResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotidentity::CreateKeysAndCertificateResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -203,7 +212,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -217,13 +227,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotidentity::ErrorResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotidentity::ErrorResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -255,7 +265,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -269,13 +280,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotidentity::RegisterThingResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotidentity::RegisterThingResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -307,7 +318,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -321,13 +333,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotidentity::ErrorResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotidentity::ErrorResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -367,7 +379,8 @@ namespace Aws Aws::Crt::ByteBuf buf = Aws::Crt::ByteBufNewCopy( Aws::Crt::g_allocator, reinterpret_cast(outgoingJson.data()), outgoingJson.length()); - auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) { + auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) + { onPubAck(errorCode); Aws::Crt::ByteBufDelete(const_cast(buf)); }; @@ -396,7 +409,8 @@ namespace Aws Aws::Crt::ByteBuf buf = Aws::Crt::ByteBufNewCopy( Aws::Crt::g_allocator, reinterpret_cast(outgoingJson.data()), outgoingJson.length()); - auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) { + auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) + { onPubAck(errorCode); Aws::Crt::ByteBufDelete(const_cast(buf)); }; @@ -425,7 +439,8 @@ namespace Aws Aws::Crt::ByteBuf buf = Aws::Crt::ByteBufNewCopy( Aws::Crt::g_allocator, reinterpret_cast(outgoingJson.data()), outgoingJson.length()); - auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) { + auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) + { onPubAck(errorCode); Aws::Crt::ByteBufDelete(const_cast(buf)); }; diff --git a/identity/source/RegisterThingRequest.cpp b/identity/source/RegisterThingRequest.cpp index 981aa7550..130b823ce 100644 --- a/identity/source/RegisterThingRequest.cpp +++ b/identity/source/RegisterThingRequest.cpp @@ -55,7 +55,10 @@ namespace Aws } } - RegisterThingRequest::RegisterThingRequest(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + RegisterThingRequest::RegisterThingRequest(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } RegisterThingRequest &RegisterThingRequest::operator=(const Crt::JsonView &doc) { diff --git a/identity/source/RegisterThingResponse.cpp b/identity/source/RegisterThingResponse.cpp index 180d5d92d..ca7ebbb61 100644 --- a/identity/source/RegisterThingResponse.cpp +++ b/identity/source/RegisterThingResponse.cpp @@ -57,7 +57,10 @@ namespace Aws } } - RegisterThingResponse::RegisterThingResponse(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + RegisterThingResponse::RegisterThingResponse(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } RegisterThingResponse &RegisterThingResponse::operator=(const Crt::JsonView &doc) { diff --git a/identity/source/RegisterThingSubscriptionRequest.cpp b/identity/source/RegisterThingSubscriptionRequest.cpp index 67f10f152..21d601ea0 100644 --- a/identity/source/RegisterThingSubscriptionRequest.cpp +++ b/identity/source/RegisterThingSubscriptionRequest.cpp @@ -18,7 +18,10 @@ namespace Aws (void)doc; } - void RegisterThingSubscriptionRequest::SerializeToObject(Aws::Crt::JsonObject &object) const { (void)object; } + void RegisterThingSubscriptionRequest::SerializeToObject(Aws::Crt::JsonObject &object) const + { + (void)object; + } RegisterThingSubscriptionRequest::RegisterThingSubscriptionRequest(const Crt::JsonView &doc) { diff --git a/iotdevicecommon/source/IotDevice.cpp b/iotdevicecommon/source/IotDevice.cpp index 72ad6d071..30b2de2bf 100644 --- a/iotdevicecommon/source/IotDevice.cpp +++ b/iotdevicecommon/source/IotDevice.cpp @@ -17,9 +17,15 @@ namespace Aws namespace Iotdevicecommon { - DeviceApiHandle::DeviceApiHandle(Crt::Allocator *allocator) noexcept { aws_iotdevice_library_init(allocator); } - - DeviceApiHandle::~DeviceApiHandle() { aws_iotdevice_library_clean_up(); } + DeviceApiHandle::DeviceApiHandle(Crt::Allocator *allocator) noexcept + { + aws_iotdevice_library_init(allocator); + } + + DeviceApiHandle::~DeviceApiHandle() + { + aws_iotdevice_library_clean_up(); + } } // namespace Iotdevicecommon } // namespace Aws diff --git a/jobs/include/aws/iotjobs/JobStatus.h b/jobs/include/aws/iotjobs/JobStatus.h index 7655b5f30..0fa69859e 100644 --- a/jobs/include/aws/iotjobs/JobStatus.h +++ b/jobs/include/aws/iotjobs/JobStatus.h @@ -61,5 +61,5 @@ namespace Aws AWS_IOTJOBS_API const char *ToString(JobStatus val); AWS_IOTJOBS_API JobStatus FromString(const Aws::Crt::String &val); } // namespace JobStatusMarshaller - } // namespace Iotjobs + } // namespace Iotjobs } // namespace Aws diff --git a/jobs/include/aws/iotjobs/RejectedErrorCode.h b/jobs/include/aws/iotjobs/RejectedErrorCode.h index 83228c402..1fc115c76 100644 --- a/jobs/include/aws/iotjobs/RejectedErrorCode.h +++ b/jobs/include/aws/iotjobs/RejectedErrorCode.h @@ -76,5 +76,5 @@ namespace Aws AWS_IOTJOBS_API const char *ToString(RejectedErrorCode val); AWS_IOTJOBS_API RejectedErrorCode FromString(const Aws::Crt::String &val); } // namespace RejectedErrorCodeMarshaller - } // namespace Iotjobs + } // namespace Iotjobs } // namespace Aws diff --git a/jobs/source/IotJobsClient.cpp b/jobs/source/IotJobsClient.cpp index c0cb1cf0c..1443c8245 100644 --- a/jobs/source/IotJobsClient.cpp +++ b/jobs/source/IotJobsClient.cpp @@ -38,9 +38,15 @@ namespace Aws m_connection = Aws::Crt::Mqtt::MqttConnection::NewConnectionFromMqtt5Client(mqtt5Client); } - IotJobsClient::operator bool() const noexcept { return m_connection && *m_connection; } + IotJobsClient::operator bool() const noexcept + { + return m_connection && *m_connection; + } - int IotJobsClient::GetLastError() const noexcept { return aws_last_error(); } + int IotJobsClient::GetLastError() const noexcept + { + return aws_last_error(); + } bool IotJobsClient::SubscribeToDescribeJobExecutionAccepted( const Aws::Iotjobs::DescribeJobExecutionSubscriptionRequest &request, @@ -54,7 +60,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -68,13 +75,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotjobs::DescribeJobExecutionResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotjobs::DescribeJobExecutionResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -106,7 +113,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -120,13 +128,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotjobs::RejectedError response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotjobs::RejectedError response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -158,7 +166,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -172,13 +181,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotjobs::GetPendingJobExecutionsResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotjobs::GetPendingJobExecutionsResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -210,7 +219,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -224,13 +234,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotjobs::RejectedError response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotjobs::RejectedError response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -262,7 +272,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -276,13 +287,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotjobs::JobExecutionsChangedEvent response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotjobs::JobExecutionsChangedEvent response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -312,7 +323,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -326,13 +338,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotjobs::NextJobExecutionChangedEvent response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotjobs::NextJobExecutionChangedEvent response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -362,7 +374,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -376,13 +389,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotjobs::StartNextJobExecutionResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotjobs::StartNextJobExecutionResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -414,7 +427,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -428,13 +442,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotjobs::RejectedError response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotjobs::RejectedError response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -466,7 +480,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -480,13 +495,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotjobs::UpdateJobExecutionResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotjobs::UpdateJobExecutionResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -518,7 +533,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -532,13 +548,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotjobs::RejectedError response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotjobs::RejectedError response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -578,7 +594,8 @@ namespace Aws Aws::Crt::ByteBuf buf = Aws::Crt::ByteBufNewCopy( Aws::Crt::g_allocator, reinterpret_cast(outgoingJson.data()), outgoingJson.length()); - auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) { + auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) + { onPubAck(errorCode); Aws::Crt::ByteBufDelete(const_cast(buf)); }; @@ -607,7 +624,8 @@ namespace Aws Aws::Crt::ByteBuf buf = Aws::Crt::ByteBufNewCopy( Aws::Crt::g_allocator, reinterpret_cast(outgoingJson.data()), outgoingJson.length()); - auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) { + auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) + { onPubAck(errorCode); Aws::Crt::ByteBufDelete(const_cast(buf)); }; @@ -636,7 +654,8 @@ namespace Aws Aws::Crt::ByteBuf buf = Aws::Crt::ByteBufNewCopy( Aws::Crt::g_allocator, reinterpret_cast(outgoingJson.data()), outgoingJson.length()); - auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) { + auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) + { onPubAck(errorCode); Aws::Crt::ByteBufDelete(const_cast(buf)); }; @@ -665,7 +684,8 @@ namespace Aws Aws::Crt::ByteBuf buf = Aws::Crt::ByteBufNewCopy( Aws::Crt::g_allocator, reinterpret_cast(outgoingJson.data()), outgoingJson.length()); - auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) { + auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) + { onPubAck(errorCode); Aws::Crt::ByteBufDelete(const_cast(buf)); }; diff --git a/jobs/source/JobExecutionData.cpp b/jobs/source/JobExecutionData.cpp index 9e39e0f14..4dba0a662 100644 --- a/jobs/source/JobExecutionData.cpp +++ b/jobs/source/JobExecutionData.cpp @@ -132,7 +132,10 @@ namespace Aws } } - JobExecutionData::JobExecutionData(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + JobExecutionData::JobExecutionData(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } JobExecutionData &JobExecutionData::operator=(const Crt::JsonView &doc) { diff --git a/jobs/source/JobExecutionState.cpp b/jobs/source/JobExecutionState.cpp index 3a25e08c8..641244c98 100644 --- a/jobs/source/JobExecutionState.cpp +++ b/jobs/source/JobExecutionState.cpp @@ -65,7 +65,10 @@ namespace Aws } } - JobExecutionState::JobExecutionState(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + JobExecutionState::JobExecutionState(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } JobExecutionState &JobExecutionState::operator=(const Crt::JsonView &doc) { diff --git a/jobs/source/JobExecutionSummary.cpp b/jobs/source/JobExecutionSummary.cpp index 1f7936e69..4181e9c4e 100644 --- a/jobs/source/JobExecutionSummary.cpp +++ b/jobs/source/JobExecutionSummary.cpp @@ -81,7 +81,10 @@ namespace Aws } } - JobExecutionSummary::JobExecutionSummary(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + JobExecutionSummary::JobExecutionSummary(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } JobExecutionSummary &JobExecutionSummary::operator=(const Crt::JsonView &doc) { diff --git a/jobs/source/JobExecutionsChangedEvent.cpp b/jobs/source/JobExecutionsChangedEvent.cpp index d8e1f0684..0b82e095d 100644 --- a/jobs/source/JobExecutionsChangedEvent.cpp +++ b/jobs/source/JobExecutionsChangedEvent.cpp @@ -73,7 +73,10 @@ namespace Aws } } - JobExecutionsChangedEvent::JobExecutionsChangedEvent(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + JobExecutionsChangedEvent::JobExecutionsChangedEvent(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } JobExecutionsChangedEvent &JobExecutionsChangedEvent::operator=(const Crt::JsonView &doc) { diff --git a/jobs/source/JobStatus.cpp b/jobs/source/JobStatus.cpp index 06169d17f..1b7603bb2 100644 --- a/jobs/source/JobStatus.cpp +++ b/jobs/source/JobStatus.cpp @@ -100,5 +100,5 @@ namespace Aws return static_cast(-1); } } // namespace JobStatusMarshaller - } // namespace Iotjobs + } // namespace Iotjobs } // namespace Aws diff --git a/jobs/source/RejectedError.cpp b/jobs/source/RejectedError.cpp index 00c2cd188..a487d7f35 100644 --- a/jobs/source/RejectedError.cpp +++ b/jobs/source/RejectedError.cpp @@ -73,7 +73,10 @@ namespace Aws } } - RejectedError::RejectedError(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + RejectedError::RejectedError(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } RejectedError &RejectedError::operator=(const Crt::JsonView &doc) { diff --git a/jobs/source/RejectedErrorCode.cpp b/jobs/source/RejectedErrorCode.cpp index 4e792a57c..d1fe072bc 100644 --- a/jobs/source/RejectedErrorCode.cpp +++ b/jobs/source/RejectedErrorCode.cpp @@ -108,5 +108,5 @@ namespace Aws return static_cast(-1); } } // namespace RejectedErrorCodeMarshaller - } // namespace Iotjobs + } // namespace Iotjobs } // namespace Aws diff --git a/jobs/source/UpdateJobExecutionRequest.cpp b/jobs/source/UpdateJobExecutionRequest.cpp index 8ac18844d..19f250897 100644 --- a/jobs/source/UpdateJobExecutionRequest.cpp +++ b/jobs/source/UpdateJobExecutionRequest.cpp @@ -115,7 +115,10 @@ namespace Aws } } - UpdateJobExecutionRequest::UpdateJobExecutionRequest(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + UpdateJobExecutionRequest::UpdateJobExecutionRequest(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } UpdateJobExecutionRequest &UpdateJobExecutionRequest::operator=(const Crt::JsonView &doc) { diff --git a/jobs/source/UpdateJobExecutionResponse.cpp b/jobs/source/UpdateJobExecutionResponse.cpp index d6a919924..43b66ec6d 100644 --- a/jobs/source/UpdateJobExecutionResponse.cpp +++ b/jobs/source/UpdateJobExecutionResponse.cpp @@ -63,7 +63,10 @@ namespace Aws } } - UpdateJobExecutionResponse::UpdateJobExecutionResponse(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + UpdateJobExecutionResponse::UpdateJobExecutionResponse(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } UpdateJobExecutionResponse &UpdateJobExecutionResponse::operator=(const Crt::JsonView &doc) { diff --git a/secure_tunneling/source/IotSecureTunnelingClient.cpp b/secure_tunneling/source/IotSecureTunnelingClient.cpp index ec569de27..303294511 100644 --- a/secure_tunneling/source/IotSecureTunnelingClient.cpp +++ b/secure_tunneling/source/IotSecureTunnelingClient.cpp @@ -29,9 +29,15 @@ namespace Aws { } - IotSecureTunnelingClient::operator bool() const noexcept { return m_connection && *m_connection; } + IotSecureTunnelingClient::operator bool() const noexcept + { + return m_connection && *m_connection; + } - int IotSecureTunnelingClient::GetLastError() const noexcept { return aws_last_error(); } + int IotSecureTunnelingClient::GetLastError() const noexcept + { + return aws_last_error(); + } bool IotSecureTunnelingClient::SubscribeToTunnelsNotify( const Aws::Iotsecuretunneling::SubscribeToTunnelsNotifyRequest &request, @@ -45,7 +51,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -59,13 +66,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotsecuretunneling::SecureTunnelingNotifyResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotsecuretunneling::SecureTunnelingNotifyResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" diff --git a/secure_tunneling/source/SecureTunnel.cpp b/secure_tunneling/source/SecureTunnel.cpp index d2101bc94..c5f02267d 100644 --- a/secure_tunneling/source/SecureTunnel.cpp +++ b/secure_tunneling/source/SecureTunnel.cpp @@ -164,11 +164,20 @@ namespace Aws return true; } - const Crt::Optional &Message::getPayload() const noexcept { return m_payload; } + const Crt::Optional &Message::getPayload() const noexcept + { + return m_payload; + } - const Crt::Optional &Message::getServiceId() const noexcept { return m_serviceId; } + const Crt::Optional &Message::getServiceId() const noexcept + { + return m_serviceId; + } - const uint32_t &Message::getConnectionId() const noexcept { return m_connectionId; } + const uint32_t &Message::getConnectionId() const noexcept + { + return m_connectionId; + } Message::~Message() { @@ -193,9 +202,15 @@ namespace Aws m_messageType = aws_byte_cursor_from_buf(&m_messageTypeStorage); } - const Crt::ByteCursor &SendMessageCompleteData::getMessageType() const noexcept { return m_messageType; } + const Crt::ByteCursor &SendMessageCompleteData::getMessageType() const noexcept + { + return m_messageType; + } - SendMessageCompleteData::~SendMessageCompleteData() { aws_byte_buf_clean_up(&m_messageTypeStorage); } + SendMessageCompleteData::~SendMessageCompleteData() + { + aws_byte_buf_clean_up(&m_messageTypeStorage); + } //*********************************************************************************************************************** /* ConnectionData */ @@ -215,9 +230,18 @@ namespace Aws setPacketByteBufOptional(m_serviceId3, m_serviceId3Storage, m_allocator, connection.service_id_3); } - const Crt::Optional &ConnectionData::getServiceId1() const noexcept { return m_serviceId1; } - const Crt::Optional &ConnectionData::getServiceId2() const noexcept { return m_serviceId2; } - const Crt::Optional &ConnectionData::getServiceId3() const noexcept { return m_serviceId3; } + const Crt::Optional &ConnectionData::getServiceId1() const noexcept + { + return m_serviceId1; + } + const Crt::Optional &ConnectionData::getServiceId2() const noexcept + { + return m_serviceId2; + } + const Crt::Optional &ConnectionData::getServiceId3() const noexcept + { + return m_serviceId3; + } ConnectionData::~ConnectionData() { @@ -241,11 +265,20 @@ namespace Aws m_connectionId = message.connection_id; } - const Crt::Optional &StreamStartedData::getServiceId() const noexcept { return m_serviceId; } + const Crt::Optional &StreamStartedData::getServiceId() const noexcept + { + return m_serviceId; + } - const uint32_t &StreamStartedData::getConnectionId() const noexcept { return m_connectionId; } + const uint32_t &StreamStartedData::getConnectionId() const noexcept + { + return m_connectionId; + } - StreamStartedData::~StreamStartedData() { aws_byte_buf_clean_up(&m_serviceIdStorage); } + StreamStartedData::~StreamStartedData() + { + aws_byte_buf_clean_up(&m_serviceIdStorage); + } //*********************************************************************************************************************** /* StreamStoppedData */ @@ -261,9 +294,15 @@ namespace Aws setPacketByteBufOptional(m_serviceId, m_serviceIdStorage, m_allocator, message.service_id); } - const Crt::Optional &StreamStoppedData::getServiceId() const noexcept { return m_serviceId; } + const Crt::Optional &StreamStoppedData::getServiceId() const noexcept + { + return m_serviceId; + } - StreamStoppedData::~StreamStoppedData() { aws_byte_buf_clean_up(&m_serviceIdStorage); } + StreamStoppedData::~StreamStoppedData() + { + aws_byte_buf_clean_up(&m_serviceIdStorage); + } //*********************************************************************************************************************** /* ConnectionStartedData */ @@ -285,9 +324,15 @@ namespace Aws return m_serviceId; } - const uint32_t &ConnectionStartedData::getConnectionId() const noexcept { return m_connectionId; } + const uint32_t &ConnectionStartedData::getConnectionId() const noexcept + { + return m_connectionId; + } - ConnectionStartedData::~ConnectionStartedData() { aws_byte_buf_clean_up(&m_serviceIdStorage); } + ConnectionStartedData::~ConnectionStartedData() + { + aws_byte_buf_clean_up(&m_serviceIdStorage); + } //*********************************************************************************************************************** /* ConnectionResetData */ @@ -304,11 +349,20 @@ namespace Aws m_connectionId = message.connection_id; } - const Crt::Optional &ConnectionResetData::getServiceId() const noexcept { return m_serviceId; } + const Crt::Optional &ConnectionResetData::getServiceId() const noexcept + { + return m_serviceId; + } - const uint32_t &ConnectionResetData::getConnectionId() const noexcept { return m_connectionId; } + const uint32_t &ConnectionResetData::getConnectionId() const noexcept + { + return m_connectionId; + } - ConnectionResetData::~ConnectionResetData() { aws_byte_buf_clean_up(&m_serviceIdStorage); } + ConnectionResetData::~ConnectionResetData() + { + aws_byte_buf_clean_up(&m_serviceIdStorage); + } //*********************************************************************************************************************** /* SecureTunnelBuilder */ @@ -786,7 +840,10 @@ namespace Aws return *this; } - bool SecureTunnel::IsValid() { return m_secure_tunnel ? true : false; } + bool SecureTunnel::IsValid() + { + return m_secure_tunnel ? true : false; + } int SecureTunnel::Start() { @@ -797,13 +854,22 @@ namespace Aws return aws_secure_tunnel_start(m_secure_tunnel); } - int SecureTunnel::Stop() { return aws_secure_tunnel_stop(m_secure_tunnel); } + int SecureTunnel::Stop() + { + return aws_secure_tunnel_stop(m_secure_tunnel); + } /* Deprecated - Use Start() */ - int SecureTunnel::Connect() { return Start(); } + int SecureTunnel::Connect() + { + return Start(); + } /* Deprecated - Use Stop() */ - int SecureTunnel::Close() { return Stop(); } + int SecureTunnel::Close() + { + return Stop(); + } /* Deprecated - Use SendMessage() */ int SecureTunnel::SendData(const Crt::ByteCursor &data) @@ -825,9 +891,18 @@ namespace Aws return aws_secure_tunnel_send_message(m_secure_tunnel, &message); } - int SecureTunnel::SendStreamStart() { return SendStreamStart(""); } - int SecureTunnel::SendStreamStart(std::string serviceId) { return SendStreamStart(serviceId, 0); } - int SecureTunnel::SendStreamStart(Crt::ByteCursor serviceId) { return SendStreamStart(serviceId, 0); } + int SecureTunnel::SendStreamStart() + { + return SendStreamStart(""); + } + int SecureTunnel::SendStreamStart(std::string serviceId) + { + return SendStreamStart(serviceId, 0); + } + int SecureTunnel::SendStreamStart(Crt::ByteCursor serviceId) + { + return SendStreamStart(serviceId, 0); + } int SecureTunnel::SendStreamStart(std::string serviceId, uint32_t connectionId) { struct aws_byte_cursor service_id_cur; @@ -851,7 +926,10 @@ namespace Aws return aws_secure_tunnel_stream_start(m_secure_tunnel, &messageView); } - int SecureTunnel::SendConnectionStart(uint32_t connectionId) { return SendConnectionStart("", connectionId); } + int SecureTunnel::SendConnectionStart(uint32_t connectionId) + { + return SendConnectionStart("", connectionId); + } int SecureTunnel::SendConnectionStart(std::string serviceId, uint32_t connectionId) { @@ -873,9 +951,15 @@ namespace Aws return aws_secure_tunnel_connection_start(m_secure_tunnel, &messageView); } - int SecureTunnel::SendStreamReset() { return aws_secure_tunnel_stream_reset(m_secure_tunnel, NULL); } + int SecureTunnel::SendStreamReset() + { + return aws_secure_tunnel_stream_reset(m_secure_tunnel, NULL); + } - aws_secure_tunnel *SecureTunnel::GetUnderlyingHandle() { return m_secure_tunnel; } + aws_secure_tunnel *SecureTunnel::GetUnderlyingHandle() + { + return m_secure_tunnel; + } void SecureTunnel::s_OnConnectionComplete( const struct aws_secure_tunnel_connection_view *connection, @@ -1097,6 +1181,9 @@ namespace Aws } } - void SecureTunnel::Shutdown() { Stop(); } + void SecureTunnel::Shutdown() + { + Stop(); + } } // namespace Iotsecuretunneling } // namespace Aws diff --git a/secure_tunneling/source/SubscribeToTunnelsNotifyRequest.cpp b/secure_tunneling/source/SubscribeToTunnelsNotifyRequest.cpp index 62c9608c9..011a83de1 100644 --- a/secure_tunneling/source/SubscribeToTunnelsNotifyRequest.cpp +++ b/secure_tunneling/source/SubscribeToTunnelsNotifyRequest.cpp @@ -28,7 +28,10 @@ namespace Aws (void)doc; } - void SubscribeToTunnelsNotifyRequest::SerializeToObject(Aws::Crt::JsonObject &object) const { (void)object; } + void SubscribeToTunnelsNotifyRequest::SerializeToObject(Aws::Crt::JsonObject &object) const + { + (void)object; + } SubscribeToTunnelsNotifyRequest::SubscribeToTunnelsNotifyRequest(const Crt::JsonView &doc) { diff --git a/secure_tunneling/tests/main.cpp b/secure_tunneling/tests/main.cpp index bd6606e19..93427786d 100644 --- a/secure_tunneling/tests/main.cpp +++ b/secure_tunneling/tests/main.cpp @@ -99,7 +99,8 @@ int main(int argc, char *argv[]) } builderDestination.WithOnMessageReceived( - [&](SecureTunnel *secureTunnel, const MessageReceivedEventData &eventData) { + [&](SecureTunnel *secureTunnel, const MessageReceivedEventData &eventData) + { { (void)secureTunnel; (void)eventData; @@ -108,17 +109,20 @@ int main(int argc, char *argv[]) } }); - builderSource.WithOnMessageReceived([&](SecureTunnel *secureTunnel, const MessageReceivedEventData &eventData) { + builderSource.WithOnMessageReceived( + [&](SecureTunnel *secureTunnel, const MessageReceivedEventData &eventData) { - (void)secureTunnel; - (void)eventData; - fprintf(stdout, "Source Client Received Message\n"); - promiseSourceReceivedMessage.set_value(); - } - }); + { + (void)secureTunnel; + (void)eventData; + fprintf(stdout, "Source Client Received Message\n"); + promiseSourceReceivedMessage.set_value(); + } + }); builderDestination.WithOnSendMessageComplete( - [&](SecureTunnel *secureTunnel, int errorCode, const SendMessageCompleteEventData &eventData) { + [&](SecureTunnel *secureTunnel, int errorCode, const SendMessageCompleteEventData &eventData) + { (void)secureTunnel; (void)eventData; @@ -138,7 +142,8 @@ int main(int argc, char *argv[]) }); builderSource.WithOnSendMessageComplete( - [&](SecureTunnel *secureTunnel, int errorCode, const SendMessageCompleteEventData &eventData) { + [&](SecureTunnel *secureTunnel, int errorCode, const SendMessageCompleteEventData &eventData) + { (void)secureTunnel; (void)eventData; @@ -158,42 +163,46 @@ int main(int argc, char *argv[]) }); builderDestination.WithOnConnectionSuccess( - [&](SecureTunnel *secureTunnel, const ConnectionSuccessEventData &eventData) { + [&](SecureTunnel *secureTunnel, const ConnectionSuccessEventData &eventData) + { (void)secureTunnel; (void)eventData; fprintf(stdout, "Destination Client Connection Success\n"); promiseDestinationConnected.set_value(); }); - builderSource.WithOnConnectionSuccess([&](SecureTunnel *secureTunnel, const ConnectionSuccessEventData &eventData) { - (void)secureTunnel; - (void)eventData; + builderSource.WithOnConnectionSuccess( + [&](SecureTunnel *secureTunnel, const ConnectionSuccessEventData &eventData) + { + (void)secureTunnel; + (void)eventData; - fprintf(stdout, "Source Client Connection Success\n"); + fprintf(stdout, "Source Client Connection Success\n"); - /* Use a Multiplexing (Service Id) if available on this Secure Tunnel */ - if (eventData.connectionData->getServiceId1().has_value()) - { - /* Store the service id for future use */ - aws_byte_buf_clean_up(&m_serviceIdStorage); - AWS_ZERO_STRUCT(m_serviceIdStorage); - aws_byte_buf_init_copy_from_cursor( - &m_serviceIdStorage, allocator, eventData.connectionData->getServiceId1().value()); - m_serviceId = aws_byte_cursor_from_buf(&m_serviceIdStorage); - secureTunnel->SendStreamStart(m_serviceId.value(), connectionId); - fprintf(stdout, "Stream Start sent from Source Client.\n"); - } - else - { - fprintf(stdout, "Secure Tunnel should have service ids set for proper testing\n"); - exit(-1); - } + /* Use a Multiplexing (Service Id) if available on this Secure Tunnel */ + if (eventData.connectionData->getServiceId1().has_value()) + { + /* Store the service id for future use */ + aws_byte_buf_clean_up(&m_serviceIdStorage); + AWS_ZERO_STRUCT(m_serviceIdStorage); + aws_byte_buf_init_copy_from_cursor( + &m_serviceIdStorage, allocator, eventData.connectionData->getServiceId1().value()); + m_serviceId = aws_byte_cursor_from_buf(&m_serviceIdStorage); + secureTunnel->SendStreamStart(m_serviceId.value(), connectionId); + fprintf(stdout, "Stream Start sent from Source Client.\n"); + } + else + { + fprintf(stdout, "Secure Tunnel should have service ids set for proper testing\n"); + exit(-1); + } - promiseSourceConnected.set_value(); - }); + promiseSourceConnected.set_value(); + }); builderDestination.WithOnStreamStarted( - [&](SecureTunnel *secureTunnel, int errorCode, const StreamStartedEventData &eventData) { + [&](SecureTunnel *secureTunnel, int errorCode, const StreamStartedEventData &eventData) + { (void)secureTunnel; (void)eventData; if (!errorCode) @@ -209,39 +218,44 @@ int main(int argc, char *argv[]) } }); - builderDestination.WithOnConnectionStarted([&](SecureTunnel *secureTunnel, - int errorCode, - const ConnectionStartedEventData &eventData) { - (void)secureTunnel; - (void)eventData; - if (!errorCode) - { - fprintf(stdout, "Connection Started on Destination Client.\n"); - promiseDestinationConnectionStarted.set_value(); - } - else + builderDestination.WithOnConnectionStarted( + [&](SecureTunnel *secureTunnel, int errorCode, const ConnectionStartedEventData &eventData) { - fprintf(stdout, "Connection Start failed with error code %d(%s)\n", errorCode, ErrorDebugString(errorCode)); - aws_byte_buf_clean_up(&m_serviceIdStorage); - exit(-1); - } - }); + (void)secureTunnel; + (void)eventData; + if (!errorCode) + { + fprintf(stdout, "Connection Started on Destination Client.\n"); + promiseDestinationConnectionStarted.set_value(); + } + else + { + fprintf( + stdout, "Connection Start failed with error code %d(%s)\n", errorCode, ErrorDebugString(errorCode)); + aws_byte_buf_clean_up(&m_serviceIdStorage); + exit(-1); + } + }); builderDestination.WithOnConnectionShutdown([&]() { fprintf(stdout, "Destination Connection Shutdown\n"); }); builderSource.WithOnConnectionShutdown([&]() { fprintf(stdout, "Source Connection Shutdown\n"); }); - builderDestination.WithOnStopped([&](SecureTunnel *secureTunnel) { - (void)secureTunnel; - fprintf(stdout, "Destination entered Stopped State\n"); - promiseDestinationStopped.set_value(); - }); - - builderSource.WithOnStopped([&](SecureTunnel *secureTunnel) { - (void)secureTunnel; - fprintf(stdout, "Source has entered Stopped State\n"); - promiseSourceStopped.set_value(); - }); + builderDestination.WithOnStopped( + [&](SecureTunnel *secureTunnel) + { + (void)secureTunnel; + fprintf(stdout, "Destination entered Stopped State\n"); + promiseDestinationStopped.set_value(); + }); + + builderSource.WithOnStopped( + [&](SecureTunnel *secureTunnel) + { + (void)secureTunnel; + fprintf(stdout, "Source has entered Stopped State\n"); + promiseSourceStopped.set_value(); + }); /* Create Secure Tunnel using the options set with the builder */ std::shared_ptr secureTunnelDestination = builderDestination.Build(); diff --git a/shadow/source/DeleteNamedShadowRequest.cpp b/shadow/source/DeleteNamedShadowRequest.cpp index e663bb16d..16da220b0 100644 --- a/shadow/source/DeleteNamedShadowRequest.cpp +++ b/shadow/source/DeleteNamedShadowRequest.cpp @@ -31,7 +31,10 @@ namespace Aws } } - DeleteNamedShadowRequest::DeleteNamedShadowRequest(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + DeleteNamedShadowRequest::DeleteNamedShadowRequest(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } DeleteNamedShadowRequest &DeleteNamedShadowRequest::operator=(const Crt::JsonView &doc) { diff --git a/shadow/source/DeleteShadowRequest.cpp b/shadow/source/DeleteShadowRequest.cpp index a5f7fa74c..f602bb78a 100644 --- a/shadow/source/DeleteShadowRequest.cpp +++ b/shadow/source/DeleteShadowRequest.cpp @@ -31,7 +31,10 @@ namespace Aws } } - DeleteShadowRequest::DeleteShadowRequest(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + DeleteShadowRequest::DeleteShadowRequest(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } DeleteShadowRequest &DeleteShadowRequest::operator=(const Crt::JsonView &doc) { diff --git a/shadow/source/DeleteShadowResponse.cpp b/shadow/source/DeleteShadowResponse.cpp index 6e46fd6e2..5aa22864e 100644 --- a/shadow/source/DeleteShadowResponse.cpp +++ b/shadow/source/DeleteShadowResponse.cpp @@ -51,7 +51,10 @@ namespace Aws } } - DeleteShadowResponse::DeleteShadowResponse(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + DeleteShadowResponse::DeleteShadowResponse(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } DeleteShadowResponse &DeleteShadowResponse::operator=(const Crt::JsonView &doc) { diff --git a/shadow/source/DeleteShadowSubscriptionRequest.cpp b/shadow/source/DeleteShadowSubscriptionRequest.cpp index 59dc03eb3..3f91cb255 100644 --- a/shadow/source/DeleteShadowSubscriptionRequest.cpp +++ b/shadow/source/DeleteShadowSubscriptionRequest.cpp @@ -18,7 +18,10 @@ namespace Aws (void)doc; } - void DeleteShadowSubscriptionRequest::SerializeToObject(Aws::Crt::JsonObject &object) const { (void)object; } + void DeleteShadowSubscriptionRequest::SerializeToObject(Aws::Crt::JsonObject &object) const + { + (void)object; + } DeleteShadowSubscriptionRequest::DeleteShadowSubscriptionRequest(const Crt::JsonView &doc) { diff --git a/shadow/source/ErrorResponse.cpp b/shadow/source/ErrorResponse.cpp index c501b2b22..bf782bb69 100644 --- a/shadow/source/ErrorResponse.cpp +++ b/shadow/source/ErrorResponse.cpp @@ -61,7 +61,10 @@ namespace Aws } } - ErrorResponse::ErrorResponse(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + ErrorResponse::ErrorResponse(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } ErrorResponse &ErrorResponse::operator=(const Crt::JsonView &doc) { diff --git a/shadow/source/GetNamedShadowRequest.cpp b/shadow/source/GetNamedShadowRequest.cpp index b3c87a3d0..3a9383768 100644 --- a/shadow/source/GetNamedShadowRequest.cpp +++ b/shadow/source/GetNamedShadowRequest.cpp @@ -31,7 +31,10 @@ namespace Aws } } - GetNamedShadowRequest::GetNamedShadowRequest(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + GetNamedShadowRequest::GetNamedShadowRequest(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } GetNamedShadowRequest &GetNamedShadowRequest::operator=(const Crt::JsonView &doc) { diff --git a/shadow/source/GetNamedShadowSubscriptionRequest.cpp b/shadow/source/GetNamedShadowSubscriptionRequest.cpp index 19c80b2cd..38f7c3689 100644 --- a/shadow/source/GetNamedShadowSubscriptionRequest.cpp +++ b/shadow/source/GetNamedShadowSubscriptionRequest.cpp @@ -18,7 +18,10 @@ namespace Aws (void)doc; } - void GetNamedShadowSubscriptionRequest::SerializeToObject(Aws::Crt::JsonObject &object) const { (void)object; } + void GetNamedShadowSubscriptionRequest::SerializeToObject(Aws::Crt::JsonObject &object) const + { + (void)object; + } GetNamedShadowSubscriptionRequest::GetNamedShadowSubscriptionRequest(const Crt::JsonView &doc) { diff --git a/shadow/source/GetShadowRequest.cpp b/shadow/source/GetShadowRequest.cpp index 021666594..0250b1b8d 100644 --- a/shadow/source/GetShadowRequest.cpp +++ b/shadow/source/GetShadowRequest.cpp @@ -31,7 +31,10 @@ namespace Aws } } - GetShadowRequest::GetShadowRequest(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + GetShadowRequest::GetShadowRequest(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } GetShadowRequest &GetShadowRequest::operator=(const Crt::JsonView &doc) { diff --git a/shadow/source/GetShadowResponse.cpp b/shadow/source/GetShadowResponse.cpp index 17330d27a..2275c1e81 100644 --- a/shadow/source/GetShadowResponse.cpp +++ b/shadow/source/GetShadowResponse.cpp @@ -75,7 +75,10 @@ namespace Aws } } - GetShadowResponse::GetShadowResponse(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + GetShadowResponse::GetShadowResponse(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } GetShadowResponse &GetShadowResponse::operator=(const Crt::JsonView &doc) { diff --git a/shadow/source/GetShadowSubscriptionRequest.cpp b/shadow/source/GetShadowSubscriptionRequest.cpp index 50398d135..2007e3b00 100644 --- a/shadow/source/GetShadowSubscriptionRequest.cpp +++ b/shadow/source/GetShadowSubscriptionRequest.cpp @@ -18,7 +18,10 @@ namespace Aws (void)doc; } - void GetShadowSubscriptionRequest::SerializeToObject(Aws::Crt::JsonObject &object) const { (void)object; } + void GetShadowSubscriptionRequest::SerializeToObject(Aws::Crt::JsonObject &object) const + { + (void)object; + } GetShadowSubscriptionRequest::GetShadowSubscriptionRequest(const Crt::JsonView &doc) { diff --git a/shadow/source/IotShadowClient.cpp b/shadow/source/IotShadowClient.cpp index b9bac21a9..e700d6445 100644 --- a/shadow/source/IotShadowClient.cpp +++ b/shadow/source/IotShadowClient.cpp @@ -43,9 +43,15 @@ namespace Aws m_connection = Aws::Crt::Mqtt::MqttConnection::NewConnectionFromMqtt5Client(mqtt5Client); } - IotShadowClient::operator bool() const noexcept { return m_connection && *m_connection; } + IotShadowClient::operator bool() const noexcept + { + return m_connection && *m_connection; + } - int IotShadowClient::GetLastError() const noexcept { return aws_last_error(); } + int IotShadowClient::GetLastError() const noexcept + { + return aws_last_error(); + } bool IotShadowClient::SubscribeToDeleteNamedShadowAccepted( const Aws::Iotshadow::DeleteNamedShadowSubscriptionRequest &request, @@ -59,7 +65,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -73,13 +80,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotshadow::DeleteShadowResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotshadow::DeleteShadowResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -113,7 +120,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -127,13 +135,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotshadow::ErrorResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotshadow::ErrorResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -167,7 +175,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -181,13 +190,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotshadow::DeleteShadowResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotshadow::DeleteShadowResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -219,7 +228,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -233,13 +243,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotshadow::ErrorResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotshadow::ErrorResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -271,7 +281,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -285,13 +296,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotshadow::GetShadowResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotshadow::GetShadowResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -325,7 +336,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -339,13 +351,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotshadow::ErrorResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotshadow::ErrorResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -379,7 +391,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -393,13 +406,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotshadow::GetShadowResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotshadow::GetShadowResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -431,7 +444,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -445,13 +459,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotshadow::ErrorResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotshadow::ErrorResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -483,7 +497,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -497,13 +512,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotshadow::ShadowDeltaUpdatedEvent response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotshadow::ShadowDeltaUpdatedEvent response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -537,7 +552,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -551,13 +567,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotshadow::ShadowUpdatedEvent response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotshadow::ShadowUpdatedEvent response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -591,7 +607,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -605,13 +622,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotshadow::ShadowDeltaUpdatedEvent response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotshadow::ShadowDeltaUpdatedEvent response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -643,7 +660,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -657,13 +675,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotshadow::ShadowUpdatedEvent response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotshadow::ShadowUpdatedEvent response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -695,7 +713,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -709,13 +728,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotshadow::UpdateShadowResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotshadow::UpdateShadowResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -749,7 +768,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -763,13 +783,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotshadow::ErrorResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotshadow::ErrorResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -803,7 +823,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -817,13 +838,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotshadow::UpdateShadowResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotshadow::UpdateShadowResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -855,7 +876,8 @@ namespace Aws uint16_t, const Aws::Crt::String &topic, Aws::Crt::Mqtt::QOS, - int errorCode) { + int errorCode) + { (void)topic; if (errorCode) { @@ -869,13 +891,13 @@ namespace Aws }; auto onSubscribePublish = - [handler]( - Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) { - Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); - Aws::Crt::JsonObject jsonObject(objectStr); - Aws::Iotshadow::ErrorResponse response(jsonObject); - handler(&response, AWS_ERROR_SUCCESS); - }; + [handler](Aws::Crt::Mqtt::MqttConnection &, const Aws::Crt::String &, const Aws::Crt::ByteBuf &payload) + { + Aws::Crt::String objectStr(reinterpret_cast(payload.buffer), payload.len); + Aws::Crt::JsonObject jsonObject(objectStr); + Aws::Iotshadow::ErrorResponse response(jsonObject); + handler(&response, AWS_ERROR_SUCCESS); + }; Aws::Crt::StringStream subscribeTopicSStr; subscribeTopicSStr << "$aws" @@ -917,7 +939,8 @@ namespace Aws Aws::Crt::ByteBuf buf = Aws::Crt::ByteBufNewCopy( Aws::Crt::g_allocator, reinterpret_cast(outgoingJson.data()), outgoingJson.length()); - auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) { + auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) + { onPubAck(errorCode); Aws::Crt::ByteBufDelete(const_cast(buf)); }; @@ -946,7 +969,8 @@ namespace Aws Aws::Crt::ByteBuf buf = Aws::Crt::ByteBufNewCopy( Aws::Crt::g_allocator, reinterpret_cast(outgoingJson.data()), outgoingJson.length()); - auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) { + auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) + { onPubAck(errorCode); Aws::Crt::ByteBufDelete(const_cast(buf)); }; @@ -977,7 +1001,8 @@ namespace Aws Aws::Crt::ByteBuf buf = Aws::Crt::ByteBufNewCopy( Aws::Crt::g_allocator, reinterpret_cast(outgoingJson.data()), outgoingJson.length()); - auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) { + auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) + { onPubAck(errorCode); Aws::Crt::ByteBufDelete(const_cast(buf)); }; @@ -1006,7 +1031,8 @@ namespace Aws Aws::Crt::ByteBuf buf = Aws::Crt::ByteBufNewCopy( Aws::Crt::g_allocator, reinterpret_cast(outgoingJson.data()), outgoingJson.length()); - auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) { + auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) + { onPubAck(errorCode); Aws::Crt::ByteBufDelete(const_cast(buf)); }; @@ -1037,7 +1063,8 @@ namespace Aws Aws::Crt::ByteBuf buf = Aws::Crt::ByteBufNewCopy( Aws::Crt::g_allocator, reinterpret_cast(outgoingJson.data()), outgoingJson.length()); - auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) { + auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) + { onPubAck(errorCode); Aws::Crt::ByteBufDelete(const_cast(buf)); }; @@ -1066,7 +1093,8 @@ namespace Aws Aws::Crt::ByteBuf buf = Aws::Crt::ByteBufNewCopy( Aws::Crt::g_allocator, reinterpret_cast(outgoingJson.data()), outgoingJson.length()); - auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) { + auto onPublishComplete = [buf, onPubAck](Aws::Crt::Mqtt::MqttConnection &, uint16_t, int errorCode) + { onPubAck(errorCode); Aws::Crt::ByteBufDelete(const_cast(buf)); }; diff --git a/shadow/source/ShadowDeltaUpdatedEvent.cpp b/shadow/source/ShadowDeltaUpdatedEvent.cpp index 0585bfce5..fef4415f1 100644 --- a/shadow/source/ShadowDeltaUpdatedEvent.cpp +++ b/shadow/source/ShadowDeltaUpdatedEvent.cpp @@ -71,7 +71,10 @@ namespace Aws } } - ShadowDeltaUpdatedEvent::ShadowDeltaUpdatedEvent(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + ShadowDeltaUpdatedEvent::ShadowDeltaUpdatedEvent(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } ShadowDeltaUpdatedEvent &ShadowDeltaUpdatedEvent::operator=(const Crt::JsonView &doc) { diff --git a/shadow/source/ShadowMetadata.cpp b/shadow/source/ShadowMetadata.cpp index 31e3bba32..8909ec834 100644 --- a/shadow/source/ShadowMetadata.cpp +++ b/shadow/source/ShadowMetadata.cpp @@ -41,7 +41,10 @@ namespace Aws } } - ShadowMetadata::ShadowMetadata(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + ShadowMetadata::ShadowMetadata(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } ShadowMetadata &ShadowMetadata::operator=(const Crt::JsonView &doc) { diff --git a/shadow/source/ShadowState.cpp b/shadow/source/ShadowState.cpp index f32d829f9..e7c94ca1b 100644 --- a/shadow/source/ShadowState.cpp +++ b/shadow/source/ShadowState.cpp @@ -41,7 +41,10 @@ namespace Aws } } - ShadowState::ShadowState(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + ShadowState::ShadowState(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } ShadowState &ShadowState::operator=(const Crt::JsonView &doc) { diff --git a/shadow/source/ShadowStateWithDelta.cpp b/shadow/source/ShadowStateWithDelta.cpp index 42ec67a4d..df9c31f4f 100644 --- a/shadow/source/ShadowStateWithDelta.cpp +++ b/shadow/source/ShadowStateWithDelta.cpp @@ -51,7 +51,10 @@ namespace Aws } } - ShadowStateWithDelta::ShadowStateWithDelta(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + ShadowStateWithDelta::ShadowStateWithDelta(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } ShadowStateWithDelta &ShadowStateWithDelta::operator=(const Crt::JsonView &doc) { diff --git a/shadow/source/ShadowUpdatedEvent.cpp b/shadow/source/ShadowUpdatedEvent.cpp index 550674d7c..d8054c914 100644 --- a/shadow/source/ShadowUpdatedEvent.cpp +++ b/shadow/source/ShadowUpdatedEvent.cpp @@ -55,7 +55,10 @@ namespace Aws } } - ShadowUpdatedEvent::ShadowUpdatedEvent(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + ShadowUpdatedEvent::ShadowUpdatedEvent(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } ShadowUpdatedEvent &ShadowUpdatedEvent::operator=(const Crt::JsonView &doc) { diff --git a/shadow/source/ShadowUpdatedSnapshot.cpp b/shadow/source/ShadowUpdatedSnapshot.cpp index 493baa1f5..4c774e70a 100644 --- a/shadow/source/ShadowUpdatedSnapshot.cpp +++ b/shadow/source/ShadowUpdatedSnapshot.cpp @@ -55,7 +55,10 @@ namespace Aws } } - ShadowUpdatedSnapshot::ShadowUpdatedSnapshot(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + ShadowUpdatedSnapshot::ShadowUpdatedSnapshot(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } ShadowUpdatedSnapshot &ShadowUpdatedSnapshot::operator=(const Crt::JsonView &doc) { diff --git a/shadow/source/ShadowUpdatedSubscriptionRequest.cpp b/shadow/source/ShadowUpdatedSubscriptionRequest.cpp index d026f1037..4042363cb 100644 --- a/shadow/source/ShadowUpdatedSubscriptionRequest.cpp +++ b/shadow/source/ShadowUpdatedSubscriptionRequest.cpp @@ -18,7 +18,10 @@ namespace Aws (void)doc; } - void ShadowUpdatedSubscriptionRequest::SerializeToObject(Aws::Crt::JsonObject &object) const { (void)object; } + void ShadowUpdatedSubscriptionRequest::SerializeToObject(Aws::Crt::JsonObject &object) const + { + (void)object; + } ShadowUpdatedSubscriptionRequest::ShadowUpdatedSubscriptionRequest(const Crt::JsonView &doc) { diff --git a/shadow/source/UpdateNamedShadowRequest.cpp b/shadow/source/UpdateNamedShadowRequest.cpp index 81c2a005d..540420064 100644 --- a/shadow/source/UpdateNamedShadowRequest.cpp +++ b/shadow/source/UpdateNamedShadowRequest.cpp @@ -53,7 +53,10 @@ namespace Aws } } - UpdateNamedShadowRequest::UpdateNamedShadowRequest(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + UpdateNamedShadowRequest::UpdateNamedShadowRequest(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } UpdateNamedShadowRequest &UpdateNamedShadowRequest::operator=(const Crt::JsonView &doc) { diff --git a/shadow/source/UpdateShadowRequest.cpp b/shadow/source/UpdateShadowRequest.cpp index c1746bdc0..8230a0c50 100644 --- a/shadow/source/UpdateShadowRequest.cpp +++ b/shadow/source/UpdateShadowRequest.cpp @@ -53,7 +53,10 @@ namespace Aws } } - UpdateShadowRequest::UpdateShadowRequest(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + UpdateShadowRequest::UpdateShadowRequest(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } UpdateShadowRequest &UpdateShadowRequest::operator=(const Crt::JsonView &doc) { diff --git a/shadow/source/UpdateShadowResponse.cpp b/shadow/source/UpdateShadowResponse.cpp index cd0703f77..3df213d1f 100644 --- a/shadow/source/UpdateShadowResponse.cpp +++ b/shadow/source/UpdateShadowResponse.cpp @@ -75,7 +75,10 @@ namespace Aws } } - UpdateShadowResponse::UpdateShadowResponse(const Crt::JsonView &doc) { LoadFromObject(*this, doc); } + UpdateShadowResponse::UpdateShadowResponse(const Crt::JsonView &doc) + { + LoadFromObject(*this, doc); + } UpdateShadowResponse &UpdateShadowResponse::operator=(const Crt::JsonView &doc) { diff --git a/shadow/source/UpdateShadowSubscriptionRequest.cpp b/shadow/source/UpdateShadowSubscriptionRequest.cpp index 7c4cee2ac..a2af81d2a 100644 --- a/shadow/source/UpdateShadowSubscriptionRequest.cpp +++ b/shadow/source/UpdateShadowSubscriptionRequest.cpp @@ -18,7 +18,10 @@ namespace Aws (void)doc; } - void UpdateShadowSubscriptionRequest::SerializeToObject(Aws::Crt::JsonObject &object) const { (void)object; } + void UpdateShadowSubscriptionRequest::SerializeToObject(Aws::Crt::JsonObject &object) const + { + (void)object; + } UpdateShadowSubscriptionRequest::UpdateShadowSubscriptionRequest(const Crt::JsonView &doc) {