- .NET API: added functions to access DataAttribute properties

pull/331/head
Michael Zillgith 4 years ago
parent 530cdc0383
commit cb3f460fcf

@ -893,22 +893,57 @@ namespace IEC61850
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern void DataAttribute_setValue(IntPtr self, IntPtr mmsValue); static extern void DataAttribute_setValue(IntPtr self, IntPtr mmsValue);
private DataAttributeType daType; [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern int DataAttribute_getType(IntPtr self);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern byte DataAttribute_getTrgOps(IntPtr self);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern int DataAttribute_getFC(IntPtr self);
internal DataAttribute(IntPtr self, ModelNode parent) : base(self) internal DataAttribute(IntPtr self, ModelNode parent) : base(self)
{ {
this.parent = parent; this.parent = parent;
} }
/// <summary>
/// Create a new data attribute and add it to a parent model node
/// </summary>
/// The parent model node has to be of type DataObject or DataAttribute
/// <param name="name">the name of the data attribute (e.g. "stVal")</param>
/// <param name="parent">the parent model node (of type DataObject or DataAttribute)</param>
/// <param name="type">the type of the data attribute (CONSTRUCTED if the type contains sub data attributes)</param>
/// <param name="fc">the functional constraint (FC) of the data attribute</param>
/// <param name="trgOps">the trigger options (dupd, dchg, qchg) that cause an event notification</param>
/// <param name="arrayElements">the number of array elements if the data attribute is an array or 0</param>
/// <param name="sAddr">an optional short address (deprecated)</param>
public DataAttribute (string name, ModelNode parent, DataAttributeType type, FunctionalConstraint fc, TriggerOptions trgOps, public DataAttribute (string name, ModelNode parent, DataAttributeType type, FunctionalConstraint fc, TriggerOptions trgOps,
int arrayElements, UInt32 sAddr) int arrayElements, UInt32 sAddr)
{ {
this.parent = parent; this.parent = parent;
this.daType = type;
self = DataAttribute_create (name, parent.self, (int)type, (int)fc, (byte)trgOps, arrayElements, sAddr); self = DataAttribute_create (name, parent.self, (int)type, (int)fc, (byte)trgOps, arrayElements, sAddr);
} }
/// <summary>
/// Create a new data attribute and add it to a parent model node
/// </summary>
/// The parent model node has to be of type DataObject or DataAttribute
/// <param name="name">the name of the data attribute (e.g. "stVal")</param>
/// <param name="parent">the parent model node (of type DataObject or DataAttribute)</param>
/// <param name="type">the type of the data attribute (CONSTRUCTED if the type contains sub data attributes)</param>
/// <param name="fc">the functional constraint (FC) of the data attribute</param>
/// <param name="trgOps">the trigger options (dupd, dchg, qchg) that cause an event notification</param>
/// <param name="arrayElements">the number of array elements if the data attribute is an array or 0</param>
public DataAttribute(string name, ModelNode parent, DataAttributeType type, FunctionalConstraint fc, TriggerOptions trgOps,
int arrayElements)
{
this.parent = parent;
self = DataAttribute_create(name, parent.self, (int)type, (int)fc, (byte)trgOps, arrayElements, 0);
}
/// <summary> /// <summary>
/// Get IEC 61850 data attribute type of the data attribute /// Get IEC 61850 data attribute type of the data attribute
/// </summary> /// </summary>
@ -916,7 +951,29 @@ namespace IEC61850
{ {
get get
{ {
return daType; return (DataAttributeType)DataAttribute_getType(self);
}
}
/// <summary>
/// The trigger options (dchg, qchg, dupd) of the data attribute
/// </summary>
public TriggerOptions TrgOps
{
get
{
return (TriggerOptions)DataAttribute_getTrgOps(self);
}
}
/// <summary>
/// The functional constraint (FC) of the data attribute
/// </summary>
public FunctionalConstraint FC
{
get
{
return (FunctionalConstraint)DataAttribute_getFC(self);
} }
} }

@ -121,12 +121,12 @@ DataObject_create(const char* name, ModelNode* parent, int arrayElements);
/** /**
* \brief create a new data attribute and add it to a parent model node * \brief create a new data attribute and add it to a parent model node
* *
* The parent model node has to be of type LogicalNode or DataObject * The parent model node has to be of type DataObject or DataAttribute
* *
* \param name the name of the data attribute (e.g. "stVal") * \param name the name of the data attribute (e.g. "stVal")
* \param parent the parent model node * \param parent the parent model node
* \param type the type of the data attribute (CONSTRUCTED if the type contains sub data attributes) * \param type the type of the data attribute (CONSTRUCTED if the type contains sub data attributes)
* \param fc the functional constraint (FC) of the data attribte * \param fc the functional constraint (FC) of the data attribute
* \param triggerOptions the trigger options (dupd, dchg, qchg) that cause an event notification * \param triggerOptions the trigger options (dupd, dchg, qchg) that cause an event notification
* \param arrayElements the number of array elements if the data attribute is an array or 0 * \param arrayElements the number of array elements if the data attribute is an array or 0
* \param sAddr an optional short address * \param sAddr an optional short address
@ -137,6 +137,36 @@ LIB61850_API DataAttribute*
DataAttribute_create(const char* name, ModelNode* parent, DataAttributeType type, FunctionalConstraint fc, DataAttribute_create(const char* name, ModelNode* parent, DataAttributeType type, FunctionalConstraint fc,
uint8_t triggerOptions, int arrayElements, uint32_t sAddr); uint8_t triggerOptions, int arrayElements, uint32_t sAddr);
/**
* \brief Get the data type of the data attribute
*
* \param self the data attribute instance
*
* \return the data attribute type
*/
LIB61850_API DataAttributeType
DataAttribute_getType(DataAttribute* self);
/**
* \brief Get the functional constraint (FC) of the data attribute
*
* \param self the data attribute instance
*
* \return the functional constraint (FC) of the data attribute
*/
LIB61850_API FunctionalConstraint
DataAttribute_getFC(DataAttribute* self);
/**
* \brief Get the trigger options of the data attribute
*
* \param self the data attribute instance
*
* \return the trigger options (dupd, dchg, qchg) that cause an event notification
*/
LIB61850_API uint8_t
DataAttribute_getTrgOps(DataAttribute* self);
/** /**
* \brief Set the value of the data attribute (can be used to set default values before server is created) * \brief Set the value of the data attribute (can be used to set default values before server is created)
* *

@ -607,6 +607,30 @@ DataAttribute_create(const char* name, ModelNode* parent, DataAttributeType type
return self; return self;
} }
const char*
DataAttribute_getName(DataAttribute* self)
{
return self->name;
}
DataAttributeType
DataAttribute_getType(DataAttribute* self)
{
return self->type;
}
FunctionalConstraint
DataAttribute_getFC(DataAttribute* self)
{
return self->fc;
}
uint8_t
DataAttribute_getTrgOps(DataAttribute* self)
{
return self->triggerOptions;
}
void void
DataAttribute_setValue(DataAttribute* self, MmsValue* value) DataAttribute_setValue(DataAttribute* self, MmsValue* value)
{ {

Loading…
Cancel
Save