|
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.PacketTransmitter
public class PacketTransmitter
Simple transmit loop to pull packets off of a xmitQueue and send them. After the packet is sent it is put on a freeQueue.
Classes wanting to send a packet should get one by calling newDataPacket(), passing in the packet type as an argument.
Implements the com.sun.spot.service.IService interface.
PacketReceiver,
IService| Field Summary | |
|---|---|
static int |
SINGLE_PACKET_PAYLOAD_SIZE
Number of bytes of data that will fit in a single packet, not including the header |
| Fields inherited from interface com.sun.spot.service.IService |
|---|
PAUSED, PAUSING, RESUMING, RUNNING, STARTING, STOPPED, STOPPING |
| Constructor Summary | |
|---|---|
PacketTransmitter(com.sun.spot.io.j2me.radiogram.RadiogramConnection conn)
Create a new transmit loop thread. |
|
PacketTransmitter(com.sun.spot.io.j2me.radiogram.RadiogramConnection conn,
int payloadSize)
Create a new transmit loop thread and use (multi-packet) datagrams. |
|
| Method Summary | |
|---|---|
void |
free(javax.microedition.io.Datagram dg)
Routine to put a data packet onto the free list. |
boolean |
getEnabled()
Return whether service is started automatically on reboot. |
java.lang.String |
getServiceName()
Return service name |
int |
getStatus()
Return current service status. |
void |
immediateSend(javax.microedition.io.Datagram dg)
Routine to immediately send a data packet. |
boolean |
isRunning()
Return if service is currently running. |
com.sun.spot.io.j2me.radiogram.Radiogram |
newDataPacket(byte type)
Get a free data packet and write its header. |
boolean |
pause()
Pause the service, and return whether successful. |
boolean |
resume()
Resume the service, and return whether successful. |
void |
send(javax.microedition.io.Datagram dg)
Routine to queue a data packet for later sending. |
void |
setEnabled(boolean enable)
Enable/disable whether service is started automatically. |
void |
setServiceName(java.lang.String who)
Assign a name to this service. |
boolean |
start()
Start service running. |
boolean |
stop()
Stop service running. |
void |
writeHeader(com.sun.spot.io.j2me.radiogram.Radiogram rdg,
byte type)
Write the common header into a Radiogram. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int SINGLE_PACKET_PAYLOAD_SIZE
| Constructor Detail |
|---|
public PacketTransmitter(com.sun.spot.io.j2me.radiogram.RadiogramConnection conn)
conn - the RadiogramConnection to send packets over
public PacketTransmitter(com.sun.spot.io.j2me.radiogram.RadiogramConnection conn,
int payloadSize)
conn - the RadiogramConnection to send packets overpayloadSize - how big do outgoing packets need to be| Method Detail |
|---|
public void writeHeader(com.sun.spot.io.j2me.radiogram.Radiogram rdg,
byte type)
rdg - the Radiogram to write the header info intotype - the type of data packet to sendpublic com.sun.spot.io.j2me.radiogram.Radiogram newDataPacket(byte type)
type - the type of data packet to send
public void free(javax.microedition.io.Datagram dg)
dg - the Datagram to freepublic void send(javax.microedition.io.Datagram dg)
dg - the Datagram to send
public void immediateSend(javax.microedition.io.Datagram dg)
throws java.io.IOException
dg - the Datagram to send
java.io.IOExceptionpublic boolean stop()
stop in interface com.sun.spot.service.IServicepublic boolean start()
start in interface com.sun.spot.service.IServicepublic boolean pause()
pause in interface com.sun.spot.service.IServicepublic boolean resume()
resume in interface com.sun.spot.service.IServicepublic java.lang.String getServiceName()
getServiceName in interface com.sun.spot.service.IServicepublic void setServiceName(java.lang.String who)
setServiceName in interface com.sun.spot.service.IServicewho - the new name for this servicepublic boolean isRunning()
isRunning in interface com.sun.spot.service.IServicepublic int getStatus()
getStatus in interface com.sun.spot.service.IServicepublic boolean getEnabled()
getEnabled in interface com.sun.spot.service.IServicepublic void setEnabled(boolean enable)
setEnabled in interface com.sun.spot.service.IServiceenable - ignored
|
Sun SPOT Telemetry Demo -- SPOT-side v1.1 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||