@Override public void removeDevice(String dSID) { Device intDevice = strucMan.getDeviceByDSID(dSID); if (intDevice != null) { strucMan.deleteDevice(intDevice); trashDevices.add(new TrashDevice(intDevice)); } }
@Override public void unregisterDeviceListener(DeviceStatusListener deviceListener) { if (deviceListener != null) { String id = deviceListener.getDeviceStatusListenerID(); if (id.equals(DeviceStatusListener.DEVICE_DISCOVERY)) { this.deviceDiscovery = null; } else { Device intDevice = strucMan.getDeviceByDSID(deviceListener.getDeviceStatusListenerID()); if (intDevice != null) { intDevice.unregisterDeviceStateListener(); } } } }
@Override public void registerDeviceListener(DeviceStatusListener deviceListener) { if (deviceListener != null) { String id = deviceListener.getDeviceStatusListenerID(); logger.debug("register DeviceListener with id: " + id); if (id.equals(DeviceStatusListener.DEVICE_DISCOVERY)) { this.deviceDiscovery = deviceListener; for (Device device : strucMan.getDeviceMap().values()) { deviceDiscovery.onDeviceAdded(device); } } else { Device intDevice = strucMan.getDeviceByDSID(deviceListener.getDeviceStatusListenerID()); if (intDevice != null) { intDevice.registerDeviceStateListener(deviceListener); } else { deviceListener.onDeviceRemoved(null); } } } }