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 <ApDataHandler.h> |
29 #include <cmconnectionmethoddef.h> |
30 #include <ApAccessPointItem.h> |
30 #include <cmmanagerext.h> |
31 #include <ApUtils.h> |
31 #include <cmpluginpacketdatadef.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 CApAccessPointItem* WPIMUtil::FindGPRSL( |
50 TUint32 WPIMUtil::FindGPRSL( |
51 RPointerArray<CWPCharacteristic>& aLinks ) |
51 RPointerArray<CWPCharacteristic>& aLinks ) |
52 { |
52 { |
53 CCommsDatabase* commDb = CCommsDatabase::NewL(); |
53 TUint32 iapID=NULL; |
54 CleanupStack::PushL( commDb ); |
54 RCmManagerExt cmmanagerExt; |
55 CApDataHandler* apHandler = CApDataHandler::NewLC( *commDb ); |
55 cmmanagerExt.OpenL(); |
56 |
56 CleanupClosePushL(cmmanagerExt); |
57 for( TInt i( 0 ); i < aLinks.Count(); i++ ) |
57 TUint32 bearer = 0; |
58 { |
58 |
59 CWPCharacteristic* curr = aLinks[i]; |
59 |
60 |
60 for( TInt i( 0 ); i < aLinks.Count(); i++ ) |
61 TPckgBuf<TUint32> uidPckg; |
61 { |
62 for( TInt dataNum( 0 ); curr->Data( dataNum ).Length() == uidPckg.MaxLength(); dataNum++ ) |
62 CWPCharacteristic* curr = aLinks[i]; |
63 { |
63 |
64 uidPckg.Copy( curr->Data( dataNum ) ); |
64 TPckgBuf<TUint32> uidPckg; |
65 |
65 for( TInt dataNum( 0 ); curr->Data( dataNum ).Length() == uidPckg.MaxLength(); dataNum++ ) |
66 CApAccessPointItem* item = CApAccessPointItem::NewLC(); |
66 { |
67 // Read the access point pointed to by TO-NAPID or TO-PROXY |
67 uidPckg.Copy( curr->Data( dataNum ) ); |
68 apHandler->AccessPointDataL( uidPckg(), *item ); |
68 RCmConnectionMethodExt cm; |
69 |
69 cm = cmmanagerExt.ConnectionMethodL( uidPckg() ); |
70 if( item->BearerTypeL() == EApBearerTypeGPRS ) |
70 CleanupClosePushL( cm ); |
71 { |
71 bearer = cm.GetIntAttributeL( CMManager::ECmBearerType ); |
72 CleanupStack::Pop(); // item |
72 if(bearer == KUidPacketDataBearerType) |
73 CleanupStack::PopAndDestroy( 2 ); // apHandler, commDb |
73 { |
74 return item; |
74 iapID = cm.GetIntAttributeL(CMManager::ECmIapId); |
75 } |
75 CleanupStack::PopAndDestroy(2); |
76 CleanupStack::PopAndDestroy( item ); |
76 return iapID; |
77 } |
77 } |
78 } |
78 CleanupStack::PopAndDestroy(); // cm |
79 |
79 } |
|
80 } |
|
81 CleanupStack::PopAndDestroy(); //cmmanagerExt |
|
82 |
80 // This leave is absolutely needed as it pops & destroys |
83 // This leave is absolutely needed as it pops & destroys |
81 // data in CleanupStack |
84 // data in CleanupStack |
82 User::Leave( KErrNotFound ); |
85 // User::Leave( KErrNotFound ); |
83 return NULL; |
86 return iapID; |
84 } |
87 } |
85 |
88 |
86 // ----------------------------------------------------------------------------- |
89 // ----------------------------------------------------------------------------- |
87 // WPIMUtil::HasIllegalChars |
90 // WPIMUtil::HasIllegalChars |
88 // ----------------------------------------------------------------------------- |
91 // ----------------------------------------------------------------------------- |