1 /* 2 * Copyright (c) 2021-2024 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 #include "system_ability_definition.h" 21 22 #include "extra_data.h" 23 #ifdef OHOS_BUILD_ENABLE_ANCO 24 #include "i_anco_channel.h" 25 #endif // OHOS_BUILD_ENABLE_ANCO 26 #include "i_event_filter.h" 27 #include "i_input_event_filter.h" 28 #include "infrared_frequency_info.h" 29 #include "input_device.h" 30 #include "input_handler_type.h" 31 #include "key_event.h" 32 #include "key_option.h" 33 #include "mmi_event_observer.h" 34 #include "multimodalinput_ipc_interface_code.h" 35 #include "nap_process.h" 36 #include "pointer_event.h" 37 #include "pointer_style.h" 38 #include "window_info.h" 39 40 namespace OHOS { 41 namespace MMI { 42 class IMultimodalInputConnect : public IRemoteBroker { 43 public: 44 enum { 45 CONNECT_MODULE_TYPE_MMI_CLIENT = 0, 46 }; 47 static constexpr int32_t INVALID_SOCKET_FD = -1; 48 static constexpr int32_t MULTIMODAL_INPUT_CONNECT_SERVICE_ID = MULTIMODAL_INPUT_SERVICE_ID; 49 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.multimodalinput.IConnectManager"); 50 51 virtual int32_t AllocSocketFd(const std::string &programName, const int32_t moduleType, 52 int32_t &socketFd, int32_t &tokenType) = 0; 53 virtual int32_t AddInputEventFilter(sptr<IEventFilter> filter, int32_t filterId, int32_t priority, 54 uint32_t deviceTags) = 0; 55 virtual int32_t NotifyNapOnline() = 0; 56 virtual int32_t RemoveInputEventObserver() = 0; 57 virtual int32_t RemoveInputEventFilter(int32_t filterId) = 0; 58 virtual int32_t SetMouseScrollRows(int32_t rows) = 0; 59 virtual int32_t GetMouseScrollRows(int32_t &rows) = 0; 60 virtual int32_t SetCustomCursor(int32_t pid, int32_t windowId, int32_t focusX, int32_t focusY, void* pixelMap) = 0; 61 virtual int32_t SetMouseIcon(int32_t windowId, void* pixelMap) = 0; 62 virtual int32_t SetPointerSize(int32_t size) = 0; 63 virtual int32_t SetNapStatus(int32_t pid, int32_t uid, std::string bundleName, int32_t napStatus) = 0; 64 virtual int32_t GetPointerSize(int32_t &size) = 0; 65 virtual int32_t SetMouseHotSpot(int32_t pid, int32_t windowId, int32_t hotSpotX, int32_t hotSpotY) = 0; 66 virtual int32_t SetMousePrimaryButton(int32_t primaryButton) = 0; 67 virtual int32_t GetMousePrimaryButton(int32_t &primaryButton) = 0; 68 virtual int32_t SetHoverScrollState(bool state) = 0; 69 virtual int32_t GetHoverScrollState(bool &state) = 0; 70 virtual int32_t SetPointerVisible(bool visible, int32_t priority) = 0; 71 virtual int32_t IsPointerVisible(bool &visible) = 0; 72 virtual int32_t MarkProcessed(int32_t eventType, int32_t eventId) = 0; 73 virtual int32_t SetPointerColor(int32_t color) = 0; 74 virtual int32_t GetPointerColor(int32_t &color) = 0; 75 virtual int32_t EnableCombineKey(bool enable) = 0; 76 virtual int32_t SetPointerSpeed(int32_t speed) = 0; 77 virtual int32_t GetPointerSpeed(int32_t &speed) = 0; 78 virtual int32_t SetPointerStyle(int32_t windowId, PointerStyle pointerStyle, bool isUiExtension = false) = 0; 79 virtual int32_t GetPointerStyle(int32_t windowId, PointerStyle &pointerStyle, bool isUiExtension = false) = 0; 80 virtual int32_t SupportKeys(int32_t deviceId, std::vector<int32_t> &keys, std::vector<bool> &keystroke) = 0; 81 virtual int32_t GetDeviceIds(std::vector<int32_t> &ids) = 0; 82 virtual int32_t GetDevice(int32_t deviceId, std::shared_ptr<InputDevice> &inputDevice) = 0; 83 virtual int32_t RegisterDevListener() = 0; 84 virtual int32_t UnregisterDevListener() = 0; 85 virtual int32_t GetKeyboardType(int32_t deviceId, int32_t &keyboardType) = 0; 86 virtual int32_t SetKeyboardRepeatDelay(int32_t delay) = 0; 87 virtual int32_t SetKeyboardRepeatRate(int32_t rate) = 0; 88 virtual int32_t GetKeyboardRepeatDelay(int32_t &delay) = 0; 89 virtual int32_t GetKeyboardRepeatRate(int32_t &rate) = 0; 90 virtual int32_t AddInputHandler(InputHandlerType handlerType, HandleEventType eventType, 91 int32_t priority, uint32_t deviceTags) = 0; 92 virtual int32_t RemoveInputHandler(InputHandlerType handlerType, HandleEventType eventType, 93 int32_t priority, uint32_t deviceTags) = 0; 94 virtual int32_t MarkEventConsumed(int32_t eventId) = 0; 95 virtual int32_t MoveMouseEvent(int32_t offsetX, int32_t offsetY) = 0; 96 virtual int32_t InjectKeyEvent(const std::shared_ptr<KeyEvent> keyEvent, bool isNativeInject) = 0; 97 virtual int32_t SubscribeKeyEvent(int32_t subscribeId, const std::shared_ptr<KeyOption> option) = 0; 98 virtual int32_t UnsubscribeKeyEvent(int32_t subscribeId) = 0; 99 virtual int32_t SubscribeSwitchEvent(int32_t subscribeId, int32_t switchType) = 0; 100 virtual int32_t UnsubscribeSwitchEvent(int32_t subscribeId) = 0; 101 virtual int32_t InjectPointerEvent(const std::shared_ptr<PointerEvent> pointerEvent, bool isNativeInject) = 0; 102 virtual int32_t SetAnrObserver() = 0; 103 virtual int32_t GetDisplayBindInfo(DisplayBindInfos &infos) = 0; 104 virtual int32_t GetAllMmiSubscribedEvents(std::map<std::tuple<int32_t, int32_t, std::string>, int32_t> &datas) = 0; 105 virtual int32_t SetDisplayBind(int32_t deviceId, int32_t displayId, std::string &msg) = 0; 106 virtual int32_t GetFunctionKeyState(int32_t funckey, bool &state) = 0; 107 virtual int32_t SetFunctionKeyState(int32_t funcKey, bool enable) = 0; 108 virtual int32_t SetPointerLocation(int32_t x, int32_t y) = 0; 109 virtual int32_t ClearWindowPointerStyle(int32_t pid, int32_t windowId) = 0; 110 virtual int32_t SetMouseCaptureMode(int32_t windowId, bool isCaptureMode) = 0; 111 virtual int32_t GetWindowPid(int32_t windowId) = 0; 112 virtual int32_t AppendExtraData(const ExtraData& extraData) = 0; 113 virtual int32_t EnableInputDevice(bool enable) = 0; 114 virtual int32_t SetKeyDownDuration(const std::string &businessId, int32_t delay) = 0; 115 virtual int32_t SetTouchpadScrollSwitch(bool switchFlag) = 0; 116 virtual int32_t GetTouchpadScrollSwitch(bool &switchFlag) = 0; 117 virtual int32_t SetTouchpadScrollDirection(bool state) = 0; 118 virtual int32_t GetTouchpadScrollDirection(bool &state) = 0; 119 virtual int32_t SetTouchpadTapSwitch(bool switchFlag) = 0; 120 virtual int32_t GetTouchpadTapSwitch(bool &switchFlag) = 0; 121 virtual int32_t SetTouchpadPointerSpeed(int32_t speed) = 0; 122 virtual int32_t GetTouchpadPointerSpeed(int32_t &speed) = 0; 123 virtual int32_t SetTouchpadPinchSwitch(bool switchFlag) = 0; 124 virtual int32_t GetTouchpadPinchSwitch(bool &switchFlag) = 0; 125 virtual int32_t SetTouchpadSwipeSwitch(bool switchFlag) = 0; 126 virtual int32_t GetTouchpadSwipeSwitch(bool &switchFlag) = 0; 127 virtual int32_t SetTouchpadRightClickType(int32_t type) = 0; 128 virtual int32_t GetTouchpadRightClickType(int32_t &type) = 0; 129 virtual int32_t SetTouchpadRotateSwitch(bool rotateSwitch) = 0; 130 virtual int32_t GetTouchpadRotateSwitch(bool &rotateSwitch) = 0; 131 virtual int32_t SetTouchpadDoubleTapAndDragState(bool switchFlag) = 0; 132 virtual int32_t GetTouchpadDoubleTapAndDragState(bool &switchFlag) = 0; 133 virtual int32_t SetShieldStatus(int32_t shieldMode, bool isShield) = 0; 134 virtual int32_t GetShieldStatus(int32_t shieldMode, bool &isShield) = 0; 135 virtual int32_t GetKeyState(std::vector<int32_t> &pressedKeys, std::map<int32_t, int32_t> &specialKeysState) = 0; 136 virtual int32_t Authorize(bool isAuthorize) = 0; 137 virtual int32_t CancelInjection() = 0; 138 virtual int32_t SetPixelMapData(int32_t infoId, void* pixelMap) = 0; 139 virtual int32_t HasIrEmitter(bool &hasIrEmitter) = 0; 140 virtual int32_t GetInfraredFrequencies(std::vector<InfraredFrequency>& requencys) = 0; 141 virtual int32_t TransmitInfrared(int64_t number, std::vector<int64_t>& pattern) = 0; 142 virtual int32_t SetCurrentUser(int32_t userId) = 0; 143 virtual int32_t AddVirtualInputDevice(std::shared_ptr<InputDevice> device, int32_t &deviceId) = 0; 144 virtual int32_t RemoveVirtualInputDevice(int32_t deviceId) = 0; 145 virtual int32_t EnableHardwareCursorStats(bool enable) = 0; 146 virtual int32_t GetHardwareCursorStats(uint32_t &frameCount, uint32_t &vsyncCount) = 0; 147 virtual int32_t GetIntervalSinceLastInput(int64_t &timeInterval) = 0; 148 #ifdef OHOS_BUILD_ENABLE_MAGICCURSOR 149 virtual int32_t GetPointerSnapshot(void *pixelMapPtr) = 0; 150 #endif // OHOS_BUILD_ENABLE_MAGICCURSOR 151 #ifdef OHOS_BUILD_ENABLE_ANCO 152 virtual int32_t AncoAddChannel(sptr<IAncoChannel> channel) = 0; 153 virtual int32_t AncoRemoveChannel(sptr<IAncoChannel> channel) = 0; 154 #endif // OHOS_BUILD_ENABLE_ANCO 155 virtual int32_t TransferBinderClientSrv(const sptr<IRemoteObject> &binderClientObject) = 0; 156 virtual int32_t SkipPointerLayer(bool isSkip) = 0; 157 }; 158 } // namespace MMI 159 } // namespace OHOS 160 #endif // I_MULTIMODAL_INPUT_CONNECT_H 161