Package lejos.remote.rcx
Class LLCHandler
- java.lang.Object
-
- lejos.remote.rcx.PacketHandler
-
- lejos.remote.rcx.LLCHandler
-
public class LLCHandler extends PacketHandler
Packet handler than implement the LLC packet protocol. Deals with packets and acks. Supports independent streams of data in both directions.
-
-
Field Summary
-
Fields inherited from class lejos.remote.rcx.PacketHandler
lowerHandler
-
-
Constructor Summary
Constructors Constructor Description LLCHandler(I2CPort port)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisAckAvailable()Check if an Ack is availablebooleanisPacketAvailable()Check if a packet is availableintreceiveAck(byte[] buffer)Receive an ack.intreceivePacket(byte[] buffer)Receive a packet.booleansendPacket(byte[] packet, int len)Send a packet.
-
-
-
Constructor Detail
-
LLCHandler
public LLCHandler(I2CPort port)
-
-
Method Detail
-
sendPacket
public boolean sendPacket(byte[] packet, int len)Send a packet.- Specified by:
sendPacketin classPacketHandler- Parameters:
packet- the bytes to sendlen- 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:
receivePacketin classPacketHandler- Parameters:
buffer- the buffer to receive the packet into- Returns:
- the number of bytes received
-
receiveAck
public int receiveAck(byte[] buffer)
Receive an ack.- Overrides:
receiveAckin classPacketHandler- Parameters:
buffer- the buffer to receive the ack into- Returns:
- the number of bytes received
-
isPacketAvailable
public boolean isPacketAvailable()
Check if a packet is available- Specified by:
isPacketAvailablein classPacketHandler- Returns:
- true if a Packet is available, else false
-
isAckAvailable
public boolean isAckAvailable()
Check if an Ack is available- Overrides:
isAckAvailablein classPacketHandler- Returns:
- true if ack is available, else false
-
-