本文整理汇总了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;
}
示例2: getPriorityLevel
import com.connectsdk.service.capability.CapabilityMethods.CapabilityPriorityLevel; //导入依赖的package包/类
public CapabilityMethods.CapabilityPriorityLevel getPriorityLevel(Class<? extends CapabilityMethods> clazz) {
return CapabilityPriorityLevel.NOT_SUPPORTED;
}