Class SLIP


  • public class SLIP
    extends Object
    Interface for the RN131 driver to send and receive packets with the SLIP protocol.
    • Constructor Summary

      Constructors 
      Constructor Description
      SLIP​(ByteFifo rx, ByteFifo tx)
      Creates a SLIP object using the supplied buffers.
    • Constructor Detail

      • SLIP

        public SLIP​(ByteFifo rx,
                    ByteFifo tx)
        Creates a SLIP object using the supplied buffers.
        Parameters:
        rx - receive buffer to use
        tx - transmit buffer to use
    • Method Detail

      • write

        public boolean write​(byte[] packet,
                             int offset,
                             int length)
        Writes a packet to the transmit buffer.
        Parameters:
        packet - byte array with the packet
        offset - start offset of the packet data
        length - length of the packet
        Returns:
        false if buffer is full, true otherwise
      • read

        public int read​(byte[] packet,
                        int offset,
                        int length)
        Reads a packet from the receive buffer.
        Parameters:
        packet - buffer where to put the packet
        offset - offset in the buffer
        length - length of the buffer
        Returns:
        return values
        >= 0 number of received bytes
        -1 end of packet received
        -2 buffer overflow