Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## josx.rcxcomm
Class LNPIntegrityHandler

    java.lang.Object
      josx.rcxcomm.PacketHandler
          josx.rcxcomm.LNPIntegrityHandler

    public class LNPIntegrityHandler

extends PacketHandler

Packet handler that implements simple checksums. The checksum is added at the end and is not part of the packet length

Field Summary

Fields inherited from class josx.rcxcomm.PacketHandler
`lowerHandler`

Constructor Summary
`LNPIntegrityHandler(PacketHandler handler, byte op)` Create a packet handler for broadcast or addressing integrity packets

Method Summary
`boolean` | `isAddressing()` Test if last packet is an adressing (or integrity) packet
`boolean` | `isPacketAvailable()` Check if a packet is available
`int` | `receivePacket(byte[] buffer)` Receive a packet.
`boolean` | `sendPacket(byte[] packet, int len)` Send a packet.
`void` | `setOp(byte op)` Set the opcode for the next write

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

### LNPIntegrityHandler

    public LNPIntegrityHandler(PacketHandler handler,
                               byte op)

  Create a packet handler for broadcast or addressing integrity packets

  Parameters:
    `handler` - the lower level LNP packet handler
    `op` - the opcode to use for writes: 0xf0 for broadcasts, 0xf1 for addressing packets

Method Detail

### isAddressing

    public boolean isAddressing()

  Test if last packet is an adressing (or integrity) packet

  Returns:
    true if addressing packet, false if a broadcast

### setOp

    public void setOp(byte op)

  Set the opcode for the next write

  Parameters:
    `op` - oxf0 for a broadcast, oxf1 for an adressing write

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

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD