ncdengine/engine/accesspointmanager/src/catalogsaccesspointmanagerimpl.cpp
branchRCL_3
changeset 25 7333d7932ef7
parent 0 ba25891c3a9e
child 26 8b7f4e561641
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 #include "catalogsaccesspointmanagerimpl.h"
    19 #include "catalogsaccesspointmanagerimpl.h"
    20 
    20 
       
    21 #ifdef _0
    21 #include <ApUtils.h>
    22 #include <ApUtils.h>
    22 #include <ApSelect.h> 
    23 #include <ApSelect.h> 
    23 #include <ApDataHandler.h>
    24 #include <ApDataHandler.h>
       
    25 #endif
       
    26 
    24 #include <badesca.h>
    27 #include <badesca.h>
    25 
    28 
    26 #include "catalogsaccesspoint.h"
    29 #include "catalogsaccesspoint.h"
    27 #include "catalogsaccesspointsettings.h"
    30 #include "catalogsaccesspointsettings.h"
    28 #include "catalogsaccesspointmap.h"
    31 #include "catalogsaccesspointmap.h"
    59 _LIT(KSubCatalogs, "subCatalogs");
    62 _LIT(KSubCatalogs, "subCatalogs");
    60 _LIT(KDownloadAccessPoint, "downloadingAccessPoint");
    63 _LIT(KDownloadAccessPoint, "downloadingAccessPoint");
    61 _LIT(KBrowseAccessPoint, "browsingAccessPoint");
    64 _LIT(KBrowseAccessPoint, "browsingAccessPoint");
    62 _LIT(KPurchaseAccessPoint, "purchasingAccessPoint");
    65 _LIT(KPurchaseAccessPoint, "purchasingAccessPoint");
    63 
    66 
       
    67 #ifdef _0
    64 // literals used for access point settings in client configuration protocol (in alphabetical order)
    68 // literals used for access point settings in client configuration protocol (in alphabetical order)
    65 _LIT(KApName, "name");
    69 _LIT(KApName, "name");
    66 
    70 
    67 
    71 
    68 _LIT(KApCdmaDisablePlainTextAuth, "EApCdmaDisablePlainTextAuth");
    72 _LIT(KApCdmaDisablePlainTextAuth, "EApCdmaDisablePlainTextAuth");
   150 _LIT(KApWlanIPNameServer2, "EApWlanIPNameServer2");
   154 _LIT(KApWlanIPNameServer2, "EApWlanIPNameServer2");
   151 _LIT(KApWlanIpNetMask, "EApWlanIpNetMask");
   155 _LIT(KApWlanIpNetMask, "EApWlanIpNetMask");
   152 
   156 
   153 _LIT(KWapWspOptionConnectionless, "EWapWspOptionConnectionless");
   157 _LIT(KWapWspOptionConnectionless, "EWapWspOptionConnectionless");
   154 _LIT(KWapWspOptionConnectionOriented, "EWapWspOptionConnectionOriented");
   158 _LIT(KWapWspOptionConnectionOriented, "EWapWspOptionConnectionOriented");
   155 
   159 #endif
   156 
   160 
   157 CCatalogsAccessPointManager::CCatalogsAccessPointManager(
   161 CCatalogsAccessPointManager::CCatalogsAccessPointManager(
   158     CNcdGeneralManager& aGeneralManager ) :
   162     CNcdGeneralManager& aGeneralManager ) :
   159     iGeneralManager( aGeneralManager ),
   163     iGeneralManager( aGeneralManager ),
   160     iStorageManager( aGeneralManager.StorageManager() ), 
   164     iStorageManager( aGeneralManager.StorageManager() ), 
   563     const MCatalogsAccessPointManager::TAction& aAction,
   567     const MCatalogsAccessPointManager::TAction& aAction,
   564     const TUid& aClientUid,
   568     const TUid& aClientUid,
   565     TUint32& aAccessPointId) 
   569     TUint32& aAccessPointId) 
   566     {
   570     {
   567     DLTRACEIN((_L("Namespace: %S, CatalogId: %S, Action: %d, clientUid: %d"), &aNameSpace, &aCatalogId, aAction, aClientUid.iUid));
   571     DLTRACEIN((_L("Namespace: %S, CatalogId: %S, Action: %d, clientUid: %d"), &aNameSpace, &aCatalogId, aAction, aClientUid.iUid));
       
   572     
   568     CCatalogsAccessPoint* accessPoint( NULL );
   573     CCatalogsAccessPoint* accessPoint( NULL );
   569     CCatalogsClientAccessPointData* apData( NULL );
   574     CCatalogsClientAccessPointData* apData( NULL );
   570     TInt err = GetAccessPoint( accessPoint, apData );
   575     TInt err = GetAccessPoint( accessPoint, apData );
   571     if ( err != KErrNone ) 
   576     if ( err != KErrNone ) 
   572         {
   577         {
   591     TUint32& aAccessPointId) 
   596     TUint32& aAccessPointId) 
   592     {
   597     {
   593     DLTRACEIN((_L("Namespace: %S, NodeId: %S, Action: %d, clientUid: %d"),
   598     DLTRACEIN((_L("Namespace: %S, NodeId: %S, Action: %d, clientUid: %d"),
   594                &aNodeIdentifier.NodeNameSpace(), &aNodeIdentifier.NodeId(), aAction,
   599                &aNodeIdentifier.NodeNameSpace(), &aNodeIdentifier.NodeId(), aAction,
   595                aClientUid.iUid));
   600                aClientUid.iUid));
   596 
   601     
   597     CCatalogsAccessPoint* accessPoint( NULL );
   602     CCatalogsAccessPoint* accessPoint( NULL );
   598     CCatalogsClientAccessPointData* apData( NULL );
   603     CCatalogsClientAccessPointData* apData( NULL );
   599     TInt err = GetAccessPoint( accessPoint, apData );
   604     TInt err = GetAccessPoint( accessPoint, apData );
   600     if ( err != KErrNone ) 
   605     if ( err != KErrNone ) 
   601         {
   606         {
   709 
   714 
   710     return accessPoint;
   715     return accessPoint;
   711     }
   716     }
   712             
   717             
   713     
   718     
   714 TBool CCatalogsAccessPointManager::ValidateAccessPointL( CCatalogsAccessPoint* aAccessPoint )
   719 TBool CCatalogsAccessPointManager::ValidateAccessPointL( CCatalogsAccessPoint* /* aAccessPoint */ )
   715     {
   720     {
   716     DLTRACEIN((""));
   721     DLTRACEIN((""));
       
   722     
   717 #ifdef __WINS__
   723 #ifdef __WINS__
   718     // Comms database is not accessible in emulator.
   724     // Comms database is not accessible in emulator.
   719     return EFalse;
   725     return EFalse;
   720 #endif
   726 #endif
   721     CCommsDatabase *commdb = CCommsDatabase::NewL( /*EDatabaseTypeIAP*/ );
   727 
       
   728 #ifdef _0
       
   729     CCommsDatabase *commdb = CCommsDatabase::NewL( /* EDatabaseTypeIAP */);
   722     CleanupStack::PushL( commdb );
   730     CleanupStack::PushL( commdb );
   723     CApSelect*  select;
   731     CApSelect*  select;
   724     select = CApSelect::NewLC(
   732     select = CApSelect::NewLC(
   725         *commdb,
   733         *commdb,
   726         KEApIspTypeAll,
   734         KEApIspTypeAll,
   763         return matching;        
   771         return matching;        
   764         }        
   772         }        
   765             
   773             
   766     // Someone has altered the access point settings.
   774     // Someone has altered the access point settings.
   767     CleanupStack::PopAndDestroy(4);
   775     CleanupStack::PopAndDestroy(4);
       
   776 #endif
       
   777     
   768     return EFalse;
   778     return EFalse;
   769     }
   779     }
   770 
   780 
   771 TBool CCatalogsAccessPointManager::MatchInCommsDbL( const CCatalogsAccessPointSettings& aSettings, TUint32& aId )
   781 TBool CCatalogsAccessPointManager::MatchInCommsDbL( const CCatalogsAccessPointSettings& /* aSettings */, TUint32& /* aId */)
   772     {
   782     {
   773     DLTRACEIN(_L("Checking comms DB for matching access point"));
   783     DLTRACEIN(_L("Checking comms DB for matching access point"));
       
   784     
   774 #ifdef __WINS__
   785 #ifdef __WINS__
   775     // Comms database is not accessible in emulator.
   786     // Comms database is not accessible in emulator.
   776     return EFalse;
   787     return EFalse;
   777 #endif
   788 #endif
   778     
   789     
   779     CCommsDatabase *commdb = CCommsDatabase::NewL( /*EDatabaseTypeIAP*/ );
   790 #ifdef _0
       
   791     CCommsDatabase *commdb = CCommsDatabase::NewL( /* EDatabaseTypeIAP */ );
   780     CleanupStack::PushL( commdb );
   792     CleanupStack::PushL( commdb );
   781     CApSelect*  select;
   793     CApSelect*  select;
   782     select = CApSelect::NewLC(
   794     select = CApSelect::NewLC(
   783         *commdb,
   795         *commdb,
   784         KEApIspTypeAll,
   796         KEApIspTypeAll,
   814         return ETrue;
   826         return ETrue;
   815         }        
   827         }        
   816         
   828         
   817     CleanupStack::PopAndDestroy( 4, commdb ); // util, handler, select, commdb
   829     CleanupStack::PopAndDestroy( 4, commdb ); // util, handler, select, commdb
   818     DLTRACEOUT(("Matching AP not found"));
   830     DLTRACEOUT(("Matching AP not found"));
       
   831 #endif
       
   832     
   819     return EFalse;
   833     return EFalse;
   820     }
   834     }
   821 
   835 
   822 void CCatalogsAccessPointManager::CreateApToCommsDBL( const CCatalogsAccessPoint& aSettings, TUint32& aId )
   836 void CCatalogsAccessPointManager::CreateApToCommsDBL( const CCatalogsAccessPoint& /* aSettings */, TUint32& /* aId */ )
   823     {
   837     {
   824     DLTRACEIN(_L("Creating AP to comms DB"));
   838     DLTRACEIN(_L("Creating AP to comms DB"));
       
   839     
   825 #ifdef __WINS__
   840 #ifdef __WINS__
   826     // Comms database is not accessible in emulator.
   841     // Comms database is not accessible in emulator.
   827     return;
   842     return;
   828 #endif
   843 #endif
   829     CCommsDatabase *commdb = CCommsDatabase::NewL( /*EDatabaseTypeIAP*/ );
   844 
       
   845 #ifdef _0
       
   846     CCommsDatabase *commdb = CCommsDatabase::NewL( /*EDatabaseTypeIAP */);
   830     CleanupStack::PushL( commdb );
   847     CleanupStack::PushL( commdb );
   831     
   848     
   832     CApDataHandler*     handler = CApDataHandler::NewLC( *commdb );        
   849     CApDataHandler*     handler = CApDataHandler::NewLC( *commdb );        
   833     CApAccessPointItem* newAp = CApAccessPointItem::NewLC();
   850     CApAccessPointItem* newAp = CApAccessPointItem::NewLC();
   834 
   851 
   894         }
   911         }
   895 
   912 
   896     CApUtils* util = CApUtils::NewLC( *commdb );
   913     CApUtils* util = CApUtils::NewLC( *commdb );
   897     aId = util->IapIdFromWapIdL( wapId );
   914     aId = util->IapIdFromWapIdL( wapId );
   898     CleanupStack::PopAndDestroy( 4, commdb ); // commDb, handler, newAp, util
   915     CleanupStack::PopAndDestroy( 4, commdb ); // commDb, handler, newAp, util
       
   916     
       
   917 #endif
   899     DLTRACEOUT(("Access point created to comms DB"));
   918     DLTRACEOUT(("Access point created to comms DB"));
   900     }
   919     }
   901 
   920 
       
   921 #ifdef _0
   902 HBufC16* CCatalogsAccessPointManager::ReadText16L( CApAccessPointItem* aItem, const TApMember& aApMember )
   922 HBufC16* CCatalogsAccessPointManager::ReadText16L( CApAccessPointItem* aItem, const TApMember& aApMember )
   903     {
   923     {
   904     TInt length = aItem->ReadTextLengthL( aApMember );
   924     TInt length = aItem->ReadTextLengthL( aApMember );
   905     if( length == 0 )
   925     if( length == 0 )
   906         {
   926         {
   924     TPtr8 ptr( buffer->Des());
   944     TPtr8 ptr( buffer->Des());
   925     aItem->ReadTextL( aApMember, ptr );
   945     aItem->ReadTextL( aApMember, ptr );
   926     CleanupStack::Pop(); // buffer
   946     CleanupStack::Pop(); // buffer
   927     return buffer;
   947     return buffer;
   928     }
   948     }
   929 
   949 #endif
   930 
   950 
   931 void CCatalogsAccessPointManager::RemoveAccessPointsFromCommsDbL(
   951 void CCatalogsAccessPointManager::RemoveAccessPointsFromCommsDbL(
   932     TBool aAddShutdownOperation )
   952     TBool aAddShutdownOperation )
   933     {
   953     {
   934     
   954     
   978     
   998     
   979     delete iClientAccessPointData;
   999     delete iClientAccessPointData;
   980     iClientAccessPointData = NULL;
  1000     iClientAccessPointData = NULL;
   981     }
  1001     }
   982 
  1002 
   983 void CCatalogsAccessPointManager::RemoveApFromCommsDatabaseL( const TUint32& aId )
  1003 void CCatalogsAccessPointManager::RemoveApFromCommsDatabaseL( const TUint32& /* aId */ )
   984     {
  1004     {
   985     DLTRACEIN(("aId: %u", aId ));
  1005     
       
  1006 #ifdef _0
   986     CCommsDatabase *commdb = CCommsDatabase::NewL( EDatabaseTypeIAP );
  1007     CCommsDatabase *commdb = CCommsDatabase::NewL( EDatabaseTypeIAP );
   987     CleanupStack::PushL( commdb );
  1008     CleanupStack::PushL( commdb );
   988     CApDataHandler* dataHandler = CApDataHandler::NewLC( *commdb );
  1009     CApDataHandler* dataHandler = CApDataHandler::NewLC( *commdb );
   989     CApUtils* util = CApUtils::NewLC( *commdb );
  1010     CApUtils* util = CApUtils::NewLC( *commdb );
   990     TUint32 wapId = util->WapIdFromIapIdL( aId );
  1011     TUint32 wapId = util->WapIdFromIapIdL( aId );
   991     dataHandler->RemoveAPL( wapId );
  1012     dataHandler->RemoveAPL( wapId );
   992     
  1013     
   993     CleanupStack::PopAndDestroy( 3, commdb ); // util, dataHandler, commdb
  1014     CleanupStack::PopAndDestroy( 3, commdb ); // util, dataHandler, commdb
       
  1015 #endif
   994     }
  1016     }
   995 
  1017 
   996     
  1018     
   997 void CCatalogsAccessPointManager::LoadFromStorageL() 
  1019 void CCatalogsAccessPointManager::LoadFromStorageL() 
   998     {
  1020     {
  1054     // Calls ExternalizeL for this
  1076     // Calls ExternalizeL for this
  1055     item->WriteDataL();
  1077     item->WriteDataL();
  1056     item->SaveL();    
  1078     item->SaveL();    
  1057     }
  1079     }
  1058 
  1080 
  1059     
  1081 #ifdef _0   
  1060 TBool CCatalogsAccessPointManager::MatchingSettingsL(
  1082 TBool CCatalogsAccessPointManager::MatchingSettingsL(
  1061     const CCatalogsAccessPointSettings& aSettings, CApAccessPointItem& aItem) 
  1083     const CCatalogsAccessPointSettings& aSettings, CApAccessPointItem& aItem) 
  1062     {
  1084     {
  1063     DLTRACEIN(("Checking for matching AP settings"));
  1085     DLTRACEIN(("Checking for matching AP settings"));
  1064 
  1086 
  1186     
  1208     
  1187     // Setting are correct.
  1209     // Setting are correct.
  1188     DLTRACEOUT(("Matching settings"));
  1210     DLTRACEOUT(("Matching settings"));
  1189     return ETrue;
  1211     return ETrue;
  1190     }
  1212     }
  1191     
  1213 #endif   
  1192     
  1214     
  1193 void CCatalogsAccessPointManager::SetApDetailL(
  1215 void CCatalogsAccessPointManager::SetApDetailL(
  1194     CCatalogsAccessPoint& aAp, const TDesC& aKey, const TDesC& aValue ) 
  1216     CCatalogsAccessPoint& /* aAp */, const TDesC& /* aKey */, const TDesC& /* aValue */ ) 
  1195     {
  1217     {
       
  1218     
       
  1219 #ifdef _0
  1196     DLTRACEIN((""));
  1220     DLTRACEIN((""));
  1197     TBool value = EFalse;
  1221     TBool value = EFalse;
  1198     
  1222     
  1199     if (aKey == KApName) 
  1223     if (aKey == KApName) 
  1200         {
  1224         {
  1581         }
  1605         }
  1582     else 
  1606     else 
  1583         {
  1607         {
  1584         DLWARNING(( _L("Unknown access point detail: %S"), &aKey));
  1608         DLWARNING(( _L("Unknown access point detail: %S"), &aKey));
  1585         }
  1609         }
       
  1610 #endif
  1586     }
  1611     }
  1587     
  1612     
  1588 
  1613 
  1589 TInt CCatalogsAccessPointManager::GetAccessPoint( 
  1614 TInt CCatalogsAccessPointManager::GetAccessPoint( 
  1590     CCatalogsAccessPoint*& aAccessPoint,
  1615     CCatalogsAccessPoint*& aAccessPoint,