use of org.openmuc.jdlms.SetParameter in project open-smart-grid-platform by OSGP.
the class CosemObjectAccessor method writeAttribute.
public void writeAttribute(final AttributeClass attributeClass, final DataObject data) throws ProtocolAdapterException {
final AttributeAddress attributeAddress = this.createAttributeAddress(attributeClass);
final SetParameter setParameter = new SetParameter(attributeAddress, data);
final AccessResultCode accessResultCode;
try {
accessResultCode = this.connector.getConnection().set(setParameter);
} catch (final IOException e) {
throw new ProtocolAdapterException(String.format(EXCEPTION_MSG_WRITING_ATTRIBUTE, attributeClass, this.classId, this.obisCode), e);
}
if (accessResultCode != AccessResultCode.SUCCESS) {
throw new ProtocolAdapterException(String.format(EXCEPTION_MSG_ACCESS_RESULT_NOT_SUCCESS, accessResultCode.name(), attributeClass, this.classId, this.obisCode));
}
}
Aggregations