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

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

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

Device.getServices介绍

暂无

代码示例

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

  1. public boolean hasServices() {
  2. return getServices() != null && getServices().length > 0;
  3. }

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

  1. protected Collection<S> findServices(ServiceType serviceType, ServiceId serviceId, D current) {
  2. Collection services = new HashSet<>();
  3. if (current.hasServices()) {
  4. for (Service service : current.getServices()) {
  5. if (isMatch(service, serviceType, serviceId))
  6. services.add(service);
  7. }
  8. }
  9. Collection<D> embeddedDevices = findEmbeddedDevices(current);
  10. if (embeddedDevices != null) {
  11. for (D embeddedDevice : embeddedDevices) {
  12. if (embeddedDevice.hasServices()) {
  13. for (Service service : embeddedDevice.getServices()) {
  14. if (isMatch(service, serviceType, serviceId))
  15. services.add(service);
  16. }
  17. }
  18. }
  19. }
  20. return services;
  21. }

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

  1. public String getDetailsMessage() {
  2. StringBuilder sb = new StringBuilder();
  3. if (getDevice().isFullyHydrated()) {
  4. sb.append(getDevice().getDisplayString());
  5. sb.append("\n\n");
  6. for (Service service : getDevice().getServices()) {
  7. sb.append(service.getServiceType()).append("\n");
  8. }
  9. } else {
  10. sb.append(getString(R.string.deviceDetailsNotYetAvailable));
  11. }
  12. return sb.toString();
  13. }
  14. // DOC:DETAILS

代码示例来源: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 boolean hasServices() {
  2. return getServices() != null && getServices().length > 0;
  3. }

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

  1. protected void generateServiceList(Namespace namespace, Device deviceModel, Document descriptor, Element deviceElement) {
  2. if (!deviceModel.hasServices()) return;
  3. Element serviceListElement = appendNewElement(descriptor, deviceElement, ELEMENT.serviceList);
  4. for (Service service : deviceModel.getServices()) {
  5. Element serviceElement = appendNewElement(descriptor, serviceListElement, ELEMENT.service);
  6. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.serviceType, service.getServiceType());
  7. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.serviceId, service.getServiceId());
  8. if (service instanceof RemoteService) {
  9. RemoteService rs = (RemoteService) service;
  10. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.SCPDURL, rs.getDescriptorURI());
  11. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.controlURL, rs.getControlURI());
  12. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.eventSubURL, rs.getEventSubscriptionURI());
  13. } else if (service instanceof LocalService) {
  14. LocalService ls = (LocalService) service;
  15. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.SCPDURL, namespace.getDescriptorPath(ls));
  16. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.controlURL, namespace.getControlPath(ls));
  17. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.eventSubURL, namespace.getEventSubscriptionPath(ls));
  18. }
  19. }
  20. }

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

  1. for (Service service : device.getServices()) {
  2. DefaultMutableTreeNode serviceNode = new DefaultMutableTreeNode(service);
  3. deviceNode.add(serviceNode);

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

  1. protected Collection<S> findServices(ServiceType serviceType, ServiceId serviceId, D current) {
  2. Collection services = new HashSet();
  3. if (current.hasServices()) {
  4. for (Service service : current.getServices()) {
  5. if (isMatch(service, serviceType, serviceId))
  6. services.add(service);
  7. }
  8. }
  9. Collection<D> embeddedDevices = findEmbeddedDevices(current);
  10. if (embeddedDevices != null) {
  11. for (D embeddedDevice : embeddedDevices) {
  12. if (embeddedDevice.hasServices()) {
  13. for (Service service : embeddedDevice.getServices()) {
  14. if (isMatch(service, serviceType, serviceId))
  15. services.add(service);
  16. }
  17. }
  18. }
  19. }
  20. return services;
  21. }

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

  1. public boolean hasServices() {
  2. return getServices() != null && getServices().length > 0;
  3. }

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

  1. protected void generateServiceList(Namespace namespace, Device deviceModel, Document descriptor, Element deviceElement) {
  2. if (!deviceModel.hasServices()) return;
  3. Element serviceListElement = appendNewElement(descriptor, deviceElement, ELEMENT.serviceList);
  4. for (Service service : deviceModel.getServices()) {
  5. Element serviceElement = appendNewElement(descriptor, serviceListElement, ELEMENT.service);
  6. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.serviceType, service.getServiceType());
  7. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.serviceId, service.getServiceId());
  8. if (service instanceof RemoteService) {
  9. RemoteService rs = (RemoteService) service;
  10. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.SCPDURL, rs.getDescriptorURI());
  11. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.controlURL, rs.getControlURI());
  12. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.eventSubURL, rs.getEventSubscriptionURI());
  13. } else if (service instanceof LocalService) {
  14. LocalService ls = (LocalService) service;
  15. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.SCPDURL, namespace.getDescriptorPath(ls));
  16. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.controlURL, namespace.getControlPath(ls));
  17. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.eventSubURL, namespace.getEventSubscriptionPath(ls));
  18. }
  19. }
  20. }

代码示例来源:origin: hubing8658/UPnP-DLNA-Demo

  1. public String getDetailsMsg() {
  2. StringBuilder sb = new StringBuilder();
  3. if (device.isFullyHydrated()) {
  4. sb.append(device.getDisplayString());
  5. sb.append("\n\n");
  6. // sb.append(device.getIdentity().getUdn()).append("\n");
  7. // sb.append("max-age:" + device.getIdentity().getMaxAgeSeconds()).append("\n");
  8. for (Service srv : device.getServices()) {
  9. sb.append(srv.getServiceType()).append("\n");
  10. }
  11. } else {
  12. sb.append("正在查找设备详情,请稍后.");
  13. }
  14. return sb.toString();
  15. }

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

  1. protected Collection<S> findServices(ServiceType serviceType, ServiceId serviceId, D current) {
  2. Collection services = new HashSet<>();
  3. if (current.hasServices()) {
  4. for (Service service : current.getServices()) {
  5. if (isMatch(service, serviceType, serviceId))
  6. services.add(service);
  7. }
  8. }
  9. Collection<D> embeddedDevices = findEmbeddedDevices(current);
  10. if (embeddedDevices != null) {
  11. for (D embeddedDevice : embeddedDevices) {
  12. if (embeddedDevice.hasServices()) {
  13. for (Service service : embeddedDevice.getServices()) {
  14. if (isMatch(service, serviceType, serviceId))
  15. services.add(service);
  16. }
  17. }
  18. }
  19. }
  20. return services;
  21. }

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

  1. protected void generateServiceList(Namespace namespace, Device deviceModel, Document descriptor, Element deviceElement) {
  2. if (!deviceModel.hasServices()) return;
  3. Element serviceListElement = appendNewElement(descriptor, deviceElement, ELEMENT.serviceList);
  4. for (Service service : deviceModel.getServices()) {
  5. Element serviceElement = appendNewElement(descriptor, serviceListElement, ELEMENT.service);
  6. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.serviceType, service.getServiceType());
  7. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.serviceId, service.getServiceId());
  8. if (service instanceof RemoteService) {
  9. RemoteService rs = (RemoteService) service;
  10. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.SCPDURL, rs.getDescriptorURI());
  11. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.controlURL, rs.getControlURI());
  12. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.eventSubURL, rs.getEventSubscriptionURI());
  13. } else if (service instanceof LocalService) {
  14. LocalService ls = (LocalService) service;
  15. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.SCPDURL, namespace.getDescriptorPath(ls));
  16. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.controlURL, namespace.getControlPath(ls));
  17. appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.eventSubURL, namespace.getEventSubscriptionPath(ls));
  18. }
  19. }
  20. }

相关文章