Skip to content

Commit b5c2b4f

Browse files
committed
Release v1.0
2 parents 84e275f + aefdfe4 commit b5c2b4f

File tree

14 files changed

+245
-131
lines changed

14 files changed

+245
-131
lines changed

.appveyor.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.

.github/workflows/actions_build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Github Actions Build
33
on: [push]
44

55
env:
6-
COMMS_TAG: v5.2.3
7-
CC_MQTT5_TAG: v2.7
6+
COMMS_TAG: v5.2.5
7+
CC_MQTT5_TAG: v2.8
88

99
jobs:
1010
build_gcc_ubuntu_22_04:

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ option (BUILD_SHARED_LIBS "Build as shared library" OFF)
1717

1818
# Extra Configuration Variables
1919
# CC_MQTT5_CUSTOM_CLIENT_CONFIG_FILES - List of custom client configuration files
20+
# CC_MQTT5_CCACHE_EXECUTABLE - Custom ccache executable
2021

2122
# Other variables
2223
set(CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard to use")

client/app/common/TcpSession.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,18 @@ class TcpSession final : public Session
2828

2929
private:
3030
using Socket = boost::asio::ip::tcp::socket;
31-
using Timer = boost::asio::steady_timer;
3231
using InDataBuf = std::array<std::uint8_t, 4096>;
3332
using DataBuf = std::vector<std::uint8_t>;
3433

3534
TcpSession(boost::asio::io_context& io, const ProgramOptions& opts) :
3635
Base(io, opts),
37-
m_socket(io),
38-
m_readTimer(io)
36+
m_socket(io)
3937
{
4038
}
4139

4240
void doRead();
4341

4442
Socket m_socket;
45-
Timer m_readTimer;
4643
InDataBuf m_inData;
4744
DataBuf m_buf;
4845
};

client/lib/CMakeLists.txt

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ endif ()
88

99
set (HEADER_TEMPL ${CMAKE_CURRENT_SOURCE_DIR}/templ/client.h.templ)
1010
set (SRC_TEMPL ${CMAKE_CURRENT_SOURCE_DIR}/templ/client.cpp.templ)
11+
set (C_TEMPL ${CMAKE_CURRENT_SOURCE_DIR}/templ/client.c.templ)
1112
set (CONFIG_TEMPL ${CMAKE_CURRENT_SOURCE_DIR}/templ/Config.h.templ)
1213
set (PROT_OPTS_TEMPL ${CMAKE_CURRENT_SOURCE_DIR}/templ/ProtocolOptions.h.templ)
1314
set (TEMPL_PROCESS_SCRIPT ${PROJECT_SOURCE_DIR}/cmake/ProcessTemplate.cmake)
@@ -39,6 +40,7 @@ function (gen_lib_mqtt5_client config_file)
3940

4041
set (header_output ${CMAKE_CURRENT_BINARY_DIR}/${dir}/${name}client.h)
4142
set (src_output ${CMAKE_CURRENT_BINARY_DIR}/${dir}/${name}client.cpp)
43+
set (c_output ${CMAKE_CURRENT_BINARY_DIR}/${dir}/${name}client.c)
4244
set (config_output ${CMAKE_CURRENT_BINARY_DIR}/${dir}/Config.h)
4345
set (prot_opts_output ${CMAKE_CURRENT_BINARY_DIR}/${dir}/ProtocolOptions.h)
4446

@@ -90,6 +92,29 @@ function (gen_lib_mqtt5_client config_file)
9092

9193
# ---------------------------------
9294

95+
add_custom_command(
96+
OUTPUT "${c_output}"
97+
COMMAND ${CMAKE_COMMAND}
98+
-DIN_FILE="${C_TEMPL}"
99+
-DOUT_FILE="${c_output}"
100+
-DNAME="${name}"
101+
-P ${TEMPL_PROCESS_SCRIPT}
102+
DEPENDS ${C_TEMPL} ${TEMPL_PROCESS_SCRIPT}
103+
)
104+
105+
set_source_files_properties(
106+
${c_output}
107+
PROPERTIES GENERATED TRUE
108+
)
109+
110+
set (c_tgt_name "${name}client.c.tgt")
111+
add_custom_target(
112+
${c_tgt_name}
113+
DEPENDS "${c_output}" ${C_TEMPL} ${TEMPL_PROCESS_SCRIPT}
114+
)
115+
116+
# ---------------------------------
117+
93118
add_custom_command(
94119
OUTPUT "${config_output}"
95120
COMMAND ${CMAKE_COMMAND}
@@ -152,7 +177,7 @@ function (gen_lib_mqtt5_client config_file)
152177
src/ClientImpl.cpp
153178
src/TimerMgr.cpp
154179
)
155-
add_library (${lib_name} ${src} ${src_output})
180+
add_library (${lib_name} ${src} ${src_output} ${c_output})
156181
add_library (cc::${lib_name} ALIAS ${lib_name})
157182
target_link_libraries(${lib_name} PRIVATE cc::cc_mqtt5 cc::comms)
158183
target_include_directories(
@@ -168,7 +193,7 @@ function (gen_lib_mqtt5_client config_file)
168193
${lib_name} PROPERTIES
169194
INTERFACE_LINK_LIBRARIES ""
170195
)
171-
add_dependencies(${lib_name} ${header_tgt_name} ${src_tgt_name} ${config_tgt_name} ${prot_opts_tgt_name})
196+
add_dependencies(${lib_name} ${header_tgt_name} ${src_tgt_name} ${c_tgt_name} ${config_tgt_name} ${prot_opts_tgt_name})
172197

173198
if (CC_MQTT5_CLIENT_LIB_FORCE_PIC)
174199
set_property(TARGET ${lib_name} PROPERTY POSITION_INDEPENDENT_CODE ON)

client/lib/doxygen/main.dox

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@
550550
/// called before the @b cc_mqtt5_client_connect_cancel(), the operation is
551551
/// cancelled @b without callback invocation.
552552
///
553-
/// @subsection doc_cc_mqtt5_client_connect_simplify Simplifying the "Connect" Operation Preparation.
553+
/// @subsection doc_cc_mqtt5_client_connect_simplify Simplifying the "Connect" Operation Preparation
554554
/// In many use cases the "connect" operation can be quite simple with a lot of defaults.
555555
/// To simplify the sequence of the operation preparation and handling of errors,
556556
/// the library provides several wrapper functions that can be used:

client/lib/include/cc_mqtt5_client/common.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,17 @@
1212

1313
#ifdef __cplusplus
1414
extern "C" {
15+
#else // #ifdef __cplusplus
1516
#include <stdbool.h>
1617
#endif // #ifdef __cplusplus
1718

1819
/// @brief Major verion of the library
1920
/// @ingroup global
20-
#define CC_MQTT5_CLIENT_MAJOR_VERSION 0U
21+
#define CC_MQTT5_CLIENT_MAJOR_VERSION 1U
2122

2223
/// @brief Minor verion of the library
2324
/// @ingroup global
24-
#define CC_MQTT5_CLIENT_MINOR_VERSION 5U
25+
#define CC_MQTT5_CLIENT_MINOR_VERSION 0U
2526

2627
/// @brief Patch level of the library
2728
/// @ingroup global
@@ -215,7 +216,7 @@ struct CC_Mqtt5Client;
215216
/// @brief Handle used to access client specific data structures.
216217
/// @details Returned by cc_mqtt5_client_alloc() function.
217218
/// @ingroup client
218-
typedef CC_Mqtt5Client* CC_Mqtt5ClientHandle;
219+
typedef struct CC_Mqtt5Client* CC_Mqtt5ClientHandle;
219220

220221
/// @brief Declaration of the hidden structure used to define @ref CC_Mqtt5ConnectHandle
221222
/// @ingroup connect
@@ -224,7 +225,7 @@ struct CC_Mqtt5Connect;
224225
/// @brief Handle for "connect" operation.
225226
/// @details Returned by cc_mqtt5_client_connect_prepare() function.
226227
/// @ingroup connect
227-
typedef CC_Mqtt5Connect* CC_Mqtt5ConnectHandle;
228+
typedef struct CC_Mqtt5Connect* CC_Mqtt5ConnectHandle;
228229

229230
/// @brief Declaration of the hidden structure used to define @ref CC_Mqtt5DisconnectHandle
230231
/// @ingroup disconnect
@@ -233,7 +234,7 @@ struct CC_Mqtt5Disconnect;
233234
/// @brief Handle for "disconnect" operation.
234235
/// @details Returned by cc_mqtt5_client_disconnect_prepare() function.
235236
/// @ingroup disconnect
236-
typedef CC_Mqtt5Disconnect* CC_Mqtt5DisconnectHandle;
237+
typedef struct CC_Mqtt5Disconnect* CC_Mqtt5DisconnectHandle;
237238

238239
/// @brief Declaration of the hidden structure used to define @ref CC_Mqtt5SubscribeHandle
239240
/// @ingroup subscribe
@@ -242,7 +243,7 @@ struct CC_Mqtt5Subscribe;
242243
/// @brief Handle for "subscribe" operation.
243244
/// @details Returned by cc_mqtt5_client_subscribe_prepare() function.
244245
/// @ingroup subscribe
245-
typedef CC_Mqtt5Subscribe* CC_Mqtt5SubscribeHandle;
246+
typedef struct CC_Mqtt5Subscribe* CC_Mqtt5SubscribeHandle;
246247

247248
/// @brief Declaration of the hidden structure used to define @ref CC_Mqtt5UnsubscribeHandle
248249
/// @ingroup unsubscribe
@@ -251,7 +252,7 @@ struct CC_Mqtt5Unsubscribe;
251252
/// @brief Handle for "unsubscribe" operation.
252253
/// @details Returned by cc_mqtt5_client_unsubscribe_prepare() function.
253254
/// @ingroup unsubscribe
254-
typedef CC_Mqtt5Unsubscribe* CC_Mqtt5UnsubscribeHandle;
255+
typedef struct CC_Mqtt5Unsubscribe* CC_Mqtt5UnsubscribeHandle;
255256

256257
/// @brief Declaration of the hidden structure used to define @ref CC_Mqtt5PublishHandle
257258
/// @ingroup publish
@@ -260,7 +261,7 @@ struct CC_Mqtt5Publish;
260261
/// @brief Handle for "publish" operation.
261262
/// @details Returned by cc_mqtt5_client_publish_prepare() function.
262263
/// @ingroup publish
263-
typedef CC_Mqtt5Publish* CC_Mqtt5PublishHandle;
264+
typedef struct CC_Mqtt5Publish* CC_Mqtt5PublishHandle;
264265

265266
/// @brief Declaration of the hidden structure used to define @ref CC_Mqtt5ReauthHandle
266267
/// @ingroup reauth
@@ -269,7 +270,7 @@ struct CC_Mqtt5Reauth;
269270
/// @brief Handle for "reauth" operation.
270271
/// @details Returned by cc_mqtt5_client_reauth_prepare() function.
271272
/// @ingroup reauth
272-
typedef CC_Mqtt5Reauth* CC_Mqtt5ReauthHandle;
273+
typedef struct CC_Mqtt5Reauth* CC_Mqtt5ReauthHandle;
273274

274275
/// @brief Wraping structre of the single "User Property".
275276
/// @see @b cc_mqtt5_client_init_user_prop()

client/lib/src/ProtocolDefs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#include <cstdint>
2222

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

2626
namespace cc_mqtt5_client

client/lib/templ/client.c.templ

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//
2+
// Copyright 2024 - 2024 (C). Alex Robenko. All rights reserved.
3+
//
4+
// This Source Code Form is subject to the terms of the Mozilla Public
5+
// License, v. 2.0. If a copy of the MPL was not distributed with this
6+
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
7+
8+
// Just check C compilation when header is included.
9+
#include "##NAME##client.h"

client/lib/test/unit/UnitTestCommonBase.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ class UnitTestCommonBase
2121
{
2222
CC_Mqtt5ClientHandle (*m_alloc)() = nullptr;
2323
void (*m_free)(CC_Mqtt5ClientHandle) = nullptr;
24-
CC_Mqtt5ErrorCode (*m_init)(CC_Mqtt5ClientHandle) = nullptr;
2524
void (*m_tick)(CC_Mqtt5ClientHandle, unsigned) = nullptr;
2625
unsigned (*m_process_data)(CC_Mqtt5ClientHandle, const unsigned char*, unsigned) = nullptr;
2726
void (*m_notify_network_disconnected)(CC_Mqtt5ClientHandle) = nullptr;

0 commit comments

Comments
 (0)