Line data Source code
1 : /*
2 : *
3 : * Copyright (c) 2021 Project CHIP Authors
4 : *
5 : * Licensed under the Apache License, Version 2.0 (the "License");
6 : * you may not use this file except in compliance with the License.
7 : * You may obtain a copy of the License at
8 : *
9 : * http://www.apache.org/licenses/LICENSE-2.0
10 : *
11 : * Unless required by applicable law or agreed to in writing, software
12 : * distributed under the License is distributed on an "AS IS" BASIS,
13 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 : * See the License for the specific language governing permissions and
15 : * limitations under the License.
16 : */
17 :
18 : /**
19 : * @file
20 : * This file defines the classes corresponding to CHIP Interaction Model Event Generatorr Delegate.
21 : *
22 : */
23 :
24 : #pragma once
25 :
26 : #include <lib/core/TLV.h>
27 :
28 : namespace chip {
29 : namespace app {
30 : /**
31 : * An EventLoggingDelegate is used to fill event log data with cluster-specific information.
32 : *
33 : * Allows application to append any type of TLV data as part of an event log entry. Events
34 : * have a standard header applicable to all events and this class provides the
35 : * ability to add additional data past such standard header.
36 : */
37 : class EventLoggingDelegate
38 : {
39 : public:
40 104 : virtual ~EventLoggingDelegate() {}
41 :
42 : /**
43 : * @brief
44 : * A function that supplies eventData element for the event logging subsystem.
45 : *
46 : * Functions of this type are expected to provide the eventData
47 : * element for the event logging subsystem. The functions of this
48 : * type are called after the event subsystem has generated all
49 : * required event metadata. The function is called with a
50 : * chip::TLV::TLVWriter object into which it will emit a single TLV element
51 : * tagged kTag_EventData; the value of that element MUST be a
52 : * structure containing the event data. The event data itself must
53 : * be structured using context tags.
54 : *
55 : *
56 : * @param[in,out] aWriter A reference to the chip::TLV::TLVWriter object to be
57 : * used for event data serialization.
58 : *
59 : * @retval #CHIP_NO_ERROR On success.
60 : *
61 : * @retval other An appropriate error signaling to the
62 : * caller that the serialization of event
63 : * data could not be completed.
64 : *
65 : */
66 : virtual CHIP_ERROR WriteEvent(chip::TLV::TLVWriter & aWriter) = 0;
67 : };
68 : } // namespace app
69 : } // namespace chip
|