1 /*
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_HOST_H
18 #define ANDROID_INPUT_HOST_H
19 
20 #include <vector>
21 
22 #include <hardware/input.h>
23 #include <utils/RefBase.h>
24 #include <utils/String8.h>
25 #include <utils/StrongPointer.h>
26 
27 #include "InputDriver.h"
28 
29 // Declare a concrete type for the HAL
30 struct input_host {
31 };
32 
33 namespace android {
34 
35 class InputDriverInterface;
36 
37 class InputHostInterface : public input_host_t, public virtual RefBase {
38 protected:
39     InputHostInterface() = default;
40     virtual ~InputHostInterface() = default;
41 
42 public:
43 
44     virtual void registerInputDriver(InputDriverInterface* driver) = 0;
45 
46     virtual void dump(String8& result) = 0;
47 };
48 
49 class InputHost : public InputHostInterface {
50 public:
51     InputHost() = default;
52 
53     virtual void registerInputDriver(InputDriverInterface* driver) override;
54 
55     virtual void dump(String8& result) override;
56 
57 private:
58     std::vector<sp<InputDriverInterface>> mDrivers;
59 };
60 
61 } // namespace android
62 #endif // ANDRIOD_INPUT_HOST_H
63