Skip to content

Commit

Permalink
Preliminary testing of the using signals instead of callback in the l…
Browse files Browse the repository at this point in the history
…ibrary classes.
  • Loading branch information
arobenko committed Nov 7, 2024
1 parent 764168f commit f5361b6
Show file tree
Hide file tree
Showing 12 changed files with 154 additions and 133 deletions.
107 changes: 102 additions & 5 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,106 @@
add_subdirectory (src)
function (lib_tools)
set (name "${PROJECT_NAME}")

set (src
src/field/ToolsArrayListField.cpp
src/field/ToolsBitfieldField.cpp
src/field/ToolsBitmaskField.cpp
src/field/ToolsBundleField.cpp
src/field/ToolsEnumField.cpp
src/field/ToolsFloatField.cpp
src/field/ToolsIntField.cpp
src/field/ToolsOptionalField.cpp
src/field/ToolsRawDataField.cpp
src/field/ToolsStringField.cpp
src/field/ToolsUnknownField.cpp
src/field/ToolsUnsignedLongField.cpp
src/field/ToolsVariantField.cpp
src/property/message.cpp
src/ToolsConfigMgr.cpp
src/ToolsDataInfo.cpp
src/ToolsField.cpp
src/ToolsFieldHandler.cpp
src/ToolsFilter.cpp
src/ToolsFrame.cpp
src/ToolsMessage.cpp
src/ToolsMsgFactory.cpp
src/ToolsMsgFileMgr.cpp
src/ToolsMsgMgr.cpp
src/ToolsMsgMgrImpl.cpp
src/ToolsMsgSendMgr.cpp
src/ToolsMsgSendMgrImpl.cpp
src/ToolsPlugin.cpp
src/ToolsPluginMgr.cpp
src/ToolsPluginMgrImpl.cpp
src/ToolsProtocol.cpp
src/ToolsSocket.cpp
)

qt_wrap_cpp(
moc
include/cc_tools_qt/ToolsSocket.h
)

add_library(${name} SHARED ${src} ${moc})
add_library (cc::${PROJECT_NAME} ALIAS ${name})

if (CC_TOOLS_QT_INSTALL_LIBRARY_HEADERS)
target_link_libraries(${name} PUBLIC cc::comms Qt::Core ${CC_PLATFORM_SPECIFIC})
target_include_directories(${name} BEFORE
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
INTERFACE
$<INSTALL_INTERFACE:include>
)

target_compile_definitions(${name} PRIVATE -DCC_TOOLS_QT_EXPORT)
target_compile_options(${name} PUBLIC
$<$<CXX_COMPILER_ID:MSVC>:/bigobj /wd4127 /wd5054 /wd5240>
)

set_target_properties(${name} PROPERTIES VERSION ${CC_TOOLS_QT_VERSION})

install (
DIRECTORY "include/cc_tools_qt"
DESTINATION ${INC_INSTALL_DIR}
TARGETS ${name} EXPORT ${name}Export
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
)
endif()

if (CC_TOOLS_QT_INSTALL_LIBRARY_HEADERS)
install(EXPORT ${name}Export NAMESPACE cc::
DESTINATION ${LIB_INSTALL_DIR}/${INSTALL_NAME}/cmake
)
endif ()

if (CC_TOOLS_QT_INSTALL_LIBRARY_HEADERS)
install (
DIRECTORY "include/cc_tools_qt"
DESTINATION ${INC_INSTALL_DIR}
)
endif()

endfunction ()

###########################################################

if (WIN32)
if (NOT "${Qt${CC_TOOLS_QT_MAJOR_QT_VERSION}_DIR}" STREQUAL "")
find_library(QTPLATFORMSUPPORT_REL Qt${CC_TOOLS_QT_MAJOR_QT_VERSION}PlatformSupport HINTS "${Qt${CC_TOOLS_QT_MAJOR_QT_VERSION}_DIR}/lib")
find_library(QTPLATFORMSUPPORT_DEB Qt${CC_TOOLS_QT_MAJOR_QT_VERSION}PlatformSupportd HINTS "${Qt${CC_TOOLS_QT_MAJOR_QT_VERSION}_DIR}/lib")
set(QTPLATFORMSUPPORT optimized ${QTPLATFORMSUPPORT_REL} debug ${QTPLATFORMSUPPORT_DEB})
endif ()

if (NOT QTPLATFORMSUPPORT)
set (QTPLATFORMSUPPORT)
endif ()

set (CC_PLATFORM_SPECIFIC ${QTPLATFORMSUPPORT} Setupapi.lib Ws2_32.lib opengl32.lib imm32.lib winmm.lib)

endif ()

lib_tools()



15 changes: 10 additions & 5 deletions lib/include/cc_tools_qt/ToolsSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
#include "cc_tools_qt/ToolsApi.h"
#include "cc_tools_qt/ToolsDataInfo.h"

#include <QtCore/QObject>
#include <QtCore/QString>

#include <cstdint>
#include <cstddef>
#include <memory>
#include <vector>
#include <functional>

Expand All @@ -35,8 +37,9 @@ namespace cc_tools_qt
/// @details It is used by @b CommsChampion @b Tools to drive low level
/// I/O operations.
/// @headerfile cc_tools_qt/ToolsSocket.h
class CC_TOOLS_API ToolsSocket
class CC_TOOLS_API ToolsSocket : public QObject
{
Q_OBJECT
public:
/// @brief Available socket connection properties values.
enum ConnectionProperty
Expand Down Expand Up @@ -157,6 +160,9 @@ class CC_TOOLS_API ToolsSocket
/// @param[in] level Debug level. If @b 0, debug output is disabled
void setDebugOutputLevel(unsigned level = 0U);

signals:
void sigInterPluginConfigReport(const QVariantMap& props) ;

protected:
/// @brief Polymorphic start functionality implementation.
/// @details Invoked by start() and default implementation does nothing.
Expand Down Expand Up @@ -232,14 +238,13 @@ class CC_TOOLS_API ToolsSocket
unsigned getDebugOutputLevel() const;

private:
struct InnerState;
std::unique_ptr<InnerState> m_state;

DataReceivedCallback m_dataReceivedCallback;
ErrorReportCallback m_errorReportCallback;
ConnectionStatusReportCallback m_connectionStatusReportCallback;
InterPluginConfigReportCallback m_interPluginConfigReportCallback;

unsigned m_debugLevel = 0U;
bool m_running = false;
bool m_connected = false;
};

/// @brief Pointer to @ref ToolsSocket object.
Expand Down
91 changes: 0 additions & 91 deletions lib/src/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit f5361b6

Please sign in to comment.