in demo_example/asio/asio/impl/serial_port_base.ipp [40:125]
ASIO_SYNC_OP_VOID serial_port_base::baud_rate::store(
ASIO_OPTION_STORAGE& storage, asio::error_code& ec) const
{
#if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
storage.BaudRate = value_;
#else
speed_t baud;
switch (value_)
{
// Do POSIX-specified rates first.
case 0: baud = B0; break;
case 50: baud = B50; break;
case 75: baud = B75; break;
case 110: baud = B110; break;
case 134: baud = B134; break;
case 150: baud = B150; break;
case 200: baud = B200; break;
case 300: baud = B300; break;
case 600: baud = B600; break;
case 1200: baud = B1200; break;
case 1800: baud = B1800; break;
case 2400: baud = B2400; break;
case 4800: baud = B4800; break;
case 9600: baud = B9600; break;
case 19200: baud = B19200; break;
case 38400: baud = B38400; break;
// And now the extended ones conditionally.
# ifdef B7200
case 7200: baud = B7200; break;
# endif
# ifdef B14400
case 14400: baud = B14400; break;
# endif
# ifdef B57600
case 57600: baud = B57600; break;
# endif
# ifdef B115200
case 115200: baud = B115200; break;
# endif
# ifdef B230400
case 230400: baud = B230400; break;
# endif
# ifdef B460800
case 460800: baud = B460800; break;
# endif
# ifdef B500000
case 500000: baud = B500000; break;
# endif
# ifdef B576000
case 576000: baud = B576000; break;
# endif
# ifdef B921600
case 921600: baud = B921600; break;
# endif
# ifdef B1000000
case 1000000: baud = B1000000; break;
# endif
# ifdef B1152000
case 1152000: baud = B1152000; break;
# endif
# ifdef B2000000
case 2000000: baud = B2000000; break;
# endif
# ifdef B3000000
case 3000000: baud = B3000000; break;
# endif
# ifdef B3500000
case 3500000: baud = B3500000; break;
# endif
# ifdef B4000000
case 4000000: baud = B4000000; break;
# endif
default:
ec = asio::error::invalid_argument;
ASIO_SYNC_OP_VOID_RETURN(ec);
}
# if defined(_BSD_SOURCE) || defined(_DEFAULT_SOURCE)
::cfsetspeed(&storage, baud);
# else
::cfsetispeed(&storage, baud);
::cfsetospeed(&storage, baud);
# endif
#endif
ec = asio::error_code();
ASIO_SYNC_OP_VOID_RETURN(ec);
}