LogObjectsBase
(FB)
FUNCTION_BLOCK ABSTRACT LogObjectsBase EXTENDS BACnet.BACnetServerPluginBase
Base class for logging objects default implementions (Trend_Log, Trend_Log_Multiple, Event_Log). It tries to provide a feature complete implementation for logging objects with a reasonable simple implementation.
Assumptions / provisions of LogObjectBase and derived: A.) All log data are stored in the file system, one file per object.
If large data volumes should be used (Buffer_Size) a high performance file system is recommended.
B.) no sophisticated Sequence / Total_Record_Count overflow handling needed - they simply overflow / wrap around
If those assumptions / provisions are not valid for your use case, a more sophisticated implementation is needed, for example based on database, in-memory-database etc.
BACstack log data are delivered as either IEC_BACNET_LOG_RECORD, IEC_BACNET_LOG_RECORD_MULTIPLE, or IEC_BACNET_EVENT_LOG_RECORD packed in a IEC_BACNET_PROPERTY_CONTENTS and are stored binary as is in one file per logging object.
Such a log file contains: 1.) file header 2.) 0..numRecords-1 log records
A log record in such a file consists of: 1.) log record header
sequence : IEC_BACNET_UNSIGNED
time stamp : IEC_BACNET_DATE_TIME
2.) log record data as C-structure 3.) actual number of records in file : IEC_BACNET_UNSIGNED
Reasons to do so: - SysFile write operations in append mode doesnt allow writing at file pos <> end for some platforms - reading the last record should be efficient (rewind from file end), for example to get last sequence number
If the number of records is supposed to be limited practically (Buffer_Size), then purge operations of the data files are needed (to get rid of old records). Those purge operations are done implicitely in the implementation. A purge operation basically copies the records - except the purged record(s) - to a temporary file, deletes the data file, copy/move the data file to the data file. For those purge operations it might be useful to choose a TempPath on a high speed file system (RAM file system). If TempPath <> PersistentPath the temporary file will be copied to the data file and deleted afterwards, otherwise the temporary file will be renamed to the data file.
The purge operations involve a significant performance degradation. In general this should not be an issue, because BACnet logging objects are designed to inform a BACnet management device (OWS/AWS) about “log buffer mostly full” via Notification_Threshold and notifications. The BACnet management device should read and clear the log buffer to avoid “log buffer full” situations which will cause loss of logging data anyway.
BACnetEventCallback
Files
DataFiles
LogObjectsBase.CreateDataFiles
(METH)LogObjectsBase.DataFileName
(METH)LogObjectsBase.ListDataFiles
(METH)LogObjectsBase.PurgeDataFile
(METH)LogObjectsBase.ReadNumberOfRecordsAndLastSequenceFromDataFile
(METH)LogObjectsBase.ReadNumberOfRecordsFromDataFile
(METH)LogObjectsBase.RemoveDataFiles
(METH)LogObjectsBase.RemoveUnusedDataFiles
(METH)LogObjectsBase.ResetDataFile
(METH)LogObjectsBase.WriteRecordContentToDataFile
(METH)
base
LogObjectsBase.FreeReadRangeResult
(METH)LogObjectsBase.GetBufferSize
(METH)LogObjectsBase.GetRecordsByPosition
(METH)LogObjectsBase.GetRecordsBySequence
(METH)LogObjectsBase.GetRecordsByTime
(METH)LogObjectsBase.GetStopWhenFull
(METH)LogObjectsBase.HardShutdown
(PROP)LogObjectsBase.Init
(METH)Logging
LogObjectsBase.LogDataFile
(METH)LogObjectsBase.LogFilePos
(METH)LogObjectsBase.LogFileSize
(METH)LogObjectsBase.LogFileSizeAndPos
(METH)LogObjectsBase.LogObjectAddrString
(METH)LogObjectsBase.LogObjectPropertyAddrString
(METH)LogObjectsBase.LogReadRangeResult
(METH)LogObjectsBase.LogRecord
(METH)LogObjectsBase.LogRecordContentInfo
(METH)
LogObjectsBase.MaxDataSize
(PROP)ObjectHandling
LogObjectsBase.ObjectType
(PROP)LogObjectsBase.PersistentPath
(PROP)LogObjectsBase.PostStopBACnetStack
(METH)LogObjectsBase.ReadRangeResultSetInfo
(METH)LogObjectsBase.ScanObjectsAndSetCallbackAttachments
(METH)LogObjectsBase.ServerDeviceId
(PROP)LogObjectsBase.SetCallbackAttachments
(METH)LogObjectsBase.SetReadCallbackAttachment
(METH)LogObjectsBase.SetWriteCallbackAttachment
(METH)LogObjectsBase.TempPath
(PROP)ToString
LogObjectsBase.UpdateObjectPropertiesFromDataFile
(METH)