TOBI SignalServer
0.1
|
Base class for all hardware objects. More...
#include <hw_thread.h>
Public Member Functions | |
virtual | ~HWThread () |
Default destructor. | |
std::string | getType () |
Get the name of the device. | |
bool | isMaster () |
Check if device is the master. | |
bool | isSlave () |
Check if device is a slave. | |
bool | isAperiodic () |
Check if device is an aperiodic device (only delivers, if new data is available). | |
bool | hasHomogenousSignalType () |
Check if device is delivering only one SignalType (e.g. only EEG or only EMG) | |
boost::uint16_t | getNrOfBlocks () |
Get the blocksize set for the device. | |
double | getSamplingRate () |
Get the sampling rate set for the device. | |
boost::uint16_t | getNrOfChannels () |
Get the number of channels the device is acquiering. | |
std::vector< boost::uint32_t > | getChannelTypes () |
Get a vector containing channel types from acquired channels. | |
std::map< boost::uint16_t, std::pair< std::string, boost::uint32_t > > | getChannelInfoMap () |
Get a map containing all channel information. | |
bool | samplesAvailable () |
Check if new samples are available. | |
void | checkMandatoryHardwareTags (ticpp::Iterator< ticpp::Element > hw) |
Check if all needed hardware tags from xml config are correctly set. | |
virtual SampleBlock< double > | getSyncData ()=0 |
Abstract method to achieve synchronous data acquisition (method is blocking). | |
virtual SampleBlock< double > | getAsyncData ()=0 |
Abstract method to achieve asynchronous data acquisition (method is non-blocking). | |
virtual void | run ()=0 |
Abstract method to start data acquisition. | |
virtual void | stop ()=0 |
Abstract method to stop data acquisition. | |
Protected Member Functions | |
HWThread (boost::uint32_t sampling_rate, boost::uint16_t channels, boost::uint16_t blocks) | |
Constructor. | |
HWThread () | |
Default constructor. | |
virtual void | setDeviceSettings (ticpp::Iterator< ticpp::Element >const &father)=0 |
Set configuration listed in the <device_settings> section in the XML file. | |
virtual void | setChannelSettings (ticpp::Iterator< ticpp::Element >const &father)=0 |
Set configuration listed in the <channel_settings> section in the XML file. | |
void | setSamplingRate (ticpp::Iterator< ticpp::Element >const &elem) |
Set the sampling rate of the device. | |
void | setDeviceChannels (ticpp::Iterator< ticpp::Element >const &elem) |
Set parameters for all channels. | |
void | setBlocks (ticpp::Iterator< ticpp::Element >const &elem) |
Set the blocksize of the device. | |
void | setChannelSelection (ticpp::Iterator< ticpp::Element >const &elem) |
Set different parameters for channels (and overwrite settings from <measurement_channels>). | |
void | setChannelTypes () |
Sets the vector channel_types. | |
bool | isNumber (const std::string &s) |
Check, if a string represents a valid number. | |
void | setType (std::string s) |
Set the type (name) of the respective hardware device. | |
boost::uint16_t | getChannelPosition (boost::uint16_t ch_nr) |
Get the position of the respective channel (e.g. ch nr. 7 is the second acuqired channel) | |
bool | equalsOnOrOff (const std::string &s) |
bool | equalsYesOrNo (const std::string &s) |
bool | equalsMaster (const std::string &s) |
bool | equalsSlave (const std::string &s) |
bool | equalsAperiodic (const std::string &s) |
void | parseDeviceChannels (ticpp::Iterator< ticpp::Element >const &elem, boost::uint16_t &nr_ch, std::string &naming, std::string &type) |
void | parseChannelSelection (ticpp::Iterator< ticpp::Element >const &elem, boost::uint16_t &ch, std::string &name, std::string &type) |
void | checkMandatoryHardwareTagsXML (ticpp::Iterator< ticpp::Element > hw) |
Protected Attributes | |
boost::uint16_t | nr_ch_ |
number of channels | |
double | fs_ |
sampling rate | |
bool | samples_available_ |
boost::uint16_t | blocks_ |
blocksize (or also called buffersize) | |
boost::uint8_t | mode_ |
master, slave or aperiodic | |
bool | running_ |
variable, to stop hardware | |
boost::shared_mutex | rw_ |
mutex to lock data | |
std::map< boost::uint16_t, std::pair< std::string, boost::uint32_t > > | channel_info_ |
map containing ( ch_nr, (name, type) ) | |
bool | homogenous_signal_type_ |
true, if device delivers different signal types -- e.g. EEG and EMG | |
std::vector< boost::uint32_t > | channel_types_ |
vector containing signal types of channels (for faster access) | |
SampleBlock< double > | data_ |
Data object representing the last available samples from the SineGenerator. | |
std::string | type_ |
Static Protected Attributes | |
static const std::string | hardware_version_ |
static const std::string | hardware_serial_ |
static const std::string | hw_mode_ |
static const std::string | hw_devset_ |
xml-tag hardware: device_settings | |
static const std::string | hw_fs_ |
xml-tag hardware: sampling_rate | |
static const std::string | hw_channels_ |
xml-tag hardware: measurement_channels | |
static const std::string | hw_ch_nr_ |
xml-tag hardware: nr | |
static const std::string | hw_ch_names_ |
xml-tag hardware: names | |
static const std::string | hw_ch_type_ |
xml-tag hardware: channel type | |
static const std::string | hw_blocksize_ |
xml-tag hardware: blocksize | |
static const std::string | hw_chset_ |
xml-tag hardware -- channel_settings | |
static const std::string | hw_chset_sel_ |
xml-tag hardware: selection | |
static const std::string | hw_chset_ch_ |
xml-tag hardware: ch | |
static const std::string | hw_chset_nr_ |
xml-tag hardware: nr | |
static const std::string | hw_chset_name_ |
xml-tag hardware: name |
Base class for all hardware objects.
HWThread is the base class for all hardware objects providing abstract methods needed for a common interface to gather access to different types of hardware. It also provides methods and members needed for every data acquisition device (channel types, ...).
REMARK: The naming "hw_thread" was badly chosen, as it was planned at the beginning, to run every hardware object in it's own thread. Using synchronous and asynchronous data access, this is not needed all the time. File and class name are planned to be renamed in the future! (e.g. hw_base)
Write instruction how to derive from HWThread
Maybe rename HWTHread to HWBase
Implement unique device ID mechanism
Definition at line 80 of file hw_thread.h.