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 "all_in_one_executor_impl.h"
21 #include "iam_logger.h"
22 #include "iam_para2str.h"
23 
24 #undef LOG_TAG
25 #define LOG_TAG "FACE_AUTH_IMPL"
26 
27 namespace OHOS {
28 namespace HDI {
29 namespace FaceAuth {
FaceAuthInterfaceImplGetInstance(void)30 extern "C" IFaceAuthInterface *FaceAuthInterfaceImplGetInstance(void)
31 {
32     auto faceAuthInterfaceService = new (std::nothrow) FaceAuthInterfaceService();
33     if (faceAuthInterfaceService == nullptr) {
34         IAM_LOGE("faceAuthInterfaceService is nullptr");
35         return nullptr;
36     }
37     return faceAuthInterfaceService;
38 }
39 
FaceAuthInterfaceService()40 FaceAuthInterfaceService::FaceAuthInterfaceService()
41 {
42     auto executor = new (std::nothrow) AllInOneExecutorImpl();
43     if (executor == nullptr) {
44         IAM_LOGE("executor is nullptr");
45         return;
46     }
47     executorList_.push_back(sptr<IAllInOneExecutor>(executor));
48 }
49 
GetExecutorList(std::vector<sptr<IAllInOneExecutor>> & executorList)50 int32_t FaceAuthInterfaceService::GetExecutorList(std::vector<sptr<IAllInOneExecutor>> &executorList)
51 {
52     IAM_LOGI("interface mock start");
53     for (auto executor : executorList_) {
54         executorList.push_back(executor);
55     }
56     IAM_LOGI("interface mock success");
57     return HDF_SUCCESS;
58 }
59 
SetBufferProducer(const sptr<BufferProducerSequenceable> & bufferProducer)60 int32_t FaceAuthInterfaceService::SetBufferProducer(const sptr<BufferProducerSequenceable> &bufferProducer)
61 {
62     IAM_LOGI("interface mock start set buffer producer %{public}s",
63         UserIam::Common::GetPointerNullStateString(bufferProducer.GetRefPtr()).c_str());
64     return HDF_SUCCESS;
65 }
66 } // namespace FaceAuth
67 } // namespace HDI
68 } // namespace OHOS
69