voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmliaphandler.h
branchRCL_3
changeset 21 f742655b05bf
parent 20 65a3ef1d5bd0
child 22 d38647835c2e
equal deleted inserted replaced
20:65a3ef1d5bd0 21:f742655b05bf
     1 /*
       
     2 * Copyright (c) 2009-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:  IAP handler for VoIP XML processor
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef  VOIPXMLIAPHANDLER_H
       
    20 #define  VOIPXMLIAPHANDLER_H
       
    21 
       
    22 #include "voipxmlprocessordefaults.h"
       
    23 
       
    24 class RCmManagerExt;
       
    25 
       
    26 const TUint8 KEapLeapId[] = { 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11 };
       
    27 const TInt KEapChars = 8;
       
    28 
       
    29 class TWepKey
       
    30     {
       
    31 public:
       
    32     /**
       
    33      * ETrue if hexadecimal, EFalse if ASCII.
       
    34      */
       
    35     TBool iHex;
       
    36     /**
       
    37      * WEP key length.
       
    38      */
       
    39     TInt iLength;
       
    40     /**
       
    41      * WEP key data.
       
    42      */
       
    43     TBuf<KMaxWepKeyDataLength> iData;
       
    44     };
       
    45 
       
    46 struct TTemporaryIap
       
    47     {
       
    48     /**
       
    49      * Name of the IAP.
       
    50      */
       
    51     HBufC* iName;
       
    52     /**
       
    53      * SSID of the IAP.
       
    54      */
       
    55     HBufC* iSsid;
       
    56     /**
       
    57      * Tells if the SSID is hidden or not.
       
    58      */
       
    59     TBool iHidden;
       
    60     /**
       
    61      * Network mode.
       
    62      */
       
    63     TInt iNetworkMode;
       
    64     /**
       
    65      * Network type.
       
    66      */
       
    67     TInt iSecurityType;
       
    68     /**
       
    69      * Pre-shared key.
       
    70      */
       
    71     HBufC* iPreSharedKey;
       
    72     /**
       
    73      * WEP authentication mode.
       
    74      */
       
    75     TInt iWepAuthMode;
       
    76     /**
       
    77      * Current WEP key.
       
    78      */
       
    79     TWepKey iCurrentWepKey;
       
    80     /**
       
    81      * Array of WEP keys.
       
    82      */
       
    83     RArray<TWepKey> iWepKeys;
       
    84     /**
       
    85      * EAP type.
       
    86      */
       
    87     TInt iEapType;
       
    88     /**
       
    89      * EAP username.
       
    90      */
       
    91     HBufC* iEapUsername;
       
    92     /**
       
    93      * EAP password.
       
    94      */
       
    95     HBufC* iEapPassword;
       
    96     };
       
    97 
       
    98 /**
       
    99 *  VoipXmlIapHandler
       
   100 *  IAP handler class.
       
   101 * 
       
   102 *  @lib voipxmlprocessor.lib
       
   103 *  @since S60 v5.0
       
   104 */
       
   105 class CVoipXmlIapHandler : public CBase
       
   106     {
       
   107 #ifdef _DEBUG
       
   108     friend class UT_CVoipXmlIapHandler;
       
   109     friend class UT_CVoipXmlParamHandler;
       
   110 #endif
       
   111 
       
   112 public:
       
   113 
       
   114     static CVoipXmlIapHandler* NewL();
       
   115     ~CVoipXmlIapHandler();
       
   116 
       
   117 public:
       
   118 
       
   119     /**
       
   120      * Sets IAP setting.
       
   121      *
       
   122      * @since S60 v5.0
       
   123      * @param aType Type of settings.
       
   124      * @param aParam Parameter to be set.
       
   125      * @param aValue Value of the setting.
       
   126      */
       
   127     void SetSetting( TInt aType, TInt aParam, const TDesC& aValue );
       
   128 
       
   129     /**
       
   130      * Stores settings to 'XDM registry', i.e. creates an XDM collection.
       
   131      *
       
   132      * @since S60 v5.0
       
   133      * @return KErrNone if successful,
       
   134      *         KErrNotSupported if no settings to be stored,
       
   135      *         KErrCompletion if settings could not be stored.
       
   136      */
       
   137     TInt StoreSettings();
       
   138 
       
   139     /**
       
   140      * Returns destination ID.
       
   141      *
       
   142      * @since S60 v5.0
       
   143      * @return Destination ID.
       
   144      */
       
   145     TUint32 SettingsId();
       
   146 
       
   147     /**
       
   148      * Method to inform the handler that currently deployed settings
       
   149      * have ended. This way we will know when an IAP is ready to be
       
   150      * appended to iIaps array, or when a WEP key is ready to appended
       
   151      * to iWepKeys array.
       
   152      *
       
   153      * @since S60 v5.0
       
   154      * @param aType Type of settings.
       
   155      */
       
   156     void SettingsEnd( TInt aType );
       
   157 
       
   158 private:
       
   159 
       
   160     /**
       
   161      * Resets iCurrentIap settings, i.e. deletes its member data.
       
   162      *
       
   163      * @since S60 v5.0
       
   164      * @param aCloseArray Tells if array inside iCurrentIap is to be closed.
       
   165      */
       
   166     void ResetCurrentIap( TBool aCloseArray = EFalse );
       
   167 
       
   168     /**
       
   169      * Resets iIaps array, i.e. deletes its items member data.
       
   170      *
       
   171      * @since S60 v5.0
       
   172      * @param aCloseArray Tells if arrays inside iIaps' 
       
   173      *                    members are to be closed.
       
   174      */
       
   175     void ResetTempIapArray( TBool aCloseArray = EFalse );
       
   176 
       
   177     /**
       
   178      * Adds current IAP settings to iIaps array.
       
   179      *
       
   180      * @since S60 v5.0
       
   181      */
       
   182     void AddCurrentIapL();
       
   183 
       
   184     /**
       
   185      * Stores settings.
       
   186      *
       
   187      * @since S60 v5.0
       
   188      */
       
   189     void StoreSettingsL();
       
   190 
       
   191     /**
       
   192      * Creates an access point.
       
   193      * 
       
   194      * @since S60 v5.0
       
   195      * @param aCmManager CMManager reference.
       
   196      * @param aTempIap TTemporaryIap from which actual IAP will be created.
       
   197      * @return IAP ID.
       
   198      */
       
   199     TUint32 CreateIapL( RCmManagerExt& aCmManager, TTemporaryIap aTempIap );
       
   200 private:
       
   201 
       
   202     CVoipXmlIapHandler();
       
   203     void ConstructL();
       
   204 
       
   205 private:
       
   206 
       
   207     /**
       
   208      * Tells if any settings have been set to temporary profile.
       
   209      */
       
   210     TBool iSettingsSet;
       
   211 
       
   212     /**
       
   213      * Name of destination. If this is empty when saving settings,
       
   214      * destination will not be created.
       
   215      * Own.
       
   216      */
       
   217     HBufC* iDestinationName;
       
   218 
       
   219     /**
       
   220      * ID of destination.
       
   221      */
       
   222     TUint32 iDestinationId;
       
   223 
       
   224     /**
       
   225      * Access point that is being currently handled.
       
   226      */
       
   227     TTemporaryIap iCurrentIap;
       
   228 
       
   229     /**
       
   230      * Array for temporary IAP's.
       
   231      */
       
   232     RPointerArray<TTemporaryIap> iIaps;
       
   233     };
       
   234 
       
   235 #endif // VOIPXMLIAPHANDLER_H
       
   236 
       
   237 // End of file.