1 /* 2 * Copyright (c) 2022-2023 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 FINGERPRINT_AUTH_EXECUTOR_CALLBACK_HDI 17 #define FINGERPRINT_AUTH_EXECUTOR_CALLBACK_HDI 18 19 #include <cstdint> 20 21 #include "hdf_base.h" 22 #include "nocopyable.h" 23 24 #include "fingerprint_auth_all_in_one_executor_hdi.h" 25 #include "fingerprint_auth_hdi.h" 26 #include "iam_executor_iexecute_callback.h" 27 28 namespace OHOS { 29 namespace UserIam { 30 namespace FingerprintAuth { 31 namespace UserAuth = OHOS::UserIam::UserAuth; 32 33 enum FingerCallbackHdiType : int32_t { 34 FINGER_CALLBACK_ENROLL = 0, 35 FINGER_CALLBACK_AUTH = 1, 36 FINGER_CALLBACK_IDENTIFY = 2, 37 FINGER_CALLBACK_COMMAND = 3, 38 FINGER_CALLBACK_INVALID = 4, 39 }; 40 41 class FingerprintAuthExecutorCallbackHdi : public IExecutorCallback, public NoCopyable { 42 public: 43 FingerprintAuthExecutorCallbackHdi(std::shared_ptr<UserAuth::IExecuteCallback> frameworkCallback, 44 FingerCallbackHdiType fingerCallbackHdiType); 45 ~FingerprintAuthExecutorCallbackHdi() override = default; 46 47 int32_t OnResult(int32_t result, const std::vector<uint8_t> &extraInfo) override; 48 int32_t OnTip(int32_t tip, const std::vector<uint8_t> &extraInfo) override; 49 int32_t OnMessage(int32_t destRole, const std::vector<uint8_t> &msg) override; 50 51 private: 52 void DoVibrator(); 53 UserIam::UserAuth::ResultCode ConvertResultCode(const int32_t in); 54 55 std::shared_ptr<UserAuth::IExecuteCallback> frameworkCallback_; 56 FingerCallbackHdiType fingerCallbackHdiType_ = FINGER_CALLBACK_INVALID; 57 }; 58 } // namespace FingerprintAuth 59 } // namespace UserIam 60 } // namespace OHOS 61 62 #endif // FINGERPRINT_AUTH_EXECUTOR_CALLBACK_HDI 63