cmmanager/cmmgr/Framework/Inc/cmmanagerimpl.h
changeset 20 9c97ad6591ae
parent 18 fcbbe021d614
child 21 b8e8e15e80f2
child 23 7ec726f93df1
child 28 860702281757
equal deleted inserted replaced
18:fcbbe021d614 20:9c97ad6591ae
     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 connection method manager
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CMMANAGERIMPL_H
       
    19 #define CMMANAGERIMPL_H
       
    20 
       
    21 // User Includes
       
    22 #include "cmmanager.hrh"
       
    23 #include "cmobjectpool.h"
       
    24 #include "cmconnectionmethodinfo.h"
       
    25 #include <datamobilitycommsdattypes.h>
       
    26 #include <cmmanagerdef.h>
       
    27 #include <cmdefconnvalues.h>
       
    28 #include <cmgenconnsettings.h>
       
    29 
       
    30 // System Includes
       
    31 #include <e32std.h>
       
    32 #include <e32base.h>
       
    33 #include <e32cmn.h>
       
    34 #include <f32file.h>    // RFs
       
    35 #include <barsc.h>      // RResourceFile
       
    36 #include <metadatabase.h>
       
    37 #include <commsdattypesv1_1.h>
       
    38 
       
    39 // Forward Declarations
       
    40 class CCmTransactionHandler;
       
    41 class CCmDestination;
       
    42 class CCmDestinationExt;
       
    43 class CCmDestinationImpl;
       
    44 class CCmPluginBaseEng;
       
    45 class CCmPluginBase;
       
    46 class CImplementationInformation;
       
    47 class TBearerPriority;
       
    48 class RConeResourceLoader;
       
    49 class CCmConnectionMethodInfo;
       
    50 class CGulIcon;
       
    51 class CCDGlobalBearerTypePriorizationRecord;
       
    52 class CCDDataMobilitySelectionPolicyRecord;
       
    53 class TCmPluginInitParam;
       
    54 class CCmDestinationData;
       
    55 class RCmManagerExt;
       
    56 class MCmCommsDatWatcher;
       
    57 class CCmCommsDatNotifier;
       
    58 
       
    59 // DATA TYPES
       
    60 typedef RPointerArray<CImplementationInformation>   RImplInfoPtrArray;
       
    61 typedef CCDGlobalBearerTypePriorizationRecord       CCmBearerPriRec;
       
    62 typedef CCDDataMobilitySelectionPolicyRecord        CCDSnapRecord;
       
    63 
       
    64 typedef struct
       
    65     {
       
    66     RResourceFile       iFile;  // resource file handler
       
    67     TFileName           iFName; // resource filename
       
    68     TInt                iRefs;  // number of references to this res file
       
    69     }TResourceFiles;
       
    70     
       
    71 /*#ifdef _DEBUG
       
    72 void DumIapTableL( CommsDat::CMDBSession& aSession );
       
    73 #define DUMP_IAP_TBL( session )  DumIapTableL( (session) );
       
    74 #else   // _DEBUG
       
    75 #define DUMP_IAP_TBL( session )
       
    76 #endif  // _DEBUG*/
       
    77 
       
    78 /**
       
    79  *  Implementation of connection method manager
       
    80  *
       
    81  *  @lib cmmanager.lib
       
    82  *  @since S60 v3.2
       
    83  */
       
    84 NONSHARABLE_CLASS( CCmManagerImpl ) : public CBase
       
    85       {          
       
    86     // Construction/Destruction
       
    87     public:
       
    88     
       
    89         /** Epoc constructor */
       
    90         static CCmManagerImpl* NewL( TBool aCreateTables = ETrue );
       
    91         
       
    92         /** Destructor */
       
    93         virtual ~CCmManagerImpl();
       
    94         
       
    95     protected:
       
    96     
       
    97         /** First stage constructor */
       
    98         CCmManagerImpl();
       
    99     
       
   100         /** Epoc constructor */
       
   101         void ConstructL(); // second-phase constructor
       
   102         
       
   103     public: // Transaction handling API
       
   104     
       
   105         void OpenTransactionLC( TBool aSetAttribs = ETrue );
       
   106         void CommitTransactionL( TInt aError );
       
   107         void RollbackTransaction();
       
   108         
       
   109         // This will be called when the first UI view is on
       
   110         void StartCommsDatNotifierL();
       
   111         
       
   112     public: // Basic CM attribute query API
       
   113     
       
   114         /**
       
   115         * GetBearerInfoXXX function can be used to query
       
   116         * bearer informantion that doesn't belong
       
   117         * to a specific connection method, such as 
       
   118         * ECmCoverage or ECmDefaultPriority etc.
       
   119         * HBuf ownership is passed to the caller
       
   120         */
       
   121         IMPORT_C TUint32 GetBearerInfoIntL( TUint32 aBearerType,
       
   122                                             TUint32 aAttribute ) const;
       
   123         IMPORT_C TBool GetBearerInfoBoolL( TUint32 aBearerType,
       
   124                                            TUint32 aAttribute ) const;
       
   125         IMPORT_C HBufC* GetBearerInfoStringL( TUint32 aBearerType,
       
   126                                               TUint32 aAttribute ) const;
       
   127         IMPORT_C HBufC8* GetBearerInfoString8L( TUint32 aBearerType,
       
   128                                                 TUint32 aAttribute ) const;
       
   129                     
       
   130         /**
       
   131         * GetConnectionMethodInfoXXX function can be used to 
       
   132         * query any, non-bearer specific information about
       
   133         * a given connection method. This can be e.g. ECmBearerType,
       
   134         * ECmName, ECmStartPage etc.
       
   135         * HBuf ownership is passed to the caller
       
   136         */
       
   137         IMPORT_C TUint32 GetConnectionMethodInfoIntL( 
       
   138                                                 TUint32 aCmId,
       
   139                                                 TUint32 aAttribute ) const;
       
   140         IMPORT_C TBool GetConnectionMethodInfoBoolL( 
       
   141                                                 TUint32 aCmId,
       
   142                                                 TUint32 aAttribute ) const;
       
   143         IMPORT_C HBufC* GetConnectionMethodInfoStringL( 
       
   144                                                 TUint32 aCmId,
       
   145                                                 TUint32 aAttribute ) const;
       
   146         IMPORT_C HBufC8* GetConnectionMethodInfoString8L( 
       
   147                                                 TUint32 aCmId,
       
   148                                                 TUint32 aAttribute ) const;
       
   149                 
       
   150                     
       
   151     //=========================================================================
       
   152     // Creation/Destruction API
       
   153     //
       
   154     public:
       
   155               
       
   156         /**
       
   157         * Creates a Destination by the given name
       
   158         *
       
   159         * @since 3.2
       
   160         * @param aName the name of the new destination
       
   161         * @return CCmDestination*, ownership is passed to the caller
       
   162         */
       
   163         CCmDestinationImpl* CreateDestinationL( const TDesC& aName );
       
   164 
       
   165         /**
       
   166         * Creates a Destination by the given name
       
   167         *
       
   168         * @since 3.2
       
   169         * @param aName the name of the new destination
       
   170         * @param aDestId Predefined id for the destination
       
   171         * @return CCmDestination*, ownership is passed to the caller
       
   172         */
       
   173         CCmDestinationImpl* CreateDestinationL( const TDesC& aName,
       
   174                                                 TUint32      aDestId );
       
   175 
       
   176         
       
   177         /**
       
   178         * Creates a connection method does not belong to any destination
       
   179         *
       
   180         * @since 3.2
       
   181         * @param aImplementationUid - implementation uid of the connection 
       
   182         * method
       
   183         * @param aParentDestination - the destination which holds the 
       
   184         *                             connection method, NULL means there is
       
   185         *                             no parent
       
   186         * @return CCmPluginBase*
       
   187         */
       
   188         CCmPluginBase* CreateConnectionMethodL( TUint32 aBearerType,
       
   189                             CCmDestinationImpl* aParentDestination = NULL );
       
   190 
       
   191         /**
       
   192         * Creates a connection method does not belong to any destination
       
   193         *
       
   194         * @since 3.2
       
   195         * @param aImplementationUid - implementation uid of the connection 
       
   196         * method
       
   197         * @param aConnMethodId Predefined id for the connection method
       
   198         * @param aParentDestination - the destination which holds the 
       
   199         *                             connection method, NULL means there is
       
   200         *                             no parent
       
   201         * @return CCmPluginBase*
       
   202         */
       
   203         CCmPluginBase* CreateConnectionMethodL( TUint32 aBearerType,
       
   204         		            TUint32 aConnMethodId,             
       
   205                             CCmDestinationImpl* aParentDestination = NULL );
       
   206         
       
   207         /**
       
   208         * Creates a connection method does not belong to any destination
       
   209         *
       
   210         * @since 3.2
       
   211         * @param pluginBaseEng - Object to put in the pool
       
   212         * @return CCmPluginBase*
       
   213         */
       
   214         CCmPluginBase* CreateConnectionMethodL( 
       
   215                             CCmPluginBaseEng* pluginBaseEng );
       
   216 
       
   217         /**
       
   218         * Insert a connection method does not belong to any destination
       
   219         * API doesn't use CCmPluginBase. So, nothing returns
       
   220         *
       
   221         * @param pluginBaseEng - Object to put in the pool
       
   222         */
       
   223         void InsertConnectionMethodL( 
       
   224                             CCmPluginBaseEng* pluginBaseEng );
       
   225         
       
   226         /**
       
   227         * Creates a connection method does not belong to any destination
       
   228         *
       
   229         * @since 3.2
       
   230         * @param aBearerType - implementation uid of the connection 
       
   231         * method
       
   232         * @param aParams - the destination which holds the 
       
   233         *                             connection method, NULL means there is
       
   234         *                             no parent
       
   235         * @return CCmPluginBaseEng*
       
   236         */
       
   237         CCmPluginBaseEng* DoCreateConnectionMethodL( TUint32 aBearerType,
       
   238                                        TCmPluginInitParam& aParams );
       
   239 
       
   240         /**
       
   241         * Creates a connection method does not belong to any destination
       
   242         *
       
   243         * @since 3.2
       
   244         * @param aBearerType Implementation uid of the connection 
       
   245         * method
       
   246         * @param aParams Initialization params for the plugin.
       
   247         * @param aConnMethodId Predefined id for the connection method.
       
   248         * @return CCmPluginBaseEng*
       
   249         */
       
   250         CCmPluginBaseEng* DoCreateConnectionMethodL( TUint32 aBearerType,
       
   251             TCmPluginInitParam& aParams, TUint32 aConnMethodId );
       
   252 
       
   253     //=========================================================================
       
   254     // Getter-Setter API
       
   255     //
       
   256     public:    
       
   257             
       
   258         /**
       
   259         * Calls FeatureManager::FeatureSupported directly.
       
   260         *
       
   261         * @since 3.2
       
   262         * @param aFeature feature ID
       
   263         * @return feature support status
       
   264         * @since 3.2
       
   265         */
       
   266         static TBool FeatureSupported( TInt aFeature );
       
   267         
       
   268         /**
       
   269         * Obsolete
       
   270         */
       
   271         IMPORT_C CCmPluginBaseEng* ConnectionMethodL( TUint32 aCmId );
       
   272 
       
   273         /**
       
   274         * Return the connection method queried by it's ID
       
   275         *
       
   276         * @since 3.2
       
   277         * @param aCmId
       
   278         * @return CCmPluginBase*
       
   279         */
       
   280         IMPORT_C CCmPluginBase* GetConnectionMethodL( TUint32 aCmId );
       
   281         
       
   282         /**
       
   283         * Return the list of connection methods do not belongs to any 
       
   284         * destination
       
   285         *
       
   286         * @since 3.2
       
   287         * @param aCMArray on return it is the array of IAP ids.
       
   288         * @param aCheckBearerType If ETrue only connection methods with 
       
   289         *                         supported bearer types are returned
       
   290         * @param aLegacyOnly when set to ETrue only Legacy IAP ids will
       
   291         *                         be returned
       
   292         * @param aEasyWlan when set to ETrue EasyWlan id is returned, too
       
   293         * @param aSortByBearer if ETrue the CMs will be ordered according
       
   294         *                      to global bearer priority
       
   295         */        
       
   296         IMPORT_C void ConnectionMethodL( RArray<TUint32>& aCMArray,
       
   297                                          TBool aCheckBearerType = ETrue,
       
   298                                          TBool aLegacyOnly = ETrue,
       
   299                                          TBool aEasyWlan = EFalse,
       
   300                                          TBool aSortByBearer = EFalse );
       
   301         /**
       
   302         * Return an array of all destinations
       
   303         *
       
   304         * @since 3.2
       
   305         * @param aDestArray on return it returns an array of destination ids
       
   306         */
       
   307         IMPORT_C void AllDestinationsL( RArray<TUint32>& aDestArray );
       
   308 
       
   309         /**
       
   310         * Return the number of destinations
       
   311         *
       
   312         * @since 3.2
       
   313         * @return the number of destinations
       
   314         */
       
   315         inline TUint DestinationCountL() { return iDestinationCount; }
       
   316 
       
   317         /**
       
   318         * Return the destination implementation to which a specified 
       
   319         * connection method belongs, search is by destination ID ( the
       
   320         * id which is made by RECORD_FROM_ELEMENT_ID from the elementID)
       
   321         * If the  destination implementation is allready in the  object
       
   322         * pool returns it. If it is not in the pool than puts it in the
       
   323         * pool using the GetDestinationL funciton.
       
   324         *
       
   325         * @since 3.2
       
   326         * @param aId
       
   327         * @return a pointer to a destination
       
   328         */
       
   329         IMPORT_C CCmDestinationImpl* DestinationL( TUint32 aId );
       
   330         
       
   331         /**
       
   332         * Removes the destination implementation 
       
   333         * from the object pool
       
   334         *
       
   335         * @since 3.2
       
   336         * @param aId
       
   337         */
       
   338         IMPORT_C void RemoveDestFromPool( CCmDestinationImpl* aDestination );
       
   339         
       
   340         /**
       
   341         * Removes the destination implementation 
       
   342         * from the object pool
       
   343         *
       
   344         * @since 3.2
       
   345         * @param aId
       
   346         */
       
   347         void RemoveDestFromPool( CCmDestinationData* aDestination );
       
   348         
       
   349         /**
       
   350         * Removes the cm 
       
   351         * from the object pool
       
   352         *
       
   353         * @since 3.2
       
   354         */
       
   355         void RemoveCMFromPoolL( CCmPluginBaseEng* aCM );
       
   356         
       
   357         /**
       
   358         * Removes the cm 
       
   359         * from the object pool
       
   360         *
       
   361         * @since 3.2
       
   362         */
       
   363         void RemoveCMFromPoolL( CCmPluginBase* aCM );
       
   364 
       
   365         /**
       
   366         * The destination have been updated if it was a new destination
       
   367         * than the zero id must be changed to the new one 
       
   368         *
       
   369         * @param aDestination - the destination to change
       
   370         */         
       
   371         void DestinationUpdated( CCmDestinationImpl* aDestination );
       
   372               
       
   373         /**
       
   374         * Copie a connection method belonging to one destination to 
       
   375         * another. The connection method becomes shared.
       
   376         *
       
   377         * @since 3.2
       
   378         * @param aTargetDestination target destination
       
   379         * @param aConnectionMethodId connection method to be copied
       
   380         * @return index in the Connection Method list
       
   381         */
       
   382         TInt CopyConnectionMethodL( CCmDestinationImpl& aTargetDestination,
       
   383                                     CCmPluginBase& aConnectionMethod );
       
   384         
       
   385         /**
       
   386         * Move a connection method belonging to one destination to 
       
   387         * another. The connection method is removed from the source destination
       
   388         *
       
   389         * @since 3.2
       
   390         * @param aSourceDestination source destination
       
   391         * @param aTargetDestination target destination
       
   392         * @param aConnectionMethod connection method to be moved
       
   393         * @return index in the Connection Method list which the connection 
       
   394         *         method has been moved to
       
   395         */
       
   396         TInt MoveConnectionMethodL( CCmDestinationImpl& aSourceDestination,
       
   397                                     CCmDestinationImpl& aTargetDestination,
       
   398                                     CCmPluginBase& aConnectionMethod );
       
   399         
       
   400         /**
       
   401         * Remove connection method from the destination
       
   402         *
       
   403         * @since 3.2
       
   404         * @param aDestination destination the connection method is attached to
       
   405         * @param aConnectionMethod connection method to be removed
       
   406         */
       
   407         void RemoveConnectionMethodL( CCmDestinationImpl& aDestination,
       
   408                                       CCmPluginBase& aConnectionMethod );
       
   409 
       
   410         /**
       
   411         * Return the copy of the bearer priority array. Ownership is passed.
       
   412         *
       
   413         * @since 3.2
       
   414         * @param aArray bearer priority array
       
   415         */          
       
   416         void BearerPriorityArrayL( RArray<TBearerPriority>& aArray ) const;
       
   417         
       
   418         /*
       
   419         * Update bearer priority array
       
   420         *
       
   421         * @since 3.2
       
   422         * @param aArray array with new global bearer priority
       
   423         */          
       
   424         void UpdateBearerPriorityArrayL( const RArray<TBearerPriority>& aArray );
       
   425         
       
   426         /**
       
   427         * Clean up passed global bearer priority array. Delete
       
   428         * the elements and calls Reset and Close on the array.
       
   429         *
       
   430         * @since 3.2
       
   431         * @param aArray array to be cleaned up
       
   432         */
       
   433         void CleanupGlobalPriorityArray( RArray<TBearerPriority>& aArray ) const;
       
   434         
       
   435         /**
       
   436         * Search service type in the global priority table and
       
   437         * Return its priority.
       
   438         *
       
   439         * @since 3.2
       
   440         * @param aUiPriority ETrue if UI priority is requested
       
   441         * @param aServiceType serched service type 
       
   442         * @return priority of the service type or KErrNotFound
       
   443         */
       
   444         TInt GlobalBearerPriority( TBool aUiPriority, 
       
   445                                    const TDesC& aServiceType ) const;
       
   446                                    
       
   447         /*
       
   448         * Query all of the supported bearer types.
       
   449         *
       
   450         * @since 3.2
       
   451         * @param aArray list of all supported bearer types.
       
   452         */          
       
   453         void SupportedBearersL( RArray<TUint32>& aArray ) const;
       
   454         
       
   455         /*
       
   456         * Return "Uncategorized" icon.
       
   457         * This fucton leaves if the client does not have a valid UI context
       
   458         *
       
   459         * @since 3.2
       
   460         * @return CGulIcon icon of uncategorized connection methods.
       
   461         */          
       
   462         CGulIcon* UncategorizedIconL() const;
       
   463 
       
   464         /**
       
   465         * Returns the id of the EasyWlan connection method.
       
   466         *
       
   467         * @since S60 3.2
       
   468         * @return id of the EasyWLan connection method. 0 if not found
       
   469         */
       
   470         IMPORT_C TUint32 EasyWlanIdL();
       
   471 
       
   472         /**
       
   473         * Create a SNAP record object and load it if record id not 0.
       
   474         * @param aRecordId record Id. 0 means create only
       
   475         * @return created/loaded SNAP record
       
   476         */
       
   477         CCDSnapRecord* SNAPRecordL( TUint32 aRecordId ) const;
       
   478 
       
   479         CCDSnapRecord* CreateSNAPRecordL( TUint32 aRecordId ) const;
       
   480     
       
   481         /**
       
   482         * Tells the CmManager that the given default connection is deleted,
       
   483         * and it sets Default Connection to Always Ask (default value).
       
   484         *
       
   485         * @since S60 3.2
       
   486         */
       
   487         void HandleDefConnDeletedL( TCmDefConnValue& aDCSetting );
       
   488         /**
       
   489         * Returns the default connection method/SNAP.
       
   490         *
       
   491         * @since S60 3.2
       
   492         */
       
   493         void ReadDefConnL( TCmDefConnValue& aDCSetting );   
       
   494         /**
       
   495         * Stores the default connection method/SNAP.
       
   496         *
       
   497         * @since S60 3.2
       
   498         */
       
   499         void WriteDefConnL( const TCmDefConnValue& aDCSetting );  
       
   500         /**
       
   501         * Returns the default connection method/SNAP.
       
   502         *
       
   503         * @since S60 3.2
       
   504         */
       
   505         void ReadDefConnWoTransL( TCmDefConnValue& aDCSetting );   
       
   506         /**
       
   507         * Stores the default connection method/SNAP.
       
   508         *
       
   509         * @since S60 3.2
       
   510         */
       
   511         void WriteDefConnWoTransL( const TCmDefConnValue& aDCSetting );  
       
   512         /**
       
   513         * Returs ETrue if Default Connection feature is supported.
       
   514         *
       
   515         * @since S60 3.2
       
   516         */        
       
   517         TBool IsDefConnSupported();
       
   518         /**
       
   519         * Check if memory low so that process can continue
       
   520         */
       
   521         TBool IsMemoryLow(); 
       
   522         /**
       
   523         * Returns the general connection settings.
       
   524         */
       
   525         void ReadGenConnSettingsL( TCmGenConnSettings& aGenConnSettings );
       
   526         /**
       
   527         * Replaces the general connection settings.
       
   528         */
       
   529         void ReplaceGenConnSettingsL( const TCmGenConnSettings& aGenConnSettings );
       
   530         /**
       
   531         * Writes the general connection settings.
       
   532         */
       
   533         void WriteGenConnSettingsL( const TCmGenConnSettings& aGenConnSettings );
       
   534         
       
   535                 
       
   536     //=========================================================================
       
   537     // Resource handling
       
   538     //
       
   539     public:
       
   540         
       
   541         /** add resource file */
       
   542         void AddResourceFileL( TFileName& aName );
       
   543         
       
   544         /** 
       
   545         * Remove resource file from array only if
       
   546         * the reference count is zero.
       
   547         * @param aName name of the resource file to be removed
       
   548         */
       
   549         void RemoveResourceFile( TFileName& aName );
       
   550 
       
   551         /**
       
   552         * Read string from resource
       
   553         *
       
   554         * @since 3.2
       
   555         * @param aResourceId resource id of the localized string
       
   556         * @return localized string
       
   557         */
       
   558         HBufC* AllocReadL( TInt aResourceId ) const;    
       
   559     
       
   560     //=========================================================================
       
   561     // CM related functions
       
   562     //
       
   563     public:
       
   564         
       
   565         /**
       
   566         * Return the number of references to the given connection method id
       
   567         * in the DN_IAP table
       
   568         *
       
   569         * @since 3.2
       
   570         * @param aId ID of the connection method        
       
   571         * @param aRecSet entire record set of the detination table
       
   572         * @return number of references to the connection method in DN_IAP table
       
   573         */
       
   574         TUint32 NumOfConnMethodReferencesL( 
       
   575             TUint32 aId,
       
   576             CommsDat::CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* aRecSet = NULL 
       
   577             );
       
   578         
       
   579         /**
       
   580         * Indicates is at least one non-"level 1 protected" destinations
       
   581         *
       
   582         * @since S60 3.2
       
   583         * @return ETrue if at least one level 1 protected destination
       
   584         */
       
   585         TBool HasUnprotectedDestinationsL();
       
   586         
       
   587         /**
       
   588         * Walks through every connection methods to find out
       
   589         * if the passed connection method is linked to any of them.
       
   590         * @param aPlugin connection method to be checked
       
   591         * @return ETrue if linked
       
   592         */
       
   593         TBool IsIapLinkedL( const CCmPluginBaseEng& aPlugin );
       
   594         
       
   595         /**
       
   596         * Removes all references to this CM from SNAP table.
       
   597         */
       
   598         void RemoveAllReferencesL( const CCmPluginBaseEng& aPlugin );
       
   599 
       
   600         /**
       
   601         * Removes all references to this CM from SNAP table without
       
   602         * transaction to commsdat.
       
   603         */
       
   604         void RemoveAllReferencesWoTransL( const CCmPluginBaseEng& aPlugin );
       
   605 
       
   606         /**
       
   607         * Return the bearer type of connection method.
       
   608         *
       
   609         * @since 3.2
       
   610         * @param aId id of the connection method
       
   611         * @return bearer type of the connection method
       
   612         */
       
   613         TUint32 BearerTypeFromCmIdL( TUint32 aCmId );
       
   614                 
       
   615         /**
       
   616         * Return the bearer type of connection method.
       
   617         *
       
   618         * @since 3.2
       
   619         * @param aIapRecord CommsDat record of the connection method
       
   620         * @return bearer type of the connection method
       
   621         */
       
   622         TUint32 BearerTypeFromIapRecordL( CommsDat::CCDIAPRecord* aIapRecord ) const;
       
   623 
       
   624     private:
       
   625     
       
   626         /**
       
   627         * Find and create a connection method.
       
   628         *
       
   629         * @since 3.2
       
   630         * @param aCmId id of the connection method
       
   631         * @aParentDest parent destination of the connection method. Can be NULL.
       
   632         */
       
   633         CCmPluginBase* DoFindConnMethodL( TUint32 aCmId, 
       
   634                               CCmDestinationImpl* aParentDest );
       
   635     
       
   636         /**
       
   637         * Find and create a connection method.
       
   638         *
       
   639         * @since 3.2
       
   640         * @param aCmId id of the connection method
       
   641         * @aParentDest parent destination of the connection method. Can be NULL.
       
   642         */
       
   643         CCmPluginBaseEng* DoFindConnMethL( TUint32 aCmId, 
       
   644                                CCmDestinationImpl* aParentDest );
       
   645 
       
   646         /**
       
   647         * Check the existence of tables we need.
       
   648         * Creates if it is not exist, get the table id otherwise
       
   649         */
       
   650         void CheckTablesL();
       
   651 
       
   652     public:
       
   653     
       
   654         /**
       
   655         * Return the destination network table ID
       
   656         *
       
   657         * @since 3.2
       
   658         * @return iDestinationTableId element id of the destination table
       
   659         */        
       
   660         inline CommsDat::TMDBElementId DestinationTableId() const { return iDestinationTableId; };
       
   661         
       
   662         /**
       
   663         * Return Global Bearer Type Priorization Table ID
       
   664         *
       
   665         * @since 3.2
       
   666         * @return element id of the bearer type priority.
       
   667         */        
       
   668         inline CommsDat::TMDBElementId BearerTypePriorizationTableId() const { return iBearerTypePriorizationTableId; };
       
   669         
       
   670         /**
       
   671         * Return the Destination network - Icon table ID
       
   672         *
       
   673         * @since 3.2
       
   674         * @return element id of the icon table.
       
   675         */        
       
   676         inline CommsDat::TMDBElementId IconTableId() const { return iIconTableId; };
       
   677         
       
   678         /**
       
   679         * Return true if help is on in the FeatureManager
       
   680         *
       
   681         * @since 3.2
       
   682         * @return TBool.
       
   683         */        
       
   684         inline TBool IsHelpOn() const { return iHelp; };
       
   685 
       
   686         /**
       
   687         * Return the Seamlessness table ID
       
   688         *
       
   689         * @since 3.2
       
   690         * @return element id of the seamlessness table.
       
   691         */        
       
   692         inline CommsDat::TMDBElementId SeamlessnessTableId() const { return iSeamlessnessTableId; };
       
   693         
       
   694         /**
       
   695         * Checks if the current environment has the given capability.
       
   696         * Leaves with KErrPermissionDenied if capability is missing. 
       
   697         *
       
   698         * @since 3.2
       
   699         * @param aCapability capability to be checked
       
   700         */
       
   701         static void HasCapabilityL( TCapability aCapability );
       
   702         
       
   703         /**
       
   704         * Return an array of all IAP records.
       
   705         * @return array of all IAP records
       
   706         */
       
   707         CommsDat::CMDBRecordSet<CommsDat::CCDIAPRecord>* AllIapsL();
       
   708         
       
   709         /**
       
   710         * Return all the SNAP record. Filtering can be made on 
       
   711         * passed SNAP elemented id.
       
   712         * @return array of SNAP records
       
   713         */
       
   714         CommsDat::CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* 
       
   715                     CCmManagerImpl::AllSNAPRecordsL( TUint32 aSnapElementId );
       
   716         
       
   717     public:
       
   718     
       
   719         CommsDat::CMDBSession& Session() const;
       
   720 
       
   721         /**
       
   722         * Wraps this implementation to an RCmManagerExt. OWNERSHIP IS NOT PASSED
       
   723         * , SO NEVER CLOSE aCmManagerExt!!!
       
   724         *
       
   725         * @since 3.2
       
   726         * @param aCmManagerExt class to wrap implementation into
       
   727         */
       
   728         
       
   729         IMPORT_C void WrapCmManager( RCmManagerExt& aCmManagerExt );
       
   730      
       
   731         /** Remove the virtual methods from the passed list
       
   732         *
       
   733         * @since 3.2
       
   734         * @param aCmDataArray array that contains the connection methods to be filtered
       
   735         */
       
   736         IMPORT_C void FilterOutVirtualsL( RPointerArray<CCmPluginBase>& aCmDataArray );
       
   737 
       
   738         /** Create a 'flat list' of connection methods of a given destination
       
   739         * ( connection methods inside embedded destinations which are in the destination,
       
   740         * are also present in the list ) and
       
   741         * order them according to the bearer type prioritisation rules
       
   742         * and return the result in aCmArray.        
       
   743         *
       
   744         * @since 3.2
       
   745         * @param aDestination destination that contains the connection methods
       
   746         * for uncategorised connection methods, use KDestItemUncategorized
       
   747         * @param aCmArray array to return the result
       
   748         */
       
   749 
       
   750         IMPORT_C void CreateFlatCMListL( TUint32 aDestination ,
       
   751                                         RPointerArray<CCmPluginBase>& aCmArray );        
       
   752                                         
       
   753         /** Create a 'flat list' of connection methods of a given destination
       
   754         * ( connection methods inside embedded destinations which are in the destination,
       
   755         * are also present in the list ) and
       
   756         * order them according to the bearer type prioritisation rules
       
   757         * and return the result in aCmArray.        
       
   758         * LC version        
       
   759         *
       
   760         * @since 3.2
       
   761         * @param aDestination destination that contains the connection methods
       
   762         * for uncategorised connection methods, use KDestItemUncategorized
       
   763         * @param aCmArray array to return the result
       
   764         */
       
   765         IMPORT_C void CreateFlatCMListLC( TUint32 aDestination ,
       
   766                                         RPointerArray<CCmPluginBase>& aCmArray );        
       
   767       
       
   768         
       
   769         /** Get a list of uncategorised connection methods in an RPointerArray 
       
   770         * contains the parameters passed to ConnectionMethodL
       
   771         *
       
   772         * @since 3.2
       
   773         * @param aCmArray the returned list of uncategorised connection methods
       
   774         * @param aCheckBearerType see ConnectionMethodL
       
   775         * @param aLegacyOnly see ConnectionMethodL
       
   776         * @param aEasyWlan see ConnectionMethodL
       
   777         * @param aSortByBearer see ConnectionMethodL
       
   778         */
       
   779         void AppendUncatCmListL(RPointerArray<CCmPluginBase>& aCmArray,
       
   780                                          TBool aCheckBearerType = ETrue,
       
   781                                          TBool aLegacyOnly = ETrue,
       
   782                                          TBool aEasyWlan = EFalse,
       
   783                                          TBool aSortByBearer = EFalse );
       
   784         
       
   785         /** Get a list of uncategorised connection methods in an RPointerArray 
       
   786         * contains the parameters passed to ConnectionMethodL
       
   787         * LC version
       
   788         *
       
   789         * @since 3.2
       
   790         * @param aCmArray the returned list of uncategorised connection methods
       
   791         * @param aCheckBearerType see ConnectionMethodL
       
   792         * @param aLegacyOnly see ConnectionMethodL
       
   793         * @param aEasyWlan see ConnectionMethodL
       
   794         * @param aSortByBearer see ConnectionMethodL
       
   795         */
       
   796         void AppendUncatCmListLC(RPointerArray<CCmPluginBase>& aCmArray,
       
   797                                          TBool aCheckBearerType = ETrue,
       
   798                                          TBool aLegacyOnly = ETrue,
       
   799                                          TBool aEasyWlan = EFalse,
       
   800                                          TBool aSortByBearer = EFalse );
       
   801         
       
   802         /**
       
   803         * Returns a list of references to the connection methods in the destination. 
       
   804         *
       
   805         * @since 3.2
       
   806         * @param aPluginArray A pointer array to hold the values
       
   807         * ownership is passed
       
   808         */
       
   809         void AppendCmListL( TUint32 aDestintaionId, RPointerArray<CCmPluginBase>& aCmArray);
       
   810         
       
   811         /**
       
   812         * Returns a list of references to the connection methods in the destination. 
       
   813         *
       
   814         * @since 3.2
       
   815         * @param aPluginArray A pointer array to hold the values
       
   816         * ownership is passed
       
   817         */
       
   818         // and puts it on the CleanupStack
       
   819         void AppendCmListLC( TUint32 aDestintaionId, RPointerArray<CCmPluginBase>& aCmArray);
       
   820 
       
   821         /**
       
   822         * Returns a list of references to the connection methods in the supported uid list . 
       
   823         *
       
   824         * @since 3.2
       
   825         * @param aPluginArray A pointer array to hold the values
       
   826         * ownership is passed
       
   827         */
       
   828         void AppendCmListFromUidsL( RArray<TUint32>& cmIdList, RPointerArray<CCmPluginBase>& aCMArray );        
       
   829 
       
   830         /**
       
   831         * Returns internet destination id. If internety destination is not found then -1 is returned.
       
   832         *
       
   833         * @since 5.0
       
   834         * @return Internet destination id
       
   835         */
       
   836         TUint32 GetInternetDestinationIdL();
       
   837         
       
   838         /**
       
   839         * Register aWatcher as watcher for change of CommsDat
       
   840         */
       
   841         IMPORT_C void WatcherRegisterL( MCmCommsDatWatcher* aWatcher );
       
   842         
       
   843         /**
       
   844          * UnRegister current watcher
       
   845          */
       
   846         IMPORT_C void WatcherUnRegister();
       
   847         
       
   848         /*
       
   849          * Find if aDest is still existed if some change is watched
       
   850          */
       
   851         IMPORT_C TBool DestinationStillExistedL( CCmDestinationImpl* aDest );
       
   852         
       
   853         /*
       
   854          * Find if an Iap is still existed if some change is watched
       
   855          * 
       
   856          * The Iap, as parameter, is contained in the instance aPlugin
       
   857          */        
       
   858         IMPORT_C TBool IapStillExistedL( const CCmPluginBaseEng& aPlugin );
       
   859         
       
   860         /*
       
   861          * Find if an Iap is still in aDest if some change is watched
       
   862          * 
       
   863          * The Iap, as parameter, is contained in the instance aPlugin
       
   864          */
       
   865         IMPORT_C TBool IsIapStillInDestL( CCmDestinationImpl* aDest, const CCmPluginBaseEng& aPlugin );
       
   866 
       
   867     private:
       
   868             
       
   869         /**
       
   870         * Creates bearer priority array
       
   871         *
       
   872         * @since 3.2
       
   873         */          
       
   874         void CreateBearerPriorityArrayL();   
       
   875         
       
   876         /**
       
   877         * Look for the given resource file in the resource
       
   878         * file array and return the index value of it.
       
   879         *
       
   880         * @since 3.2
       
   881         * @param aName resource file name, not localized
       
   882         * @return index of the resource file in the array
       
   883         */
       
   884         TInt FindResourceFile( TFileName& aName ) const;
       
   885         
       
   886         /**
       
   887         * Build an array of all bearer specific plugins.
       
   888         *
       
   889         * @since 3.2
       
   890         */
       
   891         void BuildPluginArrayL();
       
   892     
       
   893         /**
       
   894         * Return the copy of the bearer priority array. Ownership is passed.
       
   895         *
       
   896         * @since 3.2
       
   897         * @param aArray bearer priority array
       
   898         */          
       
   899         void CopyBearerPriorityArrayL( RArray<TBearerPriority>& aArray ) const;
       
   900         
       
   901         /**
       
   902         * Return if the IAP record points to an EasyWLan service record.
       
   903         *
       
   904         * @since 3.2
       
   905         * @param aIapRecord IAP record to be checked
       
   906         * @return ETrue if AP is EasyWLan
       
   907         */
       
   908         TBool IsEasyWLanL( CommsDat::CCDIAPRecord* aIapRecord ) const;
       
   909         
       
   910         /**
       
   911         * Replaces the Default Connection record with the new one.
       
   912         *
       
   913         * @since 3.2
       
   914         * @param aDCSetting Default Connection value to set
       
   915         */
       
   916         void ReplaceDefConnRecordL( const TCmDefConnValue aDCSetting );
       
   917         
       
   918         /**
       
   919         * Combines two lists of CCmPluginBase pointers into one, according to default
       
   920         * priority order
       
   921         *
       
   922         * @since 3.2
       
   923         * @param aCmArray first list of connection methods to combine
       
   924         * @param aCmLinkedArray second list of connection methods to combine
       
   925         */
       
   926         void CombineArraysForPriorityOrderL( 
       
   927                                         RPointerArray<CCmPluginBase>& aCmArray , 
       
   928                                         RPointerArray<CCmPluginBase>& aCmLinkedArray );        
       
   929 
       
   930 
       
   931         /**
       
   932         * Gets the destination for the given element ID
       
   933         *
       
   934         * @since 3.2
       
   935         * @param aCmId The element ID of the destination
       
   936         * @return Id of the parent
       
   937         */
       
   938         TUint32 ParentDestinationL( TUint32 aCmId );
       
   939                 
       
   940         /**
       
   941         * Returns the default general connection values.
       
   942         *
       
   943         * @since 9.2
       
   944         * @param aGenConnSettings The general connection settings structure
       
   945         */
       
   946         void SetGenConnSettingsToDefault( TCmGenConnSettings& aGenConnSettings );
       
   947         
       
   948         /** 
       
   949          * Leaves if no sufficient is available for creation operations
       
   950          * 
       
   951          * @since 9.2
       
   952          */
       
   953         void CheckAvailableSpaceL();
       
   954         
       
   955 	    /**
       
   956          * Get Snap Table ID from CommsDat
       
   957          */
       
   958         TUint32 GetSnapTableIdL();
       
   959 
       
   960         /**
       
   961          * Check if the attribute is bearerspecific
       
   962          *
       
   963          * @since 9.2
       
   964          * @param aAttribute  attribute-id to be checked
       
   965          * @return ETrue if aAttribute is bearerspecific, otherwise EFalse
       
   966          */
       
   967         TBool IsBearerSpecific( TUint32 aAttribute ) const;
       
   968         
       
   969 #include "cmmanagerimpl.inl"               
       
   970     //=========================================================================
       
   971     // Member data
       
   972         
       
   973     private:
       
   974     
       
   975         CCmTransactionHandler*          iTrans;
       
   976         
       
   977         RFs                             iFs;
       
   978         CArrayPtrFlat<TResourceFiles>*  iResourceFiles;
       
   979         
       
   980         // Destination network table ID
       
   981         CommsDat::TMDBElementId iDestinationTableId;
       
   982         //Global Bearer Type Priorization Table
       
   983         CommsDat::TMDBElementId iBearerTypePriorizationTableId;
       
   984         // Destination network - Icon table
       
   985         CommsDat::TMDBElementId iIconTableId;
       
   986         // Destination network - Icon table
       
   987         CommsDat::TMDBElementId iSeamlessnessTableId;        
       
   988         // Default Connection table
       
   989         CommsDat::TMDBElementId iDefConnTableId;        
       
   990         // Bearer priorities
       
   991         RArray<TBearerPriority>* iBearerPriorityArray;
       
   992         
       
   993         CArrayPtrFlat<const CCmPluginBaseEng>* iPlugins;
       
   994         
       
   995         CCmConnectionMethodInfo* iPluginImpl;
       
   996         
       
   997         TUint iDestinationCount;
       
   998         
       
   999         CCMObjectPool* iObjectPool;
       
  1000               
       
  1001         // for the FeatureManager
       
  1002         TBool iIsFeatureManagerInitialised;
       
  1003         TBool iHelp;
       
  1004         TBool iDefConnSupported;
       
  1005         TBool iCreateTables;
       
  1006         TBool iWLan;
       
  1007                
       
  1008         // For CommsDat watcher
       
  1009         CCmCommsDatNotifier* iCommsDatIapNotifier;
       
  1010         CCmCommsDatNotifier* iCommsDatSnapNotifier;
       
  1011     private:
       
  1012     
       
  1013         friend class CCmDestinationImpl;
       
  1014         friend class CCMObjectPool;
       
  1015         friend class CCmConnectionMethodInfo;
       
  1016     };
       
  1017 
       
  1018 #endif // CMMANAGERIMPL_H