fax/faxclientandserver/FAXSVR/FAXSTUB.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 /**@file
       
    17    @internalComponent */
       
    18 #ifndef __FAXSTUB_H
       
    19 #define __FAXSTUB_H
       
    20 
       
    21 #if !defined(__E32STD_H__)
       
    22 #include <e32std.h>
       
    23 #endif
       
    24 
       
    25 #include "etel.h"
       
    26 #include "FAXLOG.H"
       
    27 
       
    28 #if !defined(__E32BASE_H__)
       
    29 #include <e32base.h>
       
    30 #endif
       
    31 
       
    32 #include "FAXSTD.H"
       
    33 /**
       
    34 @internalComponent
       
    35 */
       
    36 #define KMaxDialLength		50		
       
    37 #define KConfigStringLength 32		
       
    38 
       
    39 //**********************************
       
    40 // TFaxServerSessionSettings
       
    41 //**********************************
       
    42 /**
       
    43 @internalComponent
       
    44 */	   
       
    45 struct TFaxServerSessionSettings
       
    46 	{
       
    47 	TFaxServerSessionSettings& operator=(const TFaxServerSessionSettings& aSettings);
       
    48 	TBuf8<KMaxDialLength> iPhoneNumber;
       
    49 	TBool iLogging;
       
    50 	TBuf8<KConfigStringLength> iFaxInitString;
       
    51 	TFaxMode iMode;
       
    52 	TFaxClass iFaxClass;
       
    53 	TFileName iPortDriverName;
       
    54 	TName iCommPortName;
       
    55 	TBuf<RCall::KFaxIdUserNameMaxSize> iFaxId;
       
    56 	TInt iMaxSpeed;
       
    57 	TInt iMinSpeed;
       
    58 	TInt iPreferredECM;
       
    59 	TInt iFaxOnDemandDelay;
       
    60 // Tx Settings
       
    61 	TFaxResolution iTxResolution;
       
    62 	TFaxCompression iTxCompression;
       
    63 	TInt iTxPages;
       
    64 // Rx Settings
       
    65 	TFaxResolution iRxResolution;
       
    66 	TFaxCompression iRxCompression;
       
    67 	};
       
    68 
       
    69 class MFaxCompletionBase
       
    70 /**
       
    71 @internalTechnology
       
    72 */
       
    73 	{
       
    74 public:
       
    75 	virtual void RxConnectComplete(TInt aError)=0;		
       
    76 	virtual void RxFaxDataComplete(TInt aError)=0;		
       
    77 	virtual void RxPostPageComplete(TInt aError)=0;
       
    78 	virtual void TxConnectComplete(TInt aError)=0;
       
    79     virtual void TxFaxDataComplete(TInt aError)=0;
       
    80 	virtual void TxPostPageComplete(TInt aError)=0;		
       
    81 
       
    82 	virtual void GetCadenceAndTimeOfLastRing(TTimeIntervalMicroSeconds& aCadence,TTime& aTime)=0;
       
    83 	};	
       
    84 
       
    85 
       
    86 #ifdef __MARM__
       
    87 /**
       
    88 @internalComponent
       
    89 */
       
    90 const TInt KEtelFaxTimerGranularity = 31000;
       
    91 #else
       
    92 const TInt KEtelFaxTimerGranularity = 80000;
       
    93 #endif
       
    94 /**
       
    95 @internalComponent
       
    96 */
       
    97 #define KDefaultLastUpdateTime  5
       
    98 #define KDefaultAnswerBack  _L("01814590381")
       
    99 #define KDefaultPhase  ENotYetStarted
       
   100 #define KDefaultResolution  EFaxNormal;
       
   101 #define KDefaultCompression  EModifiedHuffman;
       
   102 #define KDefaultPageNumber  1
       
   103 #define KDefaultLinesNumber  3
       
   104 #define KDefaultSpeed  9600
       
   105 
       
   106 #define ASYNC_TIMEOUT		10000
       
   107 #define ASYNC_LONGTIMEOUT	500000
       
   108 
       
   109 class TTsyTimer
       
   110 /**
       
   111 @internalTechnology
       
   112 */
       
   113 	{
       
   114 public:
       
   115 	TTsyTimer();
       
   116 	TBool iPending;
       
   117 	TDeltaTimerEntry iEntry;
       
   118 	};
       
   119 
       
   120 class CFaxTimer;
       
   121 class CFaxSession : public CBase
       
   122 /**
       
   123 @internalTechnology
       
   124 */
       
   125 	{
       
   126 public:
       
   127     static CFaxSession * NewL ();
       
   128     static CFaxSession * NewLC ();
       
   129 
       
   130 	CFaxSession();
       
   131 	void ConstructL();
       
   132 	~CFaxSession();
       
   133 
       
   134 	virtual TInt FxOpen(TFaxServerSessionSettings& aFaxSettings,RFax::TProgress* aProgress);
       
   135 	virtual TInt FxClose();
       
   136 
       
   137 // Rx Fax
       
   138 	virtual void RxConnect();
       
   139 	virtual void RxFaxData(TDes8& aData);
       
   140 	virtual void RxPostPage();
       
   141 // Tx Fax
       
   142 	virtual void TxConnect();
       
   143 	virtual void TxFaxData(const TDesC8& aData);
       
   144 	virtual void TxPostPage();
       
   145 	virtual void Cancel();
       
   146 	virtual void SetCallBack(MFaxCompletionBase* aBase);
       
   147 
       
   148 	static TInt RxConnectHandler(TAny* aPtr);
       
   149 	static TInt RxFaxDataHandler(TAny* aPtr);
       
   150 	static TInt RxPostPageHandler(TAny* aPtr);
       
   151 	static TInt TxConnectHandler(TAny* aPtr);
       
   152 	static TInt TxFaxDataHandler(TAny* aPtr);
       
   153 	static TInt TxPostPageHandler(TAny* aPtr);
       
   154 	static TInt ProgressChanger(TAny* aPtr);
       
   155 public:
       
   156 	RFax::TProgress* iTransferProgress;
       
   157 
       
   158 	// Timer
       
   159 	CFaxTimer* iFaxTimer;
       
   160 	TTsyTimer iRxConnect;
       
   161 	TTsyTimer iRxFaxData;
       
   162 	TTsyTimer iRxPostPage;
       
   163 	TTsyTimer iTxConnect;
       
   164 	TTsyTimer iTxFaxData;
       
   165 	TTsyTimer iTxPostPage;
       
   166 	TTsyTimer iProgressChanger;	
       
   167 	MFaxCompletionBase* iCompletion;
       
   168 	};
       
   169 
       
   170 class CFaxTimer: public CBase
       
   171 /**
       
   172 @internalTechnology
       
   173 */
       
   174 	{
       
   175 public:
       
   176 	static CFaxTimer* NewL();
       
   177 	CFaxTimer();
       
   178 	void ConstructL();
       
   179 	~CFaxTimer();
       
   180 
       
   181 	void QueueTimer(TTsyTimer& aTsyTimer,
       
   182 						TTimeIntervalMicroSeconds32 aTimeInMicroSeconds,
       
   183 						TInt (*aFunction)(TAny *aPtr), TAny* aPtr);
       
   184 	TBool RemoveTimer(TTsyTimer& aHandle);
       
   185 	void ResetPending(TTsyTimer& aHandle);
       
   186 private:
       
   187 	CDeltaTimer* iTimer;
       
   188 	};
       
   189 
       
   190 #endif //__FAXSTUB_H