44
|
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 |
{
|
|
64 |
SPUDFSMVERBOSE_FNLOG("CPdpFsmFactory::CPdpFsmFactory()");
|
|
65 |
}
|
|
66 |
|
|
67 |
|
|
68 |
CPdpFsmFactory::~CPdpFsmFactory()
|
|
69 |
{
|
|
70 |
SPUDFSMVERBOSE_FNLOG("CPdpFsmFactory::~CPdpFsmFactory()");
|
|
71 |
|
|
72 |
delete iEtelDriverInput;
|
|
73 |
|
|
74 |
iContexts.DeleteAll();
|
|
75 |
iContexts.Reset();
|
|
76 |
}
|
|
77 |
|
|
78 |
|
|
79 |
void CPdpFsmFactory::InitL(TName& aTsyName, CPdpFsmInterface * aPdpFsmInterface)
|
|
80 |
{
|
|
81 |
SPUDFSMVERBOSE_FNLOG("CPdpFsmFactory::InitL()");
|
|
82 |
|
|
83 |
iPdpFsmInterface = aPdpFsmInterface;
|
|
84 |
|
|
85 |
iTsyName = aTsyName;
|
|
86 |
|
|
87 |
// lets kick off the ETelDriver first then we only alloc FSMs if it works
|
|
88 |
//
|
|
89 |
iEtelDriverInput = new (ELeave) REtelDriverInput;
|
|
90 |
|
|
91 |
iEtelDriverInput->OpenL (*iPdpFsmInterface);
|
|
92 |
|
|
93 |
// Only create PDP contexts if specifically requested.
|
|
94 |
}
|
|
95 |
|
|
96 |
|
|
97 |
void CPdpFsmFactory::Close (void)
|
|
98 |
{
|
|
99 |
SPUDFSMVERBOSE_FNLOG("CPdpFsmFactory::Close()");
|
|
100 |
iEtelDriverInput->Close();
|
|
101 |
}
|
|
102 |
|
|
103 |
|
|
104 |
/**
|
|
105 |
@return may return NULL if there is no PDP context with that Id
|
|
106 |
*/
|
|
107 |
CPdpFsm* CPdpFsmFactory::GetFsmContext (TContextId aPdpId)
|
|
108 |
{
|
|
109 |
SPUDFSMVERBOSE_FNLOG("CPdpFsmFactory::GetContext()");
|
|
110 |
|
|
111 |
return iContexts[aPdpId];
|
|
112 |
}
|
|
113 |
|
|
114 |
|
|
115 |
const TName& CPdpFsmFactory::TsyName(void)
|
|
116 |
{
|
|
117 |
return iTsyName;
|
|
118 |
}
|
|
119 |
|
|
120 |
|
|
121 |
TInt CPdpFsmFactory::NewFsmContext(TContextId aPdpId)
|
|
122 |
{
|
|
123 |
SPUDFSMVERBOSE_FNLOG("CPdpFsmFactory::NewFsmContext()");
|
|
124 |
ASSERT(ContextIdIsValid(aPdpId));
|
|
125 |
|
|
126 |
TInt ret = KErrNone;
|
|
127 |
|
|
128 |
if (!HaveFsmContext(aPdpId))
|
|
129 |
{
|
|
130 |
// Only ever called by non-leaving functions. We're going to have to trap at some point in the calling hierarchy...
|
|
131 |
//
|
|
132 |
TRAP(ret,
|
|
133 |
CPdpFsm* p = CPdpFsm::NewL(aPdpId, this, iEtelDriverInput);
|
|
134 |
iContexts[aPdpId] = p;
|
|
135 |
);
|
|
136 |
}
|
|
137 |
|
|
138 |
return ret;
|
|
139 |
}
|
|
140 |
|
|
141 |
|
|
142 |
TInt CPdpFsmFactory::DeleteFsmContext(TContextId aPdpId)
|
|
143 |
{
|
|
144 |
SPUDFSMVERBOSE_FNLOG("CPdpFsmFactory::DeleteFsmContext()");
|
|
145 |
ASSERT(ContextIsValid(aPdpId));
|
|
146 |
|
|
147 |
delete iContexts[aPdpId];
|
|
148 |
iContexts[aPdpId] = NULL;
|
|
149 |
|
|
150 |
return KErrNone;
|
|
151 |
}
|
|
152 |
|