本文整理了Java中org.fourthline.cling.model.meta.Device.getServices()
方法的一些代码示例,展示了Device.getServices()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Device.getServices()
方法的具体详情如下:
包路径:org.fourthline.cling.model.meta.Device
类名称:Device
方法名:getServices
暂无
代码示例来源:origin: 4thline/cling
public boolean hasServices() {
return getServices() != null && getServices().length > 0;
}
代码示例来源:origin: 4thline/cling
protected Collection<S> findServices(ServiceType serviceType, ServiceId serviceId, D current) {
Collection services = new HashSet<>();
if (current.hasServices()) {
for (Service service : current.getServices()) {
if (isMatch(service, serviceType, serviceId))
services.add(service);
}
}
Collection<D> embeddedDevices = findEmbeddedDevices(current);
if (embeddedDevices != null) {
for (D embeddedDevice : embeddedDevices) {
if (embeddedDevice.hasServices()) {
for (Service service : embeddedDevice.getServices()) {
if (isMatch(service, serviceType, serviceId))
services.add(service);
}
}
}
}
return services;
}
代码示例来源:origin: 4thline/cling
public String getDetailsMessage() {
StringBuilder sb = new StringBuilder();
if (getDevice().isFullyHydrated()) {
sb.append(getDevice().getDisplayString());
sb.append("\n\n");
for (Service service : getDevice().getServices()) {
sb.append(service.getServiceType()).append("\n");
}
} else {
sb.append(getString(R.string.deviceDetailsNotYetAvailable));
}
return sb.toString();
}
// DOC:DETAILS
代码示例来源: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 boolean hasServices() {
return getServices() != null && getServices().length > 0;
}
代码示例来源:origin: 4thline/cling
protected void generateServiceList(Namespace namespace, Device deviceModel, Document descriptor, Element deviceElement) {
if (!deviceModel.hasServices()) return;
Element serviceListElement = appendNewElement(descriptor, deviceElement, ELEMENT.serviceList);
for (Service service : deviceModel.getServices()) {
Element serviceElement = appendNewElement(descriptor, serviceListElement, ELEMENT.service);
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.serviceType, service.getServiceType());
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.serviceId, service.getServiceId());
if (service instanceof RemoteService) {
RemoteService rs = (RemoteService) service;
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.SCPDURL, rs.getDescriptorURI());
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.controlURL, rs.getControlURI());
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.eventSubURL, rs.getEventSubscriptionURI());
} else if (service instanceof LocalService) {
LocalService ls = (LocalService) service;
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.SCPDURL, namespace.getDescriptorPath(ls));
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.controlURL, namespace.getControlPath(ls));
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.eventSubURL, namespace.getEventSubscriptionPath(ls));
}
}
}
代码示例来源:origin: 4thline/cling
for (Service service : device.getServices()) {
DefaultMutableTreeNode serviceNode = new DefaultMutableTreeNode(service);
deviceNode.add(serviceNode);
代码示例来源:origin: kingthy/TVRemoteIME
protected Collection<S> findServices(ServiceType serviceType, ServiceId serviceId, D current) {
Collection services = new HashSet();
if (current.hasServices()) {
for (Service service : current.getServices()) {
if (isMatch(service, serviceType, serviceId))
services.add(service);
}
}
Collection<D> embeddedDevices = findEmbeddedDevices(current);
if (embeddedDevices != null) {
for (D embeddedDevice : embeddedDevices) {
if (embeddedDevice.hasServices()) {
for (Service service : embeddedDevice.getServices()) {
if (isMatch(service, serviceType, serviceId))
services.add(service);
}
}
}
}
return services;
}
代码示例来源: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: org.fourthline.cling/cling-core
public boolean hasServices() {
return getServices() != null && getServices().length > 0;
}
代码示例来源:origin: kingthy/TVRemoteIME
protected void generateServiceList(Namespace namespace, Device deviceModel, Document descriptor, Element deviceElement) {
if (!deviceModel.hasServices()) return;
Element serviceListElement = appendNewElement(descriptor, deviceElement, ELEMENT.serviceList);
for (Service service : deviceModel.getServices()) {
Element serviceElement = appendNewElement(descriptor, serviceListElement, ELEMENT.service);
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.serviceType, service.getServiceType());
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.serviceId, service.getServiceId());
if (service instanceof RemoteService) {
RemoteService rs = (RemoteService) service;
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.SCPDURL, rs.getDescriptorURI());
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.controlURL, rs.getControlURI());
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.eventSubURL, rs.getEventSubscriptionURI());
} else if (service instanceof LocalService) {
LocalService ls = (LocalService) service;
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.SCPDURL, namespace.getDescriptorPath(ls));
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.controlURL, namespace.getControlPath(ls));
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.eventSubURL, namespace.getEventSubscriptionPath(ls));
}
}
}
代码示例来源:origin: hubing8658/UPnP-DLNA-Demo
public String getDetailsMsg() {
StringBuilder sb = new StringBuilder();
if (device.isFullyHydrated()) {
sb.append(device.getDisplayString());
sb.append("\n\n");
// sb.append(device.getIdentity().getUdn()).append("\n");
// sb.append("max-age:" + device.getIdentity().getMaxAgeSeconds()).append("\n");
for (Service srv : device.getServices()) {
sb.append(srv.getServiceType()).append("\n");
}
} else {
sb.append("正在查找设备详情,请稍后.");
}
return sb.toString();
}
代码示例来源:origin: org.fourthline.cling/cling-core
protected Collection<S> findServices(ServiceType serviceType, ServiceId serviceId, D current) {
Collection services = new HashSet<>();
if (current.hasServices()) {
for (Service service : current.getServices()) {
if (isMatch(service, serviceType, serviceId))
services.add(service);
}
}
Collection<D> embeddedDevices = findEmbeddedDevices(current);
if (embeddedDevices != null) {
for (D embeddedDevice : embeddedDevices) {
if (embeddedDevice.hasServices()) {
for (Service service : embeddedDevice.getServices()) {
if (isMatch(service, serviceType, serviceId))
services.add(service);
}
}
}
}
return services;
}
代码示例来源: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: org.fourthline.cling/cling-core
protected void generateServiceList(Namespace namespace, Device deviceModel, Document descriptor, Element deviceElement) {
if (!deviceModel.hasServices()) return;
Element serviceListElement = appendNewElement(descriptor, deviceElement, ELEMENT.serviceList);
for (Service service : deviceModel.getServices()) {
Element serviceElement = appendNewElement(descriptor, serviceListElement, ELEMENT.service);
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.serviceType, service.getServiceType());
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.serviceId, service.getServiceId());
if (service instanceof RemoteService) {
RemoteService rs = (RemoteService) service;
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.SCPDURL, rs.getDescriptorURI());
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.controlURL, rs.getControlURI());
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.eventSubURL, rs.getEventSubscriptionURI());
} else if (service instanceof LocalService) {
LocalService ls = (LocalService) service;
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.SCPDURL, namespace.getDescriptorPath(ls));
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.controlURL, namespace.getControlPath(ls));
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.eventSubURL, namespace.getEventSubscriptionPath(ls));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!