equal
deleted
inserted
replaced
1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2003-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". |
17 |
17 |
18 /** |
18 /** |
19 @file Nd_etel.cpp |
19 @file Nd_etel.cpp |
20 */ |
20 */ |
21 |
21 |
|
22 |
|
23 #include "OstTraceDefinitions.h" |
|
24 #ifdef OST_TRACE_COMPILER_IN_USE |
|
25 #include "ND_ETELTraces.h" |
|
26 #endif |
|
27 |
22 #include "ND_DBACC.H" |
28 #include "ND_DBACC.H" |
23 #include "ND_STD.H" |
29 #include "ND_STD.H" |
24 #include "ND_ETEL.H" |
30 #include "ND_ETEL.H" |
25 #include "SLOGGER.H" |
31 |
26 |
32 |
27 /** |
33 /** |
28 @internalComponent |
34 @internalComponent |
29 */ |
35 */ |
30 _LIT(KDoubleColon,"::"); |
36 _LIT(KDoubleColon,"::"); |
75 @exception Leaves if ETel server Connect() returns error, or not enough memory is available. |
81 @exception Leaves if ETel server Connect() returns error, or not enough memory is available. |
76 */ |
82 */ |
77 { |
83 { |
78 CActiveScheduler::Add(this); |
84 CActiveScheduler::Add(this); |
79 |
85 |
80 __FLOG_STMT(_LIT8(logString,"NetDial:\tConnecting Etel Server");) |
86 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_CONSTRUCTL_1, "NetDial:\tConnecting Etel Server"); |
81 __FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString()); |
|
82 User::LeaveIfError(iTelServer.Connect()); |
87 User::LeaveIfError(iTelServer.Connect()); |
83 iState=EIdle; |
88 iState=EIdle; |
84 iCallType=EUnknown; |
89 iCallType=EUnknown; |
85 } |
90 } |
86 |
91 |
90 Close active call. |
95 Close active call. |
91 If TSY is loaded, call UnloadPhoneModule() to unload it. |
96 If TSY is loaded, call UnloadPhoneModule() to unload it. |
92 Close ETel server connection. |
97 Close ETel server connection. |
93 */ |
98 */ |
94 { |
99 { |
95 __FLOG_STMT(_LIT8(logString1,"NetDial:\tClosing Call");) |
100 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_DTOR_1,"NetDial:\tClosing Call"); |
96 __FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString1()); |
|
97 CloseCall(); |
101 CloseCall(); |
98 __FLOG_STMT(_LIT8(logString2,"NetDial:\tClosing Etel Server");) |
102 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_DTOR_2, "NetDial:\tClosing Etel Server"); |
99 __FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString2()); |
|
100 if(iTsyLoaded) |
103 if(iTsyLoaded) |
101 { |
104 { |
102 iTelServer.UnloadPhoneModule(iTsyName); |
105 iTelServer.UnloadPhoneModule(iTsyName); |
103 iTsyLoaded=EFalse; |
106 iTsyLoaded=EFalse; |
104 } |
107 } |
131 and dial the call. |
134 and dial the call. |
132 |
135 |
133 @exception Leaves if GetCallParamsL() leaves. |
136 @exception Leaves if GetCallParamsL() leaves. |
134 */ |
137 */ |
135 { |
138 { |
136 __FLOG_STMT(_LIT(logString,"NetDial:\tDialling %S");) |
139 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_DIALL_1, "NetDial:\tDialling %S", iTelNum); |
137 __FLOG_STATIC1(KNetDialLogFolder(),KNetDialLogFile(),TRefByValue<const TDesC>(logString()),&iTelNum); |
|
138 |
140 |
139 TInt ret=iDb->GetRedialAttempts(iMaxDialAttempts); |
141 TInt ret=iDb->GetRedialAttempts(iMaxDialAttempts); |
140 if (ret!=KErrNone) |
142 if (ret!=KErrNone) |
141 { |
143 { |
142 iMaxDialAttempts=KDefaultMaxDialAttempts; |
144 iMaxDialAttempts=KDefaultMaxDialAttempts; |
195 /** |
197 /** |
196 Enable listening for a baseband disconnect |
198 Enable listening for a baseband disconnect |
197 @param aObserver a reference to observer. |
199 @param aObserver a reference to observer. |
198 */ |
200 */ |
199 { |
201 { |
200 __FLOG_STMT(_LIT8(logString,"NetDial:\tListening For Call Status Change");) |
202 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_LISTENFORSTATUSCHANGE_1, "NetDial:\tListening For Call Status Change"); |
201 __FLOG_STATIC(KNetDialLogFolder(), KNetDialLogFile(), logString()); |
|
202 |
203 |
203 __ASSERT_ALWAYS(EIdle == iState, NetDialPanic(EEtelServerNotIdle)); |
204 __ASSERT_ALWAYS(EIdle == iState, NetDialPanic(EEtelServerNotIdle)); |
204 __ASSERT_ALWAYS(iCallOpen, NetDialPanic(EEtelCallNotOpen)); |
205 __ASSERT_ALWAYS(iCallOpen, NetDialPanic(EEtelCallNotOpen)); |
205 |
206 |
206 iCurrentObserver = &aObserver; |
207 iCurrentObserver = &aObserver; |
209 iState = EListenForStatusChange; |
210 iState = EListenForStatusChange; |
210 } |
211 } |
211 |
212 |
212 void CTelServerProcessor::CancelListenForStatusChange() |
213 void CTelServerProcessor::CancelListenForStatusChange() |
213 { |
214 { |
214 __FLOG_STMT(_LIT8(logString,"NetDial:\tCancelListenForStatusChange. iState: [%d]. iStatus: [%d]");) |
215 OstTraceDefEx2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_CANCELLISTENFORSTATUSCHANGE_1, "NetDial:\tCancelListenForStatusChange. iState: [%d]. iStatus: [%d]",iState, iStatus.Int()); |
215 __FLOG_STATIC2(KNetDialLogFolder(), KNetDialLogFile(), logString(), iState, iStatus.Int()); |
|
216 |
216 |
217 __ASSERT_ALWAYS(iCallOpen, NetDialPanic(EEtelCallNotOpen)); |
217 __ASSERT_ALWAYS(iCallOpen, NetDialPanic(EEtelCallNotOpen)); |
218 |
218 |
219 Cancel(); |
219 Cancel(); |
220 } |
220 } |
224 Handle call status change. |
224 Handle call status change. |
225 If the call dropped, notify the observer, otherwise re-issue status |
225 If the call dropped, notify the observer, otherwise re-issue status |
226 change notification |
226 change notification |
227 */ |
227 */ |
228 { |
228 { |
229 __FLOG_STMT(_LIT8(logString,"NetDial:\tCall Status Changed. CallStatus %d Error: %d");) |
229 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_HANDLESTATUSCHANGE_1, "NetDial:\tCall Status Changed. CallStatus %d Error: %d",iCallStatus, iStatus.Int()); |
230 __FLOG_STATIC2(KNetDialLogFolder(), KNetDialLogFile(), logString(), iCallStatus, iStatus.Int()); |
|
231 |
230 |
232 // Ignore if subscribing to status change notification failed. |
231 // Ignore if subscribing to status change notification failed. |
233 // It can be that the TSY doesn't support the feature etc. |
232 // It can be that the TSY doesn't support the feature etc. |
234 if (KErrNone != iStatus.Int()) |
233 if (KErrNone != iStatus.Int()) |
235 { |
234 { |
279 GetPhoneInfoL(info); |
278 GetPhoneInfoL(info); |
280 |
279 |
281 if (!iCallOpen) |
280 if (!iCallOpen) |
282 OpenNewCallL(); |
281 OpenNewCallL(); |
283 |
282 |
284 __FLOG_STMT(_LIT8(logString2,"NetDial:\tWaiting For Incoming Call");) |
283 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_WAITFORINCOMINGCALLL_1, "NetDial:\tWaiting For Incoming Call"); |
285 __FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString2()); |
|
286 |
284 |
287 if (iCallType==ECoreCallOnly) |
285 if (iCallType==ECoreCallOnly) |
288 { |
286 { |
289 iDb->GetCallParamsL(iCallParams); |
287 iDb->GetCallParamsL(iCallParams); |
290 iCall.AnswerIncomingCall(iStatus,iCallParamsPckg); |
288 iCall.AnswerIncomingCall(iStatus,iCallParamsPckg); |
344 #ifdef SYMBIAN_NETWORKING_CSDAGENT_BCA_SUPPORT |
342 #ifdef SYMBIAN_NETWORKING_CSDAGENT_BCA_SUPPORT |
345 CancelListenForStatusChange(); |
343 CancelListenForStatusChange(); |
346 #endif |
344 #endif |
347 Assertions(); |
345 Assertions(); |
348 |
346 |
349 __FLOG_STMT(_LIT8(logString,"NetDial:\tHanging Up Call");) |
347 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_STARTHANGUP_1, "NetDial:\tHanging Up Call"); |
350 __FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString()); |
|
351 ActiveCall().HangUp(iStatus); |
348 ActiveCall().HangUp(iStatus); |
352 SetActive(); |
349 SetActive(); |
353 } |
350 } |
354 |
351 |
355 void CTelServerProcessor::GetCommPortL(RCall::TCommPort& aCommPort) |
352 void CTelServerProcessor::GetCommPortL(RCall::TCommPort& aCommPort) |
359 |
356 |
360 @param aCommPort returns reference to loaned comm port. |
357 @param aCommPort returns reference to loaned comm port. |
361 @exception Leaves if LoanDataPort() returns error or SetCommPortL leaves. |
358 @exception Leaves if LoanDataPort() returns error or SetCommPortL leaves. |
362 */ |
359 */ |
363 { |
360 { |
364 __FLOG_STMT(_LIT8(logString,"NetDial:\tLoaning Port From Etel");) |
361 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_GETCOMMPORTL_1, "NetDial:\tLoaning Port From Etel"); |
365 __FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString()); |
|
366 User::LeaveIfError(ActiveCall().LoanDataPort(aCommPort)); |
362 User::LeaveIfError(ActiveCall().LoanDataPort(aCommPort)); |
367 iDb->SetCommPortL(aCommPort); |
363 iDb->SetCommPortL(aCommPort); |
368 iLoaned=ETrue; |
364 iLoaned=ETrue; |
369 #ifndef SYMBIAN_NETWORKING_CSDAGENT_BCA_SUPPORT |
365 #ifndef SYMBIAN_NETWORKING_CSDAGENT_BCA_SUPPORT |
370 iState=EIdle; |
366 iState=EIdle; |
376 Call RecoverDataPort() to return comm port to ETel server. |
372 Call RecoverDataPort() to return comm port to ETel server. |
377 |
373 |
378 @exception Leaves if RecoverDataPort() returns error. |
374 @exception Leaves if RecoverDataPort() returns error. |
379 */ |
375 */ |
380 { |
376 { |
381 __FLOG_STMT(_LIT8(logString,"NetDial:\tRecovering Port To Etel");) |
377 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_RETURNCOMMPORTL_1, "NetDial:\tRecovering Port To Etel"); |
382 __FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString()); |
|
383 User::LeaveIfError(ActiveCall().RecoverDataPort()); |
378 User::LeaveIfError(ActiveCall().RecoverDataPort()); |
384 iLoaned=EFalse; |
379 iLoaned=EFalse; |
385 #ifndef SYMBIAN_NETWORKING_CSDAGENT_BCA_SUPPORT |
380 #ifndef SYMBIAN_NETWORKING_CSDAGENT_BCA_SUPPORT |
386 iState=EIdle; |
381 iState=EIdle; |
387 #endif |
382 #endif |
391 /** |
386 /** |
392 If comm port is loaned, call ReturnCommPortL() and trap error. |
387 If comm port is loaned, call ReturnCommPortL() and trap error. |
393 If call is open, call Close() from active call object. |
388 If call is open, call Close() from active call object. |
394 */ |
389 */ |
395 { |
390 { |
396 __FLOG_STMT(_LIT8(logString,"NetDial:\tClosing Call");) |
391 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_CLOSECALL_1, "NetDial:\tClosing Call"); |
397 __FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString()); |
|
398 if (iLoaned) |
392 if (iLoaned) |
399 { |
393 { |
400 TRAPD(ret,ReturnCommPortL()); // can't do anything with the error, so just trap |
394 TRAPD(ret,ReturnCommPortL()); // can't do anything with the error, so just trap |
401 if (KErrNone != ret) |
395 if (KErrNone != ret) |
402 { |
396 { |
403 __FLOG_STMT(_LIT8(logString2,"ReturnCommPort:\tError Occured");) |
397 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_CLOSECALL_2, "ReturnCommPort:\tError Occured"); |
404 __FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString2()); |
|
405 } |
398 } |
406 } |
399 } |
407 |
400 |
408 if (iCallOpen) |
401 if (iCallOpen) |
409 { |
402 { |
567 RPhone::TLineInfo lineInfo; |
560 RPhone::TLineInfo lineInfo; |
568 GetLineInfoL(lineInfo,info.iName,RLine::KCapsData); |
561 GetLineInfoL(lineInfo,info.iName,RLine::KCapsData); |
569 callName.Append(lineInfo.iName); |
562 callName.Append(lineInfo.iName); |
570 |
563 |
571 callName.Append(KDoubleColon); |
564 callName.Append(KDoubleColon); |
572 __FLOG_STMT(_LIT8(logString,"NetDial:\tOpening Call");) |
565 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_OPENNEWCALLL_1, "NetDial:\tOpening Call"); |
573 __FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString()); |
|
574 |
566 |
575 iDb->CopyIspInitStringToModemL(); // will not leave if the field is blank |
567 iDb->CopyIspInitStringToModemL(); // will not leave if the field is blank |
576 // Only MultimodeV1 and greater supported! |
568 // Only MultimodeV1 and greater supported! |
577 if (info.iExtensions>=(TUint)KETelExtMultimodeV1) |
569 if (info.iExtensions>=(TUint)KETelExtMultimodeV1) |
578 { |
570 { |
593 { |
585 { |
594 TInt count; |
586 TInt count; |
595 User::LeaveIfError(iTelServer.EnumeratePhones(count)); |
587 User::LeaveIfError(iTelServer.EnumeratePhones(count)); |
596 if (count<=0) |
588 if (count<=0) |
597 { |
589 { |
598 __FLOG_STMT(_LIT(logString,"NetDial:\tGetPhoneInfoL(): no phones found - leaving with -1");) |
590 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_GETPHONEINFOL_1,"NetDial:\tGetPhoneInfoL(): no phones found - leaving with -1"); |
599 __FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString()); |
|
600 User::Leave(KErrNotFound); |
591 User::Leave(KErrNotFound); |
601 } |
592 } |
602 TInt i; |
593 TInt i; |
603 TBool found=EFalse; |
594 TBool found=EFalse; |
604 for (i=0; i<count; i++) |
595 for (i=0; i<count; i++) |
617 } |
608 } |
618 } |
609 } |
619 |
610 |
620 if (!found) |
611 if (!found) |
621 { |
612 { |
622 __FLOG_STMT(_LIT(logString,"NetDial:\tGetPhoneInfoL(): required phone not found - leaving with -1");) |
613 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_GETPHONEINFOL_2, "NetDial:\tGetPhoneInfoL(): required phone not found - leaving with -1"); |
623 __FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString()); |
|
624 User::Leave(KErrNotFound); |
614 User::Leave(KErrNotFound); |
625 } |
615 } |
626 } |
616 } |
627 |
617 |
628 void CTelServerProcessor::GetLineInfoL(RPhone::TLineInfo& aInfo,const TDesC& aPhoneName, TUint aLineType) |
618 void CTelServerProcessor::GetLineInfoL(RPhone::TLineInfo& aInfo,const TDesC& aPhoneName, TUint aLineType) |
633 |
623 |
634 TInt count = 0; |
624 TInt count = 0; |
635 User::LeaveIfError(phone.EnumerateLines(count)); |
625 User::LeaveIfError(phone.EnumerateLines(count)); |
636 if (count <= 0) |
626 if (count <= 0) |
637 { |
627 { |
638 __FLOG_STMT(_LIT(logString,"NetDial:\tGetLineInfoL(): no line info available - leaving with -1");) |
628 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_GETLINEINFOL_1,"NetDial:\tGetLineInfoL(): no line info available - leaving with -1"); |
639 __FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString()); |
|
640 User::Leave(KErrNotFound); |
629 User::Leave(KErrNotFound); |
641 } |
630 } |
642 |
631 |
643 TBool found = EFalse; |
632 TBool found = EFalse; |
644 for (TInt i=0; i<count && !found; ++i) |
633 for (TInt i=0; i<count && !found; ++i) |
664 } |
653 } |
665 |
654 |
666 CleanupStack::PopAndDestroy(&phone); |
655 CleanupStack::PopAndDestroy(&phone); |
667 if (!found) |
656 if (!found) |
668 { |
657 { |
669 __FLOG_STMT(_LIT(logString,"NetDial:\tGetLineInfoL(): required line not found - leaving with -1");) |
658 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_GETLINEINFOL_2, "NetDial:\tGetLineInfoL(): required line not found - leaving with -1"); |
670 __FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString()); |
|
671 User::Leave(KErrNotFound); |
659 User::Leave(KErrNotFound); |
672 } |
660 } |
673 } |
661 } |
674 |
662 |
675 void CTelServerProcessor::SetMmParametersL() |
663 void CTelServerProcessor::SetMmParametersL() |