serial_stream.hpp
Go to the documentation of this file.
00001 
00008 /*****************************************************************************
00009 ** Ifdefs
00010 *****************************************************************************/
00011 
00012 #ifndef ECL_STREAMS_SERIAL_STREAM_HPP_
00013 #define ECL_STREAMS_SERIAL_STREAM_HPP_
00014 
00015 /*****************************************************************************
00016 ** Includes
00017 *****************************************************************************/
00018 
00019 #include <string>
00020 #include <ecl/config/macros.hpp>
00021 #include <ecl/devices/serial.hpp>
00022 #include <ecl/exceptions/standard_exception.hpp>
00023 #include "text_stream.hpp"
00024 
00025 /*****************************************************************************
00026 ** Namespaces
00027 *****************************************************************************/
00028 
00029 namespace ecl {
00030 
00031 /*****************************************************************************
00032 ** Interfaces [SerialStream]
00033 *****************************************************************************/
00042 class ECL_PUBLIC SerialStream : public TextStream<Serial> {
00043 public:
00050         SerialStream() {};
00065         SerialStream(const std::string& port_name, const BaudRate &baud_rate = BaudRate_115200, const DataBits &data_bits = DataBits_8,
00066                         const StopBits &stop_bits = StopBits_1, const Parity &parity = NoParity) ecl_throw_decl(StandardException)
00067         {
00068                 ecl_try {
00069                         if ( !this->device().open(port_name, baud_rate, data_bits, stop_bits, parity) ) {
00070                                 error = this->device().error();
00071                         }
00072                 } ecl_catch(StandardException &e) {
00073                         ecl_throw(StandardException(LOC,e));
00074                 }
00075         }
00076         virtual ~SerialStream() {};
00077 
00078 };
00079 
00080 } // namespace ecl
00081 
00082 
00083 #endif /* ECL_STREAMS_SERIAL_STREAM_HPP_ */


ecl_streams
Author(s): Daniel Stonier (d.stonier@gmail.com)
autogenerated on Thu Jan 2 2014 11:12:54