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 24 namespace OHOS { 25 namespace UserIam { 26 namespace UserAuth { 27 class UserAuthCallbackService : public UserAuthCallbackStub { 28 public: 29 explicit UserAuthCallbackService(const std::shared_ptr<AuthenticationCallback> &impl); 30 explicit UserAuthCallbackService(const std::shared_ptr<IdentificationCallback> &impl); 31 ~UserAuthCallbackService() override = default; 32 void OnResult(int32_t result, const Attributes &extraInfo) override; 33 void OnAcquireInfo(int32_t module, int32_t acquireInfo, const Attributes &extraInfo) override; 34 35 private: 36 std::shared_ptr<AuthenticationCallback> authCallback_ {nullptr}; 37 std::shared_ptr<IdentificationCallback> identifyCallback_ {nullptr}; 38 std::shared_ptr<UserIam::UserAuth::IamHitraceHelper> iamHitraceHelper_ {nullptr}; 39 }; 40 41 class GetExecutorPropertyCallbackService : public GetExecutorPropertyCallbackStub { 42 public: 43 explicit GetExecutorPropertyCallbackService(const std::shared_ptr<GetPropCallback> &impl); 44 ~GetExecutorPropertyCallbackService() override = default; 45 void OnGetExecutorPropertyResult(int32_t result, const Attributes &attributes) override; 46 47 private: 48 std::shared_ptr<GetPropCallback> getPropCallback_ {nullptr}; 49 }; 50 51 class SetExecutorPropertyCallbackService : public SetExecutorPropertyCallbackStub { 52 public: 53 explicit SetExecutorPropertyCallbackService(const std::shared_ptr<SetPropCallback> &impl); 54 ~SetExecutorPropertyCallbackService() override = default; 55 void OnSetExecutorPropertyResult(int32_t result) override; 56 57 private: 58 std::shared_ptr<SetPropCallback> setPropCallback_ {nullptr}; 59 }; 60 } // namespace UserAuth 61 } // namespace UserIam 62 } // namespace OHOS 63 #endif // USER_AUTH_CALLBACK_SERVICE_H