diff --git a/examples/iec61850_client_example1/client_example1.c b/examples/iec61850_client_example1/client_example1.c index 1eb9444..651c0c7 100644 --- a/examples/iec61850_client_example1/client_example1.c +++ b/examples/iec61850_client_example1/client_example1.c @@ -22,7 +22,7 @@ reportCallbackFunction(void* parameter, ClientReport report) for (i = 0; i < 4; i++) { ReasonForInclusion reason = ClientReport_getReasonForInclusion(report, i); - if (reason != REASON_NOT_INCLUDED) { + if (reason != IEC61850_REASON_NOT_INCLUDED) { printf(" GGIO1.SPCSO%i.stVal: %i (included for reason %i)\n", i, MmsValue_getBoolean(MmsValue_getElement(dataSetValues, i)), reason); } diff --git a/examples/iec61850_client_example_reporting/client_example_reporting.c b/examples/iec61850_client_example_reporting/client_example_reporting.c index 378596d..1f53117 100644 --- a/examples/iec61850_client_example_reporting/client_example_reporting.c +++ b/examples/iec61850_client_example_reporting/client_example_reporting.c @@ -48,7 +48,7 @@ reportCallbackFunction(void* parameter, ClientReport report) for (i = 0; i < LinkedList_size(dataSetDirectory); i++) { ReasonForInclusion reason = ClientReport_getReasonForInclusion(report, i); - if (reason != REASON_NOT_INCLUDED) { + if (reason != IEC61850_REASON_NOT_INCLUDED) { LinkedList entry = LinkedList_get(dataSetDirectory, i); diff --git a/src/iec61850/client/client_report.c b/src/iec61850/client/client_report.c index a0b7c8a..e3fbd10 100644 --- a/src/iec61850/client/client_report.c +++ b/src/iec61850/client/client_report.c @@ -67,17 +67,17 @@ char* ReasonForInclusion_getValueAsString(ReasonForInclusion reasonCode) { switch (reasonCode) { - case REASON_NOT_INCLUDED: + case IEC61850_REASON_NOT_INCLUDED: return "not-included"; - case REASON_DATA_CHANGE: + case IEC61850_REASON_DATA_CHANGE: return "data-change"; - case REASON_DATA_UPDATE: + case IEC61850_REASON_DATA_UPDATE: return "data-update"; - case REASON_QUALITY_CHANGE: + case IEC61850_REASON_QUALITY_CHANGE: return "quality-change"; - case REASON_GI: + case IEC61850_REASON_GI: return "GI"; - case REASON_INTEGRITY: + case IEC61850_REASON_INTEGRITY: return "integrity"; default: return "unknown"; @@ -136,7 +136,7 @@ ClientReport_getReasonForInclusion(ClientReport self, int elementIndex) if (self->reasonForInclusion != NULL) return self->reasonForInclusion[elementIndex]; else - return REASON_NOT_INCLUDED; + return IEC61850_REASON_NOT_INCLUDED; } MmsValue* @@ -536,7 +536,7 @@ private_IedConnection_handleReport(IedConnection self, MmsValue* value) int elementIndex; for (elementIndex = 0; elementIndex < dataSetSize; elementIndex++) - matchingReport->reasonForInclusion[elementIndex] = REASON_NOT_INCLUDED; + matchingReport->reasonForInclusion[elementIndex] = IEC61850_REASON_NOT_INCLUDED; } @@ -570,22 +570,22 @@ private_IedConnection_handleReport(IedConnection self, MmsValue* value) MmsValue* reasonForInclusion = MmsValue_getElement(value, reasonForInclusionIndex); if (MmsValue_getBitStringBit(reasonForInclusion, 1) == true) - matchingReport->reasonForInclusion[i] = REASON_DATA_CHANGE; + matchingReport->reasonForInclusion[i] = IEC61850_REASON_DATA_CHANGE; else if (MmsValue_getBitStringBit(reasonForInclusion, 2) == true) - matchingReport->reasonForInclusion[i] = REASON_QUALITY_CHANGE; + matchingReport->reasonForInclusion[i] = IEC61850_REASON_QUALITY_CHANGE; else if (MmsValue_getBitStringBit(reasonForInclusion, 3) == true) - matchingReport->reasonForInclusion[i] = REASON_DATA_UPDATE; + matchingReport->reasonForInclusion[i] = IEC61850_REASON_DATA_UPDATE; else if (MmsValue_getBitStringBit(reasonForInclusion, 4) == true) - matchingReport->reasonForInclusion[i] = REASON_INTEGRITY; + matchingReport->reasonForInclusion[i] = IEC61850_REASON_INTEGRITY; else if (MmsValue_getBitStringBit(reasonForInclusion, 5) == true) - matchingReport->reasonForInclusion[i] = REASON_GI; + matchingReport->reasonForInclusion[i] = IEC61850_REASON_GI; } else { - matchingReport->reasonForInclusion[i] = REASON_UNKNOWN; + matchingReport->reasonForInclusion[i] = IEC61850_REASON_UNKNOWN; } } else { - matchingReport->reasonForInclusion[i] = REASON_NOT_INCLUDED; + matchingReport->reasonForInclusion[i] = IEC61850_REASON_NOT_INCLUDED; } } diff --git a/src/iec61850/inc/iec61850_client.h b/src/iec61850/inc/iec61850_client.h index 47d4618..0181f71 100644 --- a/src/iec61850/inc/iec61850_client.h +++ b/src/iec61850/inc/iec61850_client.h @@ -658,27 +658,35 @@ IedConnection_getRCBValues(IedConnection self, IedClientError* error, const char /** Describes the reason for the inclusion of the element in the report */ typedef enum { /** the element is not included in the received report */ - REASON_NOT_INCLUDED = 0, + IEC61850_REASON_NOT_INCLUDED = 0, /** the element is included due to a change of the data value */ - REASON_DATA_CHANGE = 1, + IEC61850_REASON_DATA_CHANGE = 1, /** the element is included due to a change in the quality of data */ - REASON_QUALITY_CHANGE = 2, + IEC61850_REASON_QUALITY_CHANGE = 2, /** the element is included due to an update of the data value */ - REASON_DATA_UPDATE = 3, + IEC61850_REASON_DATA_UPDATE = 3, /** the element is included due to a periodic integrity report task */ - REASON_INTEGRITY = 4, + IEC61850_REASON_INTEGRITY = 4, /** the element is included due to a general interrogation by the client */ - REASON_GI = 5, + IEC61850_REASON_GI = 5, /** the reason for inclusion is unknown */ - REASON_UNKNOWN = 6 + IEC61850_REASON_UNKNOWN = 6 } ReasonForInclusion; +#define REASON_NOT_INCLUDED IEC61850_REASON_NOT_INCLUDED +#define REASON_DATA_CHANGE IEC61850_REASON_DATA_CHANGE +#define REASON_QUALITY_CHANGE IEC61850_REASON_QUALITY_CHANGE +#define REASON_DATA_UPDATE IEC61850_REASON_DATA_UPDATE +#define REASON_INTEGRITY IEC61850_REASON_INTEGRITY +#define REASON_GI IEC61850_REASON_GI +#define REASON_UNKNOWN IEC61850_REASON_UNKNOWN + /* Element encoding mask values for ClientReportControlBlock */