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 17 #ifndef _UI_INPUTREADER_INPUT_CONTROLLER_H 18 #define _UI_INPUTREADER_INPUT_CONTROLLER_H 19 20 #include "EventHub.h" 21 #include "InputDevice.h" 22 #include "InputListener.h" 23 #include "InputReaderContext.h" 24 25 namespace android { 26 27 /* A peripheral controller manages the input device peripherals associated with the input device, 28 * like the sysfs based battery and light class devices. 29 * 30 */ 31 class PeripheralControllerInterface { 32 public: PeripheralControllerInterface()33 PeripheralControllerInterface() {} ~PeripheralControllerInterface()34 virtual ~PeripheralControllerInterface() {} 35 36 // Interface methods for Battery 37 virtual std::optional<int32_t> getBatteryCapacity(int32_t batteryId) = 0; 38 virtual std::optional<int32_t> getBatteryStatus(int32_t batteryId) = 0; 39 40 // Interface methods for Light 41 virtual bool setLightColor(int32_t lightId, int32_t color) = 0; 42 virtual bool setLightPlayerId(int32_t lightId, int32_t playerId) = 0; 43 virtual std::optional<int32_t> getLightColor(int32_t lightId) = 0; 44 virtual std::optional<int32_t> getLightPlayerId(int32_t lightId) = 0; 45 46 virtual void populateDeviceInfo(InputDeviceInfo* deviceInfo) = 0; 47 virtual void dump(std::string& dump) = 0; 48 }; 49 50 } // namespace android 51 52 #endif // _UI_INPUTREADER_INPUT_CONTROLLER_H 53