diff --git a/dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs b/dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs index 475aadc1..e8adb97f 100644 --- a/dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs +++ b/dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs @@ -1323,6 +1323,16 @@ namespace IEC61850 EX = 11, /** Control */ CO = 12, + /** Unicast SV */ + US = 13, + /** Multicast SV */ + MS = 14, + /** Unbuffered report */ + RP = 15, + /** Buffered report */ + BR = 16, + + /** All FCs - wildcard value */ ALL = 99, NONE = -1 } diff --git a/dotnet/IEC61850forCSharp/MmsValue.cs b/dotnet/IEC61850forCSharp/MmsValue.cs index 3f69b7b0..d4e84436 100644 --- a/dotnet/IEC61850forCSharp/MmsValue.cs +++ b/dotnet/IEC61850forCSharp/MmsValue.cs @@ -140,6 +140,12 @@ namespace IEC61850 [return: MarshalAs(UnmanagedType.I1)] static extern bool MmsValue_equals(IntPtr self, IntPtr otherValue); + [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] + static extern IntPtr MmsValue_newBinaryTime (bool timeOfDay); + + [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] + static extern void MmsValue_setBinaryTime (IntPtr self, UInt64 timestamp); + internal MmsValue (IntPtr value) { @@ -229,6 +235,26 @@ namespace IEC61850 return new MmsValue(newValue, true); } + /// + /// Create a new MmsValue instance of type MMS_BINARY_TIME + /// + /// the new MmsValue instance. + /// If set to true large 6 byte format. + public static MmsValue NewBinaryTime(bool largeFormat) + { + IntPtr newValue = MmsValue_newBinaryTime (largeFormat); + + return new MmsValue (newValue, true); + } + + /// + /// Sets the binary time. + /// + /// Timestamp. + public void SetBinaryTime(UInt64 timestamp) { + MmsValue_setBinaryTime (this.valueReference, timestamp); + } + internal IntPtr valueReference; private bool responsableForDeletion; diff --git a/src/iec61850/client/client_report_control.c b/src/iec61850/client/client_report_control.c index 3d01defe..b0b4a187 100644 --- a/src/iec61850/client/client_report_control.c +++ b/src/iec61850/client/client_report_control.c @@ -637,7 +637,7 @@ IedConnection_setRCBValues(IedConnection self, IedClientError* error, ClientRepo MmsValue* dataAccessError = (MmsValue*) accessResult->data; if (MmsValue_getDataAccessError(dataAccessError) != DATA_ACCESS_ERROR_SUCCESS) { - *error = IED_ERROR_UNKNOWN; + *error = iedConnection_mapDataAccessErrorToIedError(MmsValue_getDataAccessError(dataAccessError)); break; } diff --git a/src/iec61850/common/iec61850_common.c b/src/iec61850/common/iec61850_common.c index 7dae4129..f8e0f016 100644 --- a/src/iec61850/common/iec61850_common.c +++ b/src/iec61850/common/iec61850_common.c @@ -129,6 +129,10 @@ FunctionalConstraint_toString(FunctionalConstraint fc) { return "US"; case IEC61850_FC_MS: return "MS"; + case IEC61850_FC_RP: + return "RP"; + case IEC61850_FC_BR: + return "BR"; default: return NULL; } @@ -157,6 +161,8 @@ FunctionalConstraint_fromString(const char* fcString) if (fcString[0] == 'M') { if (fcString[1] == 'X') return IEC61850_FC_MX; + if (fcString[1] == 'S') + return IEC61850_FC_MS; return IEC61850_FC_NONE; } @@ -183,6 +189,8 @@ FunctionalConstraint_fromString(const char* fcString) if (fcString[0] == 'B') { if (fcString[1] == 'L') return IEC61850_FC_BL; + if (fcString[1] == 'R') + return IEC61850_FC_BR; return IEC61850_FC_NONE; } @@ -192,6 +200,18 @@ FunctionalConstraint_fromString(const char* fcString) return IEC61850_FC_NONE; } + if (fcString[0] == 'U') { + if (fcString[1] == 'S') + return IEC61850_FC_US; + return IEC61850_FC_NONE; + } + + if (fcString[0] == 'R') { + if (fcString[1] == 'P') + return IEC61850_FC_RP; + return IEC61850_FC_NONE; + } + return IEC61850_FC_NONE; } diff --git a/src/iec61850/inc/iec61850_common.h b/src/iec61850/inc/iec61850_common.h index 0c9dc271..938c9d17 100644 --- a/src/iec61850/inc/iec61850_common.h +++ b/src/iec61850/inc/iec61850_common.h @@ -229,7 +229,12 @@ typedef enum eFunctionalConstraint { IEC61850_FC_US = 13, /** Multicast SV */ IEC61850_FC_MS = 14, + /** Unbuffered report */ + IEC61850_FC_RP = 15, + /** Buffered report */ + IEC61850_FC_BR = 16, + /** All FCs - wildcard value */ IEC61850_FC_ALL = 99, IEC61850_FC_NONE = -1 } FunctionalConstraint; diff --git a/src/iec61850/server/mms_mapping/reporting.c b/src/iec61850/server/mms_mapping/reporting.c index 0a8da537..17811fc4 100644 --- a/src/iec61850/server/mms_mapping/reporting.c +++ b/src/iec61850/server/mms_mapping/reporting.c @@ -1438,10 +1438,6 @@ Reporting_RCBWriteAccessHandler(MmsMapping* self, ReportControl* rc, char* eleme goto exit_function; } - else if ((strcmp(elementName, "ConfRev") == 0) || (strcmp(elementName, "SqNum") == 0)) { - retVal = DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED; - goto exit_function; - } else if (strcmp(elementName, "RptID") == 0) { MmsValue* rptId = ReportControl_getRCBValue(rc, elementName); @@ -1452,6 +1448,10 @@ Reporting_RCBWriteAccessHandler(MmsMapping* self, ReportControl* rc, char* eleme goto exit_function; } + else if (strcmp(elementName, "ConfRev") == 0) { + retVal = DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED; + goto exit_function; + } else if (strcmp(elementName, "SqNum") == 0) { retVal = DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED; goto exit_function; @@ -1460,6 +1460,10 @@ Reporting_RCBWriteAccessHandler(MmsMapping* self, ReportControl* rc, char* eleme retVal = DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED; goto exit_function; } + else if (strcmp(elementName, "TimeofEntry") == 0) { + retVal = DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED; + goto exit_function; + } MmsValue* rcbValue = ReportControl_getRCBValue(rc, elementName);