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 "all_in_one_executor_impl.h" 21 #include "iam_logger.h" 22 23 #undef LOG_TAG 24 #define LOG_TAG "FINGERPRINT_AUTH_IMPL" 25 26 namespace OHOS { 27 namespace HDI { 28 namespace FingerprintAuth { FingerprintAuthInterfaceImplGetInstance(void)29extern "C" IFingerprintAuthInterface *FingerprintAuthInterfaceImplGetInstance(void) 30 { 31 auto fingerprintAuthInterfaceService = new (std::nothrow) FingerprintAuthInterfaceService(); 32 if (fingerprintAuthInterfaceService == nullptr) { 33 IAM_LOGE("fingerprintAuthInterfaceService is nullptr"); 34 return nullptr; 35 } 36 return fingerprintAuthInterfaceService; 37 } 38 FingerprintAuthInterfaceService()39FingerprintAuthInterfaceService::FingerprintAuthInterfaceService() 40 { 41 auto executor = new (std::nothrow) AllInOneExecutorImpl(); 42 if (executor == nullptr) { 43 IAM_LOGE("executor is nullptr"); 44 return; 45 } 46 executorList_.push_back(sptr<IAllInOneExecutor>(executor)); 47 } 48 GetExecutorList(std::vector<sptr<IAllInOneExecutor>> & executorList)49int32_t FingerprintAuthInterfaceService::GetExecutorList(std::vector<sptr<IAllInOneExecutor>> &executorList) 50 { 51 IAM_LOGI("interface mock start"); 52 for (auto executor : executorList_) { 53 executorList.push_back(executor); 54 } 55 IAM_LOGI("interface mock success"); 56 return HDF_SUCCESS; 57 } 58 } // namespace FingerprintAuth 59 } // namespace HDI 60 } // namespace OHOS 61