- 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>
108 lines
2.3 KiB
C++
108 lines
2.3 KiB
C++
|
|
|
|
#pragma once
|
|
|
|
#include "tcpserver_export.h"
|
|
|
|
#include <QtCore/QObject>
|
|
#include <QtCore/QString>
|
|
#include <QtCore/QVector>
|
|
|
|
class QAbstractSocket;
|
|
class QByteArray;
|
|
class WorkerBase;
|
|
|
|
class TCPSERVER_EXPORT CommandInterface : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit CommandInterface(unsigned short port, const QByteArray& command = QByteArray());
|
|
|
|
virtual ~CommandInterface();
|
|
|
|
void handleCommand(const QVector<QByteArray>& args);
|
|
|
|
virtual void newPlainData();
|
|
|
|
virtual QString help() const = 0;
|
|
|
|
QByteArray command() const;
|
|
|
|
void setAutoWriteEOL(bool newAutoWriteEOL);
|
|
|
|
bool autoWriteEOL() const;
|
|
|
|
bool errorOccured() const;
|
|
|
|
static void setDefaultSuccessMessage(const QString& msg);
|
|
|
|
static void setDefaultErrorMessage(const QString& msg);
|
|
|
|
template <class T> static CommandInterface* factory(unsigned short port)
|
|
{
|
|
return new T(port);
|
|
}
|
|
|
|
virtual void aboutToDestroy() {}
|
|
|
|
protected:
|
|
virtual void handleCommandInternal(const QVector<QByteArray>& args) = 0;
|
|
|
|
void setWriteTimeout(int iMS);
|
|
|
|
void writeData(const QByteArray& payload);
|
|
|
|
void writeData(const char* payload);
|
|
|
|
void writeData(const QString& payload);
|
|
|
|
void writeData(const QStringList& payload);
|
|
|
|
void writeData(const QList<QByteArray>& payload);
|
|
|
|
void writeOk(const QString& additionalMsg = QString());
|
|
|
|
void writeError(const QString& additionalMsg = QString());
|
|
|
|
void writeEOL();
|
|
|
|
QByteArray quote(const QByteArray& payload);
|
|
|
|
QAbstractSocket* socket();
|
|
|
|
void setSocket(QAbstractSocket* socket);
|
|
|
|
WorkerBase* workerBase();
|
|
|
|
void setWorkerBase(WorkerBase* wb);
|
|
|
|
void conversionError(const QByteArray& arg, const QByteArray& type);
|
|
|
|
bool getValue(const QByteArray& arg, bool& value);
|
|
|
|
bool getValue(const QByteArray& arg, long& value);
|
|
|
|
bool getValue(const QByteArray& arg, unsigned long& value);
|
|
|
|
bool getValue(const QByteArray& arg, int& value);
|
|
|
|
bool getValue(const QByteArray& arg, unsigned int& value);
|
|
|
|
bool getValue(const QByteArray& arg, float& value);
|
|
|
|
bool getValue(const QByteArray& arg, double& value);
|
|
|
|
unsigned short port() const;
|
|
|
|
void closeConnection();
|
|
|
|
bool socketIsOpen() const;
|
|
|
|
private:
|
|
friend class WorkerBase;
|
|
|
|
class Private;
|
|
|
|
Private* const d;
|
|
};
|