File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,6 +46,11 @@ struct BOOST_SYMBOL_VISIBLE serial_port final : stream
4646 [[nodiscard]] BOOST_COBALT_IO_DECL system::result<void > set_parity (parity rate);
4747 [[nodiscard]] BOOST_COBALT_IO_DECL system::result<parity> get_parity ();
4848
49+ using stop_bits = asio::serial_port_base::stop_bits::type;
50+
51+ [[nodiscard]] BOOST_COBALT_IO_DECL system::result<void > set_stop_bits (stop_bits stop_bits);
52+ [[nodiscard]] BOOST_COBALT_IO_DECL system::result<stop_bits> get_stop_bits ();
53+
4954 using native_handle_type = typename asio::basic_serial_port<executor>::native_handle_type;
5055 native_handle_type native_handle () {return serial_port_.native_handle ();}
5156
Original file line number Diff line number Diff line change @@ -95,6 +95,21 @@ auto serial_port::get_parity() -> system::result<parity>
9595 return ec ? ec : system::result<parity>(br.value ());
9696}
9797
98+ system::result<void > serial_port::set_stop_bits (stop_bits stop_bits)
99+ {
100+ system::error_code ec;
101+ serial_port_.set_option (asio::serial_port_base::stop_bits (stop_bits), ec);
102+ return ec ? ec : boost::system::result<void >();
103+ }
104+
105+ auto serial_port::get_stop_bits () -> system::result<stop_bits>
106+ {
107+ system::error_code ec;
108+ asio::serial_port_base::stop_bits sb;
109+ serial_port_.get_option (sb, ec);
110+ return ec ? ec : boost::system::result<stop_bits>(sb.value ());
111+ }
112+
98113serial_port::serial_port (const cobalt::executor & executor)
99114 : serial_port_(executor) {}
100115serial_port::serial_port (std::string_view device, const cobalt::executor & executor)
You can’t perform that action at this time.
0 commit comments