Logo Search packages:      
Sourcecode: libserial version File versions  Download package

short SerialStreamBuf::NumOfStopBits (  )  const

Get the number of stop bits being used during serial communication.

Returns:
The number of stop bits.

Definition at line 477 of file SerialStreamBuf.cc.

References mFileDescriptor.

Referenced by LibSerial::SerialStream::NumOfStopBits(), and SetNumOfStopBits().

                                     {
    if( -1 == mFileDescriptor ) {
        return 0 ;
    }
    //
    // Get the current terminal settings. 
    //
    struct termios term_setting ;
    if( -1 == tcgetattr(mFileDescriptor, &term_setting) ) {
        return 0 ;
    }
    //
    // If CSTOPB is set then the number of stop bits is 2 otherwise it
    // is 1.
    //
    if( term_setting.c_cflag & CSTOPB ) {
        return 2 ; 
    } else {
        return 1 ;
    }
}


Generated by  Doxygen 1.6.0   Back to index