• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 I_MULTIMODAL_INPUT_CONNECT_H
17 #define I_MULTIMODAL_INPUT_CONNECT_H
18 
19 #include "iremote_broker.h"
20 
21 #include "i_event_filter.h"
22 #include "input_handler_type.h"
23 #include "key_event.h"
24 #include "key_option.h"
25 #include "pointer_event.h"
26 #include "system_ability_definition.h"
27 
28 namespace OHOS {
29 namespace MMI {
30 class IMultimodalInputConnect : public IRemoteBroker {
31 public:
32     enum {
33         ALLOC_SOCKET_FD = 0,
34         ADD_INPUT_EVENT_FILTER = 1,
35         SET_POINTER_VISIBLE = 2,
36         IS_POINTER_VISIBLE = 3,
37         SUBSCRIBE_KEY_EVENT = 6,
38         UNSUBSCRIBE_KEY_EVENT = 7,
39         ADD_INPUT_HANDLER = 8,
40         REMOVE_INPUT_HANDLER = 9,
41         MARK_EVENT_CONSUMED = 10,
42         MOVE_MOUSE = 11,
43         INJECT_KEY_EVENT = 12,
44         INJECT_POINTER_EVENT = 13,
45         SET_ANR_OBSERVER = 14,
46         SUPPORT_KEYS = 15,
47         GET_DEVICE_IDS = 16,
48         GET_DEVICE = 17,
49         REGISTER_DEV_MONITOR = 18,
50         UNREGISTER_DEV_MONITOR = 19,
51         GET_KEYBOARD_TYPE = 20,
52         SET_POINTER_SPEED = 21,
53         GET_POINTER_SPEED = 22,
54         SET_POINTER_STYLE = 23,
55         GET_POINTER_STYLE = 24,
56         SET_FUNCTION_KEY_STATE = 25,
57         GET_FUNCTION_KEY_STATE = 26,
58         REGISTER_COOPERATE_MONITOR = 30,
59         UNREGISTER_COOPERATE_MONITOR = 31,
60         ENABLE_INPUT_DEVICE_COOPERATE = 32,
61         START_INPUT_DEVICE_COOPERATE = 33,
62         STOP_DEVICE_COOPERATE = 34,
63         GET_INPUT_DEVICE_COOPERATE_STATE = 35,
64         SET_INPUT_DEVICE_TO_SCREEN = 50,
65     };
66 
67     enum {
68         CONNECT_MODULE_TYPE_MMI_CLIENT = 0,
69     };
70     static constexpr int32_t INVALID_SOCKET_FD = -1;
71     static constexpr int32_t MULTIMODAL_INPUT_CONNECT_SERVICE_ID = MULTIMODAL_INPUT_SERVICE_ID;
72     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.multimodalinput.IConnectManager");
73 
74     virtual int32_t AllocSocketFd(const std::string &programName, const int32_t moduleType,
75         int32_t &socketFd, int32_t &tokenType) = 0;
76     virtual int32_t AddInputEventFilter(sptr<IEventFilter> filter) = 0;
77     virtual int32_t SetPointerVisible(bool visible) = 0;
78     virtual int32_t IsPointerVisible(bool &visible) = 0;
79     virtual int32_t SetPointerSpeed(int32_t speed) = 0;
80     virtual int32_t GetPointerSpeed(int32_t &speed) = 0;
81     virtual int32_t SetPointerStyle(int32_t windowId, int32_t pointerStyle) = 0;
82     virtual int32_t GetPointerStyle(int32_t windowId, int32_t &pointerStyle) = 0;
83     virtual int32_t SupportKeys(int32_t userData, int32_t deviceId, std::vector<int32_t> &keys) = 0;
84     virtual int32_t GetDeviceIds(int32_t userData) = 0;
85     virtual int32_t GetDevice(int32_t userData, int32_t id) = 0;
86     virtual int32_t RegisterDevListener() = 0;
87     virtual int32_t UnregisterDevListener() = 0;
88     virtual int32_t GetKeyboardType(int32_t userData, int32_t deviceId) = 0;
89     virtual int32_t AddInputHandler(InputHandlerType handlerType, HandleEventType eventType) = 0;
90     virtual int32_t RemoveInputHandler(InputHandlerType handlerType, HandleEventType eventType) = 0;
91     virtual int32_t MarkEventConsumed(int32_t eventId) = 0;
92     virtual int32_t MoveMouseEvent(int32_t offsetX, int32_t offsetY) = 0;
93     virtual int32_t InjectKeyEvent(const std::shared_ptr<KeyEvent> keyEvent) = 0;
94     virtual int32_t SubscribeKeyEvent(int32_t subscribeId, const std::shared_ptr<KeyOption> option) = 0;
95     virtual int32_t UnsubscribeKeyEvent(int32_t subscribeId) = 0;
96     virtual int32_t InjectPointerEvent(const std::shared_ptr<PointerEvent> pointerEvent) = 0;
97     virtual int32_t SetAnrObserver() = 0;
98     virtual int32_t RegisterCooperateListener() = 0;
99     virtual int32_t UnregisterCooperateListener() = 0;
100     virtual int32_t EnableInputDeviceCooperate(int32_t userData, bool enabled) = 0;
101     virtual int32_t StartInputDeviceCooperate(int32_t userData, const std::string &sinkDeviceId,
102         int32_t srcInputDeviceId) = 0;
103     virtual int32_t StopDeviceCooperate(int32_t userData) = 0;
104     virtual int32_t GetInputDeviceCooperateState(int32_t userData, const std::string &deviceId) = 0;
105     virtual int32_t SetInputDevice(const std::string& dhid, const std::string& screenId) = 0;
106     virtual int32_t GetFunctionKeyState(int32_t funckey, bool &state) = 0;
107     virtual int32_t SetFunctionKeyState(int32_t funcKey, bool enable) = 0;
108 };
109 } // namespace MMI
110 } // namespace OHOS
111 #endif // I_MULTIMODAL_INPUT_CONNECT_H
112