- IED server: fixed bug in log service - old-entry and old-entry-time not updated

pull/331/head
Michael Zillgith 5 years ago
parent 42bb617841
commit dc22dc76ec

@ -81,6 +81,9 @@ LogInstance_create(LogicalNode* parentLN, const char* name);
LIB61850_INTERNAL void
LogInstance_setLogStorage(LogInstance* self, LogStorage logStorage);
LIB61850_INTERNAL void
LogInstance_updateStatus(LogInstance* self);
LIB61850_INTERNAL void
LogInstance_logSingleData(LogInstance* self, const char* dataRef, MmsValue* value, uint8_t flag);

@ -163,13 +163,21 @@ LogInstance_logEntryFinished(LogInstance* self, uint64_t entryID)
self->locked = false;
}
void
LogInstance_updateStatus(LogInstance* self)
{
if (self->logStorage) {
LogStorage_getOldestAndNewestEntries(self->logStorage, &(self->newEntryId), &(self->newEntryTime),
&(self->oldEntryId), &(self->oldEntryTime));
}
}
void
LogInstance_setLogStorage(LogInstance* self, LogStorage logStorage)
{
self->logStorage = logStorage;
LogStorage_getOldestAndNewestEntries(logStorage, &(self->newEntryId), &(self->newEntryTime),
&(self->oldEntryId), &(self->oldEntryTime));
LogInstance_updateStatus(self);
}
LogControl*
@ -357,6 +365,9 @@ updateLogStatusInLCB(LogControl* self)
LogInstance* logInstance = self->logInstance;
if (logInstance != NULL) {
LogInstance_updateStatus(logInstance);
MmsValue_setBinaryTime(self->oldEntrTm, logInstance->oldEntryTime);
MmsValue_setBinaryTime(self->newEntrTm, logInstance->newEntryTime);

@ -30,6 +30,12 @@ LogStorage_setMaxLogEntries(LogStorage self, int maxEntries)
self->maxLogEntries = maxEntries;
}
int
LogStorage_getMaxLogEntries(LogStorage self)
{
return self->maxLogEntries;
}
uint64_t
LogStorage_addEntry(LogStorage self, uint64_t timestamp)
{

@ -107,6 +107,16 @@ struct sLogStorage {
LIB61850_API void
LogStorage_setMaxLogEntries(LogStorage self, int maxEntries);
/**
* \brief Get the maximum allowed number of log entries for this log
*
* \param self the pointer of the LogStorage instance
*
* \return the maximum number of log entries
*/
LIB61850_API int
LogStorage_getMaxLogEntries(LogStorage self);
/**
* \brief Add an entry to the log
*

Loading…
Cancel
Save