本文整理汇总了Java中org.openhab.core.library.types.PercentType.intValue方法的典型用法代码示例。如果您正苦于以下问题:Java PercentType.intValue方法的具体用法?Java PercentType.intValue怎么用?Java PercentType.intValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openhab.core.library.types.PercentType
的用法示例。
在下文中一共展示了PercentType.intValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setValue
import org.openhab.core.library.types.PercentType; //导入方法依赖的package包/类
/**
* Set the channel output to a fixed value of output level * 255, if no
* actions are available. If actions are available, they are faded to the
* output level.
*
* @param value
* output value
*/
public synchronized void setValue(PercentType outputlevel) {
if (outputlevel.intValue() == 0) {
switchOff();
return;
} else {
switchOn();
}
if (hasRunningActions()) {
for (BaseAction a : actions) {
a.setOutputLevel(outputlevel.intValue());
}
} else {
value = DmxUtil.getOutputValue(value, outputlevel.intValue());
}
}
示例2: getVolumeCommand
import org.openhab.core.library.types.PercentType; //导入方法依赖的package包/类
private String getVolumeCommand(PlexBindingConfig config, Command command) {
int newVolume = 100;
PlexSession session = getSessionByMachineId(config.getMachineIdentifier());
if (session != null)
newVolume = session.getVolume();
if (command.getClass().equals(PercentType.class)) {
PercentType percentType = (PercentType)command;
newVolume = percentType.intValue();
} else if (command.getClass().equals(IncreaseDecreaseType.class)) {
if (command.equals(IncreaseDecreaseType.DECREASE))
newVolume = Math.max(0, newVolume-VOLUME_STEP);
else
newVolume = Math.min(100, newVolume+VOLUME_STEP);
}
if (session != null) {
session.setVolume(newVolume);
callback.updateReceived(session);
}
String url = String.format("playback/setParameters?volume=%d", newVolume);
return url;
}
示例3: convert
import org.openhab.core.library.types.PercentType; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Integer convert(Item item, PercentType command) {
if (command.intValue() <= 0)
return 0x00;
if (command.intValue() > 0 && command.intValue() < 0x63)
return command.intValue();
else
return 0x63;
}
示例4: convert
import org.openhab.core.library.types.PercentType; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Integer convert(Item item, PercentType command) {
if (command.intValue() <= 0)
return 0x00;
else
return 0xFF;
}