📄 irlapstatereceive.java
字号:
/*
**************************************************************************
** $Header: /cvsroot/jred/jred/src/com/synchrona/jred/irlap/IrLAPStateReceive.java,v 1.2 2000/07/30 20:18:12 mpatters Exp $
**
** Copyright (C) 2000 Synchrona, Inc. All rights reserved.
**
** This file is part of JRed, a 100% Java implementation of the IrDA
** infrared communications protocols.
**
** This file may be distributed under the terms of the Synchrona Public
** License as defined by Synchrona, Inc. and appearing in the file
** LICENSE included in the packaging of this file. The Synchrona Public
** License is based on the Q Public License as defined by Troll Tech AS
** of Norway; it differs only in its use of the courts of Florida, USA
** rather than those of Oslo, Norway.
**************************************************************************
*/
package com.synchrona.jred.irlap;
class IrLAPStateReceive extends IrLAPState {
private static IrLAPState s_instance = new IrLAPStateReceive();
public static IrLAPState getInstance() {
return s_instance;
}
private IrLAPStateReceive() {
}
public void handleData(IrLAPContext context, byte yConnection, int nNr, boolean bCommand, boolean bPoll, byte [] ayData) throws Exception {
//debug("IrLAPStateReceive", "handleData");
if ( bCommand ) {
context.dataIndication(yConnection, ayData);
context.incrementVr();
context.updateNr(nNr);
if ( nNr != context.getVs() ) {
if ( context.pendingDataRequests() ) {
context.stopWatchdogTimer();
context.waitMinimumTurnaroundTime();
context.flushQueue(yConnection);
//context.sendNext(yConnection);
}
} else {
context.waitMinimumTurnaroundTime();
context.sendRR(yConnection, false, true);
context.startWatchdogTimer();
}
}
/*
if ( bPoll && !context.isRemoteBusy() ) {
context.dataIndication(yConnection, ayData);
context.incrementVr();
context.updateNr(nNr);
context.waitMinimumTurnaroundTime();
context.sendRR(yConnection, false, true);
context.startWatchdogTimer();
}
*/
}
public void handleDisconnect(IrLAPContext context, int nSource, byte yConnection) throws Exception {
//debug("IrLAPStateReceive", "handleDisconnect");
context.setMediaBusy(false);
context.nextState(IrLAPStateNDM.getInstance());
// reset all of the connection variables so we're ready for the next
// attempt.
context.initializeConnectionState();
context.sendUA(nSource, yConnection, false);
context.stopWatchdogTimer();
}
public void handleRR(IrLAPContext context, byte yConnection, int nNr, boolean bCommand, boolean bPoll) throws Exception {
//debug("IrLAPStateReceive", "handleRR");
context.setRemoteBusy(false);
context.updateNr(nNr);
if ( context.pendingDataRequests() ) {
context.stopWatchdogTimer();
context.sendNext(yConnection);
} else {
context.waitMinimumTurnaroundTime();
context.sendRR(yConnection, false, true);
context.startWatchdogTimer();
}
}
public void handleXID(IrLAPContext context, int nSource, int nDestination, byte ySlot, boolean bCommand, byte [] ayHints) throws Exception {
context.waitMinimumTurnaroundTime();
context.sendRR(context.getConnection(), false, true);
context.startWatchdogTimer();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -