Search in sources :

Example 1 with ActualMeterReadsQueryDto

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

the class ActualMeterReadsRequestMessageProcessor method handleMessage.

@Override
protected Serializable handleMessage(final DlmsConnectionManager conn, final DlmsDevice device, final Serializable requestObject, final MessageMetadata messageMetadata) throws OsgpException {
    this.assertRequestObjectType(ActualMeterReadsQueryDto.class, requestObject);
    final ActualMeterReadsQueryDto actualMeterReadsRequest = (ActualMeterReadsQueryDto) requestObject;
    return this.monitoringService.requestActualMeterReads(conn, device, actualMeterReadsRequest, messageMetadata);
}
Also used : ActualMeterReadsQueryDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ActualMeterReadsQueryDto)

Example 2 with ActualMeterReadsQueryDto

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

the class MonitoringService method requestActualMeterReads.

public void requestActualMeterReads(final MessageMetadata messageMetadata, final ActualMeterReadsQuery actualMeterReadsQuery) throws FunctionalException {
    LOGGER.info("requestActualMeterReads for organisationIdentification: {} for deviceIdentification: {}", messageMetadata.getOrganisationIdentification(), messageMetadata.getDeviceIdentification());
    final SmartMeter smartMeter = this.domainHelperService.findSmartMeter(messageMetadata.getDeviceIdentification());
    if (actualMeterReadsQuery.isMbusDevice()) {
        if (smartMeter.getChannel() == null) {
            /*
         * For now, throw a FunctionalException. As soon as we can
         * communicate with some types of gas meters directly, and not
         * through an M-Bus port of an energy meter, this will have to
         * be changed.
         */
            throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.DOMAIN_SMART_METERING, new AssertionError("Meter for gas reads should have a channel configured."));
        }
        final Device gatewayDevice = smartMeter.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.VALIDATION_ERROR, ComponentType.DOMAIN_SMART_METERING, new AssertionError("Meter for gas reads should have an energy meter as gateway device."));
        }
        final ActualMeterReadsQueryDto requestDto = new ActualMeterReadsQueryDto(ChannelDto.fromNumber(smartMeter.getChannel()));
        this.osgpCoreRequestMessageSender.send(requestDto, messageMetadata.builder().withDeviceIdentification(gatewayDevice.getDeviceIdentification()).withIpAddress(gatewayDevice.getIpAddress()).withNetworkSegmentIds(gatewayDevice.getBtsId(), gatewayDevice.getCellId()).build());
    } else {
        this.osgpCoreRequestMessageSender.send(new ActualMeterReadsQueryDto(), messageMetadata.builder().withIpAddress(smartMeter.getIpAddress()).withNetworkSegmentIds(smartMeter.getBtsId(), smartMeter.getCellId()).build());
    }
}
Also used : Device(org.opensmartgridplatform.domain.core.entities.Device) ActualMeterReadsQueryDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ActualMeterReadsQueryDto) SmartMeter(org.opensmartgridplatform.domain.core.entities.SmartMeter) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)

Example 3 with ActualMeterReadsQueryDto

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

the class GetActualMeterReadsGasCommandExecutor method fromBundleRequestInput.

@Override
public ActualMeterReadsQueryDto fromBundleRequestInput(final ActionRequestDto bundleInput) throws ProtocolAdapterException {
    this.checkActionRequestType(bundleInput);
    final ActualMeterReadsDataGasDto actualMeterReadsDataGasDto = (ActualMeterReadsDataGasDto) bundleInput;
    return new ActualMeterReadsQueryDto(actualMeterReadsDataGasDto.getChannel());
}
Also used : ActualMeterReadsDataGasDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ActualMeterReadsDataGasDto) ActualMeterReadsQueryDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ActualMeterReadsQueryDto)

Aggregations

ActualMeterReadsQueryDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.ActualMeterReadsQueryDto)3 Device (org.opensmartgridplatform.domain.core.entities.Device)1 SmartMeter (org.opensmartgridplatform.domain.core.entities.SmartMeter)1 ActualMeterReadsDataGasDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.ActualMeterReadsDataGasDto)1 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)1