|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.rcxcomm.PacketHandler
public abstract class PacketHandler
Abstract packet handler.
Implementations must include sendPacket, receivePacket and
isPacketAvailable(). The other methods are optional.
WARNING: THIS CLASS IS SHARED BETWEEN THE classes AND pccomms PROJECTS.
DO NOT EDIT THE VERSION IN pccomms AS IT WILL BE OVERWRITTEN WHEN THE PROJECT IS BUILT.
Field Summary | |
---|---|
protected PacketHandler |
lowerHandler
|
Constructor Summary | |
---|---|
PacketHandler()
|
|
PacketHandler(PacketHandler handler)
|
Method Summary | |
---|---|
void |
close()
Close this packet handler and all lower layers. |
int |
getError()
Get the last error. |
boolean |
isAckAvailable()
Check if an ack is available |
abstract boolean |
isPacketAvailable()
Check if a packet is available |
void |
open(byte source,
byte destination)
Set the source and destination for this connection. |
int |
receiveAck(byte[] buffer)
|
abstract int |
receivePacket(byte[] buffer)
Receive a packet. |
void |
reset()
Reset sequence numbers for this handler |
abstract boolean |
sendPacket(byte[] packet,
int len)
Send a packet. |
void |
setListen(boolean listen)
Set or unset the listen flag to keep a PC serial tower alive |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected PacketHandler lowerHandler
Constructor Detail |
---|
public PacketHandler()
public PacketHandler(PacketHandler handler)
Method Detail |
---|
public void open(byte source, byte destination)
public void reset()
public void setListen(boolean listen)
listen
- true to set listen mode, else falsepublic abstract boolean sendPacket(byte[] packet, int len)
packet
- the bytes to sendlen
- the number of bytes to send
public abstract int receivePacket(byte[] buffer)
buffer
- the buffer to receive the packet into
public int receiveAck(byte[] buffer)
public abstract boolean isPacketAvailable()
public boolean isAckAvailable()
public void close()
public int getError()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |