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

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

本文整理了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

/**
 * Returns all devices (root or embedded) which have at least one matching service.
 *
 * @param serviceType The type of service to search for.
 * @return Any registered root or embedded device with at least one matching service.
 */
Collection<D> get(ServiceType serviceType) {
  Collection<D> devices = new HashSet<>();
  for (RegistryItem<UDN, D> item : deviceItems) {
    D[] d = (D[])item.getItem().findDevices(serviceType);
    if (d != null) {
      devices.addAll(Arrays.asList(d));
    }
  }
  return devices;
}

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

/**
 * 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;
}

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

protected Service discoverConnectionService(Device device) {
  if (!device.getType().equals(IGD_DEVICE_TYPE)) {
    return null;
  }
  Device[] connectionDevices = device.findDevices(CONNECTION_DEVICE_TYPE);
  if (connectionDevices.length == 0) {
    log.fine("IGD doesn't support '" + CONNECTION_DEVICE_TYPE + "': " + device);
    return null;
  }
  Device connectionDevice = connectionDevices[0];
  log.fine("Using first discovered WAN connection device: " + connectionDevice);
  Service ipConnectionService = connectionDevice.findService(IP_SERVICE_TYPE);
  Service pppConnectionService = connectionDevice.findService(PPP_SERVICE_TYPE);
  if (ipConnectionService == null && pppConnectionService == null) {
    log.fine("IGD doesn't support IP or PPP WAN connection service: " + device);
  }
  return ipConnectionService != null ? ipConnectionService : pppConnectionService;
}

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

/**
 * Returns all devices (root or embedded) which have at least one matching service.
 *
 * @param serviceType The type of service to search for.
 * @return Any registered root or embedded device with at least one matching service.
 */
Collection<D> get(ServiceType serviceType) {
  Collection<D> devices = new HashSet();
  for (RegistryItem<UDN, D> item : deviceItems) {
    D[] d = (D[])item.getItem().findDevices(serviceType);
    if (d != null) {
      devices.addAll(Arrays.asList(d));
    }
  }
  return devices;
}

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

/**
 * 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;
}

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

protected Service discoverConnectionService(Device device) {
  if (!device.getType().equals(IGD_DEVICE_TYPE)) {
    return null;
  }
  Device[] connectionDevices = device.findDevices(CONNECTION_DEVICE_TYPE);
  if (connectionDevices.length == 0) {
    log.fine("IGD doesn't support '" + CONNECTION_DEVICE_TYPE + "': " + device);
    return null;
  }
  Device connectionDevice = connectionDevices[0];
  log.fine("Using first discovered WAN connection device: " + connectionDevice);
  Service ipConnectionService = connectionDevice.findService(IP_SERVICE_TYPE);
  Service pppConnectionService = connectionDevice.findService(PPP_SERVICE_TYPE);
  if (ipConnectionService == null && pppConnectionService == null) {
    log.fine("IGD doesn't support IP or PPP WAN connection service: " + device);
  }
  return ipConnectionService != null ? ipConnectionService : pppConnectionService;
}

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

/**
 * Returns all devices (root or embedded) which have at least one matching service.
 *
 * @param serviceType The type of service to search for.
 * @return Any registered root or embedded device with at least one matching service.
 */
Collection<D> get(ServiceType serviceType) {
  Collection<D> devices = new HashSet<>();
  for (RegistryItem<UDN, D> item : deviceItems) {
    D[] d = (D[])item.getItem().findDevices(serviceType);
    if (d != null) {
      devices.addAll(Arrays.asList(d));
    }
  }
  return devices;
}

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

/**
 * 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;
}

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

protected Service<?, ?> discoverConnectionService(@SuppressWarnings("rawtypes") final Device<?, Device, ?> device) {
  if (!device.getType().equals(IGD_DEVICE_TYPE)) {
    logger.debug("Found service of wrong type {}, expected {}.", device.getType(), IGD_DEVICE_TYPE);
    return null;
  }
  @SuppressWarnings("rawtypes")
  final Device[] connectionDevices = device.findDevices(CONNECTION_DEVICE_TYPE);
  if (connectionDevices.length == 0) {
    logger.debug("IGD doesn't support '{}': {}", CONNECTION_DEVICE_TYPE, device);
    return null;
  }
  logger.debug("Found {} devices", connectionDevices.length);
  return findConnectionService(connectionDevices);
}

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

protected Service discoverConnectionService(Device device) {
  if (!device.getType().equals(IGD_DEVICE_TYPE)) {
    return null;
  }
  Device[] connectionDevices = device.findDevices(CONNECTION_DEVICE_TYPE);
  if (connectionDevices.length == 0) {
    log.fine("IGD doesn't support '" + CONNECTION_DEVICE_TYPE + "': " + device);
    return null;
  }
  Device connectionDevice = connectionDevices[0];
  log.fine("Using first discovered WAN connection device: " + connectionDevice);
  Service ipConnectionService = connectionDevice.findService(IP_SERVICE_TYPE);
  Service pppConnectionService = connectionDevice.findService(PPP_SERVICE_TYPE);
  if (ipConnectionService == null && pppConnectionService == null) {
    log.fine("IGD doesn't support IP or PPP WAN connection service: " + device);
  }
  return ipConnectionService != null ? ipConnectionService : pppConnectionService;
}

相关文章