use of org.openremote.protocol.zwave.port.ZWavePortConfiguration in project openremote by openremote.
the class ZWaveNetwork method connect.
public synchronized void connect() {
if (controller != null) {
return;
}
// Need this config object for the Z-Wave lib
ZWavePortConfiguration configuration = new ZWavePortConfiguration();
configuration.setCommLayer(ZWavePortConfiguration.CommLayer.NETTY);
configuration.setComPort(serialPort);
ioClient = new ZWaveSerialIOClient(serialPort);
ioClient.addConnectionStatusConsumer(this::onConnectionStatusChanged);
controller = new Controller(NettyConnectionManager.create(configuration, ioClient));
try {
controller.connect();
} catch (ConfigurationException | ConnectionException e) {
disposeClient();
controller = null;
ioClient = null;
onConnectionStatusChanged(ConnectionStatus.ERROR);
}
}
Aggregations