• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 INTERFACE_ACCESSIBILITY_ELEMENT_OPERATOR_CALLBACK_H
17 #define INTERFACE_ACCESSIBILITY_ELEMENT_OPERATOR_CALLBACK_H
18 
19 #include <cstdint>
20 #include <string>
21 #include <vector>
22 #include "accessibility_element_info.h"
23 #include "iremote_broker.h"
24 
25 namespace OHOS {
26 namespace Accessibility {
27 /*
28 * The class supply the callback to feedback the result from UI to AA.
29 */
30 class IAccessibilityElementOperatorCallback : public IRemoteBroker {
31 public:
32     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.accessibility.IAccessibilityElementOperatorCallback");
33 
34     /**
35      * @brief Set the element information by accessibility id to AA.
36      * @param infos The element info 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::vector<AccessibilityElementInfo> &infos,
40         const int32_t requestId) = 0;
41 
42     /**
43      * @brief Set the element information by window id to AA.
44      * @param infos The element info searched by window id.
45      * @param requestId The request id from AA, it is used to match with request and response.
46      */
47     virtual void SetSearchDefaultFocusByWindowIdResult(const std::vector<AccessibilityElementInfo> &infos,
48         const int32_t requestId) = 0;
49 
50     /**
51      * @brief Set the element information matched with text to AA.
52      * @param infos The element information searched matched with text.
53      * @param requestId The request id from AA, it is used to match with request and response.
54      */
55     virtual void SetSearchElementInfoByTextResult(const std::vector<AccessibilityElementInfo> &infos,
56         const int32_t requestId) = 0;
57 
58     /**
59      * @brief Set the element information matched with focus type to AA.
60      * @param info The element information searched matched with focus type.
61      * @param requestId The request id from AA, it is used to match with request and response.
62      */
63     virtual void SetFindFocusedElementInfoResult(const AccessibilityElementInfo &info, const int32_t requestId) = 0;
64 
65     /**
66      * @brief Set the element information by focus direction to AA.
67      * @param info The element information searched by focus direction.
68      * @param requestId The request id from AA, it is used to match with request and response.
69      */
70     virtual void SetFocusMoveSearchResult(const AccessibilityElementInfo &info, const int32_t requestId) = 0;
71 
72     /**
73      * @brief Set the result of action executed to AA.
74      * @param succeeded True: The action is executed successfully; otherwise is false.
75      * @param requestId The request id from AA, it is used to match with request and response.
76      */
77     virtual void SetExecuteActionResult(const bool succeeded, const int32_t requestId) = 0;
78 
79     /**
80      * @brief Set the result of cursor position to AA.
81      * @param cursorPosition The cursorPosition to be returned.
82      * @param requestId The request id from AA, it is used to match with request and response.
83      */
84     virtual void SetCursorPositionResult(const int32_t cursorPosition, const int32_t requestId) = 0;
85 
86     /**
87      * @brief Set isFilter.
88      * @param enableFilter True : Perform filtering ;otherwise is false.
89      */
SetIsFilter(bool enableFilter)90     void SetIsFilter(bool enableFilter)
91     {
92         isFilter = enableFilter;
93     }
94 
95     /**
96      * @brief Get isFilter.
97      */
GetFilter()98     bool GetFilter()
99     {
100         return isFilter;
101     }
102 private:
103    bool isFilter = false;
104 };
105 } // namespace Accessibility
106 } // namespace OHOS
107 #endif // INTERFACE_ACCESSIBILITY_ELEMENT_OPERATOR_CALLBACK_H