From 3fdbfef367514df07b0cf158fc24fe72aca0541f Mon Sep 17 00:00:00 2001 From: Chris Ye Date: Wed, 6 Jan 2021 18:45:18 -0800 Subject: Support Inputdevice LightsManager feature in frameworks. Add lights manager support to input frameworks. Bug: 161633625 Test: atest LightsManagerTest, atest InputDeviceLightsManagerTest Change-Id: Ie00357bce0f6c98e9eada5e0a79f93f48e7a4d1b --- include/input/InputDevice.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'include/input/InputDevice.h') diff --git a/include/input/InputDevice.h b/include/input/InputDevice.h index 2bd7bd2004..2deb99d154 100644 --- a/include/input/InputDevice.h +++ b/include/input/InputDevice.h @@ -100,6 +100,13 @@ enum class InputDeviceSensorReportingMode : int32_t { SPECIAL_TRIGGER = 3, }; +enum class InputDeviceLightType : int32_t { + SINGLE = 0, + PLAYER_ID = 1, + RGB = 2, + MULTI_COLOR = 3, +}; + struct InputDeviceSensorInfo { explicit InputDeviceSensorInfo(std::string name, std::string vendor, int32_t version, InputDeviceSensorType type, InputDeviceSensorAccuracy accuracy, @@ -156,6 +163,20 @@ struct InputDeviceSensorInfo { int32_t id; }; +struct InputDeviceLightInfo { + explicit InputDeviceLightInfo(std::string name, int32_t id, InputDeviceLightType type, + int32_t ordinal) + : name(name), id(id), type(type), ordinal(ordinal) {} + // Name string of the light. + std::string name; + // Light id + int32_t id; + // Type of the light. + InputDeviceLightType type; + // Ordinal of the light + int32_t ordinal; +}; + /* * Describes the characteristics and capabilities of an input device. */ @@ -198,6 +219,7 @@ public: float min, float max, float flat, float fuzz, float resolution); void addMotionRange(const MotionRange& range); void addSensorInfo(const InputDeviceSensorInfo& info); + void addLightInfo(const InputDeviceLightInfo& info); inline void setKeyboardType(int32_t keyboardType) { mKeyboardType = keyboardType; } inline int32_t getKeyboardType() const { return mKeyboardType; } @@ -230,6 +252,10 @@ public: const std::vector getSensorTypes(); + const std::vector getLightIds(); + + const InputDeviceLightInfo* getLightInfo(int32_t id); + private: int32_t mId; int32_t mGeneration; @@ -248,6 +274,8 @@ private: std::vector mMotionRanges; std::unordered_map mSensors; + /* Map from light ID to light info */ + std::unordered_map mLights; }; /* Types of input device configuration files. */ -- cgit v1.2.3-59-g8ed1b