- added new function DataAttribute_setValue

pull/331/head
Michael Zillgith 5 years ago
parent 2b1104c0d3
commit c4dcd37449

@ -123,7 +123,9 @@ namespace IEC61850
/** periodic transmission of all data set values */
INTEGRITY = 8,
/** general interrogation (on client request) */
GI = 16
GI = 16,
/** Report will be triggered only on rising edge (transient variable) */
TRG_OPT_TRANSIENT = 128
}
/// <summary>

@ -871,11 +871,13 @@ namespace IEC61850
public class DataAttribute : ModelNode
{
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr DataAttribute_create(string name, IntPtr parent, int type, int fc,
byte triggerOptions, int arrayElements, UInt32 sAddr);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern void DataAttribute_setValue(IntPtr self, IntPtr mmsValue);
internal DataAttribute(IntPtr self, ModelNode parent) : base(self)
{
this.parent = parent;
@ -889,6 +891,14 @@ namespace IEC61850
self = DataAttribute_create (name, parent.self, (int)type, (int)fc, (byte)trgOps, arrayElements, sAddr);
}
/// <summary>
/// Set the value of the data attribute (can be used to set default values before server is created)
/// </summary>
/// <param name="value">New value for the data attribute</param>
public void SetValue(MmsValue value)
{
DataAttribute_setValue(self, value.valueReference);
}
}
public class ModelNode

@ -137,6 +137,15 @@ LIB61850_API DataAttribute*
DataAttribute_create(const char* name, ModelNode* parent, DataAttributeType type, FunctionalConstraint fc,
uint8_t triggerOptions, int arrayElements, uint32_t sAddr);
/**
* \brief Set the value of the data attribute (can be used to set default values before server is created)
*
* \param self the data attribute instance
* \param value the new default value
*/
LIB61850_API void
DataAttribute_setValue(DataAttribute* self, MmsValue* value);
/**
* \brief create a new report control block (RCB)
*

@ -607,6 +607,17 @@ DataAttribute_create(const char* name, ModelNode* parent, DataAttributeType type
return self;
}
void
DataAttribute_setValue(DataAttribute* self, MmsValue* value)
{
if (self->mmsValue) {
MmsValue_update(self->mmsValue, value);
}
else {
self->mmsValue = MmsValue_clone(value);
}
}
DataSet*
DataSet_create(const char* name, LogicalNode* parent)
{

Loading…
Cancel
Save