convergedconnectionhandler/cchclientapi/inc/cchuiconnectionhandler.h
branchRCL_3
changeset 22 d38647835c2e
equal deleted inserted replaced
21:f742655b05bf 22:d38647835c2e
       
     1 /*
       
     2 * Copyright (c) 2008-2010 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     /**
       
   125      * Returns ETrue if wlan search (query) is ongoing.
       
   126      *
       
   127      * @since S60 5.0
       
   128      * @return ETrue if wlan search ongoing.
       
   129      */ 
       
   130     TBool SearchWlanOngoing();
       
   131        
       
   132 private:
       
   133 
       
   134     CCchUiConnectionHandler(
       
   135         CCchUiCchHandler& aCchUiCchHandler,
       
   136         CCchUiSpsHandler& aSpsHandler );
       
   137     
       
   138     void ConstructL();
       
   139     
       
   140     /**
       
   141      * Checks if connection method already exists.
       
   142      *
       
   143      * @since S60 5.0
       
   144      * @param aDestination Target destination.
       
   145      * @param aSsid SSID of the connection method.
       
   146      * @param aSecurityMode Security mode of the candidate.
       
   147      * @param aAlreadyExists If access point already exists, this is ETrue.
       
   148      * @param aHidden Is candidate hidden or not.
       
   149      * @return TInt Iap id of the new connection method or KErrNotFound.
       
   150      */
       
   151     TInt ConnectionMethodAlreadyExistsL( 
       
   152         RCmDestinationExt& aDestination, 
       
   153         const TDesC& aSsid, 
       
   154         CMManager::TWlanSecMode aSecurityMode,
       
   155         TBool& aAlreadyExists,
       
   156         TBool aHidden );
       
   157     
       
   158     /**
       
   159      * Checks if connection method already exists.
       
   160      *
       
   161      * @since S60 9.2
       
   162      * @param aIapId internet accespoint ID.
       
   163      * @param aTargetSnap target destination.
       
   164      * @return ETrue if exists.
       
   165      */
       
   166     TBool ConnectionMethodAlreadyExistsL(
       
   167         TUint32 aIapId, RCmDestinationExt& aTargetSnap ) const;
       
   168     
       
   169     /**
       
   170      * Adds new connection method to snap.
       
   171      *
       
   172      * @since S60 5.0
       
   173      * @param aDestination Target destination.
       
   174      * @param aSsid SSID of the connection method.
       
   175      * @param aSecurityMode Security mode of the connection method.
       
   176      * @param aAlreadyExists If access point already exists, this is ETrue.
       
   177      * @param aSetHidden Set iap hidden.
       
   178      * @return TInt Iap id of the new connection method or old
       
   179      *         if already existed.
       
   180      */
       
   181     TInt AddNewConnectionMethodL( 
       
   182         RCmDestinationExt& aDestination,
       
   183         const TDesC& aSsid,
       
   184         TWlanConnectionSecurityMode aSecurityMode,
       
   185         TBool& aAlreadyExists,
       
   186         TBool aSetHidden );
       
   187     
       
   188     /**
       
   189      * Saves security settings to created connection method.
       
   190      *
       
   191      * @since S60 5.0
       
   192      * @param aSecMode Security mode.
       
   193      * @param aKey Key.
       
   194      * @param aHex Use hex.
       
   195      * @param aIapId Iap id.
       
   196      */
       
   197     void SaveSecuritySettingsL(
       
   198         const TWlanConnectionSecurityMode aSecMode, 
       
   199         const HBufC* aKey, 
       
   200         const TBool aHex, 
       
   201         const TUint32 aIapId );
       
   202             
       
   203     /**
       
   204      * Sets specific SNAP in use for specific service.
       
   205      *
       
   206      * @since S60 5.0
       
   207      * @param aServiceId Service id of the service to be handled.
       
   208      * @param aSNAPId Snap id to set.
       
   209      */
       
   210     void SetSnapToUseL( 
       
   211         TUint aServiceId, 
       
   212         TUint32 aSNAPId );    
       
   213        
       
   214     /**
       
   215      * Creates SNAP for service. Ownership is passed.
       
   216      *
       
   217      * @since S60 5.0
       
   218      * @param aServiceName service name
       
   219      * @return Created destination, ownership is passed.
       
   220      */            
       
   221     RCmDestinationExt CreateServiceSnapL( 
       
   222         const TDesC& aServiceName );
       
   223                 
       
   224 private: // data
       
   225 
       
   226     /**
       
   227      * Reference to CCH handler.
       
   228      * Not own.
       
   229      */
       
   230     CCchUiCchHandler& iCCHHandler;
       
   231     
       
   232     /**
       
   233      * Reference to service settings handler.
       
   234      * Not own.
       
   235      */
       
   236     CCchUiSpsHandler& iSpsHandler;
       
   237     
       
   238     /**
       
   239      * Pointer to connection ui utilities.
       
   240      * Own.
       
   241      */
       
   242     CConnectionUiUtilities* iConnUiUtils;
       
   243         
       
   244     /**
       
   245      * Handle to connection method manager.
       
   246      * Own.
       
   247      */
       
   248     RCmManagerExt iCmManagerExt;
       
   249     
       
   250     /**
       
   251      * Handle to connection monitor. Required to resolve hidden/public status.
       
   252      * Own.
       
   253      */
       
   254     RConnectionMonitor iConnMon;
       
   255     
       
   256     /**
       
   257      * Flag for determining if search wlan search (query) is ongoing
       
   258      */
       
   259     TBool iSearchWlanOngoing;
       
   260     
       
   261     CCHUI_UNIT_TEST( UT_CchUi )
       
   262     };
       
   263 
       
   264 #endif // C_CCCHUICONNECTIONHANDLER_H