Jump to content

Programming FAQ

From BCI2000 Wiki

Contributing

Q: I wrote a piece of software that I would like to add to BCI2000 as a contribution. How do I proceed?

A: See Contributions:Contents#How to contribute for a suggestion.

Debugging

Q: How do I debug a BCI2000 module?

A:

  1. Add the "rem" comment indicator in front of the module's startup command in the batch file you are using to start up BCI2000.
  2. In the Borland IDE, go to "Project->Options->Compiler", click "Full Debug" and "OK", and recompile the module.
  3. Execute the batch file.
  4. Change to the IDE, and run the module in the debugger.

Q: I keep getting "Unexpected system state transition 11->1" error messages from the operator module.

A: Basically, this error means that the operator module receives messages from core modules that are incompatible with its present state, e.g. a module sends a parameter list but the operator module is not in the publishing phase, and thus cannot respond appropriately. Often, this error is caused when one runs a module from the debugger, aborts its execution, and then restarts it. Then, the BCI2000 system as a whole will be in an undefined state. Rather than just restarting a single module, you need to quit BCI2000 from the operator module, and then restart all modules. Similarly, a module may be crashed, and still be running even after you quit BCI2000. Check for this in the Task Manager's process view, and kill the runaway module from there before restarting BCI2000. Also, if the runaway module is part of the BCI2000 core distribution, we will be glad if you drop us a note on the BBS.

Source Code Access

Q: When trying to get access to the BCI2000 source code, my user account and password don't work.

A:

  • Make sure you are using the Wiki/SVN account information that was sent to you per e-mail, not the BBS account, which is different.
  • Make sure your SVN client knows how to do Digest Authentification. Some precompiled SVN versions for Mac OS X have been reported not to work (the Fink distribution should).
  • Avoid interference from firewalls by using SSL rather than plain HTTP communication.

App Connector

Q: I want to replace the BCI2000 application module with an external application written in my favorite programming environment. This should be possible using the App Connector protocol. However, when I replace the application module with an empty dummy one, my external application does not get any data.

A: If you are going to use the App Connector, then your application module needs to contain both ConnectorInput and ConnectorOutput filter as a minimum configuration.

Getting Started with a new Module

Q: How should I begin working on a new BCI2000 module?

A: BCI2000 provides a mechanism to create new BCI2000 modules from templates. To create a new BCI2000 module, run BCI2000/build/NewBCI2000Module; for a new filter, run BCI2000/build/NewBCI2000Filter. Both executables will only be present when you have built BCI2000 first as described here.

Writing Filter Components

Q: I would like to write my own signal processing filter. Where is a good place to start?

A: Writing your own signal processing filter itself is described at: Programming Tutorial:Implementing a Signal Processing Filter.

General information on signal processing modules is found at Technical Reference:Core Modules#Signal Processing Module and User Reference:Filters.


Q: I wrote a signal processing filter, data acquisition component (ADC filter), or data format component (FileWriter). I added its cpp file to the appropriate module, everything compiles and links fine, but I cannot use it -- everything appears as if the new component were nonexistent. What is wrong?

A: Make sure that your component is instantiated.

  • For source and application components, make sure that there is a line RegisterFilter( YourFilterClassName, Position ); somewhere in its cpp file (preferably at the top, following #include statements).
  • For signal processing filters, make sure that your filter is listed in the signal module's PipeDefinition.cpp as a statement Filter( YourFilterClassname, Position );