Skip to content

Commit

Permalink
job service client
Browse files Browse the repository at this point in the history
  • Loading branch information
xiazhvera committed Oct 2, 2023
1 parent b4be2cd commit 17d0d75
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
15 changes: 1 addition & 14 deletions jobs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -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::
Expand Down
2 changes: 2 additions & 0 deletions jobs/include/aws/iotjobs/IotJobsClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <aws/crt/StlAllocator.h>
#include <aws/crt/Types.h>

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

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

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

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

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

int IotJobsClient::GetLastError() const noexcept { return aws_last_error(); }
Expand Down

0 comments on commit 17d0d75

Please sign in to comment.