3 //=============================================================================
7 * $Id: TTY_IO.h 82271 2008-07-09 09:23:03Z olli $
9 * @author Douglas C. Schmidt <schmidt@uci.edu>
11 //=============================================================================
16 #include "ace/DEV_IO.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
27 * @brief Class definitions for platform specific TTY features.
29 * This class represents an example interface for a specific
30 * device (a serial line). It extends the capability of the
31 * underlying DEV_IO class by adding a control method that takes
32 * a special structure (Serial_Params) as argument to allow a
33 * comfortable user interface (away from that annoying termios
34 * structure, which is very specific to UNIX).
36 class ACE_Export ACE_TTY_IO
: public ACE_DEV_IO
41 SETPARAMS
, ///< Set control parameters.
42 GETPARAMS
///< Get control parameters.
45 struct ACE_Export Serial_Params
49 /** Specifies the baudrate at which the communnication port operates. */
51 /** Specifies the minimum number of bytes in input buffer before XON char
52 is sent. Negative value indicates that default value should
55 /** Specifies the maximum number of bytes in input buffer before XOFF char
56 is sent. Negative value indicates that default value should
59 /** Specifies the minimum number of characters for non-canonical
61 unsigned int readmincharacters
;
62 /** Specifies the time to wait before returning from read. Negative value
63 means infinite timeout. */
65 /** Specifies the parity mode. POSIX supports "none", "even" and
66 "odd" parity. Additionally Win32 supports "mark" and "space"
68 const char *paritymode
;
69 /** Enable & set CTS mode. Note that RTS & CTS are enabled/disabled
70 together on some systems (RTS/CTS is enabled if either
71 <code>ctsenb</code> or <code>rtsenb</code> is set). */
73 /** Enable & set RTS mode. Note that RTS & CTS are enabled/disabled
74 together on some systems (RTS/CTS is enabled if either
75 <code>ctsenb</code> or <code>rtsenb</code> is set).
78 - 2 = Enable RTS flow-control handshaking (Win32).
79 - 3 = Specifies that RTS line will be high if bytes are available
80 for transmission. After transmission RTS will be low (Win32). */
82 /** Enable/disable software flow control on input. */
84 /** Enable/disable software flow control on output. */
86 /** Specifies if device is a modem (POSIX). If not set modem status
89 /** Enable/disable receiver (POSIX). */
91 /** Controls whether DSR is disabled or enabled (Win32). */
93 /** Controls whether DTR is disabled or enabled. */
95 /** Data bits. Valid values 5, 6, 7 and 8 data bits.
96 Additionally Win32 supports 4 data bits. */
97 unsigned char databits
;
98 /** Stop bits. Valid values are 1 and 2. */
99 unsigned char stopbits
;
102 /** Interface for reading/writing serial device parameters. */
103 int control (Control_Mode cmd
, Serial_Params
*arg
) const;
105 #if defined (ACE_NEEDS_DEV_IO_CONVERSION)
106 /** This is necessary to pass ACE_TTY_IO as parameter to DEV_Connector. */
107 operator ACE_DEV_IO
&();
108 #endif /* ACE_NEEDS_DEV_IO_CONVERSION */
111 ACE_END_VERSIONED_NAMESPACE_DECL
113 #endif /* ACE_TTY_IO_H */