I'm using a Datatranslation board to control custom hardware. To control the hardware I've written a class that I've tested and it works.
However, when I use this class in my BCI2000 Application, I get one of my own exception thrown at me. The problem is that when I press Set Config, both Preflight and Initialization are called on the application, which causes the initialization of the hardware (once for Preflight, once for initialization), but the hardware only gets closed for the preflight. When pressing the Set Config button again, the hardware is still in use by the last initialization. What is a good place to stop the hardware to prevent an error with re-configuring?
Destructor calls in Preflight
-
mellinger
- Posts: 1341
- Joined: 12 Feb 2003, 11:06
There is a GenericFilter::Halt() function provided for this purpose. It is called each time prior to the Preflight()-Initialize() sequence.
In your filter's header file, declare
and close the hardware from the definition of this method.
Also, add a Halt() call to the filter's destructor to make sure the hardware is closed when the filter is destructed.
In your filter's header file, declare
Code: Select all
virtual void Halt();Also, add a Halt() call to the filter's destructor to make sure the hardware is closed when the filter is destructed.
Who is online
Users browsing this forum: No registered users and 0 guests
