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