예제 #1
0
    @SuppressWarnings("unchecked")
    @Override
    protected void eventReceived(GENASubscription sub) {

      Map<String, StateVariableValue> values = sub.getCurrentValues();
      Device device = sub.getService().getDevice();

      logger.trace(
          "Receiving a GENA subscription '{}' response for device '{}'",
          sub.getService().getServiceId().getId(),
          device.getRoot().getIdentity().getUdn());
      for (UpnpIOParticipant participant : participants.keySet()) {
        if (participants.get(participant).equals(device.getRoot())) {
          for (String stateVariable : values.keySet()) {
            StateVariableValue value = values.get(stateVariable);
            if (value.getValue() != null) {
              try {
                participant.onValueReceived(
                    stateVariable,
                    value.getValue().toString(),
                    sub.getService().getServiceId().getId());
              } catch (Exception e) {
                logger.error("Participant threw an exception onValueReceived", e);
              }
            }
          }
          break;
        }
      }
    }