use of org.opensmartgridplatform.oslp.Oslp.LightValue in project open-smart-grid-platform by OSGP.
the class OslpChannelHandler method handleSetLightRequest.
private void handleSetLightRequest(final Device device, final SetLightRequest request) {
// Device simulator will only use first light value,
// other light values will be ignored
final LightValue lightValue = request.getValues(0);
device.setLightOn(lightValue.getOn());
if (lightValue.hasDimValue()) {
final int dimValue = lightValue.getDimValue().byteAt(0);
device.setDimValue(dimValue);
} else {
device.setDimValue(null);
}
final Oslp.Event event = device.isLightOn() ? Oslp.Event.LIGHT_EVENTS_LIGHT_ON : Oslp.Event.LIGHT_EVENTS_LIGHT_OFF;
final String description = "setLightRequest [SET_LIGHT] SCHED[-]";
this.sendEvent(device, event, description);
}
Aggregations