|
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.Objectorg.sunspotworld.demo.util.PeriodicTask
org.sunspotworld.demo.AccelMonitor
public class AccelMonitor
Routines to control and read data from the SPOT's accelerometer and send them via Radiogram packets to a display program running on a host computer.
The actual task scheduling is done by the PeriodicTask parent class.
Packets from the host application are received by the PacketReceiver class and then dispatched to this class to respond to. The replies are sent back via the PacketTransmitter class. The commands are defined in the PacketTypes class.
PeriodicTask,
PacketHandler,
PacketReceiver,
PacketTransmitter,
PacketTypes| Field Summary |
|---|
| Fields inherited from class org.sunspotworld.demo.util.PeriodicTask |
|---|
clk_index, priority, shiftTask, status, taskPeriod, taskPeriodCount, thread, timer |
| Fields inherited from interface com.sun.spot.service.IService |
|---|
PAUSED, PAUSING, RESUMING, RUNNING, STARTING, STOPPED, STOPPING |
| Constructor Summary | |
|---|---|
AccelMonitor(TelemetryMain m,
int sampleInterval)
Create a new accelerometer controller. |
|
| Method Summary | |
|---|---|
void |
calibrate()
Have the accelerometer calculate the current rest offsets. |
void |
doTask()
Called once per task period to pack up accelerometer readings. |
void |
getAccInfo()
Send a packet to inform host of current accelerometer settings. |
void |
handlePacket(byte type,
com.sun.spot.io.j2me.radiogram.Radiogram pkt)
Callback from PacketReceiver when a new command is received from the host. |
boolean |
is2GScale()
Is the accelerometer using the 2G scale? |
void |
setName(java.lang.String who)
temporary fix until IService interface fixed |
void |
setPacketConnection(PacketTransmitter xmit,
PacketReceiver rcvr)
Get the PacketTransmitter & PacketReceiver to use to talk with the host. |
void |
setScale(byte b)
Set the accelerometer to use either the 2G or 6G scale. |
void |
starting()
Routine called when task execution is about to start up. |
void |
stopping()
Routine called when task execution is finished. |
| Methods inherited from class org.sunspotworld.demo.util.PeriodicTask |
|---|
getCounter, getEnabled, getServiceName, getStatus, getTaskPeriod, getTaskPeriodCount, isRunning, pause, resume, setEnabled, setServiceName, setTaskPeriod, setTaskPriority, shiftStart, start, stop |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AccelMonitor(TelemetryMain m,
int sampleInterval)
m - reference to the main program getting commands from the host displaysampleInterval - how often to sample the accelerometer, in milliseconds| Method Detail |
|---|
public void setPacketConnection(PacketTransmitter xmit,
PacketReceiver rcvr)
xmit - the PacketTransmitter to send packetsrcvr - the PacketReceiver that will receive commands from the host and dispatch them to handlePacket()
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 boolean is2GScale()
public void getAccInfo()
public void setScale(byte b)
b - the scale to use = 2 or 6public void calibrate()
public void starting()
starting in class PeriodicTaskpublic void stopping()
stopping in class PeriodicTaskpublic void doTask()
doTask in class PeriodicTaskpublic void setName(java.lang.String who)
|
Sun SPOT Telemetry Demo -- SPOT-side v1.1 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||