#include "rcs_defs.hh"Include dependency graph for ttyintf.hh:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
| struct | rcs_serial_port_setting |
Functions | |
| char * | clean_string (char *string, int len) |
| int | print_serial_port_configuration (RCS_SERIAL_PORT_HANDLE _handle) |
| int | set_serial_port_configuration (RCS_SERIAL_PORT_HANDLE _handle, rcs_serial_port_setting *_settings) |
| RCS_SERIAL_PORT_HANDLE | open_serial_communications_port (const char *name) |
| int | read_serial_communications_port (RCS_SERIAL_PORT_HANDLE _handle, char *buf, int maxlen) |
| int | readn_serial_communications_port (RCS_SERIAL_PORT_HANDLE _handle, char *buf, int maxlen) |
| int | write_serial_communications_port (RCS_SERIAL_PORT_HANDLE _handle, char *buf, int maxlen) |
| int | close_serial_communications_port (RCS_SERIAL_PORT_HANDLE _handle) |
|
||||||||||||
|
Definition at line 116 of file ttyintf.cc. 00117 {
00118 int i = 0;
00119 char *cptr = string;
00120 char c = *cptr;
00121 if (len > 256)
00122 {
00123 len = 256;
00124 }
00125 while (i < len
00126 && (c == ' ' || c == '\t' || c == '=' || c == '\r' || c == '\n')
00127 && c != 0)
00128 {
00129 cptr++;
00130 c = *cptr;
00131 i++;
00132 }
00133 memset (clean_string_buf, 0, 256);
00134 if (c == 0 || i > len)
00135 {
00136 return clean_string_buf;
00137 }
00138 c = *cptr;
00139 char *dptr = clean_string_buf;
00140 while (i < len && c != 0 && c != ' ' && c != '\t' && c != '\r' && c != '\n')
00141 {
00142 *dptr = *cptr;
00143 cptr++;
00144 dptr++;
00145 i++;
00146 c = *cptr;
00147 }
00148 return clean_string_buf;
00149 }
|
|
|
Definition at line 28 of file _tty.c. 00029 {
00030 #ifdef UNIX_LIKE_PLAT
00031 int ttyFileFd = _handle;
00032 struct termios ttysettings;
00033 if (tcgetattr (ttyFileFd, &ttysettings) < 0)
00034 {
00035 rcs_print ("tcgetattr failed.\n");
00036 return -1;
00037 }
00038 rcs_print ("c_iflag: %x ", ttysettings.c_iflag);
00039 if (ttysettings.c_iflag & BRKINT)
00040 rcs_print ("BRKINT ");
00041 if (ttysettings.c_iflag & ICRNL)
00042 rcs_print ("ICRNL ");
00043 if (ttysettings.c_iflag & IGNBRK)
00044 rcs_print ("IGNBRK ");
00045 if (ttysettings.c_iflag & IGNCR)
00046 rcs_print ("IGNCR ");
00047 if (ttysettings.c_iflag & IMAXBEL)
00048 rcs_print ("IMAXBEL ");
00049 if (ttysettings.c_iflag & INLCR)
00050 rcs_print ("INLCR ");
00051 if (ttysettings.c_iflag & INPCK)
00052 rcs_print ("INPCK ");
00053 if (ttysettings.c_iflag & IUCLC)
00054 rcs_print ("IUCLC ");
00055 if (ttysettings.c_iflag & IXANY)
00056 rcs_print ("IXANY ");
00057 if (ttysettings.c_iflag & IXOFF)
00058 rcs_print ("IXOFF ");
00059 if (ttysettings.c_iflag & IXON)
00060 rcs_print ("IXON ");
00061 if (ttysettings.c_iflag & PARMRK)
00062 rcs_print ("PARMRK ");
00063 rcs_print ("\n");
00064 rcs_print ("c_oflag: %x ", ttysettings.c_oflag);
00065 if (ttysettings.c_oflag & BSDLY)
00066 rcs_print ("BSDLY ");
00067 if (ttysettings.c_oflag & CRDLY)
00068 rcs_print ("CRDLY ");
00069 if (ttysettings.c_oflag & FFDLY)
00070 rcs_print ("FFDLY ");
00071 if (ttysettings.c_oflag & NLDLY)
00072 rcs_print ("NLDLY ");
00073 if (ttysettings.c_oflag & OCRNL)
00074 rcs_print ("OCRNL ");
00075 if (ttysettings.c_oflag & OFDEL)
00076 rcs_print ("OFDEL ");
00077 if (ttysettings.c_oflag & OFILL)
00078 rcs_print ("OFILL ");
00079 if (ttysettings.c_oflag & OLCUC)
00080 rcs_print ("OLCUC ");
00081 if (ttysettings.c_oflag & ONLCR)
00082 rcs_print ("ONLCR ");
00083 if (ttysettings.c_oflag & ONLRET)
00084 rcs_print ("ONLRET ");
00085 if (ttysettings.c_oflag & ONOCR)
00086 rcs_print ("ONOCR ");
00087 /* if(ttysettings.c_oflag & ONOEOT) rcs_print("ONEOT "); */
00088 if (ttysettings.c_oflag & OPOST)
00089 rcs_print ("OPOST ");
00090 /* if(ttysettings.c_oflag & OXTABS) rcs_print("OXTABS "); */
00091 if (ttysettings.c_oflag & TABDLY)
00092 rcs_print ("TABDLY ");
00093 if (ttysettings.c_oflag & VTDLY)
00094 rcs_print ("VTDLY ");
00095 rcs_print ("\n");
00096 rcs_print ("c_cflag: %x ", ttysettings.c_cflag);
00097 #ifndef LINUX
00098 if (ttysettings.c_cflag & CCTS_OFLOW)
00099 rcs_print ("CCTS_OFLOW ");
00100 #endif
00101 /* if(ttysettings.c_cflag & CIGNORE) rcs_print("CIGNORE "); */
00102 if (ttysettings.c_cflag & CLOCAL)
00103 rcs_print ("CLOCAL ");
00104 if (ttysettings.c_cflag & CREAD)
00105 rcs_print ("CREAD ");
00106 #ifndef LINUX
00107 if (ttysettings.c_cflag & CRTS_IFLOW)
00108 rcs_print ("CRTS_IFLOW ");
00109 #endif
00110 if ((ttysettings.c_cflag & CSIZE) == CS5)
00111 rcs_print ("CS5 ");
00112 if ((ttysettings.c_cflag & CSIZE) == CS6)
00113 rcs_print ("CS6 ");
00114 if ((ttysettings.c_cflag & CSIZE) == CS7)
00115 rcs_print ("CS7 ");
00116 if ((ttysettings.c_cflag & CSIZE) == CS8)
00117 rcs_print ("CS8 ");
00118 if (ttysettings.c_cflag & CSTOPB)
00119 rcs_print ("CSTOPB ");
00120 if (ttysettings.c_cflag & HUPCL)
00121 rcs_print ("HUPCL ");
00122 /* if(ttysettings.c_cflag & MDMBUF) rcs_print("MDMBUF "); */
00123 if (ttysettings.c_cflag & PARENB)
00124 rcs_print ("PARENB ");
00125 if (ttysettings.c_cflag & PARODD)
00126 rcs_print ("PARODD ");
00127 rcs_print ("\n");
00128 rcs_print ("c_lflag: %x ", ttysettings.c_lflag);
00129 /*if(ttysettings.c_cflag & ALTWERASE) rcs_print("ALTWERASE "); */
00130 if (ttysettings.c_cflag & ECHO)
00131 rcs_print ("ECHO ");
00132 if (ttysettings.c_cflag & ECHOCTL)
00133 rcs_print ("ECHOCTL ");
00134 if (ttysettings.c_cflag & ECHOE)
00135 rcs_print ("ECHOE ");
00136 if (ttysettings.c_cflag & ECHOK)
00137 rcs_print ("ECHOK ");
00138 if (ttysettings.c_cflag & ECHOKE)
00139 rcs_print ("ECHOKE ");
00140 if (ttysettings.c_cflag & ECHONL)
00141 rcs_print ("ECHONL ");
00142 if (ttysettings.c_cflag & ECHOPRT)
00143 rcs_print ("ECHOPRT ");
00144 if (ttysettings.c_cflag & FLUSHO)
00145 rcs_print ("FLUSHO ");
00146 if (ttysettings.c_cflag & ICANON)
00147 rcs_print ("ICANON ");
00148 if (ttysettings.c_cflag & IEXTEN)
00149 rcs_print ("IEXTEN ");
00150 if (ttysettings.c_cflag & ISIG)
00151 rcs_print ("ISIG ");
00152 if (ttysettings.c_cflag & NOFLSH)
00153 rcs_print ("NOFLSH ");
00154 /* if(ttysettings.c_cflag & NOKERNINFO) rcs_print("NOKERNINFO "); */
00155 if (ttysettings.c_cflag & PENDIN)
00156 rcs_print ("PENDIN ");
00157 if (ttysettings.c_cflag & TOSTOP)
00158 rcs_print ("TOSTOP ");
00159 if (ttysettings.c_cflag & XCASE)
00160 rcs_print ("XCASE ");
00161 rcs_print ("\n");
00162 #endif
00163
00164 #ifdef WIN32
00165 DCB dcb;
00166 if (!GetCommState (_handle, &dcb))
00167 {
00168 return -1;
00169 }
00170 rcs_print ("DCBlength=%d\n", dcb.DCBlength); /* sizeof(DCB) */
00171
00172 rcs_print ("BaudRate=%d\n", dcb.BaudRate); /* current baud rate */
00173 rcs_print ("fBinary=%d\n", dcb.fBinary); /* binary mode, no EOF check */
00174 rcs_print ("fParity=%d\n", dcb.fParity); /* enable parity checking */
00175 rcs_print ("fOutxCtsFlow=%d\n", dcb.fOutxCtsFlow); /* CTS output flow control */
00176 rcs_print ("fOutxDsrFlow=%d\n", dcb.fOutxDsrFlow); /* DSR output flow control */
00177 rcs_print ("fDtrControl=%d\n", dcb.fDsrSensitivity); /* DTR flow control type */
00178 rcs_print ("fDsrSensitivity=%d\n", dcb.fDsrSensitivity); /* DSR sensitivity */
00179 rcs_print ("fTXContinueOnXoff=%d\n", dcb.fTXContinueOnXoff); /* XOFF continues Tx */
00180 rcs_print ("fOutX=%d\n", dcb.fOutX); /* XON/XOFF out flow control */
00181 rcs_print ("fInX=%d\n", dcb.fInX); /* XON/XOFF in flow control */
00182 rcs_print ("fErrorChar=%d\n", dcb.fErrorChar); /* enable error replacement */
00183 rcs_print ("fNull=%d\n", dcb.fNull); /* enable null stripping */
00184 rcs_print ("fRtsControl=%d\n", dcb.fRtsControl); /* RTS flow control */
00185 rcs_print ("fAbortOnError=%d\n", dcb.fAbortOnError); /* abort reads/writes on error */
00186 rcs_print ("XonLim=%d\n", dcb.XonLim); /* transmit XON threshold */
00187 rcs_print ("XoffLim=%d\n", dcb.XoffLim); /* transmit XOFF threshold */
00188 rcs_print ("ByteSize=%d\n", dcb.ByteSize); /* number of bits/byte, 4-8 */
00189 rcs_print ("Parity=%d\n", dcb.Parity); /* 0-4=no,odd,even,mark,space */
00190 rcs_print ("StopBits=%d\n", dcb.StopBits); /* 0,1,2 = 1, 1.5, 2 */
00191 rcs_print ("XonChar=%x %c\n", dcb.XoffChar, dcb.XoffChar); /* Tx and Rx XON character */
00192 rcs_print ("XoffChar=%x %c\n", dcb.XoffChar, dcb.XoffChar); /* Tx and Rx XOFF character */
00193 rcs_print ("ErrorChar=%x %c\n", dcb.ErrorChar, dcb.ErrorChar); /* error replacement character */
00194 rcs_print ("EofChar=%x %c\n", dcb.EofChar, dcb.EofChar); /* end of input character */
00195 rcs_print ("EvtChar=%x %c\n", dcb.EvtChar, dcb.EvtChar); /* received event character */
00196 return 0;
00197 #endif
00198 }
|
|
||||||||||||
|
|
|
|
|
|
||||||||||||||||
|
Definition at line 372 of file _tty.c. 00374 {
00375 #ifdef UNIX_LIKE_PLAT
00376 int ttyFileFd = _handle;
00377 int bytes_read = read (ttyFileFd, buf, maxlen);
00378 return bytes_read;
00379 #endif
00380 #ifdef WIN32
00381 unsigned long bytes_read = 0;
00382 if (!ReadFile (_handle, buf, maxlen, &bytes_read, NULL))
00383 {
00384 return -1;
00385 }
00386 return bytes_read;
00387 #endif
00388 }
|
|
||||||||||||||||
|
Definition at line 687 of file ttyintf.cc. Referenced by TTYMEM::check_if_read(), TTYMEM::clear(), TTYMEM::peek(), TTYMEM::read(), CMS_SERVER_REMOTE_TTY_PORT::run(), TTYMEM::verify_bufname(), TTYMEM::write(), and TTYMEM::write_if_read().
00689 {
00690 int bytes_read = 0;
00691 while (bytes_read < len)
00692 {
00693 int rval = read_serial_communications_port (_handle, buf + bytes_read,
00694 len - bytes_read);
00695 if (rval < 0)
00696 {
00697 return rval;
00698 }
00699 bytes_read += rval;
00700 }
00701 return bytes_read;
00702 }
|
|
||||||||||||||||
|
Definition at line 391 of file _tty.c. 00393 {
00394 #ifdef UNIX_LIKE_PLAT
00395 int ttyFileFd = _handle;
00396 return write (ttyFileFd, buf, maxlen);
00397 #endif
00398 #ifdef WIN32
00399 unsigned long bytes_written = 0;
00400 if (!WriteFile (_handle, buf, maxlen, &bytes_written, NULL))
00401 {
00402 return -1;
00403 }
00404 return bytes_written;
00405 #endif
00406 }
|
|
|
Definition at line 649 of file ttyintf.cc. Referenced by CMS_SERVER_REMOTE_TTY_PORT::unregister_port(), and TTYMEM::~TTYMEM().
00650 {
00651 if (removeHandle (_handle))
00652 {
00653 return 0;
00654 }
00655 #ifdef UNIX
00656 return close (_handle);
00657 #endif
00658 #ifdef WIN32
00659 return CloseHandle (_handle);
00660 #endif
00661 }
|
1.2.11.1 written by Dimitri van Heesch,
© 1997-2001