Programming FAQ: Difference between revisions
| Line 57: | Line 57: | ||
#In the IDE, choose View->Project Manager to get a list of project files, and check whether your filter or ADC class cpp file is listed there; if not, add your new cpp file to the list. | #In the IDE, choose View->Project Manager to get a list of project files, and check whether your filter or ADC class cpp file is listed there; if not, add your new cpp file to the list. | ||
#Add any required .lib files or auxiliary cpp files to the list of project files. | #Add any required .lib files or auxiliary cpp files to the list of project files. | ||
#Compile and link using the IDE. When this works, do a command-line "make clean && make prepare", open the file <tt>src/ | #Compile and link using the IDE. When this works, do a command-line "make clean && make prepare", open the file <tt>src/makefiles</tt>, and remove the leading # character from your new project's entry. Then, doing a "make all" should include your new project. | ||
==Writing Filter Components== | ==Writing Filter Components== | ||
Revision as of 13:58, 21 May 2008
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:
- Comment out the module from the startup batch file you are using.
- In the Borland IDE, go to "Project->Options->Compiler", and click "Full Debug".
- Execute the batch file.
- 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 modules share a large number of source files, and should have identical compiler settings. Thus, it is best to begin with a copy of an existing module's project, choosing the one that is most similar to your planned module. Then, follow these steps:
- Create a new, empty directory inside the appropriate BCI2000/src/contrib/ subdirectory, using a name that fits your new module.
- Create an empty directory "obj" inside the newly created directory.
- Copy the template project file (e.g., SignalGenerator.bpr), and the identically named cpp file (e.g., SignalGenerator.cpp) to the new project directory.
- Rename the bpr and the cpp file to what you want to be the name of the executable.
- Using a text editor, do a search-and-replace within the bpr and the cpp files, replacing all occurrences of the original name (e.g., "SignalGenerator") with the new name.
- Create a new cpp file for the new filter or ADC component, or copy an existing one as a template.
- Open the bpr file using the Borland IDE.
- In the IDE, choose View->Project Manager to get a list of project files, and check whether your filter or ADC class cpp file is listed there; if not, add your new cpp file to the list.
- Add any required .lib files or auxiliary cpp files to the list of project files.
- Compile and link using the IDE. When this works, do a command-line "make clean && make prepare", open the file src/makefiles, and remove the leading # character from your new project's entry. Then, doing a "make all" should include your new project.
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.
- For signal processing filters, make sure that your filter is listed in the signal module's PipeDefinition.cpp as a statement Filter( YourFilterClassname, Position );