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