diff --git a/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs b/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs
index 683d646b..b531a48b 100644
--- a/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs
+++ b/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs
@@ -517,8 +517,11 @@ namespace IEC61850
[DllImport ("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr ControlAction_getOrIdent (IntPtr self, ref int size);
- [DllImport ("iec61850", CallingConvention = CallingConvention.Cdecl)]
- static extern IntPtr ControlAction_getClientConnection (IntPtr self);
+ [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
+ static extern IntPtr ControlAction_getClientConnection(IntPtr self);
+
+ [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
+ static extern int ControlAction_getCtlNum(IntPtr self);
private IntPtr self;
private IedServer.ControlHandlerInfo info;
@@ -569,6 +572,15 @@ namespace IEC61850
return orIdent;
}
+ ///
+ /// Gets the ctlNum attribute of the control action
+ ///
+ /// The ctlNum value. Valid values are restricted from 0 to 255, -1 means not present
+ public int GetCtlNum()
+ {
+ return ControlAction_getCtlNum(self);
+ }
+
///
/// Gets the control object that is subject to this action
///
diff --git a/src/iec61850/inc/iec61850_server.h b/src/iec61850/inc/iec61850_server.h
index c922eb88..983d863c 100644
--- a/src/iec61850/inc/iec61850_server.h
+++ b/src/iec61850/inc/iec61850_server.h
@@ -1164,6 +1164,16 @@ ControlAction_getOrCat(ControlAction self);
LIB61850_API uint8_t*
ControlAction_getOrIdent(ControlAction self, int* orIdentSize);
+/**
+ * \brief Get the ctlNum attribute send by the client
+ *
+ * \param self the control action instance
+ *
+ * \return the ctlNum value
+ */
+LIB61850_API int
+ControlAction_getCtlNum(ControlAction self);
+
/**
* \brief Gets the client object associated with the client that caused the control action
*
diff --git a/src/iec61850/server/mms_mapping/control.c b/src/iec61850/server/mms_mapping/control.c
index b5b95ed0..b0097b50 100644
--- a/src/iec61850/server/mms_mapping/control.c
+++ b/src/iec61850/server/mms_mapping/control.c
@@ -1734,6 +1734,18 @@ ControlAction_getOrIdent(ControlAction self, int* orIdentSize)
return NULL;
}
+int
+ControlAction_getCtlNum(ControlAction self)
+{
+ ControlObject* controlObject = (ControlObject*) self;
+
+ if (controlObject->ctlNum) {
+ return MmsValue_toInt32(controlObject->ctlNum);
+ }
+
+ return -1;
+}
+
ClientConnection
ControlAction_getClientConnection(ControlAction self)
{