1 /* 2 * Copyright (c) 2022-2024 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_TAG "PIN_AUTH_SDK" 23 24 namespace OHOS { 25 namespace UserIam { 26 namespace PinAuth { InputerGetDataService(const std::shared_ptr<IInputer> & inputer)27InputerGetDataService::InputerGetDataService(const std::shared_ptr<IInputer> &inputer) : inputer_(inputer) 28 { 29 } 30 OnGetData(const InputerGetDataParam & getDataParam)31void InputerGetDataService::OnGetData(const InputerGetDataParam &getDataParam) 32 { 33 IAM_LOGI("start"); 34 if (getDataParam.inputerSetData == nullptr) { 35 IAM_LOGE("inputerSetData is nullptr"); 36 return; 37 } 38 39 std::shared_ptr<IInputerData> sharedInputerData = Common::MakeShared<InputerDataImpl>(getDataParam); 40 if (sharedInputerData == nullptr) { 41 IAM_LOGE("sharedInputerData is nullptr"); 42 return; 43 } 44 if (inputer_ == nullptr) { 45 IAM_LOGE("inputer is nullptr"); 46 return; 47 } 48 inputer_->OnGetData(getDataParam.authSubType, getDataParam.challenge, sharedInputerData); 49 } 50 } // namespace PinAuth 51 } // namespace UserIam 52 } // namespace OHOS 53