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_streams_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                         this->device().open(port_name, baud_rate, data_bits, stop_bits, parity);
00070                         if ( !this->device().open() ) {
00071                                 error = this->device().error();
00072                         }
00073                 } ecl_catch(StandardException &e) {
00074                         ecl_throw(StandardException(LOC,e));
00075                 }
00076         }
00077         virtual ~SerialStream() {};
00078 
00079 };
00080 
00081 } // namespace ecl
00082 
00083 
00084 #endif /* ECL_STREAMS_SERIAL_STREAM_HPP_ */


ecl_streams
Author(s): Daniel Stonier
autogenerated on Thu Jun 6 2019 21:18:12