ClassTwo.h
上传用户:glass0516
上传日期:2010-01-11
资源大小:104k
文件大小:3k
- /*****************************************************************************
- * RelayFax Open Source Project
- * Copyright 1996-2004 Alt-N Technologies, Ltd.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted only as authorized by the RelayFax Open
- * Source License. A copy of this license is available in file LICENSE
- * in the top-level directory of the distribution.
- *
- * RelayFax is a registered trademark of Alt-N Technologies, Ltd.
- *
- * Individual files and/or contributed packages may be copyright by
- * other parties and subject to additional restrictions.
- *****************************************************************************/
- ////////////////////////////////////////////////////////////////////////////////
- //
- // The purpose of CClassTwo is contain the protocol specifics of EIA
- // fax modem class 2
- //
- ////////////////////////////////////////////////////////////////////////////////
- #ifndef CLASSTWO_H
- #define CLASSTWO_H
- #include "Modem.h"
- class CClassTwo : public CModem
- {
- public:
- CClassTwo();
- virtual ~CClassTwo();
- enum PhaseAStates { STATE_SET_PARAMS, // sending states
- STATE_SET_CSID,
- STATE_DIALING };
- enum PhaseBStates { STATE_SENDING, // sending states
- STATE_RECEIVING,
- STATE_RESET_PARAMS };
- enum PhaseEStates { STATE_WAIT_FOR_OK,
- STATE_WAIT_FOR_FK_RESP };
- virtual bool OnWaitTimeout( void );
- // methods overridden from CCommPort
- virtual void OnConnect(void);
- virtual bool OnDisconnect(void);
- virtual void OnWrite(void);
- virtual void OnReadLine(void);
- // methods overridden from CModem
- virtual void OnSendFaxMsg(MSG* pMsg);
- virtual void OnRecvFaxMsg(MSG* pMsg);
- virtual void OnAbortFaxMsg(void);
- virtual void OnHDLCFrame(void);
- virtual void OnPartialHDLCFrame(void);
- virtual void OnTimer( UINT nID );
- virtual void Abort( bool bUserCancelled );
- virtual void CheckTimeouts( DWORD dwInActive );
- void SetState( int nNewState, int nNewPhaseState = 0 );
- // int ParseFaxParams( int nMaxParams );
- protected:
- void PhaseInit(void);
- void PhaseIdle(void);
- void PhaseRinging(void);
- void PhaseA(void);
- void PhaseB(void);
- void PhaseC(void);
- void PhaseD(void);
- void PhaseE(void);
- void OnDIS(void);
- void OnCSI(void);
- // void OnCFR(void);
- // void OnMCF(void);
- // void OnRTP(void);
- // void OnRTN(void);
- // void OnFTT(void);
- void OnDCS(void);
- void OnTSI(void);
- void OnEOP(void);
- void OnEOM(void);
- void OnMPS(void);
- // void OnDCN(void);
- // void OnPPS(void);
- // void OnPPR(void);
- // void OnRNR(void);
- // void OnRR(void);
- // void OnCRP(void);
- void OnNSF(void);
- void OnNSS(void);
- // void OnCTC(void);
- // void OnCTR(void);
- // void OnEOR(void);
- // void OnERR(void);
- void OnFPTS(void);
- void OnFET(void);
- void OnFHNG(void);
- int m_nPhaseState;
- int m_nLoopCtr;
- int m_nPPRCtr;
- // Init sequence
- void SetLocalID(void);
- void SetRecv(void);
- void SetBitOrder(void);
- void SetFaxParams( bool bSending );
- void VerifyOptions(void);
- bool m_bGotEOP;
- bool m_bGotMPS;
- bool m_bGotEOM;
- bool m_bGotDIS;
- bool m_bGotDCS;
- bool m_bResendFaxParams;
- bool m_bFirstFrame;
- int m_nScanTime;
- WORD m_wMinLineChars;
- };
- #endif // CLASSTWO_H