ipcm_pub/connection_settings_api/inc/cmmanager.h
changeset 0 5a93021fdf25
child 20 9c97ad6591ae
equal deleted inserted replaced
-1:000000000000 0:5a93021fdf25
       
     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:  Connection manager IF class.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CMMANAGER_H
       
    19 #define CMMANAGER_H
       
    20 
       
    21 // System Includes
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 #include <e32cmn.h>
       
    25 #include <cmdefconnvalues.h>
       
    26 #include <cmgenconnsettings.h>
       
    27 
       
    28 // Forward Declarations
       
    29 class RCmConnectionMethod;
       
    30 class RCmDestination;
       
    31 class CCmManagerImpl;
       
    32 class TBearerPriority;
       
    33 class CGulIcon;
       
    34 
       
    35 /**
       
    36  *  RCmManager gives access to network destinations and connection methods.
       
    37  *
       
    38  *  @lib cmmanager.lib
       
    39  *  @since S60 v3.2
       
    40  */
       
    41 NONSHARABLE_CLASS(RCmManager)
       
    42       {          
       
    43     //=====================================================================
       
    44     // Constructors/Destructors
       
    45     // 
       
    46     public:
       
    47     
       
    48         /**
       
    49         * Default constructor. 
       
    50         */
       
    51         inline RCmManager();
       
    52 
       
    53     //=====================================================================
       
    54     // API functions
       
    55     public:
       
    56         
       
    57         /**
       
    58         * Symbian constructor
       
    59         *
       
    60         * @since S60 3.2
       
    61         */
       
    62         IMPORT_C void OpenL();    
       
    63         
       
    64         /**
       
    65         * Symbian constructor
       
    66         * Pushes the object on the cleanup stack
       
    67         *
       
    68         * @since S60 3.2
       
    69         */
       
    70         IMPORT_C void OpenLC();    
       
    71         
       
    72         /**
       
    73         * Secondary destructor
       
    74         *
       
    75         * @since S60 3.2
       
    76         */
       
    77         IMPORT_C void Close();
       
    78         
       
    79     //=======================================================================
       
    80     // Getter API
       
    81     public:    
       
    82       
       
    83         /**
       
    84         * Used to query bearer information that doesn't belong
       
    85         * to a specific connection method, such as 
       
    86         * ECmCoverage or ECmDefaultPriority etc.
       
    87         *
       
    88         * @since S60 3.2
       
    89         * @param aBearerType the bearer
       
    90         * @param aAttribute the setting value
       
    91         * @return the setting value
       
    92         */
       
    93         IMPORT_C TUint32 GetBearerInfoIntL( TUint32 aBearerType,
       
    94                                   TUint32 aAttribute ) const;
       
    95                                   
       
    96         
       
    97         /**
       
    98         * Used to query bearer information that doesn't belong
       
    99         * to a specific connection method, such as 
       
   100         * ECmCoverage or ECmDefaultPriority etc.
       
   101         *
       
   102         * @since S60 3.2
       
   103         * @param aBearerType the bearer
       
   104         * @param aAttribute the setting value
       
   105         * @return the setting value
       
   106         */
       
   107         IMPORT_C TBool GetBearerInfoBoolL( TUint32 aBearerType,
       
   108                                  TUint32 aAttribute ) const;
       
   109         /**
       
   110         * Used to query bearer information that doesn't belong
       
   111         * to a specific connection method, such as 
       
   112         * ECmCoverage or ECmDefaultPriority etc.
       
   113         * HBuf ownership is passed to the caller
       
   114         *
       
   115         * @since S60 3.2
       
   116         * @param aBearerType the bearer
       
   117         * @param aAttribute the setting value
       
   118         * @return the setting value
       
   119         */        
       
   120         IMPORT_C HBufC* GetBearerInfoStringL( TUint32 aBearerType,
       
   121                                     TUint32 aAttribute ) const;
       
   122         /**
       
   123         * Used to query bearer information that does not belong
       
   124         * to a specific connection method, such as 
       
   125         * ECmCoverage or ECmDefaultPriority, etc.
       
   126         * HBuf ownership is passed to the caller
       
   127         *
       
   128         * @since S60 3.2
       
   129         * @param aBearerType the bearer
       
   130         * @param aAttribute the setting value
       
   131         * @return the setting value
       
   132         */
       
   133         IMPORT_C HBufC8* GetBearerInfoString8L( TUint32 aBearerType,
       
   134                                     TUint32 aAttribute ) const;
       
   135                     
       
   136         /**
       
   137         * Used to query any non-bearer specific information about
       
   138         * a given connection method. This can be e.g. ECmBearerType,
       
   139         * ECmName, ECmStartPage, etc.
       
   140         *
       
   141         * @since S60 3.2
       
   142         * @param aIapId the connection method id
       
   143         * @param aAttribute the setting value
       
   144         * @return the setting value
       
   145         */
       
   146         IMPORT_C TUint32 GetConnectionMethodInfoIntL( TUint32 aIapId,
       
   147                                              TUint32 aAttribute ) const;
       
   148         
       
   149         /**
       
   150         * Used to query any, non-bearer specific information about
       
   151         * a given connection method. This can be e.g. ECmBearerType,
       
   152         * ECmName, ECmStartPage, etc.
       
   153         *
       
   154         * @since S60 3.2
       
   155         * @param aIapId the connection method id
       
   156         * @param aAttribute the setting value
       
   157         * @return the setting value
       
   158         */
       
   159         IMPORT_C TBool GetConnectionMethodInfoBoolL( TUint32 aIapId,
       
   160                                             TUint32 aAttribute ) const;
       
   161 
       
   162         /**
       
   163         * Used to query any non-bearer specific information about
       
   164         * a given connection method. This can be e.g. ECmBearerType,
       
   165         * ECmName, ECmStartPage, etc.
       
   166         * HBuf ownership is passed to the caller
       
   167         *
       
   168         * @since S60 3.2
       
   169         * @param aIapId the connection method id
       
   170         * @param aAttribute the setting value
       
   171         * @return the setting value
       
   172         */
       
   173         IMPORT_C HBufC* GetConnectionMethodInfoStringL( TUint32 aIapId,
       
   174                                                TUint32 aAttribute ) const;
       
   175 
       
   176         /**
       
   177         * Used to query any non-bearer specific information about
       
   178         * a given connection method. This can be e.g. ECmBearerType,
       
   179         * ECmName, ECmStartPage, etc.
       
   180         * HBuf ownership is passed to the caller
       
   181         *
       
   182         * @since S60 3.2
       
   183         * @param aIapId the connection method id
       
   184         * @param aAttribute the setting value
       
   185         * @return the setting value
       
   186         */
       
   187         IMPORT_C HBufC8* GetConnectionMethodInfoString8L( TUint32 aIapId,
       
   188                                                TUint32 aAttribute ) const;
       
   189                 
       
   190         /**
       
   191         * Returns the connection method queried by its ID
       
   192         *
       
   193         * @since S60 3.2
       
   194         * @param aConnectionMethodId id of the connection method
       
   195         * @return RCmConnectionMethod connection method
       
   196         */
       
   197         IMPORT_C RCmConnectionMethod ConnectionMethodL( 
       
   198                                      TUint32 aConnectionMethodId ) const;
       
   199                         
       
   200         /**
       
   201         * Returns the list of connection methods. Connection Methods are 
       
   202         * filtered by the switch parameters e.g. aLegacyOnly.
       
   203         *
       
   204         * @since S60 3.2
       
   205         * @param aCMArray on return it is the array of IAP ids.
       
   206         * @param aCheckBearerType If ETrue only connection methods with 
       
   207         *                         supported bearer type are returned
       
   208         * @param aLegacyOnly when set to ETrue only Legacy IAP ids will
       
   209         *                         be returned
       
   210         * @param aEasyWlan when set to ETrue EasyWlan id is returned, too
       
   211         */
       
   212         IMPORT_C void ConnectionMethodL( RArray<TUint32>& aCMArray, 
       
   213                                          TBool aCheckBearerType = ETrue,
       
   214                                          TBool aLegacyOnly = ETrue,
       
   215                                          TBool aEasyWlan = EFalse ) const;
       
   216         
       
   217         /**
       
   218         * Returns an array of all destination id's
       
   219         *
       
   220         * @since S60 3.2
       
   221         * @param aDestArray list all available destinations' id
       
   222         */ 
       
   223         IMPORT_C void AllDestinationsL( RArray<TUint32>& aDestArray ) const;
       
   224 
       
   225         /**
       
   226         * Returns the destination to which a specified 
       
   227         * connection method belongs, search is by destination ID
       
   228         *
       
   229         * @since S60 3.2
       
   230         * @param aDestinationId id of destination
       
   231         * @return RCmDestination network destination 
       
   232         */
       
   233         IMPORT_C RCmDestination DestinationL( TUint32 aDestinationId ) const;
       
   234        
       
   235         /**
       
   236         * Returns the copy of the bearer priority array. Ownership is passed.
       
   237         *
       
   238         * @since S60 3.2
       
   239         * @param aArray bearer priority array
       
   240         */          
       
   241         IMPORT_C void BearerPriorityArrayL( 
       
   242                                    RArray<TBearerPriority>& aArray ) const;
       
   243        
       
   244         /**
       
   245         * Clean up passed global bearer priority array. Delete
       
   246         * the elements and calls Reset and Close on the array.
       
   247         *
       
   248         * @since S60 3.2
       
   249         * @param aArray array to be cleaned up
       
   250         */
       
   251         IMPORT_C void CleanupGlobalPriorityArray( 
       
   252                                    RArray<TBearerPriority>& aArray ) const;
       
   253         
       
   254         /**
       
   255         * Returns the id of the EasyWlan connection method.
       
   256         *
       
   257         * @since S60 3.2
       
   258         * @return id of the EasyWLan connection method. 0 if not found.
       
   259         */
       
   260         IMPORT_C TUint32 EasyWlanIdL() const;
       
   261         
       
   262         /**
       
   263         * Returns the default connection method/SNAP.
       
   264         *
       
   265         * @since S60 3.2
       
   266         */
       
   267         IMPORT_C void ReadDefConnL( TCmDefConnValue& aDCSetting );
       
   268 
       
   269         /**
       
   270         * Stores the default connection method/SNAP.
       
   271         *
       
   272         * @since S60 3.2
       
   273         */
       
   274         IMPORT_C void WriteDefConnL( const TCmDefConnValue& aDCSetting );  
       
   275 
       
   276 
       
   277         /**
       
   278         * Returns the general connection settings.
       
   279         *
       
   280         * @since S60 9.2
       
   281         */
       
   282         IMPORT_C void ReadGenConnSettingsL( TCmGenConnSettings& aGenConnSettings );
       
   283 
       
   284         /**
       
   285         * Writes the general connection settings.
       
   286         *
       
   287         * @since S60 9.2
       
   288         */
       
   289         IMPORT_C void WriteGenConnSettingsL( const TCmGenConnSettings& aGenConnSettings );
       
   290         
       
   291         
       
   292         /** Open session and create tables if they don't exist*/
       
   293         IMPORT_C void CreateTablesAndOpenL();    
       
   294 
       
   295         /**
       
   296         * Creates a Destination with the passed name. 
       
   297         * @param aName the name of the new destination.
       
   298         * @return RCmDestination new destination. ownership is passed to the 
       
   299         * caller
       
   300         */
       
   301         IMPORT_C RCmDestination CreateDestinationL( const TDesC& aName );
       
   302 
       
   303         /**
       
   304         * Creates a connection method does not belong to any destination
       
   305         * @param aImplementationUid - bearer type of the new connection method
       
   306         * @return RCmConnectionMethod newly created connection method.
       
   307         */
       
   308         IMPORT_C RCmConnectionMethod CreateConnectionMethodL( TUint32 aBearerType );        
       
   309 
       
   310         /**
       
   311         * Copies a connection method belonging to one destination to 
       
   312         * another. The connection method becomes shared.
       
   313         * Calls UpdateL on the destination
       
   314         * @param aTargetDestination
       
   315         * @param aConnectionMethodId
       
   316         * @return TInt - index in the Connection Method list
       
   317         */
       
   318         IMPORT_C TInt CopyConnectionMethodL( RCmDestination& aTargetDestination,
       
   319                                              RCmConnectionMethod& aConnectionMethod );
       
   320 
       
   321         /**
       
   322         * Moves a connection method belonging to one destination to 
       
   323         * another. The connection method is removed from the source destination
       
   324         * @param aSourceDestination
       
   325         * @param aTargetDestination
       
   326         * @param aConnectionMethod
       
   327         * @return TInt - index in the Connection Method list
       
   328         */
       
   329         IMPORT_C TInt MoveConnectionMethodL( RCmDestination& aSourceDestination,
       
   330                                              RCmDestination& aTargetDestination,
       
   331                                              RCmConnectionMethod& aConnectionMethod );
       
   332 
       
   333         /**
       
   334         * Remove connection method from the destination
       
   335         * @param aDestination destination the connection method is attached to
       
   336         * @param aConnectionMethod connection method to be removed
       
   337         */
       
   338         IMPORT_C void RemoveConnectionMethodL( RCmDestination& aDestination,
       
   339                                                RCmConnectionMethod& aConnectionMethod );
       
   340 
       
   341         /**
       
   342         * Removes connection method from every destination and make it 
       
   343         * uncategorized.
       
   344         * @param aConnectionMethod connection method to be removed
       
   345         */
       
   346         IMPORT_C void RemoveAllReferencesL( RCmConnectionMethod& aConnectionMethod );
       
   347 
       
   348         /**
       
   349         * Update bearer priority array
       
   350         * @param aArray array with new global bearer priority
       
   351         */          
       
   352         IMPORT_C void UpdateBearerPriorityArrayL( const RArray<TBearerPriority>& aArray );
       
   353 
       
   354         /**
       
   355         * Creates a Destination with the passed name and id. 
       
   356         * @param aName the name of the new destination.
       
   357         * @param aDestId Predefined id of the destination.
       
   358         * @return RCmDestination newly created destination or leaves with
       
   359         * KErrAlreadyExists if there exists CM with the same Id.
       
   360         * Ownership is passed to the caller.
       
   361         */
       
   362         IMPORT_C RCmDestination CreateDestinationL( const TDesC& aName,
       
   363                                                        TUint32      aDestId );
       
   364 
       
   365         /**
       
   366         * Creates a connection method does not belong to any destination
       
   367         * @param aImplementationUid - bearer type of the new connection
       
   368         * method
       
   369         * @param aConnMethodId Predefined id for the connection method.
       
   370         * @return RCmConnectionMethod newly created connection
       
   371         * method or leaves with KErrAlreadyExists if there exists CM
       
   372         * with the same Id.
       
   373         */
       
   374         IMPORT_C RCmConnectionMethod CreateConnectionMethodL( TUint32 aImplementationUid,
       
   375                                                               TUint32 aConnMethodId );
       
   376 
       
   377         /**
       
   378         * Query all of the supported bearer types.
       
   379         * @param aArray list of all supported bearer types.
       
   380         */          
       
   381         IMPORT_C void SupportedBearersL( RArray<TUint32>& aArray ) const;
       
   382 
       
   383         /**
       
   384         * Returns "Uncategorized" icon.
       
   385         * This fucton leaves if the client does not have a valid UI context
       
   386         * @return CGulIcon* Icon of uncategorized connection methods. Ownership 
       
   387         * is passed.
       
   388         */          
       
   389         IMPORT_C CGulIcon* UncategorizedIconL() const;
       
   390         
       
   391     private:
       
   392         /**
       
   393         * This is a private copy constructor without implementation.
       
   394         * The sole purpose of this declaration is to forbid the copying of 
       
   395         * the objects of this class.
       
   396         */          
       
   397         RCmManager(RCmManager&  );
       
   398         /**
       
   399         * This is a private copy constructor without implementation.
       
   400         * The sole purpose of this declaration is to forbid the copying of 
       
   401         * the objects of this class.
       
   402         */          
       
   403         RCmManager& operator=( RCmManager& );
       
   404     //=========================================================================
       
   405     // Member data
       
   406     
       
   407     private:
       
   408     
       
   409         /**
       
   410          * the implementation class
       
   411          */
       
   412         CCmManagerImpl* iImplementation;
       
   413     };
       
   414 
       
   415 #include "cmmanager.inl"
       
   416     
       
   417 #endif // CMMANAGER_H