本文整理汇总了Java中gnu.io.SerialPort.FLOWCONTROL_NONE属性的典型用法代码示例。如果您正苦于以下问题:Java SerialPort.FLOWCONTROL_NONE属性的具体用法?Java SerialPort.FLOWCONTROL_NONE怎么用?Java SerialPort.FLOWCONTROL_NONE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类gnu.io.SerialPort
的用法示例。
在下文中一共展示了SerialPort.FLOWCONTROL_NONE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SerialParameters
/**
* Constructs a new <tt>SerialParameters</tt> instance with
* default values: 9600 boud - 8N1 - ASCII.
*/
public SerialParameters() {
m_PortName = "";
m_BaudRate = 9600;
m_FlowControlIn = SerialPort.FLOWCONTROL_NONE;
m_FlowControlOut = SerialPort.FLOWCONTROL_NONE;
m_Databits = SerialPort.DATABITS_8;
m_Stopbits = SerialPort.STOPBITS_1;
m_Parity = SerialPort.PARITY_NONE;
m_Encoding = Modbus.DEFAULT_SERIAL_ENCODING;
m_ReceiveTimeout = 500; //5 secs
m_Echo = false;
}
示例2: stringToFlow
/**
* 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;
}
示例3: flowToString
/**
* 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";
}
}
示例4: SerialParameters
/**
* Default constructer. Sets parameters to no port, 9600 baud, no flow control, 8 data bits, 1
* stop bit, no parity.
*/
public SerialParameters() {
this(
UI.EMPTY_STRING,
9600,
SerialPort.FLOWCONTROL_NONE,
SerialPort.FLOWCONTROL_NONE,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
}
示例5: flowToString
/**
* 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$
}
}
示例6: stringToFlow
/**
* 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;
}
示例7: getPortParameters
@Override
public SerialParameters getPortParameters(final String portName) {
return new SerialParameters(
portName,
9600,
SerialPort.FLOWCONTROL_NONE,
SerialPort.FLOWCONTROL_NONE,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
}
示例8: getPortParameters
@Override
public SerialParameters getPortParameters(final String portName) {
final SerialParameters hac5PortParameters = new SerialParameters(
portName,
4800,
SerialPort.FLOWCONTROL_NONE,
SerialPort.FLOWCONTROL_NONE,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
return hac5PortParameters;
}
示例9: getPortParameters
@Override
public SerialParameters getPortParameters(String portName) {
SerialParameters portParameters = new SerialParameters(portName,
4800,
SerialPort.FLOWCONTROL_NONE,
SerialPort.FLOWCONTROL_NONE,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
return portParameters;
}
示例10: SerialParameters
/**
* Constructs a new <tt>SerialParameters</tt> instance with
* default values.
*/
public SerialParameters() {
m_PortName = "";
m_BaudRate = 9600;
m_FlowControlIn = SerialPort.FLOWCONTROL_NONE;
m_FlowControlOut = SerialPort.FLOWCONTROL_NONE;
m_Databits = SerialPort.DATABITS_8;
m_Stopbits = SerialPort.STOPBITS_1;
m_Parity = SerialPort.PARITY_NONE;
m_Encoding = Modbus.DEFAULT_SERIAL_ENCODING;
m_ReceiveTimeout = 500; //5 secs
m_Echo = false;
}
示例11: stringToFlow
/**
* 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;
}
示例12: flowToString
/**
* 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";
}
}
示例13: testEqualsSameSerial2
@Test
public void testEqualsSameSerial2() {
ModbusSerialSlaveEndpoint e1 = new ModbusSerialSlaveEndpoint(new SerialParameters("port1", 9600,
SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE, Modbus.DEFAULT_SERIAL_ENCODING, true, 500));
ModbusSerialSlaveEndpoint e2 = new ModbusSerialSlaveEndpoint(new SerialParameters("port1", 9600,
SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE, Modbus.DEFAULT_SERIAL_ENCODING, true, 500));
Assert.assertEquals(e1, e2);
}
示例14: testEqualsSameSerial3
/**
* even though different echo parameter & baud rate, the endpoints are considered the same due to same port
*/
@Test
public void testEqualsSameSerial3() {
ModbusSerialSlaveEndpoint e1 = new ModbusSerialSlaveEndpoint(new SerialParameters("port1", 9600,
SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE, Modbus.DEFAULT_SERIAL_ENCODING, true, 500));
ModbusSerialSlaveEndpoint e2 = new ModbusSerialSlaveEndpoint(new SerialParameters("port1", 9600,
SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE, Modbus.DEFAULT_SERIAL_ENCODING, false, 500));
Assert.assertEquals(e1, e2);
Assert.assertEquals(e1.hashCode(), e2.hashCode());
}
示例15: testEqualsDifferentSerial
@Test
public void testEqualsDifferentSerial() {
ModbusSerialSlaveEndpoint e1 = new ModbusSerialSlaveEndpoint(new SerialParameters("port1", 9600,
SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE, Modbus.DEFAULT_SERIAL_ENCODING, true, 500));
ModbusSerialSlaveEndpoint e2 = new ModbusSerialSlaveEndpoint(new SerialParameters("port2", 9600,
SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE, Modbus.DEFAULT_SERIAL_ENCODING, true, 500));
Assert.assertNotEquals(e1, e2);
Assert.assertNotEquals(e1.hashCode(), e2.hashCode());
}