Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list
Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF
Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
- Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
- Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)
Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified
Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
128 lines
2.9 KiB
C++
128 lines
2.9 KiB
C++
/**
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
|
|
#include "mainthread.h"
|
|
|
|
#include "tetra_if_impl.h"
|
|
#include "trimble_if.h"
|
|
|
|
#include <QMutexLocker>
|
|
#include <QTimer>
|
|
#include <DDS/Core/pacemaker.h>
|
|
|
|
namespace DifferentialGPS
|
|
{
|
|
MainThread::MainThread(QObject *parent)
|
|
: QObject(parent)
|
|
, m_ddsHandler(nullptr)
|
|
, m_dgpsTimer(new QTimer(this))
|
|
, m_tetraIfNum(0)
|
|
, m_trimbleIfNum(0)
|
|
, m_logger(getLogger("MainThread"))
|
|
, m_broadcastTime(QTime::currentTime())
|
|
, m_broadcastCycle_ms(10000)
|
|
{
|
|
m_tetraIF[0] = new TetraImpl;
|
|
m_tetraIF[1] = new TetraImpl;
|
|
|
|
m_trimbleIF[0] = new TrimbleIF;
|
|
m_trimbleIF[1] = new TrimbleIF;
|
|
|
|
connect(this, &MainThread::newDataAvailable,
|
|
m_tetraIF[m_tetraIfNum], &TetraImpl::onNewDataAvailable,
|
|
Qt::QueuedConnection);
|
|
|
|
}
|
|
|
|
MainThread::~MainThread()
|
|
{
|
|
m_ddsHandler = nullptr;
|
|
|
|
m_tetraIF[0]->quit();
|
|
m_tetraIF[1]->quit();
|
|
m_trimbleIF[0]->quit();
|
|
m_trimbleIF[1]->quit();
|
|
|
|
m_tetraIF[0]->wait();
|
|
m_tetraIF[1]->wait();
|
|
m_trimbleIF[0]->wait();
|
|
m_trimbleIF[1]->wait();
|
|
|
|
delete m_tetraIF[0];
|
|
delete m_tetraIF[1];
|
|
delete m_trimbleIF[0];
|
|
delete m_trimbleIF[1];
|
|
}
|
|
|
|
|
|
bool MainThread::init(int domainId)
|
|
{
|
|
m_ddsHandler.reset(new DdsHandler(domainId));
|
|
if (!m_ddsHandler->init())
|
|
{
|
|
ERROR_LOG(m_logger) << "Initialisation DdsHandler failed.";
|
|
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError);
|
|
return false;
|
|
}
|
|
|
|
m_trimbleIF[0]->startThread(0, this);
|
|
m_trimbleIF[1]->startThread(1, this);
|
|
|
|
m_tetraIF[m_tetraIfNum]->startThread(m_tetraIfNum, this);
|
|
|
|
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::Running);
|
|
return true;
|
|
}
|
|
|
|
void MainThread::addNewData(const QByteArray &ba, int trimbleIfNum)
|
|
{
|
|
const int cycle_ms = m_broadcastCycle_ms + (m_broadcastCycle_ms / 5); // Zykluszeit + 20%
|
|
QTime currentTime = QTime::currentTime();
|
|
|
|
bool overtake = (trimbleIfNum == m_trimbleIfNum);
|
|
if (!overtake)
|
|
{
|
|
if (m_broadcastTime.msecsTo(currentTime) > cycle_ms)
|
|
{
|
|
overtake = true;
|
|
m_trimbleIfNum = trimbleIfNum; // Lese ab jetzt bevorzugt von diesem IF
|
|
}
|
|
}
|
|
|
|
if (overtake)
|
|
{
|
|
QMutexLocker l(&m_mutex);
|
|
m_dgpsData = ba;
|
|
if (m_tetraIF[m_tetraIfNum]->isRunning())
|
|
emit newDataAvailable();
|
|
else
|
|
{
|
|
disconnect(this, &MainThread::newDataAvailable,
|
|
m_tetraIF[m_tetraIfNum], &TetraImpl::onNewDataAvailable);
|
|
m_tetraIfNum = (m_tetraIfNum + 1) % 2;
|
|
connect(this, &MainThread::newDataAvailable,
|
|
m_tetraIF[m_tetraIfNum], &TetraImpl::onNewDataAvailable,
|
|
Qt::QueuedConnection);
|
|
|
|
m_tetraIF[m_tetraIfNum]->startThread(m_tetraIfNum, this);
|
|
}
|
|
|
|
m_broadcastTime = currentTime; // Die Broadcast-Zeit merken
|
|
}
|
|
|
|
}
|
|
|
|
bool MainThread::getNewData(QByteArray &ba)
|
|
{
|
|
QMutexLocker l(&m_mutex);
|
|
if (!m_dgpsData.size())
|
|
return false;
|
|
ba = m_dgpsData;
|
|
|
|
return true;
|
|
}
|
|
} // namespace DifferentialGPS
|