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 "face_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_FACE_AUTH_IMPL 24 25 namespace OHOS { 26 namespace HDI { 27 namespace FaceAuth { FaceAuthInterfaceImplGetInstance(void)28extern "C" IFaceAuthInterface *FaceAuthInterfaceImplGetInstance(void) 29 { 30 auto faceAuthInterfaceService = new (std::nothrow) FaceAuthInterfaceService(); 31 if (faceAuthInterfaceService == nullptr) { 32 IAM_LOGE("faceAuthInterfaceService is nullptr"); 33 return nullptr; 34 } 35 return faceAuthInterfaceService; 36 } 37 FaceAuthInterfaceService()38FaceAuthInterfaceService::FaceAuthInterfaceService() 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)48int32_t FaceAuthInterfaceService::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)58int32_t FaceAuthInterfaceService::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 FaceAuth 66 } // namespace HDI 67 } // namespace OHOS 68