Search in sources :

Example 1 with EncryptionKeyStatusTypeDto

use of org.opensmartgridplatform.dto.valueobjects.smartmetering.EncryptionKeyStatusTypeDto in project open-smart-grid-platform by OSGP.

the class GetMbusEncryptionKeyStatusByChannelCommandExecutor method execute.

@Override
public GetMbusEncryptionKeyStatusByChannelResponseDto execute(final DlmsConnectionManager conn, final DlmsDevice device, final GetMbusEncryptionKeyStatusByChannelRequestDataDto request, final MessageMetadata messageMetadata) throws OsgpException {
    final GetMBusDeviceOnChannelRequestDataDto mbusDeviceOnChannelRequest = new GetMBusDeviceOnChannelRequestDataDto(device.getDeviceIdentification(), request.getChannel());
    final ChannelElementValuesDto channelElementValues = this.getMBusDeviceOnChannelCommandExecutor.execute(conn, device, mbusDeviceOnChannelRequest, messageMetadata);
    if (!channelElementValues.hasChannel() || !channelElementValues.hasDeviceTypeIdentification() || !channelElementValues.hasManufacturerIdentification()) {
        throw new FunctionalException(FunctionalExceptionType.NO_DEVICE_FOUND_ON_CHANNEL, ComponentType.DOMAIN_SMART_METERING);
    }
    final EncryptionKeyStatusTypeDto encryptionKeyStatusType = this.getMbusEncryptionKeyStatusCommandExecutor.getEncryptionKeyStatusTypeDto(request.getChannel(), conn);
    return new GetMbusEncryptionKeyStatusByChannelResponseDto(device.getDeviceIdentification(), encryptionKeyStatusType, request.getChannel());
}
Also used : ChannelElementValuesDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ChannelElementValuesDto) EncryptionKeyStatusTypeDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.EncryptionKeyStatusTypeDto) GetMbusEncryptionKeyStatusByChannelResponseDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMbusEncryptionKeyStatusByChannelResponseDto) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException) GetMBusDeviceOnChannelRequestDataDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMBusDeviceOnChannelRequestDataDto)

Aggregations

ChannelElementValuesDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.ChannelElementValuesDto)1 EncryptionKeyStatusTypeDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.EncryptionKeyStatusTypeDto)1 GetMBusDeviceOnChannelRequestDataDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMBusDeviceOnChannelRequestDataDto)1 GetMbusEncryptionKeyStatusByChannelResponseDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMbusEncryptionKeyStatusByChannelResponseDto)1 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)1