|
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 00034 #ifndef TIA_NEW_CLIENT_IMPL_H 00035 #define TIA_NEW_CLIENT_IMPL_H 00036 00037 #include "tia_client_impl_base.h" 00038 #include "tia/ssconfig.h" 00039 #include "../newtia/network/socket.h" 00040 #include "../newtia/messages/tia_control_message_builder.h" 00041 #include "../newtia/messages/tia_control_message_parser.h" 00042 00043 00044 00045 #include <boost/asio.hpp> 00046 00047 namespace tia 00048 { 00049 00050 class TiADataPacketParser; 00051 00052 //----------------------------------------------------------------------------- 00058 class TiANewClientImpl : public TiAClientImplBase 00059 { 00060 public: 00061 TiANewClientImpl (); 00062 00063 virtual ~TiANewClientImpl(); 00064 00065 00066 virtual void connect (const std::string& address, short unsigned port); 00067 00068 virtual bool connected () const; 00069 00070 virtual void disconnect (); 00071 00072 virtual void requestConfig (); 00073 00074 virtual SSConfig config () const; 00075 00076 virtual void startReceiving (bool use_udp_bc); 00077 00078 virtual bool receiving() const; 00079 00080 virtual void stopReceiving(); 00081 00082 virtual void getDataPacket (DataPacket& packet); 00083 00087 virtual DataPacket* getEmptyDataPacket(); 00088 00089 virtual void setBufferSize (size_t size); 00090 00091 private: 00092 void sendMessage (TiAControlMessage const& message); 00093 void waitForOKResponse (); 00094 void waitForErrorResponse (); 00095 00096 00097 //------------------------------------------------------------------------- 00098 TiAControlMessage waitForControlMessage (std::string const& command_name); 00099 00100 00101 std::string const MESSAGE_VERSION_; 00102 std::string server_ip_address_; 00103 bool receiving_; 00104 00105 SSConfig config_; 00106 unsigned buffer_size_; 00107 00108 boost::asio::io_service io_service_; 00109 std::auto_ptr<Socket> socket_; 00110 std::auto_ptr<ReadSocket> data_socket_; 00111 std::auto_ptr<TiAControlMessageBuilder> message_builder_; 00112 std::auto_ptr<TiAControlMessageParser> message_parser_; 00113 std::auto_ptr<TiADataPacketParser> data_packet_parser; 00114 boost::shared_ptr<DataPacket> packet_; 00115 // std::auto_ptr<TiAControlMessageParser> message_parser_; 00116 }; 00117 00118 00119 } 00120 00121 #endif // TIA_NEW_CLIENT_IMPL_H