TOBI SignalServer
0.1
|
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 00047 #ifndef HWACCESS_H 00048 #define HWACCESS_H 00049 00050 #include <boost/asio.hpp> 00051 #include <boost/cstdint.hpp> 00052 #include "hw_thread.h" 00053 00054 namespace tia 00055 { 00056 class DataPacket; 00057 } 00058 00059 namespace tobiss 00060 { 00061 00062 class XMLParser; 00063 00064 //--------------------------------------------------------------------------------------- 00065 00079 class HWAccess 00080 { 00081 public: 00088 HWAccess(boost::asio::io_service& io_service, XMLParser& x); 00089 00095 virtual ~HWAccess(); 00096 00104 void fillDataPacket(tia::DataPacket* packet); 00105 00109 void startDataAcquisition(); 00113 void stopDataAcquisition(); 00114 00121 std::vector<boost::uint32_t> getAcquiredSignalTypes(); 00122 00129 std::vector<boost::uint16_t> getBlockSizesPerSignalType(); 00130 00137 std::vector<boost::uint16_t> getNrOfChannelsPerSignalType(); 00138 00145 std::vector<boost::uint32_t> getSamplingRatePerSignalType(); 00146 00152 boost::uint16_t getNrOfChannels(); 00153 00160 std::map<boost::uint32_t, std::vector<std::string> > getChannelNames() 00161 { return(channel_naming_); } 00162 00168 boost::uint16_t getNrOfConnectedDevices() 00169 { 00170 if(!master_) 00171 return(0); 00172 return(slaves_.size()+1); 00173 } 00174 00180 boost::uint32_t getMastersSamplingRate() 00181 { 00182 if(!master_) 00183 return(0); 00184 return(master_->getSamplingRate()); 00185 } 00186 00192 boost::uint32_t getMastersBlocksize() 00193 { 00194 if(!master_) 00195 return(0); 00196 return(master_->getNrOfBlocks()); 00197 } 00198 00202 static std::vector<std::string> getPossibleHardwareNames(); 00203 00204 00205 //----------------------------------------------- 00206 00207 private: 00214 void buildDataInfoMap(); 00215 00222 void buildFsInfoMap(); 00223 00230 void doHWSetup(); 00234 void checkIfSingleMaster(); 00238 void setAperiodics(); 00242 void setMasterSlaveRatio(); 00249 void reportInHomogenousDevice(HWThread* dev); 00250 00251 //----------------------------------------------- 00252 00253 private: 00257 std::vector< HWThread* > slaves_; 00258 00262 std::vector< HWThread* > aperiodics_; 00263 00267 HWThread* master_; 00268 00272 HWThread* event_listener_; 00273 00277 std::vector<unsigned int> fs_ratio_; 00281 std::vector<unsigned int> sample_it_; // iteration variable for sample-count 00282 00283 std::map<boost::uint32_t, std::pair<boost::uint16_t, boost::uint16_t> > data_info_; 00284 std::map<boost::uint32_t, double > fs_info_; 00285 00286 std::map<boost::uint32_t, std::vector<std::string> > channel_naming_; 00287 00288 bool acqu_running_; 00289 00290 #ifdef TIMING_TEST 00291 private: 00292 bool lpt_flag_; 00293 #endif 00294 00295 }; 00296 00297 } // Namespace tobiss 00298 00299 #endif // HWACCESS_H 00300 00301 //--------------------------------------------------------------------------------------- 00302