blob: 7a99f90640762e57838fde97a876f62677976dcf [file] [log] [blame]
Tim Kilbourn73475a42015-02-13 10:35:20 -08001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_INPUT_DEVICE_H_
18#define ANDROID_INPUT_DEVICE_H_
19
20#include <memory>
21
22#include <utils/Timers.h>
23
24#include "InputHub.h"
25
26namespace android {
27
28/**
29 * InputDeviceInterface represents an input device in the HAL. It processes
30 * input events before passing them to the input host.
31 */
32class InputDeviceInterface {
33public:
34 virtual void processInput(InputEvent& event, nsecs_t currentTime) = 0;
35
36protected:
37 InputDeviceInterface() = default;
38 virtual ~InputDeviceInterface() = default;
39};
40
41/**
42 * EvdevDevice is an input device backed by a Linux evdev node.
43 */
44class EvdevDevice : public InputDeviceInterface {
45public:
Tim Kilbournc929d252015-04-29 13:50:17 -070046 explicit EvdevDevice(const std::shared_ptr<InputDeviceNode>& node);
Tim Kilbourn73475a42015-02-13 10:35:20 -080047 virtual ~EvdevDevice() override = default;
48
49 virtual void processInput(InputEvent& event, nsecs_t currentTime) override;
50
51private:
52 std::shared_ptr<InputDeviceNode> mDeviceNode;
53
54 int32_t mOverrideSec = 0;
55 int32_t mOverrideUsec = 0;
56};
57
58} // namespace android
59
60#endif // ANDROID_INPUT_DEVICE_H_