SunSPOT API V5.0


com.sun.spot.peripheral
Interface ISleepManager


public interface ISleepManager

Interface to the low power sleep manager for the Sun SPOT

Author:
Syntropy

Method Summary
 void adjustStartTime(long delta)
          Adds the specified amount to the internal starttime variable used in the computation of UpTime.
 void disableDeepSleep()
          Disable deep sleep mode
 void disableDiagnosticMode()
          When diagnostic mode is disabled, a SPOT will not simulate deep sleep when USB is connected.
 void enableDeepSleep()
          Enable deep sleep mode
 void enableDeepSleep(boolean b)
          Conditionally enable/disable deep sleep mode
 void enableDiagnosticMode()
          In diagnostic mode, a SPOT will simulate deep sleep even when USB is connected.
 void ensureDeepSleep(long sleepTime)
          If Thread.sleep would result in a deep sleep of the specified time, then do that sleep.
 int getDeepSleepCount()
          Get deep sleep count
 long getMaximumShallowSleepTime()
          Find out the maximum sleep time that will cause a shallow sleep.
 long getMinimumDeepSleepTime()
          Find out the minimum sleep time that will cause a deep sleep.
 long getTotalDeepSleepTime()
          Get the total time in milliseconds that the SPOT has spent in deep sleep since it was started.
 long getTotalShallowSleepTime()
          Get the total time in milliseconds that the SPOT has spent in shallow sleep since it was started.
 long getUpTime()
          Get the total time in milliseconds since the SPOT was started.
 boolean isDeepSleepEnabled()
           
 boolean isInDiagnosticMode()
           
 void resetMinimumDeepSleepTime()
          After each deep sleep the minimum deep sleep time is adjusted to take account of how long the drivers took to tear down and set up.
 void setTracing(boolean tracingEnabled)
          Set whether to display detailed trace information during deep sleep tear down and setup.
 

Method Detail

getDeepSleepCount

int getDeepSleepCount()
Get deep sleep count

Returns:
The number of times the SPOT has entered deep sleep

enableDeepSleep

void enableDeepSleep()
Enable deep sleep mode


enableDeepSleep

void enableDeepSleep(boolean b)
Conditionally enable/disable deep sleep mode

Parameters:
b - enable deep sleep if true, disable otherwise

getMinimumDeepSleepTime

long getMinimumDeepSleepTime()
Find out the minimum sleep time that will cause a deep sleep. Note that sleeps for periods shorter than this may still cause a deep sleep - see getMaximumShallowSleepTime(). Note also that the value returned by this call is not a constant: the value can increase during execution if drivers take longer than expected to tear down or set up.

Returns:
The minimum sleep time to enter deep sleep

getMaximumShallowSleepTime

long getMaximumShallowSleepTime()
Find out the maximum sleep time that will cause a shallow sleep. Note that sleeps for periods longer than this may still cause a shallow sleep - see getMinimumDeepSleepTime()

Returns:
The maximum sleep time to enter shallow sleep

disableDeepSleep

void disableDeepSleep()
Disable deep sleep mode


enableDiagnosticMode

void enableDiagnosticMode()
In diagnostic mode, a SPOT will simulate deep sleep even when USB is connected. This facility enables device driver authors to debug their tearDown and setUp code. Enabling diagnostic mode also causes detailed trace output to the log.


disableDiagnosticMode

void disableDiagnosticMode()
When diagnostic mode is disabled, a SPOT will not simulate deep sleep when USB is connected. This is the most efficient set up for people other than device driver authors.


isInDiagnosticMode

boolean isInDiagnosticMode()
Returns:
whether the sleep manager is in diagnostic mode.
See Also:
enableDiagnosticMode()

isDeepSleepEnabled

boolean isDeepSleepEnabled()
Returns:
whether deep sleep is currently enabled

setTracing

void setTracing(boolean tracingEnabled)
Set whether to display detailed trace information during deep sleep tear down and setup.

Parameters:
tracingEnabled -

ensureDeepSleep

void ensureDeepSleep(long sleepTime)
                     throws UnableToDeepSleepException
If Thread.sleep would result in a deep sleep of the specified time, then do that sleep. Otherwise, throw an exception to indicate why not.

Parameters:
sleepTime - time to sleep in millis
Throws:
UnableToDeepSleepException

resetMinimumDeepSleepTime

void resetMinimumDeepSleepTime()
After each deep sleep the minimum deep sleep time is adjusted to take account of how long the drivers took to tear down and set up. This method resets the minimum deep sleep time to the default.


getTotalShallowSleepTime

long getTotalShallowSleepTime()
Get the total time in milliseconds that the SPOT has spent in shallow sleep since it was started.

Returns:
the total shallow sleep time in millis

getTotalDeepSleepTime

long getTotalDeepSleepTime()
Get the total time in milliseconds that the SPOT has spent in deep sleep since it was started.

Returns:
the total deep sleep time in millis

getUpTime

long getUpTime()
Get the total time in milliseconds since the SPOT was started.

Returns:
the total time the SPOT has been running

adjustStartTime

void adjustStartTime(long delta)
Adds the specified amount to the internal starttime variable used in the computation of UpTime. This method is automatically invoked when a user calls the setTime() method in PowerController.


SunSPOT API V5.0


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