本文整理汇总了Java中org.fourthline.cling.model.types.ServiceType类的典型用法代码示例。如果您正苦于以下问题:Java ServiceType类的具体用法?Java ServiceType怎么用?Java ServiceType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceType类属于org.fourthline.cling.model.types包,在下文中一共展示了ServiceType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createConfiguration
import org.fourthline.cling.model.types.ServiceType; //导入依赖的package包/类
@Override
protected AndroidUpnpServiceConfiguration createConfiguration() {
return new AndroidUpnpServiceConfiguration() {
@Override
public int getRegistryMaintenanceIntervalMillis() {
return 7000;
}
@Override
public ServiceType[] getExclusiveServiceTypes() {
return new ServiceType[] { new UDAServiceType("AVTransport"), new UDAServiceType("ContentDirectory"), new UDAServiceType("ConnectionManager"), new UDAServiceType("RenderingControl"), new UDAServiceType("X_MS_MediaReceiverRegistrar") };
}
};
}
示例2: createConfiguration
import org.fourthline.cling.model.types.ServiceType; //导入依赖的package包/类
@Override
protected AndroidUpnpServiceConfiguration createConfiguration() {
return new AndroidUpnpServiceConfiguration() {
@Override
public int getRegistryMaintenanceIntervalMillis() {
return 7000;
}
@Override
public ServiceType[] getExclusiveServiceTypes() {
// only care the these service below
return new ServiceType[]{
new UDAServiceType(UpnpServiceType.AVTRANSPORT),
new UDAServiceType(UpnpServiceType.RENDERING_CONTROL),
new UDAServiceType(UpnpServiceType.CONTENT_DIRECTORY),
};
}
};
}
示例3: createConfiguration
import org.fourthline.cling.model.types.ServiceType; //导入依赖的package包/类
@Override
protected AndroidUpnpServiceConfiguration createConfiguration() {
return new AndroidUpnpServiceConfiguration() {
@Override
public int getRegistryMaintenanceIntervalMillis() {
return 7000;
}
@Override
public ServiceType[] getExclusiveServiceTypes() {
// only care the these service below
return new ServiceType[]{
new UDAServiceType(UpnpServiceType.AVTRANSPORT),
new UDAServiceType(UpnpServiceType.RENDERING_CONTROL),
};
}
};
}
示例4: createConfiguration
import org.fourthline.cling.model.types.ServiceType; //导入依赖的package包/类
@Override
protected AndroidUpnpServiceConfiguration createConfiguration() {
return new AndroidUpnpServiceConfiguration() {
@Override
public int getRegistryMaintenanceIntervalMillis() {
return 7000;
}
@Override
public ServiceType[] getExclusiveServiceTypes() {
// only care the these service below
return new ServiceType[]{
new UDAServiceType(UpnpServiceType.CONTENT_DIRECTORY),
};
}
};
}
示例5: isSupportedServiceAdvertisement
import org.fourthline.cling.model.types.ServiceType; //导入依赖的package包/类
protected boolean isSupportedServiceAdvertisement(IncomingDatagramMessage message) {
ServiceType[] exclusiveServiceTypes = getUpnpService().getConfiguration().getExclusiveServiceTypes();
if (exclusiveServiceTypes == null) return false; // Discovery is disabled
if (exclusiveServiceTypes.length == 0) return true; // Any advertisement is fine
String usnHeader = message.getHeaders().getFirstHeader(UpnpHeader.Type.USN.getHttpName());
if (usnHeader == null) return false; // Not a service advertisement, drop it
try {
NamedServiceType nst = NamedServiceType.valueOf(usnHeader);
for (ServiceType exclusiveServiceType : exclusiveServiceTypes) {
if (nst.getServiceType().implementsVersion(exclusiveServiceType))
return true;
}
} catch (InvalidValueException ex) {
log.finest("Not a named service type header value: " + usnHeader);
}
log.fine("Service advertisement not supported, dropping it: " + usnHeader);
return false;
}
示例6: filterExclusiveServices
import org.fourthline.cling.model.types.ServiceType; //导入依赖的package包/类
protected List<RemoteService> filterExclusiveServices(RemoteService[] services) {
ServiceType[] exclusiveTypes = getUpnpService().getConfiguration().getExclusiveServiceTypes();
if (exclusiveTypes == null || exclusiveTypes.length == 0)
return Arrays.asList(services);
List<RemoteService> exclusiveServices = new ArrayList();
for (RemoteService discoveredService : services) {
for (ServiceType exclusiveType : exclusiveTypes) {
if (discoveredService.getServiceType().implementsVersion(exclusiveType)) {
log.fine("Including exclusive service: " + discoveredService);
exclusiveServices.add(discoveredService);
} else {
log.fine("Excluding unwanted service: " + exclusiveType);
}
}
}
return exclusiveServices;
}
示例7: createServiceTypeMessages
import org.fourthline.cling.model.types.ServiceType; //导入依赖的package包/类
protected List<OutgoingSearchResponse> createServiceTypeMessages(LocalDevice device,
NetworkAddress activeStreamServer) {
List<OutgoingSearchResponse> msgs = new ArrayList<OutgoingSearchResponse>();
for (ServiceType serviceType : device.findServiceTypes()) {
OutgoingSearchResponse message =
new OutgoingSearchResponseServiceType(
getInputMessage(),
getDescriptorLocation(activeStreamServer, device),
device,
serviceType
);
prepareOutgoingSearchResponse(message);
msgs.add(message);
}
return msgs;
}
示例8: sendSearchResponseServiceType
import org.fourthline.cling.model.types.ServiceType; //导入依赖的package包/类
protected void sendSearchResponseServiceType(ServiceType serviceType, NetworkAddress activeStreamServer) throws RouterException {
log.fine("Responding to service type search: " + serviceType);
Collection<Device> devices = getUpnpService().getRegistry().getDevices(serviceType);
for (Device device : devices) {
if (device instanceof LocalDevice) {
if (isAdvertisementDisabled((LocalDevice)device))
continue;
log.finer("Sending matching service type search result: " + device);
OutgoingSearchResponse message =
new OutgoingSearchResponseServiceType(
getInputMessage(),
getDescriptorLocation(activeStreamServer, (LocalDevice) device),
(LocalDevice) device,
serviceType
);
prepareOutgoingSearchResponse(message);
getUpnpService().getRouter().send(message);
}
}
}
示例9: endElement
import org.fourthline.cling.model.types.ServiceType; //导入依赖的package包/类
@Override
public void endElement(ELEMENT element) throws SAXException {
switch (element) {
case serviceType:
getInstance().serviceType = ServiceType.valueOf(getCharacters());
break;
case serviceId:
getInstance().serviceId = ServiceId.valueOf(getCharacters());
break;
case SCPDURL:
getInstance().descriptorURI = parseURI(getCharacters());
break;
case controlURL:
getInstance().controlURI = parseURI(getCharacters());
break;
case eventSubURL:
getInstance().eventSubscriptionURI = parseURI(getCharacters());
break;
}
}
示例10: read
import org.fourthline.cling.model.types.ServiceType; //导入依赖的package包/类
public LocalService read(Class<?> clazz, ServiceId id, ServiceType type,
boolean supportsQueryStateVariables, Set<Class> stringConvertibleTypes)
throws LocalServiceBindingException {
Map<StateVariable, StateVariableAccessor> stateVariables = readStateVariables(clazz, stringConvertibleTypes);
Map<Action, ActionExecutor> actions = readActions(clazz, stateVariables, stringConvertibleTypes);
// Special treatment of the state variable querying action
if (supportsQueryStateVariables) {
actions.put(new QueryStateVariableAction(), new QueryStateVariableExecutor());
}
try {
return new LocalService(type, id, actions, stateVariables, stringConvertibleTypes, supportsQueryStateVariables);
} catch (ValidationException ex) {
log.severe("Could not validate device model: " + ex.toString());
for (ValidationError validationError : ex.getErrors()) {
log.severe(validationError.toString());
}
throw new LocalServiceBindingException("Validation of model failed, check the log");
}
}
示例11: Service
import org.fourthline.cling.model.types.ServiceType; //导入依赖的package包/类
public Service(ServiceType serviceType, ServiceId serviceId,
Action<S>[] actions, StateVariable<S>[] stateVariables) throws ValidationException {
this.serviceType = serviceType;
this.serviceId = serviceId;
if (actions != null) {
for (Action action : actions) {
this.actions.put(action.getName(), action);
action.setService(this);
}
}
if (stateVariables != null) {
for (StateVariable stateVariable : stateVariables) {
this.stateVariables.put(stateVariable.getName(), stateVariable);
stateVariable.setService(this);
}
}
}
示例12: LocalService
import org.fourthline.cling.model.types.ServiceType; //导入依赖的package包/类
public LocalService(ServiceType serviceType, ServiceId serviceId,
Map<Action, ActionExecutor> actionExecutors,
Map<StateVariable, StateVariableAccessor> stateVariableAccessors,
Set<Class> stringConvertibleTypes,
boolean supportsQueryStateVariables) throws ValidationException {
super(serviceType, serviceId,
actionExecutors.keySet().toArray(new Action[actionExecutors.size()]),
stateVariableAccessors.keySet().toArray(new StateVariable[stateVariableAccessors.size()])
);
this.supportsQueryStateVariables = supportsQueryStateVariables;
this.stringConvertibleTypes = stringConvertibleTypes;
this.stateVariableAccessors = stateVariableAccessors;
this.actionExecutors = actionExecutors;
}
示例13: setVolume
import org.fourthline.cling.model.types.ServiceType; //导入依赖的package包/类
@Override
public void setVolume(int volume) {
if(volume < 0) {
volume = 0;
} else if(volume > device.volumeMax) {
volume = device.volumeMax;
}
device.volume = volume;
try {
controlPoint.execute(new SetVolume(device.renderer.findService(new ServiceType("schemas-upnp-org", "RenderingControl")), volume) {
@SuppressWarnings("rawtypes")
@Override
public void failure(ActionInvocation invocation, UpnpResponse operation, String defaultMessage) {
Log.w(TAG, "Set volume failed: " + defaultMessage);
}
});
} catch(Exception e) {
Log.w(TAG, "Failed to set volume");
}
}
示例14: createConfiguration
import org.fourthline.cling.model.types.ServiceType; //导入依赖的package包/类
@Override
protected UpnpServiceConfiguration createConfiguration() {
return new AndroidUpnpServiceConfiguration() {
@Override
public int getRegistryMaintenanceIntervalMillis() {
return 20000;
}
@Override
public ServiceType[] getExclusiveServiceTypes() {
return new ServiceType[]{
new UDAServiceType("ContentDirectory") //SwitchPower
};
}
};
}
示例15: createConfiguration
import org.fourthline.cling.model.types.ServiceType; //导入依赖的package包/类
@Override
protected UpnpServiceConfiguration createConfiguration() {
return new AndroidUpnpServiceConfiguration() {
@Override
public int getRegistryMaintenanceIntervalMillis() {
return 7000;
}
@Override
public ServiceType[] getExclusiveServiceTypes() {
return new ServiceType[]{new UDAServiceType("ContentDirectory")};
}
};
}