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