|
BCI2000RemoteNET
|
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
| |||
| 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(IDictionary<string, IEnumerable<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(). | |||
| 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. | |
Provides functionality for control of BCI2000.
|
inline |
Constructor for BCI2000Remote
| connection | Connection 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</param |
|
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.
| name | The name of the state to be added |
| bitWidth | The bit width of the new state. Must be between 1 and 32. |
| initialValue | The initial value of the state. |
| BCI2000CommandException | Thrown if BCI2000 is in invalid state or invalid parameters passed |
|
inline |
Adds a parameter to BCI2000. Must be called before StartupModules(IDictionary<string, IEnumerable<string>?>). BCI2000RemoteNET provides no abstraction over BCI2000 parameters. It treats them as strings, and declares them within BCI2000 as the dynamic variant type.
| section | The section of the parameter. This will be the page on which the parameter appears in the BCI2000 parameters menu. |
| name | The name of the parameter. |
| defaultValue | The default value of the parameter. This argument is optional. |
| maxValue | The maximum value of the parameter. This argument is optional. |
| minValue | The minimum value of the parameter. This argument is optional. |
| BCI2000CommandException | Thrown if BCI2000 is in an invalid state for adding parameters |
|
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.
| name | The name of the state to be added |
| bitWidth | The bit width of the new state. Must be between 1 and 32. |
| initialValue | The initial value of the state. |
| BCI2000CommandException | Thrown if BCI2000 is in invalid state or invalid parameters passed |
|
inline |
Gets the value of the specified event.
| name | The name of the event to get |
|
inline |
Gets the value of the signal at the specified channel and element
| channel | The channel of the signal to get |
| element | The element of the signal to get |
|
inline |
Gets the value of the specified state.
| name | The name of the state to get |
|
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().
| filename | Path to the parameter file to load |
| BCI2000CommandException | Thrown if BCI2000 is in an invalid state for loading parameters |
|
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)
| name | The name of the event to pulse |
| value | The value of the event to pulse |
|
inline |
Sets the specified event to the specified value. To set an event for a single sample duration, use PulseEvent(string, uint)
| name | The name of the event to set |
| value | The value of the event to set |
|
inline |
Sets a BCI2000 parameter. This must be called while the operator is in the Idle or Connected states.
| name | The name of the parameter to set |
| value | The value to set the parameter to |
| BCI2000CommandException | Thrown if BCI2000 is in an invalid state for setting parameters |
|
inline |
Sets the specified state to the specified value.
| name | The name of the state to set |
| value | The value of the state to set |
|
inline |
Starts a BCI2000 run, setting config if necessary.
| BCI2000CommandException | Thrown if BCI2000 is not in a state in which it can be immediately started or set config. |
|
inline |
Starts up the specified BCI2000 modules.
| modules | The 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. |
|
inline |
Stops a BCI2000 run.
| BCI2000CommandException | Thrown if BCI2000 is not currently recording |
|
inline |
Visualizes a BCI2000 value, for example, an event.
| value | The expression to visualize. For example, if you wish to visualize an event called event pass in the value "event" |
|
inline |
Waits for the system to be in the specified state. This will block until the system is in the specified state.
| timeout | The timeout value (in seconds) that the command will wait before failing. Leave as null to wait indefinitely. |
|
inline |
Waits for the system to be in one of the specified states. This will block until the system is in the specified state.
| timeout | The timeout value (in seconds) that the command will wait before failing. Leave as null to wait indefinitely. |