1 /*
2  * Copyright (c) 2022-2024 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 PIN_AUTH_DRIVER_HDI
17 #define PIN_AUTH_DRIVER_HDI
18 
19 #include <mutex>
20 #include <vector>
21 
22 #include "nocopyable.h"
23 
24 #include "iam_executor_iauth_driver_hdi.h"
25 #include "iremote_broker.h"
26 #include "iam_executor_iauth_executor_hdi.h"
27 #include "pin_auth_interface_adapter.h"
28 #include "pin_auth_hdi.h"
29 
30 namespace OHOS {
31 namespace UserIam {
32 namespace PinAuth {
33 class PinAuthDriverHdi : public UserAuth::IAuthDriverHdi, public NoCopyable {
34 public:
35     explicit PinAuthDriverHdi(const std::shared_ptr<PinAuthInterfaceAdapter> &pinAuthInterfaceAdapter);
36     ~PinAuthDriverHdi() override = default;
37     void GetExecutorList(std::vector<std::shared_ptr<UserAuth::IAuthExecutorHdi>> &executorList) override;
38     void OnHdiDisconnect() override;
39 
40 private:
41     void GetAllInOneExecutorList(std::vector<std::shared_ptr<UserAuth::IAuthExecutorHdi>> &executorList,
42         std::vector<sptr<IAllInOneExecutor>> &iExecutorList);
43     void GetCollectorExecutorList(std::vector<std::shared_ptr<UserAuth::IAuthExecutorHdi>> &executorList,
44         std::vector<sptr<ICollector>> &iCollectorList);
45     void GetVerifierExecutorList(std::vector<std::shared_ptr<UserAuth::IAuthExecutorHdi>> &executorList,
46         std::vector<sptr<IVerifier>> &iVerifierList);
47 
48     const std::shared_ptr<PinAuthInterfaceAdapter> pinAuthInterfaceAdapter_;
49 };
50 } // PinAuth
51 } // UserIam
52 } // OHOS
53 
54 #endif // PIN_AUTH_DRIVER_HDI