• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 #include "fingerprint_auth_interface_service.h"
17 
18 #include <hdf_base.h>
19 
20 #include "executor_impl.h"
21 #include "iam_logger.h"
22 
23 #define LOG_LABEL OHOS::UserIam::Common::LABEL_FINGERPRINT_AUTH_IMPL
24 
25 namespace OHOS {
26 namespace HDI {
27 namespace FingerprintAuth {
FingerprintAuthInterfaceImplGetInstance(void)28 extern "C" IFingerprintAuthInterface *FingerprintAuthInterfaceImplGetInstance(void)
29 {
30     auto fingerprintAuthInterfaceService = new (std::nothrow) FingerprintAuthInterfaceService();
31     if (fingerprintAuthInterfaceService == nullptr) {
32         IAM_LOGE("fingerprintAuthInterfaceService is nullptr");
33         return nullptr;
34     }
35     return fingerprintAuthInterfaceService;
36 }
37 
FingerprintAuthInterfaceService()38 FingerprintAuthInterfaceService::FingerprintAuthInterfaceService()
39 {
40     auto executor = new (std::nothrow) ExecutorImpl();
41     if (executor == nullptr) {
42         IAM_LOGE("executor is nullptr");
43         return;
44     }
45     executorList_.push_back(sptr<IExecutor>(executor));
46 }
47 
GetExecutorList(std::vector<sptr<IExecutorV1_0>> & executorList)48 int32_t FingerprintAuthInterfaceService::GetExecutorList(std::vector<sptr<IExecutorV1_0>> &executorList)
49 {
50     IAM_LOGI("interface mock start");
51     for (auto executor : executorList_) {
52         executorList.push_back(executor);
53     }
54     IAM_LOGI("interface mock success");
55     return HDF_SUCCESS;
56 }
57 
GetExecutorListV1_1(std::vector<sptr<IExecutor>> & executorList)58 int32_t FingerprintAuthInterfaceService::GetExecutorListV1_1(std::vector<sptr<IExecutor>> &executorList)
59 {
60     IAM_LOGI("interface mock start");
61     executorList = executorList_;
62     IAM_LOGI("interface mock success");
63     return HDF_SUCCESS;
64 }
65 } // namespace FingerprintAuth
66 } // namespace HDI
67 } // namespace OHOS
68