nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer

#include <src/lib/profiles/data-management/Current/LoggingManagement.h>

Internal event buffer, built around the nl::Weave::TLV::WeaveCircularTLVBuffer.

Summary

Constructors and Destructors

CircularEventBuffer(uint8_t *inBuffer, size_t inBufferLength, CircularEventBuffer *inPrev, CircularEventBuffer *inNext)
A constructor for the CircularEventBuffer (internal API).

Public attributes

mBuffer
mEventIdCounter
mFirstEventID
mFirstEventTimestamp
mFirstEventUTCTimestamp
mImportance
mLastEventID
mLastEventTimestamp
mLastEventUTCTimestamp
mNext
mNonPersistedCounter
mPrev
mUTCInitialized
bool

Public functions

AddEvent(timestamp_t inEventTimestamp)
void
Given a timestamp of an event, compute the delta time to store in the log.
AddEventUTC(utc_timestamp_t inEventTimestamp)
void
Given a timestamp of an event, compute the delta utc time to store in the log.
IsFinalDestinationForImportance(ImportanceType inImportance) const
bool
A helper function that determines whether the event of specified importance is dropped from this buffer.
RemoveEvent(size_t aNumEvents)
void
VendEventID(void)
Allocate a new event ID based on the event importance, and advance the counter if we have one.

Public static functions

GetNextBufferFunct(nl::Weave::TLV::TLVReader & ioReader, uintptr_t & inBufHandle, const uint8_t *& outBufStart, uint32_t & outBufLen)

Public attributes

mBuffer

nl::Weave::TLV::WeaveCircularTLVBuffer nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mBuffer

mEventIdCounter

nl::Weave::MonotonicallyIncreasingCounter * nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mEventIdCounter

mFirstEventID

event_id_t nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mFirstEventID

mFirstEventTimestamp

timestamp_t nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mFirstEventTimestamp

mFirstEventUTCTimestamp

utc_timestamp_t nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mFirstEventUTCTimestamp

mImportance

ImportanceType nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mImportance

mLastEventID

event_id_t nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mLastEventID

mLastEventTimestamp

timestamp_t nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mLastEventTimestamp

mLastEventUTCTimestamp

utc_timestamp_t nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mLastEventUTCTimestamp

mNext

CircularEventBuffer * nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mNext

mNonPersistedCounter

nl::Weave::MonotonicallyIncreasingCounter nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mNonPersistedCounter

mPrev

CircularEventBuffer * nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mPrev

mUTCInitialized

bool nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mUTCInitialized

Public functions

AddEvent

void nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::AddEvent(
  timestamp_t inEventTimestamp
)

Given a timestamp of an event, compute the delta time to store in the log.

Details
Parameters
inEventTimestamp
The event timestamp.
Returns
int32_t Time delta to encode for the event.

AddEventUTC

void nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::AddEventUTC(
  utc_timestamp_t inEventTimestamp
)

Given a timestamp of an event, compute the delta utc time to store in the log.

Details
Parameters
inEventTimestamp
The event's utc timestamp
Returns
int64_t Time delta to encode for the event.

CircularEventBuffer

 nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::CircularEventBuffer(
  uint8_t *inBuffer,
  size_t inBufferLength,
  CircularEventBuffer *inPrev,
  CircularEventBuffer *inNext
)

A constructor for the CircularEventBuffer (internal API).

Details
Parameters
[in] inBuffer
The actual storage to use for event storage.
[in] inBufferLength
The length of the inBuffer in bytes.
[in] inPrev
The pointer to CircularEventBuffer storing events of lesser priority.
[in] inNext
The pointer to CircularEventBuffer storing events of greater priority.
Returns

IsFinalDestinationForImportance

bool nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::IsFinalDestinationForImportance(
  ImportanceType inImportance
) const 

A helper function that determines whether the event of specified importance is dropped from this buffer.

Details
Parameters
[in] inImportance
Importance of the event.
Return Values
true
The event will be dropped from this buffer as a result of queue overflow.
false
The event will be bumped to the next queue.

RemoveEvent

void nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::RemoveEvent(
  size_t aNumEvents
)

VendEventID

event_id_t nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::VendEventID(
  void
)

Allocate a new event ID based on the event importance, and advance the counter if we have one.

Details
Returns
event_id_t Event ID for this importance.

Public static functions

GetNextBufferFunct

WEAVE_ERROR nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::GetNextBufferFunct(
  nl::Weave::TLV::TLVReader & ioReader,
  uintptr_t & inBufHandle,
  const uint8_t *& outBufStart,
  uint32_t & outBufLen
)