• 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 "inputer_get_data_service.h"
17 
18 #include "iam_logger.h"
19 #include "iam_ptr.h"
20 #include "inputer_data_impl.h"
21 
22 #define LOG_LABEL OHOS::UserIam::Common::LABEL_PIN_AUTH_SDK
23 
24 namespace OHOS {
25 namespace UserIam {
26 namespace PinAuth {
InputerGetDataService(const std::shared_ptr<IInputer> & inputer)27 InputerGetDataService::InputerGetDataService(const std::shared_ptr<IInputer> &inputer) : inputer_(inputer)
28 {
29 }
30 
OnGetData(int32_t authSubType,const std::vector<uint8_t> & algoParameter,const sptr<InputerSetData> & inputerSetData,uint32_t algoVersion,bool isEnroll)31 void InputerGetDataService::OnGetData(int32_t authSubType, const std::vector<uint8_t> &algoParameter,
32     const sptr<InputerSetData> &inputerSetData, uint32_t algoVersion, bool isEnroll)
33 {
34     IAM_LOGI("start");
35     if (inputerSetData == nullptr) {
36         IAM_LOGE("inputerSetData is nullptr");
37         return;
38     }
39 
40     std::shared_ptr<IInputerData> sharedInputerData =
41         Common::MakeShared<InputerDataImpl>(algoParameter, inputerSetData, algoVersion, isEnroll);
42     if (sharedInputerData == nullptr) {
43         IAM_LOGE("sharedInputerData is nullptr");
44         return;
45     }
46     if (inputer_ == nullptr) {
47         IAM_LOGE("inputer is nullptr");
48         return;
49     }
50     inputer_->OnGetData(authSubType, sharedInputerData);
51 }
52 } // namespace PinAuth
53 } // namespace UserIam
54 } // namespace OHOS
55