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


Java PHLightState.setHue方法代码示例

本文整理汇总了Java中com.philips.lighting.model.PHLightState.setHue方法的典型用法代码示例。如果您正苦于以下问题:Java PHLightState.setHue方法的具体用法?Java PHLightState.setHue怎么用?Java PHLightState.setHue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.philips.lighting.model.PHLightState的用法示例。


在下文中一共展示了PHLightState.setHue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showRandomColorsOnAllLamps

import com.philips.lighting.model.PHLightState; //导入方法依赖的package包/类
@Override
public void showRandomColorsOnAllLamps() {
	for (PHBridge bridge : bridges) {
		PHBridgeResourcesCache resourceCache = bridge.getResourceCache();
		List<PHLight> allLights = resourceCache.getAllLights();
		Random rand = new Random();
		for (PHLight light : allLights) {
			PHLightState lightState = new PHLightState();
			lightState.setBrightness(HueConstants.MAX_BRI);
			lightState.setSaturation(HueConstants.MAX_SAT);
			lightState.setHue(rand.nextInt(HueConstants.MAX_HUE + 1));
			bridge.updateLightState(light, lightState);
		}
	}
}
 
开发者ID:adessoAG,项目名称:JenkinsHue,代码行数:16,代码来源:HueServiceImpl.java

示例2: randomLights

import com.philips.lighting.model.PHLightState; //导入方法依赖的package包/类
public void randomLights() {
    PHBridge bridge = phHueSDK.getSelectedBridge();
    PHBridgeResourcesCache cache = bridge.getResourceCache();

    List<PHLight> allLights = cache.getAllLights();
    Random rand = new Random();

    for (PHLight light : allLights) {
        PHLightState lightState = new PHLightState();
        lightState.setHue(rand.nextInt(MAX_HUE));
        bridge.updateLightState(light, lightState); // If no bridge response is required then use this simpler form.
    }
}
 
开发者ID:carstena,项目名称:game-to-philips-hue,代码行数:14,代码来源:Controller.java

示例3: setColorHSB

import com.philips.lighting.model.PHLightState; //导入方法依赖的package包/类
@Override
public void setColorHSB(HSBColor colorHSB)
{
	// get the bridge object (asks it to the network driver to get the most
	// updated version) TODO: check if the received reference is kept up to
	// date
	PHBridge bridge = this.gateway.getBridge();

	// check not null
	if (bridge != null)
	{

		// get the light
		PHLight light = bridge.getResourceCache().getLights()
				.get(this.localId);

		// prepare the new lamp state
		PHLightState newLightState = new PHLightState();

		// update hue and saturation
		newLightState.setHue(colorHSB.getHue());
		newLightState.setSaturation(colorHSB.getSaturation());
		newLightState.setBrightness(colorHSB.getBrightness());

		// update the real device
		bridge.updateLightState(light, newLightState);

		// notify...

		// update the status
		this.updateStatus();

	}
}
 
开发者ID:dog-gateway,项目名称:hue-drivers,代码行数:35,代码来源:HueColorDimmableLightDriverInstance.java


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