cmmanager/cmmgr/Framework/Src/cmdestinationext.cpp
branchRCL_3
changeset 58 83ca720e2b9a
parent 0 5a93021fdf25
equal deleted inserted replaced
57:05bc53fe583b 58:83ca720e2b9a
       
     1 /*
       
     2 * Copyright (c) 2006 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 of RCmDestinationExt
       
    15 *
       
    16 */
       
    17 
       
    18 #include <cmdestinationext.h>
       
    19 #include "cmdestinationimpl.h"
       
    20 #include <cmconnectionmethodext.h>
       
    21 #include <cmpluginbaseeng.h>
       
    22 #include <cmpluginbase.h>
       
    23 #include "cmmanagerimpl.h"
       
    24 
       
    25 using namespace CMManager;
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // RCmDestinationExt::Close()
       
    29 // -----------------------------------------------------------------------------
       
    30 //
       
    31 EXPORT_C void RCmDestinationExt::Close()
       
    32     {
       
    33     if( !iDestinatonData )
       
    34         {
       
    35         return;
       
    36         }
       
    37 
       
    38     iDestinatonData->Cmmgr()->RemoveDestFromPool(iDestinatonData);     
       
    39     iDestinatonData = NULL;
       
    40     }
       
    41     
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // RCmDestinationExt::~RCmDestinationExt()
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 EXPORT_C RCmDestinationExt::~RCmDestinationExt()
       
    48     {
       
    49     Close();
       
    50     }
       
    51 
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // RCmDestinationExt::RCmDestinationExt( RCmDestinationExt& )
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 EXPORT_C RCmDestinationExt::RCmDestinationExt(
       
    58                                 const RCmDestinationExt& aCmDestination)    
       
    59     : iDestinatonData( aCmDestination.iDestinatonData )
       
    60     {
       
    61     iDestinatonData->IncrementRefCounter();
       
    62     }
       
    63 
       
    64 
       
    65 
       
    66 // -----------------------------------------------------------------------------
       
    67 // RCmDestinationExt::RCmDestinationExt::operator=()
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 EXPORT_C RCmDestinationExt& RCmDestinationExt::operator=(
       
    71                                 const RCmDestinationExt& aCmDestination)
       
    72     {
       
    73     if (this != &aCmDestination) 
       
    74         {
       
    75         Close();
       
    76         iDestinatonData = aCmDestination.iDestinatonData;        
       
    77         iDestinatonData->IncrementRefCounter();
       
    78         }
       
    79     return *this;
       
    80     }
       
    81     
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // RCmDestinationExt::ConnectionMethodCount()
       
    85 // -----------------------------------------------------------------------------
       
    86 //        
       
    87 EXPORT_C TInt RCmDestinationExt::ConnectionMethodCount()    
       
    88     {
       
    89     __ASSERT_ALWAYS( iDestinatonData, User::Panic(_L( "CMManager" ), 
       
    90                                                   KErrBadHandle ) );
       
    91 
       
    92     return iDestinatonData->ConnectionMethodCount();
       
    93     };
       
    94     
       
    95 // -----------------------------------------------------------------------------
       
    96 // RCmDestinationExt::ConnectionMethodL
       
    97 // -----------------------------------------------------------------------------
       
    98 //     
       
    99 EXPORT_C RCmConnectionMethodExt 
       
   100                             RCmDestinationExt::ConnectionMethodL( TInt anIndex )
       
   101     {
       
   102     if (!iDestinatonData)
       
   103         {
       
   104         User::Leave(KErrBadHandle);
       
   105         }
       
   106 
       
   107     RCmConnectionMethodExt cm;
       
   108     CCmDestinationImpl* aImplementation = 
       
   109             CCmDestinationImpl::NewLC(iDestinatonData);
       
   110     // Deleting aImplementation will decrement the ref counter
       
   111     iDestinatonData->IncrementRefCounter();
       
   112     cm.iImplementation = 
       
   113         aImplementation->GetConnectionMethodL( anIndex )->Plugin();
       
   114     //CCmDestinationImpl::GetConnectionMethodL doesn't give ownership
       
   115     cm.iImplementation->IncrementRefCounter();
       
   116     CleanupStack::PopAndDestroy(aImplementation);    
       
   117     return cm;
       
   118     }
       
   119 
       
   120 // -----------------------------------------------------------------------------
       
   121 // RCmDestinationExt::ConnectionMethodByIDL
       
   122 // -----------------------------------------------------------------------------
       
   123 //     
       
   124 EXPORT_C RCmConnectionMethodExt 
       
   125                         RCmDestinationExt::ConnectionMethodByIDL( TInt aIapId )
       
   126     {
       
   127     if (!iDestinatonData)
       
   128         {
       
   129         User::Leave(KErrBadHandle);
       
   130         }
       
   131 
       
   132     RCmConnectionMethodExt cm;
       
   133     
       
   134     CCmDestinationImpl* aImplementation = 
       
   135             CCmDestinationImpl::NewLC(iDestinatonData);
       
   136     // Deleting aImplementation will decrement the ref counter
       
   137     iDestinatonData->IncrementRefCounter();
       
   138     cm.iImplementation = 
       
   139         aImplementation->ConnectionMethodByIDL( aIapId )->Plugin();
       
   140     //CCmDestinationImpl::ConnectionMethodByIDL doesn't give ownership
       
   141     cm.iImplementation->IncrementRefCounter();
       
   142     CleanupStack::PopAndDestroy(aImplementation);
       
   143     
       
   144     return cm;
       
   145     }
       
   146 
       
   147 // -----------------------------------------------------------------------------
       
   148 // RCmDestinationExt::PriorityL()
       
   149 // -----------------------------------------------------------------------------
       
   150 //        
       
   151 EXPORT_C TUint RCmDestinationExt::PriorityL(const RCmConnectionMethodExt& aCCMItem )
       
   152     {
       
   153     if (!iDestinatonData)
       
   154         {
       
   155         User::Leave(KErrBadHandle);
       
   156         }
       
   157 
       
   158     CCmDestinationImpl* aImplementation = 
       
   159             CCmDestinationImpl::NewLC(iDestinatonData);
       
   160     // Deleting aImplementation will decrement the ref counter
       
   161     iDestinatonData->IncrementRefCounter();
       
   162     TUint retValue = aImplementation->PriorityL( *aCCMItem.iImplementation );
       
   163     CleanupStack::PopAndDestroy(aImplementation);
       
   164     return retValue;
       
   165     }
       
   166 
       
   167 // -----------------------------------------------------------------------------
       
   168 // RCmDestinationExt::NameLC()
       
   169 // -----------------------------------------------------------------------------
       
   170 //        
       
   171 EXPORT_C HBufC* RCmDestinationExt::NameLC ( )
       
   172     {
       
   173     if (!iDestinatonData)
       
   174         {
       
   175         User::Leave(KErrBadHandle);
       
   176         }
       
   177 
       
   178     CCmDestinationImpl* aImplementation = 
       
   179             CCmDestinationImpl::NewLC(iDestinatonData);
       
   180     // Deleting aImplementation will decrement the ref counter
       
   181     iDestinatonData->IncrementRefCounter();
       
   182     HBufC* retValue = aImplementation->NameLC();
       
   183     CleanupStack::Pop(retValue);
       
   184     CleanupStack::PopAndDestroy(aImplementation);
       
   185     CleanupStack::PushL(retValue);
       
   186     return retValue;
       
   187     };
       
   188 
       
   189 // -----------------------------------------------------------------------------
       
   190 // RCmDestinationExt::Id()
       
   191 // -----------------------------------------------------------------------------
       
   192 //        
       
   193 EXPORT_C TUint32 RCmDestinationExt::Id() 
       
   194     {
       
   195     __ASSERT_ALWAYS( iDestinatonData, User::Panic(_L( "CMManager" ), 
       
   196                                                   KErrBadHandle ) );
       
   197 
       
   198     return iDestinatonData->Id();
       
   199     }
       
   200 
       
   201 // -----------------------------------------------------------------------------
       
   202 // RCmDestinationExt::ElementId()
       
   203 // -----------------------------------------------------------------------------
       
   204 //        
       
   205 EXPORT_C TUint32 RCmDestinationExt::ElementId() 
       
   206     {
       
   207     __ASSERT_ALWAYS( iDestinatonData, User::Panic(_L( "CMManager" ), 
       
   208                                                   KErrBadHandle ) );
       
   209 
       
   210     return iDestinatonData->ElementId();
       
   211     }
       
   212 
       
   213 // -----------------------------------------------------------------------------
       
   214 // RCmDestinationExt::IconL()
       
   215 // -----------------------------------------------------------------------------
       
   216 //      
       
   217 EXPORT_C CGulIcon* RCmDestinationExt::IconL() 
       
   218     {
       
   219     if (!iDestinatonData)
       
   220         {
       
   221         User::Leave(KErrBadHandle);
       
   222         }
       
   223 
       
   224     CCmDestinationImpl* aImplementation = 
       
   225             CCmDestinationImpl::NewLC(iDestinatonData);
       
   226     // Deleting aImplementation will decrement the ref counter
       
   227     iDestinatonData->IncrementRefCounter();
       
   228     CGulIcon* retValue = aImplementation->IconL();
       
   229     CleanupStack::PopAndDestroy(aImplementation);
       
   230     return retValue;
       
   231     }
       
   232 
       
   233 
       
   234 // -----------------------------------------------------------------------------
       
   235 // RCmDestinationExt::MetadataL()
       
   236 // -----------------------------------------------------------------------------
       
   237 //      
       
   238 EXPORT_C 
       
   239     TUint32 RCmDestinationExt::MetadataL( TSnapMetadataField aMetaField ) const
       
   240     {
       
   241     if (!iDestinatonData)
       
   242         {
       
   243         User::Leave(KErrBadHandle);
       
   244         }
       
   245     return iDestinatonData->MetadataL( aMetaField );
       
   246     }
       
   247 
       
   248 // -----------------------------------------------------------------------------
       
   249 // RCmDestinationExt::ProtectionLevel()
       
   250 // -----------------------------------------------------------------------------
       
   251 //  
       
   252 EXPORT_C TProtectionLevel RCmDestinationExt::ProtectionLevel()
       
   253     {
       
   254     __ASSERT_ALWAYS( iDestinatonData, User::Panic(_L( "CMManager" ), 
       
   255                                                   KErrBadHandle ) );
       
   256 
       
   257     return iDestinatonData->ProtectionLevel();
       
   258     }
       
   259 
       
   260 // -----------------------------------------------------------------------------
       
   261 // RCmDestinationExt::IsHidden()
       
   262 // -----------------------------------------------------------------------------
       
   263 //          
       
   264 EXPORT_C TBool RCmDestinationExt::IsHidden()
       
   265     {
       
   266     __ASSERT_ALWAYS( iDestinatonData, User::Panic(_L( "CMManager" ), 
       
   267                                                   KErrBadHandle ) );
       
   268 
       
   269     TBool hidden( EFalse );
       
   270     TRAPD( err, hidden = iDestinatonData->IsHiddenL() );
       
   271     __ASSERT_ALWAYS( err == KErrNone, User::Panic(_L( "CMManager" ), 
       
   272                                                   KErrArgument ) );
       
   273                                                   
       
   274     return hidden;
       
   275     }
       
   276 
       
   277 // -----------------------------------------------------------------------------
       
   278 // RCmDestinationExt::CreateConnectionMethodL()
       
   279 // -----------------------------------------------------------------------------
       
   280 //  
       
   281 EXPORT_C RCmConnectionMethodExt 
       
   282         RCmDestinationExt::CreateConnectionMethodL( TUint32 aImplementationUid )
       
   283     {
       
   284     if (!iDestinatonData)
       
   285         {
       
   286         User::Leave(KErrBadHandle);
       
   287         }
       
   288 
       
   289     RCmConnectionMethodExt cm;
       
   290     CCmDestinationImpl* aImplementation = 
       
   291             CCmDestinationImpl::NewLC(iDestinatonData);
       
   292     // Deleting aImplementation will decrement the ref counter
       
   293     iDestinatonData->IncrementRefCounter();
       
   294     CCmPluginBase* imp = aImplementation->CreateConnectionMethodL( 
       
   295                                         aImplementationUid );
       
   296     imp->IncrementRefCounter();
       
   297     CleanupStack::PushL(imp);                                    
       
   298     cm.iImplementation = imp->Plugin();
       
   299     CleanupStack::PopAndDestroy(imp);
       
   300     
       
   301     CleanupStack::PopAndDestroy(aImplementation);
       
   302     return cm;
       
   303     }
       
   304 
       
   305 // -----------------------------------------------------------------------------
       
   306 // RCmDestinationExt::CreateConnectionMethodL()
       
   307 // -----------------------------------------------------------------------------
       
   308 //  
       
   309 EXPORT_C RCmConnectionMethodExt RCmDestinationExt::CreateConnectionMethodL( 
       
   310     TUint32 aImplementationUid,
       
   311     TUint32  aConnMethId )
       
   312     {
       
   313     if (!iDestinatonData)
       
   314         {
       
   315         User::Leave(KErrBadHandle);
       
   316         }
       
   317 
       
   318     RCmConnectionMethodExt cm;
       
   319     CCmDestinationImpl* implementation = 
       
   320                                      CCmDestinationImpl::NewLC( iDestinatonData );
       
   321     // Deleting aImplementation will decrement the ref counter
       
   322     iDestinatonData->IncrementRefCounter();
       
   323     CCmPluginBase* imp = implementation->CreateConnectionMethodL( 
       
   324                                                             aImplementationUid,
       
   325                                                             aConnMethId );
       
   326     imp->IncrementRefCounter();
       
   327     CleanupStack::PushL(imp);                                    
       
   328     cm.iImplementation = imp->Plugin();
       
   329     CleanupStack::PopAndDestroy(imp);
       
   330 
       
   331     CleanupStack::PopAndDestroy(implementation);
       
   332     return cm;
       
   333     }
       
   334 
       
   335 // -----------------------------------------------------------------------------
       
   336 // RCmDestinationExt::AddConnectionMethodL()
       
   337 // -----------------------------------------------------------------------------
       
   338 // 
       
   339 EXPORT_C TInt RCmDestinationExt::AddConnectionMethodL( 
       
   340                                       RCmConnectionMethodExt aConnectionMethod )
       
   341     {
       
   342     if (!iDestinatonData)
       
   343         {
       
   344         User::Leave(KErrBadHandle);
       
   345         }
       
   346         
       
   347     CCmDestinationImpl* implementation = 
       
   348             CCmDestinationImpl::NewLC(iDestinatonData);
       
   349     // Deleting aImplementation will decrement the ref counter
       
   350     iDestinatonData->IncrementRefCounter();
       
   351 
       
   352     CCmPluginBase* connMethod = new (ELeave) 
       
   353                             CCmPluginBase(aConnectionMethod.iImplementation);
       
   354     connMethod->IncrementRefCounter();    
       
   355     CleanupStack::PushL( connMethod );        
       
   356 
       
   357     // Check if the given connection method exists already in this destination
       
   358     if ( aConnectionMethod.iImplementation->IdIsValid() &&
       
   359          implementation->CheckIfCMExistsL( *connMethod ) )
       
   360         {
       
   361         CleanupStack::PopAndDestroy( connMethod );
       
   362         CleanupStack::PopAndDestroy( implementation );
       
   363         User::Leave( KErrAlreadyExists );
       
   364         }
       
   365 
       
   366     TInt retValue =  implementation->AddConnectionMethodL( *connMethod );
       
   367     CleanupStack::PopAndDestroy( connMethod );
       
   368     CleanupStack::PopAndDestroy( implementation );
       
   369     return retValue;
       
   370     }
       
   371 
       
   372 // -----------------------------------------------------------------------------
       
   373 // RCmDestinationExt::AddEmbeddedDestinationL()
       
   374 // -----------------------------------------------------------------------------
       
   375 // 
       
   376 EXPORT_C TInt RCmDestinationExt::AddEmbeddedDestinationL( 
       
   377                                            const RCmDestinationExt& aDestination )
       
   378     {
       
   379     if ( !iDestinatonData )
       
   380         {
       
   381         User::Leave(KErrBadHandle);
       
   382         }
       
   383     
       
   384     if ( this == &aDestination )
       
   385         {
       
   386         User::Leave( KErrArgument );
       
   387         }
       
   388     
       
   389     CCmDestinationImpl* aImplementation = 
       
   390             CCmDestinationImpl::NewLC(iDestinatonData);
       
   391     // Deleting will decrement the ref counter
       
   392     aImplementation->IncrementRefCounter();
       
   393     CCmDestinationImpl* aDestToAdd = 
       
   394             CCmDestinationImpl::NewLC(aDestination.iDestinatonData);
       
   395     // Deleting will decrement the ref counter
       
   396     aDestToAdd->IncrementRefCounter();
       
   397         
       
   398     TInt retValue =  aImplementation->AddEmbeddedDestinationL( 
       
   399                                                 *aDestToAdd );        
       
   400     CleanupStack::PopAndDestroy(aDestToAdd);
       
   401     CleanupStack::PopAndDestroy(aImplementation);
       
   402     return retValue;
       
   403     }
       
   404 
       
   405 // -----------------------------------------------------------------------------
       
   406 // RCmDestinationExt::DeleteConnectionMethodL()
       
   407 // -----------------------------------------------------------------------------
       
   408 // 
       
   409 EXPORT_C void RCmDestinationExt::DeleteConnectionMethodL( 
       
   410                                       RCmConnectionMethodExt& aConnectionMethod )
       
   411     {
       
   412     if (!iDestinatonData)
       
   413         {
       
   414         User::Leave(KErrBadHandle);
       
   415         }
       
   416 
       
   417     CCmDestinationImpl* aImplementation = 
       
   418             CCmDestinationImpl::NewLC(iDestinatonData);
       
   419     // Deleting aImplementation will decrement the ref counter
       
   420     iDestinatonData->IncrementRefCounter();
       
   421     CCmPluginBase* connMethod = new (ELeave) 
       
   422                             CCmPluginBase(aConnectionMethod.iImplementation);
       
   423     connMethod->IncrementRefCounter();    
       
   424     CleanupStack::PushL( connMethod );        
       
   425     aImplementation->DeleteConnectionMethodL( 
       
   426                                            *connMethod );
       
   427     CleanupStack::PopAndDestroy(connMethod);
       
   428     CleanupStack::PopAndDestroy(aImplementation);
       
   429     }
       
   430     
       
   431 // -----------------------------------------------------------------------------
       
   432 // RCmDestinationExt::RemoveConnectionMethodL()
       
   433 // -----------------------------------------------------------------------------
       
   434 // 
       
   435 EXPORT_C void RCmDestinationExt::RemoveConnectionMethodL( 
       
   436                                       RCmConnectionMethodExt aConnectionMethod )
       
   437     {
       
   438     if (!iDestinatonData)
       
   439         {
       
   440         User::Leave(KErrBadHandle);
       
   441         }
       
   442 
       
   443     CCmDestinationImpl* aImplementation = 
       
   444             CCmDestinationImpl::NewLC(iDestinatonData);
       
   445     // Deleting aImplementation will decrement the ref counter
       
   446     iDestinatonData->IncrementRefCounter();
       
   447     aImplementation->RemoveConnectionMethodL( 
       
   448                                            *aConnectionMethod.iImplementation );
       
   449     CleanupStack::PopAndDestroy(aImplementation);
       
   450     }
       
   451     
       
   452 // -----------------------------------------------------------------------------
       
   453 // RCmDestinationExt::ModifyPriorityL()
       
   454 // -----------------------------------------------------------------------------
       
   455 //      
       
   456 EXPORT_C void RCmDestinationExt::ModifyPriorityL( 
       
   457                                                 RCmConnectionMethodExt& aCCmItem, 
       
   458                                                 TUint aIndex )
       
   459     {
       
   460     if (!iDestinatonData)
       
   461         {
       
   462         User::Leave(KErrBadHandle);
       
   463         }
       
   464 
       
   465 
       
   466     CCmDestinationImpl* aImplementation = 
       
   467             CCmDestinationImpl::NewLC(iDestinatonData);
       
   468     // Deleting aImplementation will decrement the ref counter
       
   469     iDestinatonData->IncrementRefCounter();
       
   470     CCmPluginBase* connMethod = new (ELeave) 
       
   471                             CCmPluginBase(aCCmItem.iImplementation);
       
   472     connMethod->IncrementRefCounter();    
       
   473     CleanupStack::PushL( connMethod );        
       
   474     aImplementation->ModifyPriorityL( *connMethod, aIndex );
       
   475     CleanupStack::PopAndDestroy(connMethod);
       
   476     CleanupStack::PopAndDestroy(aImplementation);
       
   477     }
       
   478     
       
   479 // -----------------------------------------------------------------------------
       
   480 // RCmDestinationExt::SetNameL()
       
   481 // -----------------------------------------------------------------------------
       
   482 //        
       
   483 EXPORT_C void RCmDestinationExt::SetNameL( const TDesC& aName )
       
   484     {
       
   485     if (!iDestinatonData)
       
   486         {
       
   487         User::Leave(KErrBadHandle);
       
   488         }
       
   489 
       
   490     CCmDestinationImpl* aImplementation = 
       
   491             CCmDestinationImpl::NewLC(iDestinatonData);
       
   492     // Deleting aImplementation will decrement the ref counter
       
   493     iDestinatonData->IncrementRefCounter();
       
   494     aImplementation->SetNameL( aName );
       
   495     CleanupStack::PopAndDestroy(aImplementation);
       
   496     }
       
   497 
       
   498 // -----------------------------------------------------------------------------
       
   499 // RCmDestinationExt::SetIconL()
       
   500 // -----------------------------------------------------------------------------
       
   501 //      
       
   502 EXPORT_C void RCmDestinationExt::SetIconL( TUint32 anIndex )
       
   503     {
       
   504     if (!iDestinatonData)
       
   505         {
       
   506         User::Leave(KErrBadHandle);
       
   507         }
       
   508         
       
   509     if ( anIndex > KNumOfIcons )
       
   510         {
       
   511         User::Leave( KErrArgument );
       
   512         }
       
   513 
       
   514     CCmDestinationImpl* aImplementation = 
       
   515             CCmDestinationImpl::NewLC(iDestinatonData);
       
   516     // Deleting aImplementation will decrement the ref counter
       
   517     iDestinatonData->IncrementRefCounter();
       
   518     aImplementation->SetIconL( anIndex );        
       
   519     CleanupStack::PopAndDestroy(aImplementation);
       
   520     }
       
   521 
       
   522 // -----------------------------------------------------------------------------
       
   523 // RCmDestinationExt::SetMetadataL()
       
   524 // -----------------------------------------------------------------------------
       
   525 //      
       
   526 EXPORT_C void RCmDestinationExt::SetMetadataL( TSnapMetadataField aMetaField, 
       
   527 		                                       TUint32 aValue ) 
       
   528     {
       
   529     if (!iDestinatonData)
       
   530         {
       
   531         User::Leave(KErrBadHandle);
       
   532         }
       
   533 
       
   534     CCmDestinationImpl* aImplementation = 
       
   535             CCmDestinationImpl::NewLC(iDestinatonData);
       
   536     // Deleting aImplementation will decrement the ref counter
       
   537     iDestinatonData->IncrementRefCounter();
       
   538     aImplementation->SetMetadataL( aMetaField, aValue );
       
   539     CleanupStack::PopAndDestroy(aImplementation);
       
   540     }
       
   541 
       
   542 // -----------------------------------------------------------------------------
       
   543 // RCmDestinationExt::SetProtectionL()
       
   544 // -----------------------------------------------------------------------------
       
   545 //  
       
   546 EXPORT_C void RCmDestinationExt::SetProtectionL( TProtectionLevel aProtLevel )
       
   547     {
       
   548     if (!iDestinatonData)
       
   549         {
       
   550         User::Leave(KErrBadHandle);
       
   551         }
       
   552 
       
   553     CCmDestinationImpl* aImplementation = 
       
   554             CCmDestinationImpl::NewLC(iDestinatonData);
       
   555     // Deleting aImplementation will decrement the ref counter
       
   556     iDestinatonData->IncrementRefCounter();
       
   557     aImplementation->SetProtectionL( aProtLevel );
       
   558     CleanupStack::PopAndDestroy(aImplementation);
       
   559     }
       
   560 
       
   561 // -----------------------------------------------------------------------------
       
   562 // RCmDestinationExt::SetHiddenL()
       
   563 // -----------------------------------------------------------------------------
       
   564 //          
       
   565 EXPORT_C void RCmDestinationExt::SetHiddenL( TBool aHidden )
       
   566     {
       
   567     if (!iDestinatonData)
       
   568         {
       
   569         User::Leave(KErrBadHandle);
       
   570         }
       
   571 
       
   572     CCmDestinationImpl* aImplementation = 
       
   573             CCmDestinationImpl::NewLC(iDestinatonData);
       
   574     // Deleting aImplementation will decrement the ref counter
       
   575     iDestinatonData->IncrementRefCounter();
       
   576     aImplementation->SetHiddenL( aHidden );         
       
   577     CleanupStack::PopAndDestroy(aImplementation);
       
   578     }
       
   579 
       
   580 // -----------------------------------------------------------------------------
       
   581 // RCmDestinationExt::UpdateL()
       
   582 // -----------------------------------------------------------------------------
       
   583 //          
       
   584 EXPORT_C void RCmDestinationExt::UpdateL()
       
   585     {
       
   586     if (!iDestinatonData)
       
   587         {
       
   588         User::Leave(KErrBadHandle);
       
   589         }
       
   590 
       
   591     CCmDestinationImpl* aImplementation = 
       
   592             CCmDestinationImpl::NewLC(iDestinatonData);
       
   593     // Deleting aImplementation will decrement the ref counter
       
   594     iDestinatonData->IncrementRefCounter();
       
   595     aImplementation->UpdateL();
       
   596     CleanupStack::PopAndDestroy(aImplementation);
       
   597     }
       
   598 
       
   599 // -----------------------------------------------------------------------------
       
   600 // RCmDestinationExt::DeleteLD()
       
   601 // -----------------------------------------------------------------------------
       
   602 //
       
   603 EXPORT_C void RCmDestinationExt::DeleteLD()
       
   604     {
       
   605     if (!iDestinatonData)
       
   606         {
       
   607         User::Leave(KErrBadHandle);
       
   608         }
       
   609 
       
   610     CCmDestinationImpl* aImplementation = 
       
   611             CCmDestinationImpl::NewLC(iDestinatonData);
       
   612     iDestinatonData->IncrementRefCounter();
       
   613     aImplementation->DeleteLD();  
       
   614     CleanupStack::Pop(aImplementation);
       
   615     iDestinatonData = NULL;
       
   616     }
       
   617 
       
   618 // -----------------------------------------------------------------------------
       
   619 // RCmDestinationExt::IsConnectedL()
       
   620 // -----------------------------------------------------------------------------
       
   621 //
       
   622 EXPORT_C TBool RCmDestinationExt::IsConnectedL() const 
       
   623     {
       
   624     if (!iDestinatonData)
       
   625         {
       
   626         User::Leave(KErrBadHandle);
       
   627         }
       
   628 
       
   629     CCmDestinationImpl* aImplementation = 
       
   630             CCmDestinationImpl::NewLC(iDestinatonData);
       
   631     // Deleting aImplementation will decrement the ref counter
       
   632     iDestinatonData->IncrementRefCounter();
       
   633     TBool retValue = aImplementation->IsConnectedL();    
       
   634     CleanupStack::PopAndDestroy(aImplementation);
       
   635     return retValue;
       
   636     }
       
   637     
       
   638 // -----------------------------------------------------------------------------
       
   639 // RCmDestinationExt::RCmDestinationExt
       
   640 // -----------------------------------------------------------------------------
       
   641 //
       
   642 EXPORT_C RCmDestinationExt::RCmDestinationExt()    
       
   643     : iDestinatonData( NULL )
       
   644     {
       
   645     }
       
   646 
       
   647 // -----------------------------------------------------------------------------
       
   648 // RCmDestinationExt::operator==
       
   649 // -----------------------------------------------------------------------------
       
   650 //
       
   651 EXPORT_C TBool RCmDestinationExt::operator==(const RCmDestinationExt& aDestination ) const
       
   652     {
       
   653     return ( iDestinatonData == aDestination.iDestinatonData );
       
   654     };
       
   655 
       
   656 // -----------------------------------------------------------------------------
       
   657 // RCmDestinationExt::operator!=
       
   658 // -----------------------------------------------------------------------------
       
   659 //
       
   660 EXPORT_C TBool RCmDestinationExt::operator!=(const RCmDestinationExt& aDestination ) const
       
   661     {
       
   662     return !( iDestinatonData == aDestination.iDestinatonData );
       
   663     };
       
   664     
       
   665 // End of file