24
|
1 |
// Copyright (c) 2004-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 |
// PDP FSM factory implementation
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
@internalComponent
|
|
21 |
*/
|
|
22 |
|
|
23 |
#include "cpdpfsmfactory.h"
|
|
24 |
#include "spudfsmdebuglogger.h"
|
|
25 |
|
|
26 |
// NewL
|
|
27 |
CPdpFsmFactory* CPdpFsmFactory::NewL ()
|
|
28 |
{
|
|
29 |
SPUDFSMVERBOSE_FNLOG("CPdpFsmFactory::NewL()");
|
|
30 |
|
|
31 |
return new (ELeave) CPdpFsmFactory ();
|
|
32 |
}
|
|
33 |
|
|
34 |
#if defined(__VC32__)
|
|
35 |
#if (_MSC_VER >= 1200)
|
|
36 |
#pragma warning(disable:4355)
|
|
37 |
#endif
|
|
38 |
#endif
|
|
39 |
//Cpdpfsmfactory.cpp(22...) : warning C4355: 'this' : used in base member initializer list
|
|
40 |
// these warnings are benign unless the designed usage of SpudFsm changes such that SpudFsm is used
|
|
41 |
// as a base class to something else, in which case this code will have to change IFF the this pointer
|
|
42 |
// passed is used in the states c'tor. Currently, the pointer is just stored.
|
|
43 |
// In V9, e32def.h turns this warning off.
|
|
44 |
|
|
45 |
CPdpFsmFactory::CPdpFsmFactory()
|
|
46 |
: iStateInitialised (this),
|
|
47 |
iStateOpeningPhone (this),
|
|
48 |
iStateCreatingPrimary (this),
|
|
49 |
iStateActivatingPrimary (this),
|
|
50 |
iStateCreatingSecondary (this),
|
|
51 |
iStateCreatedSecondary (this),
|
|
52 |
iStateSettingQoS (this),
|
|
53 |
iStateSettingTFT (this),
|
|
54 |
iStateActivatingSecondary (this),
|
|
55 |
iStateOpen (this),
|
|
56 |
iStateChangingQoS (this),
|
|
57 |
iStateChangingTFT (this),
|
|
58 |
iStateGettingNegQoS (this),
|
|
59 |
iStateModifyingActive (this),
|
|
60 |
iStateSuspended (this),
|
|
61 |
iStateClosing (this),
|
|
62 |
iStateStopping (this),
|
|
63 |
iStateCreatingMbms(this),
|
|
64 |
iStateActivatingMbms(this),
|
|
65 |
iStateCreatedMbms(this)
|
|
66 |
{
|
|
67 |
SPUDFSMVERBOSE_FNLOG("CPdpFsmFactory::CPdpFsmFactory()");
|
|
68 |
}
|
|
69 |
|
|
70 |
|
|
71 |
CPdpFsmFactory::~CPdpFsmFactory()
|
|
72 |
{
|
|
73 |
SPUDFSMVERBOSE_FNLOG("CPdpFsmFactory::~CPdpFsmFactory()");
|
|
74 |
|
|
75 |
iContexts.DeleteAll();
|
|
76 |
iContexts.Reset();
|
|
77 |
|
|
78 |
delete iEtelDriverInput;
|
|
79 |
}
|
|
80 |
|
|
81 |
|
|
82 |
void CPdpFsmFactory::InitL(const TName& aTsyName, CPdpFsmInterface * aPdpFsmInterface)
|
|
83 |
{
|
|
84 |
SPUDFSMVERBOSE_FNLOG("CPdpFsmFactory::InitL()");
|
|
85 |
|
|
86 |
iPdpFsmInterface = aPdpFsmInterface;
|
|
87 |
|
|
88 |
iTsyName = aTsyName;
|
|
89 |
|
|
90 |
// lets kick off the ETelDriver first then we only alloc FSMs if it works
|
|
91 |
//
|
|
92 |
iEtelDriverInput = new (ELeave) REtelDriverInput;
|
|
93 |
|
|
94 |
iEtelDriverInput->OpenL (*iPdpFsmInterface);
|
|
95 |
|
|
96 |
// Only create PDP contexts if specifically requested.
|
|
97 |
}
|
|
98 |
|
|
99 |
|
|
100 |
void CPdpFsmFactory::Close (void)
|
|
101 |
{
|
|
102 |
SPUDFSMVERBOSE_FNLOG("CPdpFsmFactory::Close()");
|
|
103 |
// in OOM conditions iEtelDriveInput may not have successfully
|
|
104 |
// been created, check here for safety.
|
|
105 |
if (iEtelDriverInput != NULL)
|
|
106 |
{
|
|
107 |
iEtelDriverInput->Close();
|
|
108 |
}
|
|
109 |
}
|
|
110 |
|
|
111 |
|
|
112 |
/**
|
|
113 |
@return may return NULL if there is no PDP context with that Id
|
|
114 |
*/
|
|
115 |
CPdpFsm* CPdpFsmFactory::GetFsmContext (TContextId aPdpId)
|
|
116 |
{
|
|
117 |
SPUDFSMVERBOSE_FNLOG("CPdpFsmFactory::GetContext()");
|
|
118 |
|
|
119 |
return iContexts[aPdpId];
|
|
120 |
}
|
|
121 |
|
|
122 |
|
|
123 |
const TName& CPdpFsmFactory::TsyName(void)
|
|
124 |
{
|
|
125 |
return iTsyName;
|
|
126 |
}
|
|
127 |
|
|
128 |
#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
129 |
TInt CPdpFsmFactory::NewFsmContext(TContextId aPdpId)
|
|
130 |
#else
|
|
131 |
TContextId CPdpFsmFactory::NewFsmContextL(MPdpFsmEventHandler& aPdpFsmEventHandler,SpudMan::TPdpContextType aContextType)
|
|
132 |
#endif
|
|
133 |
{
|
|
134 |
SPUDFSMVERBOSE_FNLOG("CPdpFsmFactory::NewFsmContext()");
|
|
135 |
|
|
136 |
#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
137 |
TInt ret = KErrNone;
|
|
138 |
ASSERT(ContextIdIsValid(aPdpId));
|
|
139 |
if (!HaveFsmContext(aPdpId))
|
|
140 |
{
|
|
141 |
// Only ever called by non-leaving functions. We're going to have to trap at some point in the calling hierarchy...
|
|
142 |
//
|
|
143 |
TRAP(ret,
|
|
144 |
CPdpFsm* p = CPdpFsm::NewL(aPdpId, this, iEtelDriverInput);
|
|
145 |
iContexts[aPdpId] = p;
|
|
146 |
);
|
|
147 |
}
|
|
148 |
return ret;
|
|
149 |
#else
|
|
150 |
TInt i=0;
|
|
151 |
while (i < KMaxPdpContexts && iContexts[i] != NULL)
|
|
152 |
{
|
|
153 |
i++;
|
|
154 |
}
|
|
155 |
if (i < KMaxPdpContexts)
|
|
156 |
{
|
|
157 |
CPdpFsm* p = CPdpFsm::NewL(i, this, iEtelDriverInput, aPdpFsmEventHandler, aContextType);
|
|
158 |
iContexts[i] = p;
|
|
159 |
iEtelDriverInput->CreatePdpL(i, aContextType);
|
|
160 |
}
|
|
161 |
return i;
|
|
162 |
#endif
|
|
163 |
}
|
|
164 |
|
|
165 |
TInt CPdpFsmFactory::DeleteFsmContext(TContextId aPdpId)
|
|
166 |
{
|
|
167 |
SPUDFSMVERBOSE_FNLOG("CPdpFsmFactory::DeleteFsmContext()");
|
|
168 |
ASSERT(ContextIsValid(aPdpId));
|
|
169 |
|
|
170 |
delete iContexts[aPdpId];
|
|
171 |
iContexts[aPdpId] = NULL;
|
|
172 |
|
|
173 |
return KErrNone;
|
|
174 |
}
|
|
175 |
|