protected LocalDevice createDevice() throws ValidationException, LocalServiceBindingException { DeviceType type = new UDADeviceType("BinaryLight", 1); DeviceDetails details = new DeviceDetails( "Friendly Binary Light", new ManufacturerDetails("ACME"), new ModelDetails("AndroidLight", "A light with on/off switch.", "v1") ); LocalService service = new AnnotationLocalServiceBinder().read(SwitchPower.class); service.setManager( new DefaultServiceManager<>(service, SwitchPower.class) ); return new LocalDevice( new DeviceIdentity(udn), type, details, createDefaultDeviceIcon(), service ); } // DOC:CREATE_DEVICE
@Override public String toString() { return "(" + getClass().getSimpleName() + ") UDN: " + getUdn(); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Device device = (Device) o; if (!identity.equals(device.identity)) return false; return true; }
@Override public LocalDevice newInstance(UDN udn, UDAVersion version, DeviceType type, DeviceDetails details, Icon[] icons, LocalService[] services, List<LocalDevice> embeddedDevices) throws ValidationException { return new LocalDevice( new DeviceIdentity(udn, getIdentity().getMaxAgeSeconds()), version, type, details, icons, services, embeddedDevices.size() > 0 ? embeddedDevices.toArray(new LocalDevice[embeddedDevices.size()]) : null ); }
void add(final LocalDevice localDevice, DiscoveryOptions options) throws RegistrationException { setDiscoveryOptions(localDevice.getIdentity().getUdn(), options); if (registry.getDevice(localDevice.getIdentity().getUdn(), false) != null) { log.fine("Ignoring addition, device already registered: " + localDevice); return; log.fine("Adding item to registry with expiration in seconds: " + localDevice.getIdentity().getMaxAgeSeconds()); localDevice.getIdentity().getUdn(), localDevice, localDevice.getIdentity().getMaxAgeSeconds() );
DeviceIdentity identity = new DeviceIdentity(UDN.uniqueSystemIdentifier("tinyMediaManager"), 600); DeviceType type = new UDADeviceType("MediaServer", 1); String hostname = NetworkUtil.getMachineHostname(); new ModelDetails("tinyMediaManager", "tinyMediaManager - Media Server", ReleaseInfo.getVersion()), new URI("http://" + hostname + ":" + UPNP_PORT + "/dev/" + identity.getUdn().getIdentifierString() + "/desc"), new DLNADoc[] { new DLNADoc("DMS", DLNADoc.Version.V1_5), LOGGER.info("Hello, i'm " + identity.getUdn().getIdentifierString());
public DeviceIdentity(UDN udn, DeviceIdentity template) { this.udn = udn; this.maxAgeSeconds = template.getMaxAgeSeconds(); }
@Override public String toString() { return "(" + getClass().getSimpleName() + ") Identity: " + getIdentity().toString() + ", Root: " + isRoot(); } }
@Override public int hashCode() { return identity.hashCode(); }
@Override public LocalDevice newInstance(UDN udn, UDAVersion version, DeviceType type, DeviceDetails details, Icon[] icons, LocalService[] services, List<LocalDevice> embeddedDevices) throws ValidationException { return new LocalDevice( new DeviceIdentity(udn, getIdentity().getMaxAgeSeconds()), version, type, details, icons, services, embeddedDevices.size() > 0 ? embeddedDevices.toArray(new LocalDevice[embeddedDevices.size()]) : null ); }
void add(final LocalDevice localDevice, DiscoveryOptions options) throws RegistrationException { setDiscoveryOptions(localDevice.getIdentity().getUdn(), options); if (registry.getDevice(localDevice.getIdentity().getUdn(), false) != null) { log.fine("Ignoring addition, device already registered: " + localDevice); return; log.fine("Adding item to registry with expiration in seconds: " + localDevice.getIdentity().getMaxAgeSeconds()); localDevice.getIdentity().getUdn(), localDevice, localDevice.getIdentity().getMaxAgeSeconds() );
public DeviceIdentity(UDN udn, DeviceIdentity template) { this.udn = udn; this.maxAgeSeconds = template.getMaxAgeSeconds(); }
@Override public String toString() { return "(" + getClass().getSimpleName() + ") Identity: " + getIdentity().toString() + ", Root: " + isRoot(); } }
@Override public int hashCode() { return identity.hashCode(); }
public DeviceItem(Device device) { this.udn = device.getIdentity().getUdn(); this.device = device; }
public static LocalDevice createDefaultDevice(UDN udn, String friendlyName, LocalService service) throws ValidationException { return new LocalDevice( new DeviceIdentity(udn, 1800), new UDADeviceType("BinaryLight", 1), new DeviceDetails( friendlyName, new ManufacturerDetails("ACME"), new ModelDetails("BinaryLight", "A demo light with on/off switch.", "v1"), new DLNADoc[]{ new DLNADoc("DMS", DLNADoc.Version.V1_5), new DLNADoc("M-DMS", DLNADoc.Version.V1_5) }, new DLNACaps(new String[] { "av-upload", "image-upload", "audio-upload" }) ), new Icon[]{createDefaultDeviceIcon()}, service ); }
@Override public LocalDevice newInstance(UDN udn, UDAVersion version, DeviceType type, DeviceDetails details, Icon[] icons, LocalService[] services, List<LocalDevice> embeddedDevices) throws ValidationException { return new LocalDevice( new DeviceIdentity(udn, getIdentity().getMaxAgeSeconds()), version, type, details, icons, services, embeddedDevices.size() > 0 ? embeddedDevices.toArray(new LocalDevice[embeddedDevices.size()]) : null ); }
void add(final LocalDevice localDevice, DiscoveryOptions options) throws RegistrationException { setDiscoveryOptions(localDevice.getIdentity().getUdn(), options); if (registry.getDevice(localDevice.getIdentity().getUdn(), false) != null) { log.fine("Ignoring addition, device already registered: " + localDevice); return; log.fine("Adding item to registry with expiration in seconds: " + localDevice.getIdentity().getMaxAgeSeconds()); localDevice.getIdentity().getUdn(), localDevice, localDevice.getIdentity().getMaxAgeSeconds() );
public OutgoingSearchResponse(IncomingDatagramMessage request, Location location, LocalDevice device) { super(new UpnpResponse(UpnpResponse.Status.OK), request.getSourceAddress(), request.getSourcePort()); getHeaders().add(UpnpHeader.Type.MAX_AGE, new MaxAgeHeader(device.getIdentity().getMaxAgeSeconds())); getHeaders().add(UpnpHeader.Type.LOCATION, new LocationHeader(location.getURL())); getHeaders().add(UpnpHeader.Type.SERVER, new ServerHeader()); getHeaders().add(UpnpHeader.Type.EXT, new EXTHeader()); if ("true".equals(System.getProperty(Constants.SYSTEM_PROPERTY_ANNOUNCE_MAC_ADDRESS)) && location.getNetworkAddress().getHardwareAddress() != null) { getHeaders().add( UpnpHeader.Type.EXT_IFACE_MAC, new InterfaceMacHeader(location.getNetworkAddress().getHardwareAddress()) ); } }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Device device = (Device) o; if (!identity.equals(device.identity)) return false; return true; }