• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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_INPUT_ADAPTER_H
17 #define I_INPUT_ADAPTER_H
18 
19 #include <functional>
20 #include <memory>
21 
22 #include "key_event.h"
23 #include "pointer_event.h"
24 
25 namespace OHOS {
26 namespace Msdp {
27 namespace DeviceStatus {
28 class IInputAdapter {
29 public:
30     IInputAdapter() = default;
31     virtual ~IInputAdapter() = default;
32 
33     virtual int32_t AddMonitor(std::function<void(std::shared_ptr<MMI::PointerEvent>)> callback) = 0;
34     virtual int32_t AddMonitor(std::function<void(std::shared_ptr<MMI::KeyEvent>)> callback) = 0;
35     virtual void RemoveMonitor(int32_t monitorId) = 0;
36 
37     virtual int32_t AddInterceptor(std::function<void(std::shared_ptr<MMI::PointerEvent>)> pointerCb) = 0;
38     virtual int32_t AddInterceptor(std::function<void(std::shared_ptr<MMI::KeyEvent>)> keyCb) = 0;
39     virtual int32_t AddInterceptor(std::function<void(std::shared_ptr<MMI::PointerEvent>)> pointerCb,
40                                    std::function<void(std::shared_ptr<MMI::KeyEvent>)> keyCb) = 0;
41     virtual void RemoveInterceptor(int32_t interceptorId) = 0;
42 
43     virtual int32_t AddFilter(std::function<bool(std::shared_ptr<MMI::PointerEvent>)> callback) = 0;
44     virtual void RemoveFilter(int32_t filterId) = 0;
45 };
46 } // namespace DeviceStatus
47 } // namespace Msdp
48 } // namespace OHOS
49 #endif // I_INPUT_ADAPTER_H
50