|
SunSPOT API V4.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.spot.peripheral.Battery
public class Battery
Field Summary |
---|
Fields inherited from interface com.sun.spot.peripheral.IBattery |
---|
CHARGETIME, CHARGING, DEAD_BATTERY, DISCHARGING, EXT_POWERED, LOW_BATTERY, NO_BATTERY, OUT_OF_RANGE_TEMP, RUNTIME, SLEEPTIME |
Constructor Summary | |
---|---|
Battery(SpiPcs chipSelectPin,
ISpiMaster spiMaster)
Battery constructor for obtaining information about the SPOT rechargeable battery this can throw a RuntimeException if it is created with a pre-rev6 eSPOT or version earlier than PCTRL-1.99 |
Method Summary | |
---|---|
boolean |
calibrationCycleDetected()
Returns true when the battery has been depleted to low battery and then charged fully. |
double |
getAvailableCapacity()
Get the batteries remaining capacity in maHr. |
int |
getBatteryLevel()
Battery level returns an integer indicating remaining capacity in percentage (0 is empty, 100 is fully charged) |
short |
getChargeCount()
Return the number of times the SPOT has seen a full charge. |
double |
getMaximumCapacity()
Get the batteries measured maximum capacity in maHr. |
String |
getModelNumber()
Battery model must match battery used for accurate measurements. |
double |
getRatedCapacity()
Returns rated capacity of the battery (as written on the label) . |
int |
getSleepCurrent()
Sleepcurrent is microamps written to the SPOT for use in calculating sleep current. |
byte |
getState()
The state of battery is returned. |
String |
getStateAsString(int state)
The state of battery is returned as a string: no battery, dead battery, low battery, discharging, charging, fully charged |
long[] |
getTime()
Battery time measurements of sleeping since last charge, running since last charge and length of charge time. |
boolean |
hasBattery()
Attempts to detect the presence of the battery. |
boolean |
hasTemperatureSensor()
Returns true if the SPOT has detected a temperature sensor. |
String |
rawBatteryData()
All raw battery data as colon separated one entry per line string. |
void |
setSleepCurrent(int microamps)
SetSleepcurrent writes the sleep current in ADC units to estimate how much power is being consumed while the SPOT is in deep sleep. |
void |
updatePersistantInfo()
force write of battery data from SRAM into EEPROM. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Battery(SpiPcs chipSelectPin, ISpiMaster spiMaster) throws RuntimeException
chipSelectPin
- chip select pin for power controller (PeripheralChipSelect.SPI_PCS_POWER_CONTROLLER)spiMaster
- SPI object (usually from Spot.getInstance().getSPI())
RuntimeException
- if pre-rev6 eSPOT, pctrl-1.98 or earlier firmware or invalid spot.battery.model propertyMethod Detail |
---|
public String getModelNumber()
IBattery
getModelNumber
in interface IBattery
public String rawBatteryData()
IBattery
rawBatteryData
in interface IBattery
public double getAvailableCapacity()
IBattery
getAvailableCapacity
in interface IBattery
public double getMaximumCapacity()
IBattery
getMaximumCapacity
in interface IBattery
public double getRatedCapacity()
IBattery
getRatedCapacity
in interface IBattery
public int getBatteryLevel()
IBattery
getBatteryLevel
in interface IBattery
public long[] getTime()
IBattery
getTime
in interface IBattery
public short getChargeCount()
IBattery
getChargeCount
in interface IBattery
public int getSleepCurrent()
IBattery
getSleepCurrent
in interface IBattery
public void setSleepCurrent(int microamps)
IBattery
setSleepCurrent
in interface IBattery
microamps
- current consumed during deep sleep in microampspublic byte getState()
IBattery
getState
in interface IBattery
public boolean hasTemperatureSensor()
IBattery
hasTemperatureSensor
in interface IBattery
public boolean hasBattery()
IBattery
hasBattery
in interface IBattery
public boolean calibrationCycleDetected()
IBattery
calibrationCycleDetected
in interface IBattery
public String getStateAsString(int state)
IBattery
getStateAsString
in interface IBattery
state
- enumerated value returned by getState()
public void updatePersistantInfo() throws IOException
IBattery
updatePersistantInfo
in interface IBattery
IOException
- if the power controller does not respond within 10 seconds
|
SunSPOT API V4.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |