}
(void) waitFor(AT_NOCARRIER); // wait for message carrier to drop
}
- /*
- * Send training response; we follow the spec
- * by delaying 75ms before switching carriers.
- */
- pause(conf.class1TCFResponseDelay);
- if (ok) {
- transmitFrame(FCF_CFR|FCF_RCVR);
- protoTrace("TRAINING succeeded");
- } else {
- transmitFrame(FCF_FTT|FCF_RCVR);
- protoTrace("TRAINING failed");
- }
return (ok);
}
+/*
+ * Send training response (success); we follow the spec
+ * by delaying 75ms before switching carriers.
+ */
+void
+Class1Modem::trainingSucceeded()
+{
+ pause(conf.class1TCFResponseDelay);
+ transmitFrame(FCF_CFR|FCF_RCVR);
+ protoTrace("TRAINING succeeded");
+}
+
+/*
+ * Send training response (failure); we follow the spec
+ * by delaying 75ms before switching carriers.
+ */
+void
+Class1Modem::trainingFailed()
+{
+ pause(conf.class1TCFResponseDelay);
+ transmitFrame(FCF_FTT|FCF_RCVR);
+ protoTrace("TRAINING failed");
+}
+
/*
* Process a received DCS frame.
*/
&& recvDCSFrames(frame)
&& recvTraining()
);
+ if (messageReceived) trainingFailed();
+ else trainingSucceeded();
break;
case FCF_MPS: // MPS
case FCF_EOM: // EOM
* timeout, we need to achieve CONNECT first, just
* as we did following ATA back in the beginning.
*/
- if (atCmd(thCmd, AT_NOTHING) && atResponse(rbuf, 0) == AT_CONNECT && recvBegin(emsg))
+ if (atCmd(thCmd, AT_NOTHING) && atResponse(rbuf, 0) == AT_CONNECT && recvBegin(emsg)) {
+ trainingSucceeded();
goto top;
+ } else trainingFailed();
} else
emsg = "T.30 T2 timeout, expected page not received";
return (false);
{
strcpy(hangupCode, "50"); // force abort in recvEnd
}
+
+/*
+ * Processes to perform at the end of training,
+ * but after TSI screening, so we know where
+ * we're going.
+ */
+void
+Class2Modem::trainingSucceeded()
+{
+ // nothing
+}
+
+/*
+ * ibid.
+ */
+void
+Class2Modem::trainingFailed()
+{
+ // nothing
+}
virtual bool recvPage(TIFF*, int& ppm, fxStr& em) = 0;
virtual bool recvEnd(fxStr& emsg) = 0;
virtual void recvAbort() = 0;
+ virtual void trainingSucceeded() = 0;
+ virtual void trainingFailed() = 0;
// query interfaces for optional state
virtual bool getRecvPWD(fxStr&);
virtual bool getRecvTSI(fxStr&);
if (!modem->recvEnd(emsg))
traceProtocol("RECV FAX: %s", (const char*) emsg);
} else {
+ modem->trainingFailed(); // wait until after QualifyTSI
traceProtocol("RECV FAX: %s", (const char*) emsg);
TIFFClose(tif);
}
return (false);
}
}
+ modem->trainingSucceeded(); // wait until after QualifyTSI
setServerStatus("Receiving from \"%s\"", (const char*) info.sender);
recvOK = recvFaxPhaseD(tif, info, ppm, emsg);
TIFFClose(tif);