|
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
org.sunspotworld.demo.TelemetryMain
public class TelemetryMain
Sample application that sends a stream of accelerometer telemetry information back from the SPOT to a host application.
This class establishes a radio connection with the host application. The AccelMonitor class takes care of all accelerometer-related commands, and sends the host a telemetry stream of accelerometer readings.
To simplify our work we make use of a number of utility helper classes:
LocateService to locate a remote service (on a host)
PacketReceiver to receive commands from the host application and
dispatch them to whatever classes registered to handle the command
PacketTransmitter handles sending reply packets back to the host
PeriodicTask provides for running a task, such as taking samples,
at a regular interval using the timer/counter hardware
Spotlet start of a framework for robust SPOT applications. Provides
simple lifecycle management of application code by handling any fatal
errors the application causes.
PacketTypes class.
The SPOT uses the LEDs to display its status as follows:
LED 0:
LocateService,
LocateServiceListener,
PacketHandler,
PacketReceiver,
PacketTransmitter,
PacketTypes,
Spotlet| Field Summary |
|---|
| Constructor Summary | |
|---|---|
TelemetryMain()
|
|
| Method Summary | |
|---|---|
void |
closeConnection()
Called to declare that the connection to the host is no longer present. |
void |
handlePacket(byte type,
com.sun.spot.io.j2me.radiogram.Radiogram pkt)
Callback from PacketReceiver when a new command is received from the host. |
void |
initialize()
Initialize any needed variables. |
void |
queueMessage(java.lang.String msg)
Add a message to the queue to be sent to the host at a later time. |
void |
reinitialize()
Reinitialize any needed variables after an error. |
void |
run()
Main application run loop. |
void |
serviceLocated(long serviceAddress)
Callback from LocateService when the host display service has been contacted. |
| Methods inherited from class org.sunspotworld.demo.util.Spotlet |
|---|
cleanup, destroyApp, firstRun, getCurrentRunTime, getLastError, getLastRunTime, getNumberRetries, getNumberRuns, getTimeBetweenRetries, getTotalRunTime, pause, pauseApp, postFlash, preFlash, prepareToExit, quit, setBlinkLEDs, setListenForBootloader, setNumberRetries, setTimeBetweenRetries, startApp |
| 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 TelemetryMain()
| Method Detail |
|---|
public void initialize()
initialize in class Spotletpublic void reinitialize()
reinitialize in class Spotletpublic void run()
run in class Spotletpublic void serviceLocated(long serviceAddress)
serviceLocated in interface LocateServiceListenerserviceAddress - the IEEE address of the host display servicepublic void closeConnection()
public void handlePacket(byte type,
com.sun.spot.io.j2me.radiogram.Radiogram pkt)
handlePacket in interface PacketHandlertype - the commandpkt - the radiogram with any other required informationpublic void queueMessage(java.lang.String msg)
msg - the String to be sent
|
Sun SPOT Telemetry Demo -- SPOT-side v1.1 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||