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