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 00034 #ifndef SIGNALSERVER_H 00035 #define SIGNALSERVER_H 00036 00037 #include <boost/asio.hpp> 00038 #include <boost/thread.hpp> 00039 00040 00041 #ifdef USE_TID_SERVER 00042 namespace TiD 00043 { 00044 class TiDServer; 00045 } 00046 #endif 00047 00048 #ifdef USE_GDF_SAVER 00049 namespace gdf 00050 { 00051 class Writer; 00052 } 00053 #endif 00054 00055 namespace tia 00056 { 00057 class TiAServer; 00058 class DataPacket; 00059 } 00060 00061 namespace tobiss 00062 { 00063 00064 class XMLParser; 00065 class HWAccess; 00066 class EventSource; 00067 class FileWriter; 00068 00069 //----------------------------------------------------------------------------- 00070 00071 class SignalServer 00072 { 00073 public: 00074 SignalServer(XMLParser& config_parser, bool use_new_tia); 00075 virtual ~SignalServer(); 00076 00077 void stop(); 00078 void readPackets(); 00079 00080 static std::vector<std::string> getPossibleHardwareNames(); 00081 00082 private: 00083 void initGdf(); 00084 00085 void fustyReadPackets(); 00086 00087 HWAccess* hw_access_; 00088 tia::TiAServer* tia_server_; 00089 00090 boost::asio::io_service tia_io_service_; 00091 boost::thread* tia_io_service_thread_; 00092 00093 boost::asio::io_service hw_access_io_service_; 00094 boost::thread* hw_access_io_service_thread_; 00095 00096 00097 XMLParser& config_parser_; 00098 00099 bool stop_reading_; 00100 bool write_file_; 00101 boost::uint32_t master_blocksize_; 00102 boost::uint32_t master_samplingrate_; 00103 std::map<std::string,std::string> subject_info_; 00104 std::map<std::string,std::string> server_settings_; 00105 std::map<boost::uint32_t, std::vector<std::string> > channels_per_sig_type_; 00106 std::vector<boost::uint32_t> sampling_rate_per_sig_type_; 00107 00108 tia::DataPacket* packet_; 00109 00110 EventSource* event_source_; 00111 FileWriter* file_writer_; 00112 00113 #ifdef USE_TID_SERVER 00114 TiD::TiDServer* tid_server_; 00115 boost::asio::io_service tid_io_service_; 00116 boost::thread* tid_io_service_thread_; 00117 #endif 00118 00119 #ifdef USE_GDF_SAVER 00120 gdf::Writer* gdf_writer_; 00121 #endif 00122 }; 00123 00124 //----------------------------------------------------------------------------- 00125 00126 } // tobiss 00127 00128 #endif // SIGNALSERVER_H