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 /** 17 * @file user_auth_client_callback.h 18 * 19 * @brief Callback definitions returned by user auth client. 20 * @since 3.1 21 * @version 3.2 22 */ 23 24 #ifndef USER_AUTH_CLIENT_CALLBACK_H 25 #define USER_AUTH_CLIENT_CALLBACK_H 26 27 #include "attributes.h" 28 #include "iremote_broker.h" 29 #include "user_auth_client_defines.h" 30 31 namespace OHOS { 32 namespace UserIam { 33 namespace UserAuth { 34 class AuthenticationCallback { 35 public: 36 /** 37 * @brief The callback return authenticate acquire information. 38 * 39 * @param module Module of current acquire info. 40 * @param acquireInfo Acquire info needed to be pass in. 41 * @param extraInfo Other related information about authentication. 42 */ 43 virtual void OnAcquireInfo(int32_t module, uint32_t acquireInfo, const Attributes &extraInfo) = 0; 44 45 /** 46 * @brief The callback return authenticate result. 47 * 48 * @param result The result success or error code{@link ResultCode}. 49 * @param extraInfo Other related information about authentication. 50 */ 51 virtual void OnResult(int32_t result, const Attributes &extraInfo) = 0; 52 }; 53 54 class IdentificationCallback { 55 public: 56 /** 57 * @brief The callback return identification acquire information. 58 * 59 * @param module Module of current acquire info. 60 * @param acquireInfo Acquire info needed to be pass in. 61 * @param extraInfo Other related information about identification. 62 */ 63 virtual void OnAcquireInfo(int32_t module, uint32_t acquireInfo, const Attributes &extraInfo) = 0; 64 65 /** 66 * @brief The callback return identification result. 67 * 68 * @param result The result success or error code{@link ResultCode}. 69 * @param extraInfo Other related information about identification. 70 */ 71 virtual void OnResult(int32_t result, const Attributes &extraInfo) = 0; 72 }; 73 74 class GetPropCallback { 75 public: 76 /** 77 * @brief The callback return get property result. 78 * 79 * @param result The result success or error code{@link ResultCode}. 80 * @param extraInfo Other related information about get property. 81 */ 82 virtual void OnResult(int32_t result, const Attributes &extraInfo) = 0; 83 }; 84 85 class SetPropCallback { 86 public: 87 /** 88 * @brief The callback return set property result. 89 * 90 * @param result The result success or error code{@link ResultCode}. 91 * @param extraInfo Other related information about set property. 92 */ 93 virtual void OnResult(int32_t result, const Attributes &extraInfo) = 0; 94 }; 95 96 class AuthEventListenerInterface : public IRemoteBroker { 97 public: 98 /** 99 * @brief Notify the event of authencation success. 100 * 101 * @param userId The id of user who initiates authentication. 102 * @param authtype The authentication auth type{@link AuthType}. 103 * @param callerType The caller type who initiates authentication. 104 * @param callerName The caller name who initiates authentication. 105 */ 106 virtual void OnNotifyAuthSuccessEvent(int32_t userId, AuthType authtype, int32_t callerType, 107 std::string &callerName) = 0; 108 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.UserIam.UserAuth.EventListenerCallback"); 109 }; 110 111 class PrepareRemoteAuthCallback { 112 public: 113 /** 114 * @brief The callback return prepare remote auth result. 115 * 116 * @param result The result success or error code{@link ResultCode}. 117 */ 118 virtual void OnResult(int32_t result) = 0; 119 }; 120 } // namespace UserAuth 121 } // namespace UserIam 122 } // namespace OHOS 123 #endif // USER_AUTH_CLIENT_CALLBACK_H