org.fourthline.cling.model.meta.Device.getType()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(157)

本文整理了Java中org.fourthline.cling.model.meta.Device.getType()方法的一些代码示例,展示了Device.getType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Device.getType()方法的具体详情如下:
包路径:org.fourthline.cling.model.meta.Device
类名称:Device
方法名:getType

Device.getType介绍

暂无

代码示例

代码示例来源:origin: 4thline/cling

  1. protected Collection<D> find(DeviceType deviceType, D current) {
  2. Collection<D> devices = new HashSet<>();
  3. // Type might be null if we just discovered the device and it hasn't yet been hydrated
  4. if (current.getType() != null && current.getType().implementsVersion(deviceType)) {
  5. devices.add(current);
  6. }
  7. if (current.hasEmbeddedDevices()) {
  8. for (D embeddedDevice : (D[]) current.getEmbeddedDevices()) {
  9. devices.addAll(find(deviceType, embeddedDevice));
  10. }
  11. }
  12. return devices;
  13. }

代码示例来源:origin: 4thline/cling

  1. protected Service discoverConnectionService(Device device) {
  2. if (!device.getType().equals(IGD_DEVICE_TYPE)) {
  3. return null;
  4. }
  5. Device[] connectionDevices = device.findDevices(CONNECTION_DEVICE_TYPE);
  6. if (connectionDevices.length == 0) {
  7. log.fine("IGD doesn't support '" + CONNECTION_DEVICE_TYPE + "': " + device);
  8. return null;
  9. }
  10. Device connectionDevice = connectionDevices[0];
  11. log.fine("Using first discovered WAN connection device: " + connectionDevice);
  12. Service ipConnectionService = connectionDevice.findService(IP_SERVICE_TYPE);
  13. Service pppConnectionService = connectionDevice.findService(PPP_SERVICE_TYPE);
  14. if (ipConnectionService == null && pppConnectionService == null) {
  15. log.fine("IGD doesn't support IP or PPP WAN connection service: " + device);
  16. }
  17. return ipConnectionService != null ? ipConnectionService : pppConnectionService;
  18. }

代码示例来源:origin: 4thline/cling

  1. public List<ValidationError> validate() {
  2. List<ValidationError> errors = new ArrayList<>();
  3. if (getType() != null) {
  4. // Only validate the graph if we have a device type - that means we validate only if there
  5. // actually is a fully hydrated graph, not just a discovered device of which we haven't even
  6. // retrieved the descriptor yet. This assumes that the descriptor will ALWAYS contain a device
  7. // type. Now that is a risky assumption...
  8. errors.addAll(getVersion().validate());
  9. if(getIdentity() != null) {
  10. errors.addAll(getIdentity().validate());
  11. }
  12. if (getDetails() != null) {
  13. errors.addAll(getDetails().validate());
  14. }
  15. if (hasServices()) {
  16. for (Service service : getServices()) {
  17. if (service != null)
  18. errors.addAll(service.validate());
  19. }
  20. }
  21. if (hasEmbeddedDevices()) {
  22. for (Device embeddedDevice : getEmbeddedDevices()) {
  23. if (embeddedDevice != null)
  24. errors.addAll(embeddedDevice.validate());
  25. }
  26. }
  27. }
  28. return errors;
  29. }

代码示例来源:origin: kingthy/TVRemoteIME

  1. public static boolean isMediaServerDevice(Device device) {
  2. if ("urn:schemas-upnp-org:device:MediaServer:1"
  3. .equalsIgnoreCase(device.getType().getType())) {
  4. return true;
  5. }
  6. return false;
  7. }

代码示例来源:origin: kingthy/TVRemoteIME

  1. public static boolean isMediaRenderDevice(Device device) {
  2. if ("urn:schemas-upnp-org:device:MediaRenderer:1".equalsIgnoreCase(device.getType()
  3. .getType())) {
  4. return true;
  5. }
  6. return false;
  7. }

代码示例来源:origin: kingthy/TVRemoteIME

  1. protected Collection<D> find(DeviceType deviceType, D current) {
  2. Collection<D> devices = new HashSet();
  3. // Type might be null if we just discovered the device and it hasn't yet been hydrated
  4. if (current.getType() != null && current.getType().implementsVersion(deviceType)) {
  5. devices.add(current);
  6. }
  7. if (current.hasEmbeddedDevices()) {
  8. for (D embeddedDevice : (D[]) current.getEmbeddedDevices()) {
  9. devices.addAll(find(deviceType, embeddedDevice));
  10. }
  11. }
  12. return devices;
  13. }

代码示例来源:origin: 4thline/cling

  1. addIfNotNull(deviceNode, "Device Type: ", device.getType().toString());
  2. if (device.getDetails().getDlnaDocs() != null) {
  3. for (DLNADoc dlnaDoc : device.getDetails().getDlnaDocs()) {

代码示例来源:origin: kingthy/TVRemoteIME

  1. protected Service discoverConnectionService(Device device) {
  2. if (!device.getType().equals(IGD_DEVICE_TYPE)) {
  3. return null;
  4. }
  5. Device[] connectionDevices = device.findDevices(CONNECTION_DEVICE_TYPE);
  6. if (connectionDevices.length == 0) {
  7. log.fine("IGD doesn't support '" + CONNECTION_DEVICE_TYPE + "': " + device);
  8. return null;
  9. }
  10. Device connectionDevice = connectionDevices[0];
  11. log.fine("Using first discovered WAN connection device: " + connectionDevice);
  12. Service ipConnectionService = connectionDevice.findService(IP_SERVICE_TYPE);
  13. Service pppConnectionService = connectionDevice.findService(PPP_SERVICE_TYPE);
  14. if (ipConnectionService == null && pppConnectionService == null) {
  15. log.fine("IGD doesn't support IP or PPP WAN connection service: " + device);
  16. }
  17. return ipConnectionService != null ? ipConnectionService : pppConnectionService;
  18. }

代码示例来源:origin: kingthy/TVRemoteIME

  1. public List<ValidationError> validate() {
  2. List<ValidationError> errors = new ArrayList();
  3. if (getType() != null) {
  4. // Only validate the graph if we have a device type - that means we validate only if there
  5. // actually is a fully hydrated graph, not just a discovered device of which we haven't even
  6. // retrieved the descriptor yet. This assumes that the descriptor will ALWAYS contain a device
  7. // type. Now that is a risky assumption...
  8. errors.addAll(getVersion().validate());
  9. if (getDetails() != null) {
  10. errors.addAll(getDetails().validate());
  11. }
  12. if (hasServices()) {
  13. for (Service service : getServices()) {
  14. if (service != null)
  15. errors.addAll(service.validate());
  16. }
  17. }
  18. if (hasEmbeddedDevices()) {
  19. for (Device embeddedDevice : getEmbeddedDevices()) {
  20. if (embeddedDevice != null)
  21. errors.addAll(embeddedDevice.validate());
  22. }
  23. }
  24. }
  25. return errors;
  26. }

代码示例来源:origin: 4thline/cling

  1. appendNewElementIfNotNull(descriptor, deviceElement, ELEMENT.deviceType, deviceModel.getType());

代码示例来源:origin: kaklakariada/portmapper

  1. protected Service<?, ?> discoverConnectionService(@SuppressWarnings("rawtypes") final Device<?, Device, ?> device) {
  2. if (!device.getType().equals(IGD_DEVICE_TYPE)) {
  3. logger.debug("Found service of wrong type {}, expected {}.", device.getType(), IGD_DEVICE_TYPE);
  4. return null;
  5. }
  6. @SuppressWarnings("rawtypes")
  7. final Device[] connectionDevices = device.findDevices(CONNECTION_DEVICE_TYPE);
  8. if (connectionDevices.length == 0) {
  9. logger.debug("IGD doesn't support '{}': {}", CONNECTION_DEVICE_TYPE, device);
  10. return null;
  11. }
  12. logger.debug("Found {} devices", connectionDevices.length);
  13. return findConnectionService(connectionDevices);
  14. }

代码示例来源:origin: org.fourthline.cling/cling-core

  1. protected Collection<D> find(DeviceType deviceType, D current) {
  2. Collection<D> devices = new HashSet<>();
  3. // Type might be null if we just discovered the device and it hasn't yet been hydrated
  4. if (current.getType() != null && current.getType().implementsVersion(deviceType)) {
  5. devices.add(current);
  6. }
  7. if (current.hasEmbeddedDevices()) {
  8. for (D embeddedDevice : (D[]) current.getEmbeddedDevices()) {
  9. devices.addAll(find(deviceType, embeddedDevice));
  10. }
  11. }
  12. return devices;
  13. }

代码示例来源:origin: tinyMediaManager/tinyMediaManager

  1. /**
  2. * Finds all available Players (implementing the MediaRenderer stack)<br>
  3. * You might want to call sendPlayerSearchRequest() a few secs before, to populate freshly
  4. *
  5. * @return List of devices
  6. */
  7. public List<Device> getAvailablePlayers() {
  8. createUpnpService();
  9. List<Device> ret = new ArrayList<>();
  10. for (Device device : this.upnpService.getRegistry().getDevices()) {
  11. if (device.getType().getType().equals("MediaRenderer")) {
  12. ret.add(device);
  13. }
  14. }
  15. return ret;
  16. }

代码示例来源:origin: org.fourthline.cling/cling-support

  1. protected Service discoverConnectionService(Device device) {
  2. if (!device.getType().equals(IGD_DEVICE_TYPE)) {
  3. return null;
  4. }
  5. Device[] connectionDevices = device.findDevices(CONNECTION_DEVICE_TYPE);
  6. if (connectionDevices.length == 0) {
  7. log.fine("IGD doesn't support '" + CONNECTION_DEVICE_TYPE + "': " + device);
  8. return null;
  9. }
  10. Device connectionDevice = connectionDevices[0];
  11. log.fine("Using first discovered WAN connection device: " + connectionDevice);
  12. Service ipConnectionService = connectionDevice.findService(IP_SERVICE_TYPE);
  13. Service pppConnectionService = connectionDevice.findService(PPP_SERVICE_TYPE);
  14. if (ipConnectionService == null && pppConnectionService == null) {
  15. log.fine("IGD doesn't support IP or PPP WAN connection service: " + device);
  16. }
  17. return ipConnectionService != null ? ipConnectionService : pppConnectionService;
  18. }

代码示例来源:origin: org.fourthline.cling/cling-core

  1. public List<ValidationError> validate() {
  2. List<ValidationError> errors = new ArrayList<>();
  3. if (getType() != null) {
  4. // Only validate the graph if we have a device type - that means we validate only if there
  5. // actually is a fully hydrated graph, not just a discovered device of which we haven't even
  6. // retrieved the descriptor yet. This assumes that the descriptor will ALWAYS contain a device
  7. // type. Now that is a risky assumption...
  8. errors.addAll(getVersion().validate());
  9. if(getIdentity() != null) {
  10. errors.addAll(getIdentity().validate());
  11. }
  12. if (getDetails() != null) {
  13. errors.addAll(getDetails().validate());
  14. }
  15. if (hasServices()) {
  16. for (Service service : getServices()) {
  17. if (service != null)
  18. errors.addAll(service.validate());
  19. }
  20. }
  21. if (hasEmbeddedDevices()) {
  22. for (Device embeddedDevice : getEmbeddedDevices()) {
  23. if (embeddedDevice != null)
  24. errors.addAll(embeddedDevice.validate());
  25. }
  26. }
  27. }
  28. return errors;
  29. }

代码示例来源:origin: kingthy/TVRemoteIME

  1. appendNewElementIfNotNull(descriptor, deviceElement, ELEMENT.deviceType, deviceModel.getType());

代码示例来源:origin: org.fourthline.cling/cling-core

  1. appendNewElementIfNotNull(descriptor, deviceElement, ELEMENT.deviceType, deviceModel.getType());

相关文章