Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.synchrona.jred.irlap
Class IrLAPFramer  view IrLAPFramer download IrLAPFramer.java

java.lang.Object
  extended bycom.synchrona.jred.irlap.IrLAPFramer
All Implemented Interfaces:
java.lang.Runnable

public class IrLAPFramer
extends java.lang.Object
implements java.lang.Runnable


Field Summary
private static byte BROADCAST_ADDRESS
           
private static int COMM_PARAMETER_ARRAY_LENGTH
           
private static byte COMMAND_DISCONNECT
           
private static byte FINAL_SLOT
           
private static byte INFORMATION_FORMAT
           
private static byte IRLAP_VERSION
           
private  byte[] m_ayCommParameters
           
private  byte[] m_ayOutputFrame
           
private  boolean m_bDoLogging
           
private  iIrLAPFramerListener m_listener
           
private  com.synchrona.util.Log m_log
           
private  SerialPort m_port
           
private  iFrameWrapper m_wrapper
           
private static byte MASK_CR_BIT
           
private static byte MASK_NR_BITS
           
private static byte MASK_NS_BITS
           
private static byte MASK_PF_BIT
           
private static byte MASK_SUPERVISORY_CONTROLS
           
private static byte RR_CONTROL
           
private static byte SNRM_COMMAND
           
private static byte SUPERVISORY_FORMAT
           
private static byte UA_RESPONSE
           
private static byte UNNUMBERED_FORMAT
           
private static byte XID_COMMAND
           
private static byte XID_FORMAT
           
private static byte XID_RESPONSE
           
 
Constructor Summary
IrLAPFramer(com.synchrona.util.Log log, SerialPort port)
           
 
Method Summary
 void addIrLAPFramerListener(iIrLAPFramerListener listener)
           
private  int bytesToInt(byte[] ayBytes, int nOffset)
           
private  void dispatchDISC(byte yConnection, boolean bCommand, boolean bPoll, byte[] ayFrame, int nLength)
           
private  void dispatchFrame(byte[] ayFrame, int nLength)
           
private  void dispatchInformation(byte yConnection, boolean bCommand, boolean bPoll, int nNs, int nNr, byte[] ayFrame, int nLength)
           
private  void dispatchRR(byte yConnection, int nNr, boolean bCommand, boolean bPoll)
           
private  void dispatchSNRM(byte[] ayFrame, boolean bCommand, int nLength)
           
private  void dispatchXID(byte[] ayFrame, boolean bCommand, int nLength)
           
 void initialize()
           
private  int intToBytes(byte[] ayBytes, int nOffset, int nValue)
          Write an integer in network order to the given array of bytes at the given offset.
private  int readFrame(byte[] ayFrame)
           
 void run()
          This method will be called by whoever wishes to run your class implementing Runnable.
 void sendI(byte yConnection, int nNr, int nNs, boolean bFinal, byte[] ayData, int nOffset, int nLength)
           
 void sendRR(byte yConnection, int nNr, boolean bCommand, boolean bFinal)
           
 void sendSNRM(int nSource, int nDestination, byte yConnection)
           
 void sendUA(int nSource, int nDestination, byte yConnection, boolean bSendParameters)
           
 void sendXID(int nSource, int nDestination, boolean bCommand, byte ySlot, byte[] ayDiscoveryInfo)
           
 void setConnectionParameters(byte[] ayParameters)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMMAND_DISCONNECT

private static final byte COMMAND_DISCONNECT
See Also:
Constant Field Values

BROADCAST_ADDRESS

private static final byte BROADCAST_ADDRESS
See Also:
Constant Field Values

COMM_PARAMETER_ARRAY_LENGTH

private static final int COMM_PARAMETER_ARRAY_LENGTH
See Also:
Constant Field Values

FINAL_SLOT

private static final byte FINAL_SLOT
See Also:
Constant Field Values

INFORMATION_FORMAT

private static final byte INFORMATION_FORMAT
See Also:
Constant Field Values

IRLAP_VERSION

private static final byte IRLAP_VERSION
See Also:
Constant Field Values

MASK_CR_BIT

private static final byte MASK_CR_BIT
See Also:
Constant Field Values

MASK_NR_BITS

private static final byte MASK_NR_BITS
See Also:
Constant Field Values

MASK_NS_BITS

private static final byte MASK_NS_BITS
See Also:
Constant Field Values

MASK_PF_BIT

private static final byte MASK_PF_BIT
See Also:
Constant Field Values

MASK_SUPERVISORY_CONTROLS

private static final byte MASK_SUPERVISORY_CONTROLS
See Also:
Constant Field Values

RR_CONTROL

private static final byte RR_CONTROL
See Also:
Constant Field Values

SNRM_COMMAND

private static final byte SNRM_COMMAND
See Also:
Constant Field Values

SUPERVISORY_FORMAT

private static final byte SUPERVISORY_FORMAT
See Also:
Constant Field Values

UA_RESPONSE

private static final byte UA_RESPONSE
See Also:
Constant Field Values

UNNUMBERED_FORMAT

private static final byte UNNUMBERED_FORMAT
See Also:
Constant Field Values

XID_COMMAND

private static final byte XID_COMMAND
See Also:
Constant Field Values

XID_FORMAT

private static final byte XID_FORMAT
See Also:
Constant Field Values

XID_RESPONSE

private static final byte XID_RESPONSE
See Also:
Constant Field Values

m_ayCommParameters

private byte[] m_ayCommParameters

m_ayOutputFrame

private byte[] m_ayOutputFrame

m_bDoLogging

private boolean m_bDoLogging

m_listener

private iIrLAPFramerListener m_listener

m_log

private com.synchrona.util.Log m_log

m_port

private SerialPort m_port

m_wrapper

private iFrameWrapper m_wrapper
Constructor Detail

IrLAPFramer

public IrLAPFramer(com.synchrona.util.Log log,
                   SerialPort port)
            throws java.lang.Exception
Method Detail

addIrLAPFramerListener

public void addIrLAPFramerListener(iIrLAPFramerListener listener)
                            throws java.lang.Exception

initialize

public void initialize()

run

public void run()
Description copied from interface: java.lang.Runnable
This method will be called by whoever wishes to run your class implementing Runnable. Note that there are no restrictions on what you are allowed to do in the run method, except that you cannot throw a checked exception.

Specified by:
run in interface java.lang.Runnable

sendI

public void sendI(byte yConnection,
                  int nNr,
                  int nNs,
                  boolean bFinal,
                  byte[] ayData,
                  int nOffset,
                  int nLength)
           throws java.lang.Exception

sendRR

public void sendRR(byte yConnection,
                   int nNr,
                   boolean bCommand,
                   boolean bFinal)
            throws java.lang.Exception

sendSNRM

public void sendSNRM(int nSource,
                     int nDestination,
                     byte yConnection)
              throws java.lang.Exception

sendUA

public void sendUA(int nSource,
                   int nDestination,
                   byte yConnection,
                   boolean bSendParameters)
            throws java.lang.Exception

sendXID

public void sendXID(int nSource,
                    int nDestination,
                    boolean bCommand,
                    byte ySlot,
                    byte[] ayDiscoveryInfo)
             throws java.lang.Exception

setConnectionParameters

public void setConnectionParameters(byte[] ayParameters)
                             throws java.lang.Exception

bytesToInt

private int bytesToInt(byte[] ayBytes,
                       int nOffset)

dispatchFrame

private void dispatchFrame(byte[] ayFrame,
                           int nLength)
                    throws java.lang.Exception

dispatchDISC

private void dispatchDISC(byte yConnection,
                          boolean bCommand,
                          boolean bPoll,
                          byte[] ayFrame,
                          int nLength)
                   throws java.lang.Exception

dispatchInformation

private void dispatchInformation(byte yConnection,
                                 boolean bCommand,
                                 boolean bPoll,
                                 int nNs,
                                 int nNr,
                                 byte[] ayFrame,
                                 int nLength)
                          throws java.lang.Exception

dispatchRR

private void dispatchRR(byte yConnection,
                        int nNr,
                        boolean bCommand,
                        boolean bPoll)
                 throws java.lang.Exception

dispatchSNRM

private void dispatchSNRM(byte[] ayFrame,
                          boolean bCommand,
                          int nLength)
                   throws java.lang.Exception

dispatchXID

private void dispatchXID(byte[] ayFrame,
                         boolean bCommand,
                         int nLength)
                  throws java.lang.Exception

intToBytes

private int intToBytes(byte[] ayBytes,
                       int nOffset,
                       int nValue)
                throws java.lang.Exception
Write an integer in network order to the given array of bytes at the given offset.


readFrame

private int readFrame(byte[] ayFrame)
               throws java.lang.Exception