Skip to content

Commit

Permalink
Release v5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
arobenko committed Mar 3, 2024
2 parents 736d6d0 + f7c8453 commit c232e08
Show file tree
Hide file tree
Showing 60 changed files with 1,489 additions and 269 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ option (CC_TOOLS_QT_BUILD_PLUGIN_TCP_CLIENT_SOCKET "Build TCP client socket plug
option (CC_TOOLS_QT_BUILD_PLUGIN_TCP_PROXY_SOCKET "Build TCP proxy socket plugin." ${CC_TOOLS_QT_BUILD_PLUGINS})
option (CC_TOOLS_QT_BUILD_PLUGIN_TCP_SERVER_SOCKET "Build TCP server socket plugin." ${CC_TOOLS_QT_BUILD_PLUGINS})
option (CC_TOOLS_QT_BUILD_PLUGIN_UDP_SOCKET "Build UDP socket plugin." ${CC_TOOLS_QT_BUILD_PLUGINS})
option (CC_TOOLS_QT_BUILD_PLUGIN_UDP_PROXY_SOCKET "Build UDP proxy socket plugin." ${CC_TOOLS_QT_BUILD_PLUGINS})
option (CC_TOOLS_QT_BUILD_PLUGIN_RAW_DATA_PROTOCOL "Build raw data protocol plugin." ${CC_TOOLS_QT_BUILD_PLUGINS})
option (CC_TOOLS_QT_BUILD_PLUGIN_DEMO_PROTOCOL "Build demo protocol plugin." OFF)

Expand All @@ -35,6 +36,10 @@ if ("${CMAKE_CXX_STANDARD}" STREQUAL "")
set (CMAKE_CXX_STANDARD 17)
endif ()

if ("${CMAKE_CXX_STANDARD}" VERSION_LESS "17")
message (FATAL_ERROR "Use C++17 or later to compile this project.")
endif()

if ("${CC_TOOLS_QT_MAJOR_QT_VERSION}" STREQUAL "")
set (CC_TOOLS_QT_MAJOR_QT_VERSION 5)
endif ()
Expand Down
39 changes: 21 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,27 @@ in parallel to dumping/recording the incoming messages.
The **CommsChampion Tools** contain the following
plugins that can be used with any application:

- **null_socket** - NULL socket, that doesn't produce any incoming data and
discards any outgoing data.
- **echo_socket** - Echo socket, all the data being sent is immediately reported
as an incoming data.
- **serial_socket** - Low level socket that sends and receives data over serial
(RS-232) I/O link.
- **tcp_client_socket** - Client TCP/IP socket, that connects to remote
server, sends and receives data over TCP/IP network link.
- **tcp_server_socket** - Server TCP/IP socket, waits for and accepts all
connections from TCP/IP clients, sends and receives data to/from them.
- **tcp_proxy_socket** - Proxy server TCP/IP socket, combines Server and Client
side of TCP/IP connection, can be used to monitor traffic of the messages between
remote a client and a server.
- **udp_socket** - Generic (client/server) UDP/IP socket.
- **ssl_client_socket** - Client secure (SSL/TLS) connection socket.
- **raw_data_protocol** - Protocol definition that defines only a single message
type with one field of unlimited length data. It can be used to review the
raw data being received from I/O socket.
- **CC Echo Socket** - Echo socket, all the data being sent is immediately reported
as an incoming data.
- **CC NULL Socket** - NULL socket, that doesn't produce any incoming data and
discards any outgoing data.
- **CC Serial Socket** - Low level socket that sends and receives data over serial
(RS-232) I/O link.
- **CC SSL Client Socket** - Client secure (SSL/TLS) connection socket.
- **CC TCP/IP Client Socket** - Client TCP/IP socket, that connects to remote
server, sends and receives data over TCP/IP network link.
- **CC TCP/IP Proxy Socket** - Proxy server TCP/IP socket, combines Server and Client
side of TCP/IP connection, can be used to monitor traffic of the messages between
remote a client and a server.
- **CC TCP/IP Server Socket** - Server TCP/IP socket, waits for and accepts all
connections from TCP/IP clients, sends and receives data to/from them.
- **CC UDP/IP Socket** - Generic (client/server) UDP/IP socket.
- **CC UDP/IP Proxy Socket** - Proxy server UDP/IP socket, combines Server and Client
side of UDP/IP connection, can be used to monitor traffic of the messages between
remote a client and a server.
- **CC Raw Data Protocol** - Protocol definition that defines only a single message
type with one field of unlimited length data. It can be used to review the
raw data being received from I/O socket.

# How to Build
In addition to the [Qt](http://www.qt.io/) framework, this project depends on the
Expand Down
2 changes: 1 addition & 1 deletion demo/cc_plugin/AllMessages.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once

#include <tuple>
#include "cc_plugin/Message.h"
#include "cc_plugin/DemoMessage.h"

#include "cc_plugin/message/IntValues.h"
#include "cc_plugin/message/EnumValues.h"
Expand Down
12 changes: 6 additions & 6 deletions demo/cc_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ function (cc_plugin_demo)
set (refresh_plugin_header TRUE)
if ((NOT EXISTS ${stamp_file}) OR (${meta_file} IS_NEWER_THAN ${stamp_file}))
execute_process(
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_SOURCE_DIR}/Plugin.h)
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_SOURCE_DIR}/DemoPlugin.h)
execute_process(
COMMAND ${CMAKE_COMMAND} -E touch ${stamp_file})
endif ()


set (src
Plugin.h
Plugin.cpp
Protocol.cpp
TransportMessage.cpp
Message.cpp
DemoPlugin.h
DemoPlugin.cpp
DemoProtocol.cpp
DemoTransportMessage.cpp
DemoMessage.cpp
message/IntValues.cpp
message/EnumValues.cpp
message/BitmaskValues.cpp
Expand Down
12 changes: 6 additions & 6 deletions demo/cc_plugin/Message.cpp → demo/cc_plugin/DemoMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

#include "Message.h"
#include "DemoMessage.h"

#include <cassert>

Expand All @@ -35,16 +35,16 @@ static QVariantList createFieldsProperties()
QVariantList props;
props.append(cc::property::field::IntValue().name("Version").serialisedHidden().hiddenWhenReadOnly().asMap());

assert(props.size() == demo::Message<>::TransportFieldIdx_numOfValues);
assert(props.size() == demo::DemoMessage<>::TransportFieldIdx_numOfValues);
return props;
}

} // namespace

Message::Message() = default;
Message::~Message() noexcept = default;
DemoMessage::DemoMessage() = default;
DemoMessage::~DemoMessage() noexcept = default;

const QVariantList& Message::extraTransportFieldsPropertiesImpl() const
const QVariantList& DemoMessage::extraTransportFieldsPropertiesImpl() const
{
if (getId() != demo::MsgId_Optionals) {
return Base::extraTransportFieldsPropertiesImpl();
Expand All @@ -54,7 +54,7 @@ const QVariantList& Message::extraTransportFieldsPropertiesImpl() const
return Props;
}

QString Message::idAsStringImpl() const
QString DemoMessage::idAsStringImpl() const
{
return QString("0x%1").arg(getId(), 2, 16, QChar('0'));
}
Expand Down
10 changes: 5 additions & 5 deletions demo/cc_plugin/Message.h → demo/cc_plugin/DemoMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@
#pragma once

#include "cc_tools_qt/cc_tools_qt.h"
#include "demo/Message.h"
#include "demo/DemoMessage.h"

namespace demo
{

namespace cc_plugin
{

class Message : public cc_tools_qt::MessageBase<demo::Message>
class DemoMessage : public cc_tools_qt::MessageBase<demo::DemoMessage>
{
using Base = cc_tools_qt::MessageBase<demo::Message>;
using Base = cc_tools_qt::MessageBase<demo::DemoMessage>;
public:
Message();
virtual ~Message() noexcept;
DemoMessage();
virtual ~DemoMessage() noexcept;

protected:

Expand Down
10 changes: 5 additions & 5 deletions demo/cc_plugin/Plugin.cpp → demo/cc_plugin/DemoPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.


#include "Plugin.h"
#include "Protocol.h"
#include "DemoPlugin.h"
#include "DemoProtocol.h"

namespace cc = cc_tools_qt;

Expand All @@ -27,17 +27,17 @@ namespace demo
namespace cc_plugin
{

Plugin::Plugin()
DemoPlugin::DemoPlugin()
{
pluginProperties()
.setProtocolCreateFunc(
[]()
{
return cc::ProtocolPtr(new Protocol());
return cc::ProtocolPtr(new DemoProtocol());
});
}

Plugin::~Plugin() noexcept = default;
DemoPlugin::~DemoPlugin() noexcept = default;

} // namespace cc_plugin

Expand Down
6 changes: 3 additions & 3 deletions demo/cc_plugin/Plugin.h → demo/cc_plugin/DemoPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ namespace demo
namespace cc_plugin
{

class Plugin : public cc_tools_qt::Plugin
class DemoPlugin : public cc_tools_qt::Plugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "cc.DemoProtocol" FILE "demo.json")
Q_INTERFACES(cc_tools_qt::Plugin)

public:
Plugin();
~Plugin() noexcept;
DemoPlugin();
~DemoPlugin() noexcept;
};

} // namespace cc_plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

#include "Protocol.h"
#include "DemoProtocol.h"

#include "comms/comms.h"

Expand All @@ -27,9 +27,9 @@ namespace demo
namespace cc_plugin
{

Protocol::~Protocol() noexcept = default;
DemoProtocol::~DemoProtocol() noexcept = default;

const QString& Protocol::nameImpl() const
const QString& DemoProtocol::nameImpl() const
{
static const QString& Str("Demo");
return Str;
Expand Down
14 changes: 7 additions & 7 deletions demo/cc_plugin/Protocol.h → demo/cc_plugin/DemoProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,24 @@
#pragma once

#include "cc_tools_qt/cc_tools_qt.h"
#include "cc_plugin/Stack.h"
#include "cc_plugin/TransportMessage.h"
#include "cc_plugin/DemoStack.h"
#include "cc_plugin/DemoTransportMessage.h"

namespace demo
{

namespace cc_plugin
{

class Protocol : public
class DemoProtocol : public
cc_tools_qt::ProtocolBase<
cc_plugin::Stack,
TransportMessage
cc_plugin::DemoStack,
DemoTransportMessage
>
{
public:
Protocol() = default;
virtual ~Protocol() noexcept;
DemoProtocol() = default;
virtual ~DemoProtocol() noexcept;

protected:
virtual const QString& nameImpl() const override;
Expand Down
6 changes: 3 additions & 3 deletions demo/cc_plugin/Stack.h → demo/cc_plugin/DemoStack.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once

#include "demo/Stack.h"
#include "Message.h"
#include "DemoMessage.h"
#include "AllMessages.h"

namespace demo
Expand All @@ -28,8 +28,8 @@ namespace demo
namespace cc_plugin
{

using Stack = demo::Stack<
cc_plugin::Message,
using DemoStack = demo::Stack<
cc_plugin::DemoMessage,
cc_plugin::AllMessages
>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

#include "TransportMessage.h"
#include "DemoTransportMessage.h"

#include <cassert>

Expand Down Expand Up @@ -74,19 +74,19 @@ QVariantList createFieldsProperties()
props.append(cc::property::field::ForField<demo::VersionField>().name("VERSION").asMap());
props.append(cc::property::field::ForField<demo::DataField<> >().name("PAYLOAD").asMap());
props.append(cc::property::field::ForField<demo::ChecksumField>().name("CHECKSUM").asMap());
assert(props.size() == TransportMessage::FieldIdx_NumOfValues);
assert(props.size() == DemoTransportMessage::FieldIdx_NumOfValues);
return props;
}

} // namespace

const QVariantList& TransportMessage::fieldsPropertiesImpl() const
const QVariantList& DemoTransportMessage::fieldsPropertiesImpl() const
{
static const auto Props = createFieldsProperties();
return Props;
}

comms::ErrorStatus TransportMessage::readImpl(ReadIterator& iter, std::size_t size)
comms::ErrorStatus DemoTransportMessage::readImpl(ReadIterator& iter, std::size_t size)
{
static const auto ChecksumLen =
sizeof(demo::ChecksumField::ValueType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
#pragma once

#include "cc_tools_qt/cc_tools_qt.h"
#include "cc_plugin/Message.h"
#include "cc_plugin/Stack.h"
#include "cc_plugin/DemoMessage.h"
#include "cc_plugin/DemoStack.h"

namespace demo
{

namespace cc_plugin
{

using TransportMessageFields =
using DemoTransportMessageFields =
std::tuple<
demo::SyncField,
demo::LengthField,
Expand All @@ -39,10 +39,10 @@ using TransportMessageFields =
>;


class TransportMessage : public
class DemoTransportMessage : public
cc_tools_qt::TransportMessageBase<
cc_plugin::Message,
TransportMessageFields
cc_plugin::DemoMessage,
DemoTransportMessageFields
>
{
public:
Expand All @@ -57,7 +57,7 @@ class TransportMessage : public
FieldIdx_NumOfValues
};

static_assert(FieldIdx_NumOfValues == std::tuple_size<TransportMessageFields>::value,
static_assert(FieldIdx_NumOfValues == std::tuple_size<DemoTransportMessageFields>::value,
"Wrong indices");

protected:
Expand Down
4 changes: 2 additions & 2 deletions demo/cc_plugin/message/Bitfields.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "cc_tools_qt/cc_tools_qt.h"
#include "demo/message/Bitfields.h"
#include "cc_plugin/Message.h"
#include "cc_plugin/DemoMessage.h"

namespace demo
{
Expand All @@ -33,7 +33,7 @@ namespace message

class Bitfields : public
cc_tools_qt::ProtocolMessageBase<
demo::message::Bitfields<demo::cc_plugin::Message>,
demo::message::Bitfields<demo::cc_plugin::DemoMessage>,
Bitfields>
{
public:
Expand Down
4 changes: 2 additions & 2 deletions demo/cc_plugin/message/BitmaskValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "cc_tools_qt/cc_tools_qt.h"
#include "demo/message/BitmaskValues.h"
#include "cc_plugin/Message.h"
#include "cc_plugin/DemoMessage.h"

namespace demo
{
Expand All @@ -33,7 +33,7 @@ namespace message

class BitmaskValues : public
cc_tools_qt::ProtocolMessageBase<
demo::message::BitmaskValues<demo::cc_plugin::Message>,
demo::message::BitmaskValues<demo::cc_plugin::DemoMessage>,
BitmaskValues>
{
public:
Expand Down
Loading

0 comments on commit c232e08

Please sign in to comment.