/* * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef HISYSEVENT_DELEGATE_H #define HISYSEVENT_DELEGATE_H #include #include #include #include "hisysevent_base_listener.h" #include "hisysevent_base_query_callback.h" #include "hisysevent_listener_proxy.h" #include "hisysevent_listenning_operate.h" #include "hisysevent_manager.h" #include "sys_event_query_rule.h" #include "sys_event_rule.h" #include "system_ability_definition.h" namespace OHOS { namespace HiviewDFX { class HiSysEventDelegate : public HiSysEventListenningOperate { public: HiSysEventDelegate() {} virtual ~HiSysEventDelegate(); public: static void BinderFunc(); public: int32_t AddListener(const std::shared_ptr listener, const std::vector& rules); int32_t RemoveListener(const std::shared_ptr listener); int32_t Query(const struct QueryArg& arg, const std::vector& rules, const std::shared_ptr callback) const; int32_t SetDebugMode(const std::shared_ptr listener, const bool mode); int64_t Export(const struct QueryArg& arg, const std::vector& rules) const; int64_t Subscribe(const std::vector& rules) const; int32_t Unsubscribe() const; private: void ConvertListenerRule(const std::vector& rules, std::vector& sysRules) const; void ConvertQueryRule(const std::vector& rules, std::vector& sysRules) const; sptr GetSysEventService() const; bool CreateHiviewDir() const; bool SetDirPermission() const; private: sptr spListenerCallBack = nullptr; }; } // namespace HiviewDFX } // namespace OHOS #endif // HISYSEVENT_DELEGATE_H