convergedconnectionhandler/cchclientapi/inc/cchuiconnectionhandler.h
changeset 0 a4daefaec16c
child 9 bddb6d4447db
equal deleted inserted replaced
-1:000000000000 0:a4daefaec16c
       
     1 /*
       
     2 * Copyright (c) 2008-2008 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CCCHUICONNECTIONHANDLER_H
       
    20 #define C_CCCHUICONNECTIONHANDLER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <e32const.h>
       
    24 #include <rconnmon.h>
       
    25 #include <cmmanagerext.h>
       
    26 #include <wlanmgmtcommon.h> // TWlanConnectionSecurityMode
       
    27 #include <cmpluginwlandef.h>
       
    28 
       
    29 #include "cchuicommon.hrh"
       
    30 #include "mcchuitimerobserver.h"
       
    31 
       
    32 class CCchUiCchHandler;
       
    33 class CCchUiSpsHandler;
       
    34 class RCmDestinationExt;
       
    35 class CmConnectionMethodExt;
       
    36 class CConnectionUiUtilities;
       
    37 
       
    38 
       
    39 /**
       
    40  * Connection Handler.
       
    41  * This class implements the creation and altering of connections and SNAPs.
       
    42  *
       
    43  * @code
       
    44  *  // Create CCH handler and SPS handler and give them as parameters when
       
    45  *  // you create Connection  handler.
       
    46  *  iCCHHandler = CCchUiCchHandler::NewL();    
       
    47  *  iSpsHandler = CCchUiSpsHandler::NewL();
       
    48  *  iConnectionHandler = CCchUiConnectionHandler::NewL( 
       
    49  *       *iCCHHandler, *iSpsHandler );
       
    50  * @endcode
       
    51  *
       
    52  * @lib cchui.lib
       
    53  * @since S60 5.0
       
    54  */
       
    55 NONSHARABLE_CLASS( CCchUiConnectionHandler ): public CBase
       
    56     {
       
    57 public:
       
    58     
       
    59     /**
       
    60      * Two-phased constructor.
       
    61      *
       
    62      * @param aCchUiCchHandler CCH handler reference.
       
    63      * @param aSpsHandler Service settings handler reference.
       
    64      */
       
    65     static CCchUiConnectionHandler* NewL(
       
    66         CCchUiCchHandler& aCchUiCchHandler,
       
    67         CCchUiSpsHandler& aSpsHandler );
       
    68     
       
    69     /**
       
    70      * Two-phased constructor.
       
    71      *
       
    72      * @param aCchUiCchHandler CCH handler reference.
       
    73      * @param aSpsHandler Service settings handler reference.
       
    74      */
       
    75     static CCchUiConnectionHandler* NewLC(
       
    76         CCchUiCchHandler& aCchUiCchHandler,
       
    77         CCchUiSpsHandler& aSpsHandler );
       
    78 
       
    79     /**
       
    80      * Destructor.
       
    81      */
       
    82     virtual ~CCchUiConnectionHandler();
       
    83     
       
    84     
       
    85     /**
       
    86      * Displays a dialog to select one wlan access point from all
       
    87      * available and adds access point to snap (creates snap if
       
    88      * it doesn't exist).
       
    89      *
       
    90      * @since S60 5.0
       
    91      * @param aServiceId Service id.
       
    92      * @param aSnapId Snap id of the service. Snap is verified before use.
       
    93      * @param aServiceName Service name (used as snap name if needed)
       
    94      */
       
    95     void SearchAccessPointsL(
       
    96         TUint aServiceId, 
       
    97         TUint32 aSnapId, 
       
    98         const TDesC& aServiceName );
       
    99             
       
   100     /**
       
   101      * Copies iap from specific SNAP to another.
       
   102      *
       
   103      * @since S60 5.0
       
   104      * @param aServiceId service id
       
   105      * @param aServiceName service name
       
   106      * @param aSourceIap source IAP
       
   107      * @param aTargetSnap target SNAP
       
   108      */         
       
   109     void CopyIapToServiceSnapL( 
       
   110         TUint aServiceId,
       
   111         const TDesC& aServiceName,
       
   112         TUint32 aSourceIap, 
       
   113         TUint32 aTargetSnap );
       
   114     
       
   115     /**
       
   116      * Removes connection from specific service´s SNAP.
       
   117      *
       
   118      * @since S60 5.0
       
   119      * @param aServiceName service´s name
       
   120      * @param aIapId access point id to be removed
       
   121      */            
       
   122     void RemoveConnectionL( const TDesC& aServiceName, TInt aIapId );
       
   123        
       
   124 private:
       
   125 
       
   126     CCchUiConnectionHandler(
       
   127         CCchUiCchHandler& aCchUiCchHandler,
       
   128         CCchUiSpsHandler& aSpsHandler );
       
   129     
       
   130     void ConstructL();
       
   131     
       
   132     /**
       
   133      * Checks if connection method already exists.
       
   134      *
       
   135      * @since S60 5.0
       
   136      * @param aDestination Target destination.
       
   137      * @param aSsid SSID of the connection method.
       
   138      * @param aSecurityMode Security mode of the candidate.
       
   139      * @param aAlreadyExists If access point already exists, this is ETrue.
       
   140      * @param aHidden Is candidate hidden or not.
       
   141      * @return TInt Iap id of the new connection method or KErrNotFound.
       
   142      */
       
   143     TInt ConnectionMethodAlreadyExistsL( 
       
   144         RCmDestinationExt& aDestination, 
       
   145         const TDesC& aSsid, 
       
   146         CMManager::TWlanSecMode aSecurityMode,
       
   147         TBool& aAlreadyExists,
       
   148         TBool aHidden );
       
   149     
       
   150     /**
       
   151      * Adds new connection method to snap.
       
   152      *
       
   153      * @since S60 5.0
       
   154      * @param aDestination Target destination.
       
   155      * @param aSsid SSID of the connection method.
       
   156      * @param aSecurityMode Security mode of the connection method.
       
   157      * @param aAlreadyExists If access point already exists, this is ETrue.
       
   158      * @param aSetHidden Set iap hidden.
       
   159      * @return TInt Iap id of the new connection method or old
       
   160      *         if already existed.
       
   161      */
       
   162     TInt AddNewConnectionMethodL( 
       
   163         RCmDestinationExt& aDestination,
       
   164         const TDesC& aSsid,
       
   165         TWlanConnectionSecurityMode aSecurityMode,
       
   166         TBool& aAlreadyExists,
       
   167         TBool aSetHidden );
       
   168     
       
   169     /**
       
   170      * Saves security settings to created connection method.
       
   171      *
       
   172      * @since S60 5.0
       
   173      * @param aSecMode Security mode.
       
   174      * @param aKey Key.
       
   175      * @param aHex Use hex.
       
   176      * @param aIapId Iap id.
       
   177      */
       
   178     void SaveSecuritySettingsL(
       
   179         const TWlanConnectionSecurityMode aSecMode, 
       
   180         const HBufC* aKey, 
       
   181         const TBool aHex, 
       
   182         const TUint32 aIapId );
       
   183             
       
   184     /**
       
   185      * Sets specific SNAP in use for specific service.
       
   186      *
       
   187      * @since S60 5.0
       
   188      * @param aServiceId Service id of the service to be handled.
       
   189      * @param aSNAPId Snap id to set.
       
   190      */
       
   191     void SetSnapToUseL( 
       
   192         TUint aServiceId, 
       
   193         TUint32 aSNAPId );    
       
   194        
       
   195     /**
       
   196      * Creates SNAP for service. Ownership is passed.
       
   197      *
       
   198      * @since S60 5.0
       
   199      * @param aServiceName service name
       
   200      * @return Created destination, ownership is passed.
       
   201      */            
       
   202     RCmDestinationExt CreateServiceSnapL( 
       
   203         const TDesC& aServiceName );
       
   204                 
       
   205 private: // data
       
   206 
       
   207     /**
       
   208      * Reference to CCH handler.
       
   209      * Not own.
       
   210      */
       
   211     CCchUiCchHandler& iCCHHandler;
       
   212     
       
   213     /**
       
   214      * Reference to service settings handler.
       
   215      * Not own.
       
   216      */
       
   217     CCchUiSpsHandler& iSpsHandler;
       
   218     
       
   219     /**
       
   220      * Pointer to connection ui utilities.
       
   221      * Own.
       
   222      */
       
   223     CConnectionUiUtilities* iConnUiUtils;
       
   224         
       
   225     /**
       
   226      * Handle to connection method manager.
       
   227      * Own.
       
   228      */
       
   229     RCmManagerExt iCmManagerExt;
       
   230     
       
   231     /**
       
   232      * Handle to connection monitor. Required to resolve hidden/public status.
       
   233      * Own.
       
   234      */
       
   235     RConnectionMonitor iConnMon;
       
   236     
       
   237     CCHUI_UNIT_TEST( UT_CchUi )
       
   238     };
       
   239 
       
   240 #endif // C_CCCHUICONNECTIONHANDLER_H