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