use of org.opensmartgridplatform.dto.valueobjects.ScheduleMessageTypeDto in project open-smart-grid-platform by OSGP.
the class PublicLightingSetScheduleRequestMessageProcessor method handleResponse.
private void handleResponse(final DeviceResponse deviceResponse, final SetScheduleDeviceRequest deviceRequest) {
final ScheduleMessageTypeDto scheduleMessageTypeDto = deviceRequest.getScheduleMessageDataContainer().getScheduleMessageType();
switch(scheduleMessageTypeDto) {
case RETRIEVE_CONFIGURATION:
final GetConfigurationDeviceResponse getConfigurationDeviceResponse = (GetConfigurationDeviceResponse) deviceResponse;
this.handleSetScheduleGetConfigurationResponse(deviceRequest, getConfigurationDeviceResponse);
break;
case SET_ASTRONOMICAL_OFFSETS:
this.handleSetScheduleAstronomicalOffsetsResponse(deviceRequest);
break;
case SET_REBOOT:
this.handleSetScheduleSetRebootResponse(deviceRequest);
break;
case SET_SCHEDULE:
default:
this.handleEmptyDeviceResponse(deviceResponse, this.responseMessageSender, deviceRequest.getDomain(), deviceRequest.getDomainVersion(), deviceRequest.getMessageType(), deviceRequest.getRetryCount());
}
}
use of org.opensmartgridplatform.dto.valueobjects.ScheduleMessageTypeDto in project open-smart-grid-platform by OSGP.
the class PublicLightingSetScheduleRequestMessageProcessor method handleSetScheduleGetConfigurationResponse.
private void handleSetScheduleGetConfigurationResponse(final SetScheduleDeviceRequest deviceRequest, final GetConfigurationDeviceResponse deviceResponse) {
// Configuration is retrieved, so now continue with setting the
// astronomical offsets
LOGGER.info(LOG_MESSAGE_CALL_DEVICE_SERVICE, deviceRequest.getMessageType(), ScheduleMessageTypeDto.SET_ASTRONOMICAL_OFFSETS, deviceRequest.getDomain(), deviceRequest.getDomainVersion());
final ScheduleMessageTypeDto nextRequest = this.determineNextRequest(deviceRequest, deviceResponse);
LOGGER.info("Request after getConfiguration: {}", nextRequest);
final ScheduleMessageDataContainerDto dataContainer = new ScheduleMessageDataContainerDto.Builder(deviceRequest.getScheduleMessageDataContainer().getSchedule()).withConfiguration(deviceResponse.getConfiguration()).withScheduleMessageType(nextRequest).build();
final SetScheduleDeviceRequest newDeviceRequest = new SetScheduleDeviceRequest(createDeviceRequestBuilder(deviceRequest), dataContainer, RelayTypeDto.LIGHT);
this.deviceService.setSchedule(newDeviceRequest);
}
Aggregations