Search in sources :

Example 1 with SelectiveAccessDescription

use of org.openmuc.jdlms.SelectiveAccessDescription in project open-smart-grid-platform by OSGP.

the class DlmsObjectConfigService method getAccessDescription.

private SelectiveAccessDescription getAccessDescription(final AddressRequest addressRequest, final List<DlmsCaptureObject> selectedObjects) {
    final DlmsObject object = addressRequest.getDlmsObject();
    final DateTime from = addressRequest.getFrom();
    final DateTime to = addressRequest.getTo();
    if (!(object instanceof DlmsProfile) || from == null || to == null) {
        return null;
    } else {
        final int accessSelector = 1;
        final DataObject selectedValues = this.getSelectedValues(addressRequest, selectedObjects);
        final DataObject accessParameter = this.dlmsHelper.getAccessSelectionTimeRangeParameter(from, to, selectedValues);
        return new SelectiveAccessDescription(accessSelector, accessParameter);
    }
}
Also used : DataObject(org.openmuc.jdlms.datatypes.DataObject) SelectiveAccessDescription(org.openmuc.jdlms.SelectiveAccessDescription) DlmsProfile(org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.dlmsobjectconfig.model.DlmsProfile) DlmsObject(org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.dlmsobjectconfig.model.DlmsObject) DateTime(org.joda.time.DateTime)

Example 2 with SelectiveAccessDescription

use of org.openmuc.jdlms.SelectiveAccessDescription in project open-smart-grid-platform by OSGP.

the class DlmsObjectConfigService method getAttributeAddressForProfile.

private AttributeAddressForProfile getAttributeAddressForProfile(final AddressRequest addressRequest) {
    final List<DlmsCaptureObject> selectedObjects = new ArrayList<>();
    final SelectiveAccessDescription access = this.getAccessDescription(addressRequest, selectedObjects);
    final DlmsObject dlmsObject = addressRequest.getDlmsObject();
    final ObisCode obisCode = this.replaceChannel(dlmsObject.getObisCodeAsString(), addressRequest.getChannel());
    return new AttributeAddressForProfile(new AttributeAddress(dlmsObject.getClassId(), obisCode, dlmsObject.getDefaultAttributeId(), access), selectedObjects);
}
Also used : SelectiveAccessDescription(org.openmuc.jdlms.SelectiveAccessDescription) ArrayList(java.util.ArrayList) AttributeAddress(org.openmuc.jdlms.AttributeAddress) ObisCode(org.openmuc.jdlms.ObisCode) DlmsObject(org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.dlmsobjectconfig.model.DlmsObject)

Example 3 with SelectiveAccessDescription

use of org.openmuc.jdlms.SelectiveAccessDescription in project open-smart-grid-platform by OSGP.

the class GetPeriodicMeterReadsCommandExecutorIntegrationTest method createSelectiveAccessDescriptionDsmr4Daily.

private SelectiveAccessDescription createSelectiveAccessDescriptionDsmr4Daily(final DataObject from, final DataObject to) {
    final DataObject selectedValues = DataObject.newArrayData(Arrays.asList(this.CLOCK, this.STATUS, this.ACTIVE_ENERGY_IMPORT_RATE_1, this.ACTIVE_ENERGY_IMPORT_RATE_2, this.ACTIVE_ENERGY_EXPORT_RATE_1, this.ACTIVE_ENERGY_EXPORT_RATE_2));
    final DataObject expectedAccessParam = DataObject.newStructureData(Arrays.asList(this.CLOCK, from, to, selectedValues));
    return new SelectiveAccessDescription(1, expectedAccessParam);
}
Also used : DataObject(org.openmuc.jdlms.datatypes.DataObject) SelectiveAccessDescription(org.openmuc.jdlms.SelectiveAccessDescription)

Example 4 with SelectiveAccessDescription

use of org.openmuc.jdlms.SelectiveAccessDescription in project open-smart-grid-platform by OSGP.

the class GetPeriodicMeterReadsGasCommandExecutorIntegrationTest method createSelectiveAccessDescriptionDsmr4Monthly.

private SelectiveAccessDescription createSelectiveAccessDescriptionDsmr4Monthly(final DataObject from, final DataObject to) {
    final DataObject selectedValues = DataObject.newArrayData(Arrays.asList(this.CLOCK, this.GAS_VALUE_DSMR4, this.GAS_CAPTURE_TIME_DSMR4));
    final DataObject expectedAccessParam = DataObject.newStructureData(Arrays.asList(this.CLOCK, from, to, selectedValues));
    return new SelectiveAccessDescription(1, expectedAccessParam);
}
Also used : DataObject(org.openmuc.jdlms.datatypes.DataObject) SelectiveAccessDescription(org.openmuc.jdlms.SelectiveAccessDescription)

Example 5 with SelectiveAccessDescription

use of org.openmuc.jdlms.SelectiveAccessDescription in project open-smart-grid-platform by OSGP.

the class GetPeriodicMeterReadsGasCommandExecutorIntegrationTest method createSelectiveAccessDescriptionSmr5.

private SelectiveAccessDescription createSelectiveAccessDescriptionSmr5(final DataObject from, final DataObject to) {
    final DataObject selectedValues = DataObject.newArrayData(Collections.emptyList());
    final DataObject expectedAccessParam = DataObject.newStructureData(Arrays.asList(this.CLOCK, from, to, selectedValues));
    return new SelectiveAccessDescription(1, expectedAccessParam);
}
Also used : DataObject(org.openmuc.jdlms.datatypes.DataObject) SelectiveAccessDescription(org.openmuc.jdlms.SelectiveAccessDescription)

Aggregations

SelectiveAccessDescription (org.openmuc.jdlms.SelectiveAccessDescription)17 DataObject (org.openmuc.jdlms.datatypes.DataObject)16 AttributeAddress (org.openmuc.jdlms.AttributeAddress)6 DlmsObject (org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.dlmsobjectconfig.model.DlmsObject)5 Test (org.junit.jupiter.api.Test)3 Medium (org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.dlmsobjectconfig.model.Medium)3 DateTime (org.joda.time.DateTime)2 ObisCode (org.openmuc.jdlms.ObisCode)2 DlmsProfile (org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.dlmsobjectconfig.model.DlmsProfile)2 ProtocolAdapterException (org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 List (java.util.List)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Assertions.assertThatExceptionOfType (org.assertj.core.api.Assertions.assertThatExceptionOfType)1 Fail.fail (org.assertj.core.api.Fail.fail)1