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_STUB_H
17 #define ACCESSIBILITY_ELEMENT_OPERATOR_STUB_H
18 
19 #include "i_accessibility_element_operator.h"
20 #include "iremote_stub.h"
21 
22 namespace OHOS {
23 namespace Accessibility {
24 /*
25 * The class define the interface for UI to implement.
26 * It is triggered by ABMS when AA to request the accessibility information.
27 */
28 class AccessibilityElementOperatorStub : public IRemoteStub<IAccessibilityElementOperator> {
29 public:
30     /**
31      * @brief construct function
32      * @param object The object of IPC
33      */
34     AccessibilityElementOperatorStub();
35 
36     /**
37      * @brief destruct function
38      */
39     virtual ~AccessibilityElementOperatorStub();
40 
41     /**
42      * @brief Receive the event from proxy by IPC mechanism.
43      * @param code The code is matched with the process function.
44      * @param data The data of process communication
45      * @param reply The response of IPC request
46      * @param option The option parameter of IPC,such as: async,sync
47      */
48     virtual int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
49         MessageOption &option) override;
50 
51 private:
52     /**
53      * @brief Handle the IPC request for the function:SetSearchElementInfoByAccessibilityIdResult.
54      * @param data The data of process communication
55      * @param reply The response of IPC request
56      * @return NO_ERROR: successful; otherwise is failed.
57      */
58     ErrCode HandleSearchElementInfoByAccessibilityId(MessageParcel &data, MessageParcel &reply);
59 
60     /**
61      * @brief Handle the IPC request for the function:SetSearchElementInfoByTextResult.
62      * @param data The data of process communication
63      * @param reply The response of IPC request
64      * @return NO_ERROR: successful; otherwise is failed.
65      */
66     ErrCode HandleSearchElementInfosByText(MessageParcel &data, MessageParcel &reply);
67 
68     /**
69      * @brief Handle the IPC request for the function:SetFindFocusedElementInfoResult.
70      * @param data The data of process communication
71      * @param reply The response of IPC request
72      * @return NO_ERROR: successful; otherwise is failed.
73      */
74     ErrCode HandleFindFocusedElementInfo(MessageParcel &data, MessageParcel &reply);
75 
76     /**
77      * @brief Handle the IPC request for the function:SetFocusMoveSearchResult.
78      * @param data The data of process communication
79      * @param reply The response of IPC request
80      * @return NO_ERROR: successful; otherwise is failed.
81      */
82     ErrCode HandleFocusFind(MessageParcel &data, MessageParcel &reply);
83 
84     /**
85      * @brief Handle the IPC request for the function:SetExecuteActionResult.
86      * @param data The data of process communication
87      * @param reply The response of IPC request
88      * @return NO_ERROR: successful; otherwise is failed.
89      */
90     ErrCode HandleExecuteAction(MessageParcel &data, MessageParcel &reply);
91 
92     /**
93      * @brief Handle the IPC request for the function:SetCursorPositionResult.
94      * @param data The data of process communication
95      * @param reply The response of IPC request
96      * @return NO_ERROR: successful; otherwise is failed.
97      */
98     ErrCode HandleGetCursorPosition(MessageParcel &data, MessageParcel &reply);
99 
100     /**
101      * @brief Handle the IPC request for the function:ClearFocus.
102      * @param data The data of process communication
103      * @param reply The response of IPC request
104      * @return NO_ERROR: successful; otherwise is failed.
105      */
106     ErrCode HandleClearFocus(MessageParcel &data, MessageParcel &reply);
107 
108     /**
109      * @brief Handle the IPC request for the function:OutsideTouch.
110      * @param data The data of process communication
111      * @param reply The response of IPC request
112      * @return NO_ERROR: successful; otherwise is failed.
113      */
114     ErrCode HandleOutsideTouch(MessageParcel &data, MessageParcel &reply);
115 
116     /**
117      * @brief Handle the IPC request for the function:SetChildTreeIdAndWinId.
118      * @param data The data of process communication
119      * @param reply The response of IPC request
120      * @return NO_ERROR: successful; otherwise is failed.
121      */
122     ErrCode HandleSetChildTreeIdAndWinId(MessageParcel &data, MessageParcel &reply);
123 
124     /**
125      * @brief Handle the IPC request for the function:SetBelongTreeId.
126      * @param data The data of process communication
127      * @param reply The response of IPC request
128      * @return NO_ERROR: successful; otherwise is failed.
129      */
130     ErrCode HandleSetBelongTreeId(MessageParcel &data, MessageParcel &reply);
131 
132     /**
133      * @brief Handle the IPC request for the function:SetParentWindowId.
134      * @param data The data of process communication
135      * @param reply The response of IPC request
136      * @return NO_ERROR: successful; otherwise is failed.
137      */
138     ErrCode HandleSetParentWindowId(MessageParcel &data, MessageParcel &reply);
139     using AccessibilityElementOperatorFunc =
140         ErrCode (AccessibilityElementOperatorStub::*)(MessageParcel &data, MessageParcel &reply);
141 };
142 } // namespace Accessibility
143 } // namespace OHOS
144 #endif // ACCESSIBILITY_ELEMENT_OPERATOR_STUB_H