• 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 ACCESSIBILITY_ELEMENT_OPERATOR_CALLBACK_INTERFACE_H
17 #define ACCESSIBILITY_ELEMENT_OPERATOR_CALLBACK_INTERFACE_H
18 
19 #include <cstdint>
20 #include <list>
21 #include <string>
22 
23 #include "accessibility_element_info.h"
24 #include "iremote_broker.h"
25 
26 namespace OHOS {
27 namespace Accessibility {
28 /*
29 * The class supply the callback to feedback the result from UI to AA.
30 */
31 class IAccessibilityElementOperatorCallback : public IRemoteBroker {
32 public:
33     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.accessibility.IAccessibilityElementOperatorCallback");
34 
35     /**
36      * @brief Set the element information by accessibility id to AA.
37      * @param infos The element info searched by accessibility id.
38      * @param requestId The request id from AA, it is used to match with request and response.
39      * @return
40      */
41     virtual void SetSearchElementInfoByAccessibilityIdResult(const std::vector<AccessibilityElementInfo> &infos,
42         const int requestId) = 0;
43 
44     /**
45      * @brief Set the element information matched with text to AA.
46      * @param infos The element information searched matched with text.
47      * @param requestId The request id from AA, it is used to match with request and response.
48      * @return
49      */
50     virtual void SetSearchElementInfoByTextResult(const std::vector<AccessibilityElementInfo> &infos,
51         const int requestId) = 0;
52 
53     /**
54      * @brief Set the element information matched with focus type to AA.
55      * @param info The element information searched matched with focus type.
56      * @param requestId The request id from AA, it is used to match with request and response.
57      * @return
58      */
59     virtual void SetFindFocusedElementInfoResult(const AccessibilityElementInfo &info, const int requestId) = 0;
60 
61     /**
62      * @brief Set the element information by focus direction to AA.
63      * @param info The element information searched by focus direction.
64      * @param requestId The request id from AA, it is used to match with request and response.
65      * @return
66      */
67     virtual void SetFocusMoveSearchResult(const AccessibilityElementInfo &info, const int requestId) = 0;
68 
69     /**
70      * @brief Set the result of action executed to AA.
71      * @param succeeded True: The action is executed successfully; otherwise is false.
72      * @param requestId The request id from AA, it is used to match with request and response.
73      * @return
74      */
75     virtual void SetExecuteActionResult(const bool succeeded, const int requestId) = 0;
76 
77     enum class Message {
78         SET_RESULT_BY_ACCESSIBILITY_ID = 0,
79         SET_RESULT_BY_TEXT,
80         SET_RESULT_FOCUSED_INFO,
81         SET_RESULT_FOCUS_MOVE,
82         SET_RESULT_PERFORM_ACTION,
83     };
84 };
85 } // namespace Accessibility
86 } // namespace OHOS
87 #endif