Skip to content

Commit

Permalink
Release v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
arobenko committed Jun 29, 2024
2 parents 84e275f + aefdfe4 commit b5c2b4f
Show file tree
Hide file tree
Showing 14 changed files with 245 additions and 131 deletions.
62 changes: 0 additions & 62 deletions .appveyor.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/actions_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Github Actions Build
on: [push]

env:
COMMS_TAG: v5.2.3
CC_MQTT5_TAG: v2.7
COMMS_TAG: v5.2.5
CC_MQTT5_TAG: v2.8

jobs:
build_gcc_ubuntu_22_04:
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ option (BUILD_SHARED_LIBS "Build as shared library" OFF)

# Extra Configuration Variables
# CC_MQTT5_CUSTOM_CLIENT_CONFIG_FILES - List of custom client configuration files
# CC_MQTT5_CCACHE_EXECUTABLE - Custom ccache executable

# Other variables
set(CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard to use")
Expand Down
5 changes: 1 addition & 4 deletions client/app/common/TcpSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,18 @@ class TcpSession final : public Session

private:
using Socket = boost::asio::ip::tcp::socket;
using Timer = boost::asio::steady_timer;
using InDataBuf = std::array<std::uint8_t, 4096>;
using DataBuf = std::vector<std::uint8_t>;

TcpSession(boost::asio::io_context& io, const ProgramOptions& opts) :
Base(io, opts),
m_socket(io),
m_readTimer(io)
m_socket(io)
{
}

void doRead();

Socket m_socket;
Timer m_readTimer;
InDataBuf m_inData;
DataBuf m_buf;
};
Expand Down
29 changes: 27 additions & 2 deletions client/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ endif ()

set (HEADER_TEMPL ${CMAKE_CURRENT_SOURCE_DIR}/templ/client.h.templ)
set (SRC_TEMPL ${CMAKE_CURRENT_SOURCE_DIR}/templ/client.cpp.templ)
set (C_TEMPL ${CMAKE_CURRENT_SOURCE_DIR}/templ/client.c.templ)
set (CONFIG_TEMPL ${CMAKE_CURRENT_SOURCE_DIR}/templ/Config.h.templ)
set (PROT_OPTS_TEMPL ${CMAKE_CURRENT_SOURCE_DIR}/templ/ProtocolOptions.h.templ)
set (TEMPL_PROCESS_SCRIPT ${PROJECT_SOURCE_DIR}/cmake/ProcessTemplate.cmake)
Expand Down Expand Up @@ -39,6 +40,7 @@ function (gen_lib_mqtt5_client config_file)

set (header_output ${CMAKE_CURRENT_BINARY_DIR}/${dir}/${name}client.h)
set (src_output ${CMAKE_CURRENT_BINARY_DIR}/${dir}/${name}client.cpp)
set (c_output ${CMAKE_CURRENT_BINARY_DIR}/${dir}/${name}client.c)
set (config_output ${CMAKE_CURRENT_BINARY_DIR}/${dir}/Config.h)
set (prot_opts_output ${CMAKE_CURRENT_BINARY_DIR}/${dir}/ProtocolOptions.h)

Expand Down Expand Up @@ -90,6 +92,29 @@ function (gen_lib_mqtt5_client config_file)

# ---------------------------------

add_custom_command(
OUTPUT "${c_output}"
COMMAND ${CMAKE_COMMAND}
-DIN_FILE="${C_TEMPL}"
-DOUT_FILE="${c_output}"
-DNAME="${name}"
-P ${TEMPL_PROCESS_SCRIPT}
DEPENDS ${C_TEMPL} ${TEMPL_PROCESS_SCRIPT}
)

set_source_files_properties(
${c_output}
PROPERTIES GENERATED TRUE
)

set (c_tgt_name "${name}client.c.tgt")
add_custom_target(
${c_tgt_name}
DEPENDS "${c_output}" ${C_TEMPL} ${TEMPL_PROCESS_SCRIPT}
)

# ---------------------------------

add_custom_command(
OUTPUT "${config_output}"
COMMAND ${CMAKE_COMMAND}
Expand Down Expand Up @@ -152,7 +177,7 @@ function (gen_lib_mqtt5_client config_file)
src/ClientImpl.cpp
src/TimerMgr.cpp
)
add_library (${lib_name} ${src} ${src_output})
add_library (${lib_name} ${src} ${src_output} ${c_output})
add_library (cc::${lib_name} ALIAS ${lib_name})
target_link_libraries(${lib_name} PRIVATE cc::cc_mqtt5 cc::comms)
target_include_directories(
Expand All @@ -168,7 +193,7 @@ function (gen_lib_mqtt5_client config_file)
${lib_name} PROPERTIES
INTERFACE_LINK_LIBRARIES ""
)
add_dependencies(${lib_name} ${header_tgt_name} ${src_tgt_name} ${config_tgt_name} ${prot_opts_tgt_name})
add_dependencies(${lib_name} ${header_tgt_name} ${src_tgt_name} ${c_tgt_name} ${config_tgt_name} ${prot_opts_tgt_name})

if (CC_MQTT5_CLIENT_LIB_FORCE_PIC)
set_property(TARGET ${lib_name} PROPERTY POSITION_INDEPENDENT_CODE ON)
Expand Down
2 changes: 1 addition & 1 deletion client/lib/doxygen/main.dox
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@
/// called before the @b cc_mqtt5_client_connect_cancel(), the operation is
/// cancelled @b without callback invocation.
///
/// @subsection doc_cc_mqtt5_client_connect_simplify Simplifying the "Connect" Operation Preparation.
/// @subsection doc_cc_mqtt5_client_connect_simplify Simplifying the "Connect" Operation Preparation
/// In many use cases the "connect" operation can be quite simple with a lot of defaults.
/// To simplify the sequence of the operation preparation and handling of errors,
/// the library provides several wrapper functions that can be used:
Expand Down
19 changes: 10 additions & 9 deletions client/lib/include/cc_mqtt5_client/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@

#ifdef __cplusplus
extern "C" {
#else // #ifdef __cplusplus
#include <stdbool.h>
#endif // #ifdef __cplusplus

/// @brief Major verion of the library
/// @ingroup global
#define CC_MQTT5_CLIENT_MAJOR_VERSION 0U
#define CC_MQTT5_CLIENT_MAJOR_VERSION 1U

/// @brief Minor verion of the library
/// @ingroup global
#define CC_MQTT5_CLIENT_MINOR_VERSION 5U
#define CC_MQTT5_CLIENT_MINOR_VERSION 0U

/// @brief Patch level of the library
/// @ingroup global
Expand Down Expand Up @@ -215,7 +216,7 @@ struct CC_Mqtt5Client;
/// @brief Handle used to access client specific data structures.
/// @details Returned by cc_mqtt5_client_alloc() function.
/// @ingroup client
typedef CC_Mqtt5Client* CC_Mqtt5ClientHandle;
typedef struct CC_Mqtt5Client* CC_Mqtt5ClientHandle;

/// @brief Declaration of the hidden structure used to define @ref CC_Mqtt5ConnectHandle
/// @ingroup connect
Expand All @@ -224,7 +225,7 @@ struct CC_Mqtt5Connect;
/// @brief Handle for "connect" operation.
/// @details Returned by cc_mqtt5_client_connect_prepare() function.
/// @ingroup connect
typedef CC_Mqtt5Connect* CC_Mqtt5ConnectHandle;
typedef struct CC_Mqtt5Connect* CC_Mqtt5ConnectHandle;

/// @brief Declaration of the hidden structure used to define @ref CC_Mqtt5DisconnectHandle
/// @ingroup disconnect
Expand All @@ -233,7 +234,7 @@ struct CC_Mqtt5Disconnect;
/// @brief Handle for "disconnect" operation.
/// @details Returned by cc_mqtt5_client_disconnect_prepare() function.
/// @ingroup disconnect
typedef CC_Mqtt5Disconnect* CC_Mqtt5DisconnectHandle;
typedef struct CC_Mqtt5Disconnect* CC_Mqtt5DisconnectHandle;

/// @brief Declaration of the hidden structure used to define @ref CC_Mqtt5SubscribeHandle
/// @ingroup subscribe
Expand All @@ -242,7 +243,7 @@ struct CC_Mqtt5Subscribe;
/// @brief Handle for "subscribe" operation.
/// @details Returned by cc_mqtt5_client_subscribe_prepare() function.
/// @ingroup subscribe
typedef CC_Mqtt5Subscribe* CC_Mqtt5SubscribeHandle;
typedef struct CC_Mqtt5Subscribe* CC_Mqtt5SubscribeHandle;

/// @brief Declaration of the hidden structure used to define @ref CC_Mqtt5UnsubscribeHandle
/// @ingroup unsubscribe
Expand All @@ -251,7 +252,7 @@ struct CC_Mqtt5Unsubscribe;
/// @brief Handle for "unsubscribe" operation.
/// @details Returned by cc_mqtt5_client_unsubscribe_prepare() function.
/// @ingroup unsubscribe
typedef CC_Mqtt5Unsubscribe* CC_Mqtt5UnsubscribeHandle;
typedef struct CC_Mqtt5Unsubscribe* CC_Mqtt5UnsubscribeHandle;

/// @brief Declaration of the hidden structure used to define @ref CC_Mqtt5PublishHandle
/// @ingroup publish
Expand All @@ -260,7 +261,7 @@ struct CC_Mqtt5Publish;
/// @brief Handle for "publish" operation.
/// @details Returned by cc_mqtt5_client_publish_prepare() function.
/// @ingroup publish
typedef CC_Mqtt5Publish* CC_Mqtt5PublishHandle;
typedef struct CC_Mqtt5Publish* CC_Mqtt5PublishHandle;

/// @brief Declaration of the hidden structure used to define @ref CC_Mqtt5ReauthHandle
/// @ingroup reauth
Expand All @@ -269,7 +270,7 @@ struct CC_Mqtt5Reauth;
/// @brief Handle for "reauth" operation.
/// @details Returned by cc_mqtt5_client_reauth_prepare() function.
/// @ingroup reauth
typedef CC_Mqtt5Reauth* CC_Mqtt5ReauthHandle;
typedef struct CC_Mqtt5Reauth* CC_Mqtt5ReauthHandle;

/// @brief Wraping structre of the single "User Property".
/// @see @b cc_mqtt5_client_init_user_prop()
Expand Down
2 changes: 1 addition & 1 deletion client/lib/src/ProtocolDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <cstdint>

static_assert(CC_MQTT5_VERSION <= COMMS_MAKE_VERSION(2, 7, 0),
static_assert(COMMS_MAKE_VERSION(2, 8, 0) <= CC_MQTT5_VERSION,
"The version of the cc_mqtt5 library is too low.");

namespace cc_mqtt5_client
Expand Down
9 changes: 9 additions & 0 deletions client/lib/templ/client.c.templ
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// Copyright 2024 - 2024 (C). Alex Robenko. All rights reserved.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

// Just check C compilation when header is included.
#include "##NAME##client.h"
1 change: 0 additions & 1 deletion client/lib/test/unit/UnitTestCommonBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class UnitTestCommonBase
{
CC_Mqtt5ClientHandle (*m_alloc)() = nullptr;
void (*m_free)(CC_Mqtt5ClientHandle) = nullptr;
CC_Mqtt5ErrorCode (*m_init)(CC_Mqtt5ClientHandle) = nullptr;
void (*m_tick)(CC_Mqtt5ClientHandle, unsigned) = nullptr;
unsigned (*m_process_data)(CC_Mqtt5ClientHandle, const unsigned char*, unsigned) = nullptr;
void (*m_notify_network_disconnected)(CC_Mqtt5ClientHandle) = nullptr;
Expand Down
Loading

0 comments on commit b5c2b4f

Please sign in to comment.