SunSPOT API V5.0


com.sun.spot.peripheral
Interface IBattery

All Known Implementing Classes:
Battery

public interface IBattery


Field Summary
static int CHARGETIME
           
static byte CHARGING
           
static byte DEAD_BATTERY
           
static byte DISCHARGING
           
static byte EXT_POWERED
           
static byte LOW_BATTERY
           
static byte NO_BATTERY
           
static byte OUT_OF_RANGE_TEMP
           
static int RUNTIME
           
static int SLEEPTIME
           
 
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.
 

Field Detail

NO_BATTERY

static final byte NO_BATTERY
See Also:
Constant Field Values

DEAD_BATTERY

static final byte DEAD_BATTERY
See Also:
Constant Field Values

LOW_BATTERY

static final byte LOW_BATTERY
See Also:
Constant Field Values

DISCHARGING

static final byte DISCHARGING
See Also:
Constant Field Values

CHARGING

static final byte CHARGING
See Also:
Constant Field Values

EXT_POWERED

static final byte EXT_POWERED
See Also:
Constant Field Values

OUT_OF_RANGE_TEMP

static final byte OUT_OF_RANGE_TEMP
See Also:
Constant Field Values

SLEEPTIME

static final int SLEEPTIME
See Also:
Constant Field Values

RUNTIME

static final int RUNTIME
See Also:
Constant Field Values

CHARGETIME

static final int CHARGETIME
See Also:
Constant Field Values
Method Detail

getModelNumber

String getModelNumber()
Battery model must match battery used for accurate measurements. Use the BattSet.java program to set the battery information.

Returns:
the battery model number as a string

getBatteryLevel

int getBatteryLevel()
Battery level returns an integer indicating remaining capacity in percentage (0 is empty, 100 is fully charged)

Returns:
percentage of battery level

getAvailableCapacity

double getAvailableCapacity()
Get the batteries remaining capacity in maHr.

Returns:
the capacity in milliamphours

getMaximumCapacity

double getMaximumCapacity()
Get the batteries measured maximum capacity in maHr. This value is set to the measured capacity when the battery is fully charged.

Returns:
the maximum capacity in milliamphours

getTime

long[] getTime()
Battery time measurements of sleeping since last charge, running since last charge and length of charge time.

Returns:
long array of three indexed by SLEEPTIME, RUNTIME or CHARGETIME, each value is time in seconds

getChargeCount

short getChargeCount()
Return the number of times the SPOT has seen a full charge. This value is reset to zero when the battery is replaced or removed.

Returns:
count of charge cycles

getState

byte getState()
The state of battery is returned. States are static final ints: NO_BATTERY, DEAD_BATTERY, LOW_BATTERY, DISCHARGING, CHARGING, EXT_POWERED, TEMPERATURE_OUT_OF_RANGE

Returns:
state of battery

getStateAsString

String getStateAsString(int state)
The state of battery is returned as a string: no battery, dead battery, low battery, discharging, charging, fully charged

Parameters:
state - enumerated value returned by getState()
Returns:
state of battery as a string

setSleepCurrent

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. The method will convert to ADC units (uA * 65536)/25000 and send that to the SPOT to use until changed again Default value is 32uA as typical sleep current of an eSPOT. If eDemo board is jumpered to run on standby power, this value should be increased to 102uA. Other add on boards will have to adjust this value accordingly.

Parameters:
microamps - current consumed during deep sleep in microamps

hasTemperatureSensor

boolean hasTemperatureSensor()
Returns true if the SPOT has detected a temperature sensor. Rev 5 and before did not have built in temperature sensors. A sensor can be added to the rev 5 SPOT with a simple modification. The temperature sensor can change the state of battery to indicate out of range temperature

Returns:
true if eSPOT has a temperature sensor

hasBattery

boolean hasBattery()
Attempts to detect the presence of the battery. Either battery is charging while externally powered or no external power.

Returns:
true if battery detected

calibrationCycleDetected

boolean calibrationCycleDetected()
Returns true when the battery has been depleted to low battery and then charged fully. This cycle will set the measuredCapacity. The measured capacity is originally set to the rated capacity until it detects this cycle.

Returns:
true if SPOT has detected a complete calibration cycle

getSleepCurrent

int getSleepCurrent()
Sleepcurrent is microamps written to the SPOT for use in calculating sleep current. This is added to temperature self discharge current during deep sleep.

Returns:
the value written by setSleepCurrent or default value (32uA). Value is microamps and does not inlcude temperature self discharge

getRatedCapacity

double getRatedCapacity()
Returns rated capacity of the battery (as written on the label) .

Returns:
the rated capacity in milliamphour (maHr)

rawBatteryData

String rawBatteryData()
All raw battery data as colon separated one entry per line string.

Returns:
a string of all raw values from the SPOT.

updatePersistantInfo

void updatePersistantInfo()
                          throws IOException
force write of battery data from SRAM into EEPROM. This should be done whenever the SPOT is reset and tries to reinitialize with the same battery. This is done when using the pctrl bootloader which forces a reset.

Throws:
IOException - if the power controller does not respond within 10 seconds

SunSPOT API V5.0


Copyright � 2006-2008 Sun Microsystems, Inc. All Rights Reserved.