- changed signature of WriteAccessHandler: Handler now return MmsDataAccessError instead of boolean value!
This commit is contained in:
parent
8c91a53ea9
commit
b1eda97ab4
10 changed files with 51 additions and 17 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Changes to version 0.8.7
|
||||||
|
------------------------
|
||||||
|
- server: changed signature of WriteAccessHandler: Handler now return MmsDataAccessError instead of boolean value!
|
||||||
|
- server: added function IedModel_setIedNameForDynamicModel
|
||||||
|
|
||||||
Changes to version 0.8.6
|
Changes to version 0.8.6
|
||||||
------------------------
|
------------------------
|
||||||
- demos: extended beaglebone demo to use SBO control
|
- demos: extended beaglebone demo to use SBO control
|
||||||
|
|
|
@ -11,7 +11,7 @@ project(libiec61850)
|
||||||
|
|
||||||
set(LIB_VERSION_MAJOR "0")
|
set(LIB_VERSION_MAJOR "0")
|
||||||
set(LIB_VERSION_MINOR "8")
|
set(LIB_VERSION_MINOR "8")
|
||||||
set(LIB_VERSION_PATCH "6")
|
set(LIB_VERSION_PATCH "7")
|
||||||
|
|
||||||
# feature checks
|
# feature checks
|
||||||
include(CheckLibraryExists)
|
include(CheckLibraryExists)
|
||||||
|
|
|
@ -141,7 +141,7 @@
|
||||||
/* default results for MMS identify service */
|
/* default results for MMS identify service */
|
||||||
#define CONFIG_DEFAULT_MMS_VENDOR_NAME "libiec61850.com"
|
#define CONFIG_DEFAULT_MMS_VENDOR_NAME "libiec61850.com"
|
||||||
#define CONFIG_DEFAULT_MMS_MODEL_NAME "LIBIEC61850"
|
#define CONFIG_DEFAULT_MMS_MODEL_NAME "LIBIEC61850"
|
||||||
#define CONFIG_DEFAULT_MMS_REVISION "0.8.6"
|
#define CONFIG_DEFAULT_MMS_REVISION "0.8.7"
|
||||||
|
|
||||||
/* MMS virtual file store base path - where file services are looking for files */
|
/* MMS virtual file store base path - where file services are looking for files */
|
||||||
#define CONFIG_VIRTUAL_FILESTORE_BASEPATH "./vmd-filestore/"
|
#define CONFIG_VIRTUAL_FILESTORE_BASEPATH "./vmd-filestore/"
|
||||||
|
|
|
@ -21,15 +21,24 @@ void sigint_handler(int signalId)
|
||||||
running = 0;
|
running = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static MmsDataAccessError
|
||||||
writeAccessHandler (DataAttribute* dataAttribute, MmsValue* value, ClientConnection connection)
|
writeAccessHandler (DataAttribute* dataAttribute, MmsValue* value, ClientConnection connection)
|
||||||
{
|
{
|
||||||
if (dataAttribute == IEDMODEL_Inverter_ZINV1_OutVarSet_setMag_f) {
|
if (dataAttribute == IEDMODEL_Inverter_ZINV1_OutVarSet_setMag_f) {
|
||||||
printf("New value for OutVarSet_setMag_f = %f\n", MmsValue_toFloat(value));
|
|
||||||
return true;
|
float newValue = MmsValue_toFloat(value);
|
||||||
|
|
||||||
|
printf("New value for OutVarSet_setMag_f = %f\n", newValue);
|
||||||
|
|
||||||
|
/* Check if value is inside of valid range */
|
||||||
|
if ((newValue >= 0.f) && (newValue <= 1000.1f))
|
||||||
|
return DATA_ACCESS_ERROR_SUCCESS;
|
||||||
|
else
|
||||||
|
return DATA_ACCESS_ERROR_OBJECT_VALUE_INVALID;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
|
|
@ -15,6 +15,20 @@
|
||||||
|
|
||||||
#include "platform_endian.h"
|
#include "platform_endian.h"
|
||||||
|
|
||||||
|
#define LIBIEC61850_VERSION "0.8.7"
|
||||||
|
|
||||||
|
#ifndef CONFIG_DEFAULT_MMS_VENDOR_NAME
|
||||||
|
#define CONFIG_DEFAULT_MMS_VENDOR_NAME "libiec61850.com"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_DEFAULT_MMS_MODEL_NAME
|
||||||
|
#define CONFIG_DEFAULT_MMS_MODEL_NAME "LIBIEC61850"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_DEFAULT_MMS_REVISION
|
||||||
|
#define CONFIG_DEFAULT_MMS_REVISION LIBIEC61850_VERSION
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (DEBUG != 1)
|
#if (DEBUG != 1)
|
||||||
#define NDEBUG 1
|
#define NDEBUG 1
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -18,7 +18,7 @@ DOXYFILE_ENCODING = UTF-8
|
||||||
|
|
||||||
PROJECT_NAME = "libIEC61850"
|
PROJECT_NAME = "libIEC61850"
|
||||||
|
|
||||||
PROJECT_NUMBER = 0.8.6
|
PROJECT_NUMBER = 0.8.7
|
||||||
|
|
||||||
PROJECT_BRIEF = "Open-source IEC 61850 MMS/GOOSE server and client library"
|
PROJECT_BRIEF = "Open-source IEC 61850 MMS/GOOSE server and client library"
|
||||||
|
|
||||||
|
|
|
@ -353,5 +353,5 @@ Timestamp_getTimeInMs(Timestamp* self)
|
||||||
char*
|
char*
|
||||||
LibIEC61850_getVersionString()
|
LibIEC61850_getVersionString()
|
||||||
{
|
{
|
||||||
return CONFIG_DEFAULT_MMS_REVISION;
|
return LIBIEC61850_VERSION;
|
||||||
}
|
}
|
||||||
|
|
|
@ -958,12 +958,13 @@ IedServer_observeDataAttribute(IedServer self, DataAttribute* dataAttribute,
|
||||||
* is accepted.
|
* is accepted.
|
||||||
*
|
*
|
||||||
* \param the data attribute that has been written by an MMS client.
|
* \param the data attribute that has been written by an MMS client.
|
||||||
* \param the value the client want to write to the data attribtue
|
* \param the value the client want to write to the data attribute
|
||||||
* \param connection the connection object of the client connection that invoked the write operation
|
* \param connection the connection object of the client connection that invoked the write operation
|
||||||
*
|
*
|
||||||
* \return true if access is accepted, false if access is denied.
|
* \return true if access is accepted, false if access is denied.
|
||||||
*/
|
*/
|
||||||
typedef bool (*WriteAccessHandler) (DataAttribute* dataAttribute, MmsValue* value, ClientConnection connection);
|
typedef MmsDataAccessError
|
||||||
|
(*WriteAccessHandler) (DataAttribute* dataAttribute, MmsValue* value, ClientConnection connection);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Install a WriteAccessHandler for a data attribute.
|
* \brief Install a WriteAccessHandler for a data attribute.
|
||||||
|
|
|
@ -1825,21 +1825,28 @@ mmsWriteHandler(void* parameter, MmsDomain* domain,
|
||||||
MmsValue* matchingValue = checkIfValueBelongsToModelNode(dataAttribute, cachedValue, value);
|
MmsValue* matchingValue = checkIfValueBelongsToModelNode(dataAttribute, cachedValue, value);
|
||||||
|
|
||||||
if (matchingValue != NULL) {
|
if (matchingValue != NULL) {
|
||||||
if (accessHandler->handler(dataAttribute, matchingValue, (ClientConnection) connection))
|
MmsDataAccessError handlerResult =
|
||||||
|
accessHandler->handler(dataAttribute, matchingValue, (ClientConnection) connection);
|
||||||
|
|
||||||
|
if (handlerResult == DATA_ACCESS_ERROR_SUCCESS)
|
||||||
handlerFound = true;
|
handlerFound = true;
|
||||||
else
|
else
|
||||||
return DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED;
|
return handlerResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else { /* if ACCESS_POLICY_DENY only allow direct access to handled data attribute */
|
else { /* if ACCESS_POLICY_DENY only allow direct access to handled data attribute */
|
||||||
if (dataAttribute->mmsValue == cachedValue) {
|
if (dataAttribute->mmsValue == cachedValue) {
|
||||||
if (accessHandler->handler(dataAttribute, value, (ClientConnection) connection)) {
|
MmsDataAccessError handlerResult =
|
||||||
|
accessHandler->handler(dataAttribute, value, (ClientConnection) connection);
|
||||||
|
|
||||||
|
|
||||||
|
if (handlerResult == DATA_ACCESS_ERROR_SUCCESS) {
|
||||||
handlerFound = true;
|
handlerFound = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED;
|
return handlerResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1883,8 +1890,6 @@ mmsWriteHandler(void* parameter, MmsDomain* domain,
|
||||||
return DATA_ACCESS_ERROR_OBJECT_VALUE_INVALID;
|
return DATA_ACCESS_ERROR_OBJECT_VALUE_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("WRITE ACCESS DENIED!\n");
|
|
||||||
|
|
||||||
return DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED;
|
return DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ extern "C" {
|
||||||
/**@{*/
|
/**@{*/
|
||||||
|
|
||||||
|
|
||||||
typedef enum ATTRIBUTE_PACKED {
|
typedef enum {
|
||||||
DATA_ACCESS_ERROR_NO_RESPONSE = -2, /* for server internal purposes only! */
|
DATA_ACCESS_ERROR_NO_RESPONSE = -2, /* for server internal purposes only! */
|
||||||
DATA_ACCESS_ERROR_SUCCESS = -1,
|
DATA_ACCESS_ERROR_SUCCESS = -1,
|
||||||
DATA_ACCESS_ERROR_OBJECT_INVALIDATED = 0,
|
DATA_ACCESS_ERROR_OBJECT_INVALIDATED = 0,
|
||||||
|
|
Loading…
Add table
Reference in a new issue