1 /* |
|
2 * Copyright (c) 2007 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: CCCHSubserviceInfo implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "cchsubserviceinfo.h" |
|
21 #include "cchserverbase.h" |
|
22 #include "cchrequeststorage.h" |
|
23 #include "cchpluginhandler.h" |
|
24 #include "cchlogger.h" |
|
25 |
|
26 // EXTERNAL DATA STRUCTURES |
|
27 // None |
|
28 |
|
29 // EXTERNAL FUNCTION PROTOTYPES |
|
30 // None |
|
31 |
|
32 // CONSTANTS |
|
33 // None |
|
34 |
|
35 // MACROS |
|
36 // None |
|
37 |
|
38 // LOCAL CONSTANTS AND MACROS |
|
39 // None |
|
40 |
|
41 // MODULE DATA STRUCTURES |
|
42 // None |
|
43 |
|
44 // LOCAL FUNCTION PROTOTYPES |
|
45 // None |
|
46 |
|
47 // FORWARD DECLARATIONS |
|
48 // None |
|
49 |
|
50 // ============================= LOCAL FUNCTIONS ============================= |
|
51 |
|
52 // ============================ MEMBER FUNCTIONS ============================= |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // CCCHSubserviceInfo::CCCHSubserviceInfo |
|
56 // C++ default constructor can NOT contain any code, that might leave. |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 CCCHSubserviceInfo::CCCHSubserviceInfo( |
|
60 TUint aServiceId, |
|
61 CCCHServerBase& aServer ): |
|
62 iServiceId( aServiceId ), |
|
63 iServer( aServer ), |
|
64 iEnableAtStartUp( EFalse ) |
|
65 { |
|
66 // No implementation required |
|
67 } |
|
68 |
|
69 // --------------------------------------------------------------------------- |
|
70 // CCCHSubserviceInfo::NewL |
|
71 // Two-phased constructor. |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 CCCHSubserviceInfo* CCCHSubserviceInfo::NewL( |
|
75 TUint aServiceId, |
|
76 CCCHServerBase& aServer ) |
|
77 { |
|
78 CCCHSubserviceInfo* self = CCCHSubserviceInfo::NewLC( aServiceId, aServer ); |
|
79 CleanupStack::Pop( self ); |
|
80 return self; |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // CCCHSubserviceInfo::NewLC |
|
85 // Two-phased constructor. |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 CCCHSubserviceInfo* CCCHSubserviceInfo::NewLC( |
|
89 TUint aServiceId, |
|
90 CCCHServerBase& aServer ) |
|
91 { |
|
92 CCCHSubserviceInfo* self = |
|
93 new (ELeave) CCCHSubserviceInfo( aServiceId, aServer ); |
|
94 CleanupStack::PushL( self ); |
|
95 return self; |
|
96 } |
|
97 |
|
98 // Destructor |
|
99 CCCHSubserviceInfo::~CCCHSubserviceInfo() |
|
100 { |
|
101 } |
|
102 |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // CCCHSubserviceInfo::SetSubserviceId |
|
106 // (other items were commented in a header). |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 void CCCHSubserviceInfo::SetSubserviceId( const TUint aSubserviceId ) |
|
110 { |
|
111 iSubserviceId = aSubserviceId; |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // CCCHSubserviceInfo::SetPluginUid |
|
116 // (other items were commented in a header). |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 void CCCHSubserviceInfo::SetPluginUid( const TUid aPluginUid ) |
|
120 { |
|
121 CCHLOGSTRING2( "CCCHSubserviceInfo::SetPluginUid aPluginUid = 0x%X", |
|
122 aPluginUid ); |
|
123 iPluginUid = aPluginUid; |
|
124 } |
|
125 |
|
126 // --------------------------------------------------------------------------- |
|
127 // CCCHSubserviceInfo::SetPluginUid |
|
128 // (other items were commented in a header). |
|
129 // --------------------------------------------------------------------------- |
|
130 // |
|
131 TUid CCCHSubserviceInfo::GetPluginUid() const |
|
132 { |
|
133 return iPluginUid; |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------------------------- |
|
137 // CCCHSubserviceInfo::SetType |
|
138 // (other items were commented in a header). |
|
139 // --------------------------------------------------------------------------- |
|
140 // |
|
141 void CCCHSubserviceInfo::SetType( const TCCHSubserviceType aType ) |
|
142 { |
|
143 iType = aType; |
|
144 } |
|
145 |
|
146 // --------------------------------------------------------------------------- |
|
147 // CCCHSubserviceInfo::GetType |
|
148 // (other items were commented in a header). |
|
149 // --------------------------------------------------------------------------- |
|
150 // |
|
151 TCCHSubserviceType CCCHSubserviceInfo::Type() |
|
152 { |
|
153 GetServiceNetworkInfo(); |
|
154 return iType; |
|
155 } |
|
156 |
|
157 // --------------------------------------------------------------------------- |
|
158 // CCCHSubserviceInfo::SetState |
|
159 // (other items were commented in a header). |
|
160 // --------------------------------------------------------------------------- |
|
161 // |
|
162 void CCCHSubserviceInfo::SetState( const TCCHSubserviceState aState ) |
|
163 { |
|
164 CCHLOGSTRING2( "CCCHSubserviceInfo::SetState: iPreviousState = %d", |
|
165 iState ); |
|
166 CCHLOGSTRING2( "CCCHSubserviceInfo::SetState: new state = %d", |
|
167 aState ); |
|
168 CCHLOGSTRING2( "CCCHSubserviceInfo::SetState: new state = %d", |
|
169 Type() ); |
|
170 iPreviousState = iState; |
|
171 iState = aState; |
|
172 } |
|
173 |
|
174 // --------------------------------------------------------------------------- |
|
175 // CCCHSubserviceInfo::SetError |
|
176 // (other items were commented in a header). |
|
177 // --------------------------------------------------------------------------- |
|
178 // |
|
179 void CCCHSubserviceInfo::SetError( const TInt aError ) |
|
180 { |
|
181 iError = aError; |
|
182 } |
|
183 |
|
184 // --------------------------------------------------------------------------- |
|
185 // CCCHSubserviceInfo::SetIapId |
|
186 // (other items were commented in a header). |
|
187 // --------------------------------------------------------------------------- |
|
188 // |
|
189 void CCCHSubserviceInfo::SetIapId( const TUint32 aIapId ) |
|
190 { |
|
191 iIapId = aIapId; |
|
192 } |
|
193 |
|
194 // --------------------------------------------------------------------------- |
|
195 // CCCHSubserviceInfo::SetSNAPId |
|
196 // (other items were commented in a header). |
|
197 // --------------------------------------------------------------------------- |
|
198 // |
|
199 void CCCHSubserviceInfo::SetSNAPId( const TUint32 aSNAPid ) |
|
200 { |
|
201 iSNAPId = aSNAPid; |
|
202 } |
|
203 |
|
204 // --------------------------------------------------------------------------- |
|
205 // CCCHSubserviceInfo::Update |
|
206 // (other items were commented in a header). |
|
207 // --------------------------------------------------------------------------- |
|
208 // |
|
209 void CCCHSubserviceInfo::Update() |
|
210 { |
|
211 CCHLOGSTRING( "CCCHSubserviceInfo::Update: IN" ); |
|
212 |
|
213 // Read state from plugin |
|
214 GetServiceNetworkInfo(); |
|
215 |
|
216 StatusChanged(); |
|
217 |
|
218 CCHLOGSTRING( "CCCHSubserviceInfo::Update: OUT" ); |
|
219 } |
|
220 |
|
221 // --------------------------------------------------------------------------- |
|
222 // CCCHSubserviceInfo::IsEnabled |
|
223 // (other items were commented in a header). |
|
224 // --------------------------------------------------------------------------- |
|
225 // |
|
226 TBool CCCHSubserviceInfo::IsEnabled() const |
|
227 { |
|
228 return ( iState != ECCHUninitialized && iState != ECCHDisabled ); |
|
229 } |
|
230 |
|
231 // --------------------------------------------------------------------------- |
|
232 // CCCHSubserviceInfo::StatusChangedL |
|
233 // (other items were commented in a header). |
|
234 // --------------------------------------------------------------------------- |
|
235 // |
|
236 void CCCHSubserviceInfo::StatusChanged() |
|
237 { |
|
238 CCHLOGSTRING( "CCCHSubserviceInfo::StatusChangedL: IN" ); |
|
239 CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iServiceId %d", |
|
240 iServiceId ); |
|
241 CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iType %d", |
|
242 iType ); |
|
243 CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iState %d", |
|
244 iState ); |
|
245 CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iPreviousState %d", |
|
246 iPreviousState ); |
|
247 CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iError %d", |
|
248 iError ); |
|
249 |
|
250 if( iPreviousState == ECCHUninitialized && iState == ECCHDisabled ) |
|
251 { |
|
252 CCHLOGSTRING( "CCCHSubserviceInfo::StatusChangedL: Status not notified" ); |
|
253 } |
|
254 else |
|
255 { |
|
256 if ( iPreviousState == ECCHDisconnecting && iState == ECCHDisabled ) |
|
257 { |
|
258 iPreviousState = ECCHUninitialized; |
|
259 } |
|
260 CCHLOGSTRING( "CCCHSubserviceInfo::StatusChangedL: Notify new status" ); |
|
261 TServiceStatus serviceStatus; |
|
262 serviceStatus.iConnectionInfo.iServiceSelection.iServiceId = iServiceId; |
|
263 serviceStatus.iConnectionInfo.iServiceSelection.iType = iType; |
|
264 serviceStatus.iConnectionInfo.iIapId = iIapId; |
|
265 serviceStatus.iConnectionInfo.iSNAPId = iSNAPId; |
|
266 serviceStatus.iConnectionInfo.iSNAPLocked = iSNAPLocked; |
|
267 serviceStatus.iState = iState; |
|
268 serviceStatus.iError = iError; |
|
269 |
|
270 // Send notify to clients |
|
271 iServer.RequestStorage().NotifyServiceStatesChange( serviceStatus ); |
|
272 } |
|
273 CCHLOGSTRING( "CCCHSubserviceInfo::StatusChangedL: OUT" ); |
|
274 } |
|
275 |
|
276 |
|
277 // --------------------------------------------------------------------------- |
|
278 // CCCHSubserviceInfo::GetServiceNetworkInfo |
|
279 // --------------------------------------------------------------------------- |
|
280 // |
|
281 void CCCHSubserviceInfo::GetServiceNetworkInfo( ) |
|
282 { |
|
283 iServer.PluginHandler().GetServiceNetworkInfo( iServiceId, iPluginUid, |
|
284 iType, iSNAPId, iIapId, iSNAPLocked, iPasswordSet ); |
|
285 } |
|
286 |
|
287 |
|
288 // --------------------------------------------------------------------------- |
|
289 // CCCHSubserviceInfo::FillSubserviceInfo |
|
290 // (other items were commented in a header). |
|
291 // --------------------------------------------------------------------------- |
|
292 // |
|
293 void CCCHSubserviceInfo::FillSubserviceInfo( TCCHSubservice& aSubservice ) |
|
294 { |
|
295 CCHLOGSTRING( "CCCHSubserviceInfo::FillSubserviceInfo: IN" ); |
|
296 GetServiceNetworkInfo(); |
|
297 |
|
298 aSubservice.iConnectionInfo.iServiceSelection.iServiceId = iServiceId; |
|
299 aSubservice.iConnectionInfo.iServiceSelection.iType = iType; |
|
300 aSubservice.iConnectionInfo.iIapId = iIapId; |
|
301 aSubservice.iConnectionInfo.iSNAPId = iSNAPId; |
|
302 aSubservice.iConnectionInfo.iSNAPLocked = iSNAPLocked; |
|
303 aSubservice.iSubserviceId = iSubserviceId; |
|
304 aSubservice.iState = iState; |
|
305 aSubservice.iError = iError; |
|
306 CCHLOGSTRING( "CCCHSubserviceInfo::FillSubserviceInfo: OUT" ); |
|
307 } |
|
308 |
|
309 // --------------------------------------------------------------------------- |
|
310 // CCCHSubserviceInfo::GetState |
|
311 // (other items were commented in a header). |
|
312 // --------------------------------------------------------------------------- |
|
313 // |
|
314 TCCHSubserviceState CCCHSubserviceInfo::GetState() |
|
315 { |
|
316 CCHLOGSTRING( "CCCHSubserviceInfo::GetState: IN" ); |
|
317 iServer.PluginHandler().GetServiceState( iServiceId, iPluginUid, |
|
318 iType, iState, iError ); |
|
319 return iState; |
|
320 } |
|
321 |
|
322 // --------------------------------------------------------------------------- |
|
323 // CCCHSubserviceInfo::GetError |
|
324 // (other items were commented in a header). |
|
325 // --------------------------------------------------------------------------- |
|
326 // |
|
327 TInt CCCHSubserviceInfo::GetError() |
|
328 { |
|
329 CCHLOGSTRING( "CCCHSubserviceInfo::GetError: IN" ); |
|
330 iServer.PluginHandler().GetServiceState( iServiceId, iPluginUid, |
|
331 iType, iState, iError ); |
|
332 return iError; |
|
333 } |
|
334 |
|
335 // --------------------------------------------------------------------------- |
|
336 // CCCHSubserviceInfo::SetStartupFlag |
|
337 // (other items were commented in a header). |
|
338 // --------------------------------------------------------------------------- |
|
339 // |
|
340 void CCCHSubserviceInfo::SetStartupFlag( TBool aLoadAtStartUp ) |
|
341 { |
|
342 iEnableAtStartUp = aLoadAtStartUp; |
|
343 } |
|
344 |
|
345 // --------------------------------------------------------------------------- |
|
346 // CCCHSubserviceInfo::GetStartUpFlag |
|
347 // (other items were commented in a header). |
|
348 // --------------------------------------------------------------------------- |
|
349 // |
|
350 TBool CCCHSubserviceInfo::GetStartUpFlag() const |
|
351 { |
|
352 return iEnableAtStartUp; |
|
353 } |
|
354 |
|
355 // ========================== OTHER EXPORTED FUNCTIONS ======================= |
|
356 |
|
357 // End of File |
|