|
Sun SPOT Telemetry Demo -- SPOT-side v1.1 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.microedition.midlet.MIDlet
org.sunspotworld.demo.util.Spotlet
public abstract class Spotlet
Start of a framework for robust SPOT applications. Provides simple lifecycle management of application code by handling any fatal errors the application causes. The application main class should extend Spotlet and implement the following methods: (only run is necessary)
Other methods specify how many times to retry the application after errors, whether to run a OTACommandServer for over-the-air deployment of new code, etc.
| Constructor Summary | |
|---|---|
Spotlet()
Creates a new instance of Spotlet |
|
| Method Summary | |
|---|---|
void |
cleanup()
Cleanup any resources used by the Spot application. |
protected void |
destroyApp(boolean arg0)
Only called if startApp throws any exception other than MIDletStateChangeException. |
boolean |
firstRun()
Indicate if this is the first time the application has been run. |
long |
getCurrentRunTime()
Return the elapsed time for the current call to the application's run method. |
java.lang.Throwable |
getLastError()
Return the last Error or Exception thrown by the application. |
long |
getLastRunTime()
Return the elapsed time for the previous call to the application's run method. |
int |
getNumberRetries()
Return the number of times to retry the application after an error. |
int |
getNumberRuns()
Return the number of times the application has been run. |
long |
getTimeBetweenRetries()
Return the time in milliseconds to wait before retrying the application after an error. |
long |
getTotalRunTime()
Return the total time that this application has been running. |
void |
initialize()
Do any initialization needed by the Spot application. |
static void |
pause(long time)
Pause for a specified time. |
protected void |
pauseApp()
This will never be called by the Squawk VM. |
void |
postFlash()
Called by OTACommandServer after flashing a new application. |
void |
preFlash()
Called by OTACommandServer before flashing a new application. |
void |
prepareToExit()
Callback from USB serial listener indicating that application should quit and control be passed to the system bootloader. |
void |
quit()
If the Spot application is running have it stop. |
void |
reinitialize()
Reinitialize the world before re-running the Spot application. |
abstract void |
run()
The Spot application code to run as defined by a subclass of Spotlet. |
void |
setBlinkLEDs(boolean blink)
Set whether the LEDs should be blinked between retries of the application and when done. |
void |
setListenForBootloader(boolean monitor)
Set whether or not to monitor for OTA download requests or bootloader commands over the USB connection. |
void |
setNumberRetries(int num)
Set the number of times to retry the application after an error. |
void |
setTimeBetweenRetries(long time)
Set the time in milliseconds to wait before retrying the application after an error. |
protected void |
startApp()
MIDlet call to start our application. |
| Methods inherited from class javax.microedition.midlet.MIDlet |
|---|
getAppProperty, notifyDestroyed, notifyPaused, resumeRequest |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Spotlet()
| Method Detail |
|---|
public void initialize()
public abstract void run()
public void reinitialize()
public void quit()
public void cleanup()
public int getNumberRuns()
public boolean firstRun()
public java.lang.Throwable getLastError()
public int getNumberRetries()
public void setNumberRetries(int num)
num - the number of times to retry the application, -1 = retry foreverpublic long getTimeBetweenRetries()
public void setTimeBetweenRetries(long time)
time - the time in milliseconds to wait before retrying the applicationpublic void setBlinkLEDs(boolean blink)
blink - if true blink the LEDspublic void setListenForBootloader(boolean monitor)
monitor - if true spawn threads to listen for download/bootloader requestspublic long getCurrentRunTime()
public long getLastRunTime()
public long getTotalRunTime()
public static void pause(long time)
time - the number of milliseconds to pausepublic void prepareToExit()
prepareToExit in interface com.sun.spot.util.IBootloaderListenerCallbackpublic void preFlash()
preFlash in interface com.sun.spot.peripheral.ota.IOTACommandServerListenerpublic void postFlash()
postFlash in interface com.sun.spot.peripheral.ota.IOTACommandServerListener
protected void startApp()
throws javax.microedition.midlet.MIDletStateChangeException
startApp in class javax.microedition.midlet.MIDletjavax.microedition.midlet.MIDletStateChangeExceptionprotected void pauseApp()
pauseApp in class javax.microedition.midlet.MIDlet
protected void destroyApp(boolean arg0)
throws javax.microedition.midlet.MIDletStateChangeException
destroyApp in class javax.microedition.midlet.MIDletjavax.microedition.midlet.MIDletStateChangeException
|
Sun SPOT Telemetry Demo -- SPOT-side v1.1 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||