Ejemplo n.º 1
0
 public void monitor() {
   final Device d = getDevice(uuid);
   monitor =
       new Thread(
           new Runnable() {
             @Override
             public void run() {
               String id = data.get("InstanceID");
               while (active && !"STOPPED".equals(data.get("TransportState"))) {
                 UPNPHelper.sleep(1000);
                 //						if (DEBUG) LOGGER.debug("InstanceID: " + id);
                 for (ActionArgumentValue o : getPositionInfo(d, id)) {
                   data.put(o.getArgument().getName(), o.toString());
                   //							if (DEBUG) LOGGER.debug(o.getArgument().getName() + ": " +
                   // o.toString());
                 }
                 alert();
               }
               if (!active) {
                 data.put("TransportState", "STOPPED");
                 alert();
               }
             }
           },
           "UPNP-" + d.getDetails().getFriendlyName());
   monitor.start();
 }
Ejemplo n.º 2
0
 public void alert() {
   if (isUpnpDevice(uuid)
       && (monitor == null || !monitor.isAlive())
       && !"STOPPED".equals(data.get("TransportState"))) {
     monitor();
   }
   for (ActionListener l : listeners) {
     l.actionPerformed(event);
   }
 }