1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2004-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". |
18 /** |
18 /** |
19 @file |
19 @file |
20 @internalComponent |
20 @internalComponent |
21 */ |
21 */ |
22 |
22 |
|
23 |
|
24 |
|
25 #include "OstTraceDefinitions.h" |
|
26 #ifdef OST_TRACE_COMPILER_IN_USE |
|
27 #include "ceteldriverfactoryTraces.h" |
|
28 #endif |
|
29 |
23 #include <e32base.h> |
30 #include <e32base.h> |
24 #include <etelmm.h> |
31 #include <etelmm.h> |
25 |
32 |
26 #include "cspudcontextelem.h" |
33 #include "cspudcontextelem.h" |
27 #include "ceteldriverfactory.h" |
34 #include "ceteldriverfactory.h" |
28 #include "spudteldebuglogger.h" |
|
29 #include "PDPFSM.h" |
35 #include "PDPFSM.h" |
30 using namespace EtelDriver; |
36 using namespace EtelDriver; |
31 |
37 |
32 /** |
38 /** |
33 @param aPdpFsmInterface - pdp fsm interface |
39 @param aPdpFsmInterface - pdp fsm interface |
34 */ |
40 */ |
35 CEtelDriverFactory::CEtelDriverFactory (CPdpFsmInterface& aPdpFsmInterface) |
41 CEtelDriverFactory::CEtelDriverFactory (CPdpFsmInterface& aPdpFsmInterface) |
36 : iPdpFsmInterface(aPdpFsmInterface), |
42 : iPdpFsmInterface(aPdpFsmInterface), |
37 iServiceChangeNotifier(iPacketService, iPdpFsmInterface) |
43 iServiceChangeNotifier(iPacketService, iPdpFsmInterface) |
38 { |
44 { |
39 SPUDTELVERBOSE_INFO_LOG(_L("CEtelDriverFactory::CEtelDriverFactory()")); |
45 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG,TRACE_INTERNALS, CETELDRIVERFACTORY_CTOR_1, "CEtelDriverFactory::CEtelDriverFactory()"); |
40 } |
46 } |
41 |
47 |
42 /** |
48 /** |
43 @param aPdpFsmInterface - pdp fsm interface |
49 @param aPdpFsmInterface - pdp fsm interface |
44 */ |
50 */ |
45 CEtelDriverFactory* CEtelDriverFactory::NewL (CPdpFsmInterface& aPdpFsmInterface) |
51 CEtelDriverFactory* CEtelDriverFactory::NewL (CPdpFsmInterface& aPdpFsmInterface) |
46 { |
52 { |
47 SPUDTEL_INFO_LOG(_L("CEtelDriverFactory::NewL()")); |
53 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CETELDRIVERFACTORY_NEWL_1, "CEtelDriverFactory::NewL()"); |
48 |
54 |
49 return new (ELeave) CEtelDriverFactory (aPdpFsmInterface); |
55 return new (ELeave) CEtelDriverFactory (aPdpFsmInterface); |
50 } |
56 } |
51 |
57 |
52 CEtelDriverFactory::~CEtelDriverFactory() |
58 CEtelDriverFactory::~CEtelDriverFactory() |
53 { |
59 { |
54 SPUDTEL_FNLOG("CEtelDriverFactory::~CEtelDriverFactory()"); |
60 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CETELDRIVERFACTORY_DTOR_1, "CEtelDriverFactory::~CEtelDriverFactory()"); |
55 SPUDTEL_INFO_LOG(_L("CEtelDriverFactory::~CEtelDriverFactory()")); |
61 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CETELDRIVERFACTORY_DTOR_2, "CEtelDriverFactory::~CEtelDriverFactory()"); |
56 |
62 |
57 // cancel all notificators |
63 // cancel all notificators |
58 iServiceChangeNotifier.Cancel(); |
64 iServiceChangeNotifier.Cancel(); |
59 |
65 |
60 // cleanup array of CEtelDriverContext objs |
66 // cleanup array of CEtelDriverContext objs |
89 */ |
95 */ |
90 static void GetPhoneInfoL(RTelServer& aTelServer, const TDesC& aLoadedTsyName, RTelServer::TPhoneInfo& aInfo) |
96 static void GetPhoneInfoL(RTelServer& aTelServer, const TDesC& aLoadedTsyName, RTelServer::TPhoneInfo& aInfo) |
91 { |
97 { |
92 // dev. note: leavescan reports an error in this method. |
98 // dev. note: leavescan reports an error in this method. |
93 // But there is no visible ground for it. |
99 // But there is no visible ground for it. |
94 SPUDTEL_FNLOG("GetPhoneInfoL()"); |
100 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, GETPHONEINFOL_1, "GetPhoneInfoL()"); |
95 TInt count; |
101 TInt count; |
96 User::LeaveIfError(aTelServer.EnumeratePhones(count)); |
102 User::LeaveIfError(aTelServer.EnumeratePhones(count)); |
97 if (count<=0) |
103 if (count<=0) |
98 { |
104 { |
99 User::Leave(KErrNotFound); |
105 User::Leave(KErrNotFound); |
126 } |
132 } |
127 |
133 |
128 /** initializes factory objects */ |
134 /** initializes factory objects */ |
129 void CEtelDriverFactory::InitL() |
135 void CEtelDriverFactory::InitL() |
130 { |
136 { |
131 SPUDTEL_FNLOG("CEtelDriverFactory::InitL()"); |
137 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CETELDRIVERFACTORY_INITL_1, "CEtelDriverFactory::InitL()"); |
132 SPUDTEL_INFO_LOG(_L("Initializing Etel driver")); |
138 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CETELDRIVERFACTORY_INITL_2, "Initializing Etel driver"); |
133 |
139 |
134 iStrategies[EOpenPhoneStrategy] = &iOpenStrategy; |
140 iStrategies[EOpenPhoneStrategy] = &iOpenStrategy; |
135 iStrategies[ESetQoSStrategy] = &iSetQoSStrategy; |
141 iStrategies[ESetQoSStrategy] = &iSetQoSStrategy; |
136 iStrategies[ESetTftStrategy] = &iSetTftStrategy; |
142 iStrategies[ESetTftStrategy] = &iSetTftStrategy; |
137 iStrategies[EChangeTftStrategy] = &iChangeTftStrategy; |
143 iStrategies[EChangeTftStrategy] = &iChangeTftStrategy; |
180 |
186 |
181 @param aPdpId - id of a pdp context |
187 @param aPdpId - id of a pdp context |
182 */ |
188 */ |
183 void CEtelDriverFactory::CreatePdpL (TContextId aPdpId,SpudMan::TPdpContextType aContextType) |
189 void CEtelDriverFactory::CreatePdpL (TContextId aPdpId,SpudMan::TPdpContextType aContextType) |
184 { |
190 { |
185 SPUDTEL_FNLOG("CEtelDriverFactory::CreatePdpL()"); |
191 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CETELDRIVERFACTORY_CREATEPDPL_1, "CEtelDriverFactory::CreatePdpL()"); |
186 SPUDTELVERBOSE_INFO_LOG1(_L("pdp id : %d"), aPdpId); |
192 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CETELDRIVERFACTORY_CREATEPDPL_2, "pdp id : %d", aPdpId); |
187 __ASSERT_ALWAYS((NULL == iContexts[aPdpId]), User::Panic(KTxtSpudTel, KErrArgument)); |
193 __ASSERT_ALWAYS((NULL == iContexts[aPdpId]), User::Panic(KTxtSpudTel, KErrArgument)); |
188 |
194 |
189 if (aContextType == SpudMan::EMbms) |
195 if (aContextType == SpudMan::EMbms) |
190 { |
196 { |
191 iContexts[aPdpId]=CMbmsContextElem::NewL(aPdpId, *this, iPdpFsmInterface); |
197 iContexts[aPdpId]=CMbmsContextElem::NewL(aPdpId, *this, iPdpFsmInterface); |
202 @param aPdpId - id of a pdp context |
208 @param aPdpId - id of a pdp context |
203 */ |
209 */ |
204 void CEtelDriverFactory::FreePdp(TContextId aPdpId) |
210 void CEtelDriverFactory::FreePdp(TContextId aPdpId) |
205 { |
211 { |
206 |
212 |
207 SPUDTELVERBOSE_INFO_LOG1(_L("Free pdp id : %d"), aPdpId); |
213 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CETELDRIVERFACTORY_FREEPDP_1, "Free pdp id : %d", aPdpId); |
208 // In an OOM situation, this object may be cleaned up prior to establishment. |
214 // In an OOM situation, this object may be cleaned up prior to establishment. |
209 if (iContexts[aPdpId] != NULL) |
215 if (iContexts[aPdpId] != NULL) |
210 { |
216 { |
211 // the context has to be closed before a call to FreePdp |
217 // the context has to be closed before a call to FreePdp |
212 __ASSERT_ALWAYS(!Context(aPdpId).PacketContext().SubSessionHandle(), User::Panic(KTxtSpudTel, KErrInUse)); |
218 __ASSERT_ALWAYS(!Context(aPdpId).PacketContext().SubSessionHandle(), User::Panic(KTxtSpudTel, KErrInUse)); |
220 |
226 |
221 @param aPdpId - id of a pdp context |
227 @param aPdpId - id of a pdp context |
222 */ |
228 */ |
223 void CEtelDriverFactory::StartPdpNotifications (TContextId aPdpId) |
229 void CEtelDriverFactory::StartPdpNotifications (TContextId aPdpId) |
224 { |
230 { |
225 SPUDTELVERBOSE_INFO_LOG1(_L("StartPdpNotifications for pdp id : %d"), aPdpId); |
231 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CETELDRIVERFACTORY_STARTPDPNOTIFICATIONS_1, "StartPdpNotifications for pdp id : %d", aPdpId); |
226 // sanity check |
232 // sanity check |
227 ASSERT(iContexts[aPdpId]); |
233 ASSERT(iContexts[aPdpId]); |
228 |
234 |
229 iContexts[aPdpId]->Start(); |
235 iContexts[aPdpId]->Start(); |
230 } |
236 } |
233 |
239 |
234 @param aPdpId - id of a pdp context |
240 @param aPdpId - id of a pdp context |
235 */ |
241 */ |
236 void CEtelDriverFactory::CancelPdpNotifications (TContextId aPdpId) |
242 void CEtelDriverFactory::CancelPdpNotifications (TContextId aPdpId) |
237 { |
243 { |
238 SPUDTELVERBOSE_INFO_LOG1(_L("CancelPdpNotifications for pdp id : %d"), aPdpId); |
244 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CETELDRIVERFACTORY_CANCELPDPNOTIFICATIONS_1, "CancelPdpNotifications for pdp id : %d", aPdpId); |
239 // sanity check |
245 // sanity check |
240 ASSERT(iContexts[aPdpId]); |
246 ASSERT(iContexts[aPdpId]); |
241 |
247 |
242 iContexts[aPdpId]->Cancel(); |
248 iContexts[aPdpId]->Cancel(); |
243 } |
249 } |
244 |
250 |
245 /** cancels notifications for all pdp contexts */ |
251 /** cancels notifications for all pdp contexts */ |
246 void CEtelDriverFactory::CancelAllPdpNotifications() |
252 void CEtelDriverFactory::CancelAllPdpNotifications() |
247 { |
253 { |
248 SPUDTEL_INFO_LOG(_L("CancelAllPdpNotifications")); |
254 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CETELDRIVERFACTORY_CANCELALLPDPNOTIFICATIONS_1, "CancelAllPdpNotifications"); |
249 for(TContextId i = 0; i < static_cast<TContextId>(ContextCount()); i++) |
255 for(TContextId i = 0; i < static_cast<TContextId>(ContextCount()); i++) |
250 { |
256 { |
251 CancelPdpNotifications (i); |
257 CancelPdpNotifications (i); |
252 } |
258 } |
253 } |
259 } |