diff --git a/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs b/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs
index e1f5cbe7..d005c815 100644
--- a/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs
+++ b/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs
@@ -893,22 +893,57 @@ namespace IEC61850
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
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)
{
this.parent = parent;
}
+ ///
+ /// Create a new data attribute and add it to a parent model node
+ ///
+ /// The parent model node has to be of type DataObject or DataAttribute
+ /// the name of the data attribute (e.g. "stVal")
+ /// the parent model node (of type DataObject or DataAttribute)
+ /// the type of the data attribute (CONSTRUCTED if the type contains sub data attributes)
+ /// the functional constraint (FC) of the data attribute
+ /// the trigger options (dupd, dchg, qchg) that cause an event notification
+ /// the number of array elements if the data attribute is an array or 0
+ /// an optional short address (deprecated)
public DataAttribute (string name, ModelNode parent, DataAttributeType type, FunctionalConstraint fc, TriggerOptions trgOps,
int arrayElements, UInt32 sAddr)
{
this.parent = parent;
- this.daType = type;
self = DataAttribute_create (name, parent.self, (int)type, (int)fc, (byte)trgOps, arrayElements, sAddr);
}
+ ///
+ /// Create a new data attribute and add it to a parent model node
+ ///
+ /// The parent model node has to be of type DataObject or DataAttribute
+ /// the name of the data attribute (e.g. "stVal")
+ /// the parent model node (of type DataObject or DataAttribute)
+ /// the type of the data attribute (CONSTRUCTED if the type contains sub data attributes)
+ /// the functional constraint (FC) of the data attribute
+ /// the trigger options (dupd, dchg, qchg) that cause an event notification
+ /// the number of array elements if the data attribute is an array or 0
+ 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);
+ }
+
///
/// Get IEC 61850 data attribute type of the data attribute
///
@@ -916,7 +951,29 @@ namespace IEC61850
{
get
{
- return daType;
+ return (DataAttributeType)DataAttribute_getType(self);
+ }
+ }
+
+ ///
+ /// The trigger options (dchg, qchg, dupd) of the data attribute
+ ///
+ public TriggerOptions TrgOps
+ {
+ get
+ {
+ return (TriggerOptions)DataAttribute_getTrgOps(self);
+ }
+ }
+
+ ///
+ /// The functional constraint (FC) of the data attribute
+ ///
+ public FunctionalConstraint FC
+ {
+ get
+ {
+ return (FunctionalConstraint)DataAttribute_getFC(self);
}
}
diff --git a/src/iec61850/inc/iec61850_dynamic_model.h b/src/iec61850/inc/iec61850_dynamic_model.h
index 872ee425..e28ac506 100644
--- a/src/iec61850/inc/iec61850_dynamic_model.h
+++ b/src/iec61850/inc/iec61850_dynamic_model.h
@@ -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
*
- * 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 parent the parent model node
* \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 arrayElements the number of array elements if the data attribute is an array or 0
* \param sAddr an optional short address
@@ -137,6 +137,36 @@ LIB61850_API DataAttribute*
DataAttribute_create(const char* name, ModelNode* parent, DataAttributeType type, FunctionalConstraint fc,
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)
*
diff --git a/src/iec61850/server/model/dynamic_model.c b/src/iec61850/server/model/dynamic_model.c
index ea68d36d..33e79ef0 100644
--- a/src/iec61850/server/model/dynamic_model.c
+++ b/src/iec61850/server/model/dynamic_model.c
@@ -607,6 +607,30 @@ DataAttribute_create(const char* name, ModelNode* parent, DataAttributeType type
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
DataAttribute_setValue(DataAttribute* self, MmsValue* value)
{