- IEC 61850 server: report service - combine quality and value change of a FCDO in the same report when model is locked (send data set entry with multiple reason-for-inclusion)

pull/239/head
Michael Zillgith 5 years ago
parent 3bf0e9a689
commit b3c5ecdcf2

@ -2873,6 +2873,8 @@ MmsMapping_triggerReportObservers(MmsMapping* self, MmsValue* value, int flag)
{ {
LinkedList element = self->reportControls; LinkedList element = self->reportControls;
bool modelLocked = self->isModelLocked;
while ((element = LinkedList_getNext(element)) != NULL) { while ((element = LinkedList_getNext(element)) != NULL) {
ReportControl* rc = (ReportControl*) element->data; ReportControl* rc = (ReportControl*) element->data;
@ -2899,12 +2901,14 @@ MmsMapping_triggerReportObservers(MmsMapping* self, MmsValue* value, int flag)
if (DataSet_isMemberValue(rc->dataSet, value, &index)) { if (DataSet_isMemberValue(rc->dataSet, value, &index)) {
bool modelLocked = self->isModelLocked;
ReportControl_valueUpdated(rc, index, flag, modelLocked); ReportControl_valueUpdated(rc, index, flag, modelLocked);
} }
} }
} }
if (modelLocked == false) {
Reporting_processReportEventsAfterUnlock(self);
}
} }
#endif /* (CONFIG_IEC61850_REPORT_SERVICE == 1) */ #endif /* (CONFIG_IEC61850_REPORT_SERVICE == 1) */

@ -2719,19 +2719,16 @@ sendNextReportEntrySegment(ReportControl* self)
else if (MmsValue_getBitStringBit(self->inclusionField, i)) { else if (MmsValue_getBitStringBit(self->inclusionField, i)) {
bsBuf[0] = 0; /* clear all bits */ bsBuf[0] = 0; /* clear all bits */
switch((int) *currentReportBufferPos) { uint8_t reasonForInclusion = *currentReportBufferPos;
case REPORT_CONTROL_QUALITY_CHANGED:
if (reasonForInclusion & REPORT_CONTROL_QUALITY_CHANGED)
MmsValue_setBitStringBit(&_reason, 2, true); MmsValue_setBitStringBit(&_reason, 2, true);
break;
case REPORT_CONTROL_VALUE_CHANGED: if (reasonForInclusion & REPORT_CONTROL_VALUE_CHANGED)
MmsValue_setBitStringBit(&_reason, 1, true); MmsValue_setBitStringBit(&_reason, 1, true);
break;
case REPORT_CONTROL_VALUE_UPDATE: if (reasonForInclusion & REPORT_CONTROL_VALUE_UPDATE)
MmsValue_setBitStringBit(&_reason, 3, true); MmsValue_setBitStringBit(&_reason, 3, true);
break;
default:
break;
}
isIncluded = true; isIncluded = true;
} }
@ -2971,9 +2968,13 @@ Reporting_processReportEventsAfterUnlock(MmsMapping* self)
ReportControl_lockNotify(rc); ReportControl_lockNotify(rc);
if ((rc->enabled) || (rc->isBuffering)) { if ((rc->enabled) || (rc->isBuffering)) {
copyValuesToReportBuffer(rc);
processEventsForReport(rc, currentTime); if (rc->triggered) {
copyValuesToReportBuffer(rc);
processEventsForReport(rc, currentTime);
}
} }
ReportControl_unlockNotify(rc); ReportControl_unlockNotify(rc);
@ -2985,7 +2986,7 @@ ReportControl_valueUpdated(ReportControl* self, int dataSetEntryIndex, int flag,
{ {
ReportControl_lockNotify(self); ReportControl_lockNotify(self);
if (self->inclusionFlags[dataSetEntryIndex] != 0) { /* report for this data set entry is already pending (bypass BufTm) */ if (self->inclusionFlags[dataSetEntryIndex] & flag) { /* report for this data set entry is already pending (bypass BufTm) */
self->reportTime = Hal_getTimeInMs(); self->reportTime = Hal_getTimeInMs();
if (modelLocked) { if (modelLocked) {
@ -2998,7 +2999,7 @@ ReportControl_valueUpdated(ReportControl* self, int dataSetEntryIndex, int flag,
if (modelLocked) { if (modelLocked) {
/* set flag to update values when report is to be sent or data model unlocked */ /* set flag to update values when report is to be sent or data model unlocked */
self->inclusionFlags[dataSetEntryIndex] = flag | REPORT_CONTROL_NOT_UPDATED; self->inclusionFlags[dataSetEntryIndex] = self->inclusionFlags[dataSetEntryIndex] | flag | REPORT_CONTROL_NOT_UPDATED;
} }
else { else {

Loading…
Cancel
Save