@Override public void eventReceived(GENASubscription subscription) { rendererMap.mark(uuid, ACTIVE, true); if (subscription.getCurrentValues().containsKey("LastChange")) { xml2d(uuid, subscription.getCurrentValues().get("LastChange").toString(), null); } }
public void eventReceived(GENASubscription subscription) { log.finer("Event received, sequence number: " + subscription.getCurrentSequence()); final LastChange lastChange; try { lastChange = new LastChange( new RenderingControlLastChangeParser(), subscription.getCurrentValues().get("LastChange").toString()); } catch (Exception ex) { log.warning("Error parsing LastChange event content: " + ex); return; } SwingUtilities.invokeLater( new Runnable() { public void run() { for (UnsignedIntegerFourBytes instanceId : lastChange.getInstanceIDs()) { log.finer("Processing LastChange event values for instance: " + instanceId); RenderingControlVariable.Volume volume = lastChange.getEventedValue(instanceId, RenderingControlVariable.Volume.class); if (volume != null && volume.getValue().getChannel().equals(Channel.Master)) { log.finer("Received new volume value for 'Master' channel: " + volume.getValue()); onMasterVolumeChanged( new Long(instanceId.getValue()).intValue(), volume.getValue().getVolume()); } } } }); }
@Override public void established(GENASubscription sub) { LOGGER.debug( "Subscription established: " + sub.getService().getServiceId().getId() + " on " + getFriendlyName(uuid)); }
@Override public void eventsMissed(GENASubscription sub, int numberOfMissedEvents) { LOGGER.debug( "Missed events: " + numberOfMissedEvents + " for subscription " + sub.getService().getServiceId().getId() + " on " + getFriendlyName(uuid)); }
@Override public void failed(GENASubscription sub, UpnpResponse response, Exception ex) { LOGGER.debug( "Subscription failed: " + sub.getService().getServiceId().getId() + " on " + getFriendlyName(uuid) + ": " + createDefaultFailureMessage(response, ex).split(": ", 2)[1]); }
@SuppressWarnings({"rawtypes", "unchecked"}) public void eventReceived(GENASubscription sub) { Map<String, StateVariableValue> values = sub.getCurrentValues(); StateVariableValue status = values.get("Status"); Boolean newValue = (Boolean) status.getValue(); if (getDevice().isSwitched() != newValue) { getDevice().setSwitched(newValue); getBus().post(new ClingDevicePropertyChanged(getDevice(), "Status", newValue)); } }
@Override public void failed( GENASubscription sub, UpnpResponse response, Exception ex, String defaultMsg) { LOGGER.debug( "Subscription failed: " + sub.getService().getServiceId().getId() + " on " + getFriendlyName(uuid) + ": " + defaultMsg.split(": ", 2)[1]); }
@Override public void ended(GENASubscription sub, CancelReason reason, UpnpResponse response) { // Reason should be null, or it didn't end regularly if (reason != null) { LOGGER.debug( "Subscription cancelled: " + sub.getService().getServiceId().getId() + " on " + uuid + ": " + reason); } rendererMap.mark(uuid, RENEW, true); }