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

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

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

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

代码示例来源: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: 4thline/cling

public List<ValidationError> validate() {
  List<ValidationError> errors = new ArrayList<>();
  if (getType() != null) {
    // Only validate the graph if we have a device type - that means we validate only if there
    // actually is a fully hydrated graph, not just a discovered device of which we haven't even
    // retrieved the descriptor yet. This assumes that the descriptor will ALWAYS contain a device
    // type. Now that is a risky assumption...
    errors.addAll(getVersion().validate());
    
    if(getIdentity() != null) {
      errors.addAll(getIdentity().validate());
    }
    if (getDetails() != null) {
      errors.addAll(getDetails().validate());
    }
    if (hasServices()) {
      for (Service service : getServices()) {
        if (service != null)
          errors.addAll(service.validate());
      }
    }
    if (hasEmbeddedDevices()) {
      for (Device embeddedDevice : getEmbeddedDevices()) {
        if (embeddedDevice != null)
          errors.addAll(embeddedDevice.validate());
      }
    }
  }
  return errors;
}

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

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

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

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

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

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

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

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

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

public List<ValidationError> validate() {
  List<ValidationError> errors = new ArrayList();
  if (getType() != null) {
    // Only validate the graph if we have a device type - that means we validate only if there
    // actually is a fully hydrated graph, not just a discovered device of which we haven't even
    // retrieved the descriptor yet. This assumes that the descriptor will ALWAYS contain a device
    // type. Now that is a risky assumption...
    errors.addAll(getVersion().validate());
    if (getDetails() != null) {
      errors.addAll(getDetails().validate());
    }
    if (hasServices()) {
      for (Service service : getServices()) {
        if (service != null)
          errors.addAll(service.validate());
      }
    }
    if (hasEmbeddedDevices()) {
      for (Device embeddedDevice : getEmbeddedDevices()) {
        if (embeddedDevice != null)
          errors.addAll(embeddedDevice.validate());
      }
    }
  }
  return errors;
}

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

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

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

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

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

/**
 * Finds all available Players (implementing the MediaRenderer stack)<br>
 * You might want to call sendPlayerSearchRequest() a few secs before, to populate freshly
 * 
 * @return List of devices
 */
public List<Device> getAvailablePlayers() {
 createUpnpService();
 List<Device> ret = new ArrayList<>();
 for (Device device : this.upnpService.getRegistry().getDevices()) {
  if (device.getType().getType().equals("MediaRenderer")) {
   ret.add(device);
  }
 }
 return ret;
}

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

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

public List<ValidationError> validate() {
  List<ValidationError> errors = new ArrayList<>();
  if (getType() != null) {
    // Only validate the graph if we have a device type - that means we validate only if there
    // actually is a fully hydrated graph, not just a discovered device of which we haven't even
    // retrieved the descriptor yet. This assumes that the descriptor will ALWAYS contain a device
    // type. Now that is a risky assumption...
    errors.addAll(getVersion().validate());
    
    if(getIdentity() != null) {
      errors.addAll(getIdentity().validate());
    }
    if (getDetails() != null) {
      errors.addAll(getDetails().validate());
    }
    if (hasServices()) {
      for (Service service : getServices()) {
        if (service != null)
          errors.addAll(service.validate());
      }
    }
    if (hasEmbeddedDevices()) {
      for (Device embeddedDevice : getEmbeddedDevices()) {
        if (embeddedDevice != null)
          errors.addAll(embeddedDevice.validate());
      }
    }
  }
  return errors;
}

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

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

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

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

相关文章