1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
14 // |
14 // |
15 |
15 |
16 |
16 |
17 |
17 |
18 // INCLUDE FILES |
18 // INCLUDE FILES |
19 #include <ctsy/tflogger.h> |
|
20 #include "cmmfaxcompletion.h" |
19 #include "cmmfaxcompletion.h" |
21 #include "cmmcalltsy.h" |
20 #include "cmmcalltsy.h" |
22 |
21 |
23 // ======== MEMBER FUNCTIONS ======== |
22 // ======== MEMBER FUNCTIONS ======== |
24 |
23 |
25 CMmFaxCompletion::CMmFaxCompletion() : CBase(), iTsyReqHandle ( 0 ), |
24 CMmFaxCompletion::CMmFaxCompletion() : CBase(), iTsyReqHandle ( 0 ), |
26 iTelObject( NULL ) |
25 iTelObject( NULL ) |
27 { |
26 { |
28 TFLOGSTRING("TSY: CMmFaxCompletion::CMmFaxCompletion" ); |
27 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCOMPLETION_CTOR_1, "TSY: CMmFaxCompletion::CMmFaxCompletion" ); |
29 } |
28 } |
30 |
29 |
31 CMmFaxCompletion::~CMmFaxCompletion() |
30 CMmFaxCompletion::~CMmFaxCompletion() |
32 { |
31 { |
33 TFLOGSTRING("TSY: CMmFaxCompletion::~CMmFaxCompletion"); |
32 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCOMPLETION_DTOR_1, "TSY: CMmFaxCompletion::~CMmFaxCompletion"); |
34 if ( iTsyReqHandle ) |
33 if ( iTsyReqHandle ) |
35 { |
34 { |
36 TFLOGSTRING2("TSY: CMmFaxCompletion::~CMmFaxCompletion: request %d not completed!", iTsyReqHandle); |
35 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCOMPLETION_DTOR_2, "TSY: CMmFaxCompletion::~CMmFaxCompletion: request %d not completed!", iTsyReqHandle); |
37 // Completion should not be done here, because in some cases |
36 // Completion should not be done here, because in some cases |
38 // operations are completed automatically by ETel! |
37 // operations are completed automatically by ETel! |
39 // CompleteOperation(KErrCancel); |
38 // CompleteOperation(KErrCancel); |
40 } |
39 } |
41 } |
40 } |
48 // --------------------------------------------------------------------------- |
47 // --------------------------------------------------------------------------- |
49 // |
48 // |
50 void CMmFaxCompletion::CompleteOperation( |
49 void CMmFaxCompletion::CompleteOperation( |
51 TInt aError ) // error Value |
50 TInt aError ) // error Value |
52 { |
51 { |
53 TFLOGSTRING2("TSY: CMmFaxCompletion::CompleteOperation iTsyReqHandle: %d", iTsyReqHandle ); |
52 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCOMPLETION_COMPLETEOPERATION_1, "TSY: CMmFaxCompletion::CompleteOperation iTsyReqHandle: %d", iTsyReqHandle ); |
54 if ( 0 < iTsyReqHandle ) |
53 if ( 0 < iTsyReqHandle ) |
55 { |
54 { |
56 iTelObject->ReqCompleted( iTsyReqHandle, aError ); |
55 iTelObject->ReqCompleted( iTsyReqHandle, aError ); |
57 iTsyReqHandle = 0; |
56 iTsyReqHandle = 0; |
58 } |
57 } |
68 const TTsyReqHandle aTsyReqHandle, |
67 const TTsyReqHandle aTsyReqHandle, |
69 CTelObject* aTelObject ) |
68 CTelObject* aTelObject ) |
70 { |
69 { |
71 if ( 0 < iTsyReqHandle ) |
70 if ( 0 < iTsyReqHandle ) |
72 { |
71 { |
73 TFLOGSTRING3("TSY: CMmFaxCompletion::Configure overwriting previous request %d with %d", |
72 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCOMPLETION_CONFIGURE_1, "TSY: CMmFaxCompletion::Configure overwriting previous request %d with %d",iTsyReqHandle, aTsyReqHandle); |
74 iTsyReqHandle, aTsyReqHandle); |
|
75 } |
73 } |
76 |
74 |
77 iTsyReqHandle = aTsyReqHandle; |
75 iTsyReqHandle = aTsyReqHandle; |
78 iTelObject = aTelObject; |
76 iTelObject = aTelObject; |
79 } |
77 } |
86 // |
84 // |
87 void CMmFaxCompletion::GetCadenceAndTimeOfLastRing( |
85 void CMmFaxCompletion::GetCadenceAndTimeOfLastRing( |
88 TTimeIntervalMicroSeconds& /*aCadence*/, // cadence time |
86 TTimeIntervalMicroSeconds& /*aCadence*/, // cadence time |
89 TTime& /*aTime*/ ) // time |
87 TTime& /*aTime*/ ) // time |
90 { |
88 { |
91 TFLOGSTRING("TSY: CMmFaxCompletion::GetCadenceAndTimeOfLastRing"); |
89 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCOMPLETION_GETCADENCEANDTIMEOFLASTRING_1, "TSY: CMmFaxCompletion::GetCadenceAndTimeOfLastRing"); |
92 // Checking the usage of aCadence and aTime in the calling function |
90 // Checking the usage of aCadence and aTime in the calling function |
93 // (fax server) shows that we don't need to change the values. |
91 // (fax server) shows that we don't need to change the values. |
94 // REINTERPRET_CAST(CTsyPhone*,iMmCall->Owner()->Owner())-> |
92 // REINTERPRET_CAST(CTsyPhone*,iMmCall->Owner()->Owner())-> |
95 // GetCadenceAndTimeOfLastRing(aCadence,aTime); |
93 // GetCadenceAndTimeOfLastRing(aCadence,aTime); |
96 } |
94 } |
102 // --------------------------------------------------------------------------- |
100 // --------------------------------------------------------------------------- |
103 // |
101 // |
104 void CMmFaxCompletion::RxConnectComplete( |
102 void CMmFaxCompletion::RxConnectComplete( |
105 TInt aError ) |
103 TInt aError ) |
106 { |
104 { |
107 TFLOGSTRING2("TSY: CMmFaxCompletion::RXConnectComplete ErrorValue: %d", aError); |
105 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCOMPLETION_RXCONNECTCOMPLETE_1, "TSY: CMmFaxCompletion::RXConnectComplete ErrorValue: %d", aError); |
108 CMmCallTsy* mmCall = REINTERPRET_CAST(CMmCallTsy*, iTelObject); |
106 CMmCallTsy* mmCall = REINTERPRET_CAST(CMmCallTsy*, iTelObject); |
109 |
107 |
110 // This is a good place to fill missing remote party phone number. |
108 // This is a good place to fill missing remote party phone number. |
111 if ( KErrNone== aError ) |
109 if ( KErrNone== aError ) |
112 { |
110 { |
138 // --------------------------------------------------------------------------- |
136 // --------------------------------------------------------------------------- |
139 // |
137 // |
140 void CMmFaxCompletion::RxFaxDataComplete( |
138 void CMmFaxCompletion::RxFaxDataComplete( |
141 TInt aError ) // in: an error value |
139 TInt aError ) // in: an error value |
142 { |
140 { |
143 TFLOGSTRING2("TSY: CMmFaxCompletion::RxFaxDataComplete ErrorValue: %d", aError); |
141 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCOMPLETION_RXFAXDATACOMPLETE_1, "TSY: CMmFaxCompletion::RxFaxDataComplete ErrorValue: %d", aError); |
144 if ( 0 < iTsyReqHandle ) |
142 if ( 0 < iTsyReqHandle ) |
145 { |
143 { |
146 iTelObject->ReqCompleted( iTsyReqHandle, aError ); |
144 iTelObject->ReqCompleted( iTsyReqHandle, aError ); |
147 iTsyReqHandle = 0; |
145 iTsyReqHandle = 0; |
148 } |
146 } |
156 // |
154 // |
157 void CMmFaxCompletion::RxPostPageComplete( |
155 void CMmFaxCompletion::RxPostPageComplete( |
158 TInt aError ) |
156 TInt aError ) |
159 { |
157 { |
160 |
158 |
161 TFLOGSTRING2("TSY: CMmFaxCompletion::RxPostPageComplete ErrorValue: %d", aError ); |
159 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCOMPLETION_RXPOSTPAGECOMPLETE_1, "TSY: CMmFaxCompletion::RxPostPageComplete ErrorValue: %d", aError ); |
162 if ( 0 < iTsyReqHandle) |
160 if ( 0 < iTsyReqHandle) |
163 { |
161 { |
164 iTelObject->ReqCompleted( iTsyReqHandle, aError ); |
162 iTelObject->ReqCompleted( iTsyReqHandle, aError ); |
165 iTsyReqHandle = 0; |
163 iTsyReqHandle = 0; |
166 } |
164 } |
173 // --------------------------------------------------------------------------- |
171 // --------------------------------------------------------------------------- |
174 // |
172 // |
175 void CMmFaxCompletion::TxConnectComplete( |
173 void CMmFaxCompletion::TxConnectComplete( |
176 TInt aError ) |
174 TInt aError ) |
177 { |
175 { |
178 TFLOGSTRING2("TSY: CMmFaxCompletion::TXConnectComplete ErrorValue: %d", aError); |
176 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCOMPLETION_TXCONNECTCOMPLETE_1, "TSY: CMmFaxCompletion::TXConnectComplete ErrorValue: %d", aError); |
179 |
177 |
180 CMmCallTsy* mmCall = REINTERPRET_CAST(CMmCallTsy*,iTelObject); |
178 CMmCallTsy* mmCall = REINTERPRET_CAST(CMmCallTsy*,iTelObject); |
181 |
179 |
182 // this is a good place to fill missing caller id |
180 // this is a good place to fill missing caller id |
183 if ( KErrNone == aError ) |
181 if ( KErrNone == aError ) |
199 // --------------------------------------------------------------------------- |
197 // --------------------------------------------------------------------------- |
200 // |
198 // |
201 void CMmFaxCompletion::TxFaxDataComplete( |
199 void CMmFaxCompletion::TxFaxDataComplete( |
202 TInt aError ) |
200 TInt aError ) |
203 { |
201 { |
204 TFLOGSTRING2("TSY: CMmFaxCompletion::TxFaxDataComplete ErrorValue: %d", aError); |
202 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCOMPLETION_TXFAXDATACOMPLETE_1, "TSY: CMmFaxCompletion::TxFaxDataComplete ErrorValue: %d", aError); |
205 |
203 |
206 if ( 0 < iTsyReqHandle ) |
204 if ( 0 < iTsyReqHandle ) |
207 { |
205 { |
208 iTelObject->ReqCompleted( iTsyReqHandle, aError ); |
206 iTelObject->ReqCompleted( iTsyReqHandle, aError ); |
209 iTsyReqHandle = 0; |
207 iTsyReqHandle = 0; |
217 // --------------------------------------------------------------------------- |
215 // --------------------------------------------------------------------------- |
218 // |
216 // |
219 void CMmFaxCompletion::TxPostPageComplete( |
217 void CMmFaxCompletion::TxPostPageComplete( |
220 TInt aError ) |
218 TInt aError ) |
221 { |
219 { |
222 TFLOGSTRING2("TSY: CMmFaxCompletion::TxPostPageComplete ErrorValue: %d", aError ); |
220 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCOMPLETION_TXPOSTPAGECOMPLETE_1, "TSY: CMmFaxCompletion::TxPostPageComplete ErrorValue: %d", aError ); |
223 |
221 |
224 if ( 0 < iTsyReqHandle ) |
222 if ( 0 < iTsyReqHandle ) |
225 { |
223 { |
226 iTelObject->ReqCompleted( iTsyReqHandle, aError ); |
224 iTelObject->ReqCompleted( iTsyReqHandle, aError ); |
227 iTsyReqHandle = 0; |
225 iTsyReqHandle = 0; |
235 // --------------------------------------------------------------------------- |
233 // --------------------------------------------------------------------------- |
236 // |
234 // |
237 void CMmFaxCompletion::FillAnswerback( |
235 void CMmFaxCompletion::FillAnswerback( |
238 CMmCallTsy* aMmCall ) |
236 CMmCallTsy* aMmCall ) |
239 { |
237 { |
240 TFLOGSTRING("TSY: CMmFaxCompletion::FillAnswerback"); |
238 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCOMPLETION_FILLANSWERBACK_1, "TSY: CMmFaxCompletion::FillAnswerback"); |
241 |
239 |
242 if ( aMmCall ) |
240 if ( aMmCall ) |
243 { |
241 { |
244 // if progress chunk already exists, this will return pointer to existing chunk. |
242 // if progress chunk already exists, this will return pointer to existing chunk. |
245 RFax::TProgress* faxProgress = aMmCall->CreateFaxProgressChunk(); |
243 RFax::TProgress* faxProgress = aMmCall->CreateFaxProgressChunk(); |
246 if ( faxProgress ) |
244 if ( faxProgress ) |
247 { |
245 { |
248 |
246 |
249 if ( 0 == faxProgress->iAnswerback.Length() ) |
247 if ( 0 == faxProgress->iAnswerback.Length() ) |
250 { |
248 { |
251 TFLOGSTRING("TSY: CMmFaxCompletion::FillAnswerback Getting missing remote number from call info"); |
249 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCOMPLETION_FILLANSWERBACK_2, "TSY: CMmFaxCompletion::FillAnswerback Getting missing remote number from call info"); |
252 // Copy remote party phone number to Progress chunk's |
250 // Copy remote party phone number to Progress chunk's |
253 // answerback field. Answerback will hold only leftmost 20 |
251 // answerback field. Answerback will hold only leftmost 20 |
254 // numbers if the number is longer than that. |
252 // numbers if the number is longer than that. |
255 RMobileCall::TMobileCallInfoV1 info; |
253 RMobileCall::TMobileCallInfoV1 info; |
256 RMobileCall::TMobileCallInfoV1Pckg infoPkg(info); |
254 RMobileCall::TMobileCallInfoV1Pckg infoPkg(info); |