public abstract class ModBattery extends Object
An application should not instantiate this class directly; instead the application should retrieve a ModBattery instance by calling
ModManager.getClassManager(device, ModBattery.class)
.
Modifier and Type | Field and Description |
---|---|
static int |
BATTERY_EFFICIENCY_MODE
This represents the state of the charging policy between the Moto Mod battery and the phone battery.
|
static int |
BATTERY_EFFICIENCY_OFF
The battery efficiency mode is OFF. If the battery efficiency mode is reported as OFF, the Moto Mod battery will
always completely charge the phone battery (to 100%) and will keep the battery topped-off.
|
static int |
BATTERY_EFFICIENCY_ON
The battery efficiency mode is ON. If the battery efficiency mode is reported as ON, the Moto Mod battery will
always keep the phone battery charged at the efficiency level (to 80%) or the level reported by
ModBattery.BATTERY_RECHARGE_START_SOC . |
static int |
BATTERY_LOW_START_SOC
The value represents the lower threshold at which the phone will start charging from the Moto Mod, when a Moto Mod is attached and the phone is in Low
battery. It is fixed.
|
static int |
BATTERY_LOW_STOP_SOC
The upper threshold at which the phone will stop charging from the Moto Mod, when a Moto Mod is attached and the phone is in Low
battery.
|
static int |
BATTERY_RECHARGE_START_SOC
The battery percentage level at which the phone will start charging from a Moto Mod battery.
|
static int |
BATTERY_RECHARGE_STOP_SOC
The battery percentage level at which the phone will stop charging from a Moto Mod battery.
|
static int |
BATTERY_USAGE_TYPE
The battery usage type, the usage type could be either
ModBattery.BATTERY_USAGE_TYPE_UNKNOWN , ModBattery.BATTERY_USAGE_TYPE_REMOTE ,
ModBattery.BATTERY_USAGE_TYPE_SUPPLEMENTAL or
ModBattery.BATTERY_USAGE_TYPE_EMERGENCY |
static int |
BATTERY_USAGE_TYPE_EMERGENCY
Indicates that the Moto Mod battery is a remote-emergency battery. A remote-emergency battery will only provide power to a smartphone when the smartphone battery is low.
|
static int |
BATTERY_USAGE_TYPE_REMOTE
Indicates that the Moto Mod battery is a remote battery. A remote battery will not provide power to a smartphone, only to a Moto Mod.
|
static int |
BATTERY_USAGE_TYPE_SUPPLEMENTAL
Indicates that the Moto Mod battery is a supplemental battery. A supplemental battery will always power to a smartphone, to keep it charged.
|
static int |
BATTERY_USAGE_TYPE_UNKNOWN
Indicates that the Moto Mod battery usage type is unknown.
|
Constructor and Description |
---|
ModBattery() |
Modifier and Type | Method and Description |
---|---|
static long |
getBatteryCapacity(Context context)
When a Moto Mod with a battery is attached, the ModBattery.getBatteryCapacity() function will return the total capacity of the Moto Mod battery, in mAh
or Long.MIN_VALUE if the value can not be returned.
|
static int |
getBatteryLevel(Intent intent)
When a battery Moto Mod is attached, the ModBattery.getBatteryLevel() function will return the battery charge level of the Moto Mod battery,
as a percentage level (between 0 and 100).
|
static int |
getBatteryStatus(Intent intent)
When a battery Moto Mod is attached, the ModBattery.getBatteryStatus() function will return the charging status of the Moto Mod battery.
|
static int |
getBatteryType(Intent intent)
When a battery Moto Mod is attached, the ModBattery.getBatteryType() function will return the defined battery type of the attached Moto Mod battery.
|
abstract int |
getIntProperty(int property)
Returns the value of a Moto Mod battery property of integer type;
if the query fails, this value will be Integer.MIN_VALUE.
|
static boolean |
isPlugTypeMod(Intent intent)
When a battery Moto Mod is attached, the isPlugTypeMod() function will return
TRUE if there is no external charger attached and your device can be charged from the
Moto Mod.
|
public static final int BATTERY_RECHARGE_START_SOC
ModBattery.BATTERY_RECHARGE_STOP_SOC
.
Use ModBattery.getIntProperty(int)
to read it.
public static final int BATTERY_RECHARGE_STOP_SOC
ModBattery.BATTERY_RECHARGE_STOP_SOC
.
Use ModBattery.getIntProperty(int)
to read it
public static final int BATTERY_LOW_START_SOC
Use ModBattery.getIntProperty(int)
to read it
public static final int BATTERY_LOW_STOP_SOC
Use ModBattery.getIntProperty(int)
to read it
public static final int BATTERY_USAGE_TYPE
ModBattery.BATTERY_USAGE_TYPE_UNKNOWN
, ModBattery.BATTERY_USAGE_TYPE_REMOTE
,
ModBattery.BATTERY_USAGE_TYPE_SUPPLEMENTAL
or
ModBattery.BATTERY_USAGE_TYPE_EMERGENCY
Use ModBattery.getIntProperty(int)
to read it, no write method.
public static final int BATTERY_EFFICIENCY_MODE
ModBattery.BATTERY_USAGE_TYPE_SUPPLEMENTAL
.
Use ModBattery.getIntProperty(int)
to read it, no write method.
public static final int BATTERY_USAGE_TYPE_UNKNOWN
public static final int BATTERY_USAGE_TYPE_REMOTE
public static final int BATTERY_USAGE_TYPE_SUPPLEMENTAL
public static final int BATTERY_USAGE_TYPE_EMERGENCY
ModBattery.BATTERY_LOW_START_SOC
and ModBattery.BATTERY_LOW_STOP_SOC
constants will return the treshold at which the core will attempt to pull
power from the emergency battery.public static final int BATTERY_EFFICIENCY_OFF
public static final int BATTERY_EFFICIENCY_ON
ModBattery.BATTERY_RECHARGE_START_SOC
. The Core battery will be kept at
the level of ModBattery.BATTERY_RECHARGE_STOP_SOC
until the Moto Mod is
depleted.public abstract int getIntProperty(int property)
ModManager.PERMISSION_MOD_ACCESS_INFO
.property
- One of the value of
ModBattery.BATTERY_RECHARGE_START_SOC
,
ModBattery.BATTERY_RECHARGE_STOP_SOC
,
ModBattery.BATTERY_LOW_START_SOC
,
ModBattery.BATTERY_LOW_STOP_SOC
,
ModBattery.BATTERY_USAGE_TYPE
,
ModBattery.BATTERY_EFFICIENCY_MODE
.public static int getBatteryLevel(Intent intent)
intent
- The ACTION_BATTERY_CHANGED intent to be parsedpublic static int getBatteryStatus(Intent intent)
BatteryManager.BATTERY_STATUS_UNKNOWN
,
BatteryManager.BATTERY_STATUS_CHARGING
,
BatteryManager.BATTERY_STATUS_DISCHARGING
,
BatteryManager.BATTERY_STATUS_NOT_CHARGING
,
BatteryManager.BATTERY_STATUS_FULL
intent
- The ACTION_BATTERY_CHANGED intent to be parsedpublic static int getBatteryType(Intent intent)
ModBattery.BATTERY_USAGE_TYPE_UNKNOWN
,
ModBattery.BATTERY_USAGE_TYPE_REMOTE
,
ModBattery.BATTERY_USAGE_TYPE_SUPPLEMENTAL
,
ModBattery.BATTERY_USAGE_TYPE_EMERGENCY
,intent
- The ACTION_BATTERY_CHANGED intent to be parsedpublic static boolean isPlugTypeMod(Intent intent)
intent
- The ACTION_BATTERY_CHANGED intent to be parsedpublic static long getBatteryCapacity(Context context)
context
- The context(c) 2016 Motorola Mobility LLC. All Rights Reserved
MOTOROLA and the Stylized M Logo are registered trademarks of Motorola Trademark Holdings, LLC
Android, Google, Google Play, Nexus and other marks are trademarks of Google Inc.