- .NET API: added ControlAction.GetControlTime methods

pull/202/head
Michael Zillgith 6 years ago
parent 5fbb67c44c
commit 881ebac3dc

@ -510,6 +510,9 @@ namespace IEC61850
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern int ControlAction_getCtlNum(IntPtr self);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern UInt64 ControlAction_getControlTime(IntPtr self);
private IntPtr self;
private IedServer.ControlHandlerInfo info;
private IedServer iedServer;
@ -577,6 +580,24 @@ namespace IEC61850
return info.controlObject;
}
/// <summary>
/// Gets the time of control execution, if it's a time activated control
/// </summary>
/// <returns>The time of control execution or 0 for immediate execution</returns>
public UInt64 GetControlTime()
{
return ControlAction_getControlTime(self);
}
/// <summary>
/// Gets the tome of control execution as data time offset.
/// </summary>
/// <returns>The control execution time as data time offset.</returns>
public DateTimeOffset GetControlTimeAsDataTimeOffset()
{
return MmsValue.MsTimeToDateTimeOffset(GetControlTime());
}
/// <summary>
/// Gets the client object associated with the client that caused the control action
/// </summary>

@ -113,7 +113,7 @@ namespace reporting
if (rcb3.IsBuffered())
Console.WriteLine ("RCB: " + rcbReference3 + " is buffered");
rcb3.InstallReportHandler(reportHandler, rcb2);
rcb3.InstallReportHandler(reportHandler, rcb3);
rcb3.SetOptFlds(ReportOptions.REASON_FOR_INCLUSION | ReportOptions.SEQ_NUM | ReportOptions.TIME_STAMP |
ReportOptions.CONF_REV | ReportOptions.ENTRY_ID | ReportOptions.DATA_REFERENCE | ReportOptions.DATA_SET);

@ -31,13 +31,22 @@ namespace server1
IedServer iedServer = new IedServer (iedModel, config);
iedServer.SetCheckHandler(spcso1, delegate(ControlAction action, object parameter, MmsValue ctlVal, bool test, bool interlockCheck) {
Console.WriteLine("Received binary control command:");
Console.WriteLine(" ctlNum: " + action.GetCtlNum());
Console.WriteLine(" execution-time: " + action.GetControlTimeAsDataTimeOffset().ToString());
return CheckHandlerResult.ACCEPTED;
}, null);
iedServer.SetControlHandler (spcso1, delegate(ControlAction action, object parameter, MmsValue ctlVal, bool test) {
bool val = ctlVal.GetBoolean();
if (val)
Console.WriteLine("received binary control command: on");
Console.WriteLine("execute binary control command: on");
else
Console.WriteLine("received binary control command: off");
Console.WriteLine("execute binary control command: off");
return ControlHandlerResult.OK;
}, null);

Loading…
Cancel
Save