Search in sources :

Example 1 with DSID

use of org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.impl.DSID in project smarthome by eclipse.

the class DeviceStatusManagerImpl method unregisterDeviceListener.

@Override
public void unregisterDeviceListener(DeviceStatusListener deviceListener) {
    if (deviceListener != null) {
        String id = deviceListener.getDeviceStatusListenerID();
        logger.debug("unregister DeviceListener with id: {}", id);
        if (id.equals(DeviceStatusListener.DEVICE_DISCOVERY)) {
            this.deviceDiscovery = null;
        } else {
            Device intDevice = strucMan.getDeviceByDSID(deviceListener.getDeviceStatusListenerID());
            if (intDevice != null) {
                intDevice.unregisterDeviceStatusListener();
            } else {
                Circuit intCircuit = strucMan.getCircuitByDSID(new DSID(deviceListener.getDeviceStatusListenerID()));
                if (intCircuit != null) {
                    intCircuit.unregisterDeviceStatusListener();
                    if (deviceDiscovery != null) {
                        deviceDiscovery.onDeviceAdded(intCircuit);
                    }
                }
            }
        }
    }
}
Also used : Device(org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.Device) Circuit(org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.Circuit) DSID(org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.impl.DSID)

Example 2 with DSID

use of org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.impl.DSID in project smarthome by eclipse.

the class DeviceStatusManagerImpl method registerDeviceListener.

@Override
public void registerDeviceListener(DeviceStatusListener deviceListener) {
    if (deviceListener != null) {
        String id = deviceListener.getDeviceStatusListenerID();
        if (id.equals(DeviceStatusListener.DEVICE_DISCOVERY)) {
            this.deviceDiscovery = deviceListener;
            logger.debug("register Device-Discovery ");
            for (Device device : strucMan.getDeviceMap().values()) {
                deviceDiscovery.onDeviceAdded(device);
            }
            for (Circuit circuit : strucMan.getCircuitMap().values()) {
                deviceDiscovery.onDeviceAdded(circuit);
            }
        } else {
            Device intDevice = strucMan.getDeviceByDSID(deviceListener.getDeviceStatusListenerID());
            if (intDevice != null) {
                logger.debug("register DeviceListener with id: {} to Device ", id);
                intDevice.registerDeviceStatusListener(deviceListener);
            } else {
                Circuit intCircuit = strucMan.getCircuitByDSID(new DSID(deviceListener.getDeviceStatusListenerID()));
                if (intCircuit != null) {
                    logger.debug("register DeviceListener with id: {} to Circuit ", id);
                    intCircuit.registerDeviceStatusListener(deviceListener);
                } else {
                    deviceListener.onDeviceRemoved(null);
                }
            }
        }
    }
}
Also used : Device(org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.Device) Circuit(org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.Circuit) DSID(org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.impl.DSID)

Example 3 with DSID

use of org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.impl.DSID in project smarthome by eclipse.

the class DeviceImpl method setMeterDSID.

@Override
public synchronized void setMeterDSID(String meterDSID) {
    this.meterDSID = new DSID(meterDSID);
    informListenerAboutConfigChange(ChangeableDeviceConfigEnum.METER_DSID);
}
Also used : DSID(org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.impl.DSID)

Aggregations

DSID (org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.impl.DSID)3 Circuit (org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.Circuit)2 Device (org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.Device)2