use of org.opensmartgridplatform.domain.smartmetering.exceptions.GatewayDeviceNotSetForMbusDeviceException in project open-smart-grid-platform by OSGP.
the class ConfigurationService method setEncryptionKeyExchangeOnGMeter.
public void setEncryptionKeyExchangeOnGMeter(final MessageMetadata messageMetadata) throws FunctionalException {
log.info("set Encryption Key Exchange On G-Meter for organisationIdentification: {} for deviceIdentification: " + "{}", messageMetadata.getOrganisationIdentification(), messageMetadata.getDeviceIdentification());
final SmartMeter gasDevice = this.domainHelperService.findSmartMeter(messageMetadata.getDeviceIdentification());
final Device gatewayDevice = gasDevice.getGatewayDevice();
if (gatewayDevice == null) {
/*
* For now throw a FunctionalException, based on the same reasoning
* as with the channel a couple of lines up. As soon as we have
* scenario's with direct communication with gas meters this will
* have to be changed.
*/
throw new FunctionalException(FunctionalExceptionType.GATEWAY_DEVICE_NOT_SET_FOR_MBUS_DEVICE, ComponentType.DOMAIN_SMART_METERING, new GatewayDeviceNotSetForMbusDeviceException());
}
final GMeterInfoDto requestDto = new GMeterInfoDto(gasDevice.getChannel(), gasDevice.getDeviceIdentification());
this.osgpCoreRequestMessageSender.send(requestDto, messageMetadata.builder().withDeviceIdentification(gatewayDevice.getDeviceIdentification()).withIpAddress(gatewayDevice.getIpAddress()).withNetworkSegmentIds(gatewayDevice.getBtsId(), gatewayDevice.getCellId()).build());
}
use of org.opensmartgridplatform.domain.smartmetering.exceptions.GatewayDeviceNotSetForMbusDeviceException in project open-smart-grid-platform by OSGP.
the class ConfigurationService method getMbusEncryptionKeyStatus.
public void getMbusEncryptionKeyStatus(final MessageMetadata messageMetadata) throws FunctionalException {
log.info("getMbusEncryptionKeyStatus for organisationIdentification: {} for deviceIdentification: {}", messageMetadata.getOrganisationIdentification(), messageMetadata.getDeviceIdentification());
final SmartMeter mbusDevice = this.domainHelperService.findSmartMeter(messageMetadata.getDeviceIdentification());
final Device gatewayDevice = mbusDevice.getGatewayDevice();
if (gatewayDevice == null) {
throw new FunctionalException(FunctionalExceptionType.GATEWAY_DEVICE_NOT_SET_FOR_MBUS_DEVICE, ComponentType.DOMAIN_SMART_METERING, new GatewayDeviceNotSetForMbusDeviceException());
}
final GetMbusEncryptionKeyStatusRequestDto requestDto = new GetMbusEncryptionKeyStatusRequestDto(mbusDevice.getDeviceIdentification(), mbusDevice.getChannel());
this.osgpCoreRequestMessageSender.send(requestDto, messageMetadata.builder().withDeviceIdentification(gatewayDevice.getDeviceIdentification()).withIpAddress(gatewayDevice.getIpAddress()).withNetworkSegmentIds(gatewayDevice.getBtsId(), gatewayDevice.getCellId()).build());
}
Aggregations