Search in sources :

Example 6 with SetScheduleDeviceRequest

use of org.opensmartgridplatform.adapter.protocol.oslp.elster.device.requests.SetScheduleDeviceRequest in project open-smart-grid-platform by OSGP.

the class TariffSwitchingSetScheduleRequestMessageProcessor method processMessage.

@Override
public void processMessage(final ObjectMessage message) {
    LOGGER.debug("Processing tariff switching set schedule request message");
    MessageMetadata messageMetadata;
    ScheduleDto schedule;
    try {
        messageMetadata = MessageMetadata.fromMessage(message);
        schedule = (ScheduleDto) message.getObject();
    } catch (final JMSException e) {
        LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
        return;
    }
    try {
        final ScheduleMessageDataContainerDto scheduleMessageDataContainer = new ScheduleMessageDataContainerDto.Builder(schedule).build();
        this.printDomainInfo(messageMetadata.getMessageType(), messageMetadata.getDomain(), messageMetadata.getDomainVersion());
        final SetScheduleDeviceRequest deviceRequest = new SetScheduleDeviceRequest(DeviceRequest.newBuilder().messageMetaData(messageMetadata), scheduleMessageDataContainer, RelayTypeDto.TARIFF);
        this.deviceService.setSchedule(deviceRequest);
    } catch (final RuntimeException e) {
        this.handleError(e, messageMetadata);
    }
}
Also used : MessageMetadata(org.opensmartgridplatform.shared.infra.jms.MessageMetadata) ScheduleMessageDataContainerDto(org.opensmartgridplatform.dto.valueobjects.ScheduleMessageDataContainerDto) SetScheduleDeviceRequest(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.requests.SetScheduleDeviceRequest) JMSException(javax.jms.JMSException) ScheduleDto(org.opensmartgridplatform.dto.valueobjects.ScheduleDto)

Example 7 with SetScheduleDeviceRequest

use of org.opensmartgridplatform.adapter.protocol.oslp.elster.device.requests.SetScheduleDeviceRequest in project open-smart-grid-platform by OSGP.

the class PublicLightingSetScheduleRequestMessageProcessor method handleSetScheduleAstronomicalOffsetsResponse.

private void handleSetScheduleAstronomicalOffsetsResponse(final SetScheduleDeviceRequest deviceRequest) {
    // Configuration / Astronomical offsets are set , so now continue with
    // rebooting the device
    LOGGER.info(LOG_MESSAGE_CALL_DEVICE_SERVICE, deviceRequest.getMessageType(), ScheduleMessageTypeDto.SET_ASTRONOMICAL_OFFSETS, deviceRequest.getDomain(), deviceRequest.getDomainVersion());
    final ScheduleMessageDataContainerDto dataContainer = new ScheduleMessageDataContainerDto.Builder(deviceRequest.getScheduleMessageDataContainer().getSchedule()).withScheduleMessageType(ScheduleMessageTypeDto.SET_REBOOT).build();
    final SetScheduleDeviceRequest newDeviceRequest = new SetScheduleDeviceRequest(createDeviceRequestBuilder(deviceRequest), dataContainer, RelayTypeDto.LIGHT);
    this.deviceService.setSchedule(newDeviceRequest);
}
Also used : ScheduleMessageDataContainerDto(org.opensmartgridplatform.dto.valueobjects.ScheduleMessageDataContainerDto) SetScheduleDeviceRequest(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.requests.SetScheduleDeviceRequest)

Aggregations

SetScheduleDeviceRequest (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.requests.SetScheduleDeviceRequest)7 ScheduleMessageDataContainerDto (org.opensmartgridplatform.dto.valueobjects.ScheduleMessageDataContainerDto)7 DeviceRequest (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceRequest)3 MessageMetadata (org.opensmartgridplatform.shared.infra.jms.MessageMetadata)3 IOException (java.io.IOException)2 JMSException (javax.jms.JMSException)2 DeviceResponse (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceResponse)2 DeviceResponseHandler (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceResponseHandler)2 PendingSetScheduleRequest (org.opensmartgridplatform.adapter.protocol.oslp.elster.domain.entities.PendingSetScheduleRequest)2 ScheduleDto (org.opensmartgridplatform.dto.valueobjects.ScheduleDto)2 OslpEnvelope (org.opensmartgridplatform.oslp.OslpEnvelope)2 UnsignedOslpEnvelopeDto (org.opensmartgridplatform.oslp.UnsignedOslpEnvelopeDto)2 GetConfigurationDeviceResponse (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse)1 ScheduleMessageTypeDto (org.opensmartgridplatform.dto.valueobjects.ScheduleMessageTypeDto)1 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)1 TechnicalException (org.opensmartgridplatform.shared.exceptionhandling.TechnicalException)1