use of org.openmuc.jdlms.SelectiveAccessDescription in project open-smart-grid-platform by OSGP.
the class DlmsObjectConfigServiceTest method testProfileWithOneMedium.
@Test
void testProfileWithOneMedium() {
// SETUP
final Integer channel = null;
final Medium filterMedium = Medium.ELECTRICITY;
final DataObject selectedValues = DataObject.newArrayData(Collections.emptyList());
final DataObject accessParams = this.getAccessParams(selectedValues);
final SelectiveAccessDescription access = new SelectiveAccessDescription(1, accessParams);
final AttributeAddress expectedAddress = new AttributeAddress(this.profileE.getClassId(), this.profileE.getObisCodeAsString(), this.profileE.getDefaultAttributeId(), access);
// CALL
final Optional<AttributeAddressForProfile> attributeAddressForProfile = this.service.findAttributeAddressForProfile(this.device422, DlmsObjectType.INTERVAL_VALUES, channel, this.from, this.to, filterMedium);
// VERIFY
assertThat(attributeAddressForProfile).isPresent();
AttributeAddressAssert.is(attributeAddressForProfile.get().getAttributeAddress(), expectedAddress);
assertThat(attributeAddressForProfile.get().getSelectedObjects()).isEqualTo(this.captureObjectsE);
}
use of org.openmuc.jdlms.SelectiveAccessDescription in project open-smart-grid-platform by OSGP.
the class DlmsObjectConfigServiceTest method testProfileWithMediumCombinedAndNoFilterMedium.
@Test
void testProfileWithMediumCombinedAndNoFilterMedium() {
// SETUP
final Integer channel = 1;
final Medium filterMedium = null;
final DataObject selectedValues = DataObject.newArrayData(Collections.emptyList());
final DataObject accessParams = this.getAccessParams(selectedValues);
final SelectiveAccessDescription access = new SelectiveAccessDescription(1, accessParams);
final AttributeAddress expectedAddress = new AttributeAddress(this.profileCombined.getClassId(), this.profileCombined.getObisCodeAsString(), this.profileCombined.getDefaultAttributeId(), access);
// CALL
final Optional<AttributeAddressForProfile> attributeAddressForProfile = this.service.findAttributeAddressForProfile(this.device422, DlmsObjectType.DAILY_LOAD_PROFILE, channel, this.from, this.to, filterMedium);
// VERIFY
assertThat(attributeAddressForProfile).isPresent();
AttributeAddressAssert.is(attributeAddressForProfile.get().getAttributeAddress(), expectedAddress);
assertThat(attributeAddressForProfile.get().getSelectedObjects()).isEqualTo(this.captureObjectsCombined);
}
use of org.openmuc.jdlms.SelectiveAccessDescription in project open-smart-grid-platform by OSGP.
the class GetPeriodicMeterReadsGasCommandExecutorIntegrationTest method createSelectiveAccessDescriptionDsmr4Interval.
private SelectiveAccessDescription createSelectiveAccessDescriptionDsmr4Interval(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);
}
use of org.openmuc.jdlms.SelectiveAccessDescription in project open-smart-grid-platform by OSGP.
the class FindEventsCommandExecutor method getSelectiveAccessDescription.
private SelectiveAccessDescription getSelectiveAccessDescription(final DlmsDevice device, final DateTime beginDateTime, final DateTime endDateTime) throws ProtocolAdapterException {
/*
* Define the clock object {8,0-0:1.0.0.255,2,0} to be used as
* restricting object in a range descriptor with a from value and to
* value to determine which elements from the buffered array should be
* retrieved.
*/
final DlmsObject clockObject = this.dlmsObjectConfigService.getDlmsObject(device, DlmsObjectType.CLOCK);
final DataObject clockDefinition = DataObject.newStructureData(Arrays.asList(DataObject.newUInteger16Data(clockObject.getClassId()), DataObject.newOctetStringData(clockObject.getObisCode().bytes()), DataObject.newInteger8Data((byte) clockObject.getDefaultAttributeId()), DataObject.newUInteger16Data(0)));
final DataObject fromValue = this.dlmsHelper.asDataObject(beginDateTime);
final DataObject toValue = this.dlmsHelper.asDataObject(endDateTime);
/*
* Retrieve all captured objects by setting selectedValues to an empty
* array.
*/
final DataObject selectedValues = DataObject.newArrayData(Collections.emptyList());
final DataObject accessParameter = DataObject.newStructureData(Arrays.asList(clockDefinition, fromValue, toValue, selectedValues));
return new SelectiveAccessDescription(ACCESS_SELECTOR_RANGE_DESCRIPTOR, accessParameter);
}
use of org.openmuc.jdlms.SelectiveAccessDescription in project open-smart-grid-platform by OSGP.
the class AbstractGetPowerQualityProfileHandler method getSelectiveAccessDescription.
private SelectiveAccessDescription getSelectiveAccessDescription(final DateTime beginDateTime, final DateTime endDateTime, final DataObject selectableCaptureObjects) {
/*
* Define the clock object {8,0-0:1.0.0.255,2,0} to be used as
* restricting object in a range descriptor with a from value and to
* value to determine which elements from the buffered array should be
* retrieved.
*/
final DataObject clockDefinition = this.dlmsHelper.getClockDefinition();
final DataObject fromValue = this.dlmsHelper.asDataObject(beginDateTime);
final DataObject toValue = this.dlmsHelper.asDataObject(endDateTime);
final DataObject accessParameter = DataObject.newStructureData(Arrays.asList(clockDefinition, fromValue, toValue, selectableCaptureObjects));
return new SelectiveAccessDescription(ACCESS_SELECTOR_RANGE_DESCRIPTOR, accessParameter);
}
Aggregations