Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / asio / doc / overview / serial_ports.qbk
1 [/
2  / Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
3  /
4  / Distributed under the Boost Software License, Version 1.0. (See accompanying
5  / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6  /]
7
8 [section:serial_ports Serial Ports]
9
10 Boost.Asio includes classes for creating and manipulating serial ports in a portable
11 manner. For example, a serial port may be opened using:
12
13   serial_port port(my_io_service, name);
14
15 where name is something like `"COM1"` on Windows, and `"/dev/ttyS0"` on POSIX
16 platforms.
17
18 Once opened, the serial port may be used as a [link boost_asio.overview.core.streams
19 stream]. This means the objects can be used with any of the [link
20 boost_asio.reference.read read()], [link boost_asio.reference.async_read async_read()],
21 [link boost_asio.reference.write write()], [link boost_asio.reference.async_write
22 async_write()], [link boost_asio.reference.read_until read_until()] or [link
23 boost_asio.reference.async_read_until async_read_until()] free functions.
24
25 The serial port implementation also includes option classes for configuring the
26 port's baud rate, flow control type, parity, stop bits and character size.
27
28 [heading See Also]
29
30 [link boost_asio.reference.serial_port serial_port],
31 [link boost_asio.reference.serial_port_base serial_port_base],
32 [link boost_asio.reference.basic_serial_port basic_serial_port],
33 [link boost_asio.reference.serial_port_service serial_port_service],
34 [link boost_asio.reference.serial_port_base__baud_rate serial_port_base::baud_rate],
35 [link boost_asio.reference.serial_port_base__flow_control serial_port_base::flow_control],
36 [link boost_asio.reference.serial_port_base__parity serial_port_base::parity],
37 [link boost_asio.reference.serial_port_base__stop_bits serial_port_base::stop_bits],
38 [link boost_asio.reference.serial_port_base__character_size serial_port_base::character_size].
39
40 [heading Notes]
41
42 Serial ports are available on all POSIX platforms. For Windows, serial ports
43 are only available at compile time when the I/O completion port backend is used
44 (which is the default). A program may test for the macro
45 `BOOST_ASIO_HAS_SERIAL_PORT` to determine whether they are supported.
46
47 [endsect]