|
1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Access handler of the network session |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include "CPEngSessionManager.h" |
|
20 |
|
21 #include "CPEngSessionSlotId.h" |
|
22 #include "MPEngTransAdapFactory.h" |
|
23 #include "CPEngAccessHandler.h" |
|
24 #include "CPEngPureDataHandler.h" |
|
25 |
|
26 |
|
27 // ============================ MEMBER FUNCTIONS =============================== |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CPEngSessionManager::CPEngSessionManager |
|
31 // C++ default constructor can NOT contain any code, that might leave. |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 CPEngSessionManager::CPEngSessionManager( |
|
35 MPEngTransAdapFactory& aFactory ) |
|
36 : iFactory( aFactory ) |
|
37 { |
|
38 iFactory.OpenSessionCount(); |
|
39 } |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // CPEngSessionManager::ConstructL |
|
43 // Symbian 2nd phase constructor can leave. |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 void CPEngSessionManager::ConstructL( |
|
47 const CPEngSessionSlotId& aSesssId ) |
|
48 { |
|
49 iSessionId = aSesssId.CloneL(); |
|
50 User::LeaveIfError( iImpsClient.Connect() ); |
|
51 } |
|
52 |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CPEngSessionManager::NewLC() |
|
56 // Two-phased constructor. |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 CPEngSessionManager* CPEngSessionManager::NewLC( |
|
60 MPEngTransAdapFactory& aFactory, |
|
61 const CPEngSessionSlotId& aSesssId ) |
|
62 { |
|
63 CPEngSessionManager* self = new ( ELeave ) CPEngSessionManager( aFactory ); |
|
64 CleanupClosePushL( *self ); |
|
65 self->ConstructL( aSesssId ); |
|
66 return self; |
|
67 } |
|
68 |
|
69 |
|
70 // Destructor |
|
71 CPEngSessionManager::~CPEngSessionManager() |
|
72 { |
|
73 iFactory.CloseSession( this ); |
|
74 delete iSessionId; |
|
75 iImpsClient.Close(); |
|
76 delete iAccessHandler; |
|
77 delete iPureDataHandler; |
|
78 } |
|
79 |
|
80 |
|
81 // ============================================================================= |
|
82 // =============== New Functions of the MPEngSessionManager ==================== |
|
83 // ============================================================================= |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CPEngSessionManager::CloseAccessHandler |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 void CPEngSessionManager::CloseAccessHandler( ) |
|
90 { |
|
91 iAccessHandler = NULL; |
|
92 Close(); |
|
93 } |
|
94 |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // CPEngSessionManager::ClosePureDataHandler |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 void CPEngSessionManager::ClosePureDataHandler() |
|
101 { |
|
102 iPureDataHandler = NULL; |
|
103 Close(); |
|
104 } |
|
105 |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 // CPEngSessionManager::OpenRef() |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 void CPEngSessionManager::OpenRef() |
|
112 { |
|
113 Open(); |
|
114 } |
|
115 |
|
116 |
|
117 // ============================================================================= |
|
118 // =============== New Functions of the main class ============================= |
|
119 // ============================================================================= |
|
120 |
|
121 |
|
122 // ----------------------------------------------------------------------------- |
|
123 // CPEngSessionManager::AccessHandler |
|
124 // ----------------------------------------------------------------------------- |
|
125 // |
|
126 MPEngAccessHandler* CPEngSessionManager::AccessHandlerL() |
|
127 { |
|
128 if ( iAccessHandler ) |
|
129 { |
|
130 iAccessHandler->Open(); // CSI: 15,65 # |
|
131 } |
|
132 else |
|
133 { |
|
134 iAccessHandler = CPEngAccessHandler::NewL( iImpsClient, |
|
135 *this, |
|
136 *iSessionId ); |
|
137 } |
|
138 return iAccessHandler; |
|
139 } |
|
140 |
|
141 |
|
142 // ----------------------------------------------------------------------------- |
|
143 // CPEngSessionManager::PureDataHandler |
|
144 // ----------------------------------------------------------------------------- |
|
145 // |
|
146 MPEngPureDataHandler* CPEngSessionManager::PureDataHandlerL() |
|
147 { |
|
148 if ( iPureDataHandler ) |
|
149 { |
|
150 iPureDataHandler->Open(); // CSI: 15,65 # |
|
151 } |
|
152 else |
|
153 { |
|
154 AccessHandlerL(); |
|
155 CleanupClosePushL( *iAccessHandler ); |
|
156 iPureDataHandler = CPEngPureDataHandler::NewL( iImpsClient, |
|
157 *this, |
|
158 *iAccessHandler, |
|
159 *iSessionId ); |
|
160 CleanupStack::PopAndDestroy(); // iAccessHandler |
|
161 } |
|
162 return iPureDataHandler; |
|
163 } |
|
164 |
|
165 |
|
166 // ----------------------------------------------------------------------------- |
|
167 // CPEngSessionManager::SessionId |
|
168 // ----------------------------------------------------------------------------- |
|
169 // |
|
170 const CPEngSessionSlotId& CPEngSessionManager::SessionId() const |
|
171 { |
|
172 return *iSessionId; |
|
173 } |
|
174 |
|
175 // End of File |
|
176 |
|
177 |