public interface PowerSource
Modifier and Type | Interface and Description |
---|---|
static class |
PowerSource.CapacityUnits
Units of Battery Capacity
|
Modifier and Type | Method and Description |
---|---|
double |
getAmperage()
Amperage of the battery, in milliAmperes (mA).
|
PowerSource.CapacityUnits |
getCapacityUnits()
|
String |
getChemistry()
The battery chemistry (e.g., Lithium Ion).
|
int |
getCurrentCapacity()
The current (remaining) capacity of the battery.
|
int |
getCycleCount()
The cycle count of the battery, if known.
|
int |
getDesignCapacity()
The design (original) capacity of the battery.
|
String |
getDeviceName()
Name of the power source at the device level.
|
LocalDate |
getManufactureDate()
The battery's date of manufacture.
|
String |
getManufacturer()
The name of the battery's manufacturer.
|
int |
getMaxCapacity()
The maximum capacity of the battery.
|
String |
getName()
Name of the power source at the Operating System level.
|
double |
getPowerUsageRate()
Power Usage Rate of the battery, in milliWatts (mW).
|
double |
getRemainingCapacity()
Deprecated.
|
double |
getRemainingCapacityPercent()
Estimated remaining capacity as a fraction of max capacity.
|
String |
getSerialNumber()
The battery's serial number.
|
double |
getTemperature()
The battery's temperature, in degrees Celsius.
|
double |
getTimeRemaining()
Deprecated.
|
double |
getTimeRemainingEstimated()
Estimated time remaining on the power source, in seconds, as reported by the
operating system.
|
double |
getTimeRemainingInstant()
Estimated time remaining on the power source, in seconds, as reported by the
battery.
|
double |
getVoltage()
Voltage of the battery, in Volts.
|
boolean |
isCharging()
Reports whether the battery is charging.
|
boolean |
isDischarging()
Reports whether the battery is discharging.
|
boolean |
isPowerOnLine()
Reports whether the device is plugged in to an external power source.
|
boolean |
updateAttributes()
Updates statistics on this battery.
|
String getName()
String getDeviceName()
@Deprecated double getRemainingCapacity()
getRemainingCapacityPercent()
This is an estimated/smoothed value which should correspond to the Operating
System's "percent power" display, and may not directly correspond to the
ratio of getCurrentCapacity()
to getMaxCapacity()
.
double getRemainingCapacityPercent()
This is an estimated/smoothed value which should correspond to the Operating
System's "percent power" display, and may not directly correspond to the
ratio of getCurrentCapacity()
to getMaxCapacity()
.
@Deprecated double getTimeRemaining()
getTimeRemainingEstimated()
This is an estimated/smoothed value which should correspond to the Operating System's "battery time remaining" display, and will react slowly to changes in power consumption.
double getTimeRemainingEstimated()
This is an estimated/smoothed value which should correspond to the Operating System's "battery time remaining" display, and will react slowly to changes in power consumption.
double getTimeRemainingInstant()
Note that this value is not very accurate on some battery systems. The value
may vary widely depending on present power usage, which could be affected by
disk activity and other factors. This value will often be a higher value than
getTimeRemainingEstimated()
.
double getPowerUsageRate()
double getVoltage()
double getAmperage()
boolean isPowerOnLine()
true
if plugged in, false
otherwise.boolean isCharging()
true
if the battery is charging, false
otherwise.boolean isDischarging()
true
if the battery is discharging, false
otherwise.PowerSource.CapacityUnits getCapacityUnits()
int getCurrentCapacity()
getCapacityUnits()
.int getMaxCapacity()
getCapacityUnits()
.int getDesignCapacity()
getCapacityUnits()
.int getCycleCount()
String getChemistry()
LocalDate getManufactureDate()
Some battery manufacturers encode the manufacture date in the serial number. Parsing this value is operating system and battery manufacturer dependent, and is left to the user.
null
.String getManufacturer()
String getSerialNumber()
Some battery manufacturers encode the manufacture date in the serial number. Parsing this value is operating system and battery manufacturer dependent, and is left to the user.
double getTemperature()
boolean updateAttributes()
true
if the update was successful. If false
the
battery statistics are unchanged.Copyright © 2010–2019 oshi. All rights reserved.