v2.0.0
Loading...
Searching...
No Matches
rt_cmd_client.h File Reference

TCP client for the mne_rt_server command port (4217): negotiates session state via line- or JSON-encoded messages. More...

#include "../com_global.h"
#include "../rt_command/command_manager.h"
#include "../rt_command/command.h"
#include <QDataStream>
#include <QMutex>
#include <QSharedPointer>
#include <QString>
#include <QTcpSocket>
Include dependency graph for rt_cmd_client.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  COMLIB::RtCmdClient
 QTcpSocket subclass driving the mne_rt_server control channel (default port 4217). More...

Namespaces

namespace  COMLIB
 Real-time client/server communication primitives for talking to mne_rt_server.

Detailed Description

TCP client for the mne_rt_server command port (4217): negotiates session state via line- or JSON-encoded messages.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors

Author
Christoph Dinh chris.nosp@m.toph.nosp@m..dinh.nosp@m.@mne.nosp@m.-cpp..nosp@m.org
Since
2.0.0
Date
March 2026

COMLIB::RtCmdClient is a QTcpSocket subclass that drives the server’s control channel. Two equivalent wire encodings are supported: plain CLI strings (newline-terminated tokens) for interactive shell use, and JSON command objects for programmatic clients. Both are produced from the same COMLIB::Command vocabulary so the help text, parameter list and reply parsing stay in lock-step regardless of which transport a caller picks.

The client maintains an internal COMLIB::CommandManager that is populated on demand by requestCommands(); after that round-trip the [] operator and hasCommand() expose the server’s self-described vocabulary so callers can ask, for example, client["start-measurement"] without hard-coding the parameter list locally. requestBufsize() and requestConnectors() are convenience wrappers around the corresponding server commands used during the COMLIB::RtClient handshake.

All socket reads are funnelled through waitForDataAvailable() and accumulated into m_sAvailableData, which readAvailableData() drains atomically under m_qMutex. The response(QString) signal fires whenever a complete reply has been collected so callers running in the GUI thread can react without polling the socket directly.

Definition in file rt_cmd_client.h.