blob: 80ab7f3e9e6bf844855889d1a01ad212640ce977 [file] [log] [blame]
Todd Poynor87bf0d92013-05-16 14:51:15 -07001/*
2 * Copyright (C) 2013 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 ANDROID_BATTERYSERVICE_H
18#define ANDROID_BATTERYSERVICE_H
19
20#include <binder/Parcel.h>
Todd Poynora186e652014-05-08 16:04:22 -070021#include <sys/types.h>
Todd Poynor87bf0d92013-05-16 14:51:15 -070022#include <utils/Errors.h>
23#include <utils/String8.h>
24
25namespace android {
26
Sandeep Patile175a3e2016-11-10 13:39:51 -080027#include "BatteryServiceConstants.h"
Todd Poynor87bf0d92013-05-16 14:51:15 -070028
Jin Qianeec0ab52017-02-02 17:33:36 -080029// must be kept in sync with definitions in
30// frameworks/base/core/java/android/os/BatteryManager.java
Todd Poynorcf808732013-08-14 17:23:37 -070031enum {
Jin Qianeec0ab52017-02-02 17:33:36 -080032 BATTERY_PROP_CHARGE_COUNTER = 1, // equals BATTERY_PROPERTY_CHARGE_COUNTER
33 BATTERY_PROP_CURRENT_NOW = 2, // equals BATTERY_PROPERTY_CURRENT_NOW
34 BATTERY_PROP_CURRENT_AVG = 3, // equals BATTERY_PROPERTY_CURRENT_AVERAGE
35 BATTERY_PROP_CAPACITY = 4, // equals BATTERY_PROPERTY_CAPACITY
36 BATTERY_PROP_ENERGY_COUNTER = 5, // equals BATTERY_PROPERTY_ENERGY_COUNTER
37 BATTERY_PROP_BATTERY_STATUS = 6, // equals BATTERY_PROPERTY_BATTERY_STATUS
Todd Poynorcf808732013-08-14 17:23:37 -070038};
39
Todd Poynor87bf0d92013-05-16 14:51:15 -070040struct BatteryProperties {
41 bool chargerAcOnline;
42 bool chargerUsbOnline;
43 bool chargerWirelessOnline;
Adrian Roos687aa222015-07-10 13:08:28 -070044 int maxChargingCurrent;
Badhri Jagan Sridharan06f511b2015-10-27 13:37:05 -070045 int maxChargingVoltage;
Todd Poynor87bf0d92013-05-16 14:51:15 -070046 int batteryStatus;
47 int batteryHealth;
48 bool batteryPresent;
49 int batteryLevel;
50 int batteryVoltage;
Todd Poynor87bf0d92013-05-16 14:51:15 -070051 int batteryTemperature;
Ruchi Kandoiec3198e2015-08-12 17:49:42 -070052 int batteryCurrent;
53 int batteryCycleCount;
54 int batteryFullCharge;
Ruchi Kandoi42a689b2016-04-06 17:53:23 -070055 int batteryChargeCounter;
Todd Poynor87bf0d92013-05-16 14:51:15 -070056 String8 batteryTechnology;
57
58 status_t writeToParcel(Parcel* parcel) const;
59 status_t readFromParcel(Parcel* parcel);
60};
61
Todd Poynorcf808732013-08-14 17:23:37 -070062struct BatteryProperty {
Todd Poynora186e652014-05-08 16:04:22 -070063 int64_t valueInt64;
Todd Poynorcf808732013-08-14 17:23:37 -070064
65 status_t writeToParcel(Parcel* parcel) const;
66 status_t readFromParcel(Parcel* parcel);
67};
68
Todd Poynor87bf0d92013-05-16 14:51:15 -070069}; // namespace android
70
71#endif // ANDROID_BATTERYSERVICE_H