TOBI SignalServer  0.1
/home/breidi/Dropbox/signalserver/include/hardware/gBSamp_base.h
Go to the documentation of this file.
00001 /*
00002     This file is part of the TOBI SignalServer.
00003 
00004     Commercial Usage
00005     Licensees holding valid Graz University of Technology Commercial
00006     licenses may use this file in accordance with the Graz University
00007     of Technology Commercial License Agreement provided with the
00008     Software or, alternatively, in accordance with the terms contained in
00009     a written agreement between you and Graz University of Technology.
00010 
00011     --------------------------------------------------
00012 
00013     GNU General Public License Usage
00014     Alternatively, this file may be used under the terms of the GNU
00015     General Public License version 3.0 as published by the Free Software
00016     Foundation and appearing in the file gpl.txt included in the
00017     packaging of this file.  Please review the following information to
00018     ensure the GNU General Public License version 3.0 requirements will be
00019     met: http://www.gnu.org/copyleft/gpl.html.
00020 
00021     In case of GNU General Public License Usage ,the TOBI SignalServer
00022     is distributed in the hope that it will be useful,
00023     but WITHOUT ANY WARRANTY; without even the implied warranty of
00024     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00025     GNU General Public License for more details.
00026 
00027     You should have received a copy of the GNU General Public License
00028     along with the TOBI SignalServer. If not, see <http://www.gnu.org/licenses/>.
00029 
00030     Copyright 2010 Graz University of Technology
00031     Contact: SignalServer@tobi-project.org
00032 */
00033 
00034 #ifndef G_BSAMP_BASE_H
00035 #define G_BSAMP_BASE_H
00036 
00042 #include <string>
00043 
00044 #include "hardware/hw_thread.h"
00045 
00046 namespace tobiss
00047 {
00048 
00049 class gBSamp;
00050 
00051 //-----------------------------------------------------------------------------
00052 
00053 class gBSampBase : public HWThread
00054 {
00055   protected:
00056     gBSampBase();
00057     virtual ~gBSampBase() {}
00058 
00059     virtual SampleBlock<double> getSyncData() = 0;
00060     virtual SampleBlock<double> getAsyncData() = 0;
00061     virtual void run() = 0;
00062     virtual void stop() = 0;
00063 
00069     virtual void setDeviceSettings(ticpp::Iterator<ticpp::Element>const &father);
00070 
00076     virtual void setChannelSettings(ticpp::Iterator<ticpp::Element>const &father);
00077 
00083     void setHardware(ticpp::Iterator<ticpp::Element>const &hw);
00084 
00085     static const std::string hw_jumper_;   
00086     static const std::string hw_jumper_hp_;   
00087     static const std::string hw_jumper_lp_;   
00088     static const std::string hw_jumper_sense_;   
00089     static const std::string hw_jumper_notch_;   
00090 
00091     static const std::string hw_daq_mode_;    
00092     static const std::string hw_device_id_;    
00093 
00094     enum daq_mode_type
00095       { RSE = 0, NRSE, diff };
00096     daq_mode_type                        daq_mode_;
00097     std::string                          device_id_;
00098 
00099     std::map<boost::uint32_t, float>     global_scaling_factors_;
00100 
00101     std::vector<float>                   scaling_factors_;
00102 
00103 
00104 
00105   private:
00106 
00107     void setDeviceJumperSettings(ticpp::Iterator<ticpp::Element>const &elem);
00108     void setChannelJumperSettings(ticpp::Iterator<ticpp::Element>const &father);
00109 
00110     void checkJumperAttributes(ticpp::Iterator<ticpp::Element>const &elem);
00111 
00112     void getJumperParams(ticpp::Iterator<ticpp::Element>const &elem,
00113                          unsigned int &type, bool &notch, float &highpass,
00114                          float &lowpass, float &sense);
00115 
00116     void setAcquisitionMode(ticpp::Iterator<ticpp::Element>const &elem);
00117 
00118     void setDeviceName(ticpp::Iterator<ticpp::Element>const &elem);
00119 
00120     void setGlobalScalingValues();
00121 
00122     void throwXMLErrorTagNotGiven(std::string& tag_name);
00123     void throwXMLErrorWrongValue(const std::string& tag_name,const  std::string& attr_name, std::string type, float given, float cor1, float cor2);
00124 
00125     void checkEEGJumperValues(float highpass, float lowpass, float sense);
00126     void checkEOGJumperValues(float highpass, float lowpass, float sense);
00127     void checkEMGJumperValues(float highpass, float lowpass, float sense);
00128     void checkECGJumperValues(float highpass, float lowpass, float sense);
00129 
00130   private:
00131     std::map<std::string, daq_mode_type> daq_modes_map_;
00132 };
00133 
00134 //-----------------------------------------------------------------------------
00135 
00136 }  // Namespace tobiss
00137 
00138 
00139 #endif //G_BSAMP_BASE_H
00140 
 All Data Structures Files Functions Variables