BatteryService.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * Copyright (C) 2013 The Android Open Source Project
  3. * Copyright (C) 2015 The CyanogenMod Project
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. #ifndef ANDROID_BATTERYSERVICE_H
  18. #define ANDROID_BATTERYSERVICE_H
  19. #include <binder/Parcel.h>
  20. #include <sys/types.h>
  21. #include <utils/Errors.h>
  22. #include <utils/String8.h>
  23. namespace android {
  24. // must be kept in sync with definitions in BatteryManager.java
  25. enum {
  26. BATTERY_STATUS_UNKNOWN = 1, // equals BatteryManager.BATTERY_STATUS_UNKNOWN constant
  27. BATTERY_STATUS_CHARGING = 2, // equals BatteryManager.BATTERY_STATUS_CHARGING constant
  28. BATTERY_STATUS_DISCHARGING = 3, // equals BatteryManager.BATTERY_STATUS_DISCHARGING constant
  29. BATTERY_STATUS_NOT_CHARGING = 4, // equals BatteryManager.BATTERY_STATUS_NOT_CHARGING constant
  30. BATTERY_STATUS_FULL = 5, // equals BatteryManager.BATTERY_STATUS_FULL constant
  31. };
  32. // must be kept in sync with definitions in BatteryManager.java
  33. enum {
  34. BATTERY_HEALTH_UNKNOWN = 1, // equals BatteryManager.BATTERY_HEALTH_UNKNOWN constant
  35. BATTERY_HEALTH_GOOD = 2, // equals BatteryManager.BATTERY_HEALTH_GOOD constant
  36. BATTERY_HEALTH_OVERHEAT = 3, // equals BatteryManager.BATTERY_HEALTH_OVERHEAT constant
  37. BATTERY_HEALTH_DEAD = 4, // equals BatteryManager.BATTERY_HEALTH_DEAD constant
  38. BATTERY_HEALTH_OVER_VOLTAGE = 5, // equals BatteryManager.BATTERY_HEALTH_OVER_VOLTAGE constant
  39. BATTERY_HEALTH_UNSPECIFIED_FAILURE = 6, // equals BatteryManager.BATTERY_HEALTH_UNSPECIFIED_FAILURE constant
  40. BATTERY_HEALTH_COLD = 7, // equals BatteryManager.BATTERY_HEALTH_COLD constant
  41. };
  42. // must be kept in sync with definitions in BatteryProperty.java
  43. enum {
  44. BATTERY_PROP_CHARGE_COUNTER = 1, // equals BatteryProperty.CHARGE_COUNTER constant
  45. BATTERY_PROP_CURRENT_NOW = 2, // equals BatteryProperty.CURRENT_NOW constant
  46. BATTERY_PROP_CURRENT_AVG = 3, // equals BatteryProperty.CURRENT_AVG constant
  47. BATTERY_PROP_CAPACITY = 4, // equals BatteryProperty.CAPACITY constant
  48. BATTERY_PROP_ENERGY_COUNTER = 5, // equals BatteryProperty.ENERGY_COUNTER constant
  49. };
  50. struct BatteryProperties {
  51. bool chargerAcOnline;
  52. bool chargerUsbOnline;
  53. bool chargerWirelessOnline;
  54. int maxChargingCurrent;
  55. int batteryStatus;
  56. int batteryHealth;
  57. bool batteryPresent;
  58. int batteryLevel;
  59. int batteryVoltage;
  60. int batteryTemperature;
  61. String8 batteryTechnology;
  62. bool dockBatterySupported;
  63. bool chargerDockAcOnline;
  64. int dockBatteryStatus;
  65. int dockBatteryHealth;
  66. bool dockBatteryPresent;
  67. int dockBatteryLevel;
  68. int dockBatteryVoltage;
  69. int dockBatteryTemperature;
  70. String8 dockBatteryTechnology;
  71. status_t writeToParcel(Parcel* parcel) const;
  72. status_t readFromParcel(Parcel* parcel);
  73. };
  74. struct BatteryProperty {
  75. int64_t valueInt64;
  76. status_t writeToParcel(Parcel* parcel) const;
  77. status_t readFromParcel(Parcel* parcel);
  78. };
  79. }; // namespace android
  80. #endif // ANDROID_BATTERYSERVICE_H