|
1 /* |
|
2 * Copyright (c) 2006-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 * Implementation of RCmDestinationExt. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include <cmdestinationext.h> |
|
21 #include <cmconnectionmethodext.h> |
|
22 |
|
23 #include "cmmserverdefs.h" |
|
24 #include "cmmanagerapi.h" |
|
25 #include "cmdestinationwrapper.h" |
|
26 #include "cmconnectionmethodwrapper.h" |
|
27 |
|
28 #include "OstTraceDefinitions.h" |
|
29 #ifdef OST_TRACE_COMPILER_IN_USE |
|
30 #include "cmdestinationextTraces.h" |
|
31 #endif |
|
32 |
|
33 |
|
34 //----------------------------------------------------------------------------- |
|
35 // RCmDestinationExt::Close() |
|
36 //----------------------------------------------------------------------------- |
|
37 // |
|
38 EXPORT_C void RCmDestinationExt::Close() |
|
39 { |
|
40 OstTraceFunctionEntry0( RCMDESTINATIONEXT_CLOSE_ENTRY ); |
|
41 |
|
42 if ( iCmDestinationWrapper ) |
|
43 { |
|
44 if ( iCmDestinationWrapper->DecreaseReferenceCounter() <= 0 ) |
|
45 { |
|
46 delete iCmDestinationWrapper; |
|
47 } |
|
48 iCmDestinationWrapper = NULL; |
|
49 } |
|
50 |
|
51 OstTraceFunctionExit0( RCMDESTINATIONEXT_CLOSE_EXIT ); |
|
52 } |
|
53 |
|
54 //----------------------------------------------------------------------------- |
|
55 // RCmDestinationExt::~RCmDestinationExt() |
|
56 //----------------------------------------------------------------------------- |
|
57 // |
|
58 EXPORT_C RCmDestinationExt::~RCmDestinationExt() |
|
59 { |
|
60 OstTraceFunctionEntry0( RCMDESTINATIONEXT_RCMDESTINATIONEXT_ENTRY ); |
|
61 Close(); |
|
62 OstTraceFunctionExit0( RCMDESTINATIONEXT_RCMDESTINATIONEXT_EXIT ); |
|
63 } |
|
64 |
|
65 //----------------------------------------------------------------------------- |
|
66 // RCmDestinationExt::RCmDestinationExt() |
|
67 //----------------------------------------------------------------------------- |
|
68 // |
|
69 EXPORT_C RCmDestinationExt::RCmDestinationExt( |
|
70 const RCmDestinationExt& aDestination ) |
|
71 { |
|
72 OstTraceFunctionEntry0( DUP1_RCMDESTINATIONEXT_RCMDESTINATIONEXT_ENTRY ); |
|
73 |
|
74 this->iCmDestinationWrapper = aDestination.iCmDestinationWrapper; |
|
75 if ( iCmDestinationWrapper ) |
|
76 { |
|
77 iCmDestinationWrapper->IncreaseReferenceCounter(); |
|
78 } |
|
79 |
|
80 OstTraceFunctionExit0( DUP1_RCMDESTINATIONEXT_RCMDESTINATIONEXT_EXIT ); |
|
81 } |
|
82 |
|
83 //----------------------------------------------------------------------------- |
|
84 // RCmDestinationExt::operator=() |
|
85 //----------------------------------------------------------------------------- |
|
86 // |
|
87 EXPORT_C RCmDestinationExt& RCmDestinationExt::operator=( |
|
88 const RCmDestinationExt& aDestination ) |
|
89 { |
|
90 OstTraceFunctionEntry0( RCMDESTINATIONEXT_OPERATOR_ENTRY ); |
|
91 |
|
92 if ( this != &aDestination ) |
|
93 { |
|
94 Close(); |
|
95 this->iCmDestinationWrapper = aDestination.iCmDestinationWrapper; |
|
96 if ( iCmDestinationWrapper ) |
|
97 { |
|
98 iCmDestinationWrapper->IncreaseReferenceCounter(); |
|
99 } |
|
100 } |
|
101 |
|
102 OstTraceFunctionExit0( RCMDESTINATIONEXT_OPERATOR_EXIT ); |
|
103 return *this; |
|
104 } |
|
105 |
|
106 //----------------------------------------------------------------------------- |
|
107 // RCmDestinationExt::ConnectionMethodCount() |
|
108 //----------------------------------------------------------------------------- |
|
109 // |
|
110 EXPORT_C TInt RCmDestinationExt::ConnectionMethodCount() |
|
111 { |
|
112 OstTraceFunctionEntry0( RCMDESTINATIONEXT_CONNECTIONMETHODCOUNT_ENTRY ); |
|
113 |
|
114 __ASSERT_ALWAYS( iCmDestinationWrapper && iCmDestinationWrapper->SessionConnected(), |
|
115 User::Panic( KCmmPanicCategoryApi, EDestNotConnectedToServer ) ); |
|
116 |
|
117 TInt value( 0 ); |
|
118 TInt err = iCmDestinationWrapper->ConnectionMethodCount( value ); |
|
119 |
|
120 if ( err ) |
|
121 { |
|
122 value = 0; |
|
123 } |
|
124 |
|
125 OstTraceFunctionExit0( RCMDESTINATIONEXT_CONNECTIONMETHODCOUNT_EXIT ); |
|
126 return value; |
|
127 } |
|
128 |
|
129 //----------------------------------------------------------------------------- |
|
130 // RCmDestinationExt::ConnectionMethodL() |
|
131 //----------------------------------------------------------------------------- |
|
132 // |
|
133 EXPORT_C RCmConnectionMethodExt RCmDestinationExt::ConnectionMethodL( |
|
134 TInt aIndex ) |
|
135 { |
|
136 OstTraceFunctionEntry0( RCMDESTINATIONEXT_CONNECTIONMETHODL_ENTRY ); |
|
137 |
|
138 if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() ) |
|
139 { |
|
140 User::Leave( KErrBadHandle ); |
|
141 } |
|
142 |
|
143 CCmConnectionMethodWrapper* cmWrapper = CCmConnectionMethodWrapper::NewLC(); |
|
144 TInt destHandle = iCmDestinationWrapper->GetHandle(); |
|
145 TInt existingHandle( 0 ); |
|
146 cmWrapper->GetConnMethodFromDestWithIndexL( |
|
147 iCmDestinationWrapper->GetMainSession(), |
|
148 destHandle, |
|
149 aIndex, |
|
150 existingHandle ); |
|
151 if ( existingHandle ) |
|
152 { |
|
153 CleanupStack::PopAndDestroy( cmWrapper ); |
|
154 cmWrapper = iCmDestinationWrapper->GetMainSession()->GetConnMethodWrapperL( existingHandle ); |
|
155 cmWrapper->IncreaseReferenceCounter(); |
|
156 } |
|
157 else |
|
158 { |
|
159 CleanupStack::Pop( cmWrapper ); |
|
160 } |
|
161 |
|
162 RCmConnectionMethodExt cm; |
|
163 cm.iCmConnectionMethodWrapper = cmWrapper; |
|
164 |
|
165 OstTraceFunctionExit0( RCMDESTINATIONEXT_CONNECTIONMETHODL_EXIT ); |
|
166 return cm; |
|
167 } |
|
168 |
|
169 //----------------------------------------------------------------------------- |
|
170 // RCmDestinationExt::ConnectionMethodByIDL() |
|
171 //----------------------------------------------------------------------------- |
|
172 // |
|
173 EXPORT_C RCmConnectionMethodExt RCmDestinationExt::ConnectionMethodByIDL( |
|
174 TInt aConnMethodId ) |
|
175 { |
|
176 OstTraceFunctionEntry0( RCMDESTINATIONEXT_CONNECTIONMETHODBYIDL_ENTRY ); |
|
177 |
|
178 if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() ) |
|
179 { |
|
180 User::Leave( KErrBadHandle ); |
|
181 } |
|
182 |
|
183 CCmConnectionMethodWrapper* cmWrapper = CCmConnectionMethodWrapper::NewLC(); |
|
184 TInt destHandle = iCmDestinationWrapper->GetHandle(); |
|
185 TInt existingHandle( 0 ); |
|
186 cmWrapper->GetConnMethodFromDestWithIdL( |
|
187 iCmDestinationWrapper->GetMainSession(), |
|
188 destHandle, |
|
189 aConnMethodId, |
|
190 existingHandle ); |
|
191 if ( existingHandle ) |
|
192 { |
|
193 CleanupStack::PopAndDestroy( cmWrapper ); |
|
194 cmWrapper = iCmDestinationWrapper->GetMainSession()->GetConnMethodWrapperL( existingHandle ); |
|
195 cmWrapper->IncreaseReferenceCounter(); |
|
196 } |
|
197 else |
|
198 { |
|
199 CleanupStack::Pop( cmWrapper ); |
|
200 } |
|
201 |
|
202 RCmConnectionMethodExt cm; |
|
203 cm.iCmConnectionMethodWrapper = cmWrapper; |
|
204 |
|
205 OstTraceFunctionExit0( RCMDESTINATIONEXT_CONNECTIONMETHODBYIDL_EXIT ); |
|
206 return cm; |
|
207 } |
|
208 |
|
209 //----------------------------------------------------------------------------- |
|
210 // RCmDestinationExt::PriorityL() |
|
211 //----------------------------------------------------------------------------- |
|
212 // |
|
213 EXPORT_C TUint RCmDestinationExt::PriorityL( |
|
214 const RCmConnectionMethodExt& aConnectionMethod ) |
|
215 { |
|
216 OstTraceFunctionEntry0( RCMDESTINATIONEXT_PRIORITYL_ENTRY ); |
|
217 |
|
218 if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() ) |
|
219 { |
|
220 User::Leave( KErrBadHandle ); |
|
221 } |
|
222 if ( !aConnectionMethod.iCmConnectionMethodWrapper || |
|
223 !aConnectionMethod.iCmConnectionMethodWrapper->SessionConnected() ) |
|
224 { |
|
225 User::Leave( KErrArgument ); |
|
226 } |
|
227 |
|
228 TUint priority( 0 ); |
|
229 TInt handle = aConnectionMethod.iCmConnectionMethodWrapper->GetHandle(); |
|
230 TInt err = iCmDestinationWrapper->Priority( handle, priority ); |
|
231 User::LeaveIfError( err ); |
|
232 |
|
233 OstTraceFunctionExit0( RCMDESTINATIONEXT_PRIORITYL_EXIT ); |
|
234 return priority; |
|
235 } |
|
236 |
|
237 //----------------------------------------------------------------------------- |
|
238 // RCmDestinationExt::NameLC() |
|
239 //----------------------------------------------------------------------------- |
|
240 // |
|
241 EXPORT_C HBufC* RCmDestinationExt::NameLC() |
|
242 { |
|
243 OstTraceFunctionEntry0( RCMDESTINATIONEXT_NAMELC_ENTRY ); |
|
244 |
|
245 if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() ) |
|
246 { |
|
247 User::Leave( KErrBadHandle ); |
|
248 } |
|
249 |
|
250 HBufC* buffer = HBufC::NewLC( KCmmStringLengthMax ); |
|
251 TInt err = iCmDestinationWrapper->GetName( buffer ); |
|
252 User::LeaveIfError( err ); |
|
253 // Leave buffer in cleanup stack. |
|
254 |
|
255 OstTraceFunctionExit0( RCMDESTINATIONEXT_NAMELC_EXIT ); |
|
256 return buffer; |
|
257 } |
|
258 |
|
259 //----------------------------------------------------------------------------- |
|
260 // RCmDestinationExt::Id() |
|
261 //----------------------------------------------------------------------------- |
|
262 // |
|
263 EXPORT_C TUint32 RCmDestinationExt::Id() |
|
264 { |
|
265 OstTraceFunctionEntry0( RCMDESTINATIONEXT_ID_ENTRY ); |
|
266 |
|
267 __ASSERT_ALWAYS( iCmDestinationWrapper && iCmDestinationWrapper->SessionConnected(), |
|
268 User::Panic( KCmmPanicCategoryApi, EDestNotConnectedToServer ) ); |
|
269 |
|
270 TUint32 id( 0 ); |
|
271 TInt err = iCmDestinationWrapper->GetId( id ); |
|
272 |
|
273 if ( err ) |
|
274 { |
|
275 id = 0; |
|
276 } |
|
277 |
|
278 OstTraceFunctionExit0( RCMDESTINATIONEXT_ID_EXIT ); |
|
279 return id; |
|
280 } |
|
281 |
|
282 //----------------------------------------------------------------------------- |
|
283 // RCmDestinationExt::ElementId() |
|
284 //----------------------------------------------------------------------------- |
|
285 // |
|
286 EXPORT_C TUint32 RCmDestinationExt::ElementId() |
|
287 { |
|
288 OstTraceFunctionEntry0( RCMDESTINATIONEXT_ELEMENTID_ENTRY ); |
|
289 |
|
290 __ASSERT_ALWAYS( iCmDestinationWrapper && iCmDestinationWrapper->SessionConnected(), |
|
291 User::Panic( KCmmPanicCategoryApi, EDestNotConnectedToServer ) ); |
|
292 |
|
293 TUint32 elementId( 0 ); |
|
294 TInt err = iCmDestinationWrapper->GetElementId( elementId ); |
|
295 |
|
296 if ( err ) |
|
297 { |
|
298 elementId = 0; |
|
299 } |
|
300 |
|
301 OstTraceFunctionExit0( RCMDESTINATIONEXT_ELEMENTID_EXIT ); |
|
302 return elementId; |
|
303 } |
|
304 |
|
305 //----------------------------------------------------------------------------- |
|
306 // RCmDestinationExt::MetadataL() |
|
307 //----------------------------------------------------------------------------- |
|
308 // |
|
309 EXPORT_C TUint32 RCmDestinationExt::MetadataL( |
|
310 CMManager::TSnapMetadataField aMetadataField ) const |
|
311 { |
|
312 OstTraceFunctionEntry0( RCMDESTINATIONEXT_METADATAL_ENTRY ); |
|
313 |
|
314 if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() ) |
|
315 { |
|
316 User::Leave( KErrBadHandle ); |
|
317 } |
|
318 |
|
319 TUint32 value( 0 ); |
|
320 TInt err = iCmDestinationWrapper->GetMetadata( aMetadataField, value ); |
|
321 User::LeaveIfError( err ); |
|
322 |
|
323 OstTraceFunctionExit0( RCMDESTINATIONEXT_METADATAL_EXIT ); |
|
324 return value; |
|
325 } |
|
326 |
|
327 //----------------------------------------------------------------------------- |
|
328 // RCmDestinationExt::ProtectionLevel() |
|
329 //----------------------------------------------------------------------------- |
|
330 // |
|
331 EXPORT_C CMManager::TProtectionLevel RCmDestinationExt::ProtectionLevel() |
|
332 { |
|
333 OstTraceFunctionEntry0( RCMDESTINATIONEXT_PROTECTIONLEVEL_ENTRY ); |
|
334 |
|
335 __ASSERT_ALWAYS( iCmDestinationWrapper && iCmDestinationWrapper->SessionConnected(), |
|
336 User::Panic( KCmmPanicCategoryApi, EDestNotConnectedToServer ) ); |
|
337 |
|
338 TInt protectionLevel( CMManager::EProtLevel0 ); |
|
339 TInt err = iCmDestinationWrapper->GetProtectionLevel( protectionLevel ); |
|
340 |
|
341 if ( err ) |
|
342 { |
|
343 protectionLevel = CMManager::EProtLevel0; |
|
344 } |
|
345 |
|
346 OstTraceFunctionExit0( RCMDESTINATIONEXT_PROTECTIONLEVEL_EXIT ); |
|
347 return ( CMManager::TProtectionLevel )protectionLevel; |
|
348 } |
|
349 |
|
350 //----------------------------------------------------------------------------- |
|
351 // RCmDestinationExt::IsHidden() |
|
352 //----------------------------------------------------------------------------- |
|
353 // |
|
354 EXPORT_C TBool RCmDestinationExt::IsHidden() |
|
355 { |
|
356 OstTraceFunctionEntry0( RCMDESTINATIONEXT_ISHIDDEN_ENTRY ); |
|
357 |
|
358 __ASSERT_ALWAYS( iCmDestinationWrapper && iCmDestinationWrapper->SessionConnected(), |
|
359 User::Panic( KCmmPanicCategoryApi, EDestNotConnectedToServer ) ); |
|
360 |
|
361 TBool value( EFalse ); |
|
362 TInt err = iCmDestinationWrapper->IsHidden( value ); |
|
363 |
|
364 if ( err ) |
|
365 { |
|
366 value = EFalse; |
|
367 } |
|
368 |
|
369 OstTraceFunctionExit0( RCMDESTINATIONEXT_ISHIDDEN_EXIT ); |
|
370 return value; |
|
371 } |
|
372 |
|
373 //----------------------------------------------------------------------------- |
|
374 // RCmDestinationExt::CreateConnectionMethodL() |
|
375 //----------------------------------------------------------------------------- |
|
376 // |
|
377 EXPORT_C RCmConnectionMethodExt RCmDestinationExt::CreateConnectionMethodL( |
|
378 TUint32 aBearerType ) |
|
379 { |
|
380 OstTraceFunctionEntry0( RCMDESTINATIONEXT_CREATECONNECTIONMETHODL_ENTRY ); |
|
381 |
|
382 if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() ) |
|
383 { |
|
384 User::Leave( KErrBadHandle ); |
|
385 } |
|
386 |
|
387 CCmConnectionMethodWrapper* cmWrapper = CCmConnectionMethodWrapper::NewLC(); |
|
388 TInt destHandle = iCmDestinationWrapper->GetHandle(); |
|
389 cmWrapper->CreateConnMethodToDestL( |
|
390 iCmDestinationWrapper->GetMainSession(), |
|
391 destHandle, |
|
392 aBearerType ); |
|
393 CleanupStack::Pop( cmWrapper ); |
|
394 |
|
395 RCmConnectionMethodExt cm; |
|
396 cm.iCmConnectionMethodWrapper = cmWrapper; |
|
397 |
|
398 OstTraceFunctionExit0( RCMDESTINATIONEXT_CREATECONNECTIONMETHODL_EXIT ); |
|
399 return cm; |
|
400 } |
|
401 |
|
402 //----------------------------------------------------------------------------- |
|
403 // RCmDestinationExt::CreateConnectionMethodL() |
|
404 //----------------------------------------------------------------------------- |
|
405 // |
|
406 EXPORT_C RCmConnectionMethodExt RCmDestinationExt::CreateConnectionMethodL( |
|
407 TUint32 aBearerType, |
|
408 TUint32 aConnMethodId ) |
|
409 { |
|
410 OstTraceFunctionEntry0( DUP1_RCMDESTINATIONEXT_CREATECONNECTIONMETHODL_ENTRY ); |
|
411 |
|
412 if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() ) |
|
413 { |
|
414 User::Leave( KErrBadHandle ); |
|
415 } |
|
416 |
|
417 CCmConnectionMethodWrapper* cmWrapper = CCmConnectionMethodWrapper::NewLC(); |
|
418 TInt destHandle = iCmDestinationWrapper->GetHandle(); |
|
419 cmWrapper->CreateConnMethodToDestWithIdL( |
|
420 iCmDestinationWrapper->GetMainSession(), |
|
421 destHandle, |
|
422 aBearerType, |
|
423 aConnMethodId ); |
|
424 CleanupStack::Pop( cmWrapper ); |
|
425 |
|
426 RCmConnectionMethodExt cm; |
|
427 cm.iCmConnectionMethodWrapper = cmWrapper; |
|
428 |
|
429 OstTraceFunctionExit0( DUP1_RCMDESTINATIONEXT_CREATECONNECTIONMETHODL_EXIT ); |
|
430 return cm; |
|
431 } |
|
432 |
|
433 //----------------------------------------------------------------------------- |
|
434 // RCmDestinationExt::AddConnectionMethodL() |
|
435 //----------------------------------------------------------------------------- |
|
436 // |
|
437 EXPORT_C TInt RCmDestinationExt::AddConnectionMethodL( |
|
438 RCmConnectionMethodExt aConnectionMethod ) |
|
439 { |
|
440 OstTraceFunctionEntry0( RCMDESTINATIONEXT_ADDCONNECTIONMETHODL_ENTRY ); |
|
441 |
|
442 if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() ) |
|
443 { |
|
444 User::Leave( KErrBadHandle ); |
|
445 } |
|
446 if ( !aConnectionMethod.iCmConnectionMethodWrapper || |
|
447 !aConnectionMethod.iCmConnectionMethodWrapper->SessionConnected() ) |
|
448 { |
|
449 User::Leave( KErrArgument ); |
|
450 } |
|
451 |
|
452 TInt index( 0 ); |
|
453 TInt connMethodHandle = aConnectionMethod.iCmConnectionMethodWrapper->GetHandle(); |
|
454 TInt err = iCmDestinationWrapper->AddConnectionMethod( connMethodHandle, index ); |
|
455 |
|
456 User::LeaveIfError( err ); |
|
457 |
|
458 OstTraceFunctionExit0( RCMDESTINATIONEXT_ADDCONNECTIONMETHODL_EXIT ); |
|
459 return index; |
|
460 } |
|
461 |
|
462 //----------------------------------------------------------------------------- |
|
463 // RCmDestinationExt::AddEmbeddedDestinationL() |
|
464 //----------------------------------------------------------------------------- |
|
465 // |
|
466 EXPORT_C TInt RCmDestinationExt::AddEmbeddedDestinationL( |
|
467 const RCmDestinationExt& aDestination ) |
|
468 { |
|
469 OstTraceFunctionEntry0( RCMDESTINATIONEXT_ADDEMBEDDEDDESTINATIONL_ENTRY ); |
|
470 |
|
471 if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() ) |
|
472 { |
|
473 User::Leave( KErrBadHandle ); |
|
474 } |
|
475 if ( iCmDestinationWrapper == aDestination.iCmDestinationWrapper ) |
|
476 { |
|
477 User::Leave( KErrArgument ); |
|
478 } |
|
479 if ( !aDestination.iCmDestinationWrapper || |
|
480 !aDestination.iCmDestinationWrapper->SessionConnected() ) |
|
481 { |
|
482 User::Leave( KErrArgument ); |
|
483 } |
|
484 |
|
485 TInt index( 0 ); |
|
486 TInt destinationHandle = aDestination.iCmDestinationWrapper->GetHandle(); |
|
487 TInt err = iCmDestinationWrapper->AddEmbeddedDestination( destinationHandle, index ); |
|
488 |
|
489 User::LeaveIfError( err ); |
|
490 |
|
491 OstTraceFunctionExit0( RCMDESTINATIONEXT_ADDEMBEDDEDDESTINATIONL_EXIT ); |
|
492 return index; |
|
493 } |
|
494 |
|
495 //----------------------------------------------------------------------------- |
|
496 // RCmDestinationExt::DeleteConnectionMethodL() |
|
497 //----------------------------------------------------------------------------- |
|
498 // |
|
499 EXPORT_C void RCmDestinationExt::DeleteConnectionMethodL( |
|
500 RCmConnectionMethodExt& aConnectionMethod ) |
|
501 { |
|
502 OstTraceFunctionEntry0( RCMDESTINATIONEXT_DELETECONNECTIONMETHODL_ENTRY ); |
|
503 |
|
504 if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() ) |
|
505 { |
|
506 User::Leave( KErrBadHandle ); |
|
507 } |
|
508 if ( !aConnectionMethod.iCmConnectionMethodWrapper || |
|
509 !aConnectionMethod.iCmConnectionMethodWrapper->SessionConnected() ) |
|
510 { |
|
511 User::Leave( KErrArgument ); |
|
512 } |
|
513 |
|
514 TInt connMethodHandle = aConnectionMethod.iCmConnectionMethodWrapper->GetHandle(); |
|
515 TInt err = iCmDestinationWrapper->DeleteConnectionMethod( connMethodHandle ); |
|
516 User::LeaveIfError( err ); |
|
517 |
|
518 OstTraceFunctionExit0( RCMDESTINATIONEXT_DELETECONNECTIONMETHODL_EXIT ); |
|
519 } |
|
520 |
|
521 //----------------------------------------------------------------------------- |
|
522 // RCmDestinationExt::RemoveConnectionMethodL() |
|
523 //----------------------------------------------------------------------------- |
|
524 // |
|
525 EXPORT_C void RCmDestinationExt::RemoveConnectionMethodL( |
|
526 RCmConnectionMethodExt aConnectionMethod ) |
|
527 { |
|
528 OstTraceFunctionEntry0( RCMDESTINATIONEXT_REMOVECONNECTIONMETHODL_ENTRY ); |
|
529 |
|
530 if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() ) |
|
531 { |
|
532 User::Leave( KErrBadHandle ); |
|
533 } |
|
534 if ( !aConnectionMethod.iCmConnectionMethodWrapper || |
|
535 !aConnectionMethod.iCmConnectionMethodWrapper->SessionConnected() ) |
|
536 { |
|
537 User::Leave( KErrArgument ); |
|
538 } |
|
539 |
|
540 TInt connMethodHandle = aConnectionMethod.iCmConnectionMethodWrapper->GetHandle(); |
|
541 TInt err = iCmDestinationWrapper->RemoveConnectionMethod( connMethodHandle ); |
|
542 User::LeaveIfError( err ); |
|
543 |
|
544 OstTraceFunctionExit0( RCMDESTINATIONEXT_REMOVECONNECTIONMETHODL_EXIT ); |
|
545 } |
|
546 |
|
547 //----------------------------------------------------------------------------- |
|
548 // RCmDestinationExt::ModifyPriorityL() |
|
549 //----------------------------------------------------------------------------- |
|
550 // |
|
551 EXPORT_C void RCmDestinationExt::ModifyPriorityL( |
|
552 RCmConnectionMethodExt& aConnectionMethod, |
|
553 TUint aIndex ) |
|
554 { |
|
555 OstTraceFunctionEntry0( RCMDESTINATIONEXT_MODIFYPRIORITYL_ENTRY ); |
|
556 |
|
557 if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() ) |
|
558 { |
|
559 User::Leave( KErrBadHandle ); |
|
560 } |
|
561 if ( !aConnectionMethod.iCmConnectionMethodWrapper || |
|
562 !aConnectionMethod.iCmConnectionMethodWrapper->SessionConnected() ) |
|
563 { |
|
564 User::Leave( KErrArgument ); |
|
565 } |
|
566 |
|
567 TInt connMethodHandle = aConnectionMethod.iCmConnectionMethodWrapper->GetHandle(); |
|
568 TInt err = iCmDestinationWrapper->ModifyPriority( connMethodHandle, aIndex ); |
|
569 User::LeaveIfError( err ); |
|
570 |
|
571 OstTraceFunctionExit0( RCMDESTINATIONEXT_MODIFYPRIORITYL_EXIT ); |
|
572 } |
|
573 |
|
574 //----------------------------------------------------------------------------- |
|
575 // RCmDestinationExt::SetNameL() |
|
576 //----------------------------------------------------------------------------- |
|
577 // |
|
578 EXPORT_C void RCmDestinationExt::SetNameL( const TDesC& aName ) |
|
579 { |
|
580 OstTraceFunctionEntry0( RCMDESTINATIONEXT_SETNAMEL_ENTRY ); |
|
581 |
|
582 if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() ) |
|
583 { |
|
584 User::Leave( KErrBadHandle ); |
|
585 } |
|
586 |
|
587 TInt err = iCmDestinationWrapper->SetName( aName ); |
|
588 User::LeaveIfError( err ); |
|
589 |
|
590 OstTraceFunctionExit0( RCMDESTINATIONEXT_SETNAMEL_EXIT ); |
|
591 } |
|
592 |
|
593 //----------------------------------------------------------------------------- |
|
594 // RCmDestinationExt::SetMetadataL() |
|
595 //----------------------------------------------------------------------------- |
|
596 // |
|
597 EXPORT_C void RCmDestinationExt::SetMetadataL( |
|
598 CMManager::TSnapMetadataField aMetadataField, |
|
599 TUint32 aValue ) |
|
600 { |
|
601 OstTraceFunctionEntry0( RCMDESTINATIONEXT_SETMETADATAL_ENTRY ); |
|
602 |
|
603 if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() ) |
|
604 { |
|
605 User::Leave( KErrBadHandle ); |
|
606 } |
|
607 |
|
608 TInt err = iCmDestinationWrapper->SetMetadata( aMetadataField, aValue ); |
|
609 User::LeaveIfError( err ); |
|
610 |
|
611 OstTraceFunctionExit0( RCMDESTINATIONEXT_SETMETADATAL_EXIT ); |
|
612 } |
|
613 |
|
614 //----------------------------------------------------------------------------- |
|
615 // RCmDestinationExt::SetProtectionL() |
|
616 //----------------------------------------------------------------------------- |
|
617 // |
|
618 EXPORT_C void RCmDestinationExt::SetProtectionL( CMManager::TProtectionLevel aProtLevel ) |
|
619 { |
|
620 OstTraceFunctionEntry0( RCMDESTINATIONEXT_SETPROTECTIONL_ENTRY ); |
|
621 |
|
622 if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() ) |
|
623 { |
|
624 User::Leave( KErrBadHandle ); |
|
625 } |
|
626 |
|
627 TInt err = iCmDestinationWrapper->SetProtection( aProtLevel ); |
|
628 User::LeaveIfError( err ); |
|
629 |
|
630 OstTraceFunctionExit0( RCMDESTINATIONEXT_SETPROTECTIONL_EXIT ); |
|
631 } |
|
632 |
|
633 //----------------------------------------------------------------------------- |
|
634 // RCmDestinationExt::SetHiddenL() |
|
635 //----------------------------------------------------------------------------- |
|
636 // |
|
637 EXPORT_C void RCmDestinationExt::SetHiddenL( TBool aHidden ) |
|
638 { |
|
639 OstTraceFunctionEntry0( RCMDESTINATIONEXT_SETHIDDENL_ENTRY ); |
|
640 |
|
641 if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() ) |
|
642 { |
|
643 User::Leave( KErrBadHandle ); |
|
644 } |
|
645 |
|
646 TInt err = iCmDestinationWrapper->SetHidden( aHidden ); |
|
647 User::LeaveIfError( err ); |
|
648 |
|
649 OstTraceFunctionExit0( RCMDESTINATIONEXT_SETHIDDENL_EXIT ); |
|
650 } |
|
651 |
|
652 //----------------------------------------------------------------------------- |
|
653 // RCmDestinationExt::UpdateL() |
|
654 //----------------------------------------------------------------------------- |
|
655 // |
|
656 EXPORT_C void RCmDestinationExt::UpdateL() |
|
657 { |
|
658 OstTraceFunctionEntry0( RCMDESTINATIONEXT_UPDATEL_ENTRY ); |
|
659 |
|
660 if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() ) |
|
661 { |
|
662 User::Leave( KErrBadHandle ); |
|
663 } |
|
664 |
|
665 TInt err = iCmDestinationWrapper->Update(); |
|
666 User::LeaveIfError( err ); |
|
667 |
|
668 OstTraceFunctionExit0( RCMDESTINATIONEXT_UPDATEL_EXIT ); |
|
669 } |
|
670 |
|
671 //----------------------------------------------------------------------------- |
|
672 // RCmDestinationExt::DeleteLD() |
|
673 //----------------------------------------------------------------------------- |
|
674 // |
|
675 EXPORT_C void RCmDestinationExt::DeleteLD() |
|
676 { |
|
677 OstTraceFunctionEntry0( RCMDESTINATIONEXT_DELETELD_ENTRY ); |
|
678 |
|
679 if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() ) |
|
680 { |
|
681 User::Leave( KErrBadHandle ); |
|
682 } |
|
683 |
|
684 TInt err = iCmDestinationWrapper->Delete(); |
|
685 User::LeaveIfError( err ); |
|
686 |
|
687 // Instead of calling Close(), we need to force this handle closed even if |
|
688 // copies have been made. So we delete the destination wrapper directly. |
|
689 delete iCmDestinationWrapper; |
|
690 iCmDestinationWrapper = NULL; |
|
691 |
|
692 OstTraceFunctionExit0( RCMDESTINATIONEXT_DELETELD_EXIT ); |
|
693 } |
|
694 |
|
695 //----------------------------------------------------------------------------- |
|
696 // RCmDestinationExt::IsConnectedL() |
|
697 //----------------------------------------------------------------------------- |
|
698 // |
|
699 EXPORT_C TBool RCmDestinationExt::IsConnectedL() const |
|
700 { |
|
701 OstTraceFunctionEntry0( RCMDESTINATIONEXT_ISCONNECTEDL_ENTRY ); |
|
702 |
|
703 if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() ) |
|
704 { |
|
705 User::Leave( KErrBadHandle ); |
|
706 } |
|
707 |
|
708 TBool value( 0 ); |
|
709 TInt err = iCmDestinationWrapper->IsConnected( value ); |
|
710 User::LeaveIfError( err ); |
|
711 |
|
712 OstTraceFunctionExit0( RCMDESTINATIONEXT_ISCONNECTEDL_EXIT ); |
|
713 return value; |
|
714 } |
|
715 |
|
716 //----------------------------------------------------------------------------- |
|
717 // RCmDestinationExt::RCmDestinationExt() |
|
718 //----------------------------------------------------------------------------- |
|
719 // |
|
720 EXPORT_C RCmDestinationExt::RCmDestinationExt() : iCmDestinationWrapper( NULL ) |
|
721 { |
|
722 OstTraceFunctionEntry0( DUP2_RCMDESTINATIONEXT_RCMDESTINATIONEXT_ENTRY ); |
|
723 OstTraceFunctionExit0( DUP2_RCMDESTINATIONEXT_RCMDESTINATIONEXT_EXIT ); |
|
724 } |
|
725 |
|
726 //----------------------------------------------------------------------------- |
|
727 // RCmDestinationExt::operator==() |
|
728 //----------------------------------------------------------------------------- |
|
729 // |
|
730 EXPORT_C TBool RCmDestinationExt::operator==( |
|
731 const RCmDestinationExt& aDestination ) const |
|
732 { |
|
733 OstTraceFunctionEntry0( DUP1_RCMDESTINATIONEXT_OPERATOR_ENTRY ); |
|
734 |
|
735 TBool result( EFalse ); |
|
736 if ( !aDestination.iCmDestinationWrapper ) |
|
737 { |
|
738 if ( !iCmDestinationWrapper ) |
|
739 { |
|
740 result = ETrue; // Both empty. |
|
741 } |
|
742 else |
|
743 { |
|
744 result = EFalse; |
|
745 } |
|
746 } |
|
747 else if ( !iCmDestinationWrapper ) |
|
748 { |
|
749 result = EFalse; |
|
750 } |
|
751 else |
|
752 { |
|
753 // Both destination objects have wrappers. |
|
754 |
|
755 if ( !iCmDestinationWrapper->SessionConnected() || |
|
756 !aDestination.iCmDestinationWrapper->SessionConnected() ) |
|
757 { |
|
758 result = EFalse; |
|
759 } |
|
760 else |
|
761 { |
|
762 // Both destination objects are connected to server. |
|
763 |
|
764 TInt handle = aDestination.iCmDestinationWrapper->GetHandle(); |
|
765 TInt err = iCmDestinationWrapper->IsEqual( handle, result ); |
|
766 if ( err ) |
|
767 { |
|
768 result = EFalse; |
|
769 } |
|
770 } |
|
771 } |
|
772 |
|
773 OstTraceFunctionExit0( DUP1_RCMDESTINATIONEXT_OPERATOR_EXIT ); |
|
774 return result; |
|
775 } |
|
776 |
|
777 //----------------------------------------------------------------------------- |
|
778 //RCmDestinationExt::operator!=() |
|
779 //----------------------------------------------------------------------------- |
|
780 // |
|
781 EXPORT_C TBool RCmDestinationExt::operator!=( |
|
782 const RCmDestinationExt& aDestination ) const |
|
783 { |
|
784 OstTraceFunctionEntry0( DUP2_RCMDESTINATIONEXT_OPERATOR_ENTRY ); |
|
785 |
|
786 TBool result = !( operator==( aDestination ) ); |
|
787 |
|
788 OstTraceFunctionExit0( DUP2_RCMDESTINATIONEXT_OPERATOR_EXIT ); |
|
789 return result; |
|
790 } |
|
791 |
|
792 // End of file |