Files
qt-migration-legatus/qt5-before/dlbo/Lts/Services/MeteoDataManagement/tcpweatherstation.cpp
T
torstenandCopilot 7173785915 Qt6 Migration: Complete migration with DDS/RTI support and build validation
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>
2026-09-15 18:20:26 +00:00

106 lines
3.3 KiB
C++

/**
* Handle one weatherstation consist of one wind- and climate sensor
* All data will be send by signal/slot connection in case of data change.
* $Id$
* $HeadURL$
* $Author$
* Created by hjl, SLSE, 2016-09-22
*/
#include "tcpweatherstation.h"
#include "tcpclimate.h"
#include "tcpwind.h"
namespace MeteoDataManagement
{
TcpWeatherStation::TcpWeatherStation(int id,
const QString &converterIp,
quint16 climatePort,
quint16 windPort,
QObject *parent)
: QObject(parent)
, m_id(id)
, m_converterIp(converterIp)
, m_climatePort(climatePort)
, m_windPort(windPort)
, m_tcpClimate(nullptr)
, m_tcpWind(nullptr)
, m_pressure(800.0)
, m_temperature(0.0)
, m_humidity(0.0)
, m_direction(0.0)
, m_speed(0.0)
, m_climateOk(false)
, m_windOk(false)
, m_logger(getLogger("TcpWeatherStation"))
{
INFO_LOG(m_logger) << "Start TcpWeatherStation ip/(hostname): " << m_converterIp
<< " climatePort: " << m_climatePort
<< " windPort: " << m_windPort;
if (m_climatePort)
{
m_tcpClimate = new TcpClimate(this);
INFO_LOG(m_logger) << "m_tcpClimate->start(" << m_converterIp << ", "
<< QString::number(m_climatePort) << ")";
m_tcpClimate->start(m_converterIp, m_climatePort);
connect(m_tcpClimate, &TcpClimate::sigClimateDataChanged,
this, &TcpWeatherStation::onClimateDataChanged);
}
if (m_windPort)
{
m_tcpWind = new TcpWind(this);
INFO_LOG(m_logger) << "m_tcpWind->start(" << m_converterIp << ", "
<< QString::number(m_windPort) << ")";
m_tcpWind->start(m_converterIp, m_windPort);
connect(m_tcpWind, &TcpWind::sigWindDataChanged,
this, &TcpWeatherStation::onWindDataChanged);
}
}
//-------------------------------------------------------------------
void TcpWeatherStation::onClimateDataChanged(float pressure, float temperature, float humidity, bool climateOk)
{
INFO_LOG(m_logger) << "onClimateDataChanged()"
<< " MDU AssetId: " << m_id
<< " pressure: " << pressure
<< " temperature: " << temperature
<< " humidity: " << humidity
<< " climateOk: " << climateOk;
m_pressure = pressure;
m_temperature = temperature;
m_humidity = humidity;
m_climateOk = climateOk;
emit sigWeatherDataChanged(m_id, m_pressure, m_temperature, m_humidity, m_direction, m_speed, m_climateOk, m_windOk);
}
//-------------------------------------------------------------------
void TcpWeatherStation::onWindDataChanged(float direction, float speed, bool windOk)
{
INFO_LOG(m_logger) << "onWindDataChanged()"
<< " MDU AssetId: " << m_id
<< " direction: " << direction
<< " speed: " << speed
<< " climateOk: " << m_climateOk;
m_direction = direction;
m_speed = speed;
m_windOk = windOk;
emit sigWeatherDataChanged(m_id, m_pressure, m_temperature, m_humidity, m_direction, m_speed, m_climateOk, m_windOk);
}
//-------------------------------------------------------------------
} // namespace MeteoDataManagement