Пример #1
0
 @Override
 public void eventReceived(GENASubscription subscription) {
   rendererMap.mark(uuid, ACTIVE, true);
   if (subscription.getCurrentValues().containsKey("LastChange")) {
     xml2d(uuid, subscription.getCurrentValues().get("LastChange").toString(), null);
   }
 }
Пример #2
0
 protected void subscribeAll(Device d, String uuid) {
   String name = getFriendlyName(d);
   int ctrl = 0;
   for (Service s : d.getServices()) {
     String sid = s.getServiceId().getId();
     LOGGER.debug("Subscribing to " + sid + " service on " + name);
     if (sid.contains("AVTransport")) {
       ctrl |= AVT;
     } else if (sid.contains("RenderingControl")) {
       ctrl |= RC;
     }
     upnpService.getControlPoint().execute(new SubscriptionCB(s));
   }
   rendererMap.mark(uuid, RENEW, false);
   rendererMap.mark(uuid, CONTROLS, ctrl);
 }
Пример #3
0
 protected void rendererUpdated(Device d) {
   String uuid = getUUID(d);
   if (rendererMap.containsKey(uuid)) {
     if (rendererMap.get(uuid, "0").needsRenewal()) {
       LOGGER.debug("Renewing subscriptions to ", getFriendlyName(d));
       subscribeAll(d, uuid);
     }
     rendererMap.mark(uuid, ACTIVE, true);
   }
 }
Пример #4
0
 protected synchronized boolean addRenderer(Device d) {
   if (d != null) {
     String uuid = getUUID(d);
     if (isMediaRenderer(d) && rendererFound(d, uuid) != null) {
       LOGGER.debug("Adding device: {} {}", d.getType(), d.toString());
       rendererMap.mark(uuid, ACTIVE, true);
       subscribeAll(d, uuid);
       rendererReady(uuid);
       return true;
     }
   }
   return false;
 }
Пример #5
0
 @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);
 }