omaprovisioning/provisioning/IMAdapter/Src/WPIMUtil.cpp
branchRCL_3
changeset 26 19bba8228ff0
parent 25 b183ec05bd8c
equal deleted inserted replaced
25:b183ec05bd8c 26:19bba8228ff0
    24 #include <bautils.h>
    24 #include <bautils.h>
    25 #include "WPIMUtil.h"
    25 #include "WPIMUtil.h"
    26 #include <data_caging_path_literals.hrh>
    26 #include <data_caging_path_literals.hrh>
    27 
    27 
    28 #include <CWPCharacteristic.h>
    28 #include <CWPCharacteristic.h>
    29 #include <cmconnectionmethoddef.h>
    29 #include <ApDataHandler.h>
    30 #include <cmmanagerext.h>
    30 #include <ApAccessPointItem.h>
    31 #include <cmpluginpacketdatadef.h>
    31 #include <ApUtils.h>
    32 #include <commdb.h>
    32 #include <commdb.h>
    33 #include "WPAdapterUtil.h"
    33 #include "WPAdapterUtil.h"
    34 #include <wpwvadapterresource.rsg>
    34 #include <wpwvadapterresource.rsg>
    35 #include <uri16.h>                // TUriParser8
    35 #include <uri16.h>                // TUriParser8
    36 
    36 
    45 
    45 
    46 // -----------------------------------------------------------------------------
    46 // -----------------------------------------------------------------------------
    47 // CWPPecAdapter::FindGPRSL
    47 // CWPPecAdapter::FindGPRSL
    48 // -----------------------------------------------------------------------------
    48 // -----------------------------------------------------------------------------
    49 //
    49 //
    50 TUint32 WPIMUtil::FindGPRSL( 
    50 CApAccessPointItem* WPIMUtil::FindGPRSL( 
    51                                       RPointerArray<CWPCharacteristic>& aLinks )
    51                                       RPointerArray<CWPCharacteristic>& aLinks )
    52 	{
    52 	{
    53 	TUint32 iapID=NULL;
    53 	CCommsDatabase* commDb = CCommsDatabase::NewL();
    54 	RCmManagerExt  cmmanagerExt;
    54 	CleanupStack::PushL( commDb );
    55 	cmmanagerExt.OpenL();
    55 	CApDataHandler* apHandler = CApDataHandler::NewLC( *commDb );
    56 	CleanupClosePushL(cmmanagerExt);
       
    57 	TUint32 bearer = 0;
       
    58 
       
    59 	
    56 	
    60 	for( TInt i( 0 ); i < aLinks.Count(); i++ )
    57     for( TInt i( 0 ); i < aLinks.Count(); i++ )
    61 	   {
    58         {
    62 	   CWPCharacteristic* curr = aLinks[i];
    59         CWPCharacteristic* curr = aLinks[i];
    63 
    60 
    64 	   TPckgBuf<TUint32> uidPckg;
    61         TPckgBuf<TUint32> uidPckg;
    65 	   for( TInt dataNum( 0 ); curr->Data( dataNum ).Length() == uidPckg.MaxLength(); dataNum++ )
    62         for( TInt dataNum( 0 ); curr->Data( dataNum ).Length() == uidPckg.MaxLength(); dataNum++ )
    66 	      {
    63             {
    67 	      uidPckg.Copy( curr->Data( dataNum ) );
    64             uidPckg.Copy( curr->Data( dataNum ) );
    68 	      RCmConnectionMethodExt cm;
    65 
    69 	      cm = cmmanagerExt.ConnectionMethodL( uidPckg() );
    66 			CApAccessPointItem* item = CApAccessPointItem::NewLC();
    70 	      CleanupClosePushL( cm );
    67 	        // Read the access point pointed to by TO-NAPID or TO-PROXY
    71 	      bearer = cm.GetIntAttributeL( CMManager::ECmBearerType );
    68 	        apHandler->AccessPointDataL( uidPckg(), *item );
    72 	      if(bearer == KUidPacketDataBearerType)
    69 
    73 	        {
    70             if( item->BearerTypeL() == EApBearerTypeGPRS )
    74 	        iapID = cm.GetIntAttributeL(CMManager::ECmIapId);
    71                 {
    75 	        CleanupStack::PopAndDestroy(2);
    72 				CleanupStack::Pop(); // item
    76 	        return iapID;
    73 	            CleanupStack::PopAndDestroy( 2 ); // apHandler, commDb
    77 	        }
    74 				return item;
    78 	      CleanupStack::PopAndDestroy();  // cm         
    75                 }
    79 	      }
    76 			CleanupStack::PopAndDestroy( item );
    80 	    }
    77             }
    81 	CleanupStack::PopAndDestroy(); //cmmanagerExt
    78         }
    82 	
    79 
    83 	// This leave is absolutely needed as it pops & destroys 
    80 	// This leave is absolutely needed as it pops & destroys 
    84 	// data in CleanupStack
    81 	// data in CleanupStack
    85   //  User::Leave( KErrNotFound );
    82     User::Leave( KErrNotFound );
    86     return iapID;
    83     return NULL;
    87 	}
    84 	}
    88 
    85 
    89 // -----------------------------------------------------------------------------
    86 // -----------------------------------------------------------------------------
    90 // WPIMUtil::HasIllegalChars
    87 // WPIMUtil::HasIllegalChars
    91 // -----------------------------------------------------------------------------
    88 // -----------------------------------------------------------------------------