aboutsummaryrefslogtreecommitdiffstats
path: root/src/Xpl2Client.h
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-03-13 18:20:35 +0100
committerThomas Vanbesien <tvanbesi@proton.me>2026-03-13 18:20:35 +0100
commit87169e10cb7ebe732ef388552bb0c057c09767ef (patch)
treefba2c9e2255cb02553c43fb37d653a47574824ba /src/Xpl2Client.h
parent02fe86ab2a04a02b114d7ca8ce4374a29a1d5f45 (diff)
downloadQtXpl2-87169e10cb7ebe732ef388552bb0c057c09767ef.tar.gz
QtXpl2-87169e10cb7ebe732ef388552bb0c057c09767ef.zip
Unified socket slots, --wire-debug CLI flag, fix mock TX and disconnect logging
Collapse 12 per-socket slots into 4 sender()-based slots. Replace runtime wireDebug QML property with static --wire-debug CLI flag on both demo and mock server. Route MockServer::sendKaPing through sendReply so KA_PING TX shows wire bytes. Simplify sendReply to deduce command token from wire data. Fix Xpl2Client disconnect logging (logTag takes pointer, null-sender fallback).
Diffstat (limited to 'src/Xpl2Client.h')
-rw-r--r--src/Xpl2Client.h28
1 files changed, 8 insertions, 20 deletions
diff --git a/src/Xpl2Client.h b/src/Xpl2Client.h
index 9212771..41729fd 100644
--- a/src/Xpl2Client.h
+++ b/src/Xpl2Client.h
@@ -18,8 +18,6 @@ class Xpl2Client : public QObject
Q_PROPERTY (QString host READ host WRITE setHost NOTIFY hostChanged)
Q_PROPERTY (bool connected READ isConnected NOTIFY connectedChanged)
- Q_PROPERTY (
- bool wireDebug READ wireDebug WRITE setWireDebug NOTIFY wireDebugChanged)
Q_PROPERTY (int controllerId READ controllerId NOTIFY jcVersionReceived)
Q_PROPERTY (
QString firmwareVersion READ firmwareVersion NOTIFY jcVersionReceived)
@@ -35,14 +33,13 @@ public:
bool isConnected () const;
- bool wireDebug () const;
- void setWireDebug (bool enabled);
-
int controllerId () const;
QString firmwareVersion () const;
QString hardwareVersion () const;
int printheadCount () const;
+ static void enableWireDebug ();
+
Q_INVOKABLE void connectToServer ();
Q_INVOKABLE void disconnectFromServer ();
Q_INVOKABLE void getJcVersion ();
@@ -50,25 +47,15 @@ public:
signals:
void hostChanged ();
void connectedChanged ();
- void wireDebugChanged ();
void errorOccurred (const QString &error);
void statusMessage (const QString &message);
- void wireDebugMessage (const QString &message);
void jcVersionReceived ();
private slots:
- void onCommandSocketConnected ();
- void onCommandSocketDisconnected ();
- void onCommandSocketMessageReady ();
- void onCommandSocketError (QAbstractSocket::SocketError error);
- void onImagingSocketConnected ();
- void onImagingSocketDisconnected ();
- void onImagingSocketMessageReady ();
- void onImagingSocketError (QAbstractSocket::SocketError error);
- void onStatusSocketConnected ();
- void onStatusSocketDisconnected ();
- void onStatusSocketMessageReady ();
- void onStatusSocketError (QAbstractSocket::SocketError error);
+ void onSocketConnected ();
+ void onSocketDisconnected ();
+ void onSocketMessageReady ();
+ void onSocketError (QAbstractSocket::SocketError error);
private:
void sendCommand (QTcpSocket &socket, const QByteArray &command,
@@ -79,6 +66,7 @@ private:
void handleKaPing (QTcpSocket &socket);
void handleGsJcVersion (const QVariantList &params);
void updateConnectedState ();
+ QString logTag (const QTcpSocket *socket) const;
QTcpSocket m_commandSocket;
QTcpSocket m_imagingSocket;
@@ -88,7 +76,7 @@ private:
quint16 m_imagingPort = 9111;
quint16 m_statusPort = 9112;
bool m_connected = false;
- bool m_wireDebug = false;
+ static bool s_wireDebug;
int m_controllerId = 0;
QString m_firmwareVersion;
QString m_hardwareVersion;