• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @addtogroup HiAppEvent
18  * @{
19  *
20  * @brief Provides application event logging functions.
21  *
22  * Provides the event logging function for applications to log the fault, statistical, security, and user behavior
23  * events reported during running. Based on event information, you will be able to analyze the running status of
24  * applications.
25  *
26  * @since 8
27  * @version 1.0
28  */
29 
30 /**
31  * @file hiappevent.h
32  *
33  * @brief Defines the application event logging functions of the HiAppEvent module.
34  *
35  * Before performing application event logging, you must construct a ParamList object to store the input
36  * event parameters and specify the event domain, event name, and event type.
37  *
38  * <p>Event domain: a string used to identify the domain of event logging.
39  * <p>Event name: a string used to identify the event name of event logging.
40  * <p>Event type: FAULT, STATISTIC, SECURITY, BEHAVIOR.
41  * <p>ParamList: a linked list used to store event parameters, each of which is comprised of the parameter name and
42  * parameter value.
43  *
44  * Sample code:
45  * 00 Including the header file:
46  * <pre>
47  *     #include "hiappevent/hiappevent.h"
48  * </pre>
49  * 01 create a ParamList pointer.
50  * <pre>
51  *     ParamList list = OH_HiAppEvent_CreateParamList();
52  * </pre>
53  * 02 add params to the ParamList.
54  * <pre>
55  *     bool boolean = true;
56  *     OH_HiAppEvent_AddBoolParam(list, "bool_key", boolean);
57  *     int32_t nums[] = {1, 2, 3};
58  *     OH_HiAppEvent_AddInt32ArrayParam(list, "int32_arr_key", nums, sizeof(nums) / sizeof(nums[0]));
59  * </pre>
60  * 03 performing event logging.
61  * <pre>
62  *     int res = OH_HiAppEvent_Write("test_domain", "test_event", BEHAVIOR, list);
63  * </pre>
64  * 04 destroy the ParamList pointer.
65  * <pre>
66  *     OH_HiAppEvent_DestroyParamList(list);
67  * </pre>
68  *
69  * @kit PerformanceAnalysisKit
70  * @library libhiappevent_ndk.z.so
71  * @syscap SystemCapability.HiviewDFX.HiAppEvent
72  * @since 8
73  * @version 1.0
74  */
75 
76 #ifndef HIVIEWDFX_HIAPPEVENT_H
77 #define HIVIEWDFX_HIAPPEVENT_H
78 
79 #include <stdbool.h>
80 #include <stdint.h>
81 
82 #include "hiappevent_cfg.h"
83 #include "hiappevent_event.h"
84 #include "hiappevent_param.h"
85 
86 #ifdef __cplusplus
87 extern "C" {
88 #endif
89 
90 /**
91  * @brief Defines error code
92  *
93  * @since 15
94  */
95 typedef enum {
96     /** @error The operation is successful. */
97     HIAPPEVENT_SUCCESS = 0,
98     /** @error Invalid param value */
99     HIAPPEVENT_INVALID_PARAM_VALUE = -9,
100     /** @error event config is null */
101     HIAPPEVENT_EVENT_CONFIG_IS_NULL = -10,
102 } HiAppEvent_ErrorCode;
103 
104 /**
105  * @brief Event types.
106  *
107  * You are advised to select event types based on their respective usage scenarios.
108  *
109  * @since 8
110  * @version 1.0
111  */
112 enum EventType {
113     /* Fault event type */
114     FAULT = 1,
115 
116     /* Statistic event type */
117     STATISTIC = 2,
118 
119     /* Security event type */
120     SECURITY = 3,
121 
122     /* Behavior event type */
123     BEHAVIOR = 4
124 };
125 
126 /**
127  * @brief The HiAppEvent_AppEventInfo structure is used to represent event information in an application, including
128  * the event's domain, name, type, and parameters.
129  *
130  * @SystemCapability.HiviewDFX.HiAppEvent
131  * @since 12
132  * @version 1.0
133  */
134 typedef struct HiAppEvent_AppEventInfo {
135     /* The domain of the event. */
136     const char* domain;
137     /* The name of the event. */
138     const char* name;
139     /* The type of the event. */
140     enum EventType type;
141     /* The json string of the parameter. */
142     const char* params;
143 } HiAppEvent_AppEventInfo;
144 
145 /**
146  * @brief The HiAppEvent_AppEventGroup structure represents a group of events in an application. It contains the name
147  * of the event group, an array of HiAppEvent_AppEventInfo structures representing individual events grouped by the
148  * name, and the length of the event array.
149  *
150  * @syscap SystemCapability.HiviewDFX.HiAppEvent
151  * @since 12
152  * @version 1.0
153  */
154 typedef struct HiAppEvent_AppEventGroup {
155     /* The name of the event. */
156     const char* name;
157     /* The event array which is group by the name. */
158     const struct HiAppEvent_AppEventInfo* appEventInfos;
159     /* The length of appEventInfos array. */
160     uint32_t infoLen;
161 } HiAppEvent_AppEventGroup;
162 
163 /**
164  * @brief Event param list node.
165  *
166  * @since 8
167  * @version 1.0
168  */
169 typedef struct ParamListNode* ParamList;
170 
171 /**
172  * @brief The HiAppEvent_Watcher structure is designed for event monitoring, allowing it to be invoked when the event
173  * occurs.
174  *
175  * @syscap SystemCapability.HiviewDFX.HiAppEvent
176  * @since 12
177  * @version 1.0
178  */
179 typedef struct HiAppEvent_Watcher HiAppEvent_Watcher;
180 
181 /**
182  * @brief The HiAppEvent_Config structure is designed for configuration.
183  *
184  * @since 15
185  */
186 typedef struct HiAppEvent_Config HiAppEvent_Config;
187 
188 /**
189  * @brief The OH_HiAppEvent_OnReceive function acts as the callback function for the HiAppEvent_Watcher. It is called
190  * when an event occurs.
191  *
192  * @SystemCapability.HiviewDFX.HiAppEvent
193  * @param domain The domain of the event.
194  * @param appEventGroups The event group by the domain.
195  * @param groupLen The length of appEventGroups array.
196  * @since 12
197  * @version 1.0
198  */
199 typedef void (*OH_HiAppEvent_OnReceive)(
200     const char* domain, const struct HiAppEvent_AppEventGroup* appEventGroups, uint32_t groupLen);
201 
202 /**
203  * @brief Called when watcher receive the event meet the condition.
204  *
205  * @SystemCapability.HiviewDFX.HiAppEvent
206  * @param row The row of events received by watcher.
207  * @param size The size of events received by watcher.
208  * @since 12
209  * @version 1.0
210  */
211 typedef void (*OH_HiAppEvent_OnTrigger)(int row, int size);
212 
213 /**
214  * @brief Called when watcher take the events.
215  *
216  * @SystemCapability.HiviewDFX.HiAppEvent
217  * @param events The event json string array.
218  * @param eventLen The length of events array.
219  * @since 12
220  * @version 1.0
221  */
222 typedef void (*OH_HiAppEvent_OnTake)(const char* const *events, uint32_t eventLen);
223 
224 /**
225  * @brief Create a pointer to the ParamList.
226  *
227  * @return Pointer to the ParamList.
228  * @since 8
229  * @version 1.0
230  */
231 ParamList OH_HiAppEvent_CreateParamList(void);
232 
233 /**
234  * @brief Destroy a pointer to the ParamList.
235  *
236  * @param list Event param list.
237  * @since 8
238  * @version 1.0
239  */
240 void OH_HiAppEvent_DestroyParamList(ParamList list);
241 
242 /**
243  * @brief Add bool param to the ParamList.
244  *
245  * @param list The ParamList of params to be added.
246  * @param name The name of the param to be added.
247  * @param boolean The bool value of the param to be added.
248  * @return ParamList after the param is added.
249  * @since 8
250  * @version 1.0
251  */
252 ParamList OH_HiAppEvent_AddBoolParam(ParamList list, const char* name, bool boolean);
253 
254 /**
255  * @brief Add bool array param to the ParamList.
256  *
257  * @param list The ParamList of params to be added.
258  * @param name The name of the param to be added.
259  * @param booleans The bool array value of the param to be added.
260  * @param arrSize The array size of the param to be added.
261  * @return ParamList after the param is added.
262  * @since 8
263  * @version 1.0
264  */
265 ParamList OH_HiAppEvent_AddBoolArrayParam(ParamList list, const char* name, const bool* booleans, int arrSize);
266 
267 /**
268  * @brief Add int8_t param to the ParamList.
269  *
270  * @param list The ParamList of params to be added.
271  * @param name The name of the param to be added.
272  * @param num The int8_t value of the param to be added.
273  * @return ParamList after the param is added.
274  * @since 8
275  * @version 1.0
276  */
277 ParamList OH_HiAppEvent_AddInt8Param(ParamList list, const char* name, int8_t num);
278 
279 /**
280  * @brief Add int8_t array param to the ParamList.
281  *
282  * @param list The ParamList of params to be added.
283  * @param name The name of the param to be added.
284  * @param nums The int8_t array value of the param to be added.
285  * @param arrSize The array size of the param to be added.
286  * @return ParamList after the param is added.
287  * @since 8
288  * @version 1.0
289  */
290 ParamList OH_HiAppEvent_AddInt8ArrayParam(ParamList list, const char* name, const int8_t* nums, int arrSize);
291 
292 /**
293  * @brief Add int16_t param to the ParamList.
294  *
295  * @param list The ParamList of params to be added.
296  * @param name The name of the param to be added.
297  * @param num The int16_t value of the param to be added.
298  * @return ParamList after the param is added.
299  * @since 8
300  * @version 1.0
301  */
302 ParamList OH_HiAppEvent_AddInt16Param(ParamList list, const char* name, int16_t num);
303 
304 /**
305  * @brief Add int16_t array param to the ParamList.
306  *
307  * @param list The ParamList of params to be added.
308  * @param name The name of the param to be added.
309  * @param nums The int16_t array value of the param to be added.
310  * @param arrSize The array size of the param to be added.
311  * @return ParamList after the param is added.
312  * @since 8
313  * @version 1.0
314  */
315 ParamList OH_HiAppEvent_AddInt16ArrayParam(ParamList list, const char* name, const int16_t* nums, int arrSize);
316 
317 /**
318  * @brief Add int32_t param to the ParamList.
319  *
320  * @param list The ParamList of params to be added.
321  * @param name The name of the param to be added.
322  * @param num The int32_t value of the param to be added.
323  * @return ParamList after the param is added.
324  * @since 8
325  * @version 1.0
326  */
327 ParamList OH_HiAppEvent_AddInt32Param(ParamList list, const char* name, int32_t num);
328 
329 /**
330  * @brief Add int32_t array param to the ParamList.
331  *
332  * @param list The ParamList of params to be added.
333  * @param name The name of the param to be added.
334  * @param nums The int32_t array value of the param to be added.
335  * @param arrSize The array size of the param to be added.
336  * @return ParamList after the param is added.
337  * @since 8
338  * @version 1.0
339  */
340 ParamList OH_HiAppEvent_AddInt32ArrayParam(ParamList list, const char* name, const int32_t* nums, int arrSize);
341 
342 /**
343  * @brief Add int64_t param to the ParamList.
344  *
345  * @param list The ParamList of params to be added.
346  * @param name The name of the param to be added.
347  * @param num The int64_t value of the param to be added.
348  * @return ParamList after the param is added.
349  * @since 8
350  * @version 1.0
351  */
352 ParamList OH_HiAppEvent_AddInt64Param(ParamList list, const char* name, int64_t num);
353 
354 /**
355  * @brief Add int64_t array param to the ParamList.
356  *
357  * @param list The ParamList of params to be added.
358  * @param name The name of the param to be added.
359  * @param nums The int64_t array value of the param to be added.
360  * @param arrSize The array size of the param to be added.
361  * @return ParamList after the param is added.
362  * @since 8
363  * @version 1.0
364  */
365 ParamList OH_HiAppEvent_AddInt64ArrayParam(ParamList list, const char* name, const int64_t* nums, int arrSize);
366 
367 /**
368  * @brief Add float param to the ParamList.
369  *
370  * @param list The ParamList of params to be added.
371  * @param name The name of the param to be added.
372  * @param num The float value of the param to be added.
373  * @return ParamList after the param is added.
374  * @since 8
375  * @version 1.0
376  */
377 ParamList OH_HiAppEvent_AddFloatParam(ParamList list, const char* name, float num);
378 
379 /**
380  * @brief Add float array param to the ParamList.
381  *
382  * @param list The ParamList of params to be added.
383  * @param name The name of the param to be added.
384  * @param nums The float array value of the param to be added.
385  * @param arrSize The array size of the param to be added.
386  * @return ParamList after the param is added.
387  * @since 8
388  * @version 1.0
389  */
390 ParamList OH_HiAppEvent_AddFloatArrayParam(ParamList list, const char* name, const float* nums, int arrSize);
391 
392 /**
393  * @brief Add double param to the ParamList.
394  *
395  * @param list The ParamList of params to be added.
396  * @param name The name of the param to be added.
397  * @param num The double value of the param to be added.
398  * @return ParamList after the param is added.
399  * @since 8
400  * @version 1.0
401  */
402 ParamList OH_HiAppEvent_AddDoubleParam(ParamList list, const char* name, double num);
403 
404 /**
405  * @brief Add double array param to the ParamList.
406  *
407  * @param list The ParamList of params to be added.
408  * @param name The name of the param to be added.
409  * @param nums The double array value of the param to be added.
410  * @param arrSize The array size of the param to be added.
411  * @return ParamList after the param is added.
412  * @since 8
413  * @version 1.0
414  */
415 ParamList OH_HiAppEvent_AddDoubleArrayParam(ParamList list, const char* name, const double* nums, int arrSize);
416 
417 /**
418  * @brief Add string param to the ParamList.
419  *
420  * @param list The ParamList of params to be added.
421  * @param name The name of the param to be added.
422  * @param str The string value of the param to be added.
423  * @return ParamList after the param is added.
424  * @since 8
425  * @version 1.0
426  */
427 ParamList OH_HiAppEvent_AddStringParam(ParamList list, const char* name, const char* str);
428 
429 /**
430  * @brief Add string array param to the ParamList.
431  *
432  * @param list The ParamList of params to be added.
433  * @param name The name of the param to be added.
434  * @param strs The string array value of the param to be added.
435  * @param arrSize The array size of the param to be added.
436  * @return ParamList after the param is added.
437  * @since 8
438  * @version 1.0
439  */
440 ParamList OH_HiAppEvent_AddStringArrayParam(ParamList list, const char* name, const char * const *strs, int arrSize);
441 
442 /**
443  * @brief Implements logging of application events whose parameters are of the list type.
444  *
445  * Before logging an application event, this API will first verify parameters of this event.
446  * If the verification is successful, the API will write the event to the event file.
447  *
448  * @param domain Indicates the event domain. You can customize the event domain as needed.
449  * @param name Indicates the event name. You can customize the event name as needed.
450  * @param type Indicates the event type, which is defined in {@link EventType}.
451  * @param list Indicates a linked list of event parameters, each of which is comprised of the parameter name and
452  * parameter value.
453  * @return Returns 0 if the event parameter verification is successful, and the event will be written to
454  * the event file; returns a positive integer if invalid parameters are present in the event, and
455  * the event will be written to the event file after the invalid parameters are ignored; returns a
456  * negative integer if the event parameter verification fails, and the event will not be written to the event file.
457  *         {@code 0} Parameters verification is successful.
458  *         {@code -1} Invalid event name.
459  *         {@code -4} Invalid event domain.
460  *         {@code -99} Function disabled.
461  *         {@code 1} Invalid event parameter name.
462  *         {@code 4} Invalid string length of the event parameter.
463  *         {@code 5} Invalid number of event parameters.
464  *         {@code 6} Invalid array length of the event parameter.
465  *         {@code 8} Duplicate parameter.
466  * @since 8
467  * @version 1.0
468  */
469 int OH_HiAppEvent_Write(const char* domain, const char* name, enum EventType type, const ParamList list);
470 
471 /**
472  * @brief Implements the configuration function of application events logging.
473  *
474  * Application event logging configuration interface, which is used to configure event logging switch,
475  * event file directory storage quota size and other functions.
476  *
477  * @param name Configuration item name.
478  * @param value Configuration item value.
479  * @return Returns true if configuration successful; returns false if configuration failed.
480  * @since 8
481  * @version 1.0
482  */
483 bool OH_HiAppEvent_Configure(const char* name, const char* value);
484 
485 /**
486  * @brief Create a HiAppEvent_Watcher handler pointer to set the property.
487  *
488  * @SystemCapability.HiviewDFX.HiAppEvent
489  * @param name The name of the watcher.
490  * @return Returns a pointer to the HiAppEvent_Watcher instance.
491  * @since 12
492  * @version 1.0
493  */
494 HiAppEvent_Watcher* OH_HiAppEvent_CreateWatcher(const char* name);
495 
496 /**
497  * @brief Destroy the specified HiAppEvent_Watcher handle resource.
498  *
499  * @SystemCapability.HiviewDFX.HiAppEvent
500  * @param watcher The pointer to the HiAppEvent_Watcher instance.
501  * @since 12
502  * @version 1.0
503  */
504 void OH_HiAppEvent_DestroyWatcher(HiAppEvent_Watcher* watcher);
505 
506 /**
507  * @brief The interface to set trigger conditions for the watcher. Three trigger conditions can be set through this
508  * interface and any of the condition which is set over than 0 met, the onTrigger callback set through
509  * OH_HiAppEvent_SetWatcherOnTrigger will be invoked.
510  *
511  * @SystemCapability.HiviewDFX.HiAppEvent
512  * @param watcher The pointer to the HiAppEvent_Watcher instance.
513  * @param row The row of write events that trigger the onTrigger callback.
514  * @param size The size of write events that trigger the onTrigger callback.
515  * @param timeOut The interval for trigger the onTrigger callback.
516  * @return Returns 0 if set TriggerCondition is successful, and returns a
517  * negative integer if set fail.
518  *         {@code 0} Success.
519  *         {@code -5} The watcher is nullptr.
520  * @since 12
521  * @version 1.0
522  */
523 int OH_HiAppEvent_SetTriggerCondition(HiAppEvent_Watcher* watcher, int row, int size, int timeOut);
524 
525 /**
526  * @brief The interface to set the AppEventFilter which defines the kind of app events will be received by  the watcher.
527  *
528  * @SystemCapability.HiviewDFX.HiAppEvent
529  * @param watcher The pointer to the HiAppEvent_Watcher instance.
530  * @param domain The name of the event domain to be monitored by the watcher.
531  * @param eventTypes The types of the events to be monitored by the watcher.0x08 means BEHAVIOR,0x04 means
532  * SECURITY, 0x02 means STATISTIC,0x01 means FAULT, 0xff and 0x00 means all.
533  * @param names The names of the events to be monitored by the watcher.
534  * @param namesLen The length of names array.
535  * @return Returns 0 if set AppEventFilter is successful, and returns a
536  * negative integer if set fail.
537  *         {@code 0} Success.
538  *         {@code -1} Invalid event name.
539  *         {@code -4} Invalid event domain.
540  *         {@code -5} The watcher is nullptr.
541  * @since 12
542  * @version 1.0
543  */
544 int OH_HiAppEvent_SetAppEventFilter(HiAppEvent_Watcher* watcher, const char* domain, uint8_t eventTypes,
545     const char* const *names, int namesLen);
546 
547 /**
548  * @brief The interface to set onTrigger callback for watcher. If the OnReceive callback is not be set or has been set
549  * to nullptr, the app events received by the watcher will be saved. When the new saved appEvents met the conditions set
550  * by OH_HiAppEvent_SetTriggerCondition, the onTrigger callback will be invoked.
551  *
552  * @SystemCapability.HiviewDFX.HiAppEvent
553  * @param watcher The pointer to the HiAppEvent_Watcher instance.
554  * @param onTrigger The callback of the watcher.
555  * @return Returns 0 if set OnTrigger is successful, and returns a
556  * negative integer if set fail.
557  *         {@code 0} Success.
558  *         {@code -5} The watcher is nullptr.
559  * @since 12
560  * @version 1.0
561  */
562 int OH_HiAppEvent_SetWatcherOnTrigger(HiAppEvent_Watcher* watcher, OH_HiAppEvent_OnTrigger onTrigger);
563 
564 /**
565  * @brief The interface to set onReceive callback for watcher. When the watcher received an app event, the onReceive
566  * callback set will be invoked.
567  *
568  * @SystemCapability.HiviewDFX.HiAppEvent
569  * @param watcher The pointer to the HiAppEvent_Watcher instance.
570  * @param onReceive The callback of the watcher.
571  * @return Returns 0 if set OnReceive is successful, and returns a
572  * negative integer if set fail.
573  *         {@code 0} Success.
574  *         {@code -5} The watcher is nullptr.
575  * @since 12
576  * @version 1.0
577  */
578 int OH_HiAppEvent_SetWatcherOnReceive(HiAppEvent_Watcher* watcher, OH_HiAppEvent_OnReceive onReceive);
579 
580 /**
581  * @brief The interface to take saved events data for the watcher.
582  *
583  * @SystemCapability.HiviewDFX.HiAppEvent
584  * @param watcher The pointer to the HiAppEvent_Watcher instance.
585  * @param eventNum The num of events to take.
586  * @param onTake The callback of the watcher.
587  * @return Returns 0 if take events is successful, and returns a
588  * negative integer if take fail.
589  *         {@code 0} Success.
590  *         {@code -5} The watcher is nullptr.
591  *         {@code -6} This interface must be called after OH_HiAppEvent_AddWatcher.
592  * @since 12
593  * @version 1.0
594  */
595 int OH_HiAppEvent_TakeWatcherData(HiAppEvent_Watcher* watcher, uint32_t eventNum, OH_HiAppEvent_OnTake onTake);
596 
597 /**
598  * @brief The interface to add the watcher. The watcher will start receiving app events after it is added.
599  *
600  * @SystemCapability.HiviewDFX.HiAppEvent
601  * @param watcher The pointer to the HiAppEvent_Watcher instance which receive the event.
602  * @return Returns 0 if add watcher is successful, and returns a
603  * negative integer if add fail.
604  *         {@code 0} Success.
605  *         {@code -5} The watcher is nullptr.
606  * @since 12
607  * @version 1.0
608  */
609 int OH_HiAppEvent_AddWatcher(HiAppEvent_Watcher* watcher);
610 
611 /**
612  * @brief The interface to remove the watcher. The watcher will stop receiving app events after it is removed.
613  *
614  * @SystemCapability.HiviewDFX.HiAppEvent
615  * @param watcher The pointer to the HiAppEvent_Watcher instance.
616  * @return Returns 0 if remove watcher is successful, and returns a
617  * negative integer if remove fail.
618  *         {@code 0} Success.
619  *         {@code -5} The watcher is nullptr.
620  *         {@code -6} This interface must be called after OH_HiAppEvent_AddWatcher.
621  * @since 12
622  * @version 1.0
623  */
624 int OH_HiAppEvent_RemoveWatcher(HiAppEvent_Watcher* watcher);
625 
626 /**
627  * @brief Clear all local saved event data of the application.
628  *
629  * @SystemCapability.HiviewDFX.HiAppEvent
630  * @since 12
631  * @version 1.0
632  */
633 void OH_HiAppEvent_ClearData();
634 
635 /**
636  * @brief Create a HiAppEvent_Config handler pointer to set the config.
637  *
638  * @return Returns a pointer to the HiAppEvent_Config instance.
639  * @since 15
640  */
641 HiAppEvent_Config* OH_HiAppEvent_CreateConfig(void);
642 
643 /**
644  * @brief Destroy the specified HiAppEvent_Config handle resource.
645  *
646  * @param config The pointer to the HiAppEvent_Config instance.
647  * @since 15
648  */
649 void OH_HiAppEvent_DestroyConfig(HiAppEvent_Config* config);
650 
651 /**
652  * @brief The interface to set item to the config.
653  *
654  * @param config The pointer to the HiAppEvent_Config instance.
655  * @param itemName The name of config item.
656  * @param itemValue The value of config item.
657  * @return set result.
658  *         {@link HIAPPEVENT_SUCCESS} The operation is successful.
659  *         {@link HIAPPEVENT_EVENT_CONFIG_IS_NULL} The event config is null.
660  *         {@link HIAPPEVENT_INVALID_PARAM_VALUE} The item is invalid.
661  * @since 15
662  */
663 int OH_HiAppEvent_SetConfigItem(HiAppEvent_Config* config, const char* itemName, const char* itemValue);
664 
665 /**
666  * @brief The interface to set the config.
667  *
668  * @param name The name of the os event.
669  * @param config The pointer to the HiAppEvent_Config instance.
670  * @return set result.
671  *         {@link HIAPPEVENT_SUCCESS} The operation is successful.
672  *         {@link HIAPPEVENT_INVALID_PARAM_VALUE} The config is invalid.
673  * @since 15
674  */
675 int OH_HiAppEvent_SetEventConfig(const char* name, HiAppEvent_Config* config);
676 #ifdef __cplusplus
677 }
678 #endif
679 /** @} */
680 #endif // HIVIEWDFX_HIAPPEVENT_H