11 #ifndef ASIO_SERIAL_PORT_SERVICE_HPP 12 #define ASIO_SERIAL_PORT_SERVICE_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 20 #if defined(ASIO_HAS_SERIAL_PORT) \ 21 || defined(GENERATING_DOCUMENTATION) 37 class serial_port_service
38 #if defined(GENERATING_DOCUMENTATION)
45 #if defined(GENERATING_DOCUMENTATION) 52 #if defined(ASIO_HAS_IOCP) 53 typedef detail::win_iocp_serial_port_service service_impl_type;
55 typedef detail::reactive_serial_port_service service_impl_type;
60 #if defined(GENERATING_DOCUMENTATION) 61 typedef implementation_defined implementation_type;
63 typedef service_impl_type::implementation_type implementation_type;
67 #if defined(GENERATING_DOCUMENTATION) 68 typedef implementation_defined native_type;
70 typedef service_impl_type::native_handle_type native_type;
74 #if defined(GENERATING_DOCUMENTATION) 75 typedef implementation_defined native_handle_type;
77 typedef service_impl_type::native_handle_type native_handle_type;
82 :
asio::detail::service_base<serial_port_service>(io_service),
83 service_impl_(io_service)
88 void construct(implementation_type& impl)
90 service_impl_.construct(impl);
93 #if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) 94 void move_construct(implementation_type& impl,
96 implementation_type& other_impl)
98 service_impl_.move_construct(impl, other_impl);
102 void move_assign(implementation_type& impl,
103 serial_port_service& other_service,
104 implementation_type& other_impl)
106 service_impl_.move_assign(impl, other_service.service_impl_, other_impl);
108 #endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) 111 void destroy(implementation_type& impl)
113 service_impl_.destroy(impl);
120 return service_impl_.open(impl, device, ec);
127 return service_impl_.assign(impl, handle, ec);
131 bool is_open(
const implementation_type& impl)
const 133 return service_impl_.is_open(impl);
140 return service_impl_.close(impl, ec);
144 native_type native(implementation_type& impl)
146 return service_impl_.native_handle(impl);
150 native_handle_type native_handle(implementation_type& impl)
152 return service_impl_.native_handle(impl);
159 return service_impl_.cancel(impl, ec);
163 template <
typename SettableSerialPortOption>
167 return service_impl_.set_option(impl, option, ec);
171 template <
typename GettableSerialPortOption>
175 return service_impl_.get_option(impl, option, ec);
182 return service_impl_.send_break(impl, ec);
186 template <
typename ConstBufferSequence>
187 std::size_t write_some(implementation_type& impl,
190 return service_impl_.write_some(impl, buffers, ec);
194 template <
typename ConstBufferSequence,
typename WriteHandler>
197 async_write_some(implementation_type& impl,
198 const ConstBufferSequence& buffers,
201 detail::async_result_init<
205 service_impl_.async_write_some(impl, buffers,
init.handler);
207 return init.result.get();
211 template <
typename MutableBufferSequence>
212 std::size_t read_some(implementation_type& impl,
215 return service_impl_.read_some(impl, buffers, ec);
219 template <
typename MutableBufferSequence,
typename ReadHandler>
222 async_read_some(implementation_type& impl,
223 const MutableBufferSequence& buffers,
226 detail::async_result_init<
230 service_impl_.async_read_some(impl, buffers,
init.handler);
232 return init.result.get();
237 void shutdown_service()
239 service_impl_.shutdown_service();
243 service_impl_type service_impl_;
250 #endif // defined(ASIO_HAS_SERIAL_PORT) 253 #endif // ASIO_SERIAL_PORT_SERVICE_HPP Class used to uniquely identify a service.
Provides core I/O functionality.
asio::basic_streambuf< Allocator > MatchCondition enable_if< is_match_condition< MatchCondition >::value >::type *detail::async_result_init< ReadHandler, void(asio::error_code, std::size_t)> init(ASIO_MOVE_CAST(ReadHandler)(handler))
ASIO_INITFN_RESULT_TYPE(ComposedConnectHandler, void(asio::error_code, Iterator)) async_connect(basic_socket< Protocol
const MutableBufferSequence & buffers
asio::basic_streambuf< Allocator > CompletionCondition ASIO_MOVE_ARG(ReadHandler) handler)
Class to represent an error code value.
ASIO_DECL int close(int d, state_type &state, asio::error_code &ec)
#define ASIO_MOVE_CAST(type)
Base class for all io_service services.
ASIO_DECL int open(const char *path, int flags, asio::error_code &ec)