diff options
Diffstat (limited to 'mock-server/MockServer.h')
| -rw-r--r-- | mock-server/MockServer.h | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/mock-server/MockServer.h b/mock-server/MockServer.h deleted file mode 100644 index 242cb32..0000000 --- a/mock-server/MockServer.h +++ /dev/null @@ -1,90 +0,0 @@ -/** - * @file MockServer.h - * @brief Mock XPL2 server — connects out to the client on three protocol - * ports. - */ -#pragma once - -#include <QObject> -#include <QTcpSocket> -#include <QTimer> - -class MockServer : public QObject -{ - Q_OBJECT - -public: - explicit MockServer (const QString &host, QObject *parent = nullptr); - static void enableWireDebug (); - -private slots: - void onSocketConnected (); - void onSocketDisconnected (); - void onSocketMessageReady (); - /* Send KA_PING on connected sockets, retry connection on disconnected. */ - void tick (); - void sendJcStatusMsg (); - void sendPhStatusMsg (); - -private: - struct Port - { - QTcpSocket socket; - const char *name = nullptr; - quint16 number = 0; - }; - - void setupPort (Port &port, const char *name, quint16 number); - void connectAll (); - /* Return a fixed-width "[Name:port]" tag for log lines. */ - QString logTag (const QTcpSocket *socket) const; - /* Parse incoming line, log RX, and dispatch to the matching handler. */ - void handleCommand (Port &port, const QByteArray &line); - void sendReply (QTcpSocket &socket, const QByteArray &data); - void handleKaPing (Port &port, const QByteArray ¶ms); - void handleGsJcVersion (QTcpSocket &socket); - void handleGsPhVersion (QTcpSocket &socket, const QByteArray ¶ms); - /* CN_ control command handlers */ - void handleCnJcSuccess (QTcpSocket &socket, const QByteArray &cmd); - void handleCnPhSuccess (QTcpSocket &socket, const QByteArray &cmd, - const QByteArray ¶ms); - void handleCnPhCalibrationData (QTcpSocket &socket, - const QByteArray ¶ms); - void handleCnPhCalibrationRawData (QTcpSocket &socket, - const QByteArray ¶ms); - void handleCnPhCalibratedBaseFrequency (QTcpSocket &socket, - const QByteArray ¶ms); - void handleCnStatusMessagingStart (QTcpSocket &socket, const QByteArray &cmd, - const QByteArray ¶ms); - void handleCnStatusMessagingStop (QTcpSocket &socket, const QByteArray &cmd); - /* CF_ configuration command handlers */ - void handleCfJcSetPurgeSettings (QTcpSocket &socket, - const QByteArray ¶ms); - void handleCfJcSetJettingParams (QTcpSocket &socket, - const QByteArray ¶ms); - void handleCfPhJettingParams (QTcpSocket &socket, const QByteArray &cmd, - const QByteArray ¶ms); - void handleCfJcSetter (QTcpSocket &socket, const QByteArray ¶ms); - void handleCfPhSetter (QTcpSocket &socket, const QByteArray ¶ms); - void handleCfJcGetter (QTcpSocket &socket, const QByteArray ¶ms); - void handleCfPhGetter (QTcpSocket &socket, const QByteArray ¶ms); - /* Imaging command handlers */ - void handleImagingStart (QTcpSocket &socket, const QByteArray ¶ms); - void handleImagingStop (QTcpSocket &socket); - void handleImagingMaskStart (QTcpSocket &socket, const QByteArray &cmd, - const QByteArray ¶ms); - void handleImagingMaskEnd (QTcpSocket &socket, const QByteArray &cmd, - const QByteArray ¶ms); - void handleImageCount (QTcpSocket &socket); - - QString m_host; - Port m_command; - Port m_imaging; - Port m_status; - QTimer m_tickTimer; - QTimer m_jcStatusTimer; - QTimer m_phStatusTimer; - int m_jcStatusLevel = 1; - int m_phStatusLevel = 1; - static bool s_wireDebug; -}; |
