本文整理汇总了Java中com.philips.lighting.model.PHLight类的典型用法代码示例。如果您正苦于以下问题:Java PHLight类的具体用法?Java PHLight怎么用?Java PHLight使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PHLight类属于com.philips.lighting.model包,在下文中一共展示了PHLight类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: turnOn
import com.philips.lighting.model.PHLight; //导入依赖的package包/类
void turnOn() {
PHBridge bridge = hueSDK.getSelectedBridge();
for (PHLight light : allLights) {
PHLightState lightState = new PHLightState();
lightState.setOn(true);
if (light.getModelNumber().equals("LWB014")) {
lightState.setBrightness(50);
} else {
float[] xy = PHUtilities.calculateXYFromRGB(255, 255, 255, light.getModelNumber());
lightState.setX(xy[0]);
lightState.setY(xy[1]);
lightState.setBrightness(50);
}
bridge.updateLightState(light, lightState, lightListener);
}
}
开发者ID:tkrworks,项目名称:JinsMemeBRIDGE-Android,代码行数:21,代码来源:HueController.java
示例2: turnOff
import com.philips.lighting.model.PHLight; //导入依赖的package包/类
void turnOff() {
Log.d("HUE", "turn off...");
PHLightState lightState = new PHLightState();
lightState.setOn(false);
if (allLights != null) {
for (PHLight light : allLights) {
PHBridge bridge = hueSDK.getSelectedBridge();
if (light != null) {
bridge.updateLightState(light, lightState, lightListener);
}
}
}
}
开发者ID:tkrworks,项目名称:JinsMemeBRIDGE-Android,代码行数:17,代码来源:HueController.java
示例3: changeColor
import com.philips.lighting.model.PHLight; //导入依赖的package包/类
void changeColor(int r, int g, int b, int pid) {
Log.d("HUE", "change light color...");
PHBridge bridge = hueSDK.getSelectedBridge();
for (PHLight light : allLights) {
PHLightState lightState = new PHLightState();
if (r > 0 || g > 0 || b > 0) {
lightState.setOn(true);
} else {
lightState.setOn(false);
}
float[] xy = PHUtilities.calculateXYFromRGB(r, g, b, light.getModelNumber());
if (!light.getModelNumber().equals("LWB014")) {
lightState.setX(xy[0]);
lightState.setY(xy[1]);
}
bridge.updateLightState(light, lightState, lightListener);
}
isTurnOn[pid] = b > 0;
}
开发者ID:tkrworks,项目名称:JinsMemeBRIDGE-Android,代码行数:27,代码来源:HueController.java
示例4: startColorTimer
import com.philips.lighting.model.PHLight; //导入依赖的package包/类
private void startColorTimer() {
stopColorTimer();
colorTimer = new Timer();
colorTimer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
if (currentColor > 3) {
currentColor = 0;
}
final int color = colors[currentColor];
++currentColor;
if (hueAdapter != null) {
List<PHLight> bulbs = hueAdapter.getAllBulbs();
if (bulbs != null) {
for (PHLight bulb : bulbs) {
if (config.bulbs.contains(bulb.getIdentifier())) {
hueAdapter.setPower(bulb, true);
hueAdapter.setColor(bulb, color);
}
}
}
}
}
}, 0, TIMER_COLOR_DELAY);
}
开发者ID:ConnectSDK,项目名称:SmartHomeSamplerAndroid,代码行数:26,代码来源:Scene.java
示例5: onCacheUpdated
import com.philips.lighting.model.PHLight; //导入依赖的package包/类
@Override
public void onCacheUpdated(int flag, PHBridge bridge)
{
// handle the bridge status update if needed...
// trigger device update...
List<PHLight> allLights = bridge.getResourceCache().getAllLights();
for (PHLight light : allLights)
{
// get the attached driver, if available
HueDriverInstance driverInstance = this.knownDevices.get(light
.getIdentifier());
// notify the driver
driverInstance.newMessageFromHouse(light.getLastKnownLightState());
}
}
开发者ID:dog-gateway,项目名称:hue-drivers,代码行数:20,代码来源:HueGatewayDriverInstance.java
示例6: listLamps
import com.philips.lighting.model.PHLight; //导入依赖的package包/类
private void listLamps(String... parameters){
StringBuilder sb=new StringBuilder();
for (PHLight light : bridge.getResourceCache().getAllLights()) {
StringBuilder deviceStr=new StringBuilder();
deviceStr.append(String.format("id = %s\n",light.getIdentifier()));
deviceStr.append(String.format("name = %s\n",light.getName()));
deviceStr.append(String.format("model = %s\n",light.getModelNumber()));
deviceStr.append(String.format("type = %s\n",light.getLightType()));
deviceStr.append(String.format("state = %s",light.getLastKnownLightState().isOn() ? "ON" : "OFF"));
sb.append(FuchsiaGogoUtil.createASCIIBox(light.getIdentifier(), deviceStr));
}
print(sb.toString());
}
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:17,代码来源:PhilipsHueGogoCommand.java
示例7: create
import com.philips.lighting.model.PHLight; //导入依赖的package包/类
public static PhilipsHueLightDeclarationWrapper create(ImportDeclaration importDeclaration) throws BinderException {
Map<String, Object> metadata = importDeclaration.getMetadata();
if (!declarationFilter.matches(metadata)) {
throw new BinderException("Not enough information in the metadata to be used by the phillips hue importer");
}
PhilipsHueLightDeclarationWrapper wrapper = new PhilipsHueLightDeclarationWrapper();
wrapper.id = (String) metadata.get(ID);
wrapper.name = (String) metadata.get(DISCOVERY_PHILIPS_DEVICE_NAME);
wrapper.type = (String) metadata.get(DISCOVERY_PHILIPS_DEVICE_TYPE);
wrapper.light = (PHLight) metadata.get(DISCOVERY_PHILIPS_DEVICE_OBJECT);
wrapper.bridge = (PHBridge) metadata.get(DISCOVERY_PHILIPS_DEVICE_BRIDGE);
return wrapper;
}
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:17,代码来源:PhilipsHueLightDeclarationWrapper.java
示例8: rightExceptionHasBeenThrownInAbsenceOfProperty
import com.philips.lighting.model.PHLight; //导入依赖的package包/类
@Test
public void rightExceptionHasBeenThrownInAbsenceOfProperty() {
PhilipsHueImporter importer = spy(new PhilipsHueImporter(context));
ServiceReference serviceReference = mock(ServiceReference.class);
PHLight light = mock(PHLight.class);
PHBridge bridge = mock(PHBridge.class);
HashMap<String, Object> metadata = new HashMap<String, Object>();
metadata.put("id", light.getIdentifier());
ImportDeclaration declaration = ImportDeclarationBuilder.fromMetadata(metadata).build();
importer.registration(serviceReference);
try {
importer.useDeclaration(declaration);
Assert.fail("An exception " + BinderException.class.getSimpleName() + " should have been thrown.");
} catch (BinderException be) {
//If this exception was reached, everything is OK
}
}
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:20,代码来源:PhilipsHueImporterTest.java
示例9: showRandomColorsOnAllLamps
import com.philips.lighting.model.PHLight; //导入依赖的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
示例10: updateLamp
import com.philips.lighting.model.PHLight; //导入依赖的package包/类
@Async
@Override
public void updateLamp(LampWithHueUniqueId lamp, ScenarioConfigDTO config) {
if(config != null) {
for (PHBridge bridge : bridges) {
PHBridgeResourcesCache resourceCache = bridge.getResourceCache();
List<PHLight> allLights = resourceCache.getAllLights();
String url = "http://" + bridge.getResourceCache().getBridgeConfiguration().getIpAddress() + "/api/"
+ bridge.getResourceCache().getBridgeConfiguration().getUsername() + "/lights";
bridge.doHTTPGet(url, new PHHTTPListener() {
@Override
public void onHTTPResponse(String jsonResponse) {
JSONObject object = new JSONObject(jsonResponse);
for (PHLight light : allLights) {
light.setUniqueId(object.optJSONObject(light.getIdentifier()).optString("uniqueid"));
if (light.getUniqueId().equals(lamp.getHueUniqueId())) {
updateLamp(bridge, light, config);
}
}
}
});
}
}
}
开发者ID:adessoAG,项目名称:JenkinsHue,代码行数:28,代码来源:HueServiceImpl.java
示例11: setBrightness
import com.philips.lighting.model.PHLight; //导入依赖的package包/类
public void setBrightness(String name, int brightness) throws IOException
{
PHLight light = this.lights.get(name);
if (light == null)
throw new IOException("No such light: " + name);
PHLightState lightState = new PHLightState();
lightState.setOn(brightness > 0);
lightState.setBrightness(brightness, true);
this.activeBridge.updateLightState(light, lightState);
}
开发者ID:PolyphasicDevTeam,项目名称:NoMoreOversleeps,代码行数:11,代码来源:IntegrationPhilipsHue.java
示例12: onBridgeConnected
import com.philips.lighting.model.PHLight; //导入依赖的package包/类
@Override
public void onBridgeConnected(PHBridge phBridge, String s) {
Log.d("HUE", "Bridge Connected...");
hueSDK.setSelectedBridge(phBridge);
hueSDK.enableHeartbeat(phBridge, PHHueSDK.HB_INTERVAL);
hueSDK.getLastHeartbeat()
.put(phBridge.getResourceCache().getBridgeConfiguration().getIpAddress(),
System.currentTimeMillis());
setLastConnectIp(phBridge.getResourceCache().getBridgeConfiguration().getIpAddress());
setUsername(s);
allLights = phBridge.getResourceCache().getAllLights();
for (PHLight light : allLights) {
PHLightState lightState = light.getLastKnownLightState();
Log.d("HUE",
"id = " + light.getIdentifier() + " " + light.getModelNumber() + " " + light.getUniqueId()
+ " " + lightState.getBrightness() + " " + lightState.getSaturation());
Log.d("HUE", "type = " + light.getLightType().name() + " " + light.getLightType().ordinal());
}
closeProgressDialog();
turnOn();
}
开发者ID:tkrworks,项目名称:JinsMemeBRIDGE-Android,代码行数:29,代码来源:HueController.java
示例13: stop
import com.philips.lighting.model.PHLight; //导入依赖的package包/类
synchronized void stop(boolean disableBluetooth) {
mState = SceneState.Stop;
if (disableBluetooth) {
listener.onRequestBluetoothStop();
}
stopColorTimer();
stopTimeTracking();
stopWakeUpTimer();
if (server != null) {
server.stop();
}
if (mediaSession != null) {
mediaSession.close(null);
mediaSession = null;
}
weMoAdapter.enableDevices(WeMoDevice.WEMO_DEVICE_OFF);
enableWinkDevices(false);
if (hueAdapter != null) {
List<PHLight> bulbs = hueAdapter.getAllBulbs();
if (bulbs != null) {
for (PHLight bulb : bulbs) {
if (config.bulbs.contains(bulb.getIdentifier())) {
hueAdapter.setPower(bulb, false);
}
}
}
hueAdapter.stopDiscovery();
}
}
开发者ID:ConnectSDK,项目名称:SmartHomeSamplerAndroid,代码行数:34,代码来源:Scene.java
示例14: startSmoothTimer
import com.philips.lighting.model.PHLight; //导入依赖的package包/类
private void startSmoothTimer(final int start, final int end, final boolean greater, final int increment) {
brightness = start;
stopSmoothTimer();
enableLights(true);
smoothTimer = new Timer();
smoothTimer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
listener.onRequestBluetoothStop();
// Philips bulbs
if (hueAdapter != null) {
List<PHLight> bulbs = hueAdapter.getAllBulbs();
if (bulbs != null) {
for (PHLight bulb : bulbs) {
if (config.bulbs.contains(bulb.getIdentifier())) {
hueAdapter.setBrightness(bulb, brightness);
}
}
}
brightness += increment;
if (greater) {
if (brightness >= end) {
stopSmoothTimer();
enableWinkDevices(true);
}
} else {
if (brightness <= end) {
stopSmoothTimer();
enableWinkDevices(false);
enableLights(false);
}
}
}
}
}, 0, 400);
}
开发者ID:ConnectSDK,项目名称:SmartHomeSamplerAndroid,代码行数:38,代码来源:Scene.java
示例15: enableLights
import com.philips.lighting.model.PHLight; //导入依赖的package包/类
private void enableLights(final boolean enable) {
if (hueAdapter != null) {
List<PHLight> bulbs = hueAdapter.getAllBulbs();
if (bulbs != null) {
for (PHLight bulb : bulbs) {
if (config.bulbs.contains(bulb.getIdentifier())) {
hueAdapter.setPower(bulb, enable);
hueAdapter.setColor(bulb, Color.WHITE);
}
}
}
}
}
开发者ID:ConnectSDK,项目名称:SmartHomeSamplerAndroid,代码行数:14,代码来源:Scene.java
示例16: setColor
import com.philips.lighting.model.PHLight; //导入依赖的package包/类
public boolean setColor(PHLight light, int color) {
if (bridge == null) {
return false;
}
float[] xy = PHUtilities.calculateXYFromRGB(Color.red(color), Color.green(color), Color.blue(color), light.getModelNumber());
PHLightState state = new PHLightState();
state.setX(xy[0]);
state.setY(xy[1]);
state.setEffectMode(PHLight.PHLightEffectMode.EFFECT_NONE);
state.setAlertMode(PHLight.PHLightAlertMode.ALERT_NONE);
bridge.updateLightState(light, state);
return true;
}
开发者ID:ConnectSDK,项目名称:SmartHomeSamplerAndroid,代码行数:15,代码来源:HueAdapter.java
示例17: setBrightness
import com.philips.lighting.model.PHLight; //导入依赖的package包/类
public boolean setBrightness(PHLight light, int brightness) {
if (bridge == null) {
return false;
}
PHLightState state = new PHLightState();
state.setBrightness(brightness);
state.setEffectMode(PHLight.PHLightEffectMode.EFFECT_NONE);
state.setAlertMode(PHLight.PHLightAlertMode.ALERT_NONE);
bridge.updateLightState(light, state);
return true;
}
开发者ID:ConnectSDK,项目名称:SmartHomeSamplerAndroid,代码行数:13,代码来源:HueAdapter.java
示例18: setPower
import com.philips.lighting.model.PHLight; //导入依赖的package包/类
public boolean setPower(PHLight light, boolean power) {
if (bridge == null) {
return false;
}
PHLightState state = new PHLightState();
state.setOn(power);
state.setEffectMode(PHLight.PHLightEffectMode.EFFECT_NONE);
state.setAlertMode(PHLight.PHLightAlertMode.ALERT_NONE);
bridge.updateLightState(light, state);
return true;
}
开发者ID:ConnectSDK,项目名称:SmartHomeSamplerAndroid,代码行数:13,代码来源:HueAdapter.java
示例19: findLight
import com.philips.lighting.model.PHLight; //导入依赖的package包/类
/**
* Hueに接続されているライトを検索する.
* <p>
* ライトが見つからない場合には<code>null</code>を返却する。
* </p>
*
* @param bridge Hueのブリッジ
* @param lightId ライトID
* @return Hueのブリッジに接続されたライト
*/
private PHLight findLight(final PHBridge bridge, final String lightId) {
Map<String, PHLight> lights = bridge.getResourceCache().getLights();
if (lights.size() == 0) {
return null;
}
if (lightId == null || lightId.length() == 0) {
return lights.entrySet().iterator().next().getValue();
} else {
return bridge.getResourceCache().getLights().get(lightId);
}
}
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:23,代码来源:HueLightProfile.java
示例20: getView
import com.philips.lighting.model.PHLight; //导入依赖的package包/类
@SuppressLint("ViewHolder")
@Override
public View getView(final int position, final View convertView, final ViewGroup parent) {
View view = convertView;
if (view == null) {
view = mInflater.inflate(R.layout.hue_access_point, parent, false);
}
PHLight light = mLights.get(position);
TextView titleView = (TextView) view.findViewById(R.id.title);
titleView.setText(light.getName());
return view;
}
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:16,代码来源:HueFragment04.java
注:本文中的com.philips.lighting.model.PHLight类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论