- IEC 61850 client: handle reason code correctly when report contains data with different reason code (see github #133)

pull/147/head
Michael Zillgith 7 years ago
parent 0c44dc4e5c
commit 4cce81a044

@ -686,8 +686,6 @@ private_IedConnection_handleReport(IedConnection self, MmsValue* value)
if (hasReasonForInclusion) if (hasReasonForInclusion)
matchingReport->hasReasonForInclusion = true; matchingReport->hasReasonForInclusion = true;
int reasonForInclusionIndex = valueIndex + includedElements;
for (i = 0; i < dataSetSize; i++) { for (i = 0; i < dataSetSize; i++) {
if (MmsValue_getBitStringBit(inclusion, i) == true) { if (MmsValue_getBitStringBit(inclusion, i) == true) {
@ -710,10 +708,8 @@ private_IedConnection_handleReport(IedConnection self, MmsValue* value)
if (DEBUG_IED_CLIENT) if (DEBUG_IED_CLIENT)
printf("IED_CLIENT: update element value type: %i\n", MmsValue_getType(newElementValue)); printf("IED_CLIENT: update element value type: %i\n", MmsValue_getType(newElementValue));
valueIndex++;
if (hasReasonForInclusion) { if (hasReasonForInclusion) {
MmsValue* reasonForInclusion = MmsValue_getElement(value, reasonForInclusionIndex); MmsValue* reasonForInclusion = MmsValue_getElement(value, includedElements + valueIndex);
if ((reasonForInclusion == NULL) || (MmsValue_getType(reasonForInclusion) != MMS_BIT_STRING)) { if ((reasonForInclusion == NULL) || (MmsValue_getType(reasonForInclusion) != MMS_BIT_STRING)) {
if (DEBUG_IED_CLIENT) if (DEBUG_IED_CLIENT)
@ -736,6 +732,8 @@ private_IedConnection_handleReport(IedConnection self, MmsValue* value)
else { else {
matchingReport->reasonForInclusion[i] = IEC61850_REASON_UNKNOWN; matchingReport->reasonForInclusion[i] = IEC61850_REASON_UNKNOWN;
} }
valueIndex++;
} }
else { else {
matchingReport->reasonForInclusion[i] = IEC61850_REASON_NOT_INCLUDED; matchingReport->reasonForInclusion[i] = IEC61850_REASON_NOT_INCLUDED;

Loading…
Cancel
Save