Skip to content

Commit

Permalink
IEC 61850 server: added function ControlAction_getCtlNum to access ct…
Browse files Browse the repository at this point in the history
…lNum value inside control handlers
  • Loading branch information
mzillgith committed Sep 21, 2019
1 parent 83f9f1e commit e4c3875
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
16 changes: 14 additions & 2 deletions dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,11 @@ public class ControlAction
[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;
Expand Down Expand Up @@ -569,6 +572,15 @@ public byte [] GetOrIdent ()
return orIdent;
}

/// <summary>
/// Gets the ctlNum attribute of the control action
/// </summary>
/// <returns>The ctlNum value. Valid values are restricted from 0 to 255, -1 means not present</returns>
public int GetCtlNum()
{
return ControlAction_getCtlNum(self);
}

/// <summary>
/// Gets the control object that is subject to this action
/// </summary>
Expand Down
10 changes: 10 additions & 0 deletions src/iec61850/inc/iec61850_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
12 changes: 12 additions & 0 deletions src/iec61850/server/mms_mapping/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit e4c3875

Please sign in to comment.