TOBI SignalServer  0.1
/home/breidi/Dropbox/signalserver/include/hardware/gBSamp_unix.h
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 GBSAMP_UNIX_H
00035 #define GBSAMP_UNIX_H
00036 
00037 #include <vector>
00038 #include <map>
00039 
00040 #include <boost/thread/condition.hpp>  // for mutex and cond. variables
00041 #include <boost/thread/shared_mutex.hpp>
00042 #include <boost/cstdint.hpp>
00043 #include <comedilib.h>
00044 
00045 #include "hardware/hw_thread_builder.h"
00046 #include "hardware/gBSamp_base.h"
00047 
00048 namespace tobiss
00049 {
00050 //-----------------------------------------------------------------------------
00059 class gBSamp : public gBSampBase
00060 {
00061   public:
00066     gBSamp(ticpp::Iterator<ticpp::Element> hw);
00067 
00071     virtual ~gBSamp();
00072 
00080     virtual SampleBlock<double> getSyncData();
00081 
00094     virtual SampleBlock<double> getAsyncData();
00098     virtual void run();
00102     virtual void stop();
00103 
00104 //-----------------------------------------------
00105   private:
00106 
00110     int initCard();
00111 
00112 //-----------------------------------------------
00113 
00114   private:
00115     boost::uint32_t expected_values_;
00116 
00117     std::vector<double> samples_; 
00118 
00119     boost::int32_t error_;
00120     boost::int32_t first_run_;
00121 
00122     comedi_t* device_;
00123     comedi_cmd comedi_cmd_;
00124     comedi_range* range_info_;
00125     int maxdata_;
00126     unsigned int *channel_list_;
00127     //    sampl_t* data_buffer_[10000];
00128     //    unsigned int channel_list[0];
00129     //    comedi_insn comedi_insn_;
00130     //    comedi_insnlist insn_list_;
00131     //    lsampl_t data_buf_[1000];
00132 
00133     static const HWThreadBuilderTemplateRegistratorWithoutIOService<gBSamp> factory_registrator_;
00134 
00135 };
00136 
00137 } // Namespace tobiss
00138 
00139 #endif // GBSAMP_UNIX_H
 All Data Structures Files Functions Variables