blob: 76ed1ca038e5887616a6650b3a04d730033d9728 [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
Prabir Pradhan48108662022-09-09 21:22:04 +000017#pragma once
Chris Yee2b1e5c2021-03-10 22:45:12 -080018
19#include "EventHub.h"
20#include "InputDevice.h"
21#include "InputListener.h"
22#include "InputReaderContext.h"
23
24namespace android {
25
Chris Ye1dd2e5c2021-04-04 23:12:41 -070026/* A peripheral controller manages the input device peripherals associated with the input device,
Chris Yee2b1e5c2021-03-10 22:45:12 -080027 * like the sysfs based battery and light class devices.
28 *
29 */
Chris Ye1dd2e5c2021-04-04 23:12:41 -070030class PeripheralControllerInterface {
Chris Yee2b1e5c2021-03-10 22:45:12 -080031public:
Chris Ye1dd2e5c2021-04-04 23:12:41 -070032 PeripheralControllerInterface() {}
33 virtual ~PeripheralControllerInterface() {}
Chris Yee2b1e5c2021-03-10 22:45:12 -080034
Andy Chenf9f1a022022-08-29 20:07:10 -040035 virtual int32_t getEventHubId() const = 0;
36
Chris Yee2b1e5c2021-03-10 22:45:12 -080037 // 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