1 /* |
|
2 * Copyright (c) 2008 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: implementation for CIcpPlugin |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "cicpplugin.h" |
|
20 |
|
21 #include <ecom.h> |
|
22 #include <implementationproxy.h> |
|
23 #include <e32debug.h> |
|
24 #include <stdio.h> |
|
25 #include <stdlib.h> |
|
26 #include <fcntl.h> |
|
27 #include <apgtask.h> |
|
28 #include <w32std.h> |
|
29 |
|
30 #include "cicpservicemanager.h" |
|
31 #include "icplogger.h" |
|
32 #include "imconnectionprovideruids.hrh" |
|
33 #include "cicpservicerequest.h" |
|
34 |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // CIcpPlugin::ConstructL |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 void CIcpPlugin::ConstructL() |
|
41 { |
|
42 ICPLOGSTRING( "CIcpPlugin::ConstructL" ); |
|
43 |
|
44 iServiceManager = CIcpServiceManager::NewL( iServiceObserver ); |
|
45 } |
|
46 |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CIcpPlugin::CIcpPlugin() |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 CIcpPlugin::CIcpPlugin( MCchServiceObserver& serviceObserver ) : |
|
53 iServiceObserver( serviceObserver ) |
|
54 { |
|
55 } |
|
56 |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // CIcpPlugin::NewL |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 CIcpPlugin* CIcpPlugin::NewL( TAny* aParam ) |
|
63 { |
|
64 ICPLOGSTRING2( "CIcpPlugin::NewL aParam: 0x%x", aParam ); |
|
65 __ASSERT_DEBUG( aParam, User::Panic( KNullDesC, KErrGeneral ) ); |
|
66 |
|
67 MCchServiceObserver& serviceObserver = *((MCchServiceObserver*)(aParam)); |
|
68 |
|
69 CIcpPlugin* self = new ( ELeave ) CIcpPlugin( serviceObserver ); |
|
70 |
|
71 CleanupStack::PushL( self ); |
|
72 self->ConstructL(); |
|
73 CleanupStack::Pop( self ); |
|
74 return self; |
|
75 } |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CIcpPlugin::~CIcpPlugin |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 CIcpPlugin::~CIcpPlugin() |
|
82 { |
|
83 delete iServiceManager; |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CIcpPlugin::EnableServiceL |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 void CIcpPlugin::EnableServiceL( const TServiceSelection& aServiceSelection ) |
|
91 { |
|
92 ICPLOGSTRING3( "CIcpPlugin::EnableServiceL service id: %d type: %d", |
|
93 aServiceSelection.iServiceId, aServiceSelection.iType ); |
|
94 |
|
95 iServiceManager->EnableServiceL( aServiceSelection.iServiceId, |
|
96 aServiceSelection.iType ); |
|
97 } |
|
98 |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CIcpPlugin::EnableServiceL |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 void CIcpPlugin::EnableServiceL( const TServiceSelection& aServiceSelection, |
|
105 TUint aIapId ) |
|
106 { |
|
107 ICPLOGSTRING4( "CIcpPlugin::EnableServiceL service id: %d type: %d iap id: %d", |
|
108 aServiceSelection.iServiceId, aServiceSelection.iType, aIapId ); |
|
109 |
|
110 |
|
111 iServiceManager->EnableServiceL( aServiceSelection.iServiceId, |
|
112 aServiceSelection.iType, |
|
113 aIapId ); |
|
114 |
|
115 } |
|
116 |
|
117 // ----------------------------------------------------------------------------- |
|
118 // CIcpPlugin::DisableServiceL |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 void CIcpPlugin::DisableServiceL( const TServiceSelection& aServiceSelection ) |
|
122 { |
|
123 ICPLOGSTRING3( "CIcpPlugin::DisableServiceL service id: %d type: %d", |
|
124 aServiceSelection.iServiceId, aServiceSelection.iType ); |
|
125 |
|
126 iServiceManager->DisableServiceL( aServiceSelection.iServiceId, |
|
127 aServiceSelection.iType ); |
|
128 } |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // CIcpPlugin::IsAvailableL |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 TBool CIcpPlugin::IsAvailableL( const TServiceSelection& aServiceSelection, |
|
135 const RArray<TUint32>& aIapIdArray ) const |
|
136 { |
|
137 ICPLOGSTRING3( "CIcpPlugin::IsAvailableL service id: %d type: %d", |
|
138 aServiceSelection.iServiceId, aServiceSelection.iType ); |
|
139 |
|
140 return iServiceManager->IsAvailableL( aServiceSelection.iServiceId, |
|
141 aServiceSelection.iType, aIapIdArray ); |
|
142 } |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // CIcpPlugin::GetServiceState |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 TInt CIcpPlugin::GetServiceState( const TServiceSelection& aServiceSelection, |
|
149 TCCHSubserviceState& aState ) const |
|
150 { |
|
151 ICPLOGSTRING3( "CIcpPlugin::GetServiceState service id: %d type: %d", |
|
152 aServiceSelection.iServiceId, aServiceSelection.iType ); |
|
153 |
|
154 return iServiceManager->GetServiceState( aServiceSelection.iServiceId, |
|
155 aServiceSelection.iType, aState ); |
|
156 } |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // CIcpPlugin::GetServiceNetworkInfo |
|
160 // ----------------------------------------------------------------------------- |
|
161 // |
|
162 TInt CIcpPlugin::GetServiceNetworkInfo( TServiceConnectionInfo& aConnectionInfo ) const |
|
163 { |
|
164 TServiceSelection& selection = aConnectionInfo.iServiceSelection; |
|
165 |
|
166 ICPLOGSTRING3( "CIcpPlugin::GetServiceNetworkInfo service id: %d type: %d", |
|
167 selection.iServiceId, selection.iType ); |
|
168 TInt returnval = 0; |
|
169 //TRAP_IGNORE to remove the codescanner high warning |
|
170 TRAP_IGNORE(returnval = iServiceManager->GetServiceNetworkInfoL( selection.iServiceId, |
|
171 selection.iType, |
|
172 aConnectionInfo.iSNAPId, |
|
173 aConnectionInfo.iIapId, |
|
174 aConnectionInfo.iSNAPLocked, |
|
175 aConnectionInfo.iPasswordSet)); |
|
176 return returnval; |
|
177 } |
|
178 |
|
179 // ----------------------------------------------------------------------------- |
|
180 // CIcpPlugin::SetSnapId |
|
181 // ----------------------------------------------------------------------------- |
|
182 // |
|
183 TInt CIcpPlugin::SetSnapId( const TServiceSelection& aServiceSelection, |
|
184 TUint aSnapId ) |
|
185 { |
|
186 ICPLOGSTRING4( "CIcpPlugin::SetSnapId service id: %d type: %d Snap %d", |
|
187 aServiceSelection.iServiceId, aServiceSelection.iType, aSnapId ); |
|
188 |
|
189 return iServiceManager->SetSnapId( aServiceSelection.iServiceId, |
|
190 aServiceSelection.iType, |
|
191 aSnapId ); |
|
192 } |
|
193 |
|
194 // ----------------------------------------------------------------------------- |
|
195 // CIcpPlugin::SetIapId |
|
196 // ----------------------------------------------------------------------------- |
|
197 // |
|
198 TInt CIcpPlugin::SetIapId( const TServiceSelection& aServiceSelection, |
|
199 TUint aIapId ) |
|
200 { |
|
201 ICPLOGSTRING4( "CIcpPlugin::SetIapId service id: %d type: %d iap id %d", |
|
202 aServiceSelection.iServiceId, aServiceSelection.iType, aIapId ); |
|
203 |
|
204 return iServiceManager->SetIapId( aServiceSelection.iServiceId, |
|
205 aServiceSelection.iType, |
|
206 aIapId ); |
|
207 } |
|
208 |
|
209 // ----------------------------------------------------------------------------- |
|
210 // CIcpPlugin::GetServiceInfo |
|
211 // ----------------------------------------------------------------------------- |
|
212 // |
|
213 void CIcpPlugin::GetServiceInfoL( const TServiceSelection& aServiceSelection, |
|
214 RBuf& aBuffer ) const |
|
215 { |
|
216 ICPLOGSTRING3( "CIcpPlugin::GetServiceInfoL service id: %d type: %d", |
|
217 aServiceSelection.iServiceId, aServiceSelection.iType ); |
|
218 |
|
219 iServiceManager->GetServiceInfoL( aServiceSelection.iServiceId, |
|
220 aServiceSelection.iType, |
|
221 aBuffer ); |
|
222 } |
|
223 |
|
224 // ----------------------------------------------------------------------------- |
|
225 // CIcpPlugin::ReserveService |
|
226 // ----------------------------------------------------------------------------- |
|
227 // |
|
228 TInt CIcpPlugin::ReserveService( const TServiceSelection& aServiceSelection ) |
|
229 { |
|
230 return iServiceManager->SetServiceReserved( ETrue, |
|
231 aServiceSelection.iServiceId, |
|
232 aServiceSelection.iType ); |
|
233 } |
|
234 |
|
235 // ----------------------------------------------------------------------------- |
|
236 // CIcpPlugin::FreeService |
|
237 // ----------------------------------------------------------------------------- |
|
238 // |
|
239 TInt CIcpPlugin::FreeService( const TServiceSelection& aServiceSelection ) |
|
240 { |
|
241 return iServiceManager->SetServiceReserved( EFalse, |
|
242 aServiceSelection.iServiceId, |
|
243 aServiceSelection.iType ); |
|
244 } |
|
245 |
|
246 // ----------------------------------------------------------------------------- |
|
247 // CIcpPlugin::IsReserved |
|
248 // ----------------------------------------------------------------------------- |
|
249 // |
|
250 TBool CIcpPlugin::IsReserved( const TServiceSelection& aServiceSelection ) const |
|
251 { |
|
252 return iServiceManager->IsReserved( aServiceSelection.iServiceId, |
|
253 aServiceSelection.iType ); |
|
254 } |
|
255 |
|
256 // ----------------------------------------------------------------------------- |
|
257 // CIcpPlugin::ServiceStateChanged |
|
258 // ----------------------------------------------------------------------------- |
|
259 // |
|
260 void CIcpPlugin::ServiceStateChanged( |
|
261 const TUint aServiceId, |
|
262 const TCCHSubserviceType aSubService, |
|
263 TCCHSubserviceState aState, |
|
264 TInt aError ) |
|
265 { |
|
266 |
|
267 // State of the service changed. Notify observer. |
|
268 iServiceObserver.ServiceStateChanged( |
|
269 TServiceSelection( aServiceId, aSubService ), |
|
270 aState, |
|
271 aError ); |
|
272 |
|
273 } |
|
274 |
|
275 // ----------------------------------------------------------------------------- |
|
276 // CIcpPlugin::GetConnectionParameter |
|
277 // ----------------------------------------------------------------------------- |
|
278 // |
|
279 TInt CIcpPlugin::GetConnectionParameter( |
|
280 const TServiceSelection& aServiceSelection, |
|
281 TCchConnectionParameter aParameter, |
|
282 TInt& aValue ) const |
|
283 { |
|
284 return iServiceManager->GetConnectionParameter( |
|
285 aServiceSelection.iServiceId, |
|
286 aServiceSelection.iType, |
|
287 aParameter, |
|
288 aValue |
|
289 ) ; |
|
290 } |
|
291 |
|
292 // ----------------------------------------------------------------------------- |
|
293 // CIcpPlugin::GetConnectionParameter |
|
294 // ----------------------------------------------------------------------------- |
|
295 // |
|
296 TInt CIcpPlugin::GetConnectionParameter(const TServiceSelection& aServiceSelection, |
|
297 TCchConnectionParameter aParameter, |
|
298 RBuf& aValue ) const |
|
299 { |
|
300 TRAPD(error, iServiceManager->GetConnectionParameterL( |
|
301 aServiceSelection.iServiceId, |
|
302 aServiceSelection.iType, |
|
303 aParameter, |
|
304 aValue |
|
305 )) ; |
|
306 return error; |
|
307 } |
|
308 |
|
309 // ----------------------------------------------------------------------------- |
|
310 // CIcpPlugin::SetConnectionParameter |
|
311 // ----------------------------------------------------------------------------- |
|
312 // |
|
313 TInt CIcpPlugin::SetConnectionParameter( const TServiceSelection& aServiceSelection, |
|
314 TCchConnectionParameter aParameter, |
|
315 TInt aValue ) |
|
316 { |
|
317 return iServiceManager->SetConnectionParameter( |
|
318 aServiceSelection.iServiceId, |
|
319 aServiceSelection.iType, |
|
320 aParameter, |
|
321 aValue |
|
322 ) ; |
|
323 } |
|
324 |
|
325 // ----------------------------------------------------------------------------- |
|
326 // CIcpPlugin::SetConnectionParameter |
|
327 // ----------------------------------------------------------------------------- |
|
328 // |
|
329 TInt CIcpPlugin::SetConnectionParameter( const TServiceSelection& aServiceSelection, |
|
330 TCchConnectionParameter aParameter, |
|
331 const TDesC& aValue ) |
|
332 { |
|
333 TRAPD(error, iServiceManager->SetConnectionParameterL( |
|
334 aServiceSelection.iServiceId, |
|
335 aServiceSelection.iType, |
|
336 aParameter, |
|
337 aValue |
|
338 )) ; |
|
339 return error; |
|
340 } |
|
341 |
|
342 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
343 |
|
344 // |
|
345 // Rest of the file is for ECom initialization. |
|
346 // |
|
347 |
|
348 // Map the interface UIDs |
|
349 const TImplementationProxy ImplementationTable[] = |
|
350 { |
|
351 IMPLEMENTATION_PROXY_ENTRY( KIMConnectivityPluginImplUid, CIcpPlugin::NewL ) |
|
352 }; |
|
353 |
|
354 |
|
355 // ----------------------------------------------------------------------------- |
|
356 // ImplementationGroupProxy implements for ECom |
|
357 // Exported proxy for instantiation method resolution |
|
358 // Returns: ImplementationTable |
|
359 // ----------------------------------------------------------------------------- |
|
360 // |
|
361 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) |
|
362 { |
|
363 aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); |
|
364 return ImplementationTable; |
|
365 } |
|
366 |
|
367 // End of file |
|
368 |
|