|
1 /* |
|
2 * Copyright (c) 2009-2010 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 * Collects API calls from RCmDestination- and RCmDestinationExt-classes. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include "cmdestinationwrapper.h" |
|
21 #include "cmmanagerapi.h" |
|
22 |
|
23 #include "OstTraceDefinitions.h" |
|
24 #ifdef OST_TRACE_COMPILER_IN_USE |
|
25 #include "cmdestinationwrapperTraces.h" |
|
26 #endif |
|
27 |
|
28 |
|
29 CCmDestinationWrapper* CCmDestinationWrapper::NewL() |
|
30 { |
|
31 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_NEWL_ENTRY ); |
|
32 |
|
33 CCmDestinationWrapper* self = CCmDestinationWrapper::NewLC(); |
|
34 CleanupStack::Pop( self ); |
|
35 |
|
36 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_NEWL_EXIT ); |
|
37 return self; |
|
38 } |
|
39 |
|
40 CCmDestinationWrapper* CCmDestinationWrapper::NewLC() |
|
41 { |
|
42 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_NEWLC_ENTRY ); |
|
43 |
|
44 CCmDestinationWrapper* self = new (ELeave) CCmDestinationWrapper; |
|
45 CleanupStack::PushL( self ); |
|
46 |
|
47 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_NEWLC_EXIT ); |
|
48 return self; |
|
49 } |
|
50 |
|
51 CCmDestinationWrapper::~CCmDestinationWrapper() |
|
52 { |
|
53 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_CCMDESTINATIONWRAPPER_ENTRY ); |
|
54 |
|
55 iCmDestinationApi.Close(); |
|
56 |
|
57 if ( iCmManagerApi ) |
|
58 { |
|
59 iCmManagerApi->RemoveDestinationWrapper( this ); |
|
60 iCmManagerApi = NULL; |
|
61 } |
|
62 |
|
63 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_CCMDESTINATIONWRAPPER_EXIT ); |
|
64 } |
|
65 |
|
66 CCmDestinationWrapper::CCmDestinationWrapper() |
|
67 { |
|
68 OstTraceFunctionEntry0( DUP1_CCMDESTINATIONWRAPPER_CCMDESTINATIONWRAPPER_ENTRY ); |
|
69 |
|
70 iCmManagerApi = NULL; |
|
71 iReferenceCounter = 1; |
|
72 |
|
73 OstTraceFunctionExit0( DUP1_CCMDESTINATIONWRAPPER_CCMDESTINATIONWRAPPER_EXIT ); |
|
74 } |
|
75 |
|
76 void CCmDestinationWrapper::GetDestWithIdL( |
|
77 RCmManagerApi* aCmManagerApi, |
|
78 const TUint32 aId, |
|
79 TInt& aExistingHandle ) |
|
80 { |
|
81 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_GETDESTWITHIDL_ENTRY ); |
|
82 |
|
83 if ( iCmManagerApi || iCmDestinationApi.SessionConnected() ) |
|
84 { |
|
85 User::Leave( KErrAlreadyExists ); |
|
86 } |
|
87 |
|
88 iCmManagerApi = aCmManagerApi; |
|
89 iCmDestinationApi.ConnectAndGetDestWithIdL( *aCmManagerApi, aId, aExistingHandle ); |
|
90 if ( !aExistingHandle ) |
|
91 { |
|
92 iCmManagerApi->StoreDestinationWrapper( this ); |
|
93 } |
|
94 |
|
95 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_GETDESTWITHIDL_EXIT ); |
|
96 } |
|
97 |
|
98 void CCmDestinationWrapper::CreateDestByNameL( |
|
99 RCmManagerApi* aCmManagerApi, |
|
100 const TDesC& aName ) |
|
101 { |
|
102 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_CREATEDESTBYNAMEL_ENTRY ); |
|
103 |
|
104 if ( iCmManagerApi || iCmDestinationApi.SessionConnected() ) |
|
105 { |
|
106 User::Leave( KErrAlreadyExists ); |
|
107 } |
|
108 |
|
109 iCmManagerApi = aCmManagerApi; |
|
110 iCmDestinationApi.ConnectAndCreateDestWithNameL( *aCmManagerApi, aName ); |
|
111 iCmManagerApi->StoreDestinationWrapper( this ); |
|
112 |
|
113 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_CREATEDESTBYNAMEL_EXIT ); |
|
114 } |
|
115 |
|
116 void CCmDestinationWrapper::CreateDestByNameAndIdL( |
|
117 RCmManagerApi* aCmManagerApi, |
|
118 const TDesC& aName, |
|
119 const TUint32 aId ) |
|
120 { |
|
121 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_CREATEDESTBYNAMEANDIDL_ENTRY ); |
|
122 |
|
123 if ( iCmManagerApi || iCmDestinationApi.SessionConnected() ) |
|
124 { |
|
125 User::Leave( KErrAlreadyExists ); |
|
126 } |
|
127 |
|
128 iCmManagerApi = aCmManagerApi; |
|
129 iCmDestinationApi.ConnectAndCreateDestWithNameAndIdL( *aCmManagerApi, aName, aId ); |
|
130 iCmManagerApi->StoreDestinationWrapper( this ); |
|
131 |
|
132 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_CREATEDESTBYNAMEANDIDL_EXIT ); |
|
133 } |
|
134 |
|
135 void CCmDestinationWrapper::GetConnMethodAsEmbeddedDestL( |
|
136 RCmManagerApi* aCmManagerApi, |
|
137 const TInt aConnMethodHandle, |
|
138 TInt& aExistingHandle ) |
|
139 { |
|
140 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_GETCONNMETHODASEMBEDDEDDESTL_ENTRY ); |
|
141 |
|
142 if ( iCmManagerApi || iCmDestinationApi.SessionConnected() ) |
|
143 { |
|
144 User::Leave( KErrAlreadyExists ); |
|
145 } |
|
146 |
|
147 iCmManagerApi = aCmManagerApi; |
|
148 iCmDestinationApi.ConnectAndGetConnMethodAsEmbeddedDestL( *aCmManagerApi, aConnMethodHandle, aExistingHandle ); |
|
149 if ( !aExistingHandle ) |
|
150 { |
|
151 iCmManagerApi->StoreDestinationWrapper( this ); |
|
152 } |
|
153 |
|
154 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_GETCONNMETHODASEMBEDDEDDESTL_EXIT ); |
|
155 } |
|
156 |
|
157 TInt CCmDestinationWrapper::ConnectionMethodCount( TInt& aCount ) |
|
158 { |
|
159 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_CONNECTIONMETHODCOUNT_ENTRY ); |
|
160 |
|
161 TInt err = iCmDestinationApi.ConnectionMethodCount( aCount ); |
|
162 |
|
163 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_CONNECTIONMETHODCOUNT_EXIT ); |
|
164 return err; |
|
165 } |
|
166 |
|
167 TInt CCmDestinationWrapper::Priority( const TInt aHandle, TUint& aPriority ) |
|
168 { |
|
169 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_PRIORITY_ENTRY ); |
|
170 |
|
171 TInt err = iCmDestinationApi.Priority( aHandle, aPriority ); |
|
172 |
|
173 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_PRIORITY_EXIT ); |
|
174 return err; |
|
175 } |
|
176 |
|
177 TInt CCmDestinationWrapper::GetName( HBufC* aBuffer ) |
|
178 { |
|
179 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_GETNAME_ENTRY ); |
|
180 |
|
181 TInt err = iCmDestinationApi.GetName( aBuffer ); |
|
182 |
|
183 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_GETNAME_EXIT ); |
|
184 return err; |
|
185 } |
|
186 |
|
187 TInt CCmDestinationWrapper::GetId( TUint32& aId ) |
|
188 { |
|
189 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_GETID_ENTRY ); |
|
190 |
|
191 TInt err = iCmDestinationApi.GetId( aId ); |
|
192 |
|
193 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_GETID_EXIT ); |
|
194 return err; |
|
195 } |
|
196 |
|
197 TInt CCmDestinationWrapper::GetElementId( TUint32& aElementId ) |
|
198 { |
|
199 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_GETELEMENTID_ENTRY ); |
|
200 |
|
201 TInt err = iCmDestinationApi.GetElementId( aElementId ); |
|
202 |
|
203 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_GETELEMENTID_EXIT ); |
|
204 return err; |
|
205 } |
|
206 |
|
207 TInt CCmDestinationWrapper::GetMetadata( |
|
208 const TUint32 aMetadataField, |
|
209 TUint32& aValue ) |
|
210 { |
|
211 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_GETMETADATA_ENTRY ); |
|
212 |
|
213 TInt err = iCmDestinationApi.GetMetadata( aMetadataField, aValue ); |
|
214 |
|
215 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_GETMETADATA_EXIT ); |
|
216 return err; |
|
217 } |
|
218 |
|
219 TInt CCmDestinationWrapper::GetProtectionLevel( TInt& aProtectionLevel ) |
|
220 { |
|
221 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_GETPROTECTIONLEVEL_ENTRY ); |
|
222 |
|
223 TInt err = iCmDestinationApi.GetProtectionLevel( aProtectionLevel ); |
|
224 |
|
225 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_GETPROTECTIONLEVEL_EXIT ); |
|
226 return err; |
|
227 } |
|
228 |
|
229 TInt CCmDestinationWrapper::AddConnectionMethod( |
|
230 const TInt aConnMethodHandle, |
|
231 TInt& aIndex ) |
|
232 { |
|
233 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_ADDCONNECTIONMETHOD_ENTRY ); |
|
234 |
|
235 TInt err = iCmDestinationApi.AddConnectionMethod( aConnMethodHandle, aIndex ); |
|
236 |
|
237 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_ADDCONNECTIONMETHOD_EXIT ); |
|
238 return err; |
|
239 } |
|
240 |
|
241 TInt CCmDestinationWrapper::AddEmbeddedDestination( |
|
242 const TInt aDestHandle, |
|
243 TInt& aIndex ) |
|
244 { |
|
245 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_ADDEMBEDDEDDESTINATION_ENTRY ); |
|
246 |
|
247 TInt err = iCmDestinationApi.AddEmbeddedDestination( aDestHandle, aIndex ); |
|
248 |
|
249 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_ADDEMBEDDEDDESTINATION_EXIT ); |
|
250 return err; |
|
251 } |
|
252 |
|
253 TInt CCmDestinationWrapper::DeleteConnectionMethod( |
|
254 const TInt aConnMethodHandle ) |
|
255 { |
|
256 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_DELETECONNECTIONMETHOD_ENTRY ); |
|
257 |
|
258 TInt err = iCmDestinationApi.DeleteConnectionMethod( aConnMethodHandle ); |
|
259 |
|
260 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_DELETECONNECTIONMETHOD_EXIT ); |
|
261 return err; |
|
262 } |
|
263 |
|
264 TInt CCmDestinationWrapper::RemoveConnectionMethod( |
|
265 const TInt aConnMethodHandle ) |
|
266 { |
|
267 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_REMOVECONNECTIONMETHOD_ENTRY ); |
|
268 |
|
269 TInt err = iCmDestinationApi.RemoveConnectionMethod( aConnMethodHandle ); |
|
270 |
|
271 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_REMOVECONNECTIONMETHOD_EXIT ); |
|
272 return err; |
|
273 } |
|
274 |
|
275 TInt CCmDestinationWrapper::ModifyPriority( |
|
276 const TInt aConnMethodHandle, |
|
277 const TUint aIndex ) |
|
278 { |
|
279 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_MODIFYPRIORITY_ENTRY ); |
|
280 |
|
281 TInt err = iCmDestinationApi.ModifyPriority( aConnMethodHandle, aIndex ); |
|
282 |
|
283 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_MODIFYPRIORITY_EXIT ); |
|
284 return err; |
|
285 } |
|
286 |
|
287 TInt CCmDestinationWrapper::SetName( const TDesC& aValue ) |
|
288 { |
|
289 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_SETNAME_ENTRY ); |
|
290 |
|
291 TInt err = iCmDestinationApi.SetName( aValue ); |
|
292 |
|
293 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_SETNAME_EXIT ); |
|
294 return err; |
|
295 } |
|
296 |
|
297 TInt CCmDestinationWrapper::SetMetadata( |
|
298 const TUint32 aMetaField, |
|
299 const TUint32 aValue ) |
|
300 { |
|
301 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_SETMETADATA_ENTRY ); |
|
302 |
|
303 TInt err = iCmDestinationApi.SetMetadata( aMetaField, aValue ); |
|
304 |
|
305 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_SETMETADATA_EXIT ); |
|
306 return err; |
|
307 } |
|
308 |
|
309 TInt CCmDestinationWrapper::SetProtection( const TInt aValue ) |
|
310 { |
|
311 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_SETPROTECTION_ENTRY ); |
|
312 |
|
313 TInt err = iCmDestinationApi.SetProtection( aValue ); |
|
314 |
|
315 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_SETPROTECTION_EXIT ); |
|
316 return err; |
|
317 } |
|
318 |
|
319 TInt CCmDestinationWrapper::SetHidden( const TBool aHidden ) |
|
320 { |
|
321 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_SETHIDDEN_ENTRY ); |
|
322 |
|
323 TInt err = iCmDestinationApi.SetHidden( aHidden ); |
|
324 |
|
325 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_SETHIDDEN_EXIT ); |
|
326 return err; |
|
327 } |
|
328 |
|
329 TInt CCmDestinationWrapper::Update() |
|
330 { |
|
331 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_UPDATE_ENTRY ); |
|
332 |
|
333 TInt err = iCmDestinationApi.Update(); |
|
334 |
|
335 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_UPDATE_EXIT ); |
|
336 return err; |
|
337 } |
|
338 |
|
339 TInt CCmDestinationWrapper::Refresh() |
|
340 { |
|
341 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_REFRESH_ENTRY ); |
|
342 |
|
343 TInt err = iCmDestinationApi.Refresh(); |
|
344 |
|
345 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_REFRESH_EXIT ); |
|
346 return err; |
|
347 } |
|
348 |
|
349 TInt CCmDestinationWrapper::Delete() |
|
350 { |
|
351 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_DELETE_ENTRY ); |
|
352 |
|
353 TInt err = iCmDestinationApi.Delete(); |
|
354 |
|
355 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_DELETE_EXIT ); |
|
356 return err; |
|
357 } |
|
358 |
|
359 TInt CCmDestinationWrapper::IsConnected( TBool& aResult ) |
|
360 { |
|
361 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_ISCONNECTED_ENTRY ); |
|
362 |
|
363 TInt err = iCmDestinationApi.IsConnected( aResult ); |
|
364 |
|
365 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_ISCONNECTED_EXIT ); |
|
366 return err; |
|
367 } |
|
368 |
|
369 TInt CCmDestinationWrapper::IsHidden( TBool& aResult ) |
|
370 { |
|
371 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_ISHIDDEN_ENTRY ); |
|
372 |
|
373 TInt err = iCmDestinationApi.IsHidden( aResult ); |
|
374 |
|
375 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_ISHIDDEN_EXIT ); |
|
376 return err; |
|
377 } |
|
378 |
|
379 TInt CCmDestinationWrapper::IsEqual( const TInt aHandle, TBool& aResult ) |
|
380 { |
|
381 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_ISEQUAL_ENTRY ); |
|
382 |
|
383 TInt err = iCmDestinationApi.IsEqual( aHandle, aResult ); |
|
384 |
|
385 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_ISEQUAL_EXIT ); |
|
386 return err; |
|
387 } |
|
388 |
|
389 TBool CCmDestinationWrapper::SessionConnected() |
|
390 { |
|
391 return iCmDestinationApi.SessionConnected(); |
|
392 } |
|
393 |
|
394 void CCmDestinationWrapper::CloseSession() |
|
395 { |
|
396 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_CLOSESESSION_ENTRY ); |
|
397 iCmDestinationApi.Close(); |
|
398 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_CLOSESESSION_EXIT ); |
|
399 } |
|
400 |
|
401 TInt CCmDestinationWrapper::GetHandle() const |
|
402 { |
|
403 return iCmDestinationApi.SubSessionHandle(); |
|
404 } |
|
405 |
|
406 RCmManagerApi* CCmDestinationWrapper::GetMainSession() const |
|
407 { |
|
408 return iCmManagerApi; |
|
409 } |
|
410 |
|
411 void CCmDestinationWrapper::IncreaseReferenceCounter() |
|
412 { |
|
413 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_INCREASEREFERENCECOUNTER_ENTRY ); |
|
414 iReferenceCounter++; |
|
415 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_INCREASEREFERENCECOUNTER_EXIT ); |
|
416 } |
|
417 |
|
418 TInt CCmDestinationWrapper::DecreaseReferenceCounter() |
|
419 { |
|
420 OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_DECREASEREFERENCECOUNTER_ENTRY ); |
|
421 |
|
422 iReferenceCounter--; |
|
423 if ( iReferenceCounter < 0 ) |
|
424 { |
|
425 iReferenceCounter = 0; |
|
426 } |
|
427 |
|
428 OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_DECREASEREFERENCECOUNTER_EXIT ); |
|
429 return iReferenceCounter; |
|
430 } |
|
431 |
|
432 // End of file |