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 header |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #ifndef CPDPFSMFACTORY_H |
|
24 #define CPDPFSMFACTORY_H |
|
25 |
|
26 #include <networking/umtsnifcontrolif.h> |
|
27 |
|
28 #include "PDPFSM.h" |
|
29 #include "reteldriverinput.h" |
|
30 #include "cpdpfsm.h" |
|
31 #include "tpdpstates.h" |
|
32 |
|
33 /** factory (and owner) of FSM objects */ |
|
34 class CPdpFsmFactory : public CBase |
|
35 { |
|
36 friend class CPdpFsm; |
|
37 friend class TPdpState; |
|
38 friend class TPdpStateInitialised; // Needs iEtelOpened |
|
39 friend class TPdpStateOpeningPhone; // Needs iEtelOpened |
|
40 public: |
|
41 static CPdpFsmFactory * NewL(); |
|
42 |
|
43 virtual ~CPdpFsmFactory(); |
|
44 void InitL(TName& aTsyName, CPdpFsmInterface * aPdpFsmInterface); |
|
45 |
|
46 TInt NewFsmContext(TContextId aPdpId); |
|
47 TInt DeleteFsmContext(TContextId aPdpId); |
|
48 |
|
49 CPdpFsm* GetFsmContext(TContextId aPdpId); |
|
50 |
|
51 inline TBool HaveFsmContext(TContextId aPdpId) const; |
|
52 inline TBool ContextIdIsValid(TContextId aPdpId) const; |
|
53 inline TBool ContextIsValid(TContextId aPdpId) const; |
|
54 |
|
55 void Close (void); |
|
56 |
|
57 void SpudInput (TContextId aPdpId, TInt aNotification, TInt aParam); |
|
58 |
|
59 void SetContextTerminationErrorAndStop(TContextId aPdpId, TInt aErrorCode); |
|
60 |
|
61 TInt GetLastErrorCause(TContextId aPdpId, TInt& aLastErrorCause); |
|
62 |
|
63 const TName& TsyName(void); |
|
64 |
|
65 protected: |
|
66 private: |
|
67 CPdpFsmFactory(); |
|
68 |
|
69 public: |
|
70 protected: |
|
71 private: |
|
72 TFixedArray<CPdpFsm*, KMaxPdpContexts> iContexts; |
|
73 |
|
74 // the states |
|
75 TPdpStateInitialised iStateInitialised; |
|
76 TPdpStateOpeningPhone iStateOpeningPhone; |
|
77 TPdpStateCreatingPrimary iStateCreatingPrimary; |
|
78 TPdpStateActivatingPrimary iStateActivatingPrimary; |
|
79 TPdpStateCreatingSecondary iStateCreatingSecondary; |
|
80 TPdpStateCreatedSecondary iStateCreatedSecondary; |
|
81 TPdpStateSettingQoS iStateSettingQoS; |
|
82 TPdpStateSettingTFT iStateSettingTFT; |
|
83 TPdpStateActivatingSecondary iStateActivatingSecondary; |
|
84 TPdpStateOpen iStateOpen; |
|
85 TPdpStateChangingQoS iStateChangingQoS; |
|
86 TPdpStateChangingTFT iStateChangingTFT; |
|
87 TPdpStateGettingNegQoS iStateGettingNegQoS; |
|
88 TPdpStateModifyingActive iStateModifyingActive; |
|
89 TPdpStateSuspended iStateSuspended; |
|
90 TPdpStateClosing iStateClosing; |
|
91 TPdpStateStopping iStateStopping; |
|
92 |
|
93 CPdpFsmInterface * iPdpFsmInterface; |
|
94 REtelDriverInput * iEtelDriverInput; |
|
95 |
|
96 TBool iEtelOpened; |
|
97 |
|
98 TName iTsyName; |
|
99 }; |
|
100 |
|
101 |
|
102 inline void CPdpFsmFactory::SpudInput (TContextId aPdpId, TInt aNotification, TInt aParam) |
|
103 { |
|
104 iPdpFsmInterface->SpudInput (aPdpId, aNotification, aParam); |
|
105 } |
|
106 |
|
107 |
|
108 inline TBool CPdpFsmFactory::HaveFsmContext(TContextId aPdpId) const |
|
109 { |
|
110 return (iContexts[aPdpId] != NULL); |
|
111 } |
|
112 |
|
113 |
|
114 inline TBool CPdpFsmFactory::ContextIdIsValid(TContextId aPdpId) const |
|
115 { |
|
116 return (aPdpId >= 0 && aPdpId < KMaxPdpContexts); |
|
117 } |
|
118 |
|
119 |
|
120 inline TBool CPdpFsmFactory::ContextIsValid(TContextId aPdpId) const |
|
121 { |
|
122 return (ContextIdIsValid(aPdpId) && HaveFsmContext(aPdpId)); |
|
123 } |
|
124 |
|
125 #endif // CPDPFSMFACTORY_H |
|