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 ACCESSIBILITY_ELEMENT_OPERATOR_CALLBACK_H
17 #define ACCESSIBILITY_ELEMENT_OPERATOR_CALLBACK_H
18 
19 #include <list>
20 #include "accessibility_element_info.h"
21 
22 namespace OHOS {
23 namespace Accessibility {
24 /*
25 * The class supply the callback to feedback the result from UI to AA.
26 */
27 class AccessibilityElementOperatorCallback {
28 public:
29     /**
30      * @brief Destruct
31      */
32     virtual ~AccessibilityElementOperatorCallback() = default;
33 
34     /**
35      * @brief Set the element information by accessibility id to AA.
36      * @param infos The element information searched by accessibility id.
37      * @param requestId The request id from AA, it is used to match with request and response.
38      */
39     virtual void SetSearchElementInfoByAccessibilityIdResult(const std::list<AccessibilityElementInfo> &infos,
40         const int32_t requestId) = 0;
41 
42     /**
43      * @brief Set the element information matched with text to AA.
44      * @param infos The element information searched matched with text.
45      * @param requestId The request id from AA, it is used to match with request and response.
46      */
47     virtual void SetSearchElementInfoByTextResult(const std::list<AccessibilityElementInfo> &infos,
48         const int32_t requestId) = 0;
49 
50     /**
51      * @brief Set the element information matched with focus type to AA.
52      * @param info The element information searched matched with focus type.
53      * @param requestId The request id from AA, it is used to match with request and response.
54      */
55     virtual void SetFindFocusedElementInfoResult(const AccessibilityElementInfo &info, const int32_t requestId) = 0;
56 
57     /**
58      * @brief Set the element information by focus direction to AA.
59      * @param info The element information searched by focus direction.
60      * @param requestId The request id from AA, it is used to match with request and response.
61      */
62     virtual void SetFocusMoveSearchResult(const AccessibilityElementInfo &info, const int32_t requestId) = 0;
63 
64     /**
65      * @brief Set the result of action executed to AA.
66      * @param succeeded True: The action is executed successfully; otherwise is false.
67      * @param requestId The request id from AA, it is used to match with request and response.
68      */
69     virtual void SetExecuteActionResult(const bool succeeded, const int32_t requestId) = 0;
70 
71     /**
72      * @brief Set the result of cursor position to AA.
73      * @param cursorPosition The cursorPosition to be returned.
74      * @param requestId The request id from AA, it is used to match with request and response.
75      */
76     virtual void SetCursorPositionResult(const int32_t cursorPosition, const int32_t requestId) = 0;
77 };
78 } // namespace Accessibility
79 } // namespace OHOS
80 #endif // ACCESSIBILITY_ELEMENT_OPERATOR_CALLBACK_H