diff --git a/dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs b/dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs index 4bb653bb..a39a8a2f 100644 --- a/dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs +++ b/dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs @@ -557,7 +557,13 @@ namespace IEC61850 public delegate void StateChangedHandler(IedConnection connection, IedConnectionState newState); [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] - static extern void IedConnection_installStateChangedHandler(IntPtr connection, InternalStateChangedHandler handler, IntPtr parameter); + static extern void IedConnection_installStateChangedHandler(IntPtr connection, InternalStateChangedHandler handler, IntPtr parameter); + + [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] + static extern void IedServer_ignoreReadAccess(IntPtr self, [MarshalAs(UnmanagedType.I1)] bool ignore); + + [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] + static extern void IedServer_ignoreClientRequests(IntPtr self, [MarshalAs(UnmanagedType.I1)] bool ignore); /********************* * Async functions @@ -1948,6 +1954,24 @@ namespace IEC61850 } } + /// + /// Ignore all MMS requests from clients (for testing purposes) + /// + /// when true all requests from clients will be ignored + public void IgnoreClientRequests(bool ignore) + { + IedServer_ignoreClientRequests(connection, ignore); + } + + /// + /// Temporarily ignore read requests (for testing purposes) + /// + /// true to ignore read requests, false to handle read requests. + public void IgnoreReadAccess(bool ignore) + { + IedServer_ignoreReadAccess(connection, ignore); + } + /// /// Read the values of a data set (GetDataSetValues service). /// @@ -2981,6 +3005,19 @@ namespace IEC61850 IED_STATE_CLOSING = 3 } + public static class IedClientErrorExtension + { + [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] + static extern IntPtr IedClientError_toString(int err); + + public static string ToString(this IedClientError err) + { + string stringVal = Marshal.PtrToStringAnsi(IedClientError_toString((int)err)); + + return stringVal; + } + } + /// /// Error codes for client side functions /// @@ -3066,6 +3103,9 @@ namespace IEC61850 /** Received an invalid response message from the server */ IED_ERROR_MALFORMED_MESSAGE = 34, + /** Service was not executed because required resource is still in use */ + IED_ERROR_OBJECT_CONSTRAINT_CONFLICT = 35, + /** Service not implemented */ IED_ERROR_SERVICE_NOT_IMPLEMENTED = 98,