Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Services/MeteoDataManagement/tcpclimate.h
T
torstenandCopilot 7a6be7474e Qt6 migration: Fix BUILD_RTI=OFF build errors in TrainingAreaBase
- training_area_telegrams.cpp: Fixed QJsonObject initializer syntax (Qt6 requires {{}} not ({}))
- training_area_telegrams.cpp: Fixed fromJson() methods to access m_* members directly
- training_area_telegrams.cpp: Fixed brace mismatches in multiple toJson() methods
- training_area_telegrams.h: Changed Header struct to public members for consistency
- tx_mixin.cpp: Fixed getEquipmentNumber() template for direct member access
- lts_coordinate.cpp: Added missing #include <iomanip>
- MIGRATION_STATUS.md: Added migration progress tracking document

C++17 constraint enforced due to RTI Connext DDS 7.7.0 incompatibility with C++20+

Build status: BUILD_RTI=OFF successful (0 errors, warnings only)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-23 20:49:23 +02:00

90 lines
2.5 KiB
C++
Executable File

/**
* Handle one climate sensor
* Requests for climate sensor data in an given interval.
* All data will be send by signal/slot connection in case of data change.
* $Id$
* $HeadURL$
* $Author$
* Created by hjl, SLSE, 2016-09-22
*/
#pragma once
#include <QtCore/QTimer>
#include "tcpsocket.h"
namespace MeteoDataManagement
{
class TcpClimate final : public TcpSocket
{
Q_OBJECT
public:
explicit TcpClimate(QObject *parent = nullptr);
/**
* Connect to converter and starts reading sensor data
* @param[in] converterIp IP address of the RS232-LAN Converter
* @param[in] climatePort Port number of climate sensor on the RS232-LAN Converter
*/
void start(const QString &converterIp, quint16 climatePort);
Q_SIGNALS:
/**
* Emits signal if data were changed
*/
void sigClimateDataChanged(float pressure, float temperature, float humidity, bool climateOk);
protected Q_SLOTS:
/**
* Requests for new sensor data
*/
void onSensorDataRequest();
/**
* Timeout for new sensor data request
*/
void onRequestTimeout();
protected:
NGL::INGLLogger &m_logger;
/**
* pure virtual function from TcpSocket to initialize the especially sensor device
*/
void init() override;
/**
* pure virtual function from TcpSocket to to handle the especially sensor device data
*/
void dataAvailable(const QByteArray &line) override;
/**
* Extract sensor data from given data line
* @param[in] line data line to be extacted
* @return False if an error occurded, otherwise true;
*/
bool extractDataFromLine(const QByteArray &line);
/**
* Extract especially value from given data line
* @param[in] line data line to be extracted
* @param[in] startKey extraction starts after startkey
* @param[in] endKey extraction stops before endkey
* @param[in/out] retValue reference to return value
* @return False if an error occurded, otherwise true;
*/
bool extractValueFromLine(const QByteArray &line, const QByteArray &startKey, const QByteArray &endKey, float &retValue);
QTimer *m_requestTimer; ///< Request Interval in msec
QTimer *m_requestTimeoutTimer; ///< Request Timeout in mse
float m_pressure; ///< pressure in hPa
float m_temperature; ///< temperature in Grad C
float m_humidity; ///< humidity in %
bool m_dataChanged; ///< if true, sensor data were changed
};
} // namespace MeteoDataManagement