/** @file * @author Edouard DUPIN * @copyright 2016, Edouard DUPIN, all right reserved * @license APACHE v2.0 (see license file) */ #pragma once #include #include #include #include #include namespace jus { class TcpString : public eproperty::Interface { private: enet::Tcp m_connection; std::thread* m_thread; bool m_threadRunning; public: eproperty::Value propertyIp; eproperty::Value propertyPort; eproperty::Value propertyServer; esignal::Signal signalIsConnected; esignal::Signal signalData; public: TcpString(); virtual ~TcpString(); void connect(); void disconnect(); int32_t write(const std::string& _data); std::string asyncRead(); private: std::string read(); private: void onPropertyChangeIp(); void onPropertyChangePort(); void onPropertyChangeServer(); void threadCallback(); }; }