1 /* 2 * Copyright (c) 2021 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 HIVIEW_PLUGINS_EVENT_SERVICE_INCLUDE_SYS_EVENT_SERVICE_H 17 #define HIVIEW_PLUGINS_EVENT_SERVICE_INCLUDE_SYS_EVENT_SERVICE_H 18 #include <memory> 19 20 #include "event.h" 21 #include "sys_event_service_adapter.h" 22 #include "plugin.h" 23 #include "sys_event_db_mgr.h" 24 #include "event_json_parser.h" 25 26 namespace OHOS { 27 namespace HiviewDFX { 28 class SysEventStore : public Plugin { 29 public: 30 SysEventStore(); 31 ~SysEventStore(); 32 void OnLoad() override; 33 void OnUnload() override; 34 bool OnEvent(std::shared_ptr<Event>& event) override; 35 36 private: 37 std::shared_ptr<SysEvent> Convert2SysEvent(std::shared_ptr<Event>& event); 38 private: 39 std::shared_ptr<EventJsonParser> sysEventParser_ = nullptr; 40 std::unique_ptr<SysEventDbMgr> sysEventDbMgr_ = nullptr; 41 std::atomic<bool> hasLoaded_; 42 }; // SysEventService 43 } // namespace HiviewDFX 44 } // namespace OHOS 45 #endif // HIVIEW_PLUGINS_EVENT_SERVICE_INCLUDE_SYS_EVENT_SERVICE_H 46