- IEC 61850 client: Added functions IedConnection_setRequestTimeout and IedConnection_getRequestTimeout to C API and IedConnection.RequestTimeout property to .NET API

pull/179/head
Michael Zillgith 6 years ago
parent d06ab546a9
commit 320f511d33

@ -425,6 +425,12 @@ namespace IEC61850
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern void IedConnection_setConnectTimeout(IntPtr self, UInt32 timeoutInMs); static extern void IedConnection_setConnectTimeout(IntPtr self, UInt32 timeoutInMs);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern void IedConnection_setRequestTimeout(IntPtr self, UInt32 timeoutInMs);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern UInt32 IedConnection_getRequestTimeout(IntPtr self);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern void IedConnection_connect(IntPtr self, out int error, string hostname, int tcpPort); static extern void IedConnection_connect(IntPtr self, out int error, string hostname, int tcpPort);
@ -769,6 +775,22 @@ namespace IEC61850
} }
} }
/// <summary>
/// Gets or sets the request timeout for this connection
/// </summary>
/// <value>The request timeout in milliseconds</value>
public UInt32 RequestTimeout
{
get
{
return IedConnection_getRequestTimeout(connection);
}
set
{
IedConnection_setRequestTimeout(connection, value);
}
}
/// <summary> /// <summary>
/// Gets or sets the maximum size if a PDU (has to be set before calling connect!). /// Gets or sets the maximum size if a PDU (has to be set before calling connect!).
/// </summary> /// </summary>

@ -638,6 +638,24 @@ IedConnection_setConnectTimeout(IedConnection self, uint32_t timeoutInMs)
self->connectionTimeout = timeoutInMs; self->connectionTimeout = timeoutInMs;
} }
void
IedConnection_setRequestTimeout(IedConnection self, uint32_t timeoutInMs)
{
if (self->connection) {
MmsConnection_setRequestTimeout(self->connection, timeoutInMs);
}
}
uint32_t
IedConnection_getRequestTimeout(IedConnection self)
{
if (self->connection) {
return MmsConnection_getRequestTimeout(self->connection);
}
else
return 0;
}
IedConnectionState IedConnectionState
IedConnection_getState(IedConnection self) IedConnection_getState(IedConnection self)
{ {

@ -244,6 +244,28 @@ IedConnection_destroy(IedConnection self);
LIB61850_API void LIB61850_API void
IedConnection_setConnectTimeout(IedConnection self, uint32_t timeoutInMs); IedConnection_setConnectTimeout(IedConnection self, uint32_t timeoutInMs);
/**
* \brief set the request timeout in ms
*
* Set the request timeout for this connection. You can call this function any time to adjust
* timeout behavior.
*
* \param self the connection object
* \param timoutInMs the connection timeout in ms
*/
LIB61850_API void
IedConnection_setRequestTimeout(IedConnection self, uint32_t timeoutInMs);
/**
* \brief get the request timeout in ms for this connection
*
* \param self the connection object
*
* \return request timeout in milliseconds
*/
LIB61850_API uint32_t
IedConnection_getRequestTimeout(IedConnection self);
/** /**
* \brief Perform MMS message handling and house-keeping tasks (for non-thread mode only) * \brief Perform MMS message handling and house-keeping tasks (for non-thread mode only)
* *

@ -160,6 +160,16 @@ MmsConnection_setFilestoreBasepath(MmsConnection self, const char* basepath);
LIB61850_API void LIB61850_API void
MmsConnection_setRequestTimeout(MmsConnection self, uint32_t timeoutInMs); MmsConnection_setRequestTimeout(MmsConnection self, uint32_t timeoutInMs);
/**
* \brief Get the request timeout in ms for this connection
*
* \param self MmsConnection instance to operate on
*
* \return request timeout in milliseconds
*/
LIB61850_API uint32_t
MmsConnection_getRequestTimeout(MmsConnection self);
/** /**
* \brief Set the connect timeout in ms for this connection instance * \brief Set the connect timeout in ms for this connection instance
* *

@ -1555,6 +1555,12 @@ MmsConnection_setRequestTimeout(MmsConnection self, uint32_t timeoutInMs)
self->requestTimeout = timeoutInMs; self->requestTimeout = timeoutInMs;
} }
uint32_t
MmsConnection_getRequestTimeout(MmsConnection self)
{
return self->requestTimeout;
}
void void
MmsConnection_setConnectTimeout(MmsConnection self, uint32_t timeoutInMs) MmsConnection_setConnectTimeout(MmsConnection self, uint32_t timeoutInMs)
{ {

Loading…
Cancel
Save