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_STUB_H 17 #define ACCESSIBILITY_ELEMENT_OPERATOR_CALLBACK_STUB_H 18 19 #include <cstdint> 20 #include <list> 21 #include <string> 22 23 #include "accessibility_element_operator_callback_interface.h" 24 #include "accessibility_errorcode.h" 25 #include "iremote_stub.h" 26 #include "nocopyable.h" 27 28 namespace OHOS { 29 namespace Accessibility { 30 /* 31 * The class define the interface for UI to implement. 32 * It triggered by ABMS when AA to request the accessibility information. 33 */ 34 class AccessibilityElementOperatorCallbackStub : public IRemoteStub<IAccessibilityElementOperatorCallback> { 35 public: 36 /** 37 * @brief construct function 38 * @param object The object of IPC 39 * @return 40 */ 41 AccessibilityElementOperatorCallbackStub(); 42 43 /** 44 * @brief destruct function 45 * @param 46 * @return 47 */ 48 virtual ~AccessibilityElementOperatorCallbackStub(); 49 50 /** 51 * @brief Receive the event from proxy by IPC mechanism. 52 * @param code The code is matched with the process function. 53 * @param data The data of process communication 54 * @param reply The response of IPC request 55 * @param option The option parameter of IPC,such as: async,sync 56 * @return 57 */ 58 virtual int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, 59 MessageOption &option) override; 60 private: 61 /** 62 * @brief Handle the IPC request for the function:SetSearchElementInfoByAccessibilityIdResult. 63 * @param data The data of process communication 64 * @param reply The response of IPC request 65 * @return NO_ERROR: successful; otherwise is failed. 66 */ 67 ErrCode HandleSetSearchElementInfoByAccessibilityIdResult(MessageParcel &data, MessageParcel &reply); 68 69 /** 70 * @brief Handle the IPC request for the function:SetSearchElementInfoByTextResult. 71 * @param data The data of process communication 72 * @param reply The response of IPC request 73 * @return NO_ERROR: successful; otherwise is failed. 74 */ 75 ErrCode HandleSetSearchElementInfoByTextResult(MessageParcel &data, MessageParcel &reply); 76 77 /** 78 * @brief Handle the IPC request for the function:SetFindFocusedElementInfoResult. 79 * @param data The data of process communication 80 * @param reply The response of IPC request 81 * @return NO_ERROR: successful; otherwise is failed. 82 */ 83 ErrCode HandleSetFindFocusedElementInfoResult(MessageParcel &data, MessageParcel &reply); 84 85 /** 86 * @brief Handle the IPC request for the function:SetFocusMoveSearchResult. 87 * @param data The data of process communication 88 * @param reply The response of IPC request 89 * @return NO_ERROR: successful; otherwise is failed. 90 */ 91 ErrCode HandleSetFocusMoveSearchResult(MessageParcel &data, MessageParcel &reply); 92 93 /** 94 * @brief Handle the IPC request for the function:SetExecuteActionResult. 95 * @param data The data of process communication 96 * @param reply The response of IPC request 97 * @return NO_ERROR: successful; otherwise is failed. 98 */ 99 ErrCode HandleSetExecuteActionResult(MessageParcel &data, MessageParcel &reply); 100 101 using AccessibilityElementOperatorCallbackFunc = 102 ErrCode (AccessibilityElementOperatorCallbackStub::*)(MessageParcel &data, MessageParcel &reply); 103 std::map<uint32_t, AccessibilityElementOperatorCallbackFunc> memberFuncMap_; 104 }; 105 } // namespace Accessibility 106 } // namespace OHOS 107 #endif