wlanutilities/wlansniffer/apwizard/inc/wsfwlaniapcreator.h
branchRCL_3
changeset 24 63be7eb3fc78
parent 23 b852595f5cbe
child 25 f28ada11abbf
equal deleted inserted replaced
23:b852595f5cbe 24:63be7eb3fc78
     1 /*
       
     2 * Copyright (c) 2007-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:   Class header for CWsfWlanIapCreator
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef C_WSFWLANIAPCREATOR_H
       
    22 #define C_WSFWLANIAPCREATOR_H
       
    23 
       
    24 
       
    25 //  EXTERNAL INCLUDES
       
    26 #include <e32base.h>
       
    27 #include <cmmanagerext.h>
       
    28 #include <cmpluginwlandef.h>
       
    29 
       
    30 
       
    31 //  INTERNAL INCLUDES
       
    32 #include "wsfwlaninfo.h"
       
    33 
       
    34 
       
    35 
       
    36 //  CLASS DEFINITION
       
    37 /**
       
    38 * Class collects various IAP creation related functions.
       
    39 *
       
    40 * @lib wsfapwizard.lib
       
    41 * @since S60 5.0
       
    42 */
       
    43 NONSHARABLE_CLASS( CWsfWlanIapCreator ): public CBase
       
    44     {
       
    45     public:
       
    46         /**
       
    47         * Factory function.
       
    48         * @since S60 5.0
       
    49         * @return Class instance
       
    50         */
       
    51         static CWsfWlanIapCreator* NewL();
       
    52 
       
    53         /**
       
    54         * Factory function.
       
    55         * @since S60 5.0
       
    56         * @return Class instance
       
    57         */
       
    58         static CWsfWlanIapCreator* NewLC();
       
    59 
       
    60         /**
       
    61         * Destructor
       
    62         * @since S60 5.0
       
    63         */
       
    64         ~CWsfWlanIapCreator();
       
    65 
       
    66 
       
    67     private:    // constructors
       
    68         /**
       
    69         * Constructor
       
    70         * @since S60 5.0
       
    71         */
       
    72         CWsfWlanIapCreator();    
       
    73         
       
    74         /**
       
    75         * Second-phase constructor
       
    76         * @since S60 5.0
       
    77         */
       
    78         void ConstructL();
       
    79 
       
    80 
       
    81     public:     // new methods
       
    82         /**
       
    83         * Sets the default destination for subsequent access point 
       
    84         * creation calls
       
    85         * @since S60 5.0
       
    86         * @param aDestinationId The id of the new default destination
       
    87         */
       
    88         void SetDefaultDestination( const TUint32 aDestinationId );
       
    89 
       
    90         /**
       
    91         * Creates an access point to wlan.
       
    92         * @since S60 5.0
       
    93         * @param aWlanInfo Contains all available data from wlan scanner. 
       
    94         *                  Note: the network name field may change if 
       
    95         *                  IAP already exists, e.g. MyWlan -> MyWlan(01). 
       
    96         *                  Also the IAP id is changed on successful creation
       
    97         * @param aPresharedKey The used key to access network
       
    98         * @param aIsHex ETrue if the key is given in hexadecimal string format.
       
    99         *               Applicable only in case of WEP authentication.
       
   100         */    
       
   101         void CreateAccessPointL( TWsfWlanInfo& aWlanInfo, 
       
   102                                  const TDesC& aPresharedKey, 
       
   103                                  const TBool aIsHex );    
       
   104 
       
   105 
       
   106     private:    // new methods
       
   107         /**
       
   108         * Creates connection method using the given WLAN parameters
       
   109         * @since S60 5.0
       
   110         * @param aWlanInfo WLAN parameters.
       
   111         *                  Note: the network name field may change if 
       
   112         *                  IAP already exists, e.g. MyWlan -> MyWlan(01)
       
   113         * @return The id of the created IAP
       
   114         */
       
   115         TUint32 CreateConnectionMethodL( TWsfWlanInfo& aWlanInfo );
       
   116         
       
   117         /**
       
   118         * Stores WPA data
       
   119         * @since S60 5.0
       
   120         * @param aIapId The IAP for which WPA data are to be stored
       
   121         * @param aPresharedKey WPA key string. MUST be correct as the function
       
   122         *                  DOES NOT verify its correctness!
       
   123         * @param aSecMode Security mode (to tell apart WPA-PSK/EAP)
       
   124         */    
       
   125         void StoreWPADataL( const TInt aIapId, 
       
   126                             const TDesC& aPresharedKey, 
       
   127                             const CMManager::TWlanSecMode aSecMode );
       
   128         
       
   129         /**
       
   130         * Stores WEP key data
       
   131         * @param S60 5.0
       
   132         * @param aIapId The IAP for which WEP data are to be stored
       
   133         * @param aWepKey WEP key string. MUST be correct as the function 
       
   134         *                  DOES NOT verify its correctness!
       
   135         * @param aIsHexWep To indicate whether the passed key is in hex format
       
   136         */
       
   137         void StoreWEPDataL( const TInt aIapId, 
       
   138                             const TDesC& aWepKey, 
       
   139                             const TBool aIsHexWep );
       
   140 
       
   141         /**
       
   142         * Converts an ascii sequence to hexadecimal character string
       
   143         * @since S60 5.0
       
   144         * @param aSource The ASCII string
       
   145         * @param aDest The destination for the hex string
       
   146         */
       
   147         void ConvertAsciiToHex( const TDesC8& aSource, TDes8& aDest );
       
   148 
       
   149         /**
       
   150         * Cleanup function for commsdat session
       
   151         * @since S60 5.0
       
   152         * @param aDbSession The commsdat session to clean up
       
   153         */
       
   154         static void RollbackCommsDat( TAny* aDbSession );
       
   155         
       
   156 
       
   157     private:    // data
       
   158         /**
       
   159         * Commsdat session object (owned)
       
   160         */
       
   161         CommsDat::CMDBSession *iDbSession;
       
   162         
       
   163         /**
       
   164         * Handle to the CmManager
       
   165         */
       
   166         RCmManagerExt iCmManagerExt;
       
   167         
       
   168         /**
       
   169         * Default destination id
       
   170         */
       
   171         TUint32 iDestinationId;
       
   172     };
       
   173 
       
   174 #endif // C_WSFWLANIAPCREATOR_H