Skip to content

Commit

Permalink
Merge pull request #28 from OpenDDS/opendds-3.27
Browse files Browse the repository at this point in the history
Update for Current OpenDDS master and Minor CMake Cleanup
  • Loading branch information
iguessthislldo authored Feb 6, 2024
2 parents c1b4b51 + 935cb6b commit 565e6c3
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 28 deletions.
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ endif()

find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui PrintSupport Svg OpenGL OPTIONAL_COMPONENTS ${qt_optional_components})

if(${QWT_IS_LOCAL})
if(QWT_IS_LOCAL)
set(QWT_LIBRARY ${PROJECT_SOURCE_DIR}/qwt/lib/qwt$<$<CONFIG:DEBUG>:d>.lib)
set(QWT_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/qwt/src)
else()
Expand Down Expand Up @@ -121,8 +121,6 @@ endif()

target_compile_options(monitor PRIVATE $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>: -Wall -Wextra -Wpedantic -Wno-unused -Wunused-parameter> $<$<CXX_COMPILER_ID:MSVC>: /W4>)

add_dependencies(monitor OpenDDW)

target_link_libraries(monitor
OpenDDW
${QWT_LIBRARY}
Expand Down
25 changes: 14 additions & 11 deletions FindQwt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,21 @@ FIND_PATH(QWT_INCLUDE_DIR NAMES qwt.h PATHS
PATH_SUFFIXES qwt-qt5 qwt qwt6 qt5/qwt
)

IF (QWT_INCLUDE_DIR AND QWT_LIBRARY)
SET(QWT_FOUND TRUE)
ENDIF (QWT_INCLUDE_DIR AND QWT_LIBRARY)
if(QWT_INCLUDE_DIR AND QWT_LIBRARY)
set(Qwt_FOUND TRUE)

IF (QWT_FOUND)
FILE(READ ${QWT_INCLUDE_DIR}/qwt_global.h qwt_header)
STRING(REGEX REPLACE "^.*QWT_VERSION_STR +\"([^\"]+)\".*$" "\\1" QWT_VERSION_STR "${qwt_header}")
IF (NOT QWT_FIND_QUIETLY)

if(NOT Qwt_FIND_QUIETLY)
MESSAGE(STATUS "Found Qwt: ${QWT_LIBRARY} (${QWT_VERSION_STR})")
ENDIF (NOT QWT_FIND_QUIETLY)
ELSE (QWT_FOUND)
IF (QWT_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Qwt")
ENDIF (QWT_FIND_REQUIRED)
ENDIF (QWT_FOUND)
endif()
else()
set(Qwt_FOUND FALSE)

if(Qwt_FIND_REQUIRED)
message(FATAL_ERROR "Could not find required Qwt")
elseif(NOT Qwt_FIND_QUIETLY)
message(STATUS "Could not find optional Qwt")
endif()
endif()
33 changes: 21 additions & 12 deletions src/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ DDSMonitorMainWindow::DDSMonitorMainWindow() :
{
// Prompt the user for the domain selection
domainID = settings.value("domainID").toInt();

domainID = QInputDialog::getInt(
this, "Join Domain", "Join DDS Domain:", domainID, -1, 232, 1, &ok);
}
Expand All @@ -67,7 +67,8 @@ DDSMonitorMainWindow::DDSMonitorMainWindow() :
// Join the DDS domain
CommonData::m_ddsManager = std::make_unique<DDSManager>();
m_participantPage = new ParticipantPage(mainTabWidget);
CommonData::m_ddsManager->joinDomain(domainID, "", [page = m_participantPage](const ParticipantInfo& info) {page->addParticipant(info); },
CommonData::m_ddsManager->joinDomain(domainID, "",
[page = m_participantPage](const ParticipantInfo& info) {page->addParticipant(info); },
[page = m_participantPage](const ParticipantInfo& info) {page->removeParticipant(info); });
m_publicationMonitor = std::make_unique<PublicationMonitor>();
m_subscriptionMonitor = std::make_unique<SubscriptionMonitor>();
Expand Down Expand Up @@ -352,18 +353,18 @@ void DDSMonitorMainWindow::reportConfig() const
if (discoveryMap.find(discoveryKey) != discoveryMap.end())
{
const OpenDDS::DCPS::Discovery_rch discoveryInfo = discoveryMap.at(discoveryKey);
const OpenDDS::RTPS::RtpsDiscovery* rtspInfo =
const OpenDDS::RTPS::RtpsDiscovery* rtpsInfo =
dynamic_cast<const OpenDDS::RTPS::RtpsDiscovery*>
(discoveryInfo.in());

// Only care about RTPS for now
if (rtspInfo)
if (rtpsInfo)
{
// Ports are defined from RTPS discovery spec
const uint16_t pb = rtspInfo->pb(); // Port base [7400]
const uint16_t dg = rtspInfo->dg(); // Domain ID gain [250]
const uint16_t pb = rtpsInfo->pb(); // Port base [7400]
const uint16_t dg = rtpsInfo->dg(); // Domain ID gain [250]
//const uint16_t pg = rtspInfo->pg(); // Participant ID gain [2]
const uint16_t d0 = rtspInfo->d0(); // Discovery multicast port offset [0]
const uint16_t d0 = rtpsInfo->d0(); // Discovery multicast port offset [0]
//const uint16_t d1 = rtspInfo->d1(); // Discovery unicast port offset [10]
//const uint16_t d2 = 1; // User data multicast port offset
//const uint16_t d3 = 11; // User data unicast port offset
Expand All @@ -375,7 +376,11 @@ void DDSMonitorMainWindow::reportConfig() const
//const uint16_t userMulicastPort = pb + (dg * domainID) + d2;

std::cout << "\nDiscovery multicast: "
<< rtspInfo->default_multicast_group().get_host_addr()
<< rtpsInfo->default_multicast_group(
#if OPENDDS_VERSION_AT_LEAST(3, 27, 0)
domainID).to_addr(
#endif
).get_host_addr()
<< ":"
<< discoveryMulicastPort
//<< "\nDiscovery unicast: "
Expand All @@ -399,11 +404,11 @@ void DDSMonitorMainWindow::reportConfig() const
//<< "\nGUID interface: "
//<< rtspInfo->guid_interface()
<< "\nSupports liveliness: "
<< rtspInfo->supports_liveliness()
<< rtpsInfo->supports_liveliness()
<< "\nResend period: "
<< rtspInfo->resend_period().to_dds_duration().sec
<< rtpsInfo->resend_period().to_dds_duration().sec
<< "\nTTL: "
<< static_cast<int>(rtspInfo->ttl())
<< static_cast<int>(rtpsInfo->ttl())
//<< "\nPB: " << pb
//<< "\nDG: " << dg
//<< "\nPG: " << pg
Expand Down Expand Up @@ -438,7 +443,11 @@ void DDSMonitorMainWindow::reportConfig() const
const OpenDDS::DCPS::TransportInst_rch transportInstance =
transportConfig->instances_[i];

std::cout << transportInstance->dump_to_str() << "\n";
std::cout << transportInstance->dump_to_str(
#if OPENDDS_VERSION_AT_LEAST(3, 27, 0)
domainID
#endif
) << "\n";
}

} // End DDSMonitorMainWindow::reportConfig
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.20)

project(opendds-monitor-tests VERSION 0.0.1 LANGUAGES CXX)

Expand Down
2 changes: 1 addition & 1 deletion thirdparty/OpenDDW

0 comments on commit 565e6c3

Please sign in to comment.