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


Java CapabilityPriorityLevel类代码示例

本文整理汇总了Java中com.connectsdk.service.capability.CapabilityMethods.CapabilityPriorityLevel的典型用法代码示例。如果您正苦于以下问题:Java CapabilityPriorityLevel类的具体用法?Java CapabilityPriorityLevel怎么用?Java CapabilityPriorityLevel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CapabilityPriorityLevel类属于com.connectsdk.service.capability.CapabilityMethods包,在下文中一共展示了CapabilityPriorityLevel类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCapability

import com.connectsdk.service.capability.CapabilityMethods.CapabilityPriorityLevel; //导入依赖的package包/类
/**
 * Get a capability with the highest priority from a device. If device doesn't have such
 * capability then returns null.
 * @param controllerClass type of capability
 * @return capability implementation
 */
public <T extends CapabilityMethods> T getCapability(Class<T> controllerClass) {
    T foundController = null;
    CapabilityPriorityLevel foundControllerPriority = CapabilityPriorityLevel.NOT_SUPPORTED;
    for (DeviceService service: services.values()) {
        if (service.getAPI(controllerClass) == null)
            continue;

        T controller = service.getAPI(controllerClass);
        CapabilityPriorityLevel controllerPriority = service.getPriorityLevel(controllerClass);

        if (foundController == null) {
            foundController = controller;
 
            if (controllerPriority == null || controllerPriority == CapabilityPriorityLevel.NOT_SUPPORTED) {
                Log.w(Util.T, "We found a mathcing capability class, but no priority level for the class. Please check \"getPriorityLevel()\" in your class");
            }
            foundControllerPriority = controllerPriority;
        }
        else if (controllerPriority != null && foundControllerPriority != null) {
            if (controllerPriority.getValue() > foundControllerPriority.getValue()) {
                foundController = controller;
                foundControllerPriority = controllerPriority;
            }
        }
    }

    return foundController;
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:35,代码来源:ConnectableDevice.java

示例2: getPriorityLevel

import com.connectsdk.service.capability.CapabilityMethods.CapabilityPriorityLevel; //导入依赖的package包/类
public CapabilityMethods.CapabilityPriorityLevel getPriorityLevel(Class<? extends CapabilityMethods> clazz) {
    return CapabilityPriorityLevel.NOT_SUPPORTED;
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:4,代码来源:DeviceService.java


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