blob: 30d73170e893b07dd8029653a563713eecea2030 [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
Todd Poynorcf808732013-08-14 17:23:37 -070029// must be kept in sync with definitions in BatteryProperty.java
30enum {
Todd Poynora186e652014-05-08 16:04:22 -070031 BATTERY_PROP_CHARGE_COUNTER = 1, // equals BatteryProperty.CHARGE_COUNTER constant
32 BATTERY_PROP_CURRENT_NOW = 2, // equals BatteryProperty.CURRENT_NOW constant
33 BATTERY_PROP_CURRENT_AVG = 3, // equals BatteryProperty.CURRENT_AVG constant
34 BATTERY_PROP_CAPACITY = 4, // equals BatteryProperty.CAPACITY constant
35 BATTERY_PROP_ENERGY_COUNTER = 5, // equals BatteryProperty.ENERGY_COUNTER constant
Todd Poynorcf808732013-08-14 17:23:37 -070036};
37
Todd Poynor87bf0d92013-05-16 14:51:15 -070038struct BatteryProperties {
39 bool chargerAcOnline;
40 bool chargerUsbOnline;
41 bool chargerWirelessOnline;
Adrian Roos687aa222015-07-10 13:08:28 -070042 int maxChargingCurrent;
Badhri Jagan Sridharan06f511b2015-10-27 13:37:05 -070043 int maxChargingVoltage;
Todd Poynor87bf0d92013-05-16 14:51:15 -070044 int batteryStatus;
45 int batteryHealth;
46 bool batteryPresent;
47 int batteryLevel;
48 int batteryVoltage;
Todd Poynor87bf0d92013-05-16 14:51:15 -070049 int batteryTemperature;
Ruchi Kandoiec3198e2015-08-12 17:49:42 -070050 int batteryCurrent;
51 int batteryCycleCount;
52 int batteryFullCharge;
Ruchi Kandoi42a689b2016-04-06 17:53:23 -070053 int batteryChargeCounter;
Todd Poynor87bf0d92013-05-16 14:51:15 -070054 String8 batteryTechnology;
55
56 status_t writeToParcel(Parcel* parcel) const;
57 status_t readFromParcel(Parcel* parcel);
58};
59
Todd Poynorcf808732013-08-14 17:23:37 -070060struct BatteryProperty {
Todd Poynora186e652014-05-08 16:04:22 -070061 int64_t valueInt64;
Todd Poynorcf808732013-08-14 17:23:37 -070062
63 status_t writeToParcel(Parcel* parcel) const;
64 status_t readFromParcel(Parcel* parcel);
65};
66
Todd Poynor87bf0d92013-05-16 14:51:15 -070067}; // namespace android
68
69#endif // ANDROID_BATTERYSERVICE_H