InputHost.h 1.5 KB

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