pull/331/head
Michael Zillgith 4 years ago
commit d1fd0c7e34

@ -146,6 +146,16 @@ Depending on the system you don't have to provide a generator to the cmake comma
To select some configuration options you can use ccmake or cmake-gui. To select some configuration options you can use ccmake or cmake-gui.
For newer version of Visual Studio you can use one of the following commands (for 64 bit builds):
For Visual Studio 2017:
cmake -G "Visual Studio 15 2017 Win64" ..
For Visual Studio 2019 (new way to specify the x64 platform):
cmake -G "Visual Studio 16 2019" .. -A x64
## Using the log service with sqlite ## Using the log service with sqlite

@ -34,6 +34,11 @@ namespace IEC61850
/// This class is used to represent a data set. It is used to store the values /// This class is used to represent a data set. It is used to store the values
/// of a data set. /// of a data set.
/// </summary> /// </summary>
/// <remarks>
/// This class manages native resource. Take care that the finalizer/Dispose is not
/// called while running a method or the object is still in use by another object.
/// If in doubt please use the "using" statement.
/// </remarks>
public class DataSet : IDisposable public class DataSet : IDisposable
{ {
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
@ -108,21 +113,34 @@ namespace IEC61850
return ClientDataSet_getDataSetSize(nativeObject); return ClientDataSet_getDataSetSize(nativeObject);
} }
public void Dispose() private bool disposed = false;
protected virtual void Dispose(bool disposing)
{ {
lock (this) lock (this)
{ {
if (nativeObject != IntPtr.Zero) if (!disposed)
{ {
ClientDataSet_destroy(nativeObject); if (nativeObject != IntPtr.Zero)
nativeObject = IntPtr.Zero; {
ClientDataSet_destroy(nativeObject);
nativeObject = IntPtr.Zero;
}
disposed = true;
} }
} }
} }
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
~DataSet() ~DataSet()
{ {
Dispose(); Dispose(false);
} }
internal IntPtr getNativeInstance() internal IntPtr getNativeInstance()

@ -548,7 +548,7 @@ namespace IEC61850
/// <summary> /// <summary>
/// Called when there is a change in the connection state /// Called when there is a change in the connection state
/// </summary> /// </summary>
public delegate void StateChangedHandler(IedConnection connection,IedConnectionState newState); public delegate void StateChangedHandler(IedConnection connection, IedConnectionState newState);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] [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);
@ -1788,7 +1788,7 @@ namespace IEC61850
/// by a prior function call.</description> /// by a prior function call.</description>
/// <param name="handler">The user provided callback handler</param> /// <param name="handler">The user provided callback handler</param>
/// <exception cref="IedConnectionException">This exception is thrown if there is a connection or service error</exception> /// <exception cref="IedConnectionException">This exception is thrown if there is a connection or service error</exception>
[Obsolete("ConnectionClosedHandler is deprecated, please use ConnectionEventHandler instead")] [Obsolete("ConnectionClosedHandler is deprecated, please use StateChangedHandler instead")]
public void InstallConnectionClosedHandler(ConnectionClosedHandler handler) public void InstallConnectionClosedHandler(ConnectionClosedHandler handler)
{ {
if (connectionClosedHandler == null) if (connectionClosedHandler == null)

Loading…
Cancel
Save