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 ACCESSIBLE_ABILITY_CHANNEL_STUB_H 17 #define ACCESSIBLE_ABILITY_CHANNEL_STUB_H 18 19 #include <cstdint> 20 #include <map> 21 #include "accessible_ability_channel_interface.h" 22 #include "accessibility_errorcode.h" 23 #include "hilog_wrapper.h" 24 #include "iremote_stub.h" 25 #include "nocopyable.h" 26 #include "message_parcel.h" 27 #include "message_option.h" 28 29 namespace OHOS { 30 namespace Accessibility { 31 class AccessibleAbilityChannelStub : public IRemoteStub<IAccessibleAbilityChannel> { 32 public: 33 /** 34 * @brief construct function 35 * @param object The object of IPC 36 * @return 37 */ 38 AccessibleAbilityChannelStub(); 39 40 /** 41 * @brief destruct function 42 * @param 43 * @return 44 */ 45 virtual ~AccessibleAbilityChannelStub(); 46 47 /** 48 * @brief Receive the event from proxy by IPC mechanism. 49 * @param code The code is matched with the process function. 50 * @param data The data of process communication 51 * @param reply The response of IPC request 52 * @param option The option parameter of IPC,such as: async,sync 53 * @return 54 */ 55 virtual int OnRemoteRequest(uint32_t code, MessageParcel &data, 56 MessageParcel &reply, MessageOption &option) override; 57 private: 58 /** 59 * @brief Handle the IPC request for the function:HandleSearchElementInfoByAccessibilityId. 60 * @param data The data of process communication 61 * @param reply The response of IPC request 62 * @return NO_ERROR: successful; otherwise is failed. 63 */ 64 ErrCode HandleSearchElementInfoByAccessibilityId(MessageParcel &data, MessageParcel &reply); 65 66 /** 67 * @brief Handle the IPC request for the function:HandleSearchElementInfosByText. 68 * @param data The data of process communication 69 * @param reply The response of IPC request 70 * @return NO_ERROR: successful; otherwise is failed. 71 */ 72 ErrCode HandleSearchElementInfosByText(MessageParcel &data, MessageParcel &reply); 73 74 /** 75 * @brief Handle the IPC request for the function:HandleFindFocusedElementInfo. 76 * @param data The data of process communication 77 * @param reply The response of IPC request 78 * @return NO_ERROR: successful; otherwise is failed. 79 */ 80 ErrCode HandleFindFocusedElementInfo(MessageParcel &data, MessageParcel &reply); 81 82 /** 83 * @brief Handle the IPC request for the function:HandleFocusMoveSearch. 84 * @param data The data of process communication 85 * @param reply The response of IPC request 86 * @return NO_ERROR: successful; otherwise is failed. 87 */ 88 ErrCode HandleFocusMoveSearch(MessageParcel &data, MessageParcel &reply); 89 90 /** 91 * @brief Handle the IPC request for the function:HandleExecuteAction. 92 * @param data The data of process communication 93 * @param reply The response of IPC request 94 * @return NO_ERROR: successful; otherwise is failed. 95 */ 96 ErrCode HandleExecuteAction(MessageParcel &data, MessageParcel &reply); 97 98 /** 99 * @brief Handle the IPC request for the function:HandleGetWindows. 100 * @param data The data of process communication 101 * @param reply The response of IPC request 102 * @return NO_ERROR: successful; otherwise is failed. 103 */ 104 ErrCode HandleGetWindows(MessageParcel &data, MessageParcel &reply); 105 106 /** 107 * @brief Handle the IPC request for the function:HandleExecuteCommonAction. 108 * @param data The data of process communication 109 * @param reply The response of IPC request 110 * @return NO_ERROR: successful; otherwise is failed. 111 */ 112 ErrCode HandleExecuteCommonAction(MessageParcel &data, MessageParcel &reply); 113 114 /** 115 * @brief Handle the IPC request for the function:HandleSetOnKeyPressEventResult. 116 * @param data The data of process communication 117 * @param reply The response of IPC request 118 * @return NO_ERROR: successful; otherwise is failed. 119 */ 120 ErrCode HandleSetOnKeyPressEventResult(MessageParcel &data, MessageParcel &reply); 121 122 /** 123 * @brief Handle the IPC request for the function:HandleGetDisplayResizeScale. 124 * @param data The data of process communication 125 * @param reply The response of IPC request 126 * @return NO_ERROR: successful; otherwise is failed. 127 */ 128 ErrCode HandleGetDisplayResizeScale(MessageParcel &data, MessageParcel &reply); 129 130 /** 131 * @brief Handle the IPC request for the function:HandleGetDisplayResizeCenterX. 132 * @param data The data of process communication 133 * @param reply The response of IPC request 134 * @return NO_ERROR: successful; otherwise is failed. 135 */ 136 ErrCode HandleGetDisplayResizeCenterX(MessageParcel &data, MessageParcel &reply); 137 138 /** 139 * @brief Handle the IPC request for the function:HandleGetDisplayResizeCenterY. 140 * @param data The data of process communication 141 * @param reply The response of IPC request 142 * @return NO_ERROR: successful; otherwise is failed. 143 */ 144 ErrCode HandleGetDisplayResizeCenterY(MessageParcel &data, MessageParcel &reply); 145 146 /** 147 * @brief Handle the IPC request for the function:HandleGetDisplayResizeRect. 148 * @param data The data of process communication 149 * @param reply The response of IPC request 150 * @return NO_ERROR: successful; otherwise is failed. 151 */ 152 ErrCode HandleGetDisplayResizeRect(MessageParcel &data, MessageParcel &reply); 153 154 /** 155 * @brief Handle the IPC request for the function:HandleResetDisplayResize. 156 * @param data The data of process communication 157 * @param reply The response of IPC request 158 * @return NO_ERROR: successful; otherwise is failed. 159 */ 160 ErrCode HandleResetDisplayResize(MessageParcel &data, MessageParcel &reply); 161 162 /** 163 * @brief Handle the IPC request for the function:HandleSetDisplayResizeScaleAndCenter. 164 * @param data The data of process communication 165 * @param reply The response of IPC request 166 * @return NO_ERROR: successful; otherwise is failed. 167 */ 168 ErrCode HandleSetDisplayResizeScaleAndCenter(MessageParcel &data, MessageParcel &reply); 169 170 /** 171 * @brief Handle the IPC request for the function:HandleSendSimulateGesture. 172 * @param data The data of process communication 173 * @param reply The response of IPC request 174 * @return NO_ERROR: successful; otherwise is failed. 175 */ 176 ErrCode HandleSendSimulateGesture(MessageParcel &data, MessageParcel &reply); 177 178 using AccessibleAbilityConnectionFunc = 179 ErrCode (AccessibleAbilityChannelStub::*)(MessageParcel &data, MessageParcel &reply); 180 std::map<uint32_t, AccessibleAbilityConnectionFunc> memberFuncMap_; 181 182 DISALLOW_COPY_AND_MOVE(AccessibleAbilityChannelStub); 183 }; 184 } // namespace Accessibility 185 } // namespace OHOS 186 #endif // ACCESSIBLE_ABILITY_CHANNEL_STUB_H