cmmanager/cmmgr/Framework/Src/cmconnectionmethodinfo.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 CCmConnectionMethodInfo
       
    15 *
       
    16 */
       
    17 #include <cmpluginbase.h>
       
    18 #include "cmmanagerimpl.h"
       
    19 #include "cmlogger.h"
       
    20 #include "cmconnectionmethodinfo.h"
       
    21 
       
    22 using namespace CommsDat;
       
    23 
       
    24 // ======== LOCAL FUNCTIONS ========
       
    25 
       
    26 
       
    27 // ======== MEMBER FUNCTIONS ========
       
    28 
       
    29 // ---------------------------------------------------------------------------
       
    30 // CCmConnectionMethodInfo::CCmConnectionMethodInfo
       
    31 // ---------------------------------------------------------------------------
       
    32 //
       
    33 CCmConnectionMethodInfo::CCmConnectionMethodInfo( 
       
    34                                                 TCmPluginInitParam *aInitParam )
       
    35     : CCmPluginBaseEng( aInitParam )
       
    36     {
       
    37     CLOG_CREATE;
       
    38     }
       
    39 
       
    40 // ---------------------------------------------------------------------------
       
    41 // CCmConnectionMethodInfo::ConstructL
       
    42 // ---------------------------------------------------------------------------
       
    43 //
       
    44 void CCmConnectionMethodInfo::ConstructL()
       
    45     {
       
    46     // Dummy bearer type
       
    47     iBearerType = KDummyBearerType;
       
    48     
       
    49     CCmPluginBaseEng::ConstructL();
       
    50     }
       
    51 
       
    52 // ---------------------------------------------------------------------------
       
    53 // CCmConnectionMethodInfo::NewL
       
    54 // ---------------------------------------------------------------------------
       
    55 //
       
    56 CCmConnectionMethodInfo* 
       
    57                 CCmConnectionMethodInfo::NewL( TCmPluginInitParam *aInitParam )
       
    58     {
       
    59     CCmConnectionMethodInfo* self = CCmConnectionMethodInfo::NewLC( aInitParam );
       
    60     CleanupStack::Pop( self );
       
    61     return self;
       
    62     }
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // CCmConnectionMethodInfo::NewLC
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 CCmConnectionMethodInfo* 
       
    69                 CCmConnectionMethodInfo::NewLC( TCmPluginInitParam *aInitParam )
       
    70     {
       
    71     CCmConnectionMethodInfo* self = 
       
    72                             new( ELeave ) CCmConnectionMethodInfo( aInitParam );
       
    73     CleanupStack::PushL( self );
       
    74     self->ConstructL();
       
    75     return self;
       
    76     }
       
    77 
       
    78 // ---------------------------------------------------------------------------
       
    79 // CCmConnectionMethodInfo::~CCmConnectionMethodInfo
       
    80 // ---------------------------------------------------------------------------
       
    81 //
       
    82 CCmConnectionMethodInfo::~CCmConnectionMethodInfo()
       
    83     {
       
    84     CLOG_CLOSE;
       
    85     }
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 // CCmConnectionMethodInfo::GetConnectionInfoIntL
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 TUint32 CCmConnectionMethodInfo::GetConnectionInfoIntL( const TUint32 aIapId, 
       
    92                                                  const TUint32 aAttribute )
       
    93     {
       
    94     CCmPluginBase* plugin = CmMgr().GetConnectionMethodL( aIapId );
       
    95     CleanupStack::PushL( plugin );
       
    96      
       
    97     if ( !plugin ) 
       
    98         {
       
    99         User::Leave( KErrNotFound );
       
   100         }
       
   101 
       
   102     ResetAndLoadL( aIapId );
       
   103         
       
   104     TUint32 info = plugin->GetIntAttributeL( aAttribute );
       
   105     CleanupStack::PopAndDestroy( plugin );
       
   106 
       
   107     return info;
       
   108     }
       
   109     
       
   110 // ---------------------------------------------------------------------------
       
   111 // CCmConnectionMethodInfo::GetConnectionInfoBoolL
       
   112 // ---------------------------------------------------------------------------
       
   113 //
       
   114 TBool CCmConnectionMethodInfo::GetConnectionInfoBoolL( const TUint32 aIapId, 
       
   115                                                 const TUint32 aAttribute )
       
   116     {
       
   117     CCmPluginBase* plugin = CmMgr().GetConnectionMethodL( aIapId );
       
   118     CleanupStack::PushL( plugin );
       
   119     
       
   120     if ( !plugin ) 
       
   121         {
       
   122         User::Leave( KErrNotFound );
       
   123         }
       
   124 
       
   125     ResetAndLoadL( aIapId );
       
   126         
       
   127 	TBool info = plugin->GetBoolAttributeL( aAttribute );
       
   128     CleanupStack::PopAndDestroy( plugin );
       
   129     
       
   130     return info;
       
   131 	}
       
   132                                  
       
   133 // ---------------------------------------------------------------------------
       
   134 // CCmConnectionMethodInfo::GetConnectionInfoStringL
       
   135 // ---------------------------------------------------------------------------
       
   136 //
       
   137 HBufC* 
       
   138    CCmConnectionMethodInfo::GetConnectionInfoStringL( const TUint32 aIapId, 
       
   139                                                       const TUint32 aAttribute )
       
   140     {
       
   141     CCmPluginBase* plugin = CmMgr().GetConnectionMethodL( aIapId );
       
   142     CleanupStack::PushL( plugin );
       
   143     
       
   144     if ( !plugin ) 
       
   145         {
       
   146         User::Leave( KErrNotFound );
       
   147         }
       
   148 
       
   149     ResetAndLoadL( aIapId );
       
   150 
       
   151     HBufC* info = plugin->GetStringAttributeL( aAttribute );
       
   152     CleanupStack::PopAndDestroy( plugin );
       
   153     
       
   154     return info;
       
   155     }
       
   156 
       
   157 // ---------------------------------------------------------------------------
       
   158 // CCmConnectionMethodInfo::GetConnectionInfoStringL
       
   159 // ---------------------------------------------------------------------------
       
   160 //
       
   161 HBufC8* CCmConnectionMethodInfo::GetConnectionInfoString8L( 
       
   162                                                      const TUint32 aIapId, 
       
   163                                                      const TUint32 aAttribute )
       
   164     {
       
   165     CCmPluginBase* plugin = CmMgr().GetConnectionMethodL( aIapId );
       
   166     CleanupStack::PushL( plugin );
       
   167     
       
   168     if ( !plugin ) 
       
   169         {
       
   170         User::Leave( KErrNotFound );
       
   171         }
       
   172 
       
   173     ResetAndLoadL( aIapId );
       
   174 
       
   175     HBufC8* info = plugin->GetString8AttributeL( aAttribute );
       
   176     CleanupStack::PopAndDestroy( plugin );
       
   177     
       
   178     return info;
       
   179     }
       
   180 
       
   181 // ---------------------------------------------------------------------------
       
   182 // CCmConnectionMethodInfo::RunSettingsL
       
   183 // ---------------------------------------------------------------------------
       
   184 //
       
   185 TInt CCmConnectionMethodInfo::RunSettingsL()
       
   186     {
       
   187     User::Leave( KErrNotSupported );
       
   188     return KErrNotSupported;
       
   189     }
       
   190 
       
   191 // ---------------------------------------------------------------------------
       
   192 // CCmConnectionMethodInfo::InitializeWithUiL
       
   193 // ---------------------------------------------------------------------------
       
   194 //
       
   195 TBool CCmConnectionMethodInfo::InitializeWithUiL( TBool /*aManuallyConfigure*/ )
       
   196     {
       
   197     User::Leave( KErrNotSupported );
       
   198 
       
   199     return ETrue;
       
   200     }
       
   201 
       
   202 // ---------------------------------------------------------------------------
       
   203 // CCmConnectionMethodInfo::CanHandleIapIdL
       
   204 // ---------------------------------------------------------------------------
       
   205 //
       
   206 TBool CCmConnectionMethodInfo::CanHandleIapIdL( TUint32 /*aIapId*/ ) const
       
   207     {
       
   208     User::Leave( KErrNotSupported );
       
   209     
       
   210     return EFalse;
       
   211     }
       
   212     
       
   213 // ---------------------------------------------------------------------------
       
   214 // CCmConnectionMethodInfo::CanHandleIapIdL
       
   215 // ---------------------------------------------------------------------------
       
   216 //
       
   217 TBool CCmConnectionMethodInfo::CanHandleIapIdL( 
       
   218                                             CCDIAPRecord* /*aIapRecord*/ ) const
       
   219     {
       
   220     User::Leave( KErrNotSupported );
       
   221     
       
   222     return EFalse;
       
   223     }
       
   224 
       
   225 // ---------------------------------------------------------------------------
       
   226 // CCmConnectionMethodInfo::ServiceRecordIdLC
       
   227 // ---------------------------------------------------------------------------
       
   228 //
       
   229 void CCmConnectionMethodInfo::ServiceRecordIdLC( HBufC* &/*aBearerName*/, 
       
   230                                          TUint32& /*aRecordId*/ )
       
   231     {
       
   232     User::Leave( KErrNotSupported );
       
   233     }
       
   234 
       
   235 // ---------------------------------------------------------------------------
       
   236 // CCmConnectionMethodInfo::BearerRecordIdLC
       
   237 // ---------------------------------------------------------------------------
       
   238 //
       
   239 void CCmConnectionMethodInfo::BearerRecordIdLC( HBufC* &/*aBearerName*/, 
       
   240                                          TUint32& /*aRecordId*/ )
       
   241     {
       
   242     User::Leave( KErrNotSupported );
       
   243     }
       
   244 
       
   245 // ---------------------------------------------------------------------------
       
   246 // CCmConnectionMethodInfo::CreateNewServiceRecordL
       
   247 // ---------------------------------------------------------------------------
       
   248 //
       
   249 void CCmConnectionMethodInfo::CreateNewServiceRecordL()
       
   250     {
       
   251     User::Leave( KErrNotSupported );
       
   252     }
       
   253 
       
   254 // ---------------------------------------------------------------------------
       
   255 // CCmConnectionMethodInfo::ResetAndLoadL
       
   256 // ---------------------------------------------------------------------------
       
   257 //
       
   258 void CCmConnectionMethodInfo::ResetAndLoadL( TUint32 aIapId )
       
   259     {
       
   260     if( iIapId != aIapId )
       
   261         {
       
   262         Reset();
       
   263         LoadL( aIapId );
       
   264         }
       
   265     }
       
   266 
       
   267 // ---------------------------------------------------------------------------
       
   268 // CCmConnectionMethodInfo::CopyAdditionalDataL
       
   269 // ---------------------------------------------------------------------------
       
   270 //
       
   271 void CCmConnectionMethodInfo::CopyAdditionalDataL( CCmPluginBaseEng* /*aDestInst*/ )
       
   272     {
       
   273     User::Leave( KErrNotSupported );
       
   274     }
       
   275     
       
   276 // ---------------------------------------------------------------------------
       
   277 // CCmConnectionMethodInfo::CreateInstanceL
       
   278 // ---------------------------------------------------------------------------
       
   279 //
       
   280 CCmPluginBaseEng* CCmConnectionMethodInfo::
       
   281                 CreateInstanceL( TCmPluginInitParam& /*aInitParam*/ ) const
       
   282     {
       
   283     User::Leave( KErrNotSupported );
       
   284     
       
   285     return NULL;
       
   286     }
       
   287     
       
   288 // ---------------------------------------------------------------------------
       
   289 // CCmConnectionMethodInfo::CreateCopyL
       
   290 // ---------------------------------------------------------------------------
       
   291 //
       
   292 CCmPluginBaseEng* CCmConnectionMethodInfo::CreateCopyL() const
       
   293     {
       
   294     User::Leave( KErrNotSupported );
       
   295     
       
   296     return NULL;
       
   297     }
       
   298 
       
   299 // ---------------------------------------------------------------------------
       
   300 // CCmConnectionMethodInfo::ResetIfInMemory
       
   301 // ---------------------------------------------------------------------------
       
   302 //
       
   303 void CCmConnectionMethodInfo::ResetIfInMemory( CCmPluginBaseEng* aCM )
       
   304     {
       
   305     TUint32 cmId = 0;
       
   306     TRAPD( err, cmId = aCM->GetIntAttributeL( CMManager::ECmId ) );
       
   307     if ( KErrNone == err )
       
   308         {
       
   309         if( cmId > 0 && iIapId == cmId )
       
   310             {
       
   311             Reset();
       
   312             TRAP_IGNORE( LoadL( cmId ) );
       
   313             }
       
   314         }
       
   315     }