fax/faxclientandserver/FAXSVR/FAXSERV.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 //
       
    15 
       
    16 /**
       
    17  @file 
       
    18 */
       
    19 
       
    20 #if !defined(__FaxServ_H__)
       
    21 #define __FaxServ_H__
       
    22 
       
    23 #include <f32file.h>
       
    24 #include <s32file.h>
       
    25 #include <s32mem.h>
       
    26 
       
    27 #if !defined(__FAXSTORE_H__)
       
    28 #include <faxstore.h>
       
    29 #endif
       
    30 	  
       
    31 #if !defined(__FAXHUFF_H__)
       
    32 #include <faxhuff.h>
       
    33 #endif
       
    34 
       
    35 #if !defined(__ETEL_H__)
       
    36 #include "ETEL.H"
       
    37 #endif
       
    38 
       
    39 #include <faxstd.h>
       
    40 /**
       
    41 @internalTechnology
       
    42 */
       
    43 const TUint KUidDynamicFaxServer = 0x10004C88;		
       
    44 const TUint KUidUnicodeDynamicFaxServer = 0x10004C89;
       
    45 /**
       
    46 @internalComponent
       
    47 */
       
    48 TInt FaxServerThread (TAny * session);  // function declaration needed here
       
    49 /**
       
    50 @internalComponent
       
    51 */
       
    52 #define KMaxDialLength		50		
       
    53 #define KConfigStringLength 32		
       
    54 
       
    55 
       
    56 //**********************************
       
    57 // TFaxServerSessionSettings
       
    58 //**********************************
       
    59 /**
       
    60 @internalTechnology
       
    61 */	   
       
    62 struct TFaxServerSessionSettings
       
    63 	{
       
    64 	TFaxServerSessionSettings& operator=(const TFaxServerSessionSettings& aSettings);
       
    65 	TBuf8<KMaxDialLength> iPhoneNumber;
       
    66 	TBool iLogging;
       
    67 	TBuf8<KConfigStringLength> iFaxInitString;
       
    68 	TFaxMode iMode;
       
    69 	TFaxClass iFaxClass;
       
    70 	TFileName iPortDriverName;
       
    71 	TName iCommPortName;
       
    72 	TBuf<RCall::KFaxIdUserNameMaxSize> iFaxId;
       
    73 	TInt iMaxSpeed;
       
    74 	TInt iMinSpeed;
       
    75 	TInt iPreferredECM;
       
    76 	TInt iFaxOnDemandDelay;
       
    77 // Tx Settings
       
    78 	TFaxResolution iTxResolution;
       
    79 	TFaxCompression iTxCompression;
       
    80 	TInt iTxPages;
       
    81 // Rx Settings
       
    82 	TFaxResolution iRxResolution;
       
    83 	TFaxCompression iRxCompression;
       
    84 	};
       
    85 
       
    86 class MFaxCompletionBase
       
    87 /**
       
    88 @internalTechnology
       
    89 */
       
    90 	{
       
    91 public:
       
    92 	virtual void RxConnectComplete(TInt aError)=0;		
       
    93 	virtual void RxFaxDataComplete(TInt aError)=0;		
       
    94 	virtual void RxPostPageComplete(TInt aError)=0;
       
    95 	virtual void TxConnectComplete(TInt aError)=0;
       
    96     virtual void TxFaxDataComplete(TInt aError)=0;
       
    97 	virtual void TxPostPageComplete(TInt aError)=0;		
       
    98 
       
    99 	virtual void GetCadenceAndTimeOfLastRing(TTimeIntervalMicroSeconds& aCadence,TTime& aTime)=0;
       
   100 	};	
       
   101 
       
   102 
       
   103 class CFaxModemDriver;
       
   104 class CFaxSharedFileHandles;
       
   105 class CFaxSession : public CBase
       
   106 /**
       
   107 @internalTechnology
       
   108 */
       
   109    {
       
   110  public:
       
   111      virtual TInt FxOpen(TFaxServerSessionSettings&,RFax::TProgress* aProgress);
       
   112 	 virtual TInt FxClose();
       
   113 	 virtual void RxConnect();
       
   114 	 virtual void RxFaxData(TDes8 & aData);
       
   115 	 virtual void RxPostPage();
       
   116 	 virtual void TxConnect();
       
   117 	 virtual void TxFaxData(const TDesC8 & aData);
       
   118 	 virtual void TxPostPage();
       
   119 	 virtual void Cancel();
       
   120 	 virtual void SetCallBack(MFaxCompletionBase* aBase);
       
   121 	 virtual void SetFaxHeaderFile(CFaxSharedFileHandles* iSharedFileHandles);
       
   122 
       
   123      static CFaxSession * NewL ();
       
   124      static CFaxSession * NewLC ();
       
   125      ~CFaxSession ();
       
   126      CFaxSession(void);
       
   127 
       
   128 	 MFaxCompletionBase* ReturnCompletionBase(void);		// added by JerryC
       
   129      void StartModemL ();
       
   130 
       
   131 
       
   132   enum TFaxThreadRequest
       
   133      {
       
   134      ERxConnect,
       
   135      ERxFaxData,
       
   136      ERxPostPage,
       
   137      ETxConnect,
       
   138      ETxFaxData,
       
   139      ETxPostPage,
       
   140      EFxClose
       
   141      };
       
   142 
       
   143 	/********************************************************************/
       
   144 	// CFaxRequest active object
       
   145 	/********************************************************************/
       
   146 
       
   147   class CFaxRequest : public CActive
       
   148   /**
       
   149   @internalComponent
       
   150   */
       
   151      {
       
   152    public:
       
   153      CFaxRequest();
       
   154      ~CFaxRequest ();
       
   155      static CFaxRequest * NewL (CFaxSession *);
       
   156      static CFaxRequest * NewLC (CFaxSession *);
       
   157      void ConstructL (CFaxSession *);
       
   158      void DoCancel();
       
   159      void FaxRequest (TFaxThreadRequest);
       
   160      void RunL ();
       
   161   
       
   162    public:
       
   163      RThread iChildThread;
       
   164      TRequestStatus iThreadStat;
       
   165      TInt iCancel;
       
   166 
       
   167    private:
       
   168      CFaxSession  * iFaxSession;
       
   169      TFaxThreadRequest iFaxThreadRequest;
       
   170      };
       
   171 
       
   172  public:
       
   173    RThread iParentThread;
       
   174    CFaxModemDriver * iModemDriver;
       
   175    TDes8 * iRxData;
       
   176    const TDesC8 * iTxData;
       
   177    CFaxRequest * iFaxRequest;
       
   178    TFaxServerSessionSettings iFaxServerSessionSettings;
       
   179    RFax::TProgress* iProgress;
       
   180    CFaxSharedFileHandles* iSharedFileHandles;
       
   181  private:
       
   182    TRequestStatus iChildDeath;
       
   183    MFaxCompletionBase* iCompletionBase;					// added by JerryC
       
   184    TBool iAmDestructing;
       
   185    };
       
   186 
       
   187 
       
   188 /********************************************************************/
       
   189 
       
   190 /* 
       
   191 class MFaxSession 
       
   192 	{
       
   193 public:
       
   194      virtual TInt FxOpen(TFaxServerSessionSettings&,RFax::TProgress* aProgress)=0;
       
   195 	 virtual TInt FxClose()=0;
       
   196 
       
   197 	 virtual void RxConnect()=0;
       
   198 	 virtual void RxFaxData(TDes8 & aData)=0;
       
   199 	 virtual void RxPostPage()=0;
       
   200 
       
   201 	 virtual void TxConnect()=0;
       
   202 	 virtual void TxFaxData(const TDesC8 & aData)=0;
       
   203 	 virtual void TxPostPage()=0;
       
   204 
       
   205 	 virtual void Cancel()=0;
       
   206 
       
   207 	 virtual void SetCallBack(MFaxCompletionBase* aCompletionBase)=0;
       
   208 	};
       
   209 
       
   210   */
       
   211 
       
   212 
       
   213 #endif