User Reference:SignalSharing: Difference between revisions
No edit summary |
|||
| Line 6: | Line 6: | ||
When the client application is running on a separate machine, full signal data are sent over the network. When the client is running on the same machine, only a reference to a shared memory block is sent. On the client side, a flag in the signal data block indicates whether full signal data is transmitted, or just the name of a shared memory block to which the client may connect in order to read data. | When the client application is running on a separate machine, full signal data are sent over the network. When the client is running on the same machine, only a reference to a shared memory block is sent. On the client side, a flag in the signal data block indicates whether full signal data is transmitted, or just the name of a shared memory block to which the client may connect in order to read data. | ||
To facilitate consistency with the [[Technical_Reference:States_of_Operation|BCI2000 model of operation]], ''SignalSharing'' is operating as a TCP client rather than a server. When BCI2000 goes into <tt>Initialization</tt> state, the client tries to connect to a TCP server that will receive the data. This will appear confusing at first because the ''client application'' needs to act as a server, but it is more flexible as the BCI2000 ''SignalSharing'' component may open and close connections, and send data, as it fits the current BCI2000 state of operation. | |||
==Data Transmission== | |||
Immediately after opening the connection, ''SignalSharing'' sends a [[Technical_Reference:BCI2000_Messages#Descriptor_Supplement=3:_Signal_Properties|SignalProperties]] message to announce meta-information about the filter's output signal, such as channel names, physical units, etc. | |||
Subsequently, [[Technical_Reference:BCI2000_Messages#Descriptor_Supplement=1:_Signal_Data|signal data]] are sent whenever a signal leaves the filter for which ''SignalSharing'' is enabled. | |||
Revision as of 14:03, 2 August 2024
Synopsis
SignalSharing allows to tap into BCI2000 processing by receiving any filter output signal through a combination of a TCP connection, and shared memory.
Function
The SignalSharing component in BCI2000 shares its input signal through a GenericSignal object which has been linked to a shared memory block using GenericSignal::ShareAcrossModules(). A dedicated thread waits for signal updates, and sends signal data out to a separate application waiting on a TCP/IP connection.
When the client application is running on a separate machine, full signal data are sent over the network. When the client is running on the same machine, only a reference to a shared memory block is sent. On the client side, a flag in the signal data block indicates whether full signal data is transmitted, or just the name of a shared memory block to which the client may connect in order to read data.
To facilitate consistency with the BCI2000 model of operation, SignalSharing is operating as a TCP client rather than a server. When BCI2000 goes into Initialization state, the client tries to connect to a TCP server that will receive the data. This will appear confusing at first because the client application needs to act as a server, but it is more flexible as the BCI2000 SignalSharing component may open and close connections, and send data, as it fits the current BCI2000 state of operation.
Data Transmission
Immediately after opening the connection, SignalSharing sends a SignalProperties message to announce meta-information about the filter's output signal, such as channel names, physical units, etc.
Subsequently, signal data are sent whenever a signal leaves the filter for which SignalSharing is enabled.