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 #ifndef USER_AUTH_CALLBACK_SERVICE_H 17 #define USER_AUTH_CALLBACK_SERVICE_H 18 19 #include "user_auth_callback_stub.h" 20 21 #include "iam_hitrace_helper.h" 22 #include "user_auth_client_callback.h" 23 #include "user_auth_modal_client_callback.h" 24 25 namespace OHOS { 26 namespace UserIam { 27 namespace UserAuth { 28 class UserAuthCallbackService : public UserAuthCallbackStub { 29 public: 30 explicit UserAuthCallbackService(const std::shared_ptr<AuthenticationCallback> &impl); 31 explicit UserAuthCallbackService(const std::shared_ptr<AuthenticationCallback> &impl, 32 const std::shared_ptr<UserAuthModalClientCallback> &modalCallback); 33 explicit UserAuthCallbackService(const std::shared_ptr<IdentificationCallback> &impl); 34 explicit UserAuthCallbackService(const std::shared_ptr<PrepareRemoteAuthCallback> &impl); 35 ~UserAuthCallbackService() override; 36 void OnResult(int32_t result, const Attributes &extraInfo) override; 37 void OnAcquireInfo(int32_t module, int32_t acquireInfo, const Attributes &extraInfo) override; 38 39 private: 40 std::shared_ptr<AuthenticationCallback> authCallback_ {nullptr}; 41 std::shared_ptr<UserAuthModalClientCallback> modalCallback_ {nullptr}; 42 std::shared_ptr<IdentificationCallback> identifyCallback_ {nullptr}; 43 std::shared_ptr<PrepareRemoteAuthCallback> prepareRemoteAuthCallback_ {nullptr}; 44 std::shared_ptr<UserIam::UserAuth::IamHitraceHelper> iamHitraceHelper_ {nullptr}; 45 }; 46 47 class GetExecutorPropertyCallbackService : public GetExecutorPropertyCallbackStub { 48 public: 49 explicit GetExecutorPropertyCallbackService(const std::shared_ptr<GetPropCallback> &impl); 50 ~GetExecutorPropertyCallbackService() override; 51 void OnGetExecutorPropertyResult(int32_t result, const Attributes &attributes) override; 52 53 private: 54 std::shared_ptr<GetPropCallback> getPropCallback_ {nullptr}; 55 }; 56 57 class SetExecutorPropertyCallbackService : public SetExecutorPropertyCallbackStub { 58 public: 59 explicit SetExecutorPropertyCallbackService(const std::shared_ptr<SetPropCallback> &impl); 60 ~SetExecutorPropertyCallbackService() override; 61 void OnSetExecutorPropertyResult(int32_t result) override; 62 63 private: 64 std::shared_ptr<SetPropCallback> setPropCallback_ {nullptr}; 65 }; 66 } // namespace UserAuth 67 } // namespace UserIam 68 } // namespace OHOS 69 #endif // USER_AUTH_CALLBACK_SERVICE_H