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 #ifndef MULTIMODAL_EVENT_HANDLER_H 16 #define MULTIMODAL_EVENT_HANDLER_H 17 18 #include "singleton.h" 19 #include "if_client_msg_handler.h" 20 #include "multimodal_standardized_event_manager.h" 21 #include "pointer_event.h" 22 #include "proto.h" 23 24 namespace OHOS { 25 namespace MMI { 26 enum RES_STATUS : uint8_t { 27 REG_STATUS_NOT_SYNC = 0, // 未同步 28 REG_STATUS_SYNCED = 1, // 以同步 29 }; 30 31 class MultimodalEventHandler : public Singleton<OHOS::MMI::MultimodalEventHandler> { 32 public: 33 MultimodalEventHandler() = default; 34 ~MultimodalEventHandler() = default; 35 int32_t GetMultimodeInputInfo(); 36 MMIClientPtr GetMMIClient(); 37 int32_t InjectEvent(const std::shared_ptr<OHOS::MMI::KeyEvent> keyEventPtr); 38 int32_t InjectPointerEvent(std::shared_ptr<PointerEvent> pointerEvent); 39 int32_t GetDevice(int32_t taskId, int32_t deviceId); 40 int32_t GetDeviceIds(int32_t taskId); 41 int32_t AddInputEventMontior(int32_t keyEventType); 42 void RemoveInputEventMontior(int32_t keyEventType); 43 int32_t AddInputEventTouchpadMontior(int32_t pointerEventType); 44 void RemoveInputEventTouchpadMontior(int32_t pointerEventType); 45 int32_t AddInterceptor(int32_t sourceType, int32_t id); 46 int32_t RemoveInterceptor(int32_t id); 47 48 /** 49 * Default constructor used to create a {@code MultimodalEventHandler} instance. 50 */ 51 private: 52 bool InitClient(); 53 54 private: 55 MMIClientPtr client_ = nullptr; 56 IClientMsgHandlerPtr cMsgHandler_ = nullptr; 57 }; 58 } // namespace MMI 59 } // namespace OHOS 60 #define MMIEventHdl OHOS::MMI::MultimodalEventHandler::GetInstance() 61 62 #endif // MULTIMODAL_EVENT_HANDLER_H