当前位置: 首页>>代码示例>>Java>>正文


Java SerialPort.STOPBITS_1属性代码示例

本文整理汇总了Java中gnu.io.SerialPort.STOPBITS_1属性的典型用法代码示例。如果您正苦于以下问题:Java SerialPort.STOPBITS_1属性的具体用法?Java SerialPort.STOPBITS_1怎么用?Java SerialPort.STOPBITS_1使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在gnu.io.SerialPort的用法示例。


在下文中一共展示了SerialPort.STOPBITS_1属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setStopbits

/**
 * Sets the number of stop bits.
 *
 * @param stopbits the new number of stop bits setting.
 */
public void setStopbits(double stopbits) throws IllegalArgumentException {
  if (!SerialParameterValidator.isStopbitsValid(stopbits)) {
    throw new IllegalArgumentException("stopbit value '" +
        stopbits + "' not valid");
  }

  if (stopbits == 1) {
    m_Stopbits = SerialPort.STOPBITS_1;
  } else if (stopbits == 1.5) {
    m_Stopbits = SerialPort.STOPBITS_1_5;
  } else if (stopbits == 2) {
    m_Stopbits = SerialPort.STOPBITS_2;
  } else {
    m_Stopbits = SerialPort.STOPBITS_1;
  }
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:21,代码来源:SerialParameters.java

示例2: setStopbits

/**
 * Sets the number of stop bits.
 *
 * @param stopbits the new number of stop bits setting.
 */
public void setStopbits(double stopbits) throws IllegalArgumentException {
    if (!SerialParameterValidator.isStopbitsValid(stopbits)) {
        throw new IllegalArgumentException("stopbit value '" + stopbits + "' not valid");
    }

    if (stopbits == 1) {
        m_Stopbits = SerialPort.STOPBITS_1;
    } else if (stopbits == 1.5) {
        m_Stopbits = SerialPort.STOPBITS_1_5;
    } else if (stopbits == 2) {
        m_Stopbits = SerialPort.STOPBITS_2;
    } else {
        m_Stopbits = SerialPort.STOPBITS_1;
    }
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:20,代码来源:SerialParameters.java

示例3: StreamCommand

/**
 * Creates a new instance for serial communication.
 *
 * @param listener receiving all messages/answers/errors asynchronously;
 *      there can only be one registered listener
 * @param baudRate for the serial line
 *
 * @see #setBaudRate
 */
public StreamCommand(StreamCommandListener listener,int baudRate)
{
    this.listener= listener;

    this.baudRate= baudRate;
    log.info("serial communication settings : "
            +baudRate+" baud, 8 data- 1 stop-bit, no flow control");
    dataBits= SerialPort.DATABITS_8;
    stopBits= SerialPort.STOPBITS_1;
    paritiyFlags= SerialPort.PARITY_NONE;

    port= null;
    is= null;
    os= null;

    synced= true;
    currentCommand= null;
    cmdPipe= new ArrayList<String>();
    cmdWatchdog= null;
    rtsWatchdog= null;
    message= new StreamCommandMessage();

    messageTimes= new ArrayList<Long>();
    cmdsSent= 0;
    cmdsTimeouts= 0;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:35,代码来源:StreamCommand.java

示例4: 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;
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:16,代码来源:SerialParameters.java

示例5: getStopbitsString

/**
 * Returns the number of stop bits as <tt>String</tt>.
 *
 * @return the number of stop bits as <tt>String</tt>.
 */
public String getStopbitsString() {
  switch (m_Stopbits) {
    case SerialPort.STOPBITS_1:
      return "1";
    case SerialPort.STOPBITS_1_5:
      return "1.5";
    case SerialPort.STOPBITS_2:
      return "2";
    default:
      return "1";
  }
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:17,代码来源:SerialParameters.java

示例6: 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);

}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:15,代码来源:SerialParameters.java

示例7: getStopbitsString

/**
 * Gets stop bits setting as a <code>String</code>.
 * 
 * @return Current stop bits setting.
 */
public String getStopbitsString() {
	switch (_stopbits) {
	case SerialPort.STOPBITS_1:
		return "1"; //$NON-NLS-1$
	case SerialPort.STOPBITS_1_5:
		return "1.5"; //$NON-NLS-1$
	case SerialPort.STOPBITS_2:
		return "2"; //$NON-NLS-1$
	default:
		return "1"; //$NON-NLS-1$
	}
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:17,代码来源:SerialParameters.java

示例8: setStopbits

/**
 * Sets stop bits.
 * 
 * @param stopbits
 *            New stop bits setting.
 */
public void setStopbits(final String stopbits) {
	if (stopbits.equals("1")) { //$NON-NLS-1$
		this._stopbits = SerialPort.STOPBITS_1;
	}
	if (stopbits.equals("1.5")) { //$NON-NLS-1$
		this._stopbits = SerialPort.STOPBITS_1_5;
	}
	if (stopbits.equals("2")) { //$NON-NLS-1$
		this._stopbits = SerialPort.STOPBITS_2;
	}
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:17,代码来源:SerialParameters.java

示例9: 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);
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:12,代码来源:CM4XXMDeviceReader.java

示例10: 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;
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:14,代码来源:HAC5DeviceDataReader.java

示例11: 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;
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:13,代码来源:_TemplateDeviceDataReader.java

示例12: 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;
}
 
开发者ID:dog-gateway,项目名称:jamod-rtu-over-tcp,代码行数:16,代码来源:SerialParameters.java

示例13: setStopbits

/**
 * Sets the number of stop bits from the given <tt>String</tt>.
 *
 * @param stopbits the number of stop bits as <tt>String</tt>.
 */
public void setStopbits(String stopbits) {
  if (stopbits.equals("1")) {
    m_Stopbits = SerialPort.STOPBITS_1;
  }
  if (stopbits.equals("1.5")) {
    m_Stopbits = SerialPort.STOPBITS_1_5;
  }
  if (stopbits.equals("2")) {
    m_Stopbits = SerialPort.STOPBITS_2;
  }
}
 
开发者ID:dog-gateway,项目名称:jamod-rtu-over-tcp,代码行数:16,代码来源:SerialParameters.java

示例14: getStopBits

public static int getStopBits(String sStopBitsParam) {
    switch (sStopBitsParam) {
        case "1":
            return SerialPort.STOPBITS_1;
        case "2":
            return SerialPort.STOPBITS_2;
        default:
            return SerialPort.STOPBITS_1;
    }
}
 
开发者ID:nordpos,项目名称:nordpos,代码行数:10,代码来源:SerialPortParameters.java

示例15: getStopbitsString

/**
 * Returns the number of stop bits as <tt>String</tt>.
 *
 * @return the number of stop bits as <tt>String</tt>.
 */
public String getStopbitsString() {
    switch (m_Stopbits) {
        case SerialPort.STOPBITS_1:
            return "1";
        case SerialPort.STOPBITS_1_5:
            return "1.5";
        case SerialPort.STOPBITS_2:
            return "2";
        default:
            return "1";
    }
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:17,代码来源:SerialParameters.java


注:本文中的gnu.io.SerialPort.STOPBITS_1属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。