Search in sources :

Example 1 with DeviceMessageStatus

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

the class OslpDeviceService method handleOslpResponseSetTransition.

private void handleOslpResponseSetTransition(final DeviceRequest deviceRequest, final OslpEnvelope oslpResponse, final DeviceResponseHandler deviceResponseHandler) {
    this.saveOslpResponseLogEntry(deviceRequest, oslpResponse);
    this.updateSequenceNumber(deviceRequest.getDeviceIdentification(), oslpResponse);
    final DeviceMessageStatus status;
    if (oslpResponse.getPayloadMessage().hasSetTransitionResponse()) {
        final Oslp.Status oslpStatus = oslpResponse.getPayloadMessage().getSetTransitionResponse().getStatus();
        status = this.mapper.map(oslpStatus, DeviceMessageStatus.class);
    } else {
        status = DeviceMessageStatus.FAILURE;
    }
    final DeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), deviceRequest.getMessagePriority(), status);
    deviceResponseHandler.handleResponse(deviceResponse);
}
Also used : DeviceMessageStatus(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceMessageStatus) EmptyDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse) DeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceResponse) GetConfigurationDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse) GetStatusDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetStatusDeviceResponse) GetFirmwareVersionDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetFirmwareVersionDeviceResponse) Oslp(org.opensmartgridplatform.oslp.Oslp) EmptyDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse)

Example 2 with DeviceMessageStatus

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

the class OslpDeviceService method buildDeviceResponseGetConfiguration.

private DeviceResponse buildDeviceResponseGetConfiguration(final DeviceRequest deviceRequest, final OslpEnvelope oslpResponse) {
    ConfigurationDto configuration = null;
    final DeviceMessageStatus status;
    if (oslpResponse.getPayloadMessage().hasGetConfigurationResponse()) {
        final Oslp.GetConfigurationResponse getConfigurationResponse = oslpResponse.getPayloadMessage().getGetConfigurationResponse();
        configuration = this.mapper.map(getConfigurationResponse, ConfigurationDto.class);
        status = this.mapper.map(getConfigurationResponse.getStatus(), DeviceMessageStatus.class);
    } else {
        status = DeviceMessageStatus.FAILURE;
    }
    return new GetConfigurationDeviceResponse(deviceRequest, status, configuration);
}
Also used : DeviceMessageStatus(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceMessageStatus) ConfigurationDto(org.opensmartgridplatform.dto.valueobjects.ConfigurationDto) GetConfigurationDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse) Oslp(org.opensmartgridplatform.oslp.Oslp)

Example 3 with DeviceMessageStatus

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

the class OslpDeviceService method handleOslpResponseSetSchedulePaged.

private void handleOslpResponseSetSchedulePaged(final SetScheduleDeviceRequest deviceRequest, final OslpEnvelope oslpResponse, final String domain, final String domainVersion, final String messageType, final int retryCount, final boolean isScheduled, final Pager pager, final DeviceResponseHandler deviceResponseHandler) {
    this.saveOslpResponseLogEntry(deviceRequest, oslpResponse);
    this.updateSequenceNumber(deviceRequest.getDeviceIdentification(), oslpResponse);
    // Get response status
    final DeviceMessageStatus status;
    if (oslpResponse.getPayloadMessage().hasSetScheduleResponse()) {
        final Oslp.Status oslpStatus = oslpResponse.getPayloadMessage().getSetScheduleResponse().getStatus();
        status = this.mapper.map(oslpStatus, DeviceMessageStatus.class);
    } else {
        status = DeviceMessageStatus.FAILURE;
    }
    if (pager.isLastPage() || status != DeviceMessageStatus.OK) {
        // Stop processing pages and handle device response.
        this.updateSequenceNumber(deviceRequest.getDeviceIdentification(), oslpResponse);
        final DeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), deviceRequest.getMessagePriority(), status);
        deviceResponseHandler.handleResponse(deviceResponse);
    } else {
        // Process next page
        pager.nextPage();
        this.processOslpRequestSetSchedulePaged(deviceRequest, pager);
    }
}
Also used : DeviceMessageStatus(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceMessageStatus) EmptyDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse) DeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceResponse) GetConfigurationDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse) GetStatusDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetStatusDeviceResponse) GetFirmwareVersionDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetFirmwareVersionDeviceResponse) Oslp(org.opensmartgridplatform.oslp.Oslp) EmptyDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse)

Example 4 with DeviceMessageStatus

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

the class OslpDeviceService method handleOslpResponseUpdateFirmware.

private void handleOslpResponseUpdateFirmware(final DeviceRequest deviceRequest, final OslpEnvelope oslpResponse, final DeviceResponseHandler deviceResponseHandler) {
    this.saveOslpResponseLogEntry(deviceRequest, oslpResponse);
    this.updateSequenceNumber(deviceRequest.getDeviceIdentification(), oslpResponse);
    final DeviceMessageStatus status;
    if (oslpResponse.getPayloadMessage().hasUpdateFirmwareResponse()) {
        final Oslp.Status oslpStatus = oslpResponse.getPayloadMessage().getUpdateFirmwareResponse().getStatus();
        status = this.mapper.map(oslpStatus, DeviceMessageStatus.class);
    } else {
        status = DeviceMessageStatus.FAILURE;
    }
    final DeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), deviceRequest.getMessagePriority(), status);
    deviceResponseHandler.handleResponse(deviceResponse);
}
Also used : DeviceMessageStatus(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceMessageStatus) EmptyDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse) DeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceResponse) GetConfigurationDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse) GetStatusDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetStatusDeviceResponse) GetFirmwareVersionDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetFirmwareVersionDeviceResponse) Oslp(org.opensmartgridplatform.oslp.Oslp) EmptyDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse)

Example 5 with DeviceMessageStatus

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

the class OslpDeviceService method buildDeviceResponseUpdateDeviceSslCertification.

private DeviceResponse buildDeviceResponseUpdateDeviceSslCertification(final DeviceRequest deviceRequest, final OslpEnvelope oslpResponse) {
    final DeviceMessageStatus status;
    if (oslpResponse.getPayloadMessage().hasUpdateDeviceSslCertificationResponse()) {
        final Oslp.UpdateDeviceSslCertificationResponse updateDeviceSslCertificationResponse = oslpResponse.getPayloadMessage().getUpdateDeviceSslCertificationResponse();
        status = this.mapper.map(updateDeviceSslCertificationResponse.getStatus(), DeviceMessageStatus.class);
    } else {
        status = DeviceMessageStatus.FAILURE;
    }
    return new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), deviceRequest.getMessagePriority(), status);
}
Also used : DeviceMessageStatus(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceMessageStatus) Oslp(org.opensmartgridplatform.oslp.Oslp) EmptyDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse)

Aggregations

DeviceMessageStatus (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceMessageStatus)18 Oslp (org.opensmartgridplatform.oslp.Oslp)18 EmptyDeviceResponse (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse)17 GetConfigurationDeviceResponse (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse)14 DeviceResponse (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceResponse)13 GetFirmwareVersionDeviceResponse (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetFirmwareVersionDeviceResponse)13 GetStatusDeviceResponse (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetStatusDeviceResponse)13 ConfigurationDto (org.opensmartgridplatform.dto.valueobjects.ConfigurationDto)1