Line data Source code
1 : /*
2 : *
3 : * Copyright (c) 2021 Project CHIP Authors
4 : * Copyright (c) 2015-2017 Nest Labs, Inc.
5 : * All rights reserved.
6 : *
7 : * Licensed under the Apache License, Version 2.0 (the "License");
8 : * you may not use this file except in compliance with the License.
9 : * You may obtain a copy of the License at
10 : *
11 : * http://www.apache.org/licenses/LICENSE-2.0
12 : *
13 : * Unless required by applicable law or agreed to in writing, software
14 : * distributed under the License is distributed on an "AS IS" BASIS,
15 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 : * See the License for the specific language governing permissions and
17 : * limitations under the License.
18 : */
19 :
20 : /**
21 : * @file
22 : *
23 : * @brief
24 : * Management of the CHIP Event Logging.
25 : *
26 : */
27 : #pragma once
28 :
29 : #include "EventLoggingDelegate.h"
30 : #include "EventLoggingTypes.h"
31 : #include <access/SubjectDescriptor.h>
32 : #include <app/MessageDef/EventDataIB.h>
33 : #include <app/MessageDef/StatusIB.h>
34 : #include <app/ObjectList.h>
35 : #include <app/util/basic-types.h>
36 : #include <lib/core/TLVCircularBuffer.h>
37 : #include <lib/support/CHIPCounter.h>
38 : #include <messaging/ExchangeMgr.h>
39 : #include <platform/CHIPDeviceConfig.h>
40 : #include <system/SystemClock.h>
41 :
42 : /**
43 : * Events are stored in the LogStorageResources provided to
44 : * EventManagement::Init.
45 : *
46 : * A newly generated event will be placed in the lowest-priority (in practice
47 : * DEBUG) buffer, the one associated with the first LogStorageResource. If
48 : * there is no space in that buffer, space will be created by evicting the
49 : * oldest event currently in that buffer, until enough space is available.
50 : *
51 : * When an event is evicted from a buffer, there are two possibilities:
52 : *
53 : * 1) If the next LogStorageResource has a priority that is no higher than the
54 : * event's priority, the event will be moved to that LogStorageResource's
55 : * buffer. This may in turn require events to be evicted from that buffer.
56 : * 2) If the next LogStorageResource has a priority that is higher than the
57 : * event's priority, then the event is just dropped.
58 : *
59 : * This means that LogStorageResources at a given priority level are reserved
60 : * for events of that priority level or higher priority.
61 : *
62 : * As a simple example, assume there are only two priority levels, DEBUG and
63 : * CRITICAL, and two LogStorageResources with those priorities. In that case,
64 : * old CRITICAL events will not start getting dropped until both buffers are
65 : * full, while old DEBUG events will start getting dropped once the DEBUG
66 : * LogStorageResource buffer is full.
67 : */
68 :
69 : #define CHIP_CONFIG_EVENT_GLOBAL_PRIORITY PriorityLevel::Debug
70 :
71 : namespace chip {
72 : namespace app {
73 : inline constexpr const uint32_t kEventManagementProfile = 0x1;
74 : inline constexpr const uint32_t kFabricIndexTag = 0x1;
75 : inline constexpr size_t kMaxEventSizeReserve = 512;
76 : constexpr uint16_t kRequiredEventField =
77 : (1 << to_underlying(EventDataIB::Tag::kPriority)) | (1 << to_underlying(EventDataIB::Tag::kPath));
78 :
79 : /**
80 : * @brief
81 : * Internal event buffer, built around the TLV::TLVCircularBuffer
82 : */
83 :
84 : class CircularEventBuffer : public TLV::TLVCircularBuffer
85 : {
86 : public:
87 : /**
88 : * @brief
89 : * A constructor for the CircularEventBuffer (internal API).
90 : */
91 6 : CircularEventBuffer() : TLVCircularBuffer(nullptr, 0){};
92 :
93 : /**
94 : * @brief
95 : * A Init for the CircularEventBuffer (internal API).
96 : *
97 : * @param[in] apBuffer The actual storage to use for event storage.
98 : *
99 : * @param[in] aBufferLength The length of the \c apBuffer in bytes.
100 : *
101 : * @param[in] apPrev The pointer to CircularEventBuffer storing
102 : * events of lesser priority.
103 : *
104 : * @param[in] apNext The pointer to CircularEventBuffer storing
105 : * events of greater priority.
106 : *
107 : * @param[in] aPriorityLevel CircularEventBuffer priority level
108 : */
109 : void Init(uint8_t * apBuffer, uint32_t aBufferLength, CircularEventBuffer * apPrev, CircularEventBuffer * apNext,
110 : PriorityLevel aPriorityLevel);
111 :
112 : /**
113 : * @brief
114 : * A helper function that determines whether the event of
115 : * specified priority is final destination
116 : *
117 : * @param[in] aPriority Priority of the event.
118 : *
119 : * @retval true/false event's priority is same as current buffer's priority, otherwise, false
120 : */
121 : bool IsFinalDestinationForPriority(PriorityLevel aPriority) const;
122 :
123 787 : PriorityLevel GetPriority() { return mPriority; }
124 :
125 4934 : CircularEventBuffer * GetPreviousCircularEventBuffer() { return mpPrev; }
126 4723 : CircularEventBuffer * GetNextCircularEventBuffer() { return mpNext; }
127 :
128 313 : void SetRequiredSpaceforEvicted(size_t aRequiredSpace) { mRequiredSpaceForEvicted = aRequiredSpace; }
129 313 : size_t GetRequiredSpaceforEvicted() const { return mRequiredSpaceForEvicted; }
130 :
131 497 : ~CircularEventBuffer() override = default;
132 :
133 : private:
134 : CircularEventBuffer * mpPrev = nullptr; ///< A pointer CircularEventBuffer storing events less important events
135 : CircularEventBuffer * mpNext = nullptr; ///< A pointer CircularEventBuffer storing events more important events
136 :
137 : PriorityLevel mPriority = PriorityLevel::Invalid; ///< The buffer is the final bucket for events of this priority. Events of
138 : ///< lesser priority are dropped when they get bumped out of this buffer
139 :
140 : size_t mRequiredSpaceForEvicted = 0; ///< Required space for previous buffer to evict event to new buffer
141 :
142 : CHIP_ERROR OnInit(TLV::TLVWriter & writer, uint8_t *& bufStart, uint32_t & bufLen) override;
143 : };
144 :
145 : class CircularEventReader;
146 :
147 : /**
148 : * @brief
149 : * A CircularEventBufferWrapper which has a pointer to the "current CircularEventBuffer". When trying to locate next buffer,
150 : * if nothing left there update its CircularEventBuffer until the buffer with data has been found,
151 : * the tlv reader will have a pointer to this impl.
152 : */
153 : class CircularEventBufferWrapper : public TLV::TLVCircularBuffer
154 : {
155 : public:
156 870 : CircularEventBufferWrapper() : TLVCircularBuffer(nullptr, 0), mpCurrent(nullptr){};
157 : CircularEventBuffer * mpCurrent;
158 :
159 : private:
160 : CHIP_ERROR GetNextBuffer(chip::TLV::TLVReader & aReader, const uint8_t *& aBufStart, uint32_t & aBufLen) override;
161 : };
162 :
163 : enum class EventManagementStates
164 : {
165 : Idle = 1, // No log offload in progress, log offload can begin without any constraints
166 : InProgress = 2, // Log offload in progress
167 : Shutdown = 3 // Not capable of performing any logging operation
168 : };
169 :
170 : /**
171 : * @brief
172 : * A helper class used in initializing logging management.
173 : *
174 : * The class is used to encapsulate the resources allocated by the caller and denotes
175 : * resources to be used in logging events of a particular priority. Note that
176 : * while resources referring to the counters are used exclusively by the
177 : * particular priority level, the buffers are shared between `this` priority
178 : * level and events that are "more" important.
179 : */
180 :
181 : struct LogStorageResources
182 : {
183 : // TODO: Update TLVCircularBuffer with size_t for buffer size, then use ByteSpan
184 : uint8_t * mpBuffer =
185 : nullptr; // Buffer to be used as a storage at the particular priority level and shared with more important events.
186 : // Must not be nullptr. Must be large enough to accommodate the largest event emitted by the system.
187 : uint32_t mBufferSize = 0; ///< The size, in bytes, of the `mBuffer`.
188 : PriorityLevel mPriority =
189 : PriorityLevel::Invalid; // Log priority level associated with the resources provided in this structure.
190 : };
191 :
192 : /**
193 : * @brief
194 : * A class for managing the in memory event logs. See documentation at the
195 : * top of the file describing the eviction policy for events when there is no
196 : * more space for new events.
197 : */
198 :
199 : class EventManagement
200 : {
201 : public:
202 : /**
203 : * Initialize the EventManagement with an array of LogStorageResources and
204 : * an equal-length array of CircularEventBuffers that correspond to those
205 : * LogStorageResources. The array of LogStorageResources must provide a
206 : * resource for each valid priority level, the elements of the array must be
207 : * in increasing numerical value of priority (and in increasing priority);
208 : * the first element in the array corresponds to the resources allocated for
209 : * least important events, and the last element corresponds to the most
210 : * critical events.
211 : *
212 : * @param[in] apExchangeManager ExchangeManager to be used with this logging subsystem
213 : *
214 : * @param[in] aNumBuffers Number of elements in the apLogStorageResources
215 : * and apCircularEventBuffer arrays.
216 : *
217 : * @param[in] apCircularEventBuffer An array of CircularEventBuffer for each priority level.
218 : *
219 : * @param[in] apLogStorageResources An array of LogStorageResources for each priority level.
220 : *
221 : * @param[in] apEventNumberCounter A counter to use for event numbers.
222 : *
223 : * @param[in] aMonotonicStartupTime Time we should consider as "monotonic
224 : * time 0" for cases when we use
225 : * system-time event timestamps.
226 : *
227 : */
228 : void Init(Messaging::ExchangeManager * apExchangeManager, uint32_t aNumBuffers, CircularEventBuffer * apCircularEventBuffer,
229 : const LogStorageResources * const apLogStorageResources,
230 : MonotonicallyIncreasingCounter<EventNumber> * apEventNumberCounter,
231 : System::Clock::Milliseconds64 aMonotonicStartupTime);
232 :
233 : static EventManagement & GetInstance();
234 :
235 : /**
236 : * @brief Create EventManagement object and initialize the logging management
237 : * subsystem with provided resources.
238 : *
239 : * Initialize the EventManagement with an array of LogStorageResources. The
240 : * array must provide a resource for each valid priority level, the elements
241 : * of the array must be in increasing numerical value of priority (and in
242 : * decreasing priority); the first element in the array corresponds to the
243 : * resources allocated for the most critical events, and the last element
244 : * corresponds to the least important events.
245 : *
246 : * @param[in] apExchangeManager ExchangeManager to be used with this logging subsystem
247 : *
248 : * @param[in] aNumBuffers Number of elements in inLogStorageResources array
249 : *
250 : * @param[in] apCircularEventBuffer An array of CircularEventBuffer for each priority level.
251 : * @param[in] apLogStorageResources An array of LogStorageResources for each priority level.
252 : *
253 : * @param[in] apEventNumberCounter A counter to use for event numbers.
254 : *
255 : * @param[in] aMonotonicStartupTime Time we should consider as "monotonic
256 : * time 0" for cases when we use
257 : * system-time event timestamps.
258 : *
259 : * @note This function must be called prior to the logging being used.
260 : */
261 : static void
262 : CreateEventManagement(Messaging::ExchangeManager * apExchangeManager, uint32_t aNumBuffers,
263 : CircularEventBuffer * apCircularEventBuffer, const LogStorageResources * const apLogStorageResources,
264 : MonotonicallyIncreasingCounter<EventNumber> * apEventNumberCounter,
265 : System::Clock::Milliseconds64 aMonotonicStartupTime = System::SystemClock().GetMonotonicMilliseconds64());
266 :
267 : static void DestroyEventManagement();
268 :
269 : /**
270 : * @brief
271 : * Log an event via a EventLoggingDelegate, with options.
272 : *
273 : * The EventLoggingDelegate writes the event metadata and calls the `apDelegate`
274 : * with an TLV::TLVWriter reference so that the user code can emit
275 : * the event data directly into the event log. This form of event
276 : * logging minimizes memory consumption, as event data is serialized
277 : * directly into the target buffer. The event data MUST contain
278 : * context tags to be interpreted within the schema identified by
279 : * `ClusterID` and `EventId`. The tag of the first element will be
280 : * ignored; the event logging system will replace it with the
281 : * eventData tag.
282 : *
283 : * The event is logged if the schema priority exceeds the logging
284 : * threshold specified in the LoggingConfiguration. If the event's
285 : * priority does not meet the current threshold, it is dropped and
286 : * the function returns a `0` as the resulting event ID.
287 : *
288 : * This variant of the invocation permits the caller to set any
289 : * combination of `EventOptions`:
290 : * - timestamp, when 0 defaults to the current time at the point of
291 : * the call,
292 : * - "root" section of the event source (event source and cluster ID);
293 : * if NULL, it defaults to the current device. the event is marked as
294 : * relating to the device that is making the call,
295 : *
296 : * @param[in] apDelegate The EventLoggingDelegate to serialize the event data
297 : *
298 : * @param[in] aEventOptions The options for the event metadata.
299 : *
300 : * @param[out] aEventNumber The event Number if the event was written to the
301 : * log, 0 otherwise.
302 : *
303 : * @return CHIP_ERROR CHIP Error Code
304 : */
305 : CHIP_ERROR LogEvent(EventLoggingDelegate * apDelegate, const EventOptions & aEventOptions, EventNumber & aEventNumber);
306 :
307 : /**
308 : * @brief
309 : * A helper method to get tlv reader along with buffer has data from particular priority
310 : *
311 : * @param[in,out] aReader A reference to the reader that will be
312 : * initialized with the backing storage from
313 : * the event log
314 : *
315 : * @param[in] aPriority The starting priority for the reader.
316 : * Note that in this case the starting
317 : * priority is somewhat counter intuitive:
318 : * more important events share the buffers
319 : * with less priority events, in addition to
320 : * their dedicated buffers. As a result, the
321 : * reader will traverse the least data when
322 : * the Debug priority is passed in.
323 : *
324 : * @param[in] apBufWrapper CircularEventBufferWrapper
325 : * @return #CHIP_NO_ERROR Unconditionally.
326 : */
327 : CHIP_ERROR GetEventReader(chip::TLV::TLVReader & aReader, PriorityLevel aPriority,
328 : app::CircularEventBufferWrapper * apBufWrapper);
329 :
330 : /**
331 : * @brief
332 : * A function to retrieve events of specified priority since a specified event ID.
333 : *
334 : * Given a TLV::TLVWriter, an priority type, and an event ID, the
335 : * function will fetch events since the
336 : * specified event number. The function will continue fetching events until
337 : * it runs out of space in the TLV::TLVWriter or in the log. The function
338 : * will terminate the event writing on event boundary. The function would filter out event based upon interested path
339 : * specified by read/subscribe request.
340 : *
341 : * @param[in] aWriter The writer to use for event storage
342 : * @param[in] apEventPathList the interested EventPathParams list
343 : *
344 : * @param[in,out] aEventMin On input, the Event number is the one we're fetching. On
345 : * completion, the event number of the next one we plan to fetch.
346 : *
347 : * @param[out] aEventCount The number of fetched event
348 : * @param[in] aSubjectDescriptor Subject descriptor for current read handler
349 : * @retval #CHIP_END_OF_TLV The function has reached the end of the
350 : * available log entries at the specified
351 : * priority level
352 : *
353 : * @retval #CHIP_ERROR_NO_MEMORY The function ran out of space in the
354 : * aWriter, more events in the log are
355 : * available.
356 : *
357 : * @retval #CHIP_ERROR_BUFFER_TOO_SMALL The function ran out of space in the
358 : * aWriter, more events in the log are
359 : * available.
360 : *
361 : */
362 : CHIP_ERROR FetchEventsSince(chip::TLV::TLVWriter & aWriter, const ObjectList<EventPathParams> * apEventPathList,
363 : EventNumber & aEventMin, size_t & aEventCount,
364 : const Access::SubjectDescriptor & aSubjectDescriptor);
365 : /**
366 : * @brief brief Iterate all events and invalidate the fabric-sensitive events whose associated fabric has the given fabric
367 : * index.
368 : */
369 : CHIP_ERROR FabricRemoved(FabricIndex aFabricIndex);
370 :
371 : /**
372 : * @brief
373 : * Fetch the most recently vended Number for a particular priority level
374 : *
375 : * @return EventNumber most recently vended event Number for that event priority
376 : */
377 1024 : EventNumber GetLastEventNumber() const { return mLastEventNumber; }
378 :
379 : /**
380 : * @brief
381 : * IsValid returns whether the EventManagement instance is valid
382 : */
383 890 : bool IsValid(void) { return EventManagementStates::Shutdown != mState; };
384 :
385 : /**
386 : * Logger would save last logged event number and initial written event bytes number into schedule event number array
387 : */
388 : void SetScheduledEventInfo(EventNumber & aEventNumber, uint32_t & aInitialWrittenEventBytes) const;
389 :
390 : private:
391 : /**
392 : * @brief
393 : * Internal structure for traversing events.
394 : */
395 : struct EventEnvelopeContext
396 : {
397 4348 : EventEnvelopeContext() {}
398 :
399 : int mFieldsToRead = 0;
400 : /* PriorityLevel and DeltaTime are there if that is not first event when putting events in report*/
401 : #if CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
402 : Timestamp mCurrentTime = Timestamp::Epoch(System::Clock::kZero);
403 : #else // CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
404 : Timestamp mCurrentTime = Timestamp::System(System::Clock::kZero);
405 : #endif // CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
406 : PriorityLevel mPriority = PriorityLevel::First;
407 : ClusterId mClusterId = 0;
408 : EndpointId mEndpointId = 0;
409 : EventId mEventId = 0;
410 : EventNumber mEventNumber = 0;
411 : Optional<FabricIndex> mFabricIndex;
412 : };
413 :
414 : void VendEventNumber();
415 : CHIP_ERROR CalculateEventSize(EventLoggingDelegate * apDelegate, const EventOptions * apOptions, uint32_t & requiredSize);
416 : /**
417 : * @brief Helper function for writing event header and data according to event
418 : * logging protocol.
419 : *
420 : * @param[in,out] apContext EventLoadOutContext, initialized with stateful
421 : * information for the buffer. State is updated
422 : * and preserved by ConstructEvent using this context.
423 : *
424 : * @param[in] apDelegate The EventLoggingDelegate to serialize the event data
425 : *
426 : * @param[in] apOptions EventOptions describing timestamp and other tags
427 : * relevant to this event.
428 : *
429 : */
430 : CHIP_ERROR ConstructEvent(EventLoadOutContext * apContext, EventLoggingDelegate * apDelegate, const EventOptions * apOptions);
431 :
432 : // Internal function to log event
433 : CHIP_ERROR LogEventPrivate(EventLoggingDelegate * apDelegate, const EventOptions & aEventOptions, EventNumber & aEventNumber);
434 :
435 : /**
436 : * @brief copy the event outright to next buffer with higher priority
437 : *
438 : * @param[in] apEventBuffer CircularEventBuffer
439 : *
440 : */
441 : CHIP_ERROR CopyToNextBuffer(CircularEventBuffer * apEventBuffer);
442 :
443 : /**
444 : * @brief Ensure that:
445 : *
446 : * 1) There could be aRequiredSpace bytes available (if enough things were
447 : * evicted) in all buffers that can hold events with priority aPriority.
448 : *
449 : * 2) There are in fact aRequiredSpace bytes available in our
450 : * lowest-priority buffer. This might involve evicting some events to
451 : * higher-priority buffers or dropping them.
452 : *
453 : * @param[in] aRequiredSpace required space
454 : * @param[in] aPriority priority of the event we are making space for.
455 : *
456 : */
457 : CHIP_ERROR EnsureSpaceInCircularBuffer(size_t aRequiredSpace, PriorityLevel aPriority);
458 :
459 : /**
460 : * @brief Iterate the event elements inside event tlv and mark the fabric index as kUndefinedFabricIndex if
461 : * it matches the FabricIndex apFabricIndex points to.
462 : *
463 : * @param[in] aReader event tlv reader
464 : * @param[in] apFabricIndex A FabricIndex* pointing to the fabric index for which we want to effectively evict events.
465 : *
466 : */
467 : static CHIP_ERROR FabricRemovedCB(const TLV::TLVReader & aReader, size_t, void * apFabricIndex);
468 :
469 : /**
470 : * @brief
471 : * Internal API used to implement #FetchEventsSince
472 : *
473 : * Iterator function to used to copy an event from the log into a
474 : * TLVWriter. The included apContext contains the context of the copy
475 : * operation, including the TLVWriter that will hold the copy of an
476 : * event. If event cannot be written as a whole, the TLVWriter will
477 : * be rolled back to event boundary.
478 : *
479 : * @retval #CHIP_END_OF_TLV Function reached the end of the event
480 : * @retval #CHIP_ERROR_NO_MEMORY Function could not write a portion of
481 : * the event to the TLVWriter.
482 : * @retval #CHIP_ERROR_BUFFER_TOO_SMALL Function could not write a
483 : * portion of the event to the TLVWriter.
484 : */
485 : static CHIP_ERROR CopyEventsSince(const TLV::TLVReader & aReader, size_t aDepth, void * apContext);
486 :
487 : /**
488 : * @brief Internal iterator function used to scan and filter though event logs
489 : *
490 : * The function is used to scan through the event log to find events matching the spec in the supplied context.
491 : * Particularly, it would check against mStartingEventNumber, and skip fetched event.
492 : */
493 : static CHIP_ERROR EventIterator(const TLV::TLVReader & aReader, size_t aDepth, EventLoadOutContext * apEventLoadOutContext,
494 : EventEnvelopeContext * event);
495 :
496 : /**
497 : * @brief Internal iterator function used to fetch event into EventEnvelopeContext, then EventIterator would filter event
498 : * based upon EventEnvelopeContext
499 : *
500 : */
501 : static CHIP_ERROR FetchEventParameters(const TLV::TLVReader & aReader, size_t aDepth, void * apContext);
502 :
503 : /**
504 : * @brief Internal iterator function used to scan and filter though event logs
505 : * First event gets a timestamp, subsequent ones get a delta T
506 : * First event in the sequence gets a event number neatly packaged
507 : */
508 : static CHIP_ERROR CopyAndAdjustDeltaTime(const TLV::TLVReader & aReader, size_t aDepth, void * apContext);
509 :
510 : /**
511 : * @brief checking if the tail's event can be moved to higher priority, if not, dropped, if yes, note how much space it
512 : * requires, and return.
513 : */
514 : static CHIP_ERROR EvictEvent(chip::TLV::TLVCircularBuffer & aBuffer, void * apAppData, TLV::TLVReader & aReader);
515 0 : static CHIP_ERROR AlwaysFail(chip::TLV::TLVCircularBuffer & aBuffer, void * apAppData, TLV::TLVReader & aReader)
516 : {
517 0 : return CHIP_ERROR_NO_MEMORY;
518 : };
519 :
520 : /**
521 : * @brief Check whether the event instance represented by the EventEnvelopeContext should be included in the report.
522 : *
523 : * @retval CHIP_ERROR_UNEXPECTED_EVENT This path should be excluded in the generated event report.
524 : * @retval CHIP_EVENT_ID_FOUND This path should be included in the generated event report.
525 : * @retval CHIP_ERROR_ACCESS_DENIED This path should be included in the generated event report, but the client does not have
526 : * . enough privilege to access it.
527 : *
528 : * TODO: Consider using CHIP_NO_ERROR, CHIP_ERROR_SKIP_EVENT, CHIP_ERROR_ACCESS_DENINED or some enum to represent the checking
529 : * result.
530 : */
531 : static CHIP_ERROR CheckEventContext(EventLoadOutContext * eventLoadOutContext, const EventEnvelopeContext & event);
532 :
533 : /**
534 : * @brief copy event from circular buffer to target buffer for report
535 : */
536 : static CHIP_ERROR CopyEvent(const TLV::TLVReader & aReader, TLV::TLVWriter & aWriter, EventLoadOutContext * apContext);
537 :
538 : /**
539 : * @brief
540 : * A function to get the circular buffer for particular priority
541 : *
542 : * @param aPriority PriorityLevel
543 : *
544 : * @return A pointer for the CircularEventBuffer
545 : */
546 : CircularEventBuffer * GetPriorityBuffer(PriorityLevel aPriority) const;
547 :
548 : // EventBuffer for debug level,
549 : CircularEventBuffer * mpEventBuffer = nullptr;
550 : Messaging::ExchangeManager * mpExchangeMgr = nullptr;
551 : EventManagementStates mState = EventManagementStates::Shutdown;
552 : uint32_t mBytesWritten = 0;
553 :
554 : // The counter we're going to use for event numbers.
555 : MonotonicallyIncreasingCounter<EventNumber> * mpEventNumberCounter = nullptr;
556 :
557 : EventNumber mLastEventNumber = 0; ///< Last event Number vended
558 : Timestamp mLastEventTimestamp; ///< The timestamp of the last event in this buffer
559 :
560 : System::Clock::Milliseconds64 mMonotonicStartupTime;
561 : };
562 : } // namespace app
563 : } // namespace chip
|