ipcm_plat/extended_connection_settings_api/inc/cmmanagerext.h
changeset 0 5a93021fdf25
child 8 2e6c4614c58e
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 CMMANAGEREXT_H
       
    19 #define CMMANAGEREXT_H
       
    20 
       
    21 // System includes
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 #include <e32cmn.h>
       
    25 #include <metadatabase.h>
       
    26 #include <coneresloader.h>
       
    27 #include <cmmanagerdef.h>
       
    28 #include <cmconnectionmethodext.h>
       
    29 #include <cmdefconnvalues.h>
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class RCmDestinationExt;
       
    33 class CCmManagerImpl;
       
    34 class CGulIcon;
       
    35 
       
    36 /**
       
    37  *  RCmManager is used to query and modify network destinations and connection
       
    38  *  methods.
       
    39  *
       
    40  *  @lib cmmanager.lib
       
    41  *  @since S60 v3.2
       
    42  */
       
    43 NONSHARABLE_CLASS(RCmManagerExt)
       
    44     {
       
    45     //=====================================================================
       
    46     // Constructors/Destructors
       
    47     // 
       
    48     public:
       
    49     
       
    50         /** Inline constructor */
       
    51         inline RCmManagerExt();
       
    52 
       
    53     //=====================================================================
       
    54     // API functions
       
    55     public:
       
    56         
       
    57         /** Open session */
       
    58         IMPORT_C void OpenL();    
       
    59 
       
    60         /** Open session and create tables if they don't exist*/
       
    61         IMPORT_C void CreateTablesAndOpenL();    
       
    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         /** Close session */
       
    72         IMPORT_C void Close();
       
    73         
       
    74         /**
       
    75         * GetBearerInfoXXX function can be used to query
       
    76         * bearer informantion that doesn't belong
       
    77         * to a specific connection method, such as 
       
    78         * ECmCoverage or ECmDefaultPriority etc.
       
    79         * NULL pointer, returned from string functions, means
       
    80         * attribute exists but has no value.
       
    81         * HBuf ownership is passed to the caller
       
    82         */
       
    83         IMPORT_C TUint32 GetBearerInfoIntL( TUint32 aBearerType,
       
    84                                   TUint32 aAttribute ) const;
       
    85         IMPORT_C TBool GetBearerInfoBoolL( TUint32 aBearerType,
       
    86                                  TUint32 aAttribute ) const;
       
    87         IMPORT_C HBufC* GetBearerInfoStringL( TUint32 aBearerType,
       
    88                                     TUint32 aAttribute ) const;
       
    89         IMPORT_C HBufC8* GetBearerInfoString8L( TUint32 aBearerType,
       
    90                                     TUint32 aAttribute ) const;
       
    91 
       
    92         /**
       
    93         * GetConnectionMethodInfoXXX function can be used to 
       
    94         * query any, non-bearer specific information about
       
    95         * a given connection method. This can be e.g. ECmBearerType,
       
    96         * ECmName, ECmStartPage etc.
       
    97         * NULL pointer, returned from string functions, means
       
    98         * attribute exists but has no value.
       
    99         * HBuf ownership is passed to the caller
       
   100         */
       
   101         IMPORT_C TUint32 GetConnectionMethodInfoIntL( TUint32 aIapId,
       
   102                                              TUint32 aAttribute ) const;
       
   103         IMPORT_C TBool GetConnectionMethodInfoBoolL( TUint32 aIapId,
       
   104                                             TUint32 aAttribute ) const;
       
   105         IMPORT_C HBufC* GetConnectionMethodInfoStringL( TUint32 aIapId,
       
   106                                                TUint32 aAttribute ) const;
       
   107         IMPORT_C HBufC8* GetConnectionMethodInfoString8L( TUint32 aIapId,
       
   108                                                TUint32 aAttribute ) const;
       
   109                 
       
   110         /**
       
   111         * Creates a Destination with the passed name. 
       
   112         * @param aName the name of the new destination.
       
   113         * @return RCmDestinationExt new destination. ownership is passed to the 
       
   114         * caller
       
   115         */
       
   116         IMPORT_C RCmDestinationExt CreateDestinationL( const TDesC& aName );
       
   117         
       
   118         /**
       
   119         * Creates a connection method does not belong to any destination
       
   120         * @param aImplementationUid - bearer type of the new connection method
       
   121         * @return RCmConnectionMethodExt newly created connection method.
       
   122         */
       
   123         IMPORT_C RCmConnectionMethodExt CreateConnectionMethodL( 
       
   124                                                           TUint32 aBearerType );        
       
   125         
       
   126         /**
       
   127         * Copies a connection method belonging to one destination to 
       
   128         * another. The connection method becomes shared.
       
   129         * Calls UpdateL on the destination
       
   130         * @param aTargetDestination
       
   131         * @param aConnectionMethodId
       
   132         * @return TInt - index in the Connection Method list
       
   133         */
       
   134         IMPORT_C TInt CopyConnectionMethodL( 
       
   135                                     RCmDestinationExt& aTargetDestination,
       
   136                                     RCmConnectionMethodExt& aConnectionMethod );
       
   137                                         
       
   138         /**
       
   139         * Moves a connection method belonging to one destination to 
       
   140         * another. The connection method is removed from the source destination
       
   141         * @param aSourceDestination
       
   142         * @param aTargetDestination
       
   143         * @param aConnectionMethod
       
   144         * @return TInt - index in the Connection Method list
       
   145         */
       
   146         IMPORT_C TInt MoveConnectionMethodL( 
       
   147                                     RCmDestinationExt& aSourceDestination,
       
   148                                     RCmDestinationExt& aTargetDestination,
       
   149                                     RCmConnectionMethodExt& aConnectionMethod );
       
   150                                                                                   
       
   151         /**
       
   152         * Remove connection method from the destination
       
   153         * @param aDestination destination the connection method is attached to
       
   154         * @param aConnectionMethod connection method to be removed
       
   155         */
       
   156         IMPORT_C void RemoveConnectionMethodL( 
       
   157                                    RCmDestinationExt& aDestination,
       
   158                                    RCmConnectionMethodExt& aConnectionMethod );
       
   159                                    
       
   160         /**
       
   161         * Removes connection method from every destination and make it 
       
   162         * uncategorized.
       
   163         * @param aConnectionMethod connection method to be removed
       
   164         */
       
   165         IMPORT_C void RemoveAllReferencesL( 
       
   166                                     RCmConnectionMethodExt& aConnectionMethod );
       
   167 
       
   168     //=========================================================================
       
   169     // API functions - Getter-Setter
       
   170     public:
       
   171     
       
   172         /**
       
   173         * Returns the connection method queried by its ID.
       
   174         * @param aId if of the connection method
       
   175         * @return RCmConnectionMethodExt connection method instance
       
   176         */
       
   177         IMPORT_C RCmConnectionMethodExt ConnectionMethodL( 
       
   178                                                   TUint32 aConnectionMethodId );
       
   179         
       
   180         /**
       
   181         * Returns the list of connection methods that do not belong to any 
       
   182         * destination
       
   183         * @param aCMArray on return it is the array of IAP ids.
       
   184         * @param aCheckBearerType If ETrue only connection methods with 
       
   185         *                         supported bearer types are returned
       
   186         * @param aLegacyOnly when set to ETrue only Legacy IAP ids will
       
   187         *                         be returned
       
   188         * @param aEasyWlan when set to ETrue EasyWlan id is returned, too
       
   189         */
       
   190         IMPORT_C void ConnectionMethodL( RArray<TUint32>& aCMArray,
       
   191                                          TBool aCheckBearerType = ETrue,
       
   192                                          TBool aLegacyOnly = ETrue,
       
   193                                          TBool aEasyWlan = EFalse );
       
   194         
       
   195         /**
       
   196         * Returns the destination to which a specified 
       
   197         * connection method belongs, search is by destination ID
       
   198         * @param aDestinationId id of the destination
       
   199         * @return RCmDestinationExt network destination
       
   200         */
       
   201         IMPORT_C RCmDestinationExt DestinationL( TUint32 aDestinationId );
       
   202         
       
   203         /**
       
   204         * Returns an array of all destination id's
       
   205         * @param aDestArray array of all available network destination
       
   206         */ 
       
   207         IMPORT_C void AllDestinationsL( RArray<TUint32>& aDestArray );
       
   208         
       
   209         /**
       
   210         * Returns the copy of the bearer priority array. Ownership is passed.
       
   211         * @param aArray bearer priority array
       
   212         */          
       
   213         IMPORT_C void BearerPriorityArrayL( RArray<TBearerPriority>& aArray ) const;
       
   214         
       
   215         /**
       
   216         * Update bearer priority array
       
   217         * @param aArray array with new global bearer priority
       
   218         */          
       
   219         IMPORT_C void UpdateBearerPriorityArrayL( 
       
   220                                         const RArray<TBearerPriority>& aArray );
       
   221         
       
   222 
       
   223         /**
       
   224         * Clean up passed global bearer priority array. Delete
       
   225         * the elements and calls Reset and Close on the array.
       
   226         * @param aArray array to be cleaned up
       
   227         */
       
   228         IMPORT_C void CleanupGlobalPriorityArray( 
       
   229                                         RArray<TBearerPriority>& aArray ) const;
       
   230         
       
   231         /**
       
   232         * Query all of the supported bearer types.
       
   233         * @param aArray list of all supported bearer types.
       
   234         */          
       
   235         IMPORT_C void SupportedBearersL( RArray<TUint32>& aArray ) const;
       
   236         
       
   237         /**
       
   238         * Returns "Uncategorized" icon.
       
   239         * This fucton leaves if the client does not have a valid UI context
       
   240         * @return CGulIcon* Icon of uncategorized connection methods. Ownership 
       
   241         * is passed.
       
   242         */          
       
   243         IMPORT_C CGulIcon* UncategorizedIconL() const;
       
   244         
       
   245         /**
       
   246         * Returns the id of the EasyWlan connection method.
       
   247         *
       
   248         * @since S60 3.2
       
   249         * @return id of the EasyWLan connection method. 0 if not found.
       
   250         */
       
   251         IMPORT_C TUint32 EasyWlanIdL();
       
   252 
       
   253         /**
       
   254         * Returns the default connection method/SNAP.
       
   255         *
       
   256         * @since S60 3.2
       
   257         */
       
   258         IMPORT_C void ReadDefConnL( TCmDefConnValue& aDCSetting );   
       
   259         /**
       
   260         * Stores the default connection method/SNAP.
       
   261         *
       
   262         * @since S60 3.2
       
   263         */
       
   264         IMPORT_C void WriteDefConnL( const TCmDefConnValue& aDCSetting );  
       
   265 
       
   266         /**
       
   267         * Creates a Destination with the passed name and id. 
       
   268         * @param aName the name of the new destination.
       
   269         * @param aDestId Predefined id of the destination.
       
   270         * @return RCmDestinationExt newly created destination or leaves with
       
   271         * KErrAlreadyExists if there exists CM with the same Id.
       
   272         * Ownership is passed to the caller.
       
   273         */
       
   274         IMPORT_C RCmDestinationExt CreateDestinationL( const TDesC& aName,
       
   275                                                        TUint32      aDestId );
       
   276         
       
   277         /**
       
   278         * Creates a connection method does not belong to any destination
       
   279         * @param aImplementationUid - bearer type of the new connection
       
   280         * method
       
   281         * @param aConnMethodId Predefined id for the connection method
       
   282         * (id range is from 1 to max IAP record amount in CommsDat).
       
   283         * @return RCmConnectionMethodExt newly created connection
       
   284         * method or leaves with KErrAlreadyExists if there exists CM
       
   285         * with the same Id.
       
   286         */
       
   287         IMPORT_C RCmConnectionMethodExt CreateConnectionMethodL( TUint32 aImplementationUid,
       
   288                                                                  TUint32 aConnMethodId );
       
   289 
       
   290     private:
       
   291         /**
       
   292         * This is a private copy constructor without iplemetation.
       
   293         * The sole purpose of this declaration is to forbid the copying of 
       
   294         * the objects of this class.
       
   295         */          
       
   296         RCmManagerExt(RCmManagerExt&  );
       
   297         /**
       
   298         * This is a private copy constructor without iplemetation.
       
   299         * The sole purpose of this declaration is to forbid the copying of 
       
   300         * the objects of this class.
       
   301         */          
       
   302         RCmManagerExt& operator=( RCmManagerExt& );
       
   303 
       
   304     friend class CCmManagerImpl;
       
   305     //=========================================================================
       
   306     // Member data
       
   307     
       
   308     private:
       
   309     
       
   310         CCmManagerImpl* iImplementation;
       
   311     };
       
   312     
       
   313 inline RCmManagerExt::RCmManagerExt()
       
   314     : iImplementation(NULL)
       
   315     {
       
   316     }
       
   317     
       
   318 #endif // CMMANAGEREXT_H