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());
}
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());
}
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());
}
Aggregations