|
TOBI Interface A
0.1
|
00001 /* 00002 This file is part of the TOBI Interface A (TiA) library. 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 Lesser General Public License Usage 00014 Alternatively, this file may be used under the terms of the GNU Lesser 00015 General Public License version 3.0 as published by the Free Software 00016 Foundation and appearing in the file lgpl.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/lgpl.html. 00020 00021 In case of GNU Lesser General Public License Usage ,the TiA library 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 Lesser General Public License 00028 along with the TiA library. If not, see <http://www.gnu.org/licenses/>. 00029 00030 Copyright 2010 Graz University of Technology 00031 Contact: TiA@tobi-project.org 00032 */ 00033 00041 #ifndef CONTROLCONNECTIONSERVER_H 00042 #define CONTROLCONNECTIONSERVER_H 00043 00044 // Standard 00045 #include <assert.h> 00046 #include <iostream> 00047 #include <map> 00048 00049 // Boost 00050 #include <boost/thread/condition.hpp> 00051 #include <boost/asio/deadline_timer.hpp> 00052 #include <boost/cstdint.hpp> 00053 00054 // local 00055 #include "tia-private/config/control_messages.h" 00056 #include "control_connection.h" 00057 #include "tia/constants.h" 00058 #include "tcp_server.h" 00059 00060 namespace tia 00061 { 00062 // forward declarations 00063 class TiAServer; 00064 class SubjectInfo; 00065 class TCPDataServer; 00066 class UDPDataServer; 00067 class SignalInfo; 00068 00069 00070 //----------------------------------------------------------------------------- 00071 00077 class ControlConnectionServer : public TCPServer 00078 { 00079 friend class ControlConnection; 00080 00081 public: 00087 ControlConnectionServer(std::map<std::string,std::string> subject_info, 00088 boost::asio::io_service& io_service, TiAServer& server); 00094 virtual ~ControlConnectionServer(); 00095 00099 TCPDataServer* tcpDataServer() const; 00100 00104 UDPDataServer* udpDataServer() const; 00105 00110 void getConfig(ConfigMsg& config); 00111 00112 // void checkConnections (boost::system::error_code error); 00113 00114 protected: 00115 typedef std::map<ControlConnection::ConnectionID, ControlConnection::pointer> CtrlConnHandlers; 00116 00117 protected: 00118 00122 void createSubjectInfo(std::map<std::string,std::string> subject_info); 00123 00127 void createSignalInfo(); 00128 00133 virtual void handleAccept(const TCPConnection::pointer& new_connection, 00134 const boost::system::error_code& error); 00135 00136 void clientHasDisconnected(const ControlConnection::ConnectionID& id); 00137 00138 private: 00139 00140 CtrlConnHandlers connections_; 00141 boost::mutex mutex_; 00142 TiAServer& server_; 00143 SubjectInfo* subject_info_; 00144 SignalInfo* signal_info_; 00145 Constants cst_; 00146 // tia::DataServer* data_server_; 00147 // std::map<unsigned, tia::ControlConnection2*> new_connections_; 00148 // std::map<unsigned, tia::Socket*> new_sockets_; 00149 // tia::HardwareInterface* hardware_interface_; 00150 // boost::asio::deadline_timer check_connections_timer_; 00151 00152 }; 00153 00154 } // Namespace tobiss 00155 00156 #endif //CONTROLCONNECTIONSERVER_H 00157 00158 // End Of File