java.lang.Object
com.synchrona.jred.irlap.IrLAPContext
- All Implemented Interfaces:
- iIrLAPFramerListener
- public class IrLAPContext
- extends java.lang.Object
- implements iIrLAPFramerListener
IrLAPContext offers services for the IrLAP states.
Log messages mimic directives in the IrLAP specification, which
helps in debuggering.
|
Method Summary |
void |
addIrLAPListener(iIrLAPListener listener)
|
void |
applyConnectionParameters()
|
void |
connectIndication(int nRemote,
byte yConnection,
byte[] ayParameters)
|
void |
connectResponse(int nDestination,
byte yConnection,
byte[] ayParams)
|
void |
dataIndication(byte yConnection,
byte[] ayData)
|
void |
discoveryIndication(DiscoveryInformation discoveryInfo)
|
void |
flushQueue(byte yConnection)
|
void |
generateAddress()
|
byte |
generateConnectionAddress()
|
byte |
generateResponseSlot(byte yNumSlots,
byte ySlot)
|
byte |
getConnection()
|
byte |
getResponseSlot()
|
int |
getVr()
|
int |
getVs()
|
void |
handleData(byte yConnection,
boolean bCommand,
int nNs,
int nNr,
boolean bPoll,
byte[] ayData)
|
void |
handleDisconnect(byte yConnection,
boolean bCommand,
boolean bPoll)
|
void |
handleRR(byte yConnection,
int nNr,
boolean bCommand,
boolean bPoll)
|
void |
handleSNRM(int nSource,
int nDestination,
byte yConnection,
byte[] ayParameters)
|
void |
handleXID(int nSource,
int nDestination,
byte yNumSlots,
byte ySlot,
boolean bCommand,
byte[] ayHints)
|
void |
incrementVr()
|
void |
initializeConnectionState()
|
boolean |
isConnectionConfirmed()
|
boolean |
isFrameSent()
|
boolean |
isMediaBusy()
|
boolean |
isRemoteBusy()
|
void |
negotiateConnectionParameters(byte[] ayParameters)
Does nothing right now. |
void |
nextState(IrLAPState nextState)
|
boolean |
pendingDataRequests()
|
void |
sendData(byte yConnection,
byte[] ayData,
int nOffset,
int nLength)
|
void |
sendDiscoveryResponse(int nDestination)
|
void |
sendNext(byte yConnection)
|
void |
sendRR(byte yConnection,
boolean bCommand,
boolean bFinal)
|
void |
sendSNRM(int nDestination,
byte yConnection)
|
void |
sendUA(int nDestination,
byte yConnection,
boolean bSendParameters)
|
void |
setFramer(IrLAPFramer framer)
|
void |
setFrameSent(boolean bFrameSent)
|
void |
setLog(java.io.PrintWriter log)
Deprecated. |
void |
setLogging(boolean bDoLogging)
Deprecated. |
void |
setRemoteBusy(boolean bRemoteBusy)
|
void |
startFTimer()
|
void |
startQueryTimer()
|
void |
startWatchdogTimer()
|
void |
stopQueryTimer()
|
void |
stopWatchdogTimer()
|
void |
updateNr(int nNr)
Acknowledge frames through Nr - 1 by removing them from
the send queue. |
void |
waitMinimumTurnaroundTime()
|
void |
zeroRetryCount()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_F_TIMEOUT_MSEC
public static final int DEFAULT_F_TIMEOUT_MSEC
- See Also:
- Constant Field Values
DEFAULT_MIN_TURNAROUND_MSEC
public static final int DEFAULT_MIN_TURNAROUND_MSEC
- See Also:
- Constant Field Values
DEFAULT_QUERY_TIMEOUT_MSEC
public static final int DEFAULT_QUERY_TIMEOUT_MSEC
- See Also:
- Constant Field Values
DEFAULT_WATCHDOG_TIMEOUT_MSEC
public static final int DEFAULT_WATCHDOG_TIMEOUT_MSEC
- See Also:
- Constant Field Values
DEFAULT_WINDOW_SIZE
public static final int DEFAULT_WINDOW_SIZE
- See Also:
- Constant Field Values
DISCOVERY_INFO
private static final byte[] DISCOVERY_INFO
m_ayCommParameters
private byte[] m_ayCommParameters
m_bAckRequired
private boolean m_bAckRequired
m_bConnectionConfirmed
private boolean m_bConnectionConfirmed
m_bFrameSent
private boolean m_bFrameSent
m_bMediaBusy
private boolean m_bMediaBusy
m_bRemoteBusy
private boolean m_bRemoteBusy
m_connectionLog
private ConnectionLog m_connectionLog
m_discoveryLog
private DiscoveryLog m_discoveryLog
m_framer
private IrLAPFramer m_framer
m_fTimer
private javax.swing.Timer m_fTimer
m_listener
private iIrLAPListener m_listener
m_log
private com.synchrona.util.Log m_log
m_nFTimeout
private int m_nFTimeout
m_nMyAddress
private int m_nMyAddress
m_nQueryTimeout
private int m_nQueryTimeout
m_nRemoteAddress
private int m_nRemoteAddress
m_nRetryCount
private int m_nRetryCount
m_nWatchdogTimeout
private int m_nWatchdogTimeout
m_nVr
private int m_nVr
m_nVs
private int m_nVs
m_nWindowSize
private int m_nWindowSize
m_queryTimer
private javax.swing.Timer m_queryTimer
m_random
private java.util.Random m_random
m_sendQueue
private IrLAPSendQueue m_sendQueue
m_state
private IrLAPState m_state
m_this
private IrLAPContext m_this
m_watchdogTimer
private javax.swing.Timer m_watchdogTimer
m_yConnection
private byte m_yConnection
m_yResponseSlot
private byte m_yResponseSlot
IrLAPContext
private IrLAPContext()
IrLAPContext
public IrLAPContext(com.synchrona.util.Log log)
addIrLAPListener
public void addIrLAPListener(iIrLAPListener listener)
throws java.lang.Exception
setLog
public void setLog(java.io.PrintWriter log)
- Deprecated.
setLogging
public void setLogging(boolean bDoLogging)
- Deprecated.
handleData
public void handleData(byte yConnection,
boolean bCommand,
int nNs,
int nNr,
boolean bPoll,
byte[] ayData)
throws java.lang.Exception
- Specified by:
handleData in interface iIrLAPFramerListener
handleDisconnect
public void handleDisconnect(byte yConnection,
boolean bCommand,
boolean bPoll)
throws java.lang.Exception
- Specified by:
handleDisconnect in interface iIrLAPFramerListener
handleRR
public void handleRR(byte yConnection,
int nNr,
boolean bCommand,
boolean bPoll)
throws java.lang.Exception
- Specified by:
handleRR in interface iIrLAPFramerListener
handleSNRM
public void handleSNRM(int nSource,
int nDestination,
byte yConnection,
byte[] ayParameters)
throws java.lang.Exception
- Specified by:
handleSNRM in interface iIrLAPFramerListener
handleXID
public void handleXID(int nSource,
int nDestination,
byte yNumSlots,
byte ySlot,
boolean bCommand,
byte[] ayHints)
throws java.lang.Exception
- Specified by:
handleXID in interface iIrLAPFramerListener
applyConnectionParameters
public void applyConnectionParameters()
throws java.lang.Exception
connectIndication
public void connectIndication(int nRemote,
byte yConnection,
byte[] ayParameters)
throws java.lang.Exception
connectResponse
public void connectResponse(int nDestination,
byte yConnection,
byte[] ayParams)
throws java.lang.Exception
dataIndication
public void dataIndication(byte yConnection,
byte[] ayData)
throws java.lang.Exception
discoveryIndication
public void discoveryIndication(DiscoveryInformation discoveryInfo)
throws java.lang.Exception
flushQueue
public void flushQueue(byte yConnection)
throws java.lang.Exception
generateAddress
public void generateAddress()
generateConnectionAddress
public byte generateConnectionAddress()
throws java.lang.Exception
generateResponseSlot
public byte generateResponseSlot(byte yNumSlots,
byte ySlot)
throws java.lang.Exception
getConnection
public byte getConnection()
getResponseSlot
public byte getResponseSlot()
getVr
public int getVr()
getVs
public int getVs()
incrementVr
public void incrementVr()
throws java.lang.Exception
initializeConnectionState
public void initializeConnectionState()
throws java.lang.Exception
isConnectionConfirmed
public boolean isConnectionConfirmed()
isFrameSent
public boolean isFrameSent()
isMediaBusy
public boolean isMediaBusy()
throws java.lang.Exception
isRemoteBusy
public boolean isRemoteBusy()
throws java.lang.Exception
negotiateConnectionParameters
public void negotiateConnectionParameters(byte[] ayParameters)
throws java.lang.Exception
- Does nothing right now. We stick to 9600bps, 8 data bits, 1 stop bit,
no parity. We gotta fix that -- 9600 is painfully slow.
nextState
public void nextState(IrLAPState nextState)
throws java.lang.Exception
pendingDataRequests
public boolean pendingDataRequests()
throws java.lang.Exception
sendData
public void sendData(byte yConnection,
byte[] ayData,
int nOffset,
int nLength)
throws java.lang.Exception
sendDiscoveryResponse
public void sendDiscoveryResponse(int nDestination)
throws java.lang.Exception
sendNext
public void sendNext(byte yConnection)
throws java.lang.Exception
sendRR
public void sendRR(byte yConnection,
boolean bCommand,
boolean bFinal)
throws java.lang.Exception
sendSNRM
public void sendSNRM(int nDestination,
byte yConnection)
throws java.lang.Exception
sendUA
public void sendUA(int nDestination,
byte yConnection,
boolean bSendParameters)
throws java.lang.Exception
setFramer
public void setFramer(IrLAPFramer framer)
throws java.lang.Exception
setFrameSent
public void setFrameSent(boolean bFrameSent)
throws java.lang.Exception
setRemoteBusy
public void setRemoteBusy(boolean bRemoteBusy)
throws java.lang.Exception
startFTimer
public void startFTimer()
throws java.lang.Exception
startQueryTimer
public void startQueryTimer()
throws java.lang.Exception
startWatchdogTimer
public void startWatchdogTimer()
throws java.lang.Exception
stopQueryTimer
public void stopQueryTimer()
throws java.lang.Exception
stopWatchdogTimer
public void stopWatchdogTimer()
throws java.lang.Exception
updateNr
public void updateNr(int nNr)
throws java.lang.Exception
- Acknowledge frames through Nr - 1 by removing them from
the send queue.
waitMinimumTurnaroundTime
public void waitMinimumTurnaroundTime()
throws java.lang.Exception
zeroRetryCount
public void zeroRetryCount()
throws java.lang.Exception