Advertisement
Python253

Battstatts.py

Mar 6th, 2018
423
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.70 KB | None | 1 0
  1. #!/usr/bin/env python3.2.2
  2. ## -*- coding: utf-8 -*-
  3. # An Extensive Look At Your Android's Device Battery Stats.
  4.  
  5. __file_name__ = 'battstatts.py'
  6. __author__ = 'Dan Evans'
  7. __copyright__ = 'Copyright 2012©, Coding With Py'
  8. __credits__ = 'Dan Evans'
  9. __dct_url__ = 'http://purl.org/dc/terms/'
  10. __license__ = 'Creative Commons'
  11. __rel_url__ = 'http://creativecommons.org/licenses/by-nc/4.0/'
  12. __version__ = 'CC-by-nc/4.0/'
  13. __maintainer__ = 'Dan(Python253)Evans'
  14. __email__ = 'Python253@gmail.com'
  15.  
  16. print('\n','','battstatts.py is licensed under',
  17.     'The Creative Commons Attribution-NonCommercial 4.0 International License',
  18.     '\n'*2,'File Name: '+__file_name__,'\n','Author: '+__author__,
  19.     '\n','Copyright: '+__copyright__,'\n','Credits: '+__credits__,
  20.     '\n','DCT URL: ','\n',__dct_url__,'\n','License: '+__license__,
  21.     '\n','Release URL: ','\n',__rel_url__,'\n','Version: '+__version__,
  22.     '\n','Maintainer: '+__maintainer__,'\n','Email: '+__email__,'\n')
  23. import android as a
  24. droid = a.Android()
  25. d = droid
  26. d.batteryStartMonitoring()
  27. Health = {1: "Unknown", 2: "Good", 3: "Overheat", 4: "Dead", 5: "Over Voltage", 6: "Failure"}
  28. Plug = {-1: "Unknown", 0: "Unplugged", 1: "AC Charger", 2: "USB Port"}
  29. Status = {1: "Unknown", 2: "Charging", 3: "Discharging", 4: "Not Charging", 5: "Full"}
  30. d.eventWaitFor("battery")
  31. d.eventClearBuffer()
  32. print("    ::Full Battery Data::  \n\n", d.readBatteryData().result)
  33. print("\n\n    ::Now In Plain English::\n")
  34. print("Your Battery Is Present:          ", d.batteryCheckPresent().result)
  35. print("Your Battery Technology:          ", d.batteryGetTechnology().result)
  36. print("Your Current Battery Voltage:     ", d.batteryGetVoltage().result, "nV")
  37. print("Your Current Battery Temperature: ", d.batteryGetTemperature().result/10.0, "\\°C")
  38. print("Your Battery Raw Temperature:      %1.0F (\\°C/10.0)" % (d.batteryGetTemperature().result))
  39. #Battery Plug Type Key:    
  40. # -1: "Unknown"
  41. #  0: "Unplugged"
  42. #  1: "AC Charger"
  43. #  2: "USB Port"
  44. print("Your Current Battery Plug Type:   ", Plug[d.batteryGetPlugType().result])
  45. print("Your Current Battery Level:       ", d.batteryGetLevel().result, "%")
  46. #Battery Stat Key:
  47. #  1: "Unknown"
  48. #  2: "Charging"
  49. #  3: "Discharging"
  50. #  4: "Not Charging"
  51. #  5: "Full"
  52. print("Your Current Battery Status:      ", Status[d.batteryGetStatus().result])
  53. #Battery Health Key:
  54. #  1: "Unknown"
  55. #  2: "Good"
  56. #  3: "Overheat"
  57. #  4: "Dead"
  58. #  5: "Over Voltage"
  59. #  6: "Failure"
  60. print("Your Current Battery Health:      ", Health[d.batteryGetHealth().result])
  61. print("\nCheck Power Saver Mode:\n    Need to define all processes related to Power Saver Mode\n    then print if Mode is On or Off.")
  62. print()
  63. d.batteryStopMonitoring()
  64. #end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement