1 /*
2  * Copyright (c) 2024 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 #ifndef HIAPPEVENT_IMPL_H
17 #define HIAPPEVENT_IMPL_H
18 
19 #include <string>
20 #include <memory>
21 
22 #include "app_event_observer.h"
23 #include "common.h"
24 #include "hiappevent_base.h"
25 
26 namespace OHOS {
27 namespace CJSystemapi {
28 namespace HiAppEvent {
29 class HiAppEventImpl {
30 public:
31     std::shared_ptr<HiviewDFX::AppEventPack> appEventPack_;
32     static int Configure(bool disable, const std::string& maxStorage);
33     static int Write(std::shared_ptr<HiviewDFX::AppEventPack> eventPack);
34     static int64_t AddProcessor(const OHOS::HiviewDFX::HiAppEvent::ReportConfig& conf);
35     static int RemoveProcessor(int64_t processorId);
36     static int SetUserId(const std::string& name, const std::string& value);
37     static std::tuple<int, std::string> GetUserId(const std::string& name);
38     static int SetUserProperty(const std::string& name, const std::string& value);
39     static std::tuple<int, std::string> GetUserProperty(const std::string& name);
40     static void ClearData();
41     static std::tuple<int, int64_t> addWatcher(const std::string& name,
42                                                 const std::vector<HiviewDFX::HiAppEvent::AppEventFilter>& filters,
43                                                 const HiviewDFX::HiAppEvent::TriggerCondition& cond,
44                                                 void (*callbackOnTriggerRef)(int, int, int64_t),
45                                                 void (*callbackOnReceiveRef)(char*, CArrRetAppEventGroup));
46     static void removeWatcher(const std::string& name);
47     static int Load(const std::string& moduleName);
48 };
49 } // HiAppEvent
50 } // CJSystemapi
51 } // OHOS
52 
53 #endif