当前位置: 首页>>代码示例>>Java>>正文


Java ServiceType类代码示例

本文整理汇总了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") };
		}

	};
}
 
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:17,代码来源:UpnpRegistryService.java

示例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),
            };
        }

    };
}
 
开发者ID:hezhubo,项目名称:HPlayer,代码行数:22,代码来源:UpnpService.java

示例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),
            };
        }

    };
}
 
开发者ID:hezhubo,项目名称:HPlayer,代码行数:21,代码来源:UpnpService.java

示例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),
            };
        }

    };
}
 
开发者ID:hezhubo,项目名称:HPlayer,代码行数:20,代码来源:UpnpService.java

示例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;
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:21,代码来源:ProtocolFactoryImpl.java

示例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;
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:20,代码来源:RetrieveRemoteDescriptors.java

示例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;
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:17,代码来源:ReceivingSearch.java

示例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);
        }
    }
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:23,代码来源:ReceivingSearch.java

示例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;
    }
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:21,代码来源:UDA10DeviceDescriptorBinderSAXImpl.java

示例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");
    }
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:24,代码来源:AnnotationLocalServiceBinder.java

示例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);
        }
    }

}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:22,代码来源:Service.java

示例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;
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:17,代码来源:LocalService.java

示例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");
	}
}
 
开发者ID:popeen,项目名称:Popeens-DSub,代码行数:22,代码来源:DLNAController.java

示例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
            };
        }
    };
}
 
开发者ID:eriklupander,项目名称:microgramcaster,代码行数:19,代码来源:BrowserUpnpService.java

示例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")};
        }
    };
}
 
开发者ID:MizzleDK,项目名称:Mizuu-Android-TV,代码行数:16,代码来源:UpnpService.java


注:本文中的org.fourthline.cling.model.types.ServiceType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。