Example #1
0
  public void rootDeviceFound(UPnPRootDevice device) {
    incrementDeviceStats(device.getUSN(), "found");

    checkDeviceStats(device);

    try {
      int interesting = processDevice(device.getDevice());

      if (interesting > 0) {

        try {
          this_mon.enter();

          root_info_map.put(device.getLocation(), device.getInfo());

          Iterator<String> it = root_info_map.values().iterator();

          String all_info = "";

          List reported_info = new ArrayList();

          while (it.hasNext()) {

            String info = (String) it.next();

            if (info != null && !reported_info.contains(info)) {

              reported_info.add(info);

              all_info += (all_info.length() == 0 ? "" : ",") + info;
            }
          }

          if (all_info.length() > 0) {

            plugin_interface.getPluginconfig().setPluginParameter("plugin.info", all_info);
          }

        } finally {

          this_mon.exit();
        }
      }
    } catch (Throwable e) {

      log.log("Root device processing fails", e);
    }
  }
Example #2
0
  protected void updateIgnoreList() {
    try {
      String param = "";

      if (ignore_bad_devices.getValue()) {

        PluginConfig pc = plugin_interface.getPluginconfig();

        Map ignored = pc.getPluginMapParameter("upnp.device.ignorelist", new HashMap());

        Iterator it = ignored.entrySet().iterator();

        while (it.hasNext()) {

          Map.Entry entry = (Map.Entry) it.next();

          Map value = (Map) entry.getValue();

          param += "\n    " + entry.getKey() + ": " + new String((byte[]) value.get("Location"));
        }

        if (ignored.size() > 0) {

          log.log("Devices currently being ignored: " + param);
        }
      }

      String text =
          plugin_interface
              .getUtilities()
              .getLocaleUtilities()
              .getLocalisedMessageText("upnp.ignorebaddevices.info", new String[] {param});

      ignored_devices_list.setLabelText(text);

    } catch (Throwable e) {

      Debug.printStackTrace(e);
    }
  }