From 82e57900fa50a8dfcb61113337fb50aa897c9214 Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Fri, 17 Sep 2021 07:49:11 +0000 Subject: [PATCH] - .NET API: added wrapper for IedConnection_setFile and IedConnection_setFilestoreBasepath (LIB61850-258) --- dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs b/dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs index 58bc9cbd..4c2a53c4 100644 --- a/dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs +++ b/dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs @@ -1568,7 +1568,13 @@ namespace IEC61850 [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] static extern UInt32 IedConnection_getFile(IntPtr self, out int error, string fileName, InternalIedClientGetFileHandler handler, - IntPtr handlerParameter); + IntPtr handlerParameter); + + [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] + static extern void IedConnection_setFile(IntPtr self, out int error, string sourceFilename, string destinationFilename); + + [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] + static extern void IedConnection_setFilestoreBasepath(IntPtr self, string fileName); public delegate bool GetFileHandler(object parameter,byte[] data); @@ -1615,6 +1621,31 @@ namespace IEC61850 handle.Free(); } + /// + /// Set the virtual filestore basepath for the setFile service + /// + /// The new virtual filestore basepath + public void SetFilestoreBasepath(string basepath) + { + IedConnection_setFilestoreBasepath(connection, basepath); + } + + /// + /// Upload a file to the server. + /// + /// The filename of the local (client side) file + /// The filename of the remote (service side) file + public void SetFile(string sourceFilename, string destinationFilename) + { + int error; + + IedConnection_setFile(connection, out error, sourceFilename, destinationFilename); + + if (error != 0) + throw new IedConnectionException("Error uploading file", error); + + } + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.I1)] private delegate bool IedConnection_GetFileAsyncHandler(UInt32 invokeId,IntPtr parameter,int err,UInt32 originalInvokeId,