Chris Ye | e2b1e5c | 2021-03-10 22:45:12 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2021 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 | |
Prabir Pradhan | 4810866 | 2022-09-09 21:22:04 +0000 | [diff] [blame] | 17 | #pragma once |
Chris Ye | e2b1e5c | 2021-03-10 22:45:12 -0800 | [diff] [blame] | 18 | |
| 19 | #include "EventHub.h" |
| 20 | #include "InputDevice.h" |
| 21 | #include "InputListener.h" |
| 22 | #include "InputReaderContext.h" |
| 23 | |
| 24 | namespace android { |
| 25 | |
Chris Ye | 1dd2e5c | 2021-04-04 23:12:41 -0700 | [diff] [blame] | 26 | /* A peripheral controller manages the input device peripherals associated with the input device, |
Chris Ye | e2b1e5c | 2021-03-10 22:45:12 -0800 | [diff] [blame] | 27 | * like the sysfs based battery and light class devices. |
| 28 | * |
| 29 | */ |
Chris Ye | 1dd2e5c | 2021-04-04 23:12:41 -0700 | [diff] [blame] | 30 | class PeripheralControllerInterface { |
Chris Ye | e2b1e5c | 2021-03-10 22:45:12 -0800 | [diff] [blame] | 31 | public: |
Chris Ye | 1dd2e5c | 2021-04-04 23:12:41 -0700 | [diff] [blame] | 32 | PeripheralControllerInterface() {} |
| 33 | virtual ~PeripheralControllerInterface() {} |
Chris Ye | e2b1e5c | 2021-03-10 22:45:12 -0800 | [diff] [blame] | 34 | |
Andy Chen | f9f1a02 | 2022-08-29 20:07:10 -0400 | [diff] [blame] | 35 | virtual int32_t getEventHubId() const = 0; |
| 36 | |
Chris Ye | e2b1e5c | 2021-03-10 22:45:12 -0800 | [diff] [blame] | 37 | // Interface methods for Battery |
| 38 | virtual std::optional<int32_t> getBatteryCapacity(int32_t batteryId) = 0; |
| 39 | virtual std::optional<int32_t> getBatteryStatus(int32_t batteryId) = 0; |
| 40 | |
| 41 | // Interface methods for Light |
| 42 | virtual bool setLightColor(int32_t lightId, int32_t color) = 0; |
| 43 | virtual bool setLightPlayerId(int32_t lightId, int32_t playerId) = 0; |
| 44 | virtual std::optional<int32_t> getLightColor(int32_t lightId) = 0; |
| 45 | virtual std::optional<int32_t> getLightPlayerId(int32_t lightId) = 0; |
| 46 | |
| 47 | virtual void populateDeviceInfo(InputDeviceInfo* deviceInfo) = 0; |
| 48 | virtual void dump(std::string& dump) = 0; |
| 49 | }; |
| 50 | |
| 51 | } // namespace android |