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,