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 co_auth_client_callback.h 18 * 19 * @brief Callback definitions returned by coAuth client. 20 * @since 3.1 21 * @version 3.2 22 */ 23 24 #ifndef CO_AUTH_CLIENT_CALLBACK_H 25 #define CO_AUTH_CLIENT_CALLBACK_H 26 27 #include "attributes.h" 28 #include "co_auth_client_defines.h" 29 30 namespace OHOS { 31 namespace UserIam { 32 namespace UserAuth { 33 class ExecutorRegisterCallback { 34 public: 35 /** 36 * @brief Called by the coAuth resource pool to tell the executor messenger ready. 37 * 38 * @param messenger Messenger used for execute process. 39 * @param publicKey Public key of the framework. 40 * @param templateIds Matched templateIds based on authType and executor info. 41 */ 42 virtual void OnMessengerReady(const std::shared_ptr<ExecutorMessenger> &messenger, 43 const std::vector<uint8_t> &publicKey, const std::vector<uint64_t> &templateIds) = 0; 44 45 /** 46 * @brief Called by coAuth resource pool to tell the executor to begin. 47 * 48 * @param scheduleId Specify the current schedule. 49 * @param publicKey Public key of the framework. 50 * @param commandAttrs Properties of this operation. 51 * @return Return begin execute success or not(0:success; other:failed). 52 */ 53 virtual int32_t OnBeginExecute(uint64_t scheduleId, const std::vector<uint8_t> &publicKey, 54 const Attributes &commandAttrs) = 0; 55 56 /** 57 * @brief Notify the executor to end the operation. 58 * 59 * @param scheduleId Specify the current schedule. 60 * @param commandAttrs Properties of this operation. 61 * @return Return end execute success or not(0:success; other:failed). 62 */ 63 virtual int32_t OnEndExecute(uint64_t scheduleId, const Attributes &commandAttrs) = 0; 64 65 /** 66 * @brief Called by coAuth resource pool to set executor's property. 67 * 68 * @param properties The properties need to set. 69 * @return Return set property success or not(0:success; other:failed). 70 */ 71 virtual int32_t OnSetProperty(const Attributes &properties) = 0; 72 73 /** 74 * @brief Called by coAuth resource pool to get executor's property. 75 * 76 * @param conditions The condition to get property. 77 * @param results The result of get property. 78 * @return Return get property success or not(0:success; other:failed). 79 */ 80 virtual int32_t OnGetProperty(const Attributes &conditions, Attributes &results) = 0; 81 }; 82 } // namespace UserAuth 83 } // namespace UserIam 84 } // namespace OHOS 85 86 #endif // CO_AUTH_CLIENT_CALLBACK_H