Search in sources :

Example 1 with ScheduleMessageTypeDto

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());
    }
}
Also used : ScheduleMessageTypeDto(org.opensmartgridplatform.dto.valueobjects.ScheduleMessageTypeDto) GetConfigurationDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse)

Example 2 with ScheduleMessageTypeDto

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);
}
Also used : ScheduleMessageTypeDto(org.opensmartgridplatform.dto.valueobjects.ScheduleMessageTypeDto) ScheduleMessageDataContainerDto(org.opensmartgridplatform.dto.valueobjects.ScheduleMessageDataContainerDto) SetScheduleDeviceRequest(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.requests.SetScheduleDeviceRequest)

Aggregations

ScheduleMessageTypeDto (org.opensmartgridplatform.dto.valueobjects.ScheduleMessageTypeDto)2 SetScheduleDeviceRequest (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.requests.SetScheduleDeviceRequest)1 GetConfigurationDeviceResponse (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse)1 ScheduleMessageDataContainerDto (org.opensmartgridplatform.dto.valueobjects.ScheduleMessageDataContainerDto)1