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

const short SerialStreamBuf::SetVMin ( short  vtime  ) 

Set character buffer size.

Definition at line 652 of file SerialStreamBuf.cc.

References mFileDescriptor.

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

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

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

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

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

    return vmin;
}


Generated by  Doxygen 1.6.0   Back to index