Logo Search packages:      
Sourcecode: qmk-groundstation version File versions  Download package

unsigned long Posix_QextSerialPort::lineStatus ( void   )  [virtual]

returns the line status as stored by the port function. This function will retrieve the states of the following lines: DCD, CTS, DSR, and RI. On POSIX systems, the following additional lines can be monitored: DTR, RTS, Secondary TXD, and Secondary RXD. The value returned is an unsigned long with specific bits indicating which lines are high. The following constants should be used to examine the states of individual lines:

		Mask        Line
		------      ----
		LS_CTS      CTS
		LS_DSR      DSR
		LS_DCD      DCD
		LS_RI       RI
		LS_RTS      RTS (POSIX only)
			LS_DTR      DTR (POSIX only)
				LS_ST       Secondary TXD (POSIX only)
					LS_SR       Secondary RXD (POSIX only)
						

This function will return 0 if the port associated with the class is not currently open.

Implements QextSerialBase.

Definition at line 1038 of file posix_qextserialport.cpp.

{
      unsigned long Status=0, Temp=0;
      LOCK_MUTEX();
      if (isOpen()) {
            ioctl(Posix_File->handle(), TIOCMGET, &Temp);
            if (Temp&TIOCM_CTS) {
                  Status|=LS_CTS;
            }
            if (Temp&TIOCM_DSR) {
                  Status|=LS_DSR;
            }
            if (Temp&TIOCM_RI) {
                  Status|=LS_RI;
            }
            if (Temp&TIOCM_CD) {
                  Status|=LS_DCD;
            }
            if (Temp&TIOCM_DTR) {
                  Status|=LS_DTR;
            }
            if (Temp&TIOCM_RTS) {
                  Status|=LS_RTS;
            }
            if (Temp&TIOCM_ST) {
                  Status|=LS_ST;
            }
            if (Temp&TIOCM_SR) {
                  Status|=LS_SR;
            }
      }
      UNLOCK_MUTEX();
      return Status;
}


Generated by  Doxygen 1.6.0   Back to index