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 "i_accessible_ability_channel.h" 20 #include "iremote_stub.h" 21 22 namespace OHOS { 23 namespace Accessibility { 24 class AccessibleAbilityChannelStub : public IRemoteStub<IAccessibleAbilityChannel> { 25 public: 26 /** 27 * @brief construct function 28 * @param object The object of IPC 29 */ 30 AccessibleAbilityChannelStub(); 31 32 /** 33 * @brief destruct function 34 */ 35 virtual ~AccessibleAbilityChannelStub(); 36 37 /** 38 * @brief Receive the event from proxy by IPC mechanism. 39 * @param code The code is matched with the process function. 40 * @param data The data of process communication 41 * @param reply The response of IPC request 42 * @param option The option parameter of IPC,such as: async,sync 43 */ 44 virtual int OnRemoteRequest(uint32_t code, MessageParcel &data, 45 MessageParcel &reply, MessageOption &option) override; 46 private: 47 /** 48 * @brief Handle the IPC request for the function:HandleSearchElementInfoByAccessibilityId. 49 * @param data The data of process communication 50 * @param reply The response of IPC request 51 * @return NO_ERROR: successful; otherwise is failed. 52 */ 53 ErrCode HandleSearchElementInfoByAccessibilityId(MessageParcel &data, MessageParcel &reply); 54 55 /** 56 * @brief Handle the IPC request for the function:HandleSearchElementInfosByText. 57 * @param data The data of process communication 58 * @param reply The response of IPC request 59 * @return NO_ERROR: successful; otherwise is failed. 60 */ 61 ErrCode HandleSearchElementInfosByText(MessageParcel &data, MessageParcel &reply); 62 63 /** 64 * @brief Handle the IPC request for the function:HandleFindFocusedElementInfo. 65 * @param data The data of process communication 66 * @param reply The response of IPC request 67 * @return NO_ERROR: successful; otherwise is failed. 68 */ 69 ErrCode HandleFindFocusedElementInfo(MessageParcel &data, MessageParcel &reply); 70 71 /** 72 * @brief Handle the IPC request for the function:HandleFocusMoveSearch. 73 * @param data The data of process communication 74 * @param reply The response of IPC request 75 * @return NO_ERROR: successful; otherwise is failed. 76 */ 77 ErrCode HandleFocusMoveSearch(MessageParcel &data, MessageParcel &reply); 78 79 /** 80 * @brief Handle the IPC request for the function:HandleExecuteAction. 81 * @param data The data of process communication 82 * @param reply The response of IPC request 83 * @return NO_ERROR: successful; otherwise is failed. 84 */ 85 ErrCode HandleExecuteAction(MessageParcel &data, MessageParcel &reply); 86 87 /** 88 * @brief Handle the IPC request for the function:HandleGetWindow. 89 * @param data The data of process communication 90 * @param reply The response of IPC request 91 * @return NO_ERROR: successful; otherwise is failed. 92 */ 93 ErrCode HandleGetWindow(MessageParcel &data, MessageParcel &reply); 94 95 /** 96 * @brief Handle the IPC request for the function:HandleGetWindows. 97 * @param data The data of process communication 98 * @param reply The response of IPC request 99 * @return NO_ERROR: successful; otherwise is failed. 100 */ 101 ErrCode HandleGetWindows(MessageParcel &data, MessageParcel &reply); 102 103 /** 104 * @brief Handle the IPC request for the function:HandleGetWindows. 105 * @param data The data of process communication 106 * @param reply The response of IPC request 107 * @return NO_ERROR: successful; otherwise is failed. 108 */ 109 ErrCode HandleGetWindowsByDisplayId(MessageParcel &data, MessageParcel &reply); 110 111 /** 112 * @brief Handle the IPC request for the function:HandleSetOnKeyPressEventResult. 113 * @param data The data of process communication 114 * @param reply The response of IPC request 115 * @return NO_ERROR: successful; otherwise is failed. 116 */ 117 ErrCode HandleSetOnKeyPressEventResult(MessageParcel &data, MessageParcel &reply); 118 119 /** 120 * @brief Handle the IPC request for the function:HandleSendSimulateGesturePath. 121 * @param data The data of process communication 122 * @param reply The response of IPC request 123 * @return NO_ERROR: successful; otherwise is failed. 124 */ 125 ErrCode HandleSendSimulateGesturePath(MessageParcel &data, MessageParcel &reply); 126 127 /** 128 * @brief Handle the IPC request for the function:HandleSetTargetBundleName. 129 * @param data The data of process communication 130 * @param reply The response of IPC request 131 * @return NO_ERROR: successful; otherwise is failed. 132 */ 133 ErrCode HandleSetTargetBundleName(MessageParcel &data, MessageParcel &reply); 134 135 using AccessibleAbilityConnectionFunc = 136 ErrCode (AccessibleAbilityChannelStub::*)(MessageParcel &data, MessageParcel &reply); 137 std::map<uint32_t, AccessibleAbilityConnectionFunc> memberFuncMap_; 138 }; 139 } // namespace Accessibility 140 } // namespace OHOS 141 #endif // ACCESSIBLE_ABILITY_CHANNEL_STUB_H