TOBI SignalServer  0.1
tobiss::USBamp Class Reference

A class to wrap the API provided by g.tec for the g.USBamp and enable synchronous and asynchronous data access. More...

#include <usbamp.h>

+ Inheritance diagram for tobiss::USBamp:
+ Collaboration diagram for tobiss::USBamp:

Public Member Functions

 USBamp (ticpp::Iterator< ticpp::Element > hw)
 Constructor.
virtual ~USBamp ()
 Destructor.
virtual SampleBlock< double > getSyncData ()
 Get data asynchronously.
virtual SampleBlock< double > getAsyncData ()
 Get data asynchronously.
virtual void run ()
 Method to start data acquisition.
virtual void stop ()
 Method to stop data acquisition.
 USBamp (XMLParser &parser, ticpp::Iterator< ticpp::Element > hw)
virtual SampleBlock< double > getSyncData ()
 Abstract method to achieve synchronous data acquisition (method is blocking).
virtual SampleBlock< double > getAsyncData ()
 Abstract method to achieve asynchronous data acquisition (method is non-blocking).
virtual void run ()
 Method to start data acquisition.
virtual void stop ()
 Method to stop data acquisition.

Private Member Functions

void setHardware (ticpp::Iterator< ticpp::Element >const &hw)
virtual void setDeviceSettings (ticpp::Iterator< ticpp::Element >const &father)
 Set configuration listed in the <device_settings> section in the XML file.
virtual void setChannelSettings (ticpp::Iterator< ticpp::Element >const &father)
 Set configuration listed in the <channel_settings> section in the XML file.
void setDefaultSettings ()
void setDeviceFilterSettings (ticpp::Iterator< ticpp::Element >const &elem)
void setChannelFilterSettings (ticpp::Iterator< ticpp::Element >const &father)
void setDeviceNotchSettings (ticpp::Iterator< ticpp::Element >const &elem)
void setChannelNotchSettings (ticpp::Iterator< ticpp::Element >const &father)
void setOperationMode (ticpp::Iterator< ticpp::Element >const &elem)
void setShortCut (ticpp::Iterator< ticpp::Element >const &elem)
void setTriggerLine (ticpp::Iterator< ticpp::Element >const &elem)
void setUSBampMasterOrSlave (ticpp::Iterator< ticpp::Element >const &elem)
void setCommonGround (ticpp::Iterator< ticpp::Element >const &father)
void setCommonReference (ticpp::Iterator< ticpp::Element >const &father)
void setBipolar (ticpp::Iterator< ticpp::Element >const &father)
void setDrivenRightLeg (ticpp::Iterator< ticpp::Element >const &father)
void setIndividualDrivenRightLeg (ticpp::Iterator< ticpp::Element > &elem)
void checkFilterAttributes (ticpp::Iterator< ticpp::Element >const &elem)
void getFilterParams (ticpp::Iterator< ticpp::Element >const &elem,\unsigned int &type, unsigned int &order, double &f_low, double &f_high)
void checkNotchAttributes (ticpp::Iterator< ticpp::Element >const &elem)
void getNotchParams (ticpp::Iterator< ticpp::Element >const &elem, float &f_center)
void checkNrOfChannels ()
void adjustSettingsToChannelSelection ()
void checkTriggerLineChannel ()
void getHandles ()
void check4USBampError ()
void initFilterPtrs ()
void setUSBampChannels ()
int search4FilterID (unsigned int type, unsigned int order, double f_low, double f_high)
int search4NotchID (float f_center)
void printPossibleBandPassFilters ()
void printPossibleNotchFilters ()
void printAvailableAmps ()
void setUSBampFilter ()
void setUSBampNotch ()
void initUSBamp ()
void callGT_GetData ()
void callGT_ResetTransfer ()
void callGT_Start ()
void fillSyncBuffer ()
void fillSampleBlock ()
int getUSBampFilterType (const std::string &s)
std::string getUSBampFilterName (double n)
std::string getUSBampOpMode (const std::string &s)
int getUSBampBlockNr (const std::string &s)
double roundD (double number, int digits=DIGITS_TO_ROUND)
void setHardware (ticpp::Iterator< ticpp::Element >const &hw)
virtual void setDeviceSettings (ticpp::Iterator< ticpp::Element >const &father)
 Set configuration listed in the <device_settings> section in the XML file.
virtual void setChannelSettings (ticpp::Iterator< ticpp::Element >const &father)
 Set configuration listed in the <channel_settings> section in the XML file.
void setDefaultSettings ()
void setDeviceFilterSettings (ticpp::Iterator< ticpp::Element >const &elem)
void setChannelFilterSettings (ticpp::Iterator< ticpp::Element >const &father)
void setDeviceNotchSettings (ticpp::Iterator< ticpp::Element >const &elem)
void setChannelNotchSettings (ticpp::Iterator< ticpp::Element >const &father)
void setOperationMode (ticpp::Iterator< ticpp::Element >const &elem)
void setShortCut (ticpp::Iterator< ticpp::Element >const &elem)
void setTriggerLine (ticpp::Iterator< ticpp::Element >const &elem)
void setUSBampMasterOrSlave (ticpp::Iterator< ticpp::Element >const &elem)
void setCommonGround (ticpp::Iterator< ticpp::Element >const &father)
void setCommonReference (ticpp::Iterator< ticpp::Element >const &father)
void setBipolar (ticpp::Iterator< ticpp::Element >const &father)
void setDrivenRightLeg (ticpp::Iterator< ticpp::Element >const &father)
void setIndividualDrivenRightLeg (ticpp::Iterator< ticpp::Element > &elem)
void checkFilterAttributes (ticpp::Iterator< ticpp::Element >const &elem)
void getFilterParams (ticpp::Iterator< ticpp::Element >const &elem,\unsigned int &type, unsigned int &order, float &f_low, float &f_high)
void checkNotchAttributes (ticpp::Iterator< ticpp::Element >const &elem)
void getNotchParams (ticpp::Iterator< ticpp::Element >const &elem, float &f_center)
void checkNrOfChannels ()
void checkTriggerLineChannel ()
void getHandles ()
void check4USBampError ()
void initFilterPtrs ()
void setUSBampChannels ()
int search4FilterID (unsigned int type, unsigned int order, float f_low, float f_high)
int search4NotchID (float f_center)
void setUSBampFilter ()
void setUSBampNotch ()
void initUSBamp ()
void callGT_GetData ()
void fillSyncBuffer ()
void fillSampleBlock ()
double roundD (double number, int digits=DIGITS_TO_ROUND)

Private Attributes

std::string serial_
bool enable_sc_
bool external_sync_
bool trigger_line_
boost::uint32_t trigger_line_sig_type_
boost::uint64_t sample_count_
boost::uint64_t error_count_
WORD error_code_
CHAR * error_msg_
std::vector< BYTE * > driver_buffer_
DWORD driver_buffer_size_
std::vector< DWORD > bytes_received_
DWORD timeout_
boost::uint32_t expected_values_
boost::uint32_t first_run_
boost::uint32_t current_overlapped_
HANDLE h_
std::vector< HANDLE > data_Ev_
std::vector< OVERLAPPED > ov_
std::vector< double > samples_
std::vector< boost::uint16_t > channels_
int nr_of_bp_filters_
FILTbp_filters_
int nr_of_notch_filters_
FILTnotch_filters_
std::vector< boost::int16_t > filter_id_
std::vector< boost::int16_t > notch_id_
GND ground_
REF reference_
CHANNEL bipolar_channels_
CHANNEL drl_channels_
std::string mode_
 master, slave or aperiodic
GTECUSBampWrapper usb_amp_
std::map< std::string,
std::string > 
m_
std::map< std::string,
unsigned int > 
usbamp_filter_types_
 Mapping std::strings, representing g.USBamp filter types, and identifiers together.
std::map< std::string,
std::string > 
usbamp_opModes_
 Mapping std::strings, representing g.USBamp operation modes, and identifiers together.
std::map< std::string,
unsigned int > 
usbamp_block_names_
 Mapping std::strings, representing g.USBamp block namings, and identifiers together.
BYTE * driver_buffer_
DWORD bytes_received_
std::vector< BYTE > raw_buffer_
HANDLE data_Ev_
OVERLAPPED ov_
Constants cst_

Static Private Attributes

static std::set< static
std::string > 
serials_
static bool is_usbamp_master_
static USBampmaster_device_
static std::vector< USBamp * > slave_devices_
static const
HWThreadBuilderTemplateRegistratorWithoutIOService
< USBamp
FACTORY_REGISTRATOR_
 Attributes map -- to be renamed.
static const std::string hw_filter_
 xml-tag hardware: filter
static const std::string hw_filter_type_
 xml-tag hardware: filter type
static const std::string hw_filter_order_
 xml-tag hardware: filter order
static const std::string hw_filter_low_
 xml-tag hardware: filter lower cutoff freq.
static const std::string hw_filter_high_
 xml-tag hardware: filter upper cutoff freq.
static const std::string hw_notch_
 xml-tag hardware: notch_filter
static const std::string hw_notch_center_
 xml-tag hardware: notch center freq.
static const std::string hw_opmode_
 USBamp specific.
static const std::string hw_sc_
 USBamp specific.
static const std::string hw_trigger_line_
 USBamp specific.
static const std::string hw_usbampmaster_
 USBamp specific.
static const std::string hw_comgnd_
 USBamp specific.
static const std::string hw_gnd_
 USBamp specific.
static const std::string hw_gnd_block_
 USBamp specific.
static const std::string hw_gnd_value_
 USBamp specific.
static const std::string hw_comref_
 USBamp specific.
static const std::string hw_cr_
 USBamp specific.
static const std::string hw_cr_block_
 USBamp specific.
static const std::string hw_cr_value_
 USBamp specific.
static const std::string hw_bipolar_
 USBamp specific.
static const std::string hw_bipolar_with_
 USBamp specific.
static const std::string hw_drl_
 USBamp specific.
static const std::string hw_drl_value_
 USBamp specific.
static bool received_enough_data_

Detailed Description

A class to wrap the API provided by g.tec for the g.USBamp and enable synchronous and asynchronous data access.

This class is built to gather access to the g.tec g.USBamp (usbamp). It wraps the C API provided by g.tec to be used in the TOBI signalserver. It is able to acquire data from different usbamps in a synchronous and asynchronous manner and letting them appear as one single device. Configuration has to be done by an tinyXML object, satisfying the configuration file specifications for the signalserver project.

Attention:
Only g.USBamp verison B is supported and tested propperly
Todo:

Implement Linux API

Support g.USBamp version A

Document also private methods

Implement also "auto-blocksize" mode

Bug:
Timeouts occur every second time the USBamp ist started.

This class is built to gather access to the g.tec g.USBamp (usbamp). It wraps the C API provided by g.tec to be used in the TOBI signalserver. It is able to acquire data from different usbamps in a synchronous and asynchronous manner and letting them appear as one single device. Configuration has to be done by an tinyXML object, satisfying the configuration file specifications for the signalserver project.

Definition at line 87 of file usbamp.h.


The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables