|
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.PacketReceiver
public class PacketReceiver
Simple helper class to monitor a radiogram connection and redirect packets to handlers that have registered an interest in that packet type. The contents of the first byte of the packet determines its type.
Implements the com.sun.spot.service.IService interface.
PacketHandler,
PacketTransmitter,
IService| Field Summary |
|---|
| Fields inherited from interface com.sun.spot.service.IService |
|---|
PAUSED, PAUSING, RESUMING, RUNNING, STARTING, STOPPED, STOPPING |
| Constructor Summary | |
|---|---|
PacketReceiver(com.sun.spot.io.j2me.radiogram.RadiogramConnection conn)
Creates a new instance of a PacketReceiver. |
|
| Method Summary | |
|---|---|
boolean |
getEnabled()
Return whether service is started automatically on reboot. |
java.lang.String |
getServiceName()
Return service name |
int |
getStatus()
Return current service status. |
boolean |
isRunning()
Return if service is currently running. |
boolean |
pause()
Pause the service, and return whether successful. |
void |
registerHandler(PacketHandler handler,
byte type)
Register a handler for some packet type. |
boolean |
resume()
Resume the service, and return whether successful. |
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 packet receiver service running. |
boolean |
stop()
Stop packet receiver service if running. |
void |
unregisterHandler(PacketHandler handler)
Unregister a handler from all packet types. |
void |
unregisterHandler(PacketHandler handler,
byte type)
Unregister a handler for some packet type. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PacketReceiver(com.sun.spot.io.j2me.radiogram.RadiogramConnection conn)
conn - the radiogram connection to receive packets from| Method Detail |
|---|
public void registerHandler(PacketHandler handler,
byte type)
handler - the class to registertype - the command to dispatch to this handler
public void unregisterHandler(PacketHandler handler,
byte type)
handler - the class to unregistertype - the command to not dispatch to this handlerpublic void unregisterHandler(PacketHandler handler)
handler - the class to unregisterpublic 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 | ||||||||