josx.rcxcomm
Class LNPAddressingHandler

java.lang.Object
  extended byjosx.rcxcomm.PacketHandler
      extended byjosx.rcxcomm.LNPAddressingHandler

public class LNPAddressingHandler
extends PacketHandler

Packet handler that implements LNP addressing.


Field Summary
 
Fields inherited from class josx.rcxcomm.PacketHandler
lowerHandler
 
Constructor Summary
LNPAddressingHandler(PacketHandler handler)
           
 
Method Summary
 boolean isPacketAvailable()
          Check if a packet is available
 void open(byte source, byte destination)
          Set the source and destination for this connection
 int receivePacket(byte[] buffer)
          Receive a packet.
 boolean sendPacket(byte[] packet, int len)
          Send a packet, adding the source and destination addresses
 
Methods inherited from class josx.rcxcomm.PacketHandler
close, getError, isAckAvailable, receiveAck, reset, setListen
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait
 

Constructor Detail

LNPAddressingHandler

public LNPAddressingHandler(PacketHandler handler)
Method Detail

open

public void open(byte source,
                 byte destination)
Set the source and destination for this connection

Overrides:
open in class PacketHandler

sendPacket

public boolean sendPacket(byte[] packet,
                          int len)
Send a packet, adding the source and destination addresses

Specified by:
sendPacket in class PacketHandler
Parameters:
packet - the bytes to send
len - the number of bytes to send
Returns:
true if the send was successful, else false

receivePacket

public int receivePacket(byte[] buffer)
Receive a packet.

Specified by:
receivePacket in class PacketHandler
Parameters:
buffer - the buffer to rceive the packet into
Returns:
the number of bytes received

isPacketAvailable

public boolean isPacketAvailable()
Check if a packet is available

Specified by:
isPacketAvailable in class PacketHandler
Returns:
true if a Packet is available, else false