Search in sources :

Example 1 with ZWavePortConfiguration

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);
    }
}
Also used : ConfigurationException(org.openremote.controller.exception.ConfigurationException) ZWavePortConfiguration(org.openremote.protocol.zwave.port.ZWavePortConfiguration) Controller(org.openremote.protocol.zwave.model.Controller) ConnectionException(org.openremote.protocol.zwave.ConnectionException)

Aggregations

ConfigurationException (org.openremote.controller.exception.ConfigurationException)1 ConnectionException (org.openremote.protocol.zwave.ConnectionException)1 Controller (org.openremote.protocol.zwave.model.Controller)1 ZWavePortConfiguration (org.openremote.protocol.zwave.port.ZWavePortConfiguration)1