com.googlecode.android_scripting.facade
Class BatteryManagerFacade

java.lang.Object
  extended by com.googlecode.android_scripting.jsonrpc.RpcReceiver
      extended by com.googlecode.android_scripting.facade.BatteryManagerFacade

public class BatteryManagerFacade
extends RpcReceiver

Exposes Batterymanager API. Note that in order to use any of the batteryGet* functions, you need to batteryStartMonitoring, and then wait for a "battery" event. Sleeping for a second will usually work just as well.

Author:
Alexey Reznichenko (alexey.reznichenko@gmail.com), Robbie Matthews (rjmatthews62@gmail.com)

Field Summary
static int BATTERY_PLUGGED_AC
          Power source is an AC charger.
static int BATTERY_PLUGGED_USB
          Power source is a USB port.
 
Constructor Summary
BatteryManagerFacade(FacadeManager manager)
           
 
Method Summary
 java.lang.Boolean batteryCheckPresent()
           
 java.lang.Integer batteryGetHealth()
           
 java.lang.Integer batteryGetLevel()
           
 java.lang.Integer batteryGetPlugType()
           
 java.lang.Integer batteryGetStatus()
           
 java.lang.String batteryGetTechnology()
           
 java.lang.Integer batteryGetTemperature()
           
 java.lang.Integer batteryGetVoltage()
           
 void batteryStartMonitoring()
          throws "battery" events
 void batteryStopMonitoring()
           
 Bundle readBatteryData()
           
 void shutdown()
          Invoked when the receiver is shut down.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BATTERY_PLUGGED_AC

public static final int BATTERY_PLUGGED_AC
Power source is an AC charger.

See Also:
Constant Field Values

BATTERY_PLUGGED_USB

public static final int BATTERY_PLUGGED_USB
Power source is a USB port.

See Also:
Constant Field Values
Constructor Detail

BatteryManagerFacade

public BatteryManagerFacade(FacadeManager manager)
Method Detail

readBatteryData

@Rpc(description="Returns the most recently recorded battery data.")
public Bundle readBatteryData()

batteryStartMonitoring

@Rpc(description="Starts tracking battery state.")
@RpcStartEvent(value="battery")
public void batteryStartMonitoring()
throws "battery" events


batteryStopMonitoring

@Rpc(description="Stops tracking battery state.")
@RpcStopEvent(value="battery")
public void batteryStopMonitoring()

shutdown

public void shutdown()
Description copied from class: RpcReceiver
Invoked when the receiver is shut down.

Specified by:
shutdown in class RpcReceiver

batteryGetStatus

@Rpc(description="Returns  the most recently received battery status data:\n1 - unknown;\n2 - charging;\n3 - discharging;\n4 - not charging;\n5 - full;")
public java.lang.Integer batteryGetStatus()

batteryGetHealth

@Rpc(description="Returns the most recently received battery health data:\n1 - unknown;\n2 - good;\n3 - overheat;\n4 - dead;\n5 - over voltage;\n6 - unspecified failure;")
public java.lang.Integer batteryGetHealth()

batteryGetPlugType

@Rpc(description="Returns the most recently received plug type data:\n-1 - unknown\n0 - unplugged;\n1 - power source is an AC charger\n2 - power source is a USB port")
public java.lang.Integer batteryGetPlugType()

batteryCheckPresent

@Rpc(description="Returns the most recently received battery presence data.")
@RpcMinSdk(value=5)
public java.lang.Boolean batteryCheckPresent()

batteryGetLevel

@Rpc(description="Returns the most recently received battery level (percentage).")
@RpcMinSdk(value=5)
public java.lang.Integer batteryGetLevel()

batteryGetVoltage

@Rpc(description="Returns the most recently received battery voltage.")
@RpcMinSdk(value=5)
public java.lang.Integer batteryGetVoltage()

batteryGetTemperature

@Rpc(description="Returns the most recently received battery temperature.")
@RpcMinSdk(value=5)
public java.lang.Integer batteryGetTemperature()

batteryGetTechnology

@Rpc(description="Returns the most recently received battery technology data.")
@RpcMinSdk(value=5)
public java.lang.String batteryGetTechnology()