#ifndef SERIALCLIENT_HPP #define SERIALCLIENT_HPP #include #include #include #include #include #include #include "ISerialEventHandler.hpp" class ByteSink; class ByteSource; class SerialClient { public: explicit SerialClient( std::string const& port, boost::shared_ptr handler ); ~SerialClient(); void Write( ByteSink& sink ); private: void DoWrite( ByteSink& sink ); void WriteCompleted( boost::system::error_code const& error ); void DoRead(); void ReadCompleted( ByteSource& source, boost::system::error_code const& error, std::size_t bytes_transferred ); void ServiceThread(); // Copy Construction/Assignment Prohibited. SerialClient& operator= ( SerialClient const& ); SerialClient( SerialClient const& ); boost::asio::io_service m_service; boost::asio::serial_port m_port; boost::shared_ptr m_handler; boost::thread m_serviceThread; }; #endif // SERIALCLIENT_HPP