Search in sources :

Example 1 with GatewayDeviceNotSetForMbusDeviceException

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());
}
Also used : GatewayDeviceNotSetForMbusDeviceException(org.opensmartgridplatform.domain.smartmetering.exceptions.GatewayDeviceNotSetForMbusDeviceException) Device(org.opensmartgridplatform.domain.core.entities.Device) GMeterInfoDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GMeterInfoDto) SmartMeter(org.opensmartgridplatform.domain.core.entities.SmartMeter) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)

Example 2 with GatewayDeviceNotSetForMbusDeviceException

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());
}
Also used : GetMbusEncryptionKeyStatusRequestDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMbusEncryptionKeyStatusRequestDto) GatewayDeviceNotSetForMbusDeviceException(org.opensmartgridplatform.domain.smartmetering.exceptions.GatewayDeviceNotSetForMbusDeviceException) Device(org.opensmartgridplatform.domain.core.entities.Device) SmartMeter(org.opensmartgridplatform.domain.core.entities.SmartMeter) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)

Aggregations

Device (org.opensmartgridplatform.domain.core.entities.Device)2 SmartMeter (org.opensmartgridplatform.domain.core.entities.SmartMeter)2 GatewayDeviceNotSetForMbusDeviceException (org.opensmartgridplatform.domain.smartmetering.exceptions.GatewayDeviceNotSetForMbusDeviceException)2 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)2 GMeterInfoDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.GMeterInfoDto)1 GetMbusEncryptionKeyStatusRequestDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMbusEncryptionKeyStatusRequestDto)1