Skip to content

Commit

Permalink
Mqtt updates (#13)
Browse files Browse the repository at this point in the history
* updated mqtt client for new mqtt interface.
* Updated sample and dependency versions.
  • Loading branch information
JonathanHenson authored and graebm committed Mar 21, 2019
1 parent 38abf2e commit 23168a5
Show file tree
Hide file tree
Showing 8 changed files with 133 additions and 108 deletions.
16 changes: 10 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ if (${CMAKE_INSTALL_LIBDIR} STREQUAL "lib64")
set(FIND_LIBRARY_USE_LIB64_PATHS true)
endif()

if (NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
endif()

if (BUILD_DEPS)
set(AWS_DEPS_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/deps)
if (DEFINED CMAKE_INSTALL_PREFIX)
Expand Down Expand Up @@ -88,9 +92,8 @@ else()
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_PREFIX_PATH}/${CMAKE_INSTALL_LIBDIR}/cmake")

if (NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
endif()
include(AwsCFlags)
include(AwsSharedLibSetup)

file(GLOB AWS_CRT_HEADERS
"include/aws/crt/*.h"
Expand Down Expand Up @@ -165,14 +168,15 @@ endif()

add_library(${CMAKE_PROJECT_NAME} ${AWS_CRT_CPP_SRC})

if (BUILD_SHARED_LIBS AND WIN32)
target_compile_definitions(${CMAKE_PROJECT_NAME} PUBLIC -DUSE_IMPORT_EXPORT)
if (BUILD_SHARED_LIBS)
target_compile_definitions(${CMAKE_PROJECT_NAME} PUBLIC -DAWS_CRT_CPP_USE_IMPORT_EXPORT)
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE -DAWS_CRT_CPP_EXPORTS)
endif()

set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES CXX_STANDARD ${CMAKE_CXX_STANDARD})

set(CMAKE_C_FLAGS_DEBUGOPT "")
aws_prepare_symbol_visibility_args(${CMAKE_PROJECT_NAME} "AWS_CRT_CPP")

#set warnings
if (MSVC)
Expand Down
5 changes: 3 additions & 2 deletions aws-common-runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ if (UNIX AND NOT APPLE)
endif()

set(AWS_C_IO_URL "https://github.com/awslabs/aws-c-io.git")
set(AWS_C_IO_SHA "v0.2.3")
set(AWS_C_IO_SHA "v0.2.4")
include(BuildAwsCIO)

set(AWS_C_MQTT_URL "https://github.com/awslabs/aws-c-mqtt.git")
set(AWS_C_MQTT_SHA "v0.2.2")
set(AWS_C_MQTT_SHA "v0.3.1")
include(BuildAwsCMqtt)

set(AWS_C_CAL_URL "https://github.com/awslabs/aws-c-cal.git")
Expand All @@ -46,3 +46,4 @@ if (UNIX AND NOT APPLE)
else()
add_dependencies(AwsCIO AwsCCommon )
endif()

13 changes: 9 additions & 4 deletions include/aws/crt/Exports.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,21 @@
*/

#if defined(USE_WINDOWS_DLL_SEMANTICS) || defined(WIN32)
# ifdef USE_IMPORT_EXPORT
# ifdef AWS_CRT_CPP_USE_IMPORT_EXPORT
# ifdef AWS_CRT_CPP_EXPORTS
# define AWS_CRT_CPP_API __declspec(dllexport)
# else
# define AWS_CRT_CPP_API __declspec(dllimport)
# endif /* AWS_CRT_CPP_API */
# else
# define AWS_CRT_CPP_API
# endif // USE_IMPORT_EXPORT
# endif // AWS_CRT_CPP_USE_IMPORT_EXPORT

#else // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32)
# define AWS_CRT_CPP_API
#endif // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32)
# if ((__GNUC__ >= 4) || defined(__clang__)) && defined(AWS_CRT_CPP_USE_IMPORT_EXPORT) && \
defined(AWS_CRT_CPP_EXPORTS)
# define AWS_CRT_CPP_API __attribute__((visibility("default")))
# else
# define AWS_CRT_CPP_API
# endif // __GNUC__ >= 4 || defined(__clang__)
#endif
6 changes: 5 additions & 1 deletion include/aws/crt/mqtt/MqttClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ namespace Aws
* Initiates the connection, OnConnectionCompleted will
* be invoked in an event-loop thread.
*/
bool Connect(const char *clientId, bool cleanSession, uint16_t keepAliveTime) noexcept;
bool Connect(
const char *clientId,
bool cleanSession,
uint16_t keepAliveTimeSecs = 0,
uint32_t pingTimeoutMs = 0) noexcept;

/**
* Initiates disconnect, OnDisconnectHandler will be invoked in an event-loop thread.
Expand Down
1 change: 1 addition & 0 deletions samples/mqtt_pub_sub/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ file(GLOB MQTT_PUB_SUB_SRC
set(PUB_SUB_PROJECT_NAME aws-crt-cpp-mqtt-pub-sub)
add_executable(${PUB_SUB_PROJECT_NAME} ${MQTT_PUB_SUB_SRC})
set_target_properties(${PUB_SUB_PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(${PUB_SUB_PROJECT_NAME} PROPERTIES CXX_STANDARD ${CMAKE_CXX_STANDARD})

set(CMAKE_C_FLAGS_DEBUGOPT "")

Expand Down
Loading

0 comments on commit 23168a5

Please sign in to comment.