• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 #ifndef HISYSEVENT_INTERFACES_NATIVE_INNERKITS_HISYSEVENT_MANAGER_INCLUDE_HISYSEVENT_MANAGER_C_H
16 #define HISYSEVENT_INTERFACES_NATIVE_INNERKITS_HISYSEVENT_MANAGER_INCLUDE_HISYSEVENT_MANAGER_C_H
17 
18 #include "hisysevent_record_c.h"
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 #define MAX_NUMBER_OF_EVENT_LIST 10
25 
26 /**
27  * @brief Define the argument of the query.
28  */
29 struct HiSysEventQueryArg {
30     int64_t beginTime;
31     int64_t endTime;
32     int32_t maxEvents;
33 };
34 typedef struct HiSysEventQueryArg HiSysEventQueryArg;
35 
36 /**
37  * @brief Define the rule of the query.
38  */
39 struct HiSysEventQueryRule {
40     char domain[MAX_LENGTH_OF_EVENT_DOMAIN];
41     char eventList[MAX_NUMBER_OF_EVENT_LIST][MAX_LENGTH_OF_EVENT_NAME];
42     size_t eventListSize;
43     char* condition;
44 };
45 typedef struct HiSysEventQueryRule HiSysEventQueryRule;
46 
47 /**
48  * @brief Define the callback of the query.
49  */
50 struct HiSysEventQueryCallback {
51     void (*OnQuery)(HiSysEventRecord records[], size_t size);
52     void (*OnComplete)(int32_t reason, int32_t total);
53 };
54 typedef struct HiSysEventQueryCallback HiSysEventQueryCallback;
55 
56 /**
57  * @brief Query event.
58  * @param arg      arg of query.
59  * @param rules    rules of query.
60  * @param ruleSize rules size of query.
61  * @param callback callback of query.
62  * @return 0 means success, others means failure.
63  */
64 int OH_HiSysEvent_Query(const HiSysEventQueryArg& arg, HiSysEventQueryRule rules[], size_t ruleSize,
65     HiSysEventQueryCallback& callback);
66 
67 #ifdef __cplusplus
68 }
69 #endif
70 #endif // HISYSEVENT_INTERFACES_NATIVE_INNERKITS_HISYSEVENT_MANAGER_INCLUDE_HISYSEVENT_MANAGER_C_H
71