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

Self-contained worker thread that owns the command and data sockets to a running mne_rt_server. More...

#include "../com_global.h"
#include <fiff/fiff_info.h>
#include <QMutex>
#include <QSharedPointer>
#include <QString>
#include <QThread>
#include <Eigen/Core>
Include dependency graph for rt_client.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  COMLIB::RtClient
 Threaded façade that owns a paired command/data connection to mne_rt_server and re-emits streamed buffers. More...

Namespaces

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

Macros

#define metatype_matrixxf

Functions

 Q_DECLARE_METATYPE (Eigen::MatrixXf)

Detailed Description

Self-contained worker thread that owns the command and data sockets to a running mne_rt_server.

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::RtClient is the high-level convenience wrapper around the two lower-level sockets in this directory: it constructs a private COMLIB::RtCmdClient and COMLIB::RtDataClient, performs the full negotiation handshake (request a client id on the command port, register the alias against the same id on the data port, query the FiffInfo, request a buffer size) and then sits in a run() loop pulling raw sample matrices off the data socket and re-emitting them as Qt signals on the owning thread.

The class inherits QThread directly rather than the now-preferred worker-object pattern because it predates that idiom and because the tight read/parse/emit loop benefits from running entirely inside run(); subclassing remains backwards-compatible with the acquisition plugins that already use it. Communication with the owning thread is one-way: rawBufferReceived() carries an Eigen::MatrixXf of n_channels × buffer_size samples, connectionChanged() flips on the first successful TCP connect and on any subsequent disconnect.

Lifetime is cooperative: stop() clears the running flag, the run() loop notices, the sockets are disconnected and the thread exits, after which wait() / destruction is safe. Reconnects after a server restart are not handled here — callers destroy the client and construct a new one.

Definition in file rt_client.h.

Macro Definition Documentation

◆ metatype_matrixxf

#define metatype_matrixxf

Definition at line 180 of file rt_client.h.

Function Documentation

◆ Q_DECLARE_METATYPE()

Q_DECLARE_METATYPE ( Eigen::MatrixXf )

Provides QT META type declaration of the Eigen::MatrixXf type. For signal/slot usage.