1 /* 2 * Copyright (c) 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 IAM_WIDGET_SCHEDULE_NODE_H 17 #define IAM_WIDGET_SCHEDULE_NODE_H 18 19 #include <cstdint> 20 #include <memory> 21 #include <optional> 22 23 #include "finite_state_machine.h" 24 #include "iam_common_defines.h" 25 #include "resource_node.h" 26 #include "widget_schedule_node_callback.h" 27 #include "thread_handler.h" 28 #include "user_auth_common_defines.h" 29 30 namespace OHOS { 31 namespace UserIam { 32 namespace UserAuth { 33 class Context; 34 class WidgetScheduleNode { 35 public: 36 enum State : uint32_t { 37 S_WIDGET_INIT = 0, 38 S_WIDGET_WAITING = 1, 39 S_WIDGET_AUTH_RUNNING = 2, 40 S_WIDGET_AUTH_FINISHED = 3 41 }; 42 43 enum Event : uint32_t { 44 E_START_WIDGET = 0, 45 E_START_AUTH = 1, 46 E_UPDATE_AUTH = 2, 47 E_CANCEL_AUTH = 3, 48 E_COMPLETE_AUTH = 4, 49 E_NAVI_PIN_AUTH = 5, 50 E_WIDGET_PARA_INVALID = 6 51 }; 52 53 virtual ~WidgetScheduleNode() = default; 54 virtual bool StartSchedule() = 0; 55 virtual bool StopSchedule() = 0; 56 virtual bool StartAuthList(const std::vector<AuthType> &authTypeList) = 0; 57 virtual bool StopAuthList(const std::vector<AuthType> &authTypeList) = 0; 58 virtual bool SuccessAuth(AuthType authType) = 0; 59 virtual bool NaviPinAuth() = 0; 60 virtual bool WidgetParaInvalid() = 0; 61 virtual void SetCallback(std::shared_ptr<WidgetScheduleNodeCallback> callback) = 0; 62 }; 63 } // namespace UserAuth 64 } // namespace UserIam 65 } // namespace OHOS 66 #endif // IAM_WIDGET_SCHEDULE_NODE_H