Todd Poynor | 87bf0d9 | 2013-05-16 14:51:15 -0700 | [diff] [blame] | 1 | /* |
| 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 Poynor | a186e65 | 2014-05-08 16:04:22 -0700 | [diff] [blame] | 21 | #include <sys/types.h> |
Todd Poynor | 87bf0d9 | 2013-05-16 14:51:15 -0700 | [diff] [blame] | 22 | #include <utils/Errors.h> |
| 23 | #include <utils/String8.h> |
| 24 | |
| 25 | namespace android { |
| 26 | |
Sandeep Patil | e175a3e | 2016-11-10 13:39:51 -0800 | [diff] [blame^] | 27 | #include "BatteryServiceConstants.h" |
Todd Poynor | 87bf0d9 | 2013-05-16 14:51:15 -0700 | [diff] [blame] | 28 | |
Todd Poynor | cf80873 | 2013-08-14 17:23:37 -0700 | [diff] [blame] | 29 | // must be kept in sync with definitions in BatteryProperty.java |
| 30 | enum { |
Todd Poynor | a186e65 | 2014-05-08 16:04:22 -0700 | [diff] [blame] | 31 | 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 Poynor | cf80873 | 2013-08-14 17:23:37 -0700 | [diff] [blame] | 36 | }; |
| 37 | |
Todd Poynor | 87bf0d9 | 2013-05-16 14:51:15 -0700 | [diff] [blame] | 38 | struct BatteryProperties { |
| 39 | bool chargerAcOnline; |
| 40 | bool chargerUsbOnline; |
| 41 | bool chargerWirelessOnline; |
Adrian Roos | 687aa22 | 2015-07-10 13:08:28 -0700 | [diff] [blame] | 42 | int maxChargingCurrent; |
Badhri Jagan Sridharan | 06f511b | 2015-10-27 13:37:05 -0700 | [diff] [blame] | 43 | int maxChargingVoltage; |
Todd Poynor | 87bf0d9 | 2013-05-16 14:51:15 -0700 | [diff] [blame] | 44 | int batteryStatus; |
| 45 | int batteryHealth; |
| 46 | bool batteryPresent; |
| 47 | int batteryLevel; |
| 48 | int batteryVoltage; |
Todd Poynor | 87bf0d9 | 2013-05-16 14:51:15 -0700 | [diff] [blame] | 49 | int batteryTemperature; |
Ruchi Kandoi | ec3198e | 2015-08-12 17:49:42 -0700 | [diff] [blame] | 50 | int batteryCurrent; |
| 51 | int batteryCycleCount; |
| 52 | int batteryFullCharge; |
Ruchi Kandoi | 42a689b | 2016-04-06 17:53:23 -0700 | [diff] [blame] | 53 | int batteryChargeCounter; |
Todd Poynor | 87bf0d9 | 2013-05-16 14:51:15 -0700 | [diff] [blame] | 54 | String8 batteryTechnology; |
| 55 | |
| 56 | status_t writeToParcel(Parcel* parcel) const; |
| 57 | status_t readFromParcel(Parcel* parcel); |
| 58 | }; |
| 59 | |
Todd Poynor | cf80873 | 2013-08-14 17:23:37 -0700 | [diff] [blame] | 60 | struct BatteryProperty { |
Todd Poynor | a186e65 | 2014-05-08 16:04:22 -0700 | [diff] [blame] | 61 | int64_t valueInt64; |
Todd Poynor | cf80873 | 2013-08-14 17:23:37 -0700 | [diff] [blame] | 62 | |
| 63 | status_t writeToParcel(Parcel* parcel) const; |
| 64 | status_t readFromParcel(Parcel* parcel); |
| 65 | }; |
| 66 | |
Todd Poynor | 87bf0d9 | 2013-05-16 14:51:15 -0700 | [diff] [blame] | 67 | }; // namespace android |
| 68 | |
| 69 | #endif // ANDROID_BATTERYSERVICE_H |