BCI2000RemoteNET
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
BCI2000RemoteNET.BCI2000Remote Class Reference

Provides functionality for control of BCI2000. More...

Public Types

enum  SystemState {
  Idle , Startup , Initialization , Connected ,
  Resting , Suspended , ParamsModified , Running ,
  Termination , Busy
}
 BCI2000 Operator states of operation, as documented on the <anchor xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://www.bci2000.org/mediawiki/index.php/User_Reference:Operator_Module_Scripting#WAIT_FOR_%3Csystem_state%3E_[%3Ctimeout_seconds%3E]">BCI2000 Wiki</anchor>
 

Public Member Functions

 BCI2000Remote (BCI2000Connection connection)
 Constructor for BCI2000Remote
 
void StartupModules (IDictionary< string, IEnumerable< string >?> modules)
 Starts up the specified BCI2000 modules.
 
bool WaitForSystemState (SystemState state, double? timeout=null)
 Waits for the system to be in the specified state. This will block until the system is in the specified state.
 
bool WaitForSystemState (SystemState[] states, double? timeout=null)
 Waits for the system to be in one of the specified states. This will block until the system is in the specified state.
 
SystemState GetSystemState ()
 Gets the current system state

Exceptions
BCI2000CommandExceptionIf response cannot be parsed into a valid system state

 
void SetConfig ()
 Sets BCI2000 config, readying it to run. Past this point no parameter changes can be made.
 
void Start ()
 Starts a BCI2000 run, setting config if necessary.
 
void Stop ()
 Stops a BCI2000 run.
 
void AddParameter (string section, string name, string defaultValue="%", string minValue="%", string maxValue="%")
 Adds a parameter to BCI2000. Must be called before StartupModules(Dictionary<string, List<string>>). BCI2000RemoteNET provides no abstraction over BCI2000 parameters. It treats them as strings, and declares them within BCI2000 as the dynamic variant type.
 
void LoadParameters (string filename)
 Loads the specified .prm file. If filename is relative, it is relative to the working directory of BCI2000, which will most likely be the prog directory in the BCI2000 directory. Must be called before StartupModules(Dictionary<string, List<string>>).
 
void SetParameter (string name, string value)
 Sets a BCI2000 parameter. This must be called while the operator is in the Idle or Connected states.
 
string GetParameter (string name)
 Gets the value of a BCI2000 parameter.
 
void AddState (string name, int bitWidth, UInt32 initialValue=0)
 Adds a state variable to BCI2000. State variables have a temporal resolution of one block. To log values with a higher temporal resolution, use AddEvent Must be called when BCI2000 is in the Idle system state.
 
void SetState (string name, UInt32 value)
 Sets the specified state to the specified value.
 
UInt32 GetState (string name)
 Gets the value of the specified state.
 
void AddEvent (string name, int bitWidth, UInt32 initialValue=0)
 Adds an event to BCI2000. Events are similar to state variables but with a temporal resolution of one sample. Must be called when BCI2000 is in the Idle system state.
 
void SetEvent (string name, UInt32 value)
 Sets the specified event to the specified value. To set an event for a single sample duration, use PulseEvent(string, uint)
 
void PulseEvent (string name, UInt32 value)
 Sets the specified event to the specified value for a single sample duration. To set an event to a persistent value, use SetEvent(string, uint)
 
double GetSignal (int channel, int element)
 Gets the value of the signal at the specified channel and element
 
UInt32 GetEvent (string name)
 Gets the value of the specified event.
 
void Visualize (string value)
 Visualizes a BCI2000 value, for example, an event.
 

Public Attributes

readonly BCI2000Connection connection
 The BCI2000Connection which handles connection with BCI2000 Note: It is defined as readonly because I can see no possible case in which it would be useful to swap connections in a BCI2000Remote object, especially as BCI2000Remote holds no state.
 

Detailed Description

Provides functionality for control of BCI2000.

Constructor & Destructor Documentation

◆ BCI2000Remote()

BCI2000RemoteNET.BCI2000Remote.BCI2000Remote ( BCI2000Connection connection)
inline

Constructor for BCI2000Remote

Parameters
connectionConnection object which is connected to a BCI2000 instance. Can be set to connect after this object is constructed as long as no methods of this class which require communication with BCI2000 are called beforehand

Member Function Documentation

◆ AddEvent()

void BCI2000RemoteNET.BCI2000Remote.AddEvent ( string name,
int bitWidth,
UInt32 initialValue = 0 )
inline

Adds an event to BCI2000. Events are similar to state variables but with a temporal resolution of one sample. Must be called when BCI2000 is in the Idle system state.

Parameters
nameThe name of the state to be added
bitWidthThe bit width of the new state. Must be between 1 and 32.
initialValueThe initial value of the state.
Exceptions
BCI2000CommandExceptionThrown if BCI2000 is in invalid state or invalid parameters passed

◆ AddParameter()

void BCI2000RemoteNET.BCI2000Remote.AddParameter ( string section,
string name,
string defaultValue = "%",
string minValue = "%",
string maxValue = "%" )
inline

Adds a parameter to BCI2000. Must be called before StartupModules(Dictionary<string, List<string>>). BCI2000RemoteNET provides no abstraction over BCI2000 parameters. It treats them as strings, and declares them within BCI2000 as the dynamic variant type.

Parameters
sectionThe section of the parameter. This will be the page on which the parameter appears in the BCI2000 parameters menu.
nameThe name of the parameter.
defaultValueThe default value of the parameter. This argument is optional.
maxValueThe maximum value of the parameter. This argument is optional.
minValueThe minimum value of the parameter. This argument is optional.
Exceptions
BCI2000CommandExceptionThrown if BCI2000 is in an invalid state for adding parameters

◆ AddState()

void BCI2000RemoteNET.BCI2000Remote.AddState ( string name,
int bitWidth,
UInt32 initialValue = 0 )
inline

Adds a state variable to BCI2000. State variables have a temporal resolution of one block. To log values with a higher temporal resolution, use AddEvent Must be called when BCI2000 is in the Idle system state.

Parameters
nameThe name of the state to be added
bitWidthThe bit width of the new state. Must be between 1 and 32.
initialValueThe initial value of the state.
Exceptions
BCI2000CommandExceptionThrown if BCI2000 is in invalid state or invalid parameters passed

◆ GetEvent()

UInt32 BCI2000RemoteNET.BCI2000Remote.GetEvent ( string name)
inline

Gets the value of the specified event.

Parameters
nameThe name of the event to get

◆ GetSignal()

double BCI2000RemoteNET.BCI2000Remote.GetSignal ( int channel,
int element )
inline

Gets the value of the signal at the specified channel and element

Parameters
channelThe channel of the signal to get
elementThe element of the signal to get

◆ GetState()

UInt32 BCI2000RemoteNET.BCI2000Remote.GetState ( string name)
inline

Gets the value of the specified state.

Parameters
nameThe name of the state to get

◆ LoadParameters()

void BCI2000RemoteNET.BCI2000Remote.LoadParameters ( string filename)
inline

Loads the specified .prm file. If filename is relative, it is relative to the working directory of BCI2000, which will most likely be the prog directory in the BCI2000 directory. Must be called before StartupModules(Dictionary<string, List<string>>).

Parameters
filenamePath to the parameter file to load
Exceptions
BCI2000CommandExceptionThrown if BCI2000 is in an invalid state for loading parameters

◆ PulseEvent()

void BCI2000RemoteNET.BCI2000Remote.PulseEvent ( string name,
UInt32 value )
inline

Sets the specified event to the specified value for a single sample duration. To set an event to a persistent value, use SetEvent(string, uint)

Parameters
nameThe name of the event to pulse
valueThe value of the event to pulse

◆ SetEvent()

void BCI2000RemoteNET.BCI2000Remote.SetEvent ( string name,
UInt32 value )
inline

Sets the specified event to the specified value. To set an event for a single sample duration, use PulseEvent(string, uint)

Parameters
nameThe name of the event to set
valueThe value of the event to set

◆ SetParameter()

void BCI2000RemoteNET.BCI2000Remote.SetParameter ( string name,
string value )
inline

Sets a BCI2000 parameter. This must be called while the operator is in the Idle or Connected states.

Parameters
nameThe name of the parameter to set
valueThe value to set the parameter to
Exceptions
BCI2000CommandExceptionThrown if BCI2000 is in an invalid state for setting parameters

◆ SetState()

void BCI2000RemoteNET.BCI2000Remote.SetState ( string name,
UInt32 value )
inline

Sets the specified state to the specified value.

Parameters
nameThe name of the state to set
valueThe value of the state to set

◆ Start()

void BCI2000RemoteNET.BCI2000Remote.Start ( )
inline

Starts a BCI2000 run, setting config if necessary.

Exceptions
BCI2000CommandExceptionThrown if BCI2000 is not in a state in which it can be immediately started or set config.

◆ StartupModules()

void BCI2000RemoteNET.BCI2000Remote.StartupModules ( IDictionary< string, IEnumerable< string >?> modules)
inline

Starts up the specified BCI2000 modules.

Parameters
modulesThe modules to start. A dictionary whose keys are the names of the modules to start ("SignalGenerator", "DummyApplication", etc.), and whose values are a list of arguments to the modules ("LogKeyboard=1", "LogEyetrackerTobiiPro=1". The "--" in front of each argument is optional. Pass a null instead of a parameter list for no parameters.

◆ Stop()

void BCI2000RemoteNET.BCI2000Remote.Stop ( )
inline

Stops a BCI2000 run.

Exceptions
BCI2000CommandExceptionThrown if BCI2000 is not currently recording

◆ Visualize()

void BCI2000RemoteNET.BCI2000Remote.Visualize ( string value)
inline

Visualizes a BCI2000 value, for example, an event.

Parameters
valueThe expression to visualize. For example, if you wish to visualize an event called event pass in the value "event"

◆ WaitForSystemState() [1/2]

bool BCI2000RemoteNET.BCI2000Remote.WaitForSystemState ( SystemState state,
double? timeout = null )
inline

Waits for the system to be in the specified state. This will block until the system is in the specified state.

Parameters
timeoutThe timeout value (in seconds) that the command will wait before failing. Leave as null to wait indefinitely.
Returns
True if the system state was reached within the timeout time.

◆ WaitForSystemState() [2/2]

bool BCI2000RemoteNET.BCI2000Remote.WaitForSystemState ( SystemState[] states,
double? timeout = null )
inline

Waits for the system to be in one of the specified states. This will block until the system is in the specified state.

Parameters
timeoutThe timeout value (in seconds) that the command will wait before failing. Leave as null to wait indefinitely.
Returns
True if one of the states was reached within the timeout time.

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