@Override
public void connect() throws OpenEnergyMonitorException {
try {
CommPortIdentifier portIdentifier = CommPortIdentifier
.getPortIdentifier(portName);
CommPort commPort = portIdentifier.open(this.getClass().getName(),
2000);
serialPort = (SerialPort) commPort;
serialPort.setSerialPortParams(BAUDRATE, SerialPort.DATABITS_8,
SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
in = serialPort.getInputStream();
logger.debug("Open Energy Monitor Serial Port message listener started");
} catch (Exception e) {
throw new OpenEnergyMonitorException(e);
}
}
OpenEnergyMonitorSerialConnector.java 文件源码
java
阅读 19
收藏 0
点赞 0
评论 0
项目:openhab-hdl
作者:
评论列表
文章目录