• 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 "v1_0/pin_auth_interface_service.h"
17 #include <hdf_base.h>
18 #include "iam_logger.h"
19 #include "iam_ptr.h"
20 #include "pin_auth.h"
21 #include "executor_impl.h"
22 
23 #define LOG_LABEL OHOS::UserIam::Common::LABEL_PIN_AUTH_HDI
24 
25 namespace OHOS {
26 namespace HDI {
27 namespace PinAuth {
28 namespace V1_0 {
PinAuthInterfaceImplGetInstance(void)29 extern "C" IPinAuthInterface *PinAuthInterfaceImplGetInstance(void)
30 {
31     auto pinAuthInterfaceService = new (std::nothrow) PinAuthInterfaceService();
32     if (pinAuthInterfaceService == nullptr) {
33         IAM_LOGE("pinAuthInterfaceService is nullptr");
34         return nullptr;
35     }
36     return pinAuthInterfaceService;
37 }
38 
GetExecutorList(std::vector<sptr<IExecutor>> & executorList)39 int32_t PinAuthInterfaceService::GetExecutorList(std::vector<sptr<IExecutor>> &executorList)
40 {
41     IAM_LOGI("start");
42     std::shared_ptr<OHOS::UserIam::PinAuth::PinAuth> pinHdi =
43         OHOS::UserIam::Common::MakeShared<OHOS::UserIam::PinAuth::PinAuth>();
44     if (pinHdi == nullptr) {
45         IAM_LOGE("Generate pinHdi failed");
46         return HDF_FAILURE;
47     }
48     sptr<IExecutor> executor = new (std::nothrow) ExecutorImpl(pinHdi);
49     if (executor == nullptr) {
50         IAM_LOGE("Generate executor failed");
51         return HDF_FAILURE;
52     }
53     executorList.push_back(executor);
54     IAM_LOGI("end");
55     return HDF_SUCCESS;
56 }
57 } // V1_0
58 } // PinAuth
59 } // HDI
60 } // OHOS