diff --git a/src/iec61850/inc/iec61850_server.h b/src/iec61850/inc/iec61850_server.h index 5ec99c77..392459cd 100644 --- a/src/iec61850/inc/iec61850_server.h +++ b/src/iec61850/inc/iec61850_server.h @@ -509,6 +509,9 @@ IedServer_getMmsServer(IedServer self); LIB61850_API void IedServer_enableGoosePublishing(IedServer self); +LIB61850_API void +IedServer_setGoosePublishingSimulation(IedServer self, bool test); + /** * \brief Disable all GOOSE control blocks. * diff --git a/src/iec61850/inc_private/mms_goose.h b/src/iec61850/inc_private/mms_goose.h index ab2cdfcd..9d0eb860 100644 --- a/src/iec61850/inc_private/mms_goose.h +++ b/src/iec61850/inc_private/mms_goose.h @@ -77,6 +77,11 @@ MmsGooseControlBlock_publishNewState(MmsGooseControlBlock self); LIB61850_INTERNAL void MmsGooseControlBlock_enable(MmsGooseControlBlock self); + +LIB61850_INTERNAL void +MmsGooseControlBlock_setSimulation(MmsGooseControlBlock self, bool test); + + LIB61850_INTERNAL void MmsGooseControlBlock_disable(MmsGooseControlBlock self); diff --git a/src/iec61850/inc_private/mms_mapping.h b/src/iec61850/inc_private/mms_mapping.h index 4590eb34..dd4bbf51 100644 --- a/src/iec61850/inc_private/mms_mapping.h +++ b/src/iec61850/inc_private/mms_mapping.h @@ -103,6 +103,11 @@ MmsMapping_triggerGooseObservers(MmsMapping* self, MmsValue* value); LIB61850_INTERNAL void MmsMapping_enableGoosePublishing(MmsMapping* self); + +LIB61850_INTERNAL void +MmsMapping_setGoosePublishingSimulation(MmsMapping* self, bool test); + + LIB61850_INTERNAL void MmsMapping_disableGoosePublishing(MmsMapping* self); diff --git a/src/iec61850/server/impl/ied_server.c b/src/iec61850/server/impl/ied_server.c index b64c37f1..7f1021fd 100644 --- a/src/iec61850/server/impl/ied_server.c +++ b/src/iec61850/server/impl/ied_server.c @@ -1384,6 +1384,14 @@ IedServer_enableGoosePublishing(IedServer self) #endif /* (CONFIG_INCLUDE_GOOSE_SUPPORT == 1) */ } +void +IedServer_setGoosePublishingSimulation(IedServer self, bool test) +{ +#if (CONFIG_INCLUDE_GOOSE_SUPPORT == 1) + MmsMapping_setGoosePublishingSimulation(self->mmsMapping, test); +#endif /* (CONFIG_INCLUDE_GOOSE_SUPPORT == 1) */ +} + void IedServer_disableGoosePublishing(IedServer self) { diff --git a/src/iec61850/server/mms_mapping/mms_goose.c b/src/iec61850/server/mms_mapping/mms_goose.c index 783adbb6..c2074096 100644 --- a/src/iec61850/server/mms_mapping/mms_goose.c +++ b/src/iec61850/server/mms_mapping/mms_goose.c @@ -191,6 +191,23 @@ MmsGooseControlBlock_isEnabled(MmsGooseControlBlock self) return self->goEna; } +void +MmsGooseControlBlock_setSimulation(MmsGooseControlBlock self, bool test) +{ +#if (CONFIG_MMS_THREADLESS_STACK != 1) + Semaphore_wait(self->publisherMutex); +#endif + + if(self->publisher){ + GoosePublisher_setSimulation(self->publisher, test); + } + +#if (CONFIG_MMS_THREADLESS_STACK != 1) + Semaphore_post(self->publisherMutex); +#endif + +} + void MmsGooseControlBlock_enable(MmsGooseControlBlock self) { diff --git a/src/iec61850/server/mms_mapping/mms_mapping.c b/src/iec61850/server/mms_mapping/mms_mapping.c index 4677be69..3d8343c5 100644 --- a/src/iec61850/server/mms_mapping/mms_mapping.c +++ b/src/iec61850/server/mms_mapping/mms_mapping.c @@ -2938,6 +2938,19 @@ MmsMapping_enableGoosePublishing(MmsMapping* self) } +void +MmsMapping_setGoosePublishingSimulation(MmsMapping* self, bool test) +{ + LinkedList element = self->gseControls; + + while ((element = LinkedList_getNext(element)) != NULL) { + MmsGooseControlBlock gcb = (MmsGooseControlBlock) element->data; + + MmsGooseControlBlock_setSimulation(gcb, test); + } + +} + void MmsMapping_useGooseVlanTag(MmsMapping* self, LogicalNode* ln, const char* gcbName, bool useVlanTag) {