josx.rcxcomm
Class LNPHandler

java.lang.Object
  |
  +--josx.rcxcomm.PacketHandler
        |
        +--josx.rcxcomm.LNPHandler

public class LNPHandler
extends PacketHandler

A Packet handler that implements the outer LNP packet format. It uses LLC to send and receive LNP packets.


Field Summary
 
Fields inherited from class josx.rcxcomm.PacketHandler
lowerHandler
 
Constructor Summary
LNPHandler()
          Creates an LNP packet handler and initializes LLC
 
Method Summary
 boolean isAddressing()
          Test if last received packet is addressing (or integrity)
 boolean isPacketAvailable()
          Check if a packet is available
 int receivePacket(byte[] buffer)
          Receive a packet.
 boolean sendPacket(byte[] packet, int len)
          Send a packet.
 
Methods inherited from class josx.rcxcomm.PacketHandler
close, getError, isAckAvailable, open, receiveAck, reset, setListen
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait
 

Constructor Detail

LNPHandler

public LNPHandler()
Creates an LNP packet handler and initializes LLC

Method Detail

isAddressing

public boolean isAddressing()
Test if last received packet is addressing (or integrity)

Returns:
true if an addressing packet, false if an integrity packet

sendPacket

public boolean sendPacket(byte[] packet,
                          int len)
Send a packet.

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 receive 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