/* * Copyright (c) 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 EXCECUTOR_H #define EXCECUTOR_H #include #include #include #include #include "nocopyable.h" #include "iasync_command.h" #include "iauth_executor_hdi.h" #include "iexecute_callback.h" #include "iexecutor_messenger.h" namespace OHOS { namespace UserIAM { namespace UserAuth { class Executor : public std::enable_shared_from_this, public NoCopyable { public: Executor(std::shared_ptr executorHdi, uint16_t hdiId); ~Executor() override = default; void OnHdiConnect(); void OnHdiDisconnect(); void OnFrameworkReady(); void SetExecutorMessenger(const sptr &messenger); sptr GetExecutorMessenger(); void AddCommand(std::shared_ptr command); void RemoveCommand(std::shared_ptr command); std::shared_ptr GetExecutorHdi(); const char *GetDescription(); private: void RegisterExecutorCallback(ExecutorInfo &executorInfo); void RespondCallbackOnDisconnect(); sptr executorMessenger_; std::recursive_mutex mutex_; std::set> command2Respond_; std::shared_ptr executorHdi_; std::string description_; uint16_t hdiId_; }; } // namespace UserAuth } // namespace UserIAM } // namespace OHOS #endif // EXCECUTOR_H