Search in sources :

Example 1 with GetMBusDeviceOnChannelRequestDataDto

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

the class SetDeviceLifecycleStatusByChannelCommandExecutor method execute.

@Override
public SetDeviceLifecycleStatusByChannelResponseDto execute(final DlmsConnectionManager conn, final DlmsDevice gatewayDevice, final SetDeviceLifecycleStatusByChannelRequestDataDto request, final MessageMetadata messageMetadata) throws OsgpException {
    final GetMBusDeviceOnChannelRequestDataDto mbusDeviceOnChannelRequest = new GetMBusDeviceOnChannelRequestDataDto(gatewayDevice.getDeviceIdentification(), request.getChannel());
    final ChannelElementValuesDto channelElementValues = this.getMBusDeviceOnChannelCommandExecutor.execute(conn, gatewayDevice, mbusDeviceOnChannelRequest, messageMetadata);
    if (!channelElementValues.hasChannel() || !channelElementValues.hasDeviceTypeIdentification() || !channelElementValues.hasManufacturerIdentification()) {
        throw new FunctionalException(FunctionalExceptionType.NO_DEVICE_FOUND_ON_CHANNEL, ComponentType.PROTOCOL_DLMS);
    }
    final DlmsDevice mbusDevice = this.dlmsDeviceRepository.findByMbusIdentificationNumberAndMbusManufacturerIdentification(channelElementValues.getIdentificationNumber(), channelElementValues.getManufacturerIdentification());
    if (mbusDevice == null) {
        throw new FunctionalException(FunctionalExceptionType.NO_MATCHING_MBUS_DEVICE_FOUND, ComponentType.PROTOCOL_DLMS);
    }
    return new SetDeviceLifecycleStatusByChannelResponseDto(gatewayDevice.getDeviceIdentification(), request.getChannel(), mbusDevice.getDeviceIdentification(), request.getDeviceLifecycleStatus());
}
Also used : ChannelElementValuesDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ChannelElementValuesDto) SetDeviceLifecycleStatusByChannelResponseDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.SetDeviceLifecycleStatusByChannelResponseDto) DlmsDevice(org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException) GetMBusDeviceOnChannelRequestDataDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMBusDeviceOnChannelRequestDataDto)

Example 2 with GetMBusDeviceOnChannelRequestDataDto

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

the class ConfigurationService method getMbusKeyExchangeData.

public GMeterInfoDto getMbusKeyExchangeData(final DlmsConnectionManager conn, final DlmsDevice device, final SetMbusUserKeyByChannelRequestDataDto setMbusUserKeyByChannelRequestData, final MessageMetadata messageMetadata) throws OsgpException {
    final GetMBusDeviceOnChannelRequestDataDto mbusDeviceOnChannelRequest = new GetMBusDeviceOnChannelRequestDataDto(device.getDeviceIdentification(), setMbusUserKeyByChannelRequestData.getChannel());
    final ChannelElementValuesDto channelElementValues = this.getMBusDeviceOnChannelCommandExecutor.execute(conn, device, mbusDeviceOnChannelRequest, messageMetadata);
    final DlmsDevice mbusDevice = this.domainHelperService.findMbusDevice(channelElementValues.getIdentificationNumber(), channelElementValues.getManufacturerIdentification());
    return new GMeterInfoDto(setMbusUserKeyByChannelRequestData.getChannel(), mbusDevice.getDeviceIdentification());
}
Also used : ChannelElementValuesDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ChannelElementValuesDto) GMeterInfoDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GMeterInfoDto) DlmsDevice(org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice) GetMBusDeviceOnChannelRequestDataDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMBusDeviceOnChannelRequestDataDto)

Example 3 with GetMBusDeviceOnChannelRequestDataDto

use of org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMBusDeviceOnChannelRequestDataDto 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)3 GetMBusDeviceOnChannelRequestDataDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMBusDeviceOnChannelRequestDataDto)3 DlmsDevice (org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice)2 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)2 EncryptionKeyStatusTypeDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.EncryptionKeyStatusTypeDto)1 GMeterInfoDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.GMeterInfoDto)1 GetMbusEncryptionKeyStatusByChannelResponseDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMbusEncryptionKeyStatusByChannelResponseDto)1 SetDeviceLifecycleStatusByChannelResponseDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.SetDeviceLifecycleStatusByChannelResponseDto)1