|
1 // Copyright (c) 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 // CInitialisePdpContext: |
|
14 // |
|
15 |
|
16 #include "initialisepdpcontext.h" |
|
17 #include "mslogger.h" |
|
18 #include "tsyconfg.h" |
|
19 #include "globalphonemanager.h" |
|
20 |
|
21 const TInt KLtsyOnePause = 100000; |
|
22 |
|
23 // --------------------------------------------------------------------------- |
|
24 // CInitialisePdpContext::NewL() |
|
25 // other items were commented in a header |
|
26 // --------------------------------------------------------------------------- |
|
27 CInitialisePdpContext* CInitialisePdpContext::NewL(CGlobalPhonemanager& aGloblePhone, |
|
28 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
29 { |
|
30 CInitialisePdpContext* self = new(ELeave) CInitialisePdpContext(aGloblePhone,aCtsyDispatcherCallback); |
|
31 CleanupStack::PushL(self ); |
|
32 self->ConstructL(); |
|
33 CleanupStack::Pop(); |
|
34 return self ; |
|
35 } |
|
36 |
|
37 // --------------------------------------------------------------------------- |
|
38 // CInitialisePdpContext::CInitialisePdpContext() |
|
39 // other items were commented in a header |
|
40 // --------------------------------------------------------------------------- |
|
41 CInitialisePdpContext::CInitialisePdpContext(CGlobalPhonemanager& aGloblePhone, |
|
42 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
43 :iPhoneGlobals(aGloblePhone), |
|
44 iCtsyDispatcherCallback(aCtsyDispatcherCallback) |
|
45 { |
|
46 } |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // CInitialisePdpContext::ConstructL() |
|
50 // other items were commented in a header |
|
51 // --------------------------------------------------------------------------- |
|
52 void CInitialisePdpContext::ConstructL() |
|
53 { |
|
54 iCallbackTimer = CCallbackTimer::NewL(*this); |
|
55 } |
|
56 |
|
57 // --------------------------------------------------------------------------- |
|
58 // CInitialisePdpContext::~CInitialisePdpContext() |
|
59 // other items were commented in a header |
|
60 // --------------------------------------------------------------------------- |
|
61 CInitialisePdpContext::~CInitialisePdpContext() |
|
62 { |
|
63 if(iCallbackTimer) |
|
64 { |
|
65 iCallbackTimer->Cancel(); |
|
66 delete iCallbackTimer; |
|
67 iCallbackTimer = NULL; |
|
68 } |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // CInitialisePdpContext::StartRequest() |
|
73 // other items were commented in a header |
|
74 // --------------------------------------------------------------------------- |
|
75 void CInitialisePdpContext::StartRequest() |
|
76 { |
|
77 iCallbackTimer->After(KLtsyOnePause); |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // CInitialisePdpContext::SetContext() |
|
82 // other items were commented in a header |
|
83 // --------------------------------------------------------------------------- |
|
84 void CInitialisePdpContext::SetContext(const TInt aContextId) |
|
85 { |
|
86 iContextId = aContextId; |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // CInitialisePdpContext::LoanCommPort() |
|
91 // other items were commented in a header |
|
92 // --------------------------------------------------------------------------- |
|
93 void CInitialisePdpContext::LoanCommPort() |
|
94 { |
|
95 TInt count = iPhoneGlobals.iContextList.Count(); |
|
96 TInt i = 0; |
|
97 |
|
98 //Get the context from context list |
|
99 for(i = 0; i < count;i++) |
|
100 { |
|
101 if(iPhoneGlobals.iContextList[i]->iContextID == iContextId) |
|
102 { |
|
103 break; |
|
104 } |
|
105 } |
|
106 |
|
107 TFileName csy; |
|
108 TName port; |
|
109 if(iPhoneGlobals.iPhoneStatus.iDataPortLoaned) |
|
110 { |
|
111 iCtsyDispatcherCallback.CallbackPacketServicesInitialisePdpContextComp(KErrEtelPortAlreadyLoaned, |
|
112 iPhoneGlobals.iContextList[i]->iInfo.iName, |
|
113 port); |
|
114 return ; |
|
115 } |
|
116 TInt ret = 0; |
|
117 TRAP(ret,iPhoneGlobals.iConfiguration->ConfigModemStringL(TPtrC(KCDTypeNameCsyName),csy)); |
|
118 if (ret!=KErrNone) |
|
119 { |
|
120 iCtsyDispatcherCallback.CallbackPacketServicesInitialisePdpContextComp(ret, |
|
121 iPhoneGlobals.iContextList[i]->iInfo.iName, |
|
122 port); |
|
123 return ; |
|
124 } |
|
125 TBuf8<KMaxName> tmp; |
|
126 tmp.Copy(csy); |
|
127 LOGTEXTREL2(_L8("csy:\t%S"),&tmp); |
|
128 |
|
129 TRAP(ret,iPhoneGlobals.iConfiguration->ConfigModemStringL(TPtrC(KCDTypeNamePortName),port)); |
|
130 if (ret!=KErrNone) |
|
131 { |
|
132 iCtsyDispatcherCallback.CallbackPacketServicesInitialisePdpContextComp(ret, |
|
133 iPhoneGlobals.iContextList[i]->iInfo.iName, |
|
134 port); |
|
135 return; |
|
136 } |
|
137 tmp.Copy(port); |
|
138 LOGTEXTREL2(_L8("port:\t%S"),&tmp); |
|
139 |
|
140 iCtsyDispatcherCallback.CallbackPacketServicesInitialisePdpContextComp(KErrNone, |
|
141 iPhoneGlobals.iContextList[i]->iInfo.iName, |
|
142 port); |
|
143 |
|
144 TContextMisc contextMisc; |
|
145 contextMisc.iStatus = RPacketContext::EStatusInactive; |
|
146 iPhoneGlobals.iContextList[i]->iInfo.iStatus = RPacketContext::EStatusInactive; |
|
147 iCtsyDispatcherCallback.CallbackPacketServicesNotifyPdpContextStatusChangeInd(ret, |
|
148 iPhoneGlobals.iContextList[i]->iInfo.iName, |
|
149 contextMisc); |
|
150 iCtsyDispatcherCallback.CallbackPacketServicesNotifyPdpContextAddedInd(ret, |
|
151 iPhoneGlobals.iContextList[i]->iInfo.iName); |
|
152 } |
|
153 |
|
154 void CInitialisePdpContext::TimerRun(TInt aError) |
|
155 { |
|
156 if(aError == KErrNone) |
|
157 { |
|
158 LoanCommPort(); |
|
159 } |
|
160 } |
|
161 |
|
162 // End of file |