TTY_IO.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    TTY_IO.h
00006  *
00007  *  $Id: TTY_IO.h 80826 2008-03-04 14:51:23Z wotte $
00008  *
00009  *  @author Douglas C. Schmidt <schmidt@uci.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef ACE_TTY_IO_H
00014 #define ACE_TTY_IO_H
00015 
00016 #include "ace/DEV_IO.h"
00017 
00018 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00019 # pragma once
00020 #endif /* ACE_LACKS_PRAGMA_ONCE */
00021 
00022 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00023 
00024 /**
00025  * @class ACE_TTY_IO
00026  *
00027  * @brief Class definitions for platform specific TTY features.
00028  *
00029  * This class represents an example interface for a specific
00030  * device (a serial line). It extends the capability of the
00031  * underlying DEV_IO class by adding a control method that takes
00032  * a special structure (Serial_Params) as argument to allow a
00033  * comfortable user interface (away from that annoying termios
00034  * structure, which is very specific to UNIX).
00035  */
00036 class ACE_Export ACE_TTY_IO : public ACE_DEV_IO
00037 {
00038 public:
00039   enum Control_Mode
00040   {
00041     SETPARAMS,              ///< Set control parameters.
00042     GETPARAMS               ///< Get control parameters.
00043   };
00044 
00045   struct ACE_Export Serial_Params
00046   {
00047     Serial_Params (void);
00048 
00049     /** Specifies the baudrate at which the communnication port operates. */
00050     int baudrate;
00051     /** Specifies the minimum number of bytes in input buffer before XON char
00052         is sent. Negative value indicates that default value should
00053         be used (Win32). */
00054     int xonlim;
00055     /** Specifies the maximum number of bytes in input buffer before XOFF char
00056         is sent. Negative value indicates that default value should
00057         be used (Win32). */
00058     int xofflim;
00059     /** Specifies the minimum number of characters for non-canonical
00060         read (POSIX). */
00061     unsigned int readmincharacters;
00062     /** Specifies the time to wait before returning from read. Negative value
00063         means infinite timeout. */
00064     int readtimeoutmsec;
00065     /** 
00066       * @deprecated
00067       *   Note that this member is going away in a subsequent
00068       *   release. Use <code>paritymode = "none"</code> to disable parity
00069       *   checking.
00070       *
00071       * Enable/disable parity checking.
00072       */
00073     bool parityenb;
00074     /** Specifies the parity mode. POSIX supports "none", "even" and
00075         "odd" parity. Additionally Win32 supports "mark" and "space"
00076         parity modes. */
00077     const char *paritymode;
00078     /** Enable & set CTS mode. Note that RTS & CTS are enabled/disabled
00079         together on some systems (RTS/CTS is enabled if either
00080         <code>ctsenb</code> or <code>rtsenb</code> is set). */
00081     bool ctsenb;
00082     /** Enable & set RTS mode. Note that RTS & CTS are enabled/disabled
00083         together on some systems (RTS/CTS is enabled if either
00084         <code>ctsenb</code> or <code>rtsenb</code> is set).
00085         - 0 = Disable RTS.
00086         - 1 = Enable RTS.
00087         - 2 = Enable RTS flow-control handshaking (Win32).
00088         - 3 = Specifies that RTS line will be high if bytes are available
00089               for transmission. After transmission RTS will be low (Win32). */
00090     unsigned char rtsenb;
00091     /** Enable/disable software flow control on input. */
00092     bool xinenb;
00093     /** Enable/disable software flow control on output. */
00094     bool xoutenb;
00095     /** Specifies if device is a modem (POSIX). If not set modem status
00096         lines are ignored. */
00097     bool modem;
00098     /** Enable/disable receiver (POSIX). */
00099     bool rcvenb;
00100     /** Controls whether DSR is disabled or enabled (Win32). */
00101     bool dsrenb;
00102     /** Controls whether DTR is disabled or enabled. */
00103     bool dtrdisable;
00104     /** Data bits. Valid values 5, 6, 7 and 8 data bits.
00105         Additionally Win32 supports 4 data bits. */
00106     unsigned char databits;
00107     /** Stop bits. Valid values are 1 and 2. */
00108     unsigned char stopbits;
00109   };
00110 
00111   /** Interface for reading/writing serial device parameters. */
00112   int control (Control_Mode cmd, Serial_Params *arg) const;
00113 
00114 #if defined (ACE_NEEDS_DEV_IO_CONVERSION)
00115   /** This is necessary to pass ACE_TTY_IO as parameter to DEV_Connector. */
00116   operator ACE_DEV_IO &();
00117 #endif /* ACE_NEEDS_DEV_IO_CONVERSION */
00118 };
00119 
00120 ACE_END_VERSIONED_NAMESPACE_DECL
00121 
00122 #endif /* ACE_TTY_IO_H */

Generated on Tue Feb 2 17:18:43 2010 for ACE by  doxygen 1.4.7