Java Code Examples for gnu.io.SerialPort#FLOWCONTROL_XONXOFF_OUT

The following examples show how to use gnu.io.SerialPort#FLOWCONTROL_XONXOFF_OUT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SerialParameters.java    From openhab1-addons with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Converts a <tt>String</tt> describing a flow control type to the
 * <tt>int</tt> which is defined in SerialPort.
 *
 * @param flowcontrol the <tt>String</tt> describing the flow control type.
 * @return the <tt>int</tt> describing the flow control type.
 */
private int stringToFlow(String flowcontrol) {
    flowcontrol = flowcontrol.toLowerCase();
    if (flowcontrol.equals("none")) {
        return SerialPort.FLOWCONTROL_NONE;
    }
    if (flowcontrol.equals("xon/xoff out")) {
        return SerialPort.FLOWCONTROL_XONXOFF_OUT;
    }
    if (flowcontrol.equals("xon/xoff in")) {
        return SerialPort.FLOWCONTROL_XONXOFF_IN;
    }
    if (flowcontrol.equals("rts/cts in")) {
        return SerialPort.FLOWCONTROL_RTSCTS_IN;
    }
    if (flowcontrol.equals("rts/cts out")) {
        return SerialPort.FLOWCONTROL_RTSCTS_OUT;
    }
    return SerialPort.FLOWCONTROL_NONE;
}
 
Example 2
Source File: SerialParameters.java    From openhab1-addons with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Converts an <tt>int</tt> describing a flow control type to a
 * String describing a flow control type.
 *
 * @param flowcontrol the <tt>int</tt> describing the
 *            flow control type.
 * @return the <tt>String</tt> describing the flow control type.
 */
private String flowToString(int flowcontrol) {
    switch (flowcontrol) {
        case SerialPort.FLOWCONTROL_NONE:
            return "none";
        case SerialPort.FLOWCONTROL_XONXOFF_OUT:
            return "xon/xoff out";
        case SerialPort.FLOWCONTROL_XONXOFF_IN:
            return "xon/xoff in";
        case SerialPort.FLOWCONTROL_RTSCTS_IN:
            return "rts/cts in";
        case SerialPort.FLOWCONTROL_RTSCTS_OUT:
            return "rts/cts out";
        default:
            return "none";
    }
}
 
Example 3
Source File: SerialParameters.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Converts a <code>String</code> describing a flow control type to an <code>int</code> type
 * defined in <code>SerialPort</code>.
 * 
 * @param flowControl
 *            A <code>string</code> describing a flow control type.
 * @return An <code>int</code> describing a flow control type.
 */
private int stringToFlow(final String flowControl){
	if (flowControl.equals("None")) { //$NON-NLS-1$
		return SerialPort.FLOWCONTROL_NONE;
	}
	if (flowControl.equals("Xon/Xoff Out")) { //$NON-NLS-1$
		return SerialPort.FLOWCONTROL_XONXOFF_OUT;
	}
	if (flowControl.equals("Xon/Xoff In")) { //$NON-NLS-1$
		return SerialPort.FLOWCONTROL_XONXOFF_IN;
	}
	if (flowControl.equals("RTS/CTS In")) { //$NON-NLS-1$
		return SerialPort.FLOWCONTROL_RTSCTS_IN;
	}
	if (flowControl.equals("RTS/CTS Out")) { //$NON-NLS-1$
		return SerialPort.FLOWCONTROL_RTSCTS_OUT;
	}
	return SerialPort.FLOWCONTROL_NONE;
}
 
Example 4
Source File: SerialParameters.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Converts an <code>int</code> describing a flow control type to a <code>String</code>
 * describing a flow control type.
 * 
 * @param flowControl
 *            An <code>int</code> describing a flow control type.
 * @return A <code>String</code> describing a flow control type.
 */
String flowToString(final int flowControl){
	switch (flowControl) {
	case SerialPort.FLOWCONTROL_NONE:
		return "None"; //$NON-NLS-1$
	case SerialPort.FLOWCONTROL_XONXOFF_OUT:
		return "Xon/Xoff Out"; //$NON-NLS-1$
	case SerialPort.FLOWCONTROL_XONXOFF_IN:
		return "Xon/Xoff In"; //$NON-NLS-1$
	case SerialPort.FLOWCONTROL_RTSCTS_IN:
		return "RTS/CTS In"; //$NON-NLS-1$
	case SerialPort.FLOWCONTROL_RTSCTS_OUT:
		return "RTS/CTS Out"; //$NON-NLS-1$
	default:
		return "None"; //$NON-NLS-1$
	}
}