blob: 306e36119bf5c7e04495cfa58948e8fe0c972b9d [file] [log] [blame]
Chris Yee2b1e5c2021-03-10 22:45:12 -08001/*
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
25namespace android {
26
Chris Ye1dd2e5c2021-04-04 23:12:41 -070027/* A peripheral controller manages the input device peripherals associated with the input device,
Chris Yee2b1e5c2021-03-10 22:45:12 -080028 * like the sysfs based battery and light class devices.
29 *
30 */
Chris Ye1dd2e5c2021-04-04 23:12:41 -070031class PeripheralControllerInterface {
Chris Yee2b1e5c2021-03-10 22:45:12 -080032public:
Chris Ye1dd2e5c2021-04-04 23:12:41 -070033 PeripheralControllerInterface() {}
34 virtual ~PeripheralControllerInterface() {}
Chris Yee2b1e5c2021-03-10 22:45:12 -080035
Andy Chenf9f1a022022-08-29 20:07:10 -040036 virtual int32_t getEventHubId() const = 0;
37
Chris Yee2b1e5c2021-03-10 22:45:12 -080038 // Interface methods for Battery
39 virtual std::optional<int32_t> getBatteryCapacity(int32_t batteryId) = 0;
40 virtual std::optional<int32_t> getBatteryStatus(int32_t batteryId) = 0;
41
42 // Interface methods for Light
43 virtual bool setLightColor(int32_t lightId, int32_t color) = 0;
44 virtual bool setLightPlayerId(int32_t lightId, int32_t playerId) = 0;
45 virtual std::optional<int32_t> getLightColor(int32_t lightId) = 0;
46 virtual std::optional<int32_t> getLightPlayerId(int32_t lightId) = 0;
47
48 virtual void populateDeviceInfo(InputDeviceInfo* deviceInfo) = 0;
49 virtual void dump(std::string& dump) = 0;
50};
51
52} // namespace android
53
54#endif // _UI_INPUTREADER_INPUT_CONTROLLER_H