use of org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.Device in project smarthome by eclipse.
the class DsAPIImpl method getApartmentDevices.
@Override
public List<Device> getApartmentDevices(String token) {
String response = transport.execute(SimpleRequestBuilder.buildNewJsonRequest(ClassKeys.APARTMENT).addFunction(FunctionKeys.GET_DEVICES).addParameter(ParameterKeys.TOKEN, token).buildRequestString());
JsonObject responseObj = JSONResponseHandler.toJsonObject(response);
if (JSONResponseHandler.checkResponse(responseObj) && responseObj.get(JSONApiResponseKeysEnum.RESULT.getKey()) instanceof JsonArray) {
JsonArray array = (JsonArray) responseObj.get(JSONApiResponseKeysEnum.RESULT.getKey());
List<Device> deviceList = new LinkedList<Device>();
for (int i = 0; i < array.size(); i++) {
if (array.get(i) instanceof JsonObject) {
deviceList.add(new DeviceImpl((JsonObject) array.get(i)));
}
}
return deviceList;
}
return new LinkedList<Device>();
}
use of org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.Device in project smarthome by eclipse.
the class InternalScene method activateScene.
/**
* Activates this Scene.
*/
public void activateScene() {
if (!active) {
this.active = true;
deviceHasChanged = false;
informListener();
if (this.devices != null) {
for (Device device : this.devices) {
device.callInternalScene(this);
}
}
}
}
use of org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.Device in project smarthome by eclipse.
the class InternalScene method deactivateScene.
/**
* Deactivates this Scene.
*/
public void deactivateScene() {
if (active) {
this.active = false;
deviceHasChanged = false;
informListener();
if (this.devices != null) {
for (Device device : this.devices) {
device.undoInternalScene(this);
}
}
}
}
Aggregations