use of org.openmuc.jdlms.datatypes.DataObject in project open-smart-grid-platform by OSGP.
the class SetActivityCalendarCommandExecutor method getDayProfileTablePassiveExecutor.
private DataObjectAttrExecutor getDayProfileTablePassiveExecutor(final Set<DayProfileDto> dayProfileSet) {
final AttributeAddress dayProfileTablePassive = new AttributeAddress(CLASS_ID, OBIS_CODE, ATTRIBUTE_ID_DAY_PROFILE_TABLE_PASSIVE);
final DataObject dayArray = DataObject.newArrayData(this.configurationMapper.mapAsList(dayProfileSet, DataObject.class));
LOGGER.info("DayProfileTablePassive to set is: {}", this.dlmsHelper.getDebugInfo(dayArray));
return new DataObjectAttrExecutor("DAYS", dayProfileTablePassive, dayArray, CLASS_ID, OBIS_CODE, ATTRIBUTE_ID_DAY_PROFILE_TABLE_PASSIVE);
}
use of org.openmuc.jdlms.datatypes.DataObject in project open-smart-grid-platform by OSGP.
the class DefinableLoadProfile method getCaptureObjectDefinitions.
private List<CaptureObject> getCaptureObjectDefinitions() {
final List<DataObject> captureObjectList = this.captureObjects.getValue();
final List<CaptureObject> captureObjectDefinitions = new ArrayList<>();
for (final DataObject captureObject : captureObjectList) {
captureObjectDefinitions.add(CaptureObject.newCaptureObject(captureObject));
}
return captureObjectDefinitions;
}
use of org.openmuc.jdlms.datatypes.DataObject in project open-smart-grid-platform by OSGP.
the class DefinableLoadProfile method reinitializeCaptureObjects.
private void reinitializeCaptureObjects(final List<DataObject> captureObjectList) throws IllegalAttributeAccessException {
final List<CaptureObject> captureObjectInitList = new ArrayList<>();
for (final DataObject captureObject : captureObjectList) {
final CaptureObject initCaptureObject;
try {
initCaptureObject = CaptureObject.newCaptureObject(captureObject);
} catch (final RuntimeException e) {
LOGGER.error("Unable to create capture object from: {}", captureObject, e);
throw new IllegalAttributeAccessException(AccessResultCode.OTHER_REASON, new IllegalArgumentException("Unable to create capture object from: " + captureObject, e));
}
if (!PROCESSORS_BY_CAPTURE_OBJECT.containsKey(initCaptureObject)) {
LOGGER.error("No data processor configured for {}", initCaptureObject);
throw new IllegalAttributeAccessException(AccessResultCode.OTHER_REASON, new IllegalArgumentException("No data processor configured for " + initCaptureObject));
}
captureObjectInitList.add(initCaptureObject);
}
this.captureObjectDefinitionCollection = DefinableLoadProfile.initCaptureObjects(captureObjectInitList);
}
use of org.openmuc.jdlms.datatypes.DataObject in project open-smart-grid-platform by OSGP.
the class ImageTransfer method setImageToActivateInfo.
private void setImageToActivateInfo() {
/**
* Expected image size is returned instead of the real received number of bytes. Real received
* number of bytes is different because of 0 padded transfer blocks.
*/
final DataObject imageInfo = DataObject.newStructureData(Arrays.asList(DataObject.newUInteger32Data(this.expectedImageSize), DataObject.newOctetStringData(this.identification), DataObject.newOctetStringData(this.signature)));
this.imageToActivateInfo = DataObject.newArrayData(Arrays.asList(imageInfo));
}
use of org.openmuc.jdlms.datatypes.DataObject in project open-smart-grid-platform by OSGP.
the class CaptureObjectDefinitionCollection method captureObjectsAsDataObject.
public DataObject captureObjectsAsDataObject() {
final List<DataObject> initList = new ArrayList<>();
final List<CaptureObject> captureObjects = this.allCaptureObjects();
for (final CaptureObject captureObject : captureObjects) {
initList.add(captureObject.asDataObject());
}
return DataObject.newArrayData(initList);
}
Aggregations