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 #ifndef UPDATER_UI_POINTERS_INPUT_DEVICE_H
16 #define UPDATER_UI_POINTERS_INPUT_DEVICE_H
17 #include <linux/input.h>
18 #include "input_manager.h"
19 #include "macros_updater.h"
20 #include "dock/pointer_input_device.h"
21 #include "dock/input_device.h"
22 
23 namespace Updater {
24 void AddInputDevice();
25 void HandlePointersEvent(const input_event &ev, uint32_t type);
26 class PointersInputDevice : public OHOS::PointerInputDevice {
27     DISALLOW_COPY_MOVE(PointersInputDevice);
28 public:
29     PointersInputDevice() = default;
30     virtual ~PointersInputDevice() = default;
31     static PointersInputDevice &GetInstance();
32     bool Read(OHOS::DeviceData &data) override;
33     bool ReadPoint(OHOS::DeviceData& data, OHOS::Point pos, bool fingerPressDown);
34     bool ReadTouch(OHOS::DeviceData &data);
35     void SetFingerDown(bool isPressed);
36     int HandlePointEvent(const input_event &ev, uint32_t type);
37     void HandleEvAbsMt(const input_event &ev);
38 
39 private:
40     OHOS::Point reportAbsMt_ {};
41     bool touchFingerDown_ { false };
42 };
43 } // namespace Updater
44 #endif // UPDATER_UI_POINTERS_INPUT_DEVICE_H