From 44a4336deb8d0d27d6f06a854c682038fb4531bb Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Wed, 24 Feb 2016 11:26:21 +0100 Subject: [PATCH] - changed signature of IedConnection_deleteDataSet, MmsConnection_deleteAssociationSpecificNamedVariableList, MmsConnection_deleteNamedVariableList. added boolean return value to indicate if data set/named variable list has been deleted. - increased version number to 0.9.1 --- CHANGELOG | 4 ++++ demos/beaglebone/beaglebone_leds.h | 2 +- demos/beaglebone/static_model.c | 2 ++ dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs | 7 +++++-- src/doxygen.config | 2 +- src/iec61850/client/ied_connection.c | 9 +++++---- src/iec61850/inc/iec61850_client.h | 4 +++- src/iec61850/server/mms_mapping/mms_goose.c | 3 +++ src/iec61850/server/mms_mapping/mms_mapping.c | 6 +++--- src/mms/inc/mms_client_connection.h | 8 ++++++-- .../iso_mms/client/mms_client_connection.c | 20 +++++++++++-------- 11 files changed, 45 insertions(+), 22 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c1b73337..280c5def 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +Changes to version 0.9.1 +------------------------ +- changed signature of IedConnection_deleteDataSet, MmsConnection_deleteAssociationSpecificNamedVariableList, MmsConnection_deleteNamedVariableList. added boolean return value to indicate if data set/named variable list has been deleted. + Changes to version 0.9.0.2 -------------------------- - added CONFIG_IEC61850_EDITION_1 configuration option to enable server builds for edition 1 (at the moment only remove "Owner" form RCBs). diff --git a/demos/beaglebone/beaglebone_leds.h b/demos/beaglebone/beaglebone_leds.h index 61a396c7..090932ad 100644 --- a/demos/beaglebone/beaglebone_leds.h +++ b/demos/beaglebone/beaglebone_leds.h @@ -7,7 +7,7 @@ /* set to 1 if you want to run the demo on a PC */ -//#define SIMULATED 1 +#define SIMULATED 0 diff --git a/demos/beaglebone/static_model.c b/demos/beaglebone/static_model.c index ae7b9539..83951899 100644 --- a/demos/beaglebone/static_model.c +++ b/demos/beaglebone/static_model.c @@ -2403,6 +2403,7 @@ ReportControlBlock iedModel_GenericIO_LLN0_report4 = {&iedModel_GenericIO_LLN0, + IedModel iedModel = { "beagle", &iedModel_GenericIO, @@ -2410,6 +2411,7 @@ IedModel iedModel = { &iedModel_GenericIO_LLN0_report0, NULL, NULL, + NULL, initializeValues }; diff --git a/dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs b/dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs index 9eacc0c9..c33938f5 100644 --- a/dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs +++ b/dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs @@ -1003,15 +1003,18 @@ namespace IEC61850 /// This function will delete a data set at the server. This function may fail if the data set is not /// deletable. /// The object reference of the data set + /// true if data set has been deleted, false otherwise /// This exception is thrown if there is a connection or service error - public void DeleteDataSet (string dataSetReference) + public bool DeleteDataSet (string dataSetReference) { int error; - IedConnection_deleteDataSet (connection, out error, dataSetReference); + bool isDeleted = IedConnection_deleteDataSet (connection, out error, dataSetReference); if (error != 0) throw new IedConnectionException ("Failed to delete data set", error); + + return isDeleted; } /// diff --git a/src/doxygen.config b/src/doxygen.config index ebd53fc8..18664637 100644 --- a/src/doxygen.config +++ b/src/doxygen.config @@ -18,7 +18,7 @@ DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = "libIEC61850" -PROJECT_NUMBER = 0.9.0 +PROJECT_NUMBER = 0.9.1 PROJECT_BRIEF = "Open-source IEC 61850 MMS/GOOSE server and client library" diff --git a/src/iec61850/client/ied_connection.c b/src/iec61850/client/ied_connection.c index 3d5bee5c..7c9eaa04 100644 --- a/src/iec61850/client/ied_connection.c +++ b/src/iec61850/client/ied_connection.c @@ -1973,13 +1973,14 @@ exit_function: return; } -void +bool IedConnection_deleteDataSet(IedConnection self, IedClientError* error, const char* dataSetReference) { char domainIdBuf[65]; char* domainId = domainIdBuf; char itemId[DATA_SET_MAX_NAME_LENGTH + 1]; bool isAssociationSpecific = false; + bool isDeleted = false; int dataSetReferenceLength = strlen(dataSetReference); @@ -2025,14 +2026,14 @@ IedConnection_deleteDataSet(IedConnection self, IedClientError* error, const cha MmsError mmsError; if (isAssociationSpecific) - MmsConnection_deleteAssociationSpecificNamedVariableList(self->connection, &mmsError, itemId); + isDeleted = MmsConnection_deleteAssociationSpecificNamedVariableList(self->connection, &mmsError, itemId); else - MmsConnection_deleteNamedVariableList(self->connection, &mmsError, domainId, itemId); + isDeleted = MmsConnection_deleteNamedVariableList(self->connection, &mmsError, domainId, itemId); *error = iedConnection_mapMmsErrorToIedError(mmsError); exit_function: - return; + return isDeleted; } LinkedList /* */ diff --git a/src/iec61850/inc/iec61850_client.h b/src/iec61850/inc/iec61850_client.h index c9ed2541..ed5c8911 100644 --- a/src/iec61850/inc/iec61850_client.h +++ b/src/iec61850/inc/iec61850_client.h @@ -1336,8 +1336,10 @@ IedConnection_createDataSet(IedConnection self, IedClientError* error, const cha * \param connection the connection object * \param error the error code if an error occurs * \param dataSetReference object reference of the data set + * + * \return true if data set has been deleted, false otherwise */ -void +bool IedConnection_deleteDataSet(IedConnection self, IedClientError* error, const char* dataSetReference); diff --git a/src/iec61850/server/mms_mapping/mms_goose.c b/src/iec61850/server/mms_mapping/mms_goose.c index dafc5188..288f9312 100644 --- a/src/iec61850/server/mms_mapping/mms_goose.c +++ b/src/iec61850/server/mms_mapping/mms_goose.c @@ -325,6 +325,9 @@ MmsGooseControlBlock_checkAndPublish(MmsGooseControlBlock self, uint64_t current Semaphore_post(self->publisherMutex); #endif } + else if ((self->nextPublishTime - currentTime) > ((uint32_t) self->maxTime * 2)) { + self->nextPublishTime = currentTime + self->minTime; + } } void diff --git a/src/iec61850/server/mms_mapping/mms_mapping.c b/src/iec61850/server/mms_mapping/mms_mapping.c index 6f873df6..24b3939d 100644 --- a/src/iec61850/server/mms_mapping/mms_mapping.c +++ b/src/iec61850/server/mms_mapping/mms_mapping.c @@ -229,15 +229,15 @@ createNamedVariableFromDataAttribute(DataAttribute* attribute) namedVariable->type = MMS_OCTET_STRING; break; case IEC61850_VISIBLE_STRING_32: - namedVariable->typeSpec.visibleString = -129; + namedVariable->typeSpec.visibleString = -32; namedVariable->type = MMS_VISIBLE_STRING; break; case IEC61850_VISIBLE_STRING_64: - namedVariable->typeSpec.visibleString = -129; + namedVariable->typeSpec.visibleString = -64; namedVariable->type = MMS_VISIBLE_STRING; break; case IEC61850_VISIBLE_STRING_65: - namedVariable->typeSpec.visibleString = -129; + namedVariable->typeSpec.visibleString = -65; namedVariable->type = MMS_VISIBLE_STRING; break; case IEC61850_VISIBLE_STRING_129: diff --git a/src/mms/inc/mms_client_connection.h b/src/mms/inc/mms_client_connection.h index 9d6ac1a4..fc234e7e 100644 --- a/src/mms/inc/mms_client_connection.h +++ b/src/mms/inc/mms_client_connection.h @@ -493,8 +493,10 @@ MmsConnection_readNamedVariableListDirectoryAssociationSpecific(MmsConnection se * \param mmsError user provided variable to store error code * \param domainId the domain name of the domain of the variable list * \param listName the name of the named variable list + * + * \return true if named variable list has been deleted, false otherwise */ -void +bool MmsConnection_deleteNamedVariableList(MmsConnection self, MmsError* mmsError, const char* domainId, const char* listName); /** @@ -503,8 +505,10 @@ MmsConnection_deleteNamedVariableList(MmsConnection self, MmsError* mmsError, co * \param self MmsConnection instance to operate on * \param mmsError user provided variable to store error code * \param listName the name of the named variable list + * + * \return true if named variable list has been deleted, false otherwise */ -void +bool MmsConnection_deleteAssociationSpecificNamedVariableList(MmsConnection self, MmsError* mmsError, const char* listName); diff --git a/src/mms/iso_mms/client/mms_client_connection.c b/src/mms/iso_mms/client/mms_client_connection.c index db4aecda..166ed6f4 100644 --- a/src/mms/iso_mms/client/mms_client_connection.c +++ b/src/mms/iso_mms/client/mms_client_connection.c @@ -1459,10 +1459,12 @@ exit_function: return; } -void +bool MmsConnection_deleteNamedVariableList(MmsConnection self, MmsError* mmsError, const char* domainId, const char* listName) { + bool isDeleted = false; + if (self->associationState != MMS_STATE_CONNECTED) { *mmsError = MMS_ERROR_CONNECTION_LOST; goto exit_function; @@ -1481,8 +1483,8 @@ MmsConnection_deleteNamedVariableList(MmsConnection self, MmsError* mmsError, if (self->lastResponseError != MMS_ERROR_NONE) *mmsError = self->lastResponseError; else if (responseMessage != NULL) - if (!mmsClient_parseDeleteNamedVariableListResponse(self->lastResponse, NULL)) - *mmsError = MMS_ERROR_ACCESS_OTHER; + if (mmsClient_parseDeleteNamedVariableListResponse(self->lastResponse, NULL)) + isDeleted = true; releaseResponse(self); @@ -1490,13 +1492,15 @@ MmsConnection_deleteNamedVariableList(MmsConnection self, MmsError* mmsError, *mmsError = MMS_ERROR_CONNECTION_LOST; exit_function: - return; + return isDeleted; } -void +bool MmsConnection_deleteAssociationSpecificNamedVariableList(MmsConnection self, MmsError* mmsError, const char* listName) { + bool isDeleted = false; + if (self->associationState != MMS_STATE_CONNECTED) { *mmsError = MMS_ERROR_CONNECTION_LOST; goto exit_function; @@ -1516,8 +1520,8 @@ MmsConnection_deleteAssociationSpecificNamedVariableList(MmsConnection self, if (self->lastResponseError != MMS_ERROR_NONE) *mmsError = self->lastResponseError; else if (responseMessage != NULL) - if (!mmsClient_parseDeleteNamedVariableListResponse(self->lastResponse, NULL)) - *mmsError = MMS_ERROR_ACCESS_OTHER; + if (mmsClient_parseDeleteNamedVariableListResponse(self->lastResponse, NULL)) + isDeleted = true; releaseResponse(self); @@ -1525,7 +1529,7 @@ MmsConnection_deleteAssociationSpecificNamedVariableList(MmsConnection self, *mmsError = MMS_ERROR_CONNECTION_LOST; exit_function: - return; + return isDeleted; } MmsVariableSpecification*