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

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

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

Device.findDevices介绍

暂无

代码示例

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

  1. /**
  2. * Returns all devices (root or embedded) which have at least one matching service.
  3. *
  4. * @param serviceType The type of service to search for.
  5. * @return Any registered root or embedded device with at least one matching service.
  6. */
  7. Collection<D> get(ServiceType serviceType) {
  8. Collection<D> devices = new HashSet<>();
  9. for (RegistryItem<UDN, D> item : deviceItems) {
  10. D[] d = (D[])item.getItem().findDevices(serviceType);
  11. if (d != null) {
  12. devices.addAll(Arrays.asList(d));
  13. }
  14. }
  15. return devices;
  16. }

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

  1. /**
  2. * Returns all devices (root or embedded) with a compatible type.
  3. * <p>
  4. * This routine will check compatible versions, as described by the UDA.
  5. * </p>
  6. *
  7. * @param deviceType The minimum device type required.
  8. * @return Any registered root or embedded device with a compatible type.
  9. */
  10. Collection<D> get(DeviceType deviceType) {
  11. Collection<D> devices = new HashSet<>();
  12. for (RegistryItem<UDN, D> item : deviceItems) {
  13. D[] d = (D[])item.getItem().findDevices(deviceType);
  14. if (d != null) {
  15. devices.addAll(Arrays.asList(d));
  16. }
  17. }
  18. return devices;
  19. }

代码示例来源: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: kingthy/TVRemoteIME

  1. /**
  2. * Returns all devices (root or embedded) which have at least one matching service.
  3. *
  4. * @param serviceType The type of service to search for.
  5. * @return Any registered root or embedded device with at least one matching service.
  6. */
  7. Collection<D> get(ServiceType serviceType) {
  8. Collection<D> devices = new HashSet();
  9. for (RegistryItem<UDN, D> item : deviceItems) {
  10. D[] d = (D[])item.getItem().findDevices(serviceType);
  11. if (d != null) {
  12. devices.addAll(Arrays.asList(d));
  13. }
  14. }
  15. return devices;
  16. }

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

  1. /**
  2. * Returns all devices (root or embedded) with a compatible type.
  3. * <p>
  4. * This routine will check compatible versions, as described by the UDA.
  5. * </p>
  6. *
  7. * @param deviceType The minimum device type required.
  8. * @return Any registered root or embedded device with a compatible type.
  9. */
  10. Collection<D> get(DeviceType deviceType) {
  11. Collection<D> devices = new HashSet();
  12. for (RegistryItem<UDN, D> item : deviceItems) {
  13. D[] d = (D[])item.getItem().findDevices(deviceType);
  14. if (d != null) {
  15. devices.addAll(Arrays.asList(d));
  16. }
  17. }
  18. return devices;
  19. }

代码示例来源: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: org.fourthline.cling/cling-core

  1. /**
  2. * Returns all devices (root or embedded) which have at least one matching service.
  3. *
  4. * @param serviceType The type of service to search for.
  5. * @return Any registered root or embedded device with at least one matching service.
  6. */
  7. Collection<D> get(ServiceType serviceType) {
  8. Collection<D> devices = new HashSet<>();
  9. for (RegistryItem<UDN, D> item : deviceItems) {
  10. D[] d = (D[])item.getItem().findDevices(serviceType);
  11. if (d != null) {
  12. devices.addAll(Arrays.asList(d));
  13. }
  14. }
  15. return devices;
  16. }

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

  1. /**
  2. * Returns all devices (root or embedded) with a compatible type.
  3. * <p>
  4. * This routine will check compatible versions, as described by the UDA.
  5. * </p>
  6. *
  7. * @param deviceType The minimum device type required.
  8. * @return Any registered root or embedded device with a compatible type.
  9. */
  10. Collection<D> get(DeviceType deviceType) {
  11. Collection<D> devices = new HashSet<>();
  12. for (RegistryItem<UDN, D> item : deviceItems) {
  13. D[] d = (D[])item.getItem().findDevices(deviceType);
  14. if (d != null) {
  15. devices.addAll(Arrays.asList(d));
  16. }
  17. }
  18. return devices;
  19. }

代码示例来源: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-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. }

相关文章