From da8f9fe9cf58747958d3aa6410a257c91695f63e Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Sat, 9 May 2020 07:23:46 +0200 Subject: [PATCH] - .NET API: added ControlAction.SetError method --- dotnet/IEC61850forCSharp/IEC61850CommonAPI.cs | 15 +++++++++++++++ dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs | 12 ++++++++++++ 2 files changed, 27 insertions(+) diff --git a/dotnet/IEC61850forCSharp/IEC61850CommonAPI.cs b/dotnet/IEC61850forCSharp/IEC61850CommonAPI.cs index 6ae0d53e..6b3b0b2b 100644 --- a/dotnet/IEC61850forCSharp/IEC61850CommonAPI.cs +++ b/dotnet/IEC61850forCSharp/IEC61850CommonAPI.cs @@ -649,6 +649,21 @@ namespace IEC61850 NONE = -1 } + /// + /// Definition for LastAppError error type for control models + /// Used in LastApplError and CommandTermination messages. + /// + public enum ControlLastApplError { + NO_ERROR = 0, + UNKNOWN = 1, + TIMEOUT_TEST = 2, + OPERATOR_TEST = 3 + } + + /// + /// AddCause - additional cause information for control model errors + /// Used in LastApplError and CommandTermination messages. + /// public enum ControlAddCause { ADD_CAUSE_UNKNOWN = 0, ADD_CAUSE_NOT_SUPPORTED = 1, diff --git a/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs b/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs index 90748455..0b7413e1 100644 --- a/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs +++ b/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs @@ -875,6 +875,9 @@ namespace IEC61850 [DllImport ("iec61850", CallingConvention = CallingConvention.Cdecl)] static extern void ControlAction_setAddCause (IntPtr self, int addCause); + [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] + static extern void ControlAction_setError(IntPtr self, int error); + [DllImport ("iec61850", CallingConvention = CallingConvention.Cdecl)] static extern int ControlAction_getOrCat (IntPtr self); @@ -905,6 +908,15 @@ namespace IEC61850 this.iedServer = iedServer; } + /// + /// Sets the error code for the next command termination or application error message. + /// + /// the errror code to use + public void SetError(ControlLastApplError error) + { + ControlAction_setError(self, (int)error); + } + /// /// Sets the add cause for the next command termination or application error message ///