public abstract class AbstractPowerSource extends Object implements PowerSource
PowerSource.CapacityUnits| Constructor and Description |
|---|
AbstractPowerSource(String name,
String deviceName,
double remainingCapacityPercent,
double timeRemainingEstimated,
double timeRemainingInstant,
double powerUsageRate,
double voltage,
double amperage,
boolean powerOnLine,
boolean charging,
boolean discharging,
PowerSource.CapacityUnits capacityUnits,
int currentCapacity,
int maxCapacity,
int designCapacity,
int cycleCount,
String chemistry,
LocalDate manufactureDate,
String manufacturer,
String serialNumber,
double temperature) |
| Modifier and Type | Method and Description |
|---|---|
double |
getAmperage()
Amperage of the battery, in milliAmperes (mA).
|
PowerSource.CapacityUnits |
getCapacityUnits()
Reports =the units of
PowerSource.getCurrentCapacity(),
PowerSource.getMaxCapacity(), and PowerSource.getDesignCapacity() |
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()
Estimated remaining capacity as a fraction of max capacity.
|
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()
Estimated time remaining on the power source, in seconds, as reported by the
operating system.
|
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.
|
String |
toString() |
boolean |
updateAttributes()
Updates statistics on this battery.
|
public AbstractPowerSource(String name, String deviceName, double remainingCapacityPercent, double timeRemainingEstimated, double timeRemainingInstant, double powerUsageRate, double voltage, double amperage, boolean powerOnLine, boolean charging, boolean discharging, PowerSource.CapacityUnits capacityUnits, int currentCapacity, int maxCapacity, int designCapacity, int cycleCount, String chemistry, LocalDate manufactureDate, String manufacturer, String serialNumber, double temperature)
public String getName()
PowerSourcegetName in interface PowerSourcepublic String getDeviceName()
PowerSourcegetDeviceName in interface PowerSourcepublic double getRemainingCapacity()
PowerSource
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 PowerSource.getCurrentCapacity() to PowerSource.getMaxCapacity().
getRemainingCapacity in interface PowerSourcepublic double getRemainingCapacityPercent()
PowerSource
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 PowerSource.getCurrentCapacity() to PowerSource.getMaxCapacity().
getRemainingCapacityPercent in interface PowerSourcepublic double getTimeRemaining()
PowerSourceThis 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.
getTimeRemaining in interface PowerSourcepublic double getTimeRemainingEstimated()
PowerSourceThis 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.
getTimeRemainingEstimated in interface PowerSourcepublic double getTimeRemainingInstant()
PowerSource
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
PowerSource.getTimeRemainingEstimated().
getTimeRemainingInstant in interface PowerSourcepublic double getPowerUsageRate()
PowerSourcegetPowerUsageRate in interface PowerSourcepublic double getVoltage()
PowerSourcegetVoltage in interface PowerSourcepublic double getAmperage()
PowerSourcegetAmperage in interface PowerSourcepublic boolean isPowerOnLine()
PowerSourceisPowerOnLine in interface PowerSourcetrue if plugged in, false otherwise.public boolean isCharging()
PowerSourceisCharging in interface PowerSourcetrue if the battery is charging, false otherwise.public boolean isDischarging()
PowerSourceisDischarging in interface PowerSourcetrue if the battery is discharging, false otherwise.public PowerSource.CapacityUnits getCapacityUnits()
PowerSourcePowerSource.getCurrentCapacity(),
PowerSource.getMaxCapacity(), and PowerSource.getDesignCapacity()getCapacityUnits in interface PowerSourcepublic int getCurrentCapacity()
PowerSourcegetCurrentCapacity in interface PowerSourcePowerSource.getCapacityUnits().public int getMaxCapacity()
PowerSourcegetMaxCapacity in interface PowerSourcePowerSource.getCapacityUnits().public int getDesignCapacity()
PowerSourcegetDesignCapacity in interface PowerSourcePowerSource.getCapacityUnits().public int getCycleCount()
PowerSourcegetCycleCount in interface PowerSourcepublic String getChemistry()
PowerSourcegetChemistry in interface PowerSourcepublic LocalDate getManufactureDate()
PowerSourceSome 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.
getManufactureDate in interface PowerSourcenull.public String getManufacturer()
PowerSourcegetManufacturer in interface PowerSourcepublic String getSerialNumber()
PowerSourceSome 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.
getSerialNumber in interface PowerSourcepublic double getTemperature()
PowerSourcegetTemperature in interface PowerSourcepublic boolean updateAttributes()
PowerSourceupdateAttributes in interface PowerSourcetrue if the update was successful. If false the
battery statistics are unchanged.Copyright © 2019. All rights reserved.