- IEC 61850 client: implemented IedConnection_installStateChangedHandler

pull/93/head
Michael Zillgith 7 years ago
parent 43e0fb4d05
commit e12113acde

1
.gitignore vendored

@ -1 +1,2 @@
build/
/Debug/

@ -587,7 +587,12 @@ static void
IedConnection_setState(IedConnection self, IedConnectionState newState)
{
Semaphore_wait(self->stateMutex);
if (self->state != newState)
self->connectionStateChangedHandler(self->connectionStateChangedHandlerParameter, self, newState);
self->state = newState;
Semaphore_post(self->stateMutex);
}
@ -599,7 +604,7 @@ IedConnection_installConnectionClosedHandler(IedConnection self, IedConnectionCl
self->connectionClosedParameter = parameter;
}
//TODO remove - not required - replace by mmsConnectionStateChangedHandler
/* TODO remove - not required - replace by mmsConnectionStateChangedHandler */
static void
connectionLostHandler(MmsConnection connection, void* parameter)
{
@ -640,6 +645,13 @@ IedConnection_connect(IedConnection self, IedClientError* error, const char* hos
*error = IED_ERROR_ALREADY_CONNECTED;
}
void
IedConnection_installStateChangedHandler(IedConnection self, IedConnectionStateChangedHandler handler, void* parameter)
{
self->connectionStateChangedHandler = handler;
self->connectionStateChangedHandlerParameter = parameter;
}
static void
mmsConnectionStateChangedHandler(MmsConnection connection, void* parameter, MmsConnectionState newState)
{

@ -58,6 +58,10 @@ struct sIedConnection
IedConnectionClosedHandler connectionCloseHandler;
void* connectionClosedParameter;
IedConnectionStateChangedHandler connectionStateChangedHandler;
void* connectionStateChangedHandlerParameter;
uint32_t connectionTimeout;
};

Loading…
Cancel
Save