- IED server: add support for tissue 807 (owner attribute in RCB is only present when ReportSettings@owner attribute is true)

pull/269/head
Michael Zillgith 5 years ago
parent 65ab70b6d0
commit 648a03c734

@ -107,6 +107,9 @@ typedef enum {
/** Report will be triggered by GI (general interrogation) request */ /** Report will be triggered by GI (general interrogation) request */
#define TRG_OPT_GI 16 #define TRG_OPT_GI 16
/** RCB has the owner attribute */
#define RPT_OPT_HAS_OWNER 64
/** Report will be triggered only on rising edge (transient variable */ /** Report will be triggered only on rising edge (transient variable */
#define TRG_OPT_TRANSIENT 128 #define TRG_OPT_TRANSIENT 128
/** @} */ /** @} */

@ -79,6 +79,8 @@ typedef struct {
int triggerOps; int triggerOps;
bool hasOwner; /* indicate that owner field is present */
/* information for segmented reporting */ /* information for segmented reporting */
bool segmented; /* indicates that a segmented report is in process */ bool segmented; /* indicates that a segmented report is in process */
int startIndexForNextSegment; /* start data set index for the next report segment */ int startIndexForNextSegment; /* start data set index for the next report segment */

@ -122,6 +122,7 @@ ReportControl_create(bool buffered, LogicalNode* parentLN, int reportBufferSize,
self->timeOfEntry = NULL; self->timeOfEntry = NULL;
self->reservationTimeout = 0; self->reservationTimeout = 0;
self->triggerOps = 0; self->triggerOps = 0;
self->hasOwner = false;
#if (CONFIG_MMS_THREADLESS_STACK != 1) #if (CONFIG_MMS_THREADLESS_STACK != 1)
self->createNotificationsMutex = Semaphore_create(1); self->createNotificationsMutex = Semaphore_create(1);
@ -675,12 +676,12 @@ createUnbufferedReportControlBlock(ReportControlBlock* reportControlBlock,
mmsValue->deleteValue = false; mmsValue->deleteValue = false;
mmsValue->type = MMS_STRUCTURE; mmsValue->type = MMS_STRUCTURE;
int structSize; int structSize = 11;
if (reportControl->server->edition >= IEC_61850_EDITION_2) if (reportControl->server->edition >= IEC_61850_EDITION_2) {
if (reportControl->hasOwner)
structSize = 12; structSize = 12;
else }
structSize = 11;
mmsValue->value.structure.size = structSize; mmsValue->value.structure.size = structSize;
mmsValue->value.structure.components = (MmsValue**) GLOBAL_CALLOC(structSize, sizeof(MmsValue*)); mmsValue->value.structure.components = (MmsValue**) GLOBAL_CALLOC(structSize, sizeof(MmsValue*));
@ -783,6 +784,8 @@ createUnbufferedReportControlBlock(ReportControlBlock* reportControlBlock,
mmsValue->value.structure.components[10] = MmsValue_newBoolean(false); mmsValue->value.structure.components[10] = MmsValue_newBoolean(false);
if (reportControl->server->edition >= IEC_61850_EDITION_2) { if (reportControl->server->edition >= IEC_61850_EDITION_2) {
if (reportControl->hasOwner) {
namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification)); namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification));
namedVariable->name = StringUtils_copyString("Owner"); namedVariable->name = StringUtils_copyString("Owner");
namedVariable->type = MMS_OCTET_STRING; namedVariable->type = MMS_OCTET_STRING;
@ -800,6 +803,7 @@ createUnbufferedReportControlBlock(ReportControlBlock* reportControlBlock,
MmsValue_setOctetString(mmsValue->value.structure.components[11], reportControlBlock->clientReservation + 1, 16); MmsValue_setOctetString(mmsValue->value.structure.components[11], reportControlBlock->clientReservation + 1, 16);
} }
} }
}
reportControl->rcbValues = mmsValue; reportControl->rcbValues = mmsValue;
@ -828,6 +832,7 @@ createBufferedReportControlBlock(ReportControlBlock* reportControlBlock,
brcbElementCount++; brcbElementCount++;
#endif #endif
if (reportControl->hasOwner)
brcbElementCount++; brcbElementCount++;
} }
@ -955,6 +960,9 @@ createBufferedReportControlBlock(ReportControlBlock* reportControlBlock,
int currentIndex = 13; int currentIndex = 13;
#if (CONFIG_IEC61850_BRCB_WITH_RESVTMS == 1) #if (CONFIG_IEC61850_BRCB_WITH_RESVTMS == 1)
int resvTmsIndex = currentIndex;
namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification)); namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification));
namedVariable->name = StringUtils_copyString("ResvTms"); namedVariable->name = StringUtils_copyString("ResvTms");
namedVariable->type = MMS_INTEGER; namedVariable->type = MMS_INTEGER;
@ -964,6 +972,7 @@ createBufferedReportControlBlock(ReportControlBlock* reportControlBlock,
currentIndex++; currentIndex++;
#endif /* (CONFIG_IEC61850_BRCB_WITH_RESVTMS == 1) */ #endif /* (CONFIG_IEC61850_BRCB_WITH_RESVTMS == 1) */
if (reportControl->hasOwner) {
namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification)); namedVariable = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification));
namedVariable->name = StringUtils_copyString("Owner"); namedVariable->name = StringUtils_copyString("Owner");
namedVariable->type = MMS_OCTET_STRING; namedVariable->type = MMS_OCTET_STRING;
@ -980,9 +989,10 @@ createBufferedReportControlBlock(ReportControlBlock* reportControlBlock,
reportControl->resvTms = -1; reportControl->resvTms = -1;
MmsValue_setOctetString(mmsValue->value.structure.components[currentIndex], reportControlBlock->clientReservation + 1, 16); MmsValue_setOctetString(mmsValue->value.structure.components[currentIndex], reportControlBlock->clientReservation + 1, 16);
} }
}
#if (CONFIG_IEC61850_BRCB_WITH_RESVTMS == 1) #if (CONFIG_IEC61850_BRCB_WITH_RESVTMS == 1)
MmsValue_setInt16(mmsValue->value.structure.components[13], reportControl->resvTms); MmsValue_setInt16(mmsValue->value.structure.components[resvTmsIndex], reportControl->resvTms);
#endif #endif
} }
@ -1045,6 +1055,9 @@ Reporting_createMmsBufferedRCBs(MmsMapping* self, MmsDomain* domain,
ReportControlBlock* reportControlBlock = getRCBForLogicalNodeWithIndex( ReportControlBlock* reportControlBlock = getRCBForLogicalNodeWithIndex(
self, logicalNode, currentReport, true); self, logicalNode, currentReport, true);
if (reportControlBlock->trgOps & RPT_OPT_HAS_OWNER)
rc->hasOwner = true;
rc->name = StringUtils_createString(3, logicalNode->name, "$BR$", rc->name = StringUtils_createString(3, logicalNode->name, "$BR$",
reportControlBlock->name); reportControlBlock->name);
@ -1082,6 +1095,9 @@ Reporting_createMmsUnbufferedRCBs(MmsMapping* self, MmsDomain* domain,
ReportControlBlock* reportControlBlock = getRCBForLogicalNodeWithIndex( ReportControlBlock* reportControlBlock = getRCBForLogicalNodeWithIndex(
self, logicalNode, currentReport, false); self, logicalNode, currentReport, false);
if (reportControlBlock->trgOps & RPT_OPT_HAS_OWNER)
rc->hasOwner = true;
rc->name = StringUtils_createString(3, logicalNode->name, "$RP$", rc->name = StringUtils_createString(3, logicalNode->name, "$RP$",
reportControlBlock->name); reportControlBlock->name);
@ -1127,7 +1143,7 @@ updateOwner(ReportControl* rc, MmsServerConnection connection)
{ {
rc->clientConnection = connection; rc->clientConnection = connection;
if (rc->server->edition >= IEC_61850_EDITION_2) { if (rc->server->edition >= IEC_61850_EDITION_2 && rc->hasOwner) {
MmsValue* owner = ReportControl_getRCBValue(rc, "Owner"); MmsValue* owner = ReportControl_getRCBValue(rc, "Owner");

Loading…
Cancel
Save