• 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_INTERFACE_H
17 #define ACCESSIBLE_ABILITY_CLIENT_INTERFACE_H
18 
19 #include "iremote_broker.h"
20 #include "refbase.h"
21 #include "key_event.h"
22 #include "accessibility_element_info.h"
23 #include "accessible_ability_channel_interface.h"
24 #include "accessibility_event_info.h"
25 
26 namespace OHOS {
27 namespace Accessibility {
28 class IAccessibleAbilityClient : public IRemoteBroker {
29 public:
30     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.accessibility.IAccessibleAbilityClient");
31 
32     /**
33      * @brief Init accessible ability.
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) = 0;
39 
40     /**
41      * @brief Disconnect accessible ability.
42      * @param channelId The id of channel.
43      * @return
44      */
45     virtual void Disconnect(const int channelId) = 0;
46 
47     /**
48      * @brief Called when an accessibility event occurs.
49      * @param eventInfo The information of accessible event.
50      * @return
51      */
52     virtual void OnAccessibilityEvent(const AccessibilityEventInfo &eventInfo) = 0;
53 
54     /**
55      * @brief Called when a key event occurs.
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) = 0;
61 
62     /**
63      * @brief Called when the rectangle, scale, or center coordinate for performing the resizing operations is changed.
64      * @param displayId The id of display.
65      * @param rect Indicates the rectangle for resizing the display.
66      * @param scale Indicates the scale for resizing the display.
67      * @param centerX Indicates the X coordinate of the center for resizing the display.
68      * @param centerY Indicates the Y coordinate of the center for resizing the display.
69      * @return
70      */
71     virtual void OnDisplayResized(const int displayId, const Rect &rect, const float scale, const float centerX,
72         const float centerY) = 0;
73 
74     /**
75      * @brief Called when need to notify the result of simulation gesture.
76      * @param sequence The sequence of gesture.
77      * @param completedSuccessfully The result of gesture completion.
78      * @return
79      */
80     virtual void OnGestureSimulateResult(const int sequence, const bool completedSuccessfully) = 0;
81 
82     enum class Message {
83         INIT = 0,
84         DISCONNECT,
85         ON_ACCESSIBILITY_EVENT,
86         ON_KEY_PRESS_EVENT,
87         ON_DISPALYRESIZE_CHANGED,
88         ON_GESTURE_SIMULATE_RESULT,
89     };
90 };
91 } // namespace Accessibility
92 } // namespace OHOS
93 #endif // ACCESSIBLE_ABILITY_CLIENT_INTERFACE_H