diff --git a/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs b/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs
index 89d8335d..882c2251 100644
--- a/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs
+++ b/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs
@@ -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;
}
+ ///
+ /// Gets the time of control execution, if it's a time activated control
+ ///
+ /// The time of control execution or 0 for immediate execution
+ public UInt64 GetControlTime()
+ {
+ return ControlAction_getControlTime(self);
+ }
+
+ ///
+ /// Gets the tome of control execution as data time offset.
+ ///
+ /// The control execution time as data time offset.
+ public DateTimeOffset GetControlTimeAsDataTimeOffset()
+ {
+ return MmsValue.MsTimeToDateTimeOffset(GetControlTime());
+ }
+
///
/// Gets the client object associated with the client that caused the control action
///
diff --git a/dotnet/reporting/ReportingExample.cs b/dotnet/reporting/ReportingExample.cs
index 3166745a..94a5dece 100644
--- a/dotnet/reporting/ReportingExample.cs
+++ b/dotnet/reporting/ReportingExample.cs
@@ -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);
diff --git a/dotnet/server1/Program.cs b/dotnet/server1/Program.cs
index a5910937..8853382b 100644
--- a/dotnet/server1/Program.cs
+++ b/dotnet/server1/Program.cs
@@ -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);