From ee948a0c08f7f02db2970e852c40867947453870 Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Thu, 21 Apr 2022 11:06:10 +0200 Subject: [PATCH] - added function ReportControlBlock_getResv --- dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs | 12 +++++++++ src/iec61850/inc/iec61850_dynamic_model.h | 3 +++ src/iec61850/server/mms_mapping/reporting.c | 25 +++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs b/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs index ebb61dbd..55a87e3c 100644 --- a/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs +++ b/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs @@ -1356,6 +1356,10 @@ namespace IEC61850 [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] static extern UInt16 ReportControlBlock_getResvTms(IntPtr self); + [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + static extern bool ReportControlBlock_getResv(IntPtr self); + [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr ReportControlBlock_getOwner(IntPtr self); @@ -1548,6 +1552,14 @@ namespace IEC61850 } } + public bool Resv + { + get + { + return ReportControlBlock_getResv(self); + } + } + public byte[] Owner { get diff --git a/src/iec61850/inc/iec61850_dynamic_model.h b/src/iec61850/inc/iec61850_dynamic_model.h index 0945ee94..59829e64 100644 --- a/src/iec61850/inc/iec61850_dynamic_model.h +++ b/src/iec61850/inc/iec61850_dynamic_model.h @@ -354,6 +354,9 @@ ReportControlBlock_getTimeofEntry(ReportControlBlock* self); LIB61850_API int16_t ReportControlBlock_getResvTms(ReportControlBlock* self); +LIB61850_API bool +ReportControlBlock_getResv(ReportControlBlock* self); + LIB61850_API MmsValue* ReportControlBlock_getOwner(ReportControlBlock* self); diff --git a/src/iec61850/server/mms_mapping/reporting.c b/src/iec61850/server/mms_mapping/reporting.c index 998fda06..537a1fad 100644 --- a/src/iec61850/server/mms_mapping/reporting.c +++ b/src/iec61850/server/mms_mapping/reporting.c @@ -4256,6 +4256,31 @@ ReportControlBlock_getResvTms(ReportControlBlock* self) } } +bool +ReportControlBlock_getResv(ReportControlBlock* self) +{ + if (self->trgOps & 64) { + ReportControl* rc = (ReportControl*)(self->sibling); + +#if (CONFIG_MMS_THREADLESS_STACK != 1) + Semaphore_wait(rc->rcbValuesLock); +#endif + + MmsValue* resvValue = ReportControl_getRCBValue(rc, "Resv"); + + bool resv = MmsValue_getBoolean(resvValue); + +#if (CONFIG_MMS_THREADLESS_STACK != 1) + Semaphore_post(rc->rcbValuesLock); +#endif + + return resv; + } + else { + return false; + } +} + MmsValue* ReportControlBlock_getOwner(ReportControlBlock* self) {