fax/faxclientandserver/FAXSVR/FAXMDRV.H
changeset 20 244d7c5f118e
parent 19 1f776524b15c
child 23 6b1d113cdff3
equal deleted inserted replaced
19:1f776524b15c 20:244d7c5f118e
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Contents :  fax s/r header file
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent 
       
    21 */
       
    22 
       
    23 #ifndef __FAXMDRV_H
       
    24 #define __FAXMDRV_H
       
    25 
       
    26 // class 1 T.30 frame stuff
       
    27 
       
    28 #include "FRAMES.H"
       
    29 /**
       
    30 @internalComponent
       
    31 */
       
    32 const TInt KDialTimeout (100);
       
    33 
       
    34 /********************************************************************/
       
    35 
       
    36 // now the CFaxModemDriver abstract class
       
    37 class CFaxModem;
       
    38 class CFaxModemDriver : public CBase
       
    39 /**
       
    40 @internalComponent
       
    41 */
       
    42    {
       
    43 
       
    44  public:
       
    45    static CFaxModemDriver * NewLC (TFaxServerSessionSettings *,RFax::TProgress& aProgress);
       
    46    static CFaxModemDriver * NewL (TFaxServerSessionSettings *,RFax::TProgress& aProgress);
       
    47    void ConstructL (TFaxServerSessionSettings *,RFax::TProgress& aProgress);
       
    48     CFaxModemDriver ();
       
    49    ~CFaxModemDriver ();
       
    50 
       
    51    void GetFaxDataL (TDes8 *);
       
    52    TInt GetLineL (TUint8 *);
       
    53    virtual TInt RxConnectL () = 0;
       
    54    virtual TInt RxPrePageL () = 0;
       
    55    virtual TInt RxPostPageL () = 0;
       
    56 
       
    57    TInt SendFaxDataL (const TDesC8 *);
       
    58    virtual TInt TxConnectL () = 0;
       
    59    virtual TInt TxPrePageL () = 0;
       
    60    virtual TInt TxPostPageL () = 0;
       
    61 
       
    62    inline void SetSharedFileHandles(CFaxSharedFileHandles* aSharedHandles) 
       
    63 	   {
       
    64 	   iSharedHandles = aSharedHandles;
       
    65 	   }
       
    66 
       
    67  protected:
       
    68    inline TUint8 Invert (TUint8);
       
    69    void DialFaxOnDemandL ();
       
    70    void WriteFaxStoreL (TInt);
       
    71    TInt RxStartPageL();
       
    72    TInt TxStartPageL();
       
    73    void SendFaxHeaderL ();
       
    74    void padLineL (TInt);
       
    75    TInt CheckCadenceExportL(const TDesC8 &);
       
    76 
       
    77  public:
       
    78    CFaxModem * iModem;
       
    79    TFaxServerSessionSettings * iFaxServerSessionSettings;
       
    80    TInt iRepeatPage;
       
    81    TTimeIntervalMicroSeconds iCadence;
       
    82    TTime iTimeOfLastRing;
       
    83 
       
    84  protected:
       
    85    TInt iActualFaxSpeed;
       
    86    TInt iMinscan;
       
    87    TInt iMinlinelength;        // worked out from iMinscan and iActualFaxSpeed
       
    88    TBuf8 < 128 > iResults;
       
    89    CFaxSharedFileHandles* iSharedHandles;
       
    90    };
       
    91 
       
    92 /********************************************************************/
       
    93 
       
    94 // Here we have the derived classes for various types of fax modems
       
    95 // class one is the only complicated one
       
    96 
       
    97 /********************************************************************/
       
    98 
       
    99 class CFaxClass1 : public CFaxModemDriver
       
   100 /**
       
   101 @internalComponent
       
   102 */
       
   103    {
       
   104 
       
   105  public:
       
   106    static CFaxModemDriver * NewL (TFaxServerSessionSettings *,RFax::TProgress& aProgress);
       
   107    static CFaxModemDriver * NewLC (TFaxServerSessionSettings *,RFax::TProgress& aProgress);
       
   108 
       
   109    TInt RxConnectL ();
       
   110    TInt RxPrePageL ();
       
   111    TInt RxPostPageL ();
       
   112    TInt TxConnectL ();
       
   113    TInt TxPrePageL ();
       
   114    TInt TxPostPageL ();
       
   115 
       
   116  private:
       
   117    TInt RxPrePollL ();
       
   118    TInt RxSetHighSpeedL ();
       
   119    void RxDCNL ();
       
   120    TInt TxSetHighSpeedL ();
       
   121    TInt TxDCNL ();
       
   122 
       
   123    TInt GetframeL (TDes8 &);
       
   124    TInt SendframeL (TDes8 &);
       
   125    TInt GetFramestatL ();
       
   126    TInt FramestatL ();
       
   127    TInt FramestatL (TInt);
       
   128    void ReceiveSilenceL ();
       
   129    TInt SendCRPL ();
       
   130    inline void AnalyseDISL ();
       
   131 
       
   132    union faxparms iDisFrame;
       
   133    union faxparms iDcsFrame;
       
   134    union faxparms iDtcFrame;
       
   135    TInt iDcsBytes ;
       
   136    TInt iDisBytes ;
       
   137    TInt iFcfXbit ;             // the fcf X bit, see T.30/5.3.6.1
       
   138    TBuf8 < 16 > iModemString;  // HDLC post-frame modem status
       
   139    TBuf8 < 36 > iOldFrame;     // last frame resend for class 1
       
   140    TBuf8 < 36 > iFrame;        // current frame data space
       
   141    };
       
   142 /********************************************************************/
       
   143 
       
   144 class CFaxClass2 : public CFaxModemDriver
       
   145 /**
       
   146 @internalComponent
       
   147 */
       
   148    {
       
   149  public:
       
   150    static CFaxModemDriver * NewL (TFaxServerSessionSettings *,RFax::TProgress& aProgress);
       
   151    static CFaxModemDriver * NewLC (TFaxServerSessionSettings *,RFax::TProgress& aProgress);
       
   152 
       
   153    TInt RxConnectL ();
       
   154    TInt RxPrePageL ();
       
   155    TInt RxPostPageL ();
       
   156    TInt TxConnectL ();
       
   157    TInt TxPrePageL ();
       
   158    TInt TxPostPageL ();
       
   159 
       
   160  protected:
       
   161    void ParseResults (TDesC8 &) ;
       
   162    void ExtractAnswerback (TDesC8 &);
       
   163    void AnalyseFHNG(void);
       
   164 
       
   165    };
       
   166 /********************************************************************/
       
   167 
       
   168 class CFaxClass20 : public CFaxClass2
       
   169 /**
       
   170 @internalComponent
       
   171 */
       
   172    {
       
   173  public:
       
   174    static CFaxModemDriver * NewL (TFaxServerSessionSettings *,RFax::TProgress& aProgress);
       
   175    static CFaxModemDriver * NewLC (TFaxServerSessionSettings *,RFax::TProgress& aProgress);
       
   176 
       
   177    TInt RxConnectL ();
       
   178    TInt RxPrePageL ();
       
   179    TInt RxPostPageL ();
       
   180    TInt TxConnectL ();
       
   181    TInt TxPrePageL ();
       
   182    TInt TxPostPageL ();
       
   183    };
       
   184 
       
   185 /********************************************************************/
       
   186 
       
   187 #include "FAXMDRV.INL"
       
   188 
       
   189 #endif
       
   190