use of org.openmuc.jdlms.ObisCode in project open-smart-grid-platform by OSGP.
the class DeviceSimulatorSteps method deviceSimulationOfEquipmentIdentifier.
public void deviceSimulationOfEquipmentIdentifier(final String deviceIdentification) {
final ObisCode obisCodeEquipmentIdentifier = new ObisCode(0, 0, 96, 1, 1, 255);
final ObjectNode attributeValues = this.jsonObjectCreator.convertTableToJsonObject(Arrays.asList(Arrays.asList("2", "octet-string", Hex.encodeHexString(deviceIdentification.getBytes(StandardCharsets.US_ASCII)))));
this.setDlmsAttributeValues(InterfaceClass.DATA.id(), obisCodeEquipmentIdentifier, attributeValues, "the E-meter Equipment Identifier");
}
use of org.openmuc.jdlms.ObisCode 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);
}
use of org.openmuc.jdlms.ObisCode in project open-smart-grid-platform by OSGP.
the class Smr5Profile method configurationObject.
@Bean
public ConfigurationObject configurationObject() {
final Byte[] bytes = new Byte[this.configurationObjectFlags.size()];
this.configurationObjectFlags.toArray(bytes);
this.dynamicValues().setDefaultAttributeValue(InterfaceClass.DATA.id(), new ObisCode(0, 1, 94, 31, 3, 255), ConfigurationObject.ATTRIBUTE_ID_VALUE, DataObject.newBitStringData(new BitString(ArrayUtils.toPrimitive(bytes), 16)));
return new ConfigurationObject();
}
use of org.openmuc.jdlms.ObisCode in project open-smart-grid-platform by OSGP.
the class DynamicValues method getDlmsAttributeValue.
public DataObject getDlmsAttributeValue(final CosemInterfaceObject cosemInterfaceObject, final Integer attributeId) {
final int classId = cosemInterfaceObject.getClass().getAnnotation(CosemClass.class).id();
final ObisCode obisCode = cosemInterfaceObject.getInstanceId();
final DataObject result = this.getDlmsAttributeValue(classId, obisCode, attributeId);
if (result != null) {
return result;
}
return this.getDefaultAttributeValue(classId, obisCode, attributeId);
}
use of org.openmuc.jdlms.ObisCode in project open-smart-grid-platform by OSGP.
the class DynamicValues method setDlmsAttributeValue.
/**
* This methods sends a json request to the dlmsAttributeValuesClient, to store the given
* attribute with the associated obiscode and attributeId, so that a next get request will
* retrieve this value.
*/
public void setDlmsAttributeValue(final CosemInterfaceObject cosemInterfaceObject, final Integer attributeId, final DataObject dataObject) {
try {
final int classId = cosemInterfaceObject.getClass().getAnnotation(CosemClass.class).id();
final ObisCode obisCode = cosemInterfaceObject.getInstanceId();
this.dlmsAttributeValuesClient.setDlmsAttributeValue(classId, obisCode, attributeId, dataObject);
} catch (final DlmsAttributeValuesClientException e) {
LOGGER.error("An error occured while setting a attribute on the simulator", e);
throw new WebApplicationException("Error accessing DLMS Attribute Values Service", e);
}
}
Aggregations