mirror of
https://github.com/openharmony/useriam_user_auth.git
synced 2026-07-19 14:23:34 -04:00
fced1270dd
Signed-off-by: Tianshi Liu <tianshi.liu@huawei.com> Change-Id: I9672b23d4765122983190b1e5887d7cd7c537dc6
63 lines
2.0 KiB
C++
63 lines
2.0 KiB
C++
/*
|
|
* 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 <cstdint>
|
|
#include <mutex>
|
|
#include <set>
|
|
#include <string>
|
|
|
|
#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<Executor>, public NoCopyable {
|
|
public:
|
|
Executor(std::shared_ptr<IAuthExecutorHdi> executorHdi, uint16_t hdiId);
|
|
~Executor() override = default;
|
|
|
|
void OnHdiConnect();
|
|
void OnHdiDisconnect();
|
|
void OnFrameworkReady();
|
|
void SetExecutorMessenger(const sptr<AuthResPool::IExecutorMessenger> &messenger);
|
|
sptr<AuthResPool::IExecutorMessenger> GetExecutorMessenger();
|
|
void AddCommand(std::shared_ptr<IAsyncCommand> command);
|
|
void RemoveCommand(std::shared_ptr<IAsyncCommand> command);
|
|
std::shared_ptr<IAuthExecutorHdi> GetExecutorHdi();
|
|
const char *GetDescription();
|
|
|
|
private:
|
|
void RegisterExecutorCallback(ExecutorInfo &executorInfo);
|
|
void RespondCallbackOnDisconnect();
|
|
sptr<AuthResPool::IExecutorMessenger> executorMessenger_;
|
|
std::recursive_mutex mutex_;
|
|
std::set<std::shared_ptr<IAsyncCommand>> command2Respond_;
|
|
std::shared_ptr<IAuthExecutorHdi> executorHdi_;
|
|
std::string description_;
|
|
uint16_t hdiId_;
|
|
};
|
|
} // namespace UserAuth
|
|
} // namespace UserIAM
|
|
} // namespace OHOS
|
|
|
|
#endif // EXCECUTOR_H
|