• 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 #ifndef SYS_EVENT_SOURCE_H
17 #define SYS_EVENT_SOURCE_H
18 
19 #include <memory>
20 #include <string>
21 
22 #include "event_server.h"
23 #include "event_source.h"
24 #include "platform_monitor.h"
25 #include "sys_event_service_adapter.h"
26 
27 namespace OHOS {
28 namespace HiviewDFX {
29 class SysEventSource;
30 class SysEventReceiver : public EventReceiver {
31 public:
SysEventReceiver(SysEventSource & source)32     explicit SysEventReceiver(SysEventSource& source): eventSource(source) {};
~SysEventReceiver()33     ~SysEventReceiver() override {};
34     void HandlerEvent(std::shared_ptr<EventRaw::RawData> rawData) override;
35 private:
36     SysEventSource& eventSource;
37 };
38 
39 class SysEventSource : public EventSource, public SysEventServiceBase {
40 public:
41     void OnLoad() override;
42     void OnUnload() override;
43     void StartEventSource() override;
44     void Recycle(PipelineEvent *event) override;
45     void PauseDispatch(std::weak_ptr<Plugin> plugin) override;
46     bool PublishPipelineEvent(std::shared_ptr<PipelineEvent> event);
47 
48 private:
49     EventServer eventServer_;
50     PlatformMonitor platformMonitor_;
51 };
52 } // namespace HiviewDFX
53 } // namespace OHOS
54 #endif // SYS_EVENT_SOURCE_H