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


Java PercentType.intValue方法代码示例

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

}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:27,代码来源:DmxChannel.java

示例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;
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:26,代码来源:PlexConnector.java

示例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;
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:13,代码来源:MultiLevelPercentCommandConverter.java

示例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;
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:11,代码来源:BinaryPercentCommandConverter.java


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