public static Map<String, String> getDeviceDetails(Device d) { if (d == null) { return null; } DeviceDetails dev = d.getDetails(); ManufacturerDetails man = dev.getManufacturerDetails(); ModelDetails model = dev.getModelDetails(); LinkedHashMap<String, String> details = new LinkedHashMap<>(); details.put("friendlyName", dev.getFriendlyName()); details.put("address", getURL(d).getHost()); details.put("udn", getUUID(d)); Object detail; if ((detail = man.getManufacturer()) != null) { details.put("manufacturer", (String) detail); } if ((detail = model.getModelName()) != null) { details.put("modelName", (String) detail); } if ((detail = model.getModelNumber()) != null) { details.put("modelNumber", (String) detail); } if ((detail = model.getModelDescription()) != null) { details.put("modelDescription", (String) detail); } if ((detail = man.getManufacturerURI()) != null) { details.put("manufacturerURL", detail.toString()); } if ((detail = model.getModelURI()) != null) { details.put("modelURL", detail.toString()); } return details; }
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(); }
public static URL getURL(Device d) { return d instanceof RemoteDevice ? ((RemoteDevice) d).getIdentity().getDescriptorURL() : d.getDetails().getBaseURL(); }
public static String getFriendlyName(Device d) { return d.getDetails().getFriendlyName(); }