serial_stream.hpp
Go to the documentation of this file.
1 
8 /*****************************************************************************
9 ** Ifdefs
10 *****************************************************************************/
11 
12 #ifndef ECL_STREAMS_SERIAL_STREAM_HPP_
13 #define ECL_STREAMS_SERIAL_STREAM_HPP_
14 
15 /*****************************************************************************
16 ** Includes
17 *****************************************************************************/
18 
19 #include <string>
20 #include <ecl/config/macros.hpp>
21 #include <ecl/devices/serial.hpp>
23 #include "text_stream.hpp"
24 
25 /*****************************************************************************
26 ** Namespaces
27 *****************************************************************************/
28 
29 namespace ecl {
30 
31 /*****************************************************************************
32 ** Interfaces [SerialStream]
33 *****************************************************************************/
42 class ecl_streams_PUBLIC SerialStream : public TextStream<Serial> {
43 public:
50  SerialStream() {};
65  SerialStream(const std::string& port_name, const BaudRate &baud_rate = BaudRate_115200, const DataBits &data_bits = DataBits_8,
66  const StopBits &stop_bits = StopBits_1, const Parity &parity = NoParity)
67  {
68  ecl_try {
69  this->device().open(port_name, baud_rate, data_bits, stop_bits, parity);
70  if ( !this->device().open() ) {
71  error = this->device().error();
72  }
73  } ecl_catch(StandardException &e) {
74  ecl_throw(StandardException(LOC,e));
75  }
76  }
77  virtual ~SerialStream() {};
78 
79 };
80 
81 } // namespace ecl
82 
83 
84 #endif /* ECL_STREAMS_SERIAL_STREAM_HPP_ */
ecl::DataBits_8
DataBits_8
ecl_try
#define ecl_try
ecl::BaudRate_115200
BaudRate_115200
Parity
Parity
ecl::NoParity
NoParity
ecl_streams_PUBLIC
#define ecl_streams_PUBLIC
Definition: macros.hpp:37
serial.hpp
DataBits
DataBits
BaudRate
BaudRate
standard_exception.hpp
ecl_catch
#define ecl_catch(exception)
ecl_throw
#define ecl_throw(exception)
ecl::StopBits_1
StopBits_1
text_stream.hpp
Convenience header for various text streams.
macros.hpp
ecl
StopBits
StopBits


ecl_streams
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:16:48