BCI2000RemoteNET
Loading...
Searching...
No Matches
Public Member Functions | Properties | List of all members
BCI2000RemoteNET.BCI2000Connection Class Reference

Provides basic functionality for connection and communication with the BCI2000 operator module. More...

Public Member Functions

void Disconnect ()
 Disconnects from the operator. Terminated the operator if TerminateOperatorOnDisconnect is set.
 
void StartOperator (string operatorPath, string address="127.0.0.1", int port=3999, int delay=200)
 Starts an instance of the BCI2000 Operator on the local machine.
 
void Connect (string address="127.0.0.1", int port=3999)
 Establishes a connection to an instance of BCI2000 running at the specified address and port.
 
bool Connected ()
 Gets whether or not this BCI2000Remote instance is currently connected to the BCI2000 Operator.
 
void Quit ()
 Shuts down the connected BCI2000 instance.
 
Execute< T > (string command)
 Executes the given command and returns the result as type T . Throws if the response cannot be parsed as T . If you are trying to execute a command which does not produce output, use Execute(string, bool).
 
void Execute (string command, bool expectEmptyResponse=true)
 Executes the given command. Will throw if a non-blank response is received from BCI2000 and expectEmptyResponse is not set to false.
 

Properties

int Timeout = 1000 [get, set]
 Timeout value (in milliseconds) of connection to BCI2000.
 
bool TerminateOperatorOnDisconnect = true [get, set]
 Terminate operator when this object is deleted.
 
string WindowTitle [get, set]
 The title of the BCI2000 window.
 

Detailed Description

Provides basic functionality for connection and communication with the BCI2000 operator module.

Member Function Documentation

◆ Connect()

void BCI2000RemoteNET.BCI2000Connection.Connect ( string address = "127.0.0.1",
int port = 3999 )
inline

Establishes a connection to an instance of BCI2000 running at the specified address and port.

Parameters
addressThe IPv4 address to connect to. Note that this may not necessarily be the same as the one used in StartOperator, even if running BCI2000 locally. For example, if the operator was started on the local machine with address 0.0.0.0, you would connect to it at address 127.0.0.1
portThe port on which BCI2000 is listening. If BCI2000 was started locally with StartOperator, this must be the same value.

◆ Connected()

bool BCI2000RemoteNET.BCI2000Connection.Connected ( )
inline

Gets whether or not this BCI2000Remote instance is currently connected to the BCI2000 Operator.

Returns
Whether or not this object is currently connected to BCI2000

◆ Execute()

void BCI2000RemoteNET.BCI2000Connection.Execute ( string command,
bool expectEmptyResponse = true )
inline

Executes the given command. Will throw if a non-blank response is received from BCI2000 and expectEmptyResponse is not set to false.

Parameters
commandThe command to send to BCI2000
expectEmptyResponseBy default, this function will throw if its command receives a non-empty response from BCI2000. This is because most BCI2000 commands which do not return a value will not send a response if they succeed. If set to false, this function will acceept non-empty responses from BCI2000.

◆ Execute< T >()

T BCI2000RemoteNET.BCI2000Connection.Execute< T > ( string command)
inline

Executes the given command and returns the result as type T . Throws if the response cannot be parsed as T . If you are trying to execute a command which does not produce output, use Execute(string, bool).

Template Parameters
TType of the result of the command. Must implement IParsable<TSelf>.
Parameters
commandThe command to execute
Type Constraints
T :IParsable<T> 

◆ StartOperator()

void BCI2000RemoteNET.BCI2000Connection.StartOperator ( string operatorPath,
string address = "127.0.0.1",
int port = 3999,
int delay = 200 )
inline

Starts an instance of the BCI2000 Operator on the local machine.

Parameters
operatorPathThe location of the operator binary
addressThe address on which the Operator will listen for input. Leave as default if you will only connect from the local system. Note on security: BCI2000Remote uses an unencrypted, unsecured telnet connection. Anyone who can access the connection can run BCI2000 shell scripts. This includes the capability to run arbitrary system shell code from the BCI2000 shell interface. Use extreme caution when exposing BCI2000 to the open internet, that is, setting address to a value other than the loopback address (127.0.0.1). Do not leave a connection across machines open unattended. A secure interface is planned for a future release, until then using BCI2000 to communicate between machines on different LANs (not on the same Wi-Fi, in different buildings, etc.) is not recommended. Communication between different machines on the same LAN should be safe provided that the network router does not forward the BCI2000's host machine's BCI2000 port (by default 3999, but can be set on startup.)
portThe port on which the Operator will listen for input. Leave as default unless a specific port is needed.
delayTime in milliseconds to wait after starting operator. This is to prevent failure to connect when the operator takes time to start up.

The documentation for this class was generated from the following file: