From 17d0d75fa969e529664bceb76a4cabd221cba461 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 2 Oct 2023 09:44:03 -0700 Subject: [PATCH] job service client --- jobs/CMakeLists.txt | 15 +-------------- jobs/include/aws/iotjobs/IotJobsClient.h | 2 ++ jobs/source/IotJobsClient.cpp | 5 +++++ 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/jobs/CMakeLists.txt b/jobs/CMakeLists.txt index 4059f09fa..06093f741 100644 --- a/jobs/CMakeLists.txt +++ b/jobs/CMakeLists.txt @@ -1,12 +1,7 @@ # This file is generated cmake_minimum_required(VERSION 3.1) - -project(IotJobs-cpp LANGUAGES CXX) -if (DEFINED SIMPLE_VERSION) - message("IotJobs version is ${SIMPLE_VERSION}") - set(PROJECT_VERSION ${SIMPLE_VERSION}) -endif() +project(IotJobs-cpp CXX) set(RUNTIME_DIRECTORY bin) @@ -113,14 +108,6 @@ else() set(TARGET_DIR "static") endif() -include(CMakePackageConfigHelpers) -if (DEFINED SIMPLE_VERSION) - write_basic_package_version_file( - "${CMAKE_CURRENT_BINARY_DIR}/iotjobs-cpp-config-version.cmake" - COMPATIBILITY SameMajorVersion - ) -endif() - install(EXPORT "IotJobs-cpp-targets" DESTINATION "${CMAKE_INSTALL_LIBDIR}/IotJobs-cpp/cmake/${TARGET_DIR}" NAMESPACE AWS:: diff --git a/jobs/include/aws/iotjobs/IotJobsClient.h b/jobs/include/aws/iotjobs/IotJobsClient.h index ab7c7248b..e4027c171 100644 --- a/jobs/include/aws/iotjobs/IotJobsClient.h +++ b/jobs/include/aws/iotjobs/IotJobsClient.h @@ -11,6 +11,7 @@ #include #include +#include #include namespace Aws @@ -80,6 +81,7 @@ namespace Aws { public: IotJobsClient(const std::shared_ptr &connection); + IotJobsClient(const std::shared_ptr &mqtt5Client); operator bool() const noexcept; int GetLastError() const noexcept; diff --git a/jobs/source/IotJobsClient.cpp b/jobs/source/IotJobsClient.cpp index f99ef2b52..4dd8819d5 100644 --- a/jobs/source/IotJobsClient.cpp +++ b/jobs/source/IotJobsClient.cpp @@ -33,6 +33,11 @@ namespace Aws { } + IotJobsClient::IotJobsClient(const std::shared_ptr &mqtt5Client) + { + m_connection = Aws::Crt::Mqtt::MqttConnection::NewConnectionFromMqtt5Client(mqtt5Client); + } + IotJobsClient::operator bool() const noexcept { return m_connection && *m_connection; } int IotJobsClient::GetLastError() const noexcept { return aws_last_error(); }