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

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

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

Device.getIdentity介绍

暂无

代码示例

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

public DeviceItem(Device device) {
  this.udn = device.getIdentity().getUdn();
  this.device = device;
}

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

public DeviceItem(Device device, String... label) {
  this.udn = device.getIdentity().getUdn();
  this.device = device;
  this.label = label;
}

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

protected String getDevicePath(Device device) {
  if (device.getIdentity().getUdn() == null) {
    throw new IllegalStateException("Can't generate local URI prefix without UDN");
  }
  StringBuilder s = new StringBuilder();
  s.append(DEVICE).append("/");
  s.append(URIUtil.encodePathSegment(device.getIdentity().getUdn().getIdentifierString()));
  return s.toString();
}

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

@Override
  public String toString() {
    return "(" + getClass().getSimpleName() + ") Identity: " + getIdentity().toString() + ", Root: " + isRoot();
  }
}

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

protected D find(UDN udn, D current) {
  if (current.getIdentity() != null && current.getIdentity().getUdn() != null) {
    if (current.getIdentity().getUdn().equals(udn)) return current;
  }
  if (current.hasEmbeddedDevices()) {
    for (D embeddedDevice : (D[]) current.getEmbeddedDevices()) {
      D match;
      if ((match = find(udn, embeddedDevice)) != null) return match;
    }
  }
  return null;
}

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

boolean contains(D device) {
  return contains(device.getIdentity().getUdn());
}

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

protected Collection<D> findEmbeddedDevices(D current) {
  Collection<D> devices = new HashSet<>();
  if (!current.isRoot() && current.getIdentity().getUdn() != null)
    devices.add(current);
  if (current.hasEmbeddedDevices()) {
    for (D embeddedDevice : (D[]) current.getEmbeddedDevices()) {
      devices.addAll(findEmbeddedDevices(embeddedDevice));
    }
  }
  return devices;
}

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

public ServiceReference getReference() {
  return new ServiceReference(getDevice().getIdentity().getUdn(), getServiceId());
}

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

/**
 * Returns root and embedded devices registered under the given UDN.
 *
 * @param udn A unique device name.
 * @param rootOnly Set to true if only root devices (no embedded) should be searched
 * @return Any registered root or embedded device under the given UDN, <tt>null</tt> if
 *         no device with the given UDN has been registered.
 */
D get(UDN udn, boolean rootOnly) {
  for (RegistryItem<UDN, D> item : deviceItems) {
    D device = item.getItem();
    if (device.getIdentity().getUdn().equals(udn)) {
      return device;
    }
    if (!rootOnly) {
      D foundDevice = (D)item.getItem().findDevice(udn);
      if (foundDevice != null) return foundDevice;
    }
  }
  return null;
}

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

private void establishLocalSubscription(LocalService service) {
  if (getControlPoint().getRegistry().getLocalDevice(service.getDevice().getIdentity().getUdn(), false) == null) {
    log.fine("Local device service is currently not registered, failing subscription immediately");
    failed(null, null, new IllegalStateException("Local device is not registered"));

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

incomingSubscription.getItem().getService().getDevice().getIdentity().getUdn();

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

@Override
  public String toString() {
    return "(" + getClass().getSimpleName() + ") Identity: " + getIdentity().toString() + ", Root: " + isRoot();
  }
}

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

boolean contains(D device) {
  return contains(device.getIdentity().getUdn());
}

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

currentNode.add(deviceNode);
addIfNotNull(deviceNode, "UDN: ", device.getIdentity().getUdn());
addIfNotNull(deviceNode, "Device Type: ", device.getType().toString());
if (device.getDetails().getDlnaDocs() != null) {

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

public URI getPath(Device device) {
  if (device.getIdentity().getUdn() == null) {
    throw new IllegalStateException("Can't generate local URI prefix without UDN");
  s.append(DEVICE).append("/");
  s.append(URIUtil.encodePathSegment(device.getIdentity().getUdn().getIdentifierString()));

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

public ServiceReference getReference() {
  return new ServiceReference(getDevice().getIdentity().getUdn(), getServiceId());
}

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

protected D find(UDN udn, D current) {
  if (current.getIdentity().getUdn().equals(udn)) return current;
  if (current.hasEmbeddedDevices()) {
    for (D embeddedDevice : (D[]) current.getEmbeddedDevices()) {
      D match;
      if ((match = find(udn, embeddedDevice)) != null) return match;
    }
  }
  return null;
}

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

/**
 * Returns root and embedded devices registered under the given UDN.
 *
 * @param udn A unique device name.
 * @param rootOnly Set to true if only root devices (no embedded) should be searched
 * @return Any registered root or embedded device under the given UDN, <tt>null</tt> if
 *         no device with the given UDN has been registered.
 */
D get(UDN udn, boolean rootOnly) {
  for (RegistryItem<UDN, D> item : deviceItems) {
    D device = item.getItem();
    if (device.getIdentity().getUdn().equals(udn)) {
      return device;
    }
    if (!rootOnly) {
      D foundDevice = (D)item.getItem().findDevice(udn);
      if (foundDevice != null) return foundDevice;
    }
  }
  return null;
}

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

deviceModelDetails.getSerialNumber()
);
appendNewElementIfNotNull(descriptor, deviceElement, ELEMENT.UDN, deviceModel.getIdentity().getUdn());
appendNewElementIfNotNull(
    descriptor, deviceElement, ELEMENT.presentationURL,

相关文章