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

const short SerialStreamBuf::SetVTime ( short  vtime  ) 

Set character buffer timing in 10th of a second.

Definition at line 695 of file SerialStreamBuf.cc.

References mFileDescriptor.

Referenced by SetParametersToDefault(), and LibSerial::SerialStream::SetVTime().

                                                   {
    if( -1 == mFileDescriptor ) {
        return -1 ;
    }

    if ( vtime < 0 || vtime > 255 ) {
        return -1 ;
    };

    //
    // Get the current terminal settings. 
    //
    struct termios term_setting ;
    if( -1 == tcgetattr(mFileDescriptor, &term_setting) ) {
        return -1 ;
    }

    term_setting.c_cc[VTIME] = (cc_t)vtime;
    //
    // Set the new settings for the serial port. 
    //
    if( -1 == tcsetattr(mFileDescriptor, TCSANOW, &term_setting) ) {
        return -1 ;
    }

    return vtime;
}


Generated by  Doxygen 1.6.0   Back to index