• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_CLIENT_PROXY_H
17 #define ACCESSIBLE_ABILITY_CLIENT_PROXY_H
18 
19 #include <cstdint>
20 #include "accessible_ability_client_interface.h"
21 #include "iremote_proxy.h"
22 #include "message_parcel.h"
23 #include "hilog_wrapper.h"
24 
25 namespace OHOS {
26 namespace Accessibility {
27 class AccessibleAbilityClientProxy : public IRemoteProxy<IAccessibleAbilityClient> {
28 public:
29     explicit AccessibleAbilityClientProxy(const sptr<IRemoteObject> &object);
30     virtual ~AccessibleAbilityClientProxy() = default;
31 
32     /**
33      * @brief Init accessible ability through the proxy object.
34      * @param channel The object of IAccessibleAbilityChannel.
35      * @param channelId The id of channel.
36      * @return
37      */
38     virtual void Init(const sptr<IAccessibleAbilityChannel> &channel, const int channelId) override;
39 
40     /**
41      * @brief Disconnect accessible ability through the proxy object.
42      * @param channelId The id of channel.
43      * @return
44      */
45     virtual void Disconnect(const int channelId) override;
46 
47     /**
48      * @brief Called when an accessibility event occurs through the proxy object.
49      * @param eventInfo The information of accessible event.
50      * @return
51      */
52     virtual void OnAccessibilityEvent(const AccessibilityEventInfo &eventInfo) override;
53 
54     /**
55      * @brief Called when a key event occurs through the proxy object.
56      * @param keyEvent Indicates the key event to send.
57      * @param sequence The sequence of the key event.
58      * @return
59      */
60     virtual void OnKeyPressEvent(const MMI::KeyEvent &keyEvent, const int sequence) override;
61 
62     /**
63      * @brief Called when the rectangle, scale, or center coordinate for performing the resizing operations is changed
64      *        through the proxy object.
65      * @param displayId The id of display.
66      * @param rect Indicates the rectangle for resizing the display.
67      * @param scale Indicates the scale for resizing the display.
68      * @param centerX Indicates the X coordinate of the center for resizing the display.
69      * @param centerY Indicates the Y coordinate of the center for resizing the display.
70      * @return
71      */
72     virtual void OnDisplayResized(const int displayId, const Rect &rect, const float scale, const float centerX,
73         const float centerY) override;
74 
75     /**
76      * @brief Called when need to notify the result of simulation gesture through the proxy object.
77      * @param sequence The sequence of gesture.
78      * @param completedSuccessfully The result of gesture completion.
79      * @return
80      */
81     virtual void OnGestureSimulateResult(const int sequence, const bool completedSuccessfully) override;
82 
83 private:
84     bool WriteInterfaceToken(MessageParcel &data);
85 
86     static inline BrokerDelegator<AccessibleAbilityClientProxy> delegator;
87 };
88 } // namespace Accessibility
89 } // namespace OHOS
90 #endif // ACCESSIBLE_ABILITY_CLIENT_PROXY_H