org.fourthline.cling.model.types.DeviceType Java Examples
The following examples show how to use
org.fourthline.cling.model.types.DeviceType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SempDiscovery.java From SmartApplianceEnabler with GNU General Public License v2.0 | 6 votes |
private LocalDevice createDevice() throws ValidationException, LocalServiceBindingException, IOException { DeviceIdentity identity = new DeviceIdentity( UDN.uniqueSystemIdentifier(SmartApplianceEnabler.class.getSimpleName()) ); DeviceType type = new SmartApplianceEnablerDeviceType(); DeviceDetails details = new DeviceDetails( SmartApplianceEnabler.class.getSimpleName(), new ManufacturerDetails(SmartApplianceEnabler.MANUFACTURER_NAME, URI.create(SmartApplianceEnabler.MANUFACTURER_URI)), new ModelDetails( SmartApplianceEnabler.class.getSimpleName(), SmartApplianceEnabler.DESCRIPTION, SmartApplianceEnabler.VERSION, URI.create(SmartApplianceEnabler.MODEL_URI) ) ); return new LocalDevice(identity, type, details, (Icon) null, (LocalService) null); }
Example #2
Source File: ReceivingSearch.java From TVRemoteIME with GNU General Public License v2.0 | 6 votes |
protected void sendSearchResponseDeviceType(DeviceType deviceType, NetworkAddress activeStreamServer) throws RouterException{ log.fine("Responding to device type search: " + deviceType); Collection<Device> devices = getUpnpService().getRegistry().getDevices(deviceType); for (Device device : devices) { if (device instanceof LocalDevice) { if (isAdvertisementDisabled((LocalDevice)device)) continue; log.finer("Sending matching device type search result for: " + device); OutgoingSearchResponse message = new OutgoingSearchResponseDeviceType( getInputMessage(), getDescriptorLocation(activeStreamServer, (LocalDevice) device), (LocalDevice) device ); prepareOutgoingSearchResponse(message); getUpnpService().getRouter().send(message); } } }
Example #3
Source File: ReceivingSearch.java From DroidDLNA with GNU General Public License v3.0 | 6 votes |
protected void sendSearchResponseDeviceType(DeviceType deviceType, NetworkAddress activeStreamServer) throws RouterException{ log.fine("Responding to device type search: " + deviceType); Collection<Device> devices = getUpnpService().getRegistry().getDevices(deviceType); for (Device device : devices) { if (device instanceof LocalDevice) { if (isAdvertisementDisabled((LocalDevice)device)) continue; log.finer("Sending matching device type search result for: " + device); OutgoingSearchResponse message = new OutgoingSearchResponseDeviceType( getInputMessage(), getDescriptorLocation(activeStreamServer, (LocalDevice) device), (LocalDevice) device ); prepareOutgoingSearchResponse(message); getUpnpService().getRouter().send(message); } } }
Example #4
Source File: Device.java From TVRemoteIME with GNU General Public License v2.0 | 5 votes |
protected Collection<D> find(DeviceType deviceType, D current) { Collection<D> devices = new HashSet(); // Type might be null if we just discovered the device and it hasn't yet been hydrated if (current.getType() != null && current.getType().implementsVersion(deviceType)) { devices.add(current); } if (current.hasEmbeddedDevices()) { for (D embeddedDevice : (D[]) current.getEmbeddedDevices()) { devices.addAll(find(deviceType, embeddedDevice)); } } return devices; }
Example #5
Source File: UPnPService.java From subsonic with GNU General Public License v3.0 | 5 votes |
public List<String> getSonosControllerHosts() { List<String> result = new ArrayList<String>(); for (Device device : upnpService.getRegistry().getDevices(new DeviceType("schemas-upnp-org", "ZonePlayer"))) { if (device instanceof RemoteDevice) { URL descriptorURL = ((RemoteDevice) device).getIdentity().getDescriptorURL(); if (descriptorURL != null) { result.add(descriptorURL.getHost()); } } } return result; }
Example #6
Source File: DeviceTypeHeader.java From DroidDLNA with GNU General Public License v3.0 | 5 votes |
public void setString(String s) throws InvalidHeaderException { try { setValue(DeviceType.valueOf(s)); } catch (RuntimeException ex) { throw new InvalidHeaderException("Invalid device type header value, " + ex.getMessage()); } }
Example #7
Source File: Device.java From DroidDLNA with GNU General Public License v3.0 | 5 votes |
protected Collection<D> find(DeviceType deviceType, D current) { Collection<D> devices = new HashSet(); // Type might be null if we just discovered the device and it hasn't yet been hydrated if (current.getType() != null && current.getType().implementsVersion(deviceType)) { devices.add(current); } if (current.hasEmbeddedDevices()) { for (D embeddedDevice : (D[]) current.getEmbeddedDevices()) { devices.addAll(find(deviceType, embeddedDevice)); } } return devices; }
Example #8
Source File: UPnPService.java From airsonic with GNU General Public License v3.0 | 5 votes |
public List<String> getSonosControllerHosts() { ensureServiceStarted(); List<String> result = new ArrayList<String>(); for (Device device : upnpService.getRegistry().getDevices(new DeviceType("schemas-upnp-org", "ZonePlayer"))) { if (device instanceof RemoteDevice) { URL descriptorURL = ((RemoteDevice) device).getIdentity().getDescriptorURL(); if (descriptorURL != null) { result.add(descriptorURL.getHost()); } } } return result; }
Example #9
Source File: RegistryImpl.java From DroidDLNA with GNU General Public License v3.0 | 5 votes |
synchronized public Collection<Device> getDevices(DeviceType deviceType) { Collection<Device> devices = new HashSet(); devices.addAll(localItems.get(deviceType)); devices.addAll(remoteItems.get(deviceType)); return Collections.unmodifiableCollection(devices); }
Example #10
Source File: RegistryItems.java From TVRemoteIME with GNU General Public License v2.0 | 5 votes |
/** * Returns all devices (root or embedded) with a compatible type. * <p> * This routine will check compatible versions, as described by the UDA. * </p> * * @param deviceType The minimum device type required. * @return Any registered root or embedded device with a compatible type. */ Collection<D> get(DeviceType deviceType) { Collection<D> devices = new HashSet(); for (RegistryItem<UDN, D> item : deviceItems) { D[] d = (D[])item.getItem().findDevices(deviceType); if (d != null) { devices.addAll(Arrays.asList(d)); } } return devices; }
Example #11
Source File: RegistryItems.java From DroidDLNA with GNU General Public License v3.0 | 5 votes |
/** * Returns all devices (root or embedded) with a compatible type. * <p> * This routine will check compatible versions, as described by the UDA. * </p> * * @param deviceType The minimum device type required. * @return Any registered root or embedded device with a compatible type. */ Collection<D> get(DeviceType deviceType) { Collection<D> devices = new HashSet(); for (RegistryItem<UDN, D> item : deviceItems) { D[] d = (D[])item.getItem().findDevices(deviceType); if (d != null) { devices.addAll(Arrays.asList(d)); } } return devices; }
Example #12
Source File: MediaServer.java From DroidDLNA with GNU General Public License v3.0 | 5 votes |
public MediaServer(Context context ) throws ValidationException { mContext = context; DeviceType type = new UDADeviceType(deviceType, version); DeviceDetails details = new DeviceDetails(SettingActivity.getDeviceName(context) + " (" + android.os.Build.MODEL + ")", new ManufacturerDetails( android.os.Build.MANUFACTURER), new ModelDetails(android.os.Build.MODEL, Utils.DMS_DESC, "v1")); LocalService service = new AnnotationLocalServiceBinder() .read(ContentDirectoryService.class); service.setManager(new DefaultServiceManager<ContentDirectoryService>(service, ContentDirectoryService.class)); udn = UpnpUtil.uniqueSystemIdentifier("msidms"); localDevice = new LocalDevice(new DeviceIdentity(udn), type, details, createDefaultDeviceIcon(), service); Log.v(LOGTAG, "MediaServer device created: "); Log.v(LOGTAG, "friendly name: " + details.getFriendlyName()); Log.v(LOGTAG, "manufacturer: " + details.getManufacturerDetails().getManufacturer()); Log.v(LOGTAG, "model: " + details.getModelDetails().getModelName()); // start http server try { new HttpServer(PORT); } catch (IOException ioe) { System.err.println("Couldn't start server:\n" + ioe); System.exit(-1); } Log.v(LOGTAG, "Started Http Server on port " + PORT); }
Example #13
Source File: LocalDevice.java From TVRemoteIME with GNU General Public License v2.0 | 5 votes |
@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 ); }
Example #14
Source File: RemoteDevice.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public RemoteDevice(RemoteDeviceIdentity identity, UDAVersion version, DeviceType type, DeviceDetails details, Icon[] icons, RemoteService[] services, RemoteDevice[] embeddedDevices) throws ValidationException { super(identity, version, type, details, icons, services, embeddedDevices); }
Example #15
Source File: LocalDevice.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public LocalDevice(DeviceIdentity identity, DeviceType type, DeviceDetails details, LocalService service, LocalDevice embeddedDevice) throws ValidationException { super(identity, type, details, null, new LocalService[]{service}, new LocalDevice[]{embeddedDevice}); this.deviceDetailsProvider = null; }
Example #16
Source File: LocalDevice.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public LocalDevice(DeviceIdentity identity, DeviceType type, DeviceDetails details, Icon icon, LocalService[] services) throws ValidationException { super(identity, type, details, new Icon[]{icon}, services); this.deviceDetailsProvider = null; }
Example #17
Source File: RemoteDevice.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public RemoteDevice(RemoteDeviceIdentity identity, DeviceType type, DeviceDetails details, Icon icon, RemoteService service, RemoteDevice embeddedDevice) throws ValidationException { super(identity, type, details, new Icon[]{icon}, new RemoteService[]{service}, new RemoteDevice[]{embeddedDevice}); }
Example #18
Source File: RemoteDevice.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public RemoteDevice(RemoteDeviceIdentity identity, DeviceType type, DeviceDetails details, Icon icon, RemoteService[] services) throws ValidationException { super(identity, type, details, new Icon[]{icon}, services); }
Example #19
Source File: ReceivingSearch.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
protected void sendResponses(UpnpHeader searchTarget, NetworkAddress activeStreamServer) throws RouterException { if (searchTarget instanceof STAllHeader) { sendSearchResponseAll(activeStreamServer); } else if (searchTarget instanceof RootDeviceHeader) { sendSearchResponseRootDevices(activeStreamServer); } else if (searchTarget instanceof UDNHeader) { sendSearchResponseUDN((UDN) searchTarget.getValue(), activeStreamServer); } else if (searchTarget instanceof DeviceTypeHeader) { sendSearchResponseDeviceType((DeviceType) searchTarget.getValue(), activeStreamServer); } else if (searchTarget instanceof ServiceTypeHeader) { sendSearchResponseServiceType((ServiceType) searchTarget.getValue(), activeStreamServer); } else { log.warning("Non-implemented search request target: " + searchTarget.getClass()); } }
Example #20
Source File: LocalDevice.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public LocalDevice(DeviceIdentity identity, DeviceType type, DeviceDetails details, LocalService service) throws ValidationException { super(identity, type, details, null, new LocalService[]{service}); this.deviceDetailsProvider = null; }
Example #21
Source File: Device.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public Device(DI identity, DeviceType type, DeviceDetails details, Icon[] icons, S[] services) throws ValidationException { this(identity, null, type, details, icons, services, null); }
Example #22
Source File: LocalDevice.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public LocalDevice(DeviceIdentity identity, DeviceType type, DeviceDetails details, Icon icon, LocalService[] services, LocalDevice[] embeddedDevices) throws ValidationException { super(identity, type, details, new Icon[]{icon}, services, embeddedDevices); this.deviceDetailsProvider = null; }
Example #23
Source File: MediaServer.java From HPlayer with Apache License 2.0 | 4 votes |
public MediaServer(final Context context) throws ValidationException, UnknownHostException { localAddress = getWIFIIpAddress(context); generateContentTask = new GenerateContentTask(); generateContentTask.execute(context); udn = new UDN(UUID.randomUUID()); DeviceType type = new UDADeviceType(deviceType, version); DeviceDetails details = new DeviceDetails(android.os.Build.MODEL, new ManufacturerDetails(android.os.Build.MANUFACTURER), new ModelDetails("HPlayer", "HPlayer MediaServer for Android", "v1")); LocalServiceBinder binder = new AnnotationLocalServiceBinder(); // 文件共享服务 LocalService<ContentDirectoryService> contentDirectoryService = binder.read(ContentDirectoryService.class); ServiceManager<ContentDirectoryService> contentDirectoryManger = new DefaultServiceManager<ContentDirectoryService>(contentDirectoryService) { @Override protected ContentDirectoryService createServiceInstance() throws Exception { return new ContentDirectoryService(); } }; contentDirectoryService.setManager(contentDirectoryManger); // 连接管理服务 LocalService<ConnectionManagerService> connectionManagerService = binder.read(ConnectionManagerService.class); connectionManagerService.setManager(new DefaultServiceManager<>( connectionManagerService, ConnectionManagerService.class)); // TODO 添加 AVTransportService // TODO 添加 AudioRenderingControl localDevice = new LocalDevice(new DeviceIdentity(udn), type, details, new LocalService[]{contentDirectoryService, connectionManagerService}); // 启动服务器 try { nanoHttpServer = new NanoHttpServer(port); nanoHttpServer.start(); Log.d(TAG, "Started Http Server on port " + port); } catch (IOException e) { Log.d(TAG, "Started Http Server on error:" + e.getMessage()); Toast.makeText(context, "启动服务器失败!", Toast.LENGTH_SHORT).show(); e.printStackTrace(); } }
Example #24
Source File: UPnPService.java From airsonic with GNU General Public License v3.0 | 4 votes |
private LocalDevice createMediaServerDevice() throws Exception { String serverName = settingsService.getDlnaServerName(); DeviceIdentity identity = new DeviceIdentity(UDN.uniqueSystemIdentifier(serverName)); DeviceType type = new UDADeviceType("MediaServer", 1); // TODO: DLNACaps DeviceDetails details = new DeviceDetails(serverName, new ManufacturerDetails(serverName), new ModelDetails(serverName), new DLNADoc[]{new DLNADoc("DMS", DLNADoc.Version.V1_5)}, null); InputStream in = getClass().getResourceAsStream("logo-512.png"); Icon icon = new Icon("image/png", 512, 512, 32, "logo-512", in); FileUtil.closeQuietly(in); LocalService<CustomContentDirectory> contentDirectoryservice = new AnnotationLocalServiceBinder().read(CustomContentDirectory.class); contentDirectoryservice.setManager(new DefaultServiceManager<CustomContentDirectory>(contentDirectoryservice) { @Override protected CustomContentDirectory createServiceInstance() { return dispatchingContentDirectory; } }); final ProtocolInfos protocols = new ProtocolInfos(); for (DLNAProfiles dlnaProfile : DLNAProfiles.values()) { if (dlnaProfile == DLNAProfiles.NONE) { continue; } try { protocols.add(new DLNAProtocolInfo(dlnaProfile)); } catch (Exception e) { // Silently ignored. } } LocalService<ConnectionManagerService> connetionManagerService = new AnnotationLocalServiceBinder().read(ConnectionManagerService.class); connetionManagerService.setManager(new DefaultServiceManager<ConnectionManagerService>(connetionManagerService) { @Override protected ConnectionManagerService createServiceInstance() { return new ConnectionManagerService(protocols, null); } }); // For compatibility with Microsoft LocalService<MSMediaReceiverRegistrarService> receiverService = new AnnotationLocalServiceBinder().read(MSMediaReceiverRegistrarService.class); receiverService.setManager(new DefaultServiceManager<>(receiverService, MSMediaReceiverRegistrarService.class)); return new LocalDevice(identity, type, details, new Icon[]{icon}, new LocalService[]{contentDirectoryservice, connetionManagerService, receiverService}); }
Example #25
Source File: LocalDevice.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public LocalDevice(DeviceIdentity identity, DeviceType type, DeviceDetails details, Icon[] icons, LocalService[] services) throws ValidationException { super(identity, type, details, icons, services); this.deviceDetailsProvider = null; }
Example #26
Source File: DeviceTypeHeader.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
public DeviceTypeHeader(DeviceType value) { setValue(value); }
Example #27
Source File: UDADeviceTypeHeader.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
public UDADeviceTypeHeader(DeviceType value) { super(value); }
Example #28
Source File: DeviceUSNHeader.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
public DeviceUSNHeader(UDN udn, DeviceType deviceType) { setValue(new NamedDeviceType(udn, deviceType)); }
Example #29
Source File: LocalDevice.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
public LocalDevice(DeviceIdentity identity, UDAVersion version, DeviceType type, DeviceDetailsProvider deviceDetailsProvider, Icon[] icons, LocalService[] services, LocalDevice[] embeddedDevices) throws ValidationException { super(identity, version, type, null, icons, services, embeddedDevices); this.deviceDetailsProvider = deviceDetailsProvider; }
Example #30
Source File: LocalDevice.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
public LocalDevice(DeviceIdentity identity, UDAVersion version, DeviceType type, DeviceDetails details, Icon[] icons, LocalService[] services, LocalDevice[] embeddedDevices) throws ValidationException { super(identity, version, type, details, icons, services, embeddedDevices); this.deviceDetailsProvider = null; }