1885b47fbSopenharmony_ci/* 2885b47fbSopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd. 3885b47fbSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4885b47fbSopenharmony_ci * you may not use this file except in compliance with the License. 5885b47fbSopenharmony_ci * You may obtain a copy of the License at 6885b47fbSopenharmony_ci * 7885b47fbSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8885b47fbSopenharmony_ci * 9885b47fbSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10885b47fbSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11885b47fbSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12885b47fbSopenharmony_ci * See the License for the specific language governing permissions and 13885b47fbSopenharmony_ci * limitations under the License. 14885b47fbSopenharmony_ci */ 15885b47fbSopenharmony_ci 16885b47fbSopenharmony_ci#ifndef ACCESSIBLE_ABILITY_CLIENT_PROXY_H 17885b47fbSopenharmony_ci#define ACCESSIBLE_ABILITY_CLIENT_PROXY_H 18885b47fbSopenharmony_ci 19885b47fbSopenharmony_ci#include "accessibility_ipc_interface_code.h" 20885b47fbSopenharmony_ci#include "i_accessible_ability_client.h" 21885b47fbSopenharmony_ci#include "iremote_proxy.h" 22885b47fbSopenharmony_ci 23885b47fbSopenharmony_cinamespace OHOS { 24885b47fbSopenharmony_cinamespace Accessibility { 25885b47fbSopenharmony_ciclass AccessibleAbilityClientProxy : public IRemoteProxy<IAccessibleAbilityClient> { 26885b47fbSopenharmony_cipublic: 27885b47fbSopenharmony_ci explicit AccessibleAbilityClientProxy(const sptr<IRemoteObject> &object); 28885b47fbSopenharmony_ci virtual ~AccessibleAbilityClientProxy() = default; 29885b47fbSopenharmony_ci 30885b47fbSopenharmony_ci /** 31885b47fbSopenharmony_ci * @brief Init accessible ability through the proxy object. 32885b47fbSopenharmony_ci * @param channel The object of IAccessibleAbilityChannel. 33885b47fbSopenharmony_ci * @param channelId The id of channel. 34885b47fbSopenharmony_ci */ 35885b47fbSopenharmony_ci virtual void Init(const sptr<IAccessibleAbilityChannel> &channel, const int32_t channelId) override; 36885b47fbSopenharmony_ci 37885b47fbSopenharmony_ci /** 38885b47fbSopenharmony_ci * @brief Disconnect accessible ability through the proxy object. 39885b47fbSopenharmony_ci * @param channelId The id of channel. 40885b47fbSopenharmony_ci */ 41885b47fbSopenharmony_ci virtual void Disconnect(const int32_t channelId) override; 42885b47fbSopenharmony_ci 43885b47fbSopenharmony_ci /** 44885b47fbSopenharmony_ci * @brief Called when an accessibility event occurs through the proxy object. 45885b47fbSopenharmony_ci * @param eventInfo The information of accessible event. 46885b47fbSopenharmony_ci */ 47885b47fbSopenharmony_ci virtual void OnAccessibilityEvent(const AccessibilityEventInfo &eventInfo) override; 48885b47fbSopenharmony_ci 49885b47fbSopenharmony_ci /** 50885b47fbSopenharmony_ci * @brief Called when a key event occurs through the proxy object. 51885b47fbSopenharmony_ci * @param keyEvent Indicates the key event to send. 52885b47fbSopenharmony_ci * @param sequence The sequence of the key event. 53885b47fbSopenharmony_ci */ 54885b47fbSopenharmony_ci virtual void OnKeyPressEvent(const MMI::KeyEvent &keyEvent, const int32_t sequence) override; 55885b47fbSopenharmony_ci 56885b47fbSopenharmony_ciprivate: 57885b47fbSopenharmony_ci /** 58885b47fbSopenharmony_ci * @brief Send the command data from proxy to stub in IPC mechanism. 59885b47fbSopenharmony_ci * @param code The code matched the function called. 60885b47fbSopenharmony_ci * @param data Serializable data 61885b47fbSopenharmony_ci * @param reply The response of IPC 62885b47fbSopenharmony_ci * @param option The option parameter of IPC,such as: async,sync 63885b47fbSopenharmony_ci * @return true: Write the descriptor successfully; otherwise is not. 64885b47fbSopenharmony_ci */ 65885b47fbSopenharmony_ci bool SendTransactCmd(AccessibilityInterfaceCode code, MessageParcel &data, 66885b47fbSopenharmony_ci MessageParcel &reply, MessageOption &option); 67885b47fbSopenharmony_ci 68885b47fbSopenharmony_ci bool WriteInterfaceToken(MessageParcel &data); 69885b47fbSopenharmony_ci 70885b47fbSopenharmony_ci static inline BrokerDelegator<AccessibleAbilityClientProxy> delegator; 71885b47fbSopenharmony_ci}; 72885b47fbSopenharmony_ci} // namespace Accessibility 73885b47fbSopenharmony_ci} // namespace OHOS 74885b47fbSopenharmony_ci#endif // ACCESSIBLE_ABILITY_CLIENT_PROXY_H