blob: 2902d17eaa9bf0375fcae93d70ded43f64345151 [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>
21#include <utils/Errors.h>
22#include <utils/String8.h>
23
24namespace android {
25
26// must be kept in sync with definitions in BatteryManager.java
27enum {
28 BATTERY_STATUS_UNKNOWN = 1, // equals BatteryManager.BATTERY_STATUS_UNKNOWN constant
29 BATTERY_STATUS_CHARGING = 2, // equals BatteryManager.BATTERY_STATUS_CHARGING constant
30 BATTERY_STATUS_DISCHARGING = 3, // equals BatteryManager.BATTERY_STATUS_DISCHARGING constant
31 BATTERY_STATUS_NOT_CHARGING = 4, // equals BatteryManager.BATTERY_STATUS_NOT_CHARGING constant
32 BATTERY_STATUS_FULL = 5, // equals BatteryManager.BATTERY_STATUS_FULL constant
33};
34
35// must be kept in sync with definitions in BatteryManager.java
36enum {
37 BATTERY_HEALTH_UNKNOWN = 1, // equals BatteryManager.BATTERY_HEALTH_UNKNOWN constant
38 BATTERY_HEALTH_GOOD = 2, // equals BatteryManager.BATTERY_HEALTH_GOOD constant
39 BATTERY_HEALTH_OVERHEAT = 3, // equals BatteryManager.BATTERY_HEALTH_OVERHEAT constant
40 BATTERY_HEALTH_DEAD = 4, // equals BatteryManager.BATTERY_HEALTH_DEAD constant
41 BATTERY_HEALTH_OVER_VOLTAGE = 5, // equals BatteryManager.BATTERY_HEALTH_OVER_VOLTAGE constant
42 BATTERY_HEALTH_UNSPECIFIED_FAILURE = 6, // equals BatteryManager.BATTERY_HEALTH_UNSPECIFIED_FAILURE constant
43 BATTERY_HEALTH_COLD = 7, // equals BatteryManager.BATTERY_HEALTH_COLD constant
44};
45
Todd Poynorcf808732013-08-14 17:23:37 -070046// must be kept in sync with definitions in BatteryProperty.java
47enum {
48 BATTERY_PROP_CHARGE_COUNTER = 1, // equals BatteryProperty.BATTERY_PROP_CHARGE_COUNTER constant
49 BATTERY_PROP_CURRENT_NOW = 2, // equals BatteryProperty.BATTERY_PROP_CURRENT_NOW constant
Todd Poynorc1509002013-08-27 18:12:17 -070050 BATTERY_PROP_CURRENT_AVG = 3, // equals BatteryProperty.BATTERY_PROP_CURRENT_AVG constant
Paul Lawrenced8e1f652014-03-03 13:43:20 -080051 BATTERY_PROP_CAPACITY = 4, // equals BatteryProperty.BATTERY_PROP_CAPACITY constant
Todd Poynorcf808732013-08-14 17:23:37 -070052};
53
Todd Poynor87bf0d92013-05-16 14:51:15 -070054struct BatteryProperties {
55 bool chargerAcOnline;
56 bool chargerUsbOnline;
57 bool chargerWirelessOnline;
58 int batteryStatus;
59 int batteryHealth;
60 bool batteryPresent;
61 int batteryLevel;
62 int batteryVoltage;
Todd Poynor87bf0d92013-05-16 14:51:15 -070063 int batteryTemperature;
64 String8 batteryTechnology;
65
66 status_t writeToParcel(Parcel* parcel) const;
67 status_t readFromParcel(Parcel* parcel);
68};
69
Todd Poynorcf808732013-08-14 17:23:37 -070070struct BatteryProperty {
71 int valueInt;
72
73 status_t writeToParcel(Parcel* parcel) const;
74 status_t readFromParcel(Parcel* parcel);
75};
76
Todd Poynor87bf0d92013-05-16 14:51:15 -070077}; // namespace android
78
79#endif // ANDROID_BATTERYSERVICE_H