- IEC 61850 client: added more prototypes for async client API

pull/93/head
Michael Zillgith 7 years ago
parent e6884d721b
commit 5201473262

@ -17,7 +17,7 @@
#include "platform_endian.h"
#define LIBIEC61850_VERSION "1.3.0"
#define LIBIEC61850_VERSION "1.4.0"
#ifndef CONFIG_DEFAULT_MMS_VENDOR_NAME
#define CONFIG_DEFAULT_MMS_VENDOR_NAME "libiec61850.com"

@ -441,7 +441,15 @@ private_ClientReportControlBlock_updateValues(ClientReportControlBlock self, Mms
return true;
}
typedef void
(*IedConnection_GetRCBValuesHandler) (int invokeId, void* parameter, IedClientError err, ClientReportControlBlock rcb);
uint32_t
IedConnection_getRCBValuesAsync(IedConnection self, IedClientError* error, const char* rcbReference,
IedConnection_GetRCBValuesHandler handler, void* parameter)
{
//TODO implement
}
ClientReportControlBlock
IedConnection_getRCBValues(IedConnection self, IedClientError* error, const char* rcbReference,
@ -511,6 +519,13 @@ IedConnection_getRCBValues(IedConnection self, IedClientError* error, const char
return returnRcb;
}
uint32_t
IedConnection_setRCBValues(IedConnection self, IedClientError* error, ClientReportControlBlock rcb,
uint32_t parametersMask, bool singleRequest, IedConnection_WriteObjectHandler handler, void* parameter)
{
//TODO implement
}
void
IedConnection_setRCBValues(IedConnection self, IedClientError* error, ClientReportControlBlock rcb,
uint32_t parametersMask, bool singleRequest)

@ -1,7 +1,7 @@
/*
* ied_connection.c
*
* Copyright 2013, 2014 Michael Zillgith
* Copyright 2013-2018 Michael Zillgith
*
* This file is part of libIEC61850.
*
@ -1640,6 +1640,59 @@ struct sClientProvidedFileReadHandler {
uint32_t byteReceived;
};
typedef void
(*IedConnection_FileDirectoryHandler) (int invokeId, void* parameter, IedClientError err, char* filename, uint32_t size, uint64_t lastModfified,
bool moreFollows);
static void
fileDirectoryHandler(int invokeId, void* parameter, MmsError err, char* filename, uint32_t size, uint64_t lastModfified,
bool moreFollows)
{
IedConnection self = (IedConnection) parameter;
IedConnectionOutstandingCall call = lookupOutstandingCall(self, invokeId);
if (call) {
IedConnection_FileDirectoryHandler handler = (IedConnection_FileDirectoryHandler) call->callback;
handler(invokeId, call->callbackParameter, iedConnection_mapMmsErrorToIedError(err), filename, size, lastModfified, moreFollows);
if (filename == NULL)
releaseOutstandingCall(self, call);
}
else {
if (DEBUG_IED_CLIENT)
printf("IED_CLIENT: internal error - no matching outstanding call!\n");
}
}
uint32_t
IedConnection_getFileDirectoryAsync(IedConnection self, IedClientError* error, const char* directoryName, const char* continueAfter,
IedConnection_FileDirectoryHandler handler, void* parameter)
{
MmsError err = MMS_ERROR_NONE;
IedConnectionOutstandingCall call = allocateOutstandingCall(self);
if (call == NULL) {
*error = IED_ERROR_OUTSTANDING_CALL_LIMIT_REACHED;
return 0;
}
call->callback = handler;
call->callbackParameter = parameter;
call->invokeId = MmsConnection_getFileDirectoryAsync(self->connection, &err, directoryName, continueAfter,
fileDirectoryHandler, self);
*error = iedConnection_mapMmsErrorToIedError(err);
return call->invokeId;
}
static void
mmsFileReadHandler(void* parameter, int32_t frsmId, uint8_t* buffer, uint32_t bytesReceived)
{

@ -746,6 +746,13 @@ ClientReportControlBlock
IedConnection_getRCBValues(IedConnection self, IedClientError* error, const char* rcbReference,
ClientReportControlBlock updateRcb);
typedef void
(*IedConnection_GetRCBValuesHandler) (int invokeId, void* parameter, IedClientError err, ClientReportControlBlock rcb);
uint32_t
IedConnection_getRCBValuesAsync(IedConnection self, IedClientError* error, const char* rcbReference,
IedConnection_GetRCBValuesHandler handler, void* parameter);
/** Describes the reason for the inclusion of the element in the report */
typedef enum {
/** the element is not included in the received report */
@ -854,6 +861,10 @@ void
IedConnection_setRCBValues(IedConnection self, IedClientError* error, ClientReportControlBlock rcb,
uint32_t parametersMask, bool singleRequest);
uint32_t
IedConnection_setRCBValues(IedConnection self, IedClientError* error, ClientReportControlBlock rcb,
uint32_t parametersMask, bool singleRequest, IedConnection_WriteObjectHandler handler, void* parameter);
/**
* \brief Callback function for receiving reports
*
@ -2202,6 +2213,21 @@ LinkedList /*<FileDirectoryEntry>*/
IedConnection_getFileDirectoryEx(IedConnection self, IedClientError* error, const char* directoryName, const char* continueAfter,
bool* moreFollows);
/**
* \brief Callback handler for the get file directory service
*
* Will be called once for each file directory entry and after the last entry with \ref filename = NULL to indicate
* with \ref moreFollows if more data is available at the server. In case of an error the callback will be called with
* \ref err != IED_ERROR_OK and moreFollows = false.
*/
typedef void
(*IedConnection_FileDirectoryHandler) (int invokeId, void* parameter, IedClientError err, char* filename, uint32_t size, uint64_t lastModfified,
bool moreFollows);
uint32_t
IedConnection_getFileDirectoryAsync(IedConnection self, IedClientError* error, const char* directoryName, const char* continueAfter,
IedConnection_FileDirectoryHandler handler, void* parameter);
/**
* \brief user provided handler to receive the data of the GetFile request
*

Loading…
Cancel
Save