# HG changeset patch # User William Roberts # Date 1279813472 -3600 # Node ID b3d8f88532b7ddc113fd55eadad5312bd69fc029 # Parent 30a5f517c615a4e067dd7ec593974f7a71e358d1# Parent 2fbd1d709fe76d3c7bda4be4dfd09613b247dd7f Catchup to latest Symbian^4 diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/group/bld.inf --- a/hotspotfw/group/bld.inf Fri Jun 11 16:27:29 2010 +0100 +++ b/hotspotfw/group/bld.inf Thu Jul 22 16:44:32 2010 +0100 @@ -23,13 +23,9 @@ PRJ_EXPORTS ../rom/hotspot.iby CORE_MW_LAYER_IBY_EXPORT_PATH(hotspot.iby) -../rom/hotspotResources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(hotspotResources.iby) ../rom/hotspotfwstub.sis /epoc32/data/z/system/install/hotspotfwstub.sis ../rom/ictsstub.sis /epoc32/data/z/system/install/ictsstub.sis -// Localisation files of whole Hotspot localised here -../hsbrowser/loc/hsbrowser.loc MW_LAYER_LOC_EXPORT_PATH(hsbrowser.loc) - ../internetconnectivitytestservice/conf/icts.confml MW_LAYER_CONFML(icts.confml) ../internetconnectivitytestservice/conf/icts_10282EC7.crml MW_LAYER_CRML(icts_10282ec7.crml) ../internetconnectivitytestservice/group/backup_registration.xml /epoc32/data/z/private/10282ec5/backup_registration.xml @@ -56,11 +52,5 @@ ../hsclient/group/NetCfgExtnHotSpot.mmp ../hsclient/group/hssmgmtimpl.mmp ../hspluginforagent/group/wlanagthotspotimpl.mmp -../hsbrowser/group/hsbrowser.mmp ../hsserver/group/hssscanlist.mmp PRJ_EXTENSIONS - -START EXTENSION s60/mifconv -OPTION TARGETFILE hsbrowsericon_aif.mif -OPTION SOURCES -c8,1 qgn_menu_wlan_logon -END diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/data/hsbrowser.rss --- a/hotspotfw/hsbrowser/data/hsbrowser.rss Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,187 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This file contains all the resources for HsBrowser. -* -*/ - - - -// RESOURCE IDENTIFIER -NAME HSBR // 4 letter ID - -// INCLUDES - -#include -#include -#include -#include -#include -#include -#include -#include - -// RESOURCE DEFINITIONS - -// ----------------------------------------------------------------------------- -// -// Define the resource file signature -// This resource should be empty. -// -// ----------------------------------------------------------------------------- -// -RESOURCE RSS_SIGNATURE { } - -// ----------------------------------------------------------------------------- -// -// Default Document Name -// -// ----------------------------------------------------------------------------- -// -RESOURCE TBUF { buf=""; } - -// ----------------------------------------------------------------------------- -// -// Define default CBA key and status pane. -// -// ----------------------------------------------------------------------------- -// -RESOURCE EIK_APP_INFO - { - cba = R_AVKON_SOFTKEYS_CANCEL; - status_pane = r_hsbrowser_app_model; - } - -// --------------------------------------------------------- -// -// r_hsbrowser_app_model -// Define status pane of HsBrowser. -// -// --------------------------------------------------------- -// -RESOURCE STATUS_PANE_APP_MODEL r_hsbrowser_app_model - { - layout = R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE; - panes = - { - SPANE_PANE - { - id = EEikStatusPaneUidNavi; - type = EAknCtNaviPane; - resource = r_hsbrowser_navi_decorator; - } - }; - } - -// --------------------------------------------------------- -// -// r_hsbrowser_navi_decorator -// Define static title of HsBrowser. -// -// --------------------------------------------------------- -// -RESOURCE NAVI_DECORATOR r_hsbrowser_navi_decorator - { - type = ENaviDecoratorLabel; - control = NAVI_LABEL - { - txt = qtn_netw_conset_wba_static_title; - }; - } - -// ---------------------------------------------------------------------------- -// -// r_hsbrowser_localisable_app_info -// -// ---------------------------------------------------------------------------- -// -RESOURCE LOCALISABLE_APP_INFO r_hsbrowser_localisable_app_info - { - short_caption = qtn_netw_conset_wba_static_title; - caption_and_icon = - CAPTION_AND_ICON_INFO - { - caption = qtn_netw_conset_wba_static_title; - icon_file = "Z:"APP_BITMAP_DIR"\\hsbrowsericon_aif.mif"; - }; - } - -// ---------------------------------------------------------------------------- -// -// r_hsbrowser_softkeys_continue_cancel -// -// ---------------------------------------------------------------------------- -// -RESOURCE CBA r_hsbrowser_softkeys_continue_cancel - { - buttons = - { - CBA_BUTTON{ id = EAknSoftkeyNext; txt = text_softkey_continue; }, - CBA_BUTTON{ id = EAknSoftkeyCancel; txt = text_softkey_cancel; }, - CBA_BUTTON{ id = EAknSoftkeyNext; txt = text_softkey_continue; } - }; - } - -RESOURCE CBA r_hsbrowser_softkeys_cancel - { - buttons = - { - CBA_BUTTON{ txt = text_softkey_empty; }, - CBA_BUTTON{ id = EAknSoftkeyClose; txt = text_softkey_cancel; }, - CBA_BUTTON{ txt = text_softkey_empty; } - }; - } - -// ---------------------------------------------------------------------------- -// -// r_hsbrowser_softkeys_continue_exit -// -// ---------------------------------------------------------------------------- -// -RESOURCE CBA r_hsbrowser_softkeys_continue_exit - { - buttons = - { - CBA_BUTTON{ id = EAknSoftkeyNext; txt = text_softkey_continue; }, - CBA_BUTTON{ id = EAknSoftkeyExit; txt = text_softkey_exit; }, - CBA_BUTTON{ id = EAknSoftkeyNext; txt = text_softkey_continue; } - }; - } - -// ---------------------------------------------------------------------------- -// -// r_qtn_netw_conset_wba_info_complete -// -// ---------------------------------------------------------------------------- -// -RESOURCE TBUF r_qtn_netw_conset_wba_info_complete - { - buf = qtn_netw_conset_wba_info_complete; - } - -// ---------------------------------------------------------------------------- -// -// r_qtn_netw_conset_wba_info_closed -// -// ---------------------------------------------------------------------------- -// -RESOURCE TBUF r_qtn_netw_conset_wba_info_closed - { - buf = qtn_netw_conset_wba_info_closed; - } - -RESOURCE TBUF r_qtn_netw_conset_wba_static_title - { - buf = qtn_netw_conset_wba_static_title; - } -// End of File diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/data/hsbrowser_reg.rss --- a/hotspotfw/hsbrowser/data/hsbrowser_reg.rss Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: RSS for registration file for HsBrowser. -* -*/ - - - -#include -#include - -UID2 KUidAppRegistrationResourceFile -UID3 0x2000AFCC - -RESOURCE APP_REGISTRATION_INFO - { - app_file = "HsBrowser"; - localisable_resource_file = "\\resource\\apps\\hsbrowser"; - localisable_resource_id = R_HSBROWSER_LOCALISABLE_APP_INFO; - hidden = KAppIsHidden; - embeddability = KAppNotEmbeddable; - newfile = KAppDoesNotSupportNewFile; - } - -// End of File diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/group/bld.inf --- a/hotspotfw/hsbrowser/group/bld.inf Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This file provides the information required -* for building the whole of a Hotspot Browser Application. -* -*/ - - - - -PRJ_PLATFORMS - - -PRJ_EXPORTS - - -PRJ_MMPFILES -hsbrowser.mmp diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/group/hsbrowser.mmp --- a/hotspotfw/hsbrowser/group/hsbrowser.mmp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This is the project specification file for -* HotSpot Browser Application. -* -*/ - - -#include -#include - -TARGET HsBrowser.exe -TARGETTYPE exe -UID 0x100039CE 0x2000AFCC -VENDORID VID_DEFAULT -CAPABILITY CAP_APPLICATION NetworkControl - -EPOCSTACKSIZE 0x10000 -EPOCHEAPSIZE 0x2000 0x500000 - -SOURCEPATH ../src -SOURCE hsbrowserapp.cpp -SOURCE hsbrowserappui.cpp -SOURCE hsbrowserdocument.cpp -SOURCE hsbrowsermodel.cpp -SOURCE hsbrowsercontainer.cpp -SOURCE hsbrowserloadeventobserver.cpp -SOURCE hsbrowserspecialloadobserver.cpp -SOURCE hsbrowserictsobserver.cpp -SOURCE hsbrowserhssrvnotifs.cpp - -// UI resource file -START RESOURCE ../data/hsbrowser.rss -HEADER -TARGETPATH APP_RESOURCE_DIR -LANGUAGE_IDS -END - -// registration file -START RESOURCE ../data/hsbrowser_reg.rss -DEPENDS hsbrowser.rsg -TARGETPATH /private/10003a3f/apps -END - -USERINCLUDE . -USERINCLUDE ../inc -USERINCLUDE ../../inc - -APP_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib apparc.lib cone.lib eikcore.lib -LIBRARY avkon.lib apmime.lib apgrfx.lib efsrv.lib eikcoctl.lib commonui.lib ecom.lib -LIBRARY eikdlg.lib gdi.lib bitgdi.lib esock.lib insock.lib -LIBRARY hotspotclient.lib -LIBRARY ictsclientinterface.lib -LIBRARY ws32.lib -LIBRARY commonengine.lib -LIBRARY browserengine.lib -LIBRARY aknnotify.lib eiksrv.lib -LIBRARY akncapserverclient.lib -LIBRARY bafl.lib -LIBRARY hlplch.lib // for "Help" options menu diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/inc/am_debug.h --- a/hotspotfw/hsbrowser/inc/am_debug.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Debug utilities -* -*/ - - - -#ifndef AM_DEBUG_H -#define AM_DEBUG_H - -#include - -#ifdef _DEBUG - -/** -* Class for producing debug traces -* @lib -* @since Series 60 3.0 -*/ -class Debug - { - public: - static inline void PrintBuffer( TUint aLength, const TUint8* aData ); - static inline void PrintString( const TDesC& aString, TUint aLength, const TUint8* aData ); - static inline void PrintTimestamp( const TDesC& aString ); - }; - -#define DEBUG(a) RDebug::Print(_L(a)) -#define DEBUG1(a,b) RDebug::Print(_L(a),b) -#define DEBUG2(a,b,c) RDebug::Print(_L(a),b,c) -#define DEBUG3(a,b,c,d) RDebug::Print(_L(a),b,c,d) -#define DEBUG4(a,b,c,d,e) RDebug::Print(_L(a),b,c,d,e) -#define DEBUG5(a,b,c,d,e,f) RDebug::Print(_L(a),b,c,d,e,f) -#define DEBUG6(a,b,c,d,e,f,g) RDebug::Print(_L(a),b,c,d,e,f,g) -#define DEBUG7(a,b,c,d,e,f,g,h) RDebug::Print(_L(a),b,c,d,e,f,g,h) -#define DEBUG8(a,b,c,d,e,f,g,h,i) RDebug::Print(_L(a),b,c,d,e,f,g,h,i) -#define DEBUG_MAC(a) RDebug::Print(_L("%02X%02X%02X%02X%02X%02X"),a[0],a[1],a[2],a[3],a[4],a[5]) -#define DEBUG_RATES(a) RDebug::Print(_L("%d %d %d %d %d %d %d %d"),a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]) -#define DEBUG_BUFFER(a,b) Debug::PrintBuffer(a,b); -#define DEBUG1S(a,b,c) Debug::PrintString(_L(a),b,c); -#define DEBUGT(a) Debug::PrintTimestamp(_L(a)); - -#include "am_debug.inl" - -#else // _DEBUG - -#define DEBUG(a) /* _DEBUG is not defined. */ -#define DEBUG1(a,b) /* _DEBUG is not defined. */ -#define DEBUG2(a,b,c) /* _DEBUG is not defined. */ -#define DEBUG3(a,b,c,d) /* _DEBUG is not defined. */ -#define DEBUG4(a,b,c,d,e) /* _DEBUG is not defined. */ -#define DEBUG5(a,b,c,d,e,f) /* _DEBUG is not defined. */ -#define DEBUG6(a,b,c,d,e,f,g) /* _DEBUG is not defined. */ -#define DEBUG7(a,b,c,d,e,f,g,h) /* _DEBUG is not defined. */ -#define DEBUG8(a,b,c,d,e,f,g,h,i) /* _DEBUG is not defined. */ -#define DEBUG_MAC(a) /* _DEBUG is not defined. */ -#define DEBUG_RATES(a) /* _DEBUG is not defined. */ -#define DEBUG_BUFFER(a,b) /* _DEBUG is not defined. */ -#define DEBUG1S(a,b,c) /* _DEBUG is not defined. */ -#define DEBUGT(a) /* _DEBUG is not defined. */ - -#endif // _DEBUG - -#endif // AM_DEBUG_H diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/inc/am_debug.inl --- a/hotspotfw/hsbrowser/inc/am_debug.inl Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Debug utilities -* -*/ - - - -const TUint KPrintLineLength = 200; -const TUint KPrintHexPerLine = 8; - -// ----------------------------------------------------------------------------- -// Debug::PrintBuffer -// ----------------------------------------------------------------------------- -// -inline void Debug::PrintBuffer( TUint aLength, const TUint8* aData ) - { - TBuf line; - TUint idx( 0 ); - for ( ; idx < aLength; ++idx ) - { - if ( idx && !( idx % KPrintHexPerLine ) ) - { - RDebug::Print( line ); - line.Zero(); - } - line.AppendFormat( _L( "%02X " ), aData[idx] ); - } - RDebug::Print( line ); - } - -// ----------------------------------------------------------------------------- -// Debug::PrintString -// ----------------------------------------------------------------------------- -// -inline void Debug::PrintString( const TDesC& aString, TUint aLength, const TUint8* aData ) - { - TBuf line; - - line.Append( aString ); - - TPtrC8 buf8( aData, aLength ); - - TBuf buf16; - buf16.Copy( buf8 ); - - line.Append( buf16 ); - - RDebug::Print( line ); - } - -// ----------------------------------------------------------------------------- -// Debug::PrintTimestamp -// ----------------------------------------------------------------------------- -// -inline void Debug::PrintTimestamp( const TDesC& aString ) - { - TBuf line; - TTime time; - time.HomeTime(); - - time.FormatL( line, _L( "%H:%T:%S:%C" ) ); - line.Append( _L( " " ) ); - line.Append( aString ); - - RDebug::Print( line ); - } diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/inc/hsbrowserapp.h --- a/hotspotfw/hsbrowser/inc/hsbrowserapp.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declares main application class. -* -*/ - - - -#ifndef HSBROWSERAPP_H -#define HSBROWSERAPP_H - -// INCLUDES -#include - -// CLASS DECLARATION -/** -* CHsBrowserApp application class. -* Provides the factory to create a concrete document object. -* -*/ -class CHsBrowserApp : public CAknApplication - { - - public: // Functions from base classes - /** - * From CApaApplication, overridden to enable INI file support. - * @return CDictionaryStore*, A pointer to the dictionary store - */ - CDictionaryStore* OpenIniFileLC(RFs& aFs) const; - private: - - /** - * From CApaApplication, creates CHsBrowserDocument document object. - * @return CApaDocument*, A pointer to the created document object. - */ - CApaDocument* CreateDocumentL(); - - /** - * From CApaApplication, returns application's UID. - * @return TUid, The value of KUidHsBrowserApp. - */ - TUid AppDllUid() const; - }; - -#endif - -// End of File - diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/inc/hsbrowserappui.h --- a/hotspotfw/hsbrowser/inc/hsbrowserappui.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: The UI class for HotSpot Browser Application. -* -*/ - - - -#ifndef HSBROWSERAPPUI_H -#define HSBROWSERAPPUI_H - -// INCLUDES -#include -#include -#include -#include -#include -#include - -// FORWARD DECLARATIONS -class CHsBrowserContainer; - -// CONSTANTS -const TInt KBufSize = 512; - -// CLASS DECLARATION -/** -* CHsBrowserAppUi class. -* Application UI class which provides support for the following features: -* - EIKON control architecture -* -*/ -class CHsBrowserAppUi : public CAknAppUi - { - public: - - /** - * EPOC default constructor. - */ - void ConstructL(); - - /** - * Destructor. - */ - ~CHsBrowserAppUi(); - - public: // From CEikAppUi - - /** - * Parses command line arguments. - * - * @param aCommandLine Reference to command line. - */ - TBool ProcessCommandParametersL( CApaCommandLine& aCommandLine ); - - /** - * Takes care of command handling. - * - * @param aCommand Command to be handled - */ - void HandleCommandL(TInt aCommand); - - /** - * Handles key events. - * - * @param aKeyEvent Event to handled. - * @param aType Type of the key event. - * @return Response code (EKeyWasConsumed, EKeyWasNotConsumed). - */ - virtual TKeyResponse HandleKeyEventL( - const TKeyEvent& aKeyEvent,TEventCode aType); - - /** - * Handles changes in keyboard focus when an application switches to, - * or from, the foreground. - * - * @param aForeground ETrue if the application is in the foreground, - * otherwise EFalse. - */ - void HandleForegroundEventL( TBool aForeground ); - - private: //data - - /** - * Pointer to container of Hotspot Browser . - */ - CHsBrowserContainer* iAppContainer; - }; - -#endif - -// End of File - - diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/inc/hsbrowsercommon.h --- a/hotspotfw/hsbrowser/inc/hsbrowsercommon.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Common data for HotSpot Browser Application. -* -*/ - - - -#ifndef HSBROWSERCOMMON_H -#define HSBROWSERCOMMON_H - -// CONSTANTS - -/** -* Z drive. -*/ -_LIT( KDriveZ, "z:" ); - -/** -* C drive. -*/ -_LIT( KDriveC, "c:" ); - -/* -* Series60v3.2 product file. -*/ -_LIT( KS60ProductIdFile, "Series60v3.2.sis" ); - -/* -* ROM install directory. -*/ -_LIT( KROMInstallDir, "z:\\system\\install\\" ); - -/** -* Resource file for Hotspot Browser. -*/ -_LIT( KResourceFile, "hsbrowser.rsc" ); - -/** -* UID3 of the application. -*/ -const TUid KUidHsBrowserApp = { 0x2000AFCC }; - -#endif - -// End of File diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/inc/hsbrowsercontainer.h --- a/hotspotfw/hsbrowser/inc/hsbrowsercontainer.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,333 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declares container control for HotSpot Browser Application. -* -*/ - - - -#ifndef HSBROWSERCONTAINER_H -#define HSBROWSERCONTAINER_H - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include - -// FORWARD DECLARATIONS -class CBrCtlInterface; -class CHsBrowserSpecialLoadObserver; -class CHsBrowserLoadEventObserver; -class CHsBrowserIctsObserver; -class CHsBrowserHsSrvNotifs; -class CHsBrowserModel; -class TCoeEvent; -class CAknNavigationControlContainer; -class CAknNavigationDecorator; -class CAknIndicatorContainer; -class CAknNaviLabel; - -// CONSTANTS -const TInt KComponentsNumber = 1; -const TInt KBrCtlComponentIndex = 0; - -// CLASS DECLARATION -/** -* CHsBrowserContainer class. -* This is the container control class. -*/ -class CHsBrowserContainer : public CCoeControl - { - public: // Constructors and destructor - - /** - * C++ default constructor. - * - * @param aModel Pointer to model of HsBrowser. - */ - CHsBrowserContainer( CHsBrowserModel* aModel ); - - /** - * EPOC default constructor. - * - * @param aRect Frame rectangle for container. - */ - void ConstructL( const TRect& aRect ); - - /** - * Destructor. - */ - ~CHsBrowserContainer(); - - public: - enum TNaviPaneEvent - { - ELoadingLoginPage, - ELoadingUrl, - EPageTitleAvailable, - ELoadingFinished - }; - - - public: // new - - /** - * Initializes the indicators in the navi pane. - */ - void InitNaviPaneL(); - - /** - * Updates the indicators in the navi pane. - */ - void UpdateNaviPane( TNaviPaneEvent aUpdateEvent ); - - /** - * Pass a command to the Browser Control - * - * @param aCommand The command that the Browser Control should process. - */ - void HandleCommandL( TInt aCommand ); - - /** - * Handles key events - * - * @param aKeyEvent The key event that occurred. - * @param aType The window server event type that is being handled - * @return TKeyResponse Value indicates whether or not the key event was consumed by the control. - * The default implementation simply returns EKeyWasNotConsumed. - */ - TKeyResponse HandleKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); - - /** - * Handle events when when an application switches to, - * or from, the foreground. - * - * @param aForeground ETrue if the application is in the foreground, - * otherwise EFalse. - */ - void ProcessForegroundEvent( TBool aForeground ); - - /** - * Send application to foreground. - */ - void SendToForeground(); - - /** - * Restore original ordinary position and priority. - */ - void RestorePositionAndPriority(); - - /** - * Send application to background. - */ - void SendToBackground(); - - /** - * Update softkeys according to model state. - */ - void UpdateSoftkeys(); - - /** - * Show login complete information note. - */ - void ShowLoginCompleteNote(); - - /** - * Show connection closed information note. - */ - void ShowConnClosedNote(); - - /** - * Initialize model, attach to connection, and load specified URL. - * - * @param aUrl URL of authentication web page. - * @param aIapId ID of IAP. - * @param aNetId Network ID. - * @return KErrNone, if successful, otherwice one of system wide errorcodes. - */ - TInt LoadRedirect( const TPtrC& aUrl, TInt aIapId, TInt aNetId ); - - /** - * Called when wlan connection is lost. - * Shows information note and exits. - */ - void ProcessWlanConnModeNotConnected(); - - /** - * Returns boolean value for application foreground status. - * - * @return ETrue / EFalse - */ - TBool IsForeground(); - - public: // access - - /** - * Accessor method for iBrCtlInterface - * - * @return CBrCtlInterface* A pointer to the browser control interface. - */ - inline CBrCtlInterface* BrCtlInterface(); - - /** - * Accessor method for iHsBrowserSpecialLoadObserver. - * - * @return CHsBrowserSpecialLoadObserver* A pointer to the special load observer. - */ - inline CHsBrowserSpecialLoadObserver* HsBrowserSpecialLoadObserver(); - - /** - * Accessor method for iHsBrowserIctsObserver. - * - * @return CHsBrowserIctsObserver* A pointer to the Internet connectivity test observer. - */ - inline CHsBrowserIctsObserver* HsBrowserIctsObserver(); - - /** - * Accessor method for iModel. - * - * @return CHsBrowserModel* A pointer to the model of HsBrowser. - */ - inline CHsBrowserModel* Model(); - - /** - * Accessor method for iNaviLabel. - * - * @return CAknNaviLabel* A pointer to the label control in the navigation pane. - */ - inline CAknNaviLabel* NaviLabel(); - - /** - * Get boolean value if input box is active or not. - * - * @return ETrue / EFalse - */ - inline TBool ActiveInputBox(); - - /** - * Set input box active flag - */ - inline void SetActiveInputBox( TBool aActiveInputBox ); - - private: // From CoeControl - - /** - * From CoeControl,SizeChanged. - */ - void SizeChanged(); - - /** - * From CoeControl,CountComponentControls. - */ - TInt CountComponentControls() const; - - /** - * From CCoeControl,ComponentControl. - */ - CCoeControl* ComponentControl( TInt aIndex ) const; - - /** - * From CCoeControl,Handle key events. - */ - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType); - - /** - * From CCoeControl,Handle resource change events. - */ - void HandleResourceChange( TInt aType ); - - private: //data - - /** - * Pointer to the browser control interface. - * Owned. - */ - CBrCtlInterface* iBrCtlInterface; - - /** - * Command Base - */ - TInt iCommandBase; - - /** - * Special Load Observer - */ - CHsBrowserSpecialLoadObserver* iHsBrowserSpecialLoadObserver; - - /** - * Load Event Observer - */ - CHsBrowserLoadEventObserver* iHsBrowserLoadEventObserver; - - /** - * Internet connectivity test observer - */ - CHsBrowserIctsObserver* iHsBrowserIctsObserver; - - /** - * Notifications from hotspot server. - */ - CHsBrowserHsSrvNotifs* iHsBrowserHsSrvNotifs; - - /** - * Model of HsBrowser - */ - CHsBrowserModel* iModel; - - /** - * Pointer to default control in the status pane's navigation pane. - * Not owned. - */ - CAknNavigationControlContainer* iNaviPane; - - /** - * Pointer to the editor indicator control in the navigation pane. - * Owned. - */ - CAknNavigationDecorator* iEditorIndicatorContainer; - - /** - * Pointer to the editor indicator control in the navigation pane - * Not owned. - */ - CAknIndicatorContainer* iIndiContainer; - - /** - * Resource. - */ - TInt iResource; - - /** - * Flag for softkey press. - */ - TBool iActiveInputBox; - - /** - * handle to WlanMgmtClient - */ - CWlanMgmtClient *iMgtClient; - }; - -#include "hsbrowsercontainer.inl" - -#endif - -// End of File - diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/inc/hsbrowsercontainer.inl --- a/hotspotfw/hsbrowser/inc/hsbrowsercontainer.inl Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Inline method definitions for CHsBrowserContainer. -* -*/ - - - -#ifndef HSBROWSERCONTAINER_INL -#define HSBROWSERCONTAINER_INL - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------------------------- -// CHsBrowserContainer::BrCtlInterface -// --------------------------------------------------------------------------- -// -CBrCtlInterface* CHsBrowserContainer::BrCtlInterface() - { - return iBrCtlInterface; - } - -// --------------------------------------------------------------------------- -// CHsBrowserContainer::HsBrowserSpecialLoadObserver -// --------------------------------------------------------------------------- -// -CHsBrowserSpecialLoadObserver* CHsBrowserContainer:: - HsBrowserSpecialLoadObserver() - { - return iHsBrowserSpecialLoadObserver; - } - -// --------------------------------------------------------------------------- -// CHsBrowserContainer::HsBrowserIctsObserver -// --------------------------------------------------------------------------- -// -CHsBrowserIctsObserver* CHsBrowserContainer::HsBrowserIctsObserver() - { - return iHsBrowserIctsObserver; - } - -// --------------------------------------------------------------------------- -// CHsBrowserContainer::Model -// --------------------------------------------------------------------------- -// -CHsBrowserModel* CHsBrowserContainer::Model() - { - return iModel; - } - -// --------------------------------------------------------------------------- -// CHsBrowserContainer::NaviLabel -// --------------------------------------------------------------------------- -// -CAknNaviLabel* CHsBrowserContainer::NaviLabel() - { - return NULL; - } - -// --------------------------------------------------------------------------- -// CHsBrowserContainer::ActiveInputBox -// --------------------------------------------------------------------------- -// -TBool CHsBrowserContainer::ActiveInputBox() - { - return iActiveInputBox; - } - -// --------------------------------------------------------------------------- -// CHsBrowserContainer::SetActiveInputBox -// --------------------------------------------------------------------------- -// -void CHsBrowserContainer::SetActiveInputBox( TBool aActiveInputBox ) - { - iActiveInputBox = aActiveInputBox; - } - -#endif diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/inc/hsbrowserdocument.h --- a/hotspotfw/hsbrowser/inc/hsbrowserdocument.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declares document for application. -* -*/ - - - -#ifndef HSBROWSERDOCUMENT_H -#define HSBROWSERDOCUMENT_H - -// INCLUDES -#include - -// CONSTANTS - -// FORWARD DECLARATIONS -class CEikAppUi; -class CHsBrowserModel; - -// CLASS DECLARATION - -/** -* CHsBrowserDocument application class. -*/ -class CHsBrowserDocument : public CAknDocument - { - public: // Constructors and destructor - /** - * Two-phased constructor. - */ - static CHsBrowserDocument* NewL( CEikApplication& aApp ); - - /** - * Destructor. - */ - virtual ~CHsBrowserDocument(); - - public: // access - - /** - * Accessor method for iModel. - * - * @return CHsBrowserModel* A pointer to model of HsBrowser. - */ - inline CHsBrowserModel* Model(); - - private: - - /** - * C++ default constructor. - */ - CHsBrowserDocument( CEikApplication& aApp ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // new - - /** - * Initialize model. - */ - //inline void ResetModel(); - - private: - - /** - * From CEikDocument, create CBrCtlSampleAppAppUi "App UI" object. - */ - CEikAppUi* CreateAppUiL(); - - private: // data - - /** - * Pointer to model of HsBrowser. - * Owned. - */ - CHsBrowserModel* iModel; - }; - -#include "hsbrowserdocument.inl" - -#endif - -// End of File - diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/inc/hsbrowserdocument.inl --- a/hotspotfw/hsbrowser/inc/hsbrowserdocument.inl Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Inline method definitions for CHsBrowserModel. -* -*/ - - - -#ifndef HSBROWSERDOCUMENT_INL -#define HSBROWSERDOCUMENT_INL - -#include "hsbrowsermodel.h" - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CHsBrowserDocument::Model -// --------------------------------------------------------- -// -CHsBrowserModel* CHsBrowserDocument::Model() - { - return iModel; - } - -#endif diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/inc/hsbrowserhssrvnotifs.h --- a/hotspotfw/hsbrowser/inc/hsbrowserhssrvnotifs.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implements notifications interface from Hotspot server in order -* to receive wlan connection closed notification. -* -*/ - - - -#ifndef HSBROWSERHSSRVNOTIFS_H -#define HSBROWSERHSSRVNOTIFS_H - -// INCLUDES -#include -#include -#include "hsssrvnotifications.h" -#include -#include - -// FORWARD DECLARATION -class CHsBrowserContainer; - -// CLASS DECLARATION -/** -* CHsBrowserHsSrvNotifs class. -* Class implements notifications interface for Hotspot server in order -* to receive wlan connection closed notification. -*/ -class CHsBrowserHsSrvNotifs : public CBase, public MWlanMgmtNotifications - { - - public: // Constructors and destructor - - /** - * Two-phased constructor. - * - * @param aContainer Pointer to container of browser application - */ - static CHsBrowserHsSrvNotifs* NewL( CHsBrowserContainer* aContainer ); - - /** - * Destructor. - */ - ~CHsBrowserHsSrvNotifs(); - - public: // from MWlanMgmtNotifications - - /** - * Connection state has changed . - */ - virtual void ConnectionStateChanged( TWlanConnectionMode aNewState ); - - - private: - - /** - * C++ default constructor. - * - * @param aContainer Pointer to container of browser application. - */ - CHsBrowserHsSrvNotifs( CHsBrowserContainer* aContainer ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: - - /** - * Container of hotspot browser application. - */ - CHsBrowserContainer* iContainer; - }; - -#endif // HSBROWSERHSSRVNOTIFS_H - -// End of File - diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/inc/hsbrowserictsobserver.h --- a/hotspotfw/hsbrowser/inc/hsbrowserictsobserver.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implements callback interface for Internet Connectivity Test Service -* notifications. -* -*/ - - - -#ifndef HSBROWSERICTSOBSERVER_H -#define HSBROWSERICTSOBSERVER_H - -// INCLUDES -#include -#include - -// FORWARD DECLARATION -class CHsBrowserContainer; - -// CLASS DECLARATION -/** -* This class implements callback interface for Internet Connectivity Test Service -* notifications. -*/ -class CHsBrowserIctsObserver : public CBase, public MIctsObserver - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * - * @param aContainer Pointer to container of browser application - */ - static CHsBrowserIctsObserver* NewL( CHsBrowserContainer* aContainer ); - - /** - * Destructor. - */ - ~CHsBrowserIctsObserver(); - - public: // from MIctsObserver - - /** - * From MIctsObserver, ConnectivityObserver - */ - void ConnectivityObserver( TIctsTestResult aResult, const TDesC& aString ); - - private: // new - - /** - * Process connection ok event. - */ - void ProcessConnectionOk(); - - private: - - /** - * C++ default constructor. - * - * @param aContainer Pointer to container of browser application. - */ - CHsBrowserIctsObserver( CHsBrowserContainer* aContainer ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: - - /** - * Container of hotspot browser application. - * Not owned. - */ - CHsBrowserContainer* iContainer; - }; - -#endif // HSBROWSERICTSOBSERVER_H - -// End of File - diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/inc/hsbrowserloadeventobserver.h --- a/hotspotfw/hsbrowser/inc/hsbrowserloadeventobserver.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Handle load progress events -* -*/ - - - -#ifndef HSBROWSERLOADEVENTOBSERVER_H -#define HSBROWSERLOADEVENTOBSERVER_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class CHsBrowserContainer; - -// CONSTANTS -_LIT8( KHttp, "http" ); -const TInt KTotalPollingTime = 300000000; -const TInt KExecutionTimeInterval = 10000000; -const TInt KBufSize = 4; - -// CLASS DECLARATION -/** -* This class is used to receive load progress events. -*/ -class CHsBrowserLoadEventObserver : public CBase, public MBrCtlLoadEventObserver - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CHsBrowserLoadEventObserver* NewL( CHsBrowserContainer* aContainer ); - - /** - * Destructor. - */ - ~CHsBrowserLoadEventObserver(); - - public: // from MBrCtlLoadEventObserver - - /** - * From MBrCtlLoadEventObserver, load events notification. - */ - void HandleBrowserLoadEventL( TBrCtlDefs::TBrCtlLoadEvent aLoadEvent, - TUint aSize, - TUint16 aTransactionId) ; - private: - - /** - * Constructor. - */ - CHsBrowserLoadEventObserver( CHsBrowserContainer* aContainer ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // new - - /** - * Update label in the navigation pane. - * - * @param aName Label for navi pane. - */ - void UpdateNaviLabel( const TDesC& aName ); - - /** - * Update name in fast swapper. - * - * @param aName Name in fast swapper. - */ - void UpdateFastSwapNameL( const TDesC& aName ); - - /** - * Get page title, udpate navi label and name in fast swapper. - */ - void UpdateNameL(); - - /** - * Start polling internet connection. - */ - void TestInternetConnectivityL(); - - /** - * Update boolean flag for internet connectivity test. - */ - void UpdateDoIctFlagL(); - - private: // data - - /** - * Pointer to the container class associated with this observer. - */ - CHsBrowserContainer* iContainer; // not owner - - /** - * Pointer to internet connectivity test object. - */ - CIctsClientInterface* iIcts; // owner - - /** - * Boolean flag for Internet Connectivity Test. - */ - TBool iDoIct; - - /** - * Used to differentiate the navibar content: no title shown yet when - * we are just loading the logon page - */ - TBool iIsFirstLoad; - }; - -#endif // HSBROWSERLOADEVENTOBSERVER_H - -// End of File diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/inc/hsbrowsermodel.h --- a/hotspotfw/hsbrowser/inc/hsbrowsermodel.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of HsBrowserModel class. -* -*/ - - - -#ifndef HSBROWSERMODEL_H -#define HSBROWSERMODEL_H - -// INCLUDES -#include -#include -#include "hssinterface.h" - -// FORWARD DECLARATIONS -class RConnection; -class RSocketServ; -class RHssInterface; - -// CLASS DECLARATION -/** - * Manages the HsBrowser data. - */ -class CHsBrowserModel : public CBase - { - - public: - - /** - * Static constructor. - */ - static CHsBrowserModel* NewL(); - - /** - * Destructor. - */ - ~CHsBrowserModel(); - - public: // new methods - - /** - * Set model state. - * - * @param aState State of the model. - * @param aSendToHss Flag for sending status to hotspot server. - */ - void SetState( TUint aState, TBool aSendToHss ); - - /** - * Attach to connection using known iIapId and iNetId. - */ - TInt Attach(); - - public: // access - - inline TInt IapId() const; - inline TInt NetId() const; - inline HBufC* Url(); - inline RConnection& Connection(); - inline RSocketServ& SocketServ(); - inline RHssInterface& HsServer(); - inline TBool Foreground(); - inline TUint State(); - inline TBool LoginCompleteNoteShown(); - inline TInt Position(); - inline TInt Priority(); - inline HBufC* StaticTitle(); - inline HBufC* PageTitle(); - - inline void SetNetId( TInt aNetId ); - inline void SetIapId( TInt aIapId ); - inline void SetUrl( const TPtrC& aUrl ); - inline void SetState( TUint aState ); - inline void SetForeground( TBool aForeground ); - inline void SetLoginCompleteNoteShown( TBool aLoginCompleteNoteShown ); - inline void SetStaticTitle( const TDesC& aStaticTitle ); - inline void SetPageTitle( const TDesC& aPageTitle ); - - private: - - /** - * C++ default constructor. - */ - CHsBrowserModel(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // data - - /** - * IAP ID. - */ - TInt iIapId; - - /** - * Network ID. - */ - TInt iNetId; - - /** - * URL of web page for user authentication. - * Owned. - */ - HBufC* iUrl; - - /** - * The management interface for a network connection. - */ - RConnection iConnection; - - /** - * Provides the Connect() function to create an IPC communication - * channel to the socket server. - */ - RSocketServ iSocketServ; - - /** - * Handle to a session with a hotspot server. - */ - RHssInterface iHsServer; - - /** - * Application state. Possible values are EHsBrowserUiUndefined, EHsBrowserUiRunning, - * EHsBrowserUiAuthenticatedOk, EHsBrowserUiAuthenticatedNok, EHsBrowserUiClosed, defined - * in hotspotclientserver.h - */ - TUint iState; - - /** - * Boolean flag for foreground state. - */ - TBool iForeground; - - /** - * Boolean flag for showing login complete note. - */ - TBool iLoginCompleteNoteShown; - - /** - * The window's original ordinal position. - */ - TInt iPosition; - - /** - * The window's original ordinal priority. - */ - TInt iPriority; - - /** - * Default page title, "WLAN login" - * Owned. - */ - HBufC* iStaticTitle; - - /** - * Web page title, used instead of default if available. - * Owned. - */ - HBufC* iPageTitle; - - }; - -#include "hsbrowsermodel.inl" - -#endif // HSBROWSERMODEL_H - -// end of file - diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/inc/hsbrowsermodel.inl --- a/hotspotfw/hsbrowser/inc/hsbrowsermodel.inl Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,265 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Inline method definitions for CHsBrowserModel. -* -*/ - - - -#ifndef HSBROWSERMODEL_INL -#define HSBROWSERMODEL_INL - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CHsBrowserModel::IapId -// --------------------------------------------------------- -// -TInt CHsBrowserModel::IapId() const - { - return iIapId; - } - -// --------------------------------------------------------- -// CHsBrowserModel::SetIapId -// --------------------------------------------------------- -// -void CHsBrowserModel::SetIapId( TInt aIapId ) - { - iIapId = aIapId; - } - -// --------------------------------------------------------- -// CHsBrowserModel::IapId -// --------------------------------------------------------- -// -TInt CHsBrowserModel::NetId() const - { - return iNetId; - } - -// --------------------------------------------------------- -// CHsBrowserModel::Url -// --------------------------------------------------------- -// -HBufC* CHsBrowserModel::Url() - { - return iUrl; - } - -// --------------------------------------------------------- -// CHsBrowserModel::SetNetId -// --------------------------------------------------------- -// -void CHsBrowserModel::SetNetId( TInt aNetId ) - { - iNetId = aNetId; - } - -// --------------------------------------------------------- -// CHsBrowserModel::Connection -// --------------------------------------------------------- -// -RConnection& CHsBrowserModel::Connection() - { - return iConnection; - } - -// --------------------------------------------------------- -// CHsBrowserModel::SocketServ -// --------------------------------------------------------- -// -RSocketServ& CHsBrowserModel::SocketServ() - { - return iSocketServ; - } - -// --------------------------------------------------------- -// CHsBrowserModel::HsServer -// --------------------------------------------------------- -// -RHssInterface& CHsBrowserModel::HsServer() - { - return iHsServer; - } - -// --------------------------------------------------------- -// CHsBrowserModel::SetUrl -// --------------------------------------------------------- -// -void CHsBrowserModel::SetUrl( const TPtrC& aUrl ) - { - if ( iUrl ) - { - delete iUrl; - iUrl = NULL; - } - iUrl = aUrl.Alloc(); - } - -// --------------------------------------------------------- -// CHsBrowserModel::Foreground -// --------------------------------------------------------- -// -TBool CHsBrowserModel::Foreground() - { - return iForeground; - } - -// --------------------------------------------------------- -// CHsBrowserModel::State -// --------------------------------------------------------- -// -TUint CHsBrowserModel::State() - { - return iState; - } - -// --------------------------------------------------------- -// CHsBrowserModel::ShowLoginCompleteNote -// --------------------------------------------------------- -// -/*TBool CHsBrowserModel::ShowLoginCompleteNote() - { - return iShowLoginCompleteNote; - } -*/ - -// --------------------------------------------------------- -// CHsBrowserModel::LoginCompleteNoteShown -// --------------------------------------------------------- -// -TBool CHsBrowserModel::LoginCompleteNoteShown() - { - return iLoginCompleteNoteShown; - } - -// --------------------------------------------------------- -// CHsBrowserModel::Position -// --------------------------------------------------------- -// -TInt CHsBrowserModel::Position() - { - return iPosition; - } - -// --------------------------------------------------------- -// CHsBrowserModel::Priority -// --------------------------------------------------------- -// -TInt CHsBrowserModel::Priority() - { - return iPriority; - } - -HBufC* CHsBrowserModel::StaticTitle() - { - return iStaticTitle; - } - -HBufC* CHsBrowserModel::PageTitle() - { - return iPageTitle; - } - -// --------------------------------------------------------- -// CHsBrowserModel::ShowConnClosedNote -// --------------------------------------------------------- -// -/* -TBool CHsBrowserModel::ShowConnClosedNote() - { - return iShowConnClosedNote; - } -*/ - -// --------------------------------------------------------- -// CHsBrowserModel::SetState -// --------------------------------------------------------- -// -void CHsBrowserModel::SetState( TUint aState ) - { - iState = aState; - } - -// --------------------------------------------------------- -// CHsBrowserModel::SetForeground -// --------------------------------------------------------- -// -void CHsBrowserModel::SetForeground( TBool aForeground ) - { - iForeground = aForeground; - } - -// --------------------------------------------------------- -// CHsBrowserModel::SetShowLoginCompleteNote -// --------------------------------------------------------- -// -/*void CHsBrowserModel::SetShowLoginCompleteNote( TBool aShowLoginCompleteNote ) - { - iShowLoginCompleteNote = aShowLoginCompleteNote; - } -*/ - -// --------------------------------------------------------- -// CHsBrowserModel::SetLoginCompleteNoteShown -// --------------------------------------------------------- -// -void CHsBrowserModel::SetLoginCompleteNoteShown( - TBool aLoginCompleteNoteShown ) - { - iLoginCompleteNoteShown = aLoginCompleteNoteShown; - } - -// --------------------------------------------------------- -// CHsBrowserModel::SetShowConnClosedNote -// --------------------------------------------------------- -// -/* -void CHsBrowserModel::SetShowConnClosedNote( TBool aShowConnClosedNote ) - { - iShowConnClosedNote = aShowConnClosedNote; - } -*/ - -// --------------------------------------------------------- -// CHsBrowserModel::SetStaticTitle -// --------------------------------------------------------- -// -void CHsBrowserModel::SetStaticTitle( const TDesC& aStaticTitle ) - { - if ( iStaticTitle ) - { - delete iStaticTitle; - iStaticTitle = NULL; - } - iStaticTitle = aStaticTitle.Alloc(); - } - -// --------------------------------------------------------- -// CHsBrowserModel::SetPageTitle -// --------------------------------------------------------- -// -void CHsBrowserModel::SetPageTitle( const TDesC& aPageTitle ) - { - if ( iPageTitle ) - { - delete iPageTitle; - iPageTitle = NULL; - } - iPageTitle = aPageTitle.Alloc(); - } - - -#endif // HSBROWSERMODEL_INL diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/inc/hsbrowserspecialloadobserver.h --- a/hotspotfw/hsbrowser/inc/hsbrowserspecialloadobserver.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Handle special load requests like Non-HTTP(S) load requests, -* and Non-HTML content. Control over network connections -* -*/ - - - -#ifndef HSBROWSERSPECIALLOADOBSERVER_H -#define HSBROWSERSPECIALLOADOBSERVER_H - -// INCLUDES -#include -#include - -// CLASS DECLARATION - -/** -* CHsBrowserSpecialLoadObserver class. -* This class inherits from the MBrCtlSpecialLoadObserver interface which -* is used if the host application requires: Handling of non-HTTP(S) load requests; -* Handling of non-markup content; Control over network connections -*/ -class CHsBrowserSpecialLoadObserver : public CBase, public MBrCtlSpecialLoadObserver - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CHsBrowserSpecialLoadObserver* NewL(); - - /** - * Destructor. - */ - ~CHsBrowserSpecialLoadObserver(); - - public: // from MBrCtlSpecialLoadObserver - - /** - * Request to create a network connection. - * @since 2.8 - * @param aConnectionPtr A pointer to the new connection. If NULL, the proxy filter will automatically create a network connection - * @param aSockSvrHandle A handle to the socket server. - * @param aNewConn A flag if a new connection was created. If the connection is not new, proxy filter optimization will not read the proxy again from CommsBd - * @param aBearerType The bearer type of the new connection - * @return void - */ - void NetworkConnectionNeededL( TInt* aConnectionPtr, - TInt* aSockSvrHandle, - TBool* /*aNewConn*/, - TApBearerType* /*aBearerType*/ ); - /** - * Request the host applicaion to handle non-http request. - * @since 2.8 - * @param aTypeArray Array of download parameter types. These types indicates the type of data contained within the DesArray - * @param aDesArray Array of values associated with the types in the type array. - * @return ETrue, If the request is handled by the host application. EFalse if not - */ - TBool HandleRequestL( RArray* /*aTypeArray*/, - CDesCArrayFlat* /*aDesArray*/ ); - - /** - * Request the host applicaion to handle downloads - * @since 2.8 - * @param aTypeArray Array of download parameter types - * @param aDesArray Array of values associated with the types in the type array - * @return ETrue, If the request is handled by the host application. EFalse if not - */ - TBool HandleDownloadL( RArray* /*aTypeArray*/, - CDesCArrayFlat* /*aDesArray*/ ); - - public: // access methods - - /** - * Accessor method for iConnectionPtr. - */ - void SetConnectionPtr( TInt aConnectionPtr ); - - /** - * Accessor method for iSockSvrHandle. - */ - void SetSockSvrHandle( TInt aSockSvrHandle ); - - private: - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: - - /** - * Connection handle. - */ - TInt iConnectionPtr; - - /** - * Socket server handle. - */ - TInt iSockSvrHandle; - }; - -#endif // HSBROWSERSPECIALLOADOBSERVER_H - -// End of File - diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/loc/hsbrowser.loc --- a/hotspotfw/hsbrowser/loc/hsbrowser.loc Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Localization file. -* -*/ - - - -// LOCALISATION STRINGS - -//d:A static title is displayed during the rendering of the page, and replaced -//d:by the web page title when it is available. If the web page does not have -//d:a title, the static title remains in the status pane. -//l:status_small_pane_t1/opt3 -//w: -//r:3.2 -// -#define qtn_netw_conset_wba_static_title "WLAN login" - -//d:As soon as authentication can be detected as complete, -//d:this information note is displayed, -//d:and the logon application is sent to background. -//l:popup_note_window -//w: -//r:3.2 -// -#define qtn_netw_conset_wba_info_complete "Login complete. Application will be sent to background." - -//d:If the WLAN connection is closed when logon application is in foreground, -//d:this information note is displayed and application is closed. -//l:popup_note_window -//w: -//r:3.2 -// -#define qtn_netw_conset_wba_info_closed "WLAN connection closed. Login application will now exit." - -//d:Softkey used in authentication process. -//l:control_pane_t1/opt7 -//w: -//r:3.2 -// -#define text_softkey_continue "Continue" - -// End of File diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/src/hsbrowserapp.cpp --- a/hotspotfw/hsbrowser/src/hsbrowserapp.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implements the main application class. -* -*/ - - - -// INCLUDE FILES -#include - -#include "hsbrowserapp.h" -#include "hsbrowserdocument.h" -#include "hsbrowsercommon.h" -#include "am_debug.h" - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CHsBrowserApp::AppDllUid() -// Returns application UID -// --------------------------------------------------------- -// -TUid CHsBrowserApp::AppDllUid() const - { - return KUidHsBrowserApp; - } - -// --------------------------------------------------------- -// CDictionaryStore* CHsBrowserApp::OpenIniFileLC(RFs& aFs) const -// overrides CAknApplication::OpenIniFileLC to enable INI file support -// --------------------------------------------------------- -// -CDictionaryStore* CHsBrowserApp::OpenIniFileLC( RFs& aFs ) const - { - return CEikApplication::OpenIniFileLC( aFs ); - } - -// --------------------------------------------------------- -// CHsBrowserApp::CreateDocumentL() -// Creates CHsBrowserAppDocument object -// --------------------------------------------------------- -// -CApaDocument* CHsBrowserApp::CreateDocumentL() - { - return CHsBrowserDocument::NewL( *this ); - } - -// ================= OTHER EXPORTED FUNCTIONS ============== -// -// --------------------------------------------------------- -// NewApplication() -// Constructs CHsBrowserApp -// Returns: created application object -// --------------------------------------------------------- -// -LOCAL_C CApaApplication* NewApplication( ) - { - return new CHsBrowserApp; - } - -// --------------------------------------------------------- -// E32Main -// Main function for Symbian OS v9 EXE application -// Returns: TInt -// --------------------------------------------------------- -GLDEF_C TInt E32Main() - { - DEBUG( "***** Starting Hotspot Browser Logon Application..." ); - return EikStart::RunApplication( NewApplication ); - } - -// End of File diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/src/hsbrowserappui.cpp --- a/hotspotfw/hsbrowser/src/hsbrowserappui.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,204 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: The UI class for HotSpot Browser Application. -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include - -#include "hsbrowserappui.h" -#include "hsbrowsercontainer.h" -#include "hsbrowserdocument.h" -#include "hsbrowsercommon.h" -#include "am_debug.h" - -// ================= MEMBER FUNCTIONS ======================= -// -// ---------------------------------------------------------- -// CHsBrowserAppUi::ConstructL() -// ---------------------------------------------------------- -// -void CHsBrowserAppUi::ConstructL() - { - DEBUG( "CHsBrowserAppUi::ConstructL()" ); - BaseConstructL( CAknAppUi::EAknEnableSkin ); - CHsBrowserModel* model; - model = static_cast(iDocument)->Model(); - iAppContainer = new (ELeave) CHsBrowserContainer( model ); - iAppContainer->SetMopParent( this ); - iAppContainer->ConstructL( ClientRect() ); - AddToStackL( iAppContainer ); - } - -// ---------------------------------------------------- -// CHsBrowserAppUi::~CHsBrowserAppUi() -// Destructor -// Frees reserved resources -// ---------------------------------------------------- -// -CHsBrowserAppUi::~CHsBrowserAppUi() - { - DEBUG( "CHsBrowserAppUi::~CHsBrowserAppUi()" ); - if ( iAppContainer ) - { - RemoveFromStack( iAppContainer ); - delete iAppContainer; - } - } - -// ---------------------------------------------------- -// CHsBrowserAppUi::ProcessCommandParametersL -// ---------------------------------------------------- -// -TBool CHsBrowserAppUi::ProcessCommandParametersL( - CApaCommandLine& aCommandLine ) - { - DEBUG( "CHsBrowserAppUi::ProcessCommandParametersL()" ); - - TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); - TApaTask task = taskList.FindApp( KUidHsBrowserApp ); - task.BringToForeground(); - - TBuf args; - args.Copy( aCommandLine.DocumentName() ); - - if ( args.Length() == 0 ) - { - // No arguments, meaning started from application menu. - // Continue normally, for testing purposes - return EFalse; - } - - TLex wordLex( args ); - TPtrC word; - // get IAP ID - word.Set( wordLex.NextToken() ); - TInt iapId; - TLex x1( word ); - TInt err = x1.Val( iapId ); - if ( err != KErrNone ) - { - DEBUG1( "CHsBrowserAppUi::ProcessCommandParametersL() x1.Val(), err=%d", - err ); - } - // get net ID - word.Set( wordLex.NextToken() ); - TInt netId; - TLex x2( word ); - err = x2.Val( netId ); - if ( err != KErrNone ) - { - DEBUG1( "CHsBrowserAppUi::ProcessCommandParametersL() x2.Val(), err=%d", - err ); - } - // get URL - TPtrC url( wordLex.NextToken() ); - - err = iAppContainer->LoadRedirect( url, iapId, netId ); - if ( err != KErrNone ) - { - DEBUG1( "CHsBrowserAppUi::ProcessCommandParametersL() LoadRedirect(), err=%d", - err ); - } - return EFalse; -} - -// ---------------------------------------------------- -// CHsBrowserAppUi::HandleCommandL(TInt aCommand) -// ---------------------------------------------------- -// -void CHsBrowserAppUi::HandleCommandL( TInt aCommand ) - { - DEBUG1( "CHsBrowserAppUi::HandleCommandL() aCommmand=%d", aCommand ); - - switch ( aCommand ) - { - case EAknSoftkeyCancel: - { - iAppContainer->HandleCommandL( aCommand ); - Exit(); - break; - } - case EAknSoftkeyClose: - { - // Now for sure we know that we are in input box. - // Next close aCommand should be treated as EAknSoftkeyCancel - iAppContainer->SetActiveInputBox( ETrue ); - // change softkey to Cancel... - CEikButtonGroupContainer* cba = CEikonEnv::Static()-> - AppUiFactory()->Cba(); - if ( cba ) - { - cba->SetCommandSetL( R_AVKON_SOFTKEYS_CANCEL ); - cba->DrawNow(); - } - break; - } - case EAknSoftkeyExit: - case EAknSoftkeyBack: - case EEikCmdExit: - { - iAppContainer->HandleCommandL( aCommand ); - Exit(); - break; - } - case EAknCmdHelp: - { - HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), - AppHelpContextL()); - break; - } - - default: - iAppContainer->HandleCommandL( aCommand ); - break; - } - } - -// ---------------------------------------------------- -// CHsBrowserAppUi::HandleKeyEventL() -// ---------------------------------------------------- -// -TKeyResponse CHsBrowserAppUi::HandleKeyEventL( - const TKeyEvent& aKeyEvent,TEventCode aType) - { - //DEBUG( "CHsBrowserAppUi::HandleKeyEventL()" ) - return iAppContainer->HandleKeyEventL(aKeyEvent, aType); - } - -// --------------------------------------------------------- -// CHsBrowserAppUi::HandleForegroundEventL() -// --------------------------------------------------------- -// -void CHsBrowserAppUi::HandleForegroundEventL( TBool aForeground ) - { - DEBUG( "CHsBrowserAppUi::HandleForegroundEventL()" ); - - CAknAppUi::HandleForegroundEventL( aForeground ); - if ( iAppContainer ) - { - iAppContainer->ProcessForegroundEvent( aForeground ); - } - } - - -// End of File diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/src/hsbrowsercontainer.cpp --- a/hotspotfw/hsbrowser/src/hsbrowsercontainer.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,687 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of the container control for HotSpot Browser Application. -* -*/ - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "hotspotclientserver.h" -#include "hsbrowsercontainer.h" -#include "hsbrowserloadeventobserver.h" -#include "hsbrowserloadeventobserver.h" -#include "hsbrowserspecialloadobserver.h" -#include "hsbrowserictsobserver.h" -#include "hsbrowserhssrvnotifs.h" -#include "hsbrowsermodel.h" -#include "hsbrowsercommon.h" -#include "am_debug.h" - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CHsBrowserContainer::CHsBrowserContainer() -// Constructor. -// --------------------------------------------------------- -// -CHsBrowserContainer::CHsBrowserContainer( CHsBrowserModel* aModel ) : - iModel( aModel ), - iNaviPane( NULL ), - iEditorIndicatorContainer( NULL), - iIndiContainer( NULL ), - iResource( 0 ), - iActiveInputBox( EFalse ) - { - DEBUG( "CHsBrowserContainer::CHsBrowserContainer()" ); - } - - -// --------------------------------------------------------- -// CHsBrowserContainer::ConstructL(const TRect& aRect) -// EPOC two phased constructor -// --------------------------------------------------------- -// -void CHsBrowserContainer::ConstructL( const TRect& aRect ) - { - DEBUG( "CHsBrowserContainer::ConstructL()" ); - CreateWindowL(); - - // create observers - iHsBrowserSpecialLoadObserver = CHsBrowserSpecialLoadObserver::NewL(); - iHsBrowserLoadEventObserver = CHsBrowserLoadEventObserver::NewL( this ); - iHsBrowserIctsObserver = CHsBrowserIctsObserver::NewL( this ); - iHsBrowserHsSrvNotifs = CHsBrowserHsSrvNotifs::NewL( this ); - - iCommandBase = TBrCtlDefs::ECommandIdBase; - TUint brCtlCapabilities = TBrCtlDefs::ECapabilityLoadHttpFw | - TBrCtlDefs::ECapabilityDisplayScrollBar | - TBrCtlDefs::ECapabilityCursorNavigation; - iBrCtlInterface = CreateBrowserControlL( - this, - aRect, - brCtlCapabilities, - iCommandBase, - NULL, // softkey observer - NULL, // link resolver - iHsBrowserSpecialLoadObserver, - NULL, // layout observer - NULL, // dialog provider - NULL, // window observer - NULL );// download observer - - // disable ESettingsSecurityWarnings setting, - // or implement MBrCtlDialogsProvider interface - // reason: default implementation of MBrCtlDialogsProvider::DialogConfirmL - // returns EFalse and page is not loaded. - iBrCtlInterface->SetBrowserSettingL( - TBrCtlDefs::ESettingsSecurityWarnings, EFalse ); - - // auto load on - iBrCtlInterface->SetBrowserSettingL ( - TBrCtlDefs::ESettingsAutoLoadImages, - ETrue); - - iBrCtlInterface->SetBrowserSettingL ( - TBrCtlDefs::ESettingsCookiesEnabled, - ETrue); - - iBrCtlInterface->SetBrowserSettingL ( - TBrCtlDefs::ESettingsCSSFetchEnabled, - ETrue); - - iBrCtlInterface->SetBrowserSettingL ( - TBrCtlDefs::ESettingsECMAScriptEnabled, - ETrue); - - // this observer can be added and removed dynamically - iBrCtlInterface->AddLoadEventObserverL( iHsBrowserLoadEventObserver ); - - // init navi pane indicators - InitNaviPaneL(); - - // load resource file - TFileName fileName; - fileName.Append( KDriveZ ); - fileName.Append( KDC_APP_RESOURCE_DIR ); - fileName.Append( KResourceFile ); - BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), - fileName ); - iResource = CCoeEnv::Static()->AddResourceFileL( fileName ); - - HBufC* title = StringLoader::LoadL( R_QTN_NETW_CONSET_WBA_STATIC_TITLE ); - - iModel->SetStaticTitle( *title ); - delete title; - - // activate WLAN MGMT API notifications, - // we need to know when network is lost - iMgtClient = CWlanMgmtClient::NewL(); - iMgtClient->ActivateNotificationsL( *iHsBrowserHsSrvNotifs ); - - SetRect( aRect ); // set the size - ActivateL(); // activate the window - SetFocus( ETrue ); - } - -// --------------------------------------------------------- -// CHsBrowserContainer::~CHsBrowserContainer() -// Destructor. -// --------------------------------------------------------- -// -CHsBrowserContainer::~CHsBrowserContainer() - { - DEBUG( "CHsBrowserContainer::~CHsBrowserContainer()" ); - if ( iMgtClient ) - { - iMgtClient->CancelNotifications(); - delete iMgtClient; - } - - iBrCtlInterface->RemoveLoadEventObserver( iHsBrowserLoadEventObserver ); - delete iBrCtlInterface; - - // delete observers - delete iHsBrowserSpecialLoadObserver; - delete iHsBrowserLoadEventObserver; - delete iHsBrowserIctsObserver; - - // cancels also notifications - delete iHsBrowserHsSrvNotifs; - - if ( iResource ) - { - CCoeEnv::Static()->DeleteResourceFile( iResource ); - } - - delete iEditorIndicatorContainer; - DEBUG( "CHsBrowserContainer::~CHsBrowserContainer() DONE" ); - } - - -// --------------------------------------------------------- -// CHsBrowserContainer::InitNaviPaneL() -// Initializes the indicators in the navi pane. -// --------------------------------------------------------- -// -void CHsBrowserContainer::InitNaviPaneL() - { - DEBUG( "CHsBrowserContainer::InitNaviPaneL()" ); - if ( !iEditorIndicatorContainer ) - { - CEikStatusPane* statusPane = iAvkonAppUi->StatusPane(); - if ( statusPane ) - { - iNaviPane = (CAknNavigationControlContainer*) - statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ); - if ( iNaviPane ) - { - iEditorIndicatorContainer = - iNaviPane->CreateEditorIndicatorContainerL(); - } - } - } - - if ( !iIndiContainer && iEditorIndicatorContainer ) - { - iIndiContainer = (CAknIndicatorContainer*) iEditorIndicatorContainer->DecoratedControl(); - } - - if ( iNaviPane && iEditorIndicatorContainer ) - { - iNaviPane->PushL( *iEditorIndicatorContainer ); - } - - } - -// --------------------------------------------------------- -// CHsBrowserContainer::SizeChanged() -// Called by framework when the view size is changed -// --------------------------------------------------------- -// -void CHsBrowserContainer::SizeChanged() - { - DEBUG( "CHsBrowserContainer::SizeChanged()" ); - iBrCtlInterface->SetRect(Rect()); - } - -// --------------------------------------------------------- -// CHsBrowserContainer::CountComponentControls() const -// --------------------------------------------------------- -// -TInt CHsBrowserContainer::CountComponentControls() const - { - return KComponentsNumber; - } - -// --------------------------------------------------------- -// CHsBrowserContainer::ComponentControl(TInt aIndex) const -// --------------------------------------------------------- -// -CCoeControl* CHsBrowserContainer::ComponentControl(TInt aIndex) const - { - switch ( aIndex ) - { - case KBrCtlComponentIndex: - return iBrCtlInterface; - default: - return NULL; - } - } - - -// ------------------------------------------------------------------ -// CHsBrowserContainer::UpdateNaviPane( TNaviPaneEvent aUpdateEvent ) -// ------------------------------------------------------------------ -// -void CHsBrowserContainer::UpdateNaviPane( TNaviPaneEvent aUpdateEvent ) - { - DEBUG( "CHsBrowserContainer::UpdateNaviPane()" ); - - iIndiContainer->SetIndicatorState( - TUid::Uid( EAknNaviPaneEditorIndicatorMessageInfo ), - EAknIndicatorStateOn ); - - switch( aUpdateEvent ) - { - case ELoadingLoginPage: - { - TRAP_IGNORE( iIndiContainer->SetIndicatorValueL( - TUid::Uid( EAknNaviPaneEditorIndicatorMessageInfo ), - *iModel->StaticTitle() ) ); - iIndiContainer->SetIndicatorState( - TUid::Uid( EAknNaviPaneEditorIndicatorWaitBar ), - EAknIndicatorStateAnimate ); - break; - } - case ELoadingUrl: - { - iIndiContainer->SetIndicatorState( - TUid::Uid( EAknNaviPaneEditorIndicatorWaitBar ), - EAknIndicatorStateAnimate ); - break; - } - case EPageTitleAvailable: - { - TRAP_IGNORE( iIndiContainer->SetIndicatorValueL( - TUid::Uid( EAknNaviPaneEditorIndicatorMessageInfo ), - *iModel->PageTitle() ) ); - break; - } - case ELoadingFinished: - { - iIndiContainer->SetIndicatorState( - TUid::Uid( EAknNaviPaneEditorIndicatorWaitBar ), - EAknIndicatorStateOff ); - break; - } - } - - iIndiContainer->DrawNow(); - } - -// ---------------------------------------------------- -// CHsBrowserContainer::HandleCommandL(TInt aCommand) -// ---------------------------------------------------- -// -void CHsBrowserContainer::HandleCommandL(TInt aCommand) - { - DEBUG1( "CHsBrowserContainer::HandleCommandL() aCommand=%d", aCommand ); - switch ( aCommand ) - { - case EAknSoftkeyNext: - ShowLoginCompleteNote(); - SendToBackground(); - break; - case EAknSoftkeyCancel: - case EAknSoftkeyBack: - case EAknSoftkeyExit: - case EEikCmdExit: - { - iBrCtlInterface->HandleCommandL( - TBrCtlDefs::ECommandCancelFetch + - TBrCtlDefs::ECommandIdBase ); - iModel->SetState( EHsBrowserUiClosed, ETrue ); - break; - } - case EAknCmdHelp: - { - HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), - iEikonEnv->EikAppUi()->AppHelpContextL()); - break; - } - default: - if ( aCommand >= iCommandBase && - aCommand < iCommandBase + TBrCtlDefs::ECommandIdRange ) - { - iBrCtlInterface->HandleCommandL( aCommand ); - } - break; - } - } - -// ---------------------------------------------------- -// CHsBrowserContainer::HandleKeyEventL( -// const TKeyEvent& aKeyEvent,TEventCode /*aType*/) -// ---------------------------------------------------- -// -TKeyResponse CHsBrowserContainer::HandleKeyEventL( - const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/) - { - return EKeyWasNotConsumed; - } - -// ---------------------------------------------------- -// CHsBrowserContainer::SendToForeground() -// ---------------------------------------------------- -// -void CHsBrowserContainer::SendToForeground() - { - DEBUG( "CHsBrowserContainer::SendToForeground()" ); - - // because "Connecting via..." note hides hsbrowser, - // send hsbrowser to foreground - CCoeEnv::Static()->RootWin().SetOrdinalPosition( 0, - ECoeWinPriorityNormal ); - CCoeEnv::Static()->WsSession().Flush(); - } - -// ---------------------------------------------------- -// CHsBrowserContainer::RestorePositionAndPriority() -// ---------------------------------------------------- -// -void CHsBrowserContainer::RestorePositionAndPriority() - { - DEBUG( "CHsBrowserContainer::RestorePositionAndPriority()" ); - - RWindowGroup& wg = CEikonEnv::Static()->RootWin(); - - // because "Connecting via..." note hides hsbrowser, - // it was assigned ECoeWinPriorityAlwaysAtFront priority, - // restore original now - if ( wg.OrdinalPriority() == ECoeWinPriorityAlwaysAtFront ) - { - CCoeEnv::Static()->RootWin().SetOrdinalPosition( - iModel->Position(), iModel->Priority() ); - } - } - -// --------------------------------------------------------- -// CHsBrowserContainer::SendToBackground -// --------------------------------------------------------- -// -void CHsBrowserContainer::SendToBackground() - { - DEBUG( "CHsBrowserContainer::SendToBackground()" ); - - RWindowGroup& wg = CEikonEnv::Static()->RootWin(); - - // Construct en empty TApaTask object - // giving it a reference to the Window Server session - TApaTask task( CEikonEnv::Static()->WsSession() ); - - // Initialise the object with the window group id of - // our application (so that it represent our app) - task.SetWgId( wg.Identifier() ); - - // Request window server to bring our application - // to foreground - DEBUG("CHsBrowserContainer::SendToBackground() sending to background" ); - task.SendToBackground(); - } - -// ---------------------------------------------------- -// CHsBrowserContainer::ProcessForegroundEvent() -// ---------------------------------------------------- -// -void CHsBrowserContainer::ProcessForegroundEvent( TBool aForeground ) - { - DEBUG1( "CHsBrowserContainer::ProcessForegroundEvent() aForeground = %d", aForeground ); - iModel->SetForeground( aForeground ); - UpdateSoftkeys(); - } - -// ---------------------------------------------------- -// CHsBrowserContainer::OfferKeyEventL(const -// TKeyEvent& aKeyEvent,TEventCode aType) -// ---------------------------------------------------- -// -TKeyResponse -CHsBrowserContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) - { - DEBUG( "CHsBrowserContainer::OfferKeyEventL()" ); - - TUint state = iModel->State(); - TBrCtlDefs::TBrCtlElementType elem = iBrCtlInterface->FocusedElementType(); - DEBUG1( "CHsBrowserContainer::OfferKeyEventL() type: %d", elem); - - if ( elem == TBrCtlDefs::EElementActivatedInputBox || elem == TBrCtlDefs::EElementInputBox ) - { - if ( !iActiveInputBox && state != EHsBrowserUiAuthenticatedOk ) - { - // change softkey - CEikButtonGroupContainer* cba = CEikonEnv::Static()-> - AppUiFactory()->Cba(); - if ( cba ) - { - cba->SetCommandSetL( R_HSBROWSER_SOFTKEYS_CANCEL ); - cba->DrawNow(); - } - } - iActiveInputBox = EFalse; - } - else - { - CEikButtonGroupContainer* cba = CEikonEnv::Static()-> - AppUiFactory()->Cba(); - if ( cba && state != EHsBrowserUiAuthenticatedOk ) - { - cba->SetCommandSetL( R_AVKON_SOFTKEYS_CANCEL ); - cba->DrawNow(); - } - } - DEBUG( "CHsBrowserContainer::OfferKeyEventL() done to iBrCtl" ); - return iBrCtlInterface->OfferKeyEventL(aKeyEvent, aType); - } - -// ---------------------------------------------------- -// CHsBrowserContainer::HandleResourceChange() -// ---------------------------------------------------- -// -void CHsBrowserContainer::HandleResourceChange( TInt aType ) - { - DEBUG( "CHsBrowserContainer::HandleResourceChange" ); - CCoeControl::HandleResourceChange( aType ); - - // Adjust Browser size to screen when screen layout is changed - // Vertical vs. horizontal - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - DEBUG( "CHsBrowserContainer::HandleResourceChange = KEikDynamicLayoutVariantSwitch" ); - TRect mainPaneRect; - AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, - mainPaneRect ); - SetRect( mainPaneRect ); - DrawDeferred(); - } - } - - -// ---------------------------------------------------- -// CHsBrowserContainer::UpdateSoftkeys() -// ---------------------------------------------------- -// -void CHsBrowserContainer::UpdateSoftkeys() - { - DEBUG( "CHsBrowserContainer::UpdateSoftkeys()" ); - - TBool foreground = iModel->Foreground(); - TUint state = iModel->State(); - - if ( !foreground && state == EHsBrowserUiAuthenticatedOk ) - { - // R_HSBROWSER_SOFTKEYS_CONTINUE_EXIT - CEikButtonGroupContainer* cba = CEikonEnv::Static()->AppUiFactory()->Cba(); - if ( cba ) - { - TRAP_IGNORE( cba->SetCommandSetL( R_HSBROWSER_SOFTKEYS_CONTINUE_EXIT ) ); - cba->DrawNow(); - } - } - } - -// ---------------------------------------------------- -// CHsBrowserContainer::LoadRedirect -// ---------------------------------------------------- -// -TInt CHsBrowserContainer::LoadRedirect( const TPtrC& aUrl, - TInt aIapId, TInt aNetId ) - { - DEBUG( "CHsBrowserContainer::LoadRedirect()" ); - - TInt err = KErrNone; - - UpdateNaviPane( ELoadingLoginPage ); - - // init model - iModel->SetIapId( aIapId ); - iModel->SetNetId( aNetId ); - iModel->SetUrl( aUrl ); - // attach - err = iModel->Attach(); - if ( err != KErrNone ) - { - DEBUG1( "CHsBrowserContainer::LoadRedirect() Attach() err=%d", err ); - } - else - { - TInt connPtr = REINTERPRET_CAST( TInt, &iModel->Connection() ); - if ( iHsBrowserSpecialLoadObserver ) - { - iHsBrowserSpecialLoadObserver->SetConnectionPtr( connPtr ); - iHsBrowserSpecialLoadObserver->SetSockSvrHandle( - iModel->SocketServ().Handle() ); - } - } - - if ( err == KErrNone ) - { - TRAP( err, iBrCtlInterface->LoadUrlL( aUrl ) ); - DEBUG1( "CHsBrowserContainer::LoadRedirect() iBrCtlInterface->\ - LoadUrlL() err=%d", err ); - } - return err; - } - -// --------------------------------------------------------- -// CHsBrowserContainer::ProcessWlanConnModeNotConnected -// --------------------------------------------------------- -// -void CHsBrowserContainer::ProcessWlanConnModeNotConnected() - { - DEBUG( "CHsBrowserContainer::ProcessWlanConnModeNotConnected()" ); - - // Workaround for "WLAN login application closed" error: - TRAP_IGNORE( iBrCtlInterface->HandleCommandL( - TBrCtlDefs::ECommandCancelFetch + - TBrCtlDefs::ECommandIdBase )); - - ShowConnClosedNote(); - iAvkonAppUi->Exit(); - } - -// --------------------------------------------------------- -// CHsBrowserContainer::ShowLoginCompleteNote -// --------------------------------------------------------- -// -void CHsBrowserContainer::ShowLoginCompleteNote() - { - TBool noteShown = iModel->LoginCompleteNoteShown(); - DEBUG1( "CHsBrowserContainer::ShowLoginCompleteNote() noteShown=%d", noteShown ); - - TInt pos = CCoeEnv::Static()->RootWin().OrdinalPosition(); - DEBUG1( "CHsBrowserContainer::ShowLoginCompleteNote() pos=%d", pos ); - - if ( !noteShown && pos == 0 ) - { - DEBUG( "CHsBrowserContainer::ShowLoginCompleteNote() showing note" ); - - HBufC* message = NULL; - TRAPD( err, message = StringLoader::LoadLC( R_QTN_NETW_CONSET_WBA_INFO_COMPLETE ); CleanupStack::Pop( message ) ); - if (err == KErrNone) - { - // Global note needed here, because CAknInformationNote was sometimes causing chrashes - CAknGlobalNote* note = NULL; - TRAP( err, note = CAknGlobalNote::NewLC(); CleanupStack::Pop( note ) ); - if (err == KErrNone) - { - TRAP( err, note->ShowNoteL( EAknGlobalInformationNote, *message ) ); - if (err == KErrNone) - { - DEBUG( "CHsBrowserContainer::ShowLoginCompleteNote(): Showing note DONE" ); - } - delete note; - } - delete message; - } - iModel->SetLoginCompleteNoteShown( ETrue ); - } - } - -// ---------------------------------------------------- -// CHsBrowserContainer::ShowConnClosedNote -// ---------------------------------------------------- -// -void CHsBrowserContainer::ShowConnClosedNote() - { - DEBUG( "CHsBrowserContainer::ShowConnClosedNote()" ); - if ( IsForeground() ) - { - DEBUG( "CHsBrowserContainer::ShowConnClosedNote() Foreground" ); - HBufC* message = NULL; - TRAPD( err, message = StringLoader::LoadLC( R_QTN_NETW_CONSET_WBA_INFO_CLOSED ); CleanupStack::Pop( message ) ); - if (err == KErrNone) - { - // use global note here, otherwise overlap problem - // appears with "Wlan network lost" note, which is - // also a global note. - CAknGlobalNote* note = NULL; - TRAP( err, note = CAknGlobalNote::NewLC(); CleanupStack::Pop( note ) ); - if (err == KErrNone) - { - TRAP( err, note->ShowNoteL( EAknGlobalInformationNote, *message ) ); - if (err == KErrNone) - { - DEBUG( "CHsBrowserContainer::ShowConnClosedNote(): Showing note DONE" ); - } - delete note; - } - delete message; - } - } - } - -// ---------------------------------------------------- -// CHsBrowserContainer::IsForeground() -// ---------------------------------------------------- -// -TBool CHsBrowserContainer::IsForeground() - { - DEBUG( "CHsBrowserContainer::IsForeground()" ); - TInt32 foregroundUid(0); - RWsSession ws; - TInt ret = ws.Connect(); - if ( KErrNone == ret ) - { - TApaTaskList taskList = TApaTaskList( ws ); - TApaTask foregroundTask = taskList.FindByPos( 0 ); - - CApaWindowGroupName* wgName = NULL; - TRAPD( err, wgName = CApaWindowGroupName::NewLC( ws, foregroundTask.WgId() ); CleanupStack::Pop( wgName ) ); - if (err == KErrNone) - { - foregroundUid = wgName->AppUid().iUid; - delete wgName; - } - ws.Close(); - } - return foregroundUid == KUidHsBrowserApp.iUid; - } - -// End of File diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/src/hsbrowserdocument.cpp --- a/hotspotfw/hsbrowser/src/hsbrowserdocument.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implements the document for application. -* -*/ - - - -// INCLUDE FILES -#include "hsbrowserdocument.h" -#include "hsbrowserappui.h" -#include "hsbrowsermodel.h" -#include "am_debug.h" - -// ================= MEMBER FUNCTIONS ======================= - -// ---------------------------------------------------- -// CHsBrowserDocument::CHsBrowserDocument -// ---------------------------------------------------- -// -CHsBrowserDocument::CHsBrowserDocument( CEikApplication& aApp ) -: CAknDocument(aApp), iModel( NULL ) - { - } - -// ---------------------------------------------------- -// CHsBrowserDocument::~CHsBrowserDocument -// ---------------------------------------------------- -// -CHsBrowserDocument::~CHsBrowserDocument() - { - DEBUG( "CHsBrowserDocument::~CHsBrowserDocument()" ); - if ( iModel ) - { - delete iModel; - } - } - -// ---------------------------------------------------- -// CHsBrowserDocument::ConstructL -// ---------------------------------------------------- -// -void CHsBrowserDocument::ConstructL() - { - DEBUG( "CHsBrowserDocument::ConstructL()" ); - iModel = CHsBrowserModel::NewL(); - } - -// ---------------------------------------------------- -// CHsBrowserDocument::NewL -// ---------------------------------------------------- -// -CHsBrowserDocument* CHsBrowserDocument::NewL( - CEikApplication& aApp) - { - CHsBrowserDocument* self = new (ELeave) CHsBrowserDocument( aApp ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// ---------------------------------------------------- -// CHsBrowserDocument::CreateAppUiL() -// constructs CBrCtlSampleAppUi -// ---------------------------------------------------- -// -CEikAppUi* CHsBrowserDocument::CreateAppUiL() - { - return new (ELeave) CHsBrowserAppUi; - } - -// End of File diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/src/hsbrowserhssrvnotifs.cpp --- a/hotspotfw/hsbrowser/src/hsbrowserhssrvnotifs.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implements notifications interface from Hotspot server in order -* to receive wlan connection closed notification. -* -*/ - - - -// INCLUDE FILES -#include -#include - -#include "hsbrowserhssrvnotifs.h" -#include "hsbrowsercontainer.h" -#include "am_debug.h" - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CHsBrowserHsSrvNotifs::NewL -// --------------------------------------------------------- -// -CHsBrowserHsSrvNotifs* CHsBrowserHsSrvNotifs::NewL( - CHsBrowserContainer* aContainer ) - { - DEBUG( "CHsBrowserHsSrvNotifs::CHsBrowserHsSrvNotifs::NewL()()" ); - CHsBrowserHsSrvNotifs* self = new(ELeave) CHsBrowserHsSrvNotifs( aContainer ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------- -// CHsBrowserHsSrvNotifs::CHsBrowserHsSrvNotifs -// --------------------------------------------------------- -// -CHsBrowserHsSrvNotifs::~CHsBrowserHsSrvNotifs() - { - DEBUG( "CHsBrowserHsSrvNotifs::~CHsBrowserHsSrvNotifs()" ); - } - -// ----------------------------------------------------------------------------- -// CHsBrowserHsSrvNotifs::ConnectionStateChanged -// ----------------------------------------------------------------------------- -// - -void CHsBrowserHsSrvNotifs::ConnectionStateChanged( TWlanConnectionMode aNewState ) - { - DEBUG1( "CHsBrowserHsSrvNotifs::ConnectionStateChanged() aNewState=%d", aNewState ); - if ( aNewState == EWlanConnectionModeNotConnected ) - { - iContainer->ProcessWlanConnModeNotConnected(); - } - } - -// --------------------------------------------------------- -// CHsBrowserHsSrvNotifs::CHsBrowserHsSrvNotifs -// --------------------------------------------------------- -// -CHsBrowserHsSrvNotifs::CHsBrowserHsSrvNotifs( - CHsBrowserContainer* aContainer ) : iContainer( aContainer ) - { - DEBUG( "CHsBrowserHsSrvNotifs::CHsBrowserHsSrvNotifs()" ); - } - -// --------------------------------------------------------- -// CHsBrowserHsSrvNotifs::ConstructL -// --------------------------------------------------------- -// -void CHsBrowserHsSrvNotifs::ConstructL() - { - DEBUG( "CHsBrowserHsSrvNotifs::ConstructL()" ); - } - -// End of File diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/src/hsbrowserictsobserver.cpp --- a/hotspotfw/hsbrowser/src/hsbrowserictsobserver.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implements callback interface for Internet Connectivity Test Service -* notifications. -* -*/ - - - -// INCLUDE FILES -#include -#include - -#include "hsbrowserictsobserver.h" -#include "hsbrowsercontainer.h" -#include "hotspotclientserver.h" -#include "hsbrowsermodel.h" -#include "am_debug.h" - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CHsBrowserIctsObserver::NewL -// --------------------------------------------------------- -// -CHsBrowserIctsObserver* CHsBrowserIctsObserver::NewL( - CHsBrowserContainer* aContainer ) - { - DEBUG( "CHsBrowserIctsObserver::CHsBrowserIctsObserver::NewL()()" ); - CHsBrowserIctsObserver* self = new(ELeave) CHsBrowserIctsObserver( aContainer ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------- -// CHsBrowserIctsObserver::~CHsBrowserIctsObserver -// --------------------------------------------------------- -// -CHsBrowserIctsObserver::~CHsBrowserIctsObserver() - { - DEBUG( "CHsBrowserIctsObserver::~CHsBrowserIctsObserver()" ); - } - -// ----------------------------------------------------------------------------- -// CHsBrowserIctsObserver::ConnectivityObserver -// ----------------------------------------------------------------------------- -// -void CHsBrowserIctsObserver::ConnectivityObserver( TIctsTestResult aResult, - const TDesC& /* aString */ ) - { - DEBUG1("CHsBrowserIctsObserver::ConnectivityObserver() result: %d", aResult); - switch ( aResult ) - { - case EConnectionOk : - ProcessConnectionOk(); - break; - case EHttpAuthenticationNeeded : - case EConnectionNotOk : - case ETimeout : - default: - break; - } - } - -// --------------------------------------------------------- -// CHsBrowserIctsObserver::ProcessConnectionOk -// --------------------------------------------------------- -// -void CHsBrowserIctsObserver::ProcessConnectionOk() - { - DEBUG( "CHsBrowserIctsObserver::ProcessConnectionOk()" ); - if ( iContainer ) - { - CHsBrowserModel* model = iContainer->Model(); - if ( model ) - { - model->SetState( EHsBrowserUiAuthenticatedOk, ETrue ); - } - iContainer->ShowLoginCompleteNote(); - iContainer->SendToBackground(); - iContainer->UpdateSoftkeys(); - } - } - -// --------------------------------------------------------- -// CHsBrowserIctsObserver::CHsBrowserIctsObserver -// --------------------------------------------------------- -// -CHsBrowserIctsObserver::CHsBrowserIctsObserver( - CHsBrowserContainer* aContainer ) : iContainer( aContainer ) - { - DEBUG( "CHsBrowserIctsObserver::CHsBrowserIctsObserver()" ); - } - -// --------------------------------------------------------- -// CHsBrowserIctsObserver::ConstructL -// --------------------------------------------------------- -// -void CHsBrowserIctsObserver::ConstructL() - { - DEBUG( "CHsBrowserIctsObserver::ConstructL()" ); - } - -// End of File diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/src/hsbrowserloadeventobserver.cpp --- a/hotspotfw/hsbrowser/src/hsbrowserloadeventobserver.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,324 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Handle load progress events -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include "hotspotclientserver.h" - -#include "hsbrowsercontainer.h" -#include "hsbrowserloadeventobserver.h" -#include "hsbrowserictsobserver.h" -#include "hsbrowsermodel.h" -#include "hsbrowsercommon.h" -#include "am_debug.h" - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CHsBrowserLoadEventObserver::NewL -// --------------------------------------------------------- -// -CHsBrowserLoadEventObserver* -CHsBrowserLoadEventObserver::NewL( CHsBrowserContainer* aContainer ) - { - DEBUG( "CHsBrowserLoadEventObserver::NewL()" ); - CHsBrowserLoadEventObserver* self = new(ELeave) - CHsBrowserLoadEventObserver( aContainer ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------- -// CHsBrowserLoadEventObserver::~CHsBrowserLoadEventObserver -// --------------------------------------------------------- -// -CHsBrowserLoadEventObserver::~CHsBrowserLoadEventObserver() - { - DEBUG( "CHsBrowserLoadEventObserver::~CHsBrowserLoadEventObserver()" ); - if ( iIcts ) - { - delete iIcts; - } - - } - -// --------------------------------------------------------- -// CHsBrowserLoadEventObserver::HandleBrowserLoadEventL -// --------------------------------------------------------- -// -void CHsBrowserLoadEventObserver::HandleBrowserLoadEventL( - TBrCtlDefs::TBrCtlLoadEvent aLoadEvent, - TUint /* aSize */, - TUint16 /* aTransactionId */ ) - { - DEBUG1( "CHsBrowserLoadEventObserver::HandleBrowserLoadEventL() event=%d", aLoadEvent ); - - switch( aLoadEvent ) - { - case TBrCtlDefs::EEventUrlLoadingStart: - { - if ( !iIsFirstLoad ) - { - iContainer->UpdateNaviPane( CHsBrowserContainer::ELoadingUrl ); - } - else - { - iIsFirstLoad = EFalse; - } - // no break, fall through - } - case TBrCtlDefs::EEventNewContentDisplayed: - case TBrCtlDefs::EEventNewContentStart: - { - DEBUG( "CHsBrowserLoadEventObserver::HandleBrowserLoadEventL() EEventNewContentStart" ); - if ( iDoIct ) - { - DEBUG( "CHsBrowserLoadEventObserver::HandleBrowserLoadEventL() Start testing internet connectivity."); - iDoIct = EFalse; - TRAPD( err, TestInternetConnectivityL() ); - if ( err != KErrNone ) - { - DEBUG1( "CHsBrowserLoadEventObserver::HandleBrowserLoadEventL() err=%d.", err ); - } - } - break; - } - case TBrCtlDefs::EEventLoadFinished://EEventUrlLoadingFinished: - { - DEBUG( "CHsBrowserLoadEventObserver::HandleBrowserLoadEventL() EEventUrlLoadingFinished" ); - // We've finished loading one element of page - iContainer->UpdateNaviPane( CHsBrowserContainer::ELoadingFinished ); - break; - } - case TBrCtlDefs::EEventTitleAvailable: - { - DEBUG( "CHsBrowserLoadEventObserver::HandleBrowserLoadEventL() EEventTitleAvailable" ); - UpdateNameL(); - break; - } - default: - { - break; - } - } // end of switch - - UpdateDoIctFlagL(); - - if ( iContainer ) - { - iContainer->DrawNow(); - iContainer->MakeVisible( ETrue ); - } - } - -// --------------------------------------------------------- -// CHsBrowserLoadEventObserver::CHsBrowserLoadEventObserver -// --------------------------------------------------------- -// -CHsBrowserLoadEventObserver::CHsBrowserLoadEventObserver( - CHsBrowserContainer* aContainer ) : - iContainer( aContainer ), - iIcts( NULL ), - iDoIct( EFalse ), - iIsFirstLoad( ETrue ) - { - DEBUG( "CHsBrowserLoadEventObserver::CHsBrowserLoadEventObserver()" ); - } - -// --------------------------------------------------------- -// CHsBrowserLoadEventObserver::ConstructL -// --------------------------------------------------------- -// -void -CHsBrowserLoadEventObserver::ConstructL() - { - DEBUG( "CHsBrowserLoadEventObserver::ConstructL()" ); - } - -// ---------------------------------------------------- -// CHsBrowserLoadEventObserver::UpdateNaviLabel() -// ---------------------------------------------------- -// -void CHsBrowserLoadEventObserver::UpdateNaviLabel( const TDesC& aName ) - { - DEBUG( "CHsBrowserLoadEventObserver::UpdateNaviLabel()" ); - if ( iContainer ) - { - TRAPD( err, iContainer->NaviLabel()->SetTextL( aName ) ); - if ( err == KErrNone ) - { - iContainer->NaviLabel()->DrawDeferred( ); - } - else - { - DEBUG1( "CHsBrowserLoadEventObserver::UpdateNaviLabel() err=%d", err ); - } - } - } - -// ---------------------------------------------------- -// CHsBrowserLoadEventObserver::UpdateFastSwapNameL() -// ---------------------------------------------------- -// -void CHsBrowserLoadEventObserver::UpdateFastSwapNameL( const TDesC& aName ) - { - DEBUG( "CHsBrowserLoadEventObserver::UpdateFastSwapNameL()" ); - - RApaLsSession appArcSession; - TInt err = KErrNone; - TApaAppInfo info; - - err = appArcSession.Connect(); // connect to AppArc server - if( KErrNone == err ) - { - CleanupClosePushL( appArcSession ); - appArcSession.GetAppInfo( info, KUidHsBrowserApp ); - - if ( aName.Length() > KApaMaxAppCaption ) - { - TPtrC shortName = aName.Left( KApaMaxAppCaption ); - err = appArcSession.SetAppShortCaption( shortName, ELangNone, KUidHsBrowserApp ); - } - else - { - err = appArcSession.SetAppShortCaption( aName, ELangNone, KUidHsBrowserApp ); - } - if ( err != KErrNone ) - { - DEBUG1( "CHsBrowserLoadEventObserver::UpdateFastSwapNameL() err=%d", err ); - } - CleanupStack::PopAndDestroy( &appArcSession ); - } - } - -// ---------------------------------------------------- -// CHsBrowserLoadEventObserver::UpdateNameL() -// ---------------------------------------------------- -// -void CHsBrowserLoadEventObserver::UpdateNameL() - { - DEBUG( "CHsBrowserLoadEventObserver::UpdateNameL()" ); - CBrCtlInterface* brCtlInterface = NULL; - if ( iContainer ) - { - brCtlInterface = iContainer->BrCtlInterface(); - } - if ( !brCtlInterface ) - { - return; - } - HBufC* title = brCtlInterface->PageInfoLC( TBrCtlDefs::EPageInfoTitle ); - if ( title ) - { - UpdateFastSwapNameL( *title ); - CHsBrowserModel* model = iContainer->Model(); - if ( model ) - { - model->SetPageTitle( *title ); - iContainer->UpdateNaviPane( CHsBrowserContainer::EPageTitleAvailable ); - } - } - CleanupStack::PopAndDestroy( title ); - } - -// ----------------------------------------------------------------------------- -// CHsBrowserLoadEventObserver::TestInternetConnectivityL -// ----------------------------------------------------------------------------- -// -void CHsBrowserLoadEventObserver::TestInternetConnectivityL() - { - DEBUG( "CHsBrowserLoadEventObserver::TestInternetConnectivity() 7" ); - - if ( !iContainer ) - { - DEBUG( "CHsBrowserLoadEventObserver::TestInternetConnectivity() iContainer=NULL" ); - return; - } - CHsBrowserModel* model = iContainer->Model(); - if ( !model ) - { - DEBUG( "CHsBrowserLoadEventObserver::TestInternetConnectivity() model=NULL" ); - return; - } - CHsBrowserIctsObserver* observer = iContainer->HsBrowserIctsObserver(); - if ( !observer ) - { - DEBUG( "CHsBrowserLoadEventObserver::TestInternetConnectivity() observer=NULL" ); - return; - } - DEBUG1( "CHsBrowserLoadEventObserver::TestInternetConnectivity() iap=%d", model->IapId() ); - DEBUG1( "CHsBrowserLoadEventObserver::TestInternetConnectivity() netid=%d", model->NetId() ); - if ( !iIcts ) - { - iIcts = CIctsClientInterface::NewL( model->IapId(), model->NetId(), *observer ); - } - else - { - // stop previously started polling - iIcts->StopPolling(); - } - // Start polling - DEBUG( "CHsBrowserLoadEventObserver::TestInternetConnectivity() starting ICT" ); - iIcts->StartPolling( KTotalPollingTime, KExecutionTimeInterval ); - } - -// ----------------------------------------------------------------------------- -// CHsBrowserLoadEventObserver::UpdateDoIctFlagL -// ----------------------------------------------------------------------------- -// -void CHsBrowserLoadEventObserver::UpdateDoIctFlagL() - { - DEBUG( "CHsBrowserLoadEventObserver::UpdateDoIctFlagL()" ); - CBrCtlInterface* brCtlInterface = NULL; - CHsBrowserModel* model = NULL; - if ( iContainer ) - { - brCtlInterface = iContainer->BrCtlInterface(); - model = iContainer->Model(); - } - if ( brCtlInterface && model ) - { - // get url - HBufC* url = brCtlInterface->PageInfoLC( TBrCtlDefs::EPageInfoUrl ); - if ( url ) - { - DEBUG1( "url=%S", url ); - if ( url->Compare( *model->Url() ) == 0 ) - { // match - iDoIct = ETrue; - DEBUG( "CHsBrowserLoadEventObserver::HandleBrowserLoadEventL() iDoIct = ETrue." ); - } - } - else - { - DEBUG( "CHsBrowserLoadEventObserver::UpdateDoIctFlagL() url=NULL" ); - } - CleanupStack::PopAndDestroy( url ); - } - } - -// End of File diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/src/hsbrowsermodel.cpp --- a/hotspotfw/hsbrowser/src/hsbrowsermodel.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implements the model for application. -* -*/ - - - -// INCLUDE FILES -#include -#include - -#include "hotspotclientserver.h" -#include "hsbrowsermodel.h" -#include "am_debug.h" - -// ================= MEMBER FUNCTIONS ======================= - -// ---------------------------------------------------- -// CHsBrowserModel::NewL -// ---------------------------------------------------- -// -CHsBrowserModel* CHsBrowserModel::NewL() - { - DEBUG( "CHsBrowserModel::NewL()" ); - CHsBrowserModel* self = new(ELeave) CHsBrowserModel(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------- -// CHsBrowserModel::~CHsBrowserModel -// ---------------------------------------------------- -// -CHsBrowserModel::~CHsBrowserModel() - { - DEBUG( "CHsBrowserModel::~CHsBrowserModel()" ); - if ( iUrl ) - { - delete iUrl; - } - if ( iState != EHsBrowserUiClosed ) - { - iHsServer.SetUiState( iIapId, EHsBrowserUiClosed ); - } - - iHsServer.Close(); - // Removed iConnection and iSocketServ Close() calls. - // It seems like Browser Control is freeing them as it's using them also. - - if ( iStaticTitle ) - { - delete iStaticTitle; - } - if ( iPageTitle ) - { - delete iPageTitle; - } - DEBUG( "CHsBrowserModel::~CHsBrowserModel() DONE" ); - } - -// ---------------------------------------------------- -// CHsBrowserModel::SetState -// ---------------------------------------------------- -// -void CHsBrowserModel::SetState( TUint state, TBool sendToHss ) - { - DEBUG( "CHsBrowserModel::SetState()" ); - iState = state; - if ( sendToHss ) - { - iHsServer.SetUiState( iIapId, iState ); - } - } - -// ---------------------------------------------------- -// CHsBrowserModel::Attach -// ---------------------------------------------------- -// -TInt CHsBrowserModel::Attach() - { - DEBUG( "CHsBrowserModel::Attach() 1" ); - TInt err = KErrNone; - TConnectionInfoBuf currentConnInfo; - // Open channel to Socket Server - err = iSocketServ.Connect(); - if ( err != KErrNone) - { - return err; - } - // Open connection - err = iConnection.Open( iSocketServ ); - if ( err != KErrNone) - { - return err; - } - currentConnInfo().iIapId = iIapId; - currentConnInfo().iNetId = iNetId; - - err = iConnection.Attach( currentConnInfo, - RConnection::EAttachTypeMonitor ); - - if (err != KErrNone) - { - iConnection.Close(); // Just to be sure... - } - - return err; - } - -// ---------------------------------------------------- -// CHsBrowserModel::CHsBrowserModel -// ---------------------------------------------------- -// -CHsBrowserModel::CHsBrowserModel() : - iIapId( 1 ), - iNetId( 0 ), - iUrl( NULL ), - iState( 0 ), - iForeground( ETrue ), - iLoginCompleteNoteShown( EFalse ), - iStaticTitle( NULL ), - iPageTitle( NULL) - { - DEBUG( "CHsBrowserModel::CHsBrowserModel()" ); - } - -// ---------------------------------------------------- -// CHsBrowserModel::ConstructL -// ---------------------------------------------------- -// -void CHsBrowserModel::ConstructL() - { - DEBUG( "CHsBrowserModel::ConstructL()" ); - User::LeaveIfError( iHsServer.Connect() ); - iPosition = CCoeEnv::Static()->RootWin().OrdinalPosition(); - iPriority = CCoeEnv::Static()->RootWin().OrdinalPriority(); - } - -// end of file diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsbrowser/src/hsbrowserspecialloadobserver.cpp --- a/hotspotfw/hsbrowser/src/hsbrowserspecialloadobserver.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Handle special load requests like Non-HTTP(S) load requests, -* and Non-HTML content. Control over network connections -* -*/ - - - -// INCLUDE FILES - -#include "hsbrowserspecialloadobserver.h" -#include "am_debug.h" - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CHsBrowserSpecialLoadObserver::NetworkConnectionNeededL -// --------------------------------------------------------- -// -void CHsBrowserSpecialLoadObserver::NetworkConnectionNeededL( - TInt* aConnectionPtr, - TInt* aSockSvrHandle, - TBool* /*aNewConn*/, - TApBearerType* /*aBearerType*/) - { - DEBUG( "CHsBrowserSpecialLoadObserver::NetworkConnectionNeededL()" ); - *aConnectionPtr = iConnectionPtr; - *aSockSvrHandle = iSockSvrHandle; - } - -// --------------------------------------------------------- -// CHsBrowserSpecialLoadObserver::HandleRequestL -// --------------------------------------------------------- -// -TBool CHsBrowserSpecialLoadObserver::HandleRequestL( - RArray* /*aTypeArray*/, - CDesCArrayFlat* /*aDesArray*/) - { - DEBUG( "CHsBrowserSpecialLoadObserver::HandleRequestL()" ); - return EFalse; - } - -// --------------------------------------------------------- -// CHsBrowserSpecialLoadObserver::HandleDownloadL -// --------------------------------------------------------- -// -TBool CHsBrowserSpecialLoadObserver::HandleDownloadL( - RArray* /*aTypeArray*/, - CDesCArrayFlat* /*aDesArray*/) - { - DEBUG( "CHsBrowserSpecialLoadObserver::HandleDownloadL()" ); - return EFalse; - } - -// --------------------------------------------------------- -// CHsBrowserSpecialLoadObserver::ConstructL -// --------------------------------------------------------- -// -void CHsBrowserSpecialLoadObserver::ConstructL() - { - DEBUG( "CHsBrowserSpecialLoadObserver::ConstructL()" ); - } - -// --------------------------------------------------------- -// CHsBrowserSpecialLoadObserver::~CHsBrowserSpecialLoadObserver -// --------------------------------------------------------- -// -CHsBrowserSpecialLoadObserver::~CHsBrowserSpecialLoadObserver() - { - DEBUG( "CHsBrowserSpecialLoadObserver::~CHsBrowserSpecialLoadObserver()" ); - } - - -// --------------------------------------------------------- -// CHsBrowserSpecialLoadObserver::NewL -// --------------------------------------------------------- -// -CHsBrowserSpecialLoadObserver* CHsBrowserSpecialLoadObserver::NewL() - { - DEBUG( "CHsBrowserSpecialLoadObserver::CHsBrowserSpecialLoadObserver::NewL()()" ); - CHsBrowserSpecialLoadObserver* self = new(ELeave)CHsBrowserSpecialLoadObserver; - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------- -// CHsBrowserSpecialLoadObserver::SetConnectionPtr -// --------------------------------------------------------- -// -void CHsBrowserSpecialLoadObserver::SetConnectionPtr( TInt aConnectionPtr ) - { - iConnectionPtr = aConnectionPtr; - } - -// --------------------------------------------------------- -// CHsBrowserSpecialLoadObserver::SetSockSvrHandle -// --------------------------------------------------------- -// -void CHsBrowserSpecialLoadObserver::SetSockSvrHandle( TInt aSockSvrHandle ) - { - iSockSvrHandle = aSockSvrHandle; - } - -// End of File diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsclient/NetCfgExtnHotSpot/src/NetCfgExtnHotSpot.cpp --- a/hotspotfw/hsclient/NetCfgExtnHotSpot/src/NetCfgExtnHotSpot.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/hotspotfw/hsclient/NetCfgExtnHotSpot/src/NetCfgExtnHotSpot.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -18,6 +18,7 @@ // INCLUDE FILES #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include #include #endif #include "NetCfgExtnHotSpot.h" diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsclient/inc/hssiaphandler.h --- a/hotspotfw/hsclient/inc/hssiaphandler.h Fri Jun 11 16:27:29 2010 +0100 +++ b/hotspotfw/hsclient/inc/hssiaphandler.h Thu Jul 22 16:44:32 2010 +0100 @@ -109,6 +109,12 @@ void ConvertAsciiToHex( const TDes8& aSource, HBufC8*& aDest ); + /** + * Removes brackets from UID + * @param aUid, UID of the client + */ + void ModifyClientUid( TDes& aUid ); + private: // Data /** diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsclient/src/hssiaphandler.cpp --- a/hotspotfw/hsclient/src/hssiaphandler.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/hotspotfw/hsclient/src/hssiaphandler.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -24,11 +24,15 @@ #include "am_debug.h" #include -#include +#include #include -#include +#include #include -#include +#include + +// CONSTANTS +const TInt KRetryCount = 20; +const TInt KRetryTimeout = 100000; using namespace CMManager; @@ -92,22 +96,13 @@ DEBUG("CHssIapHandler::ChangeSettingsL"); TInt ret( KErrNone ); - RCmManagerExt cmManager; + RCmManager cmManager; cmManager.OpenL(); CleanupClosePushL( cmManager ); - TUint easyWlanId = cmManager.EasyWlanIdL(); - - // Easy WLAN can't be modified - if ( easyWlanId == aIapID ) - { - CleanupStack::PopAndDestroy( &cmManager ); - return KErrPermissionDenied; - } - // Read WLAN table service id TUint32 serviceId(0); - RCmConnectionMethodExt plugin = cmManager.ConnectionMethodL( aIapID ); + RCmConnectionMethod plugin = cmManager.ConnectionMethodL( aIapID ); CleanupClosePushL( plugin ); serviceId = plugin.GetIntAttributeL( EWlanServiceId ); DEBUG1("CHssIapHandler::ChangeSettingsL WLAN serviceId: %d", serviceId); @@ -199,9 +194,27 @@ *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanEnableWpaPsk)) = aSettings.iEnableWpaPsk; } } - // now update the access point - iWLANRecord->ModifyL( *dbSession ); + // Update access point, be prepared that Commsdat might be locked + TInt errCode( KErrLocked ); + TInt retryCount( 0 ); + while( errCode == KErrLocked && retryCount < KRetryCount ) + { + TRAP( errCode, iWLANRecord->ModifyL( *dbSession ) ); + + if ( errCode == KErrLocked ) + { + User::After( KRetryTimeout ); + } + retryCount++; + } + + if ( errCode ) + { + // override previous ret value only when error happened + ret = errCode; + } + CleanupStack::PopAndDestroy( dbSession ); DEBUG("CHssIapHandler::ChangeSettingsL DONE"); return ret; @@ -326,11 +339,11 @@ { DEBUG( "CHssIapHandler::GetNetworkIdL()" ); - RCmManagerExt cmManager; + RCmManager cmManager; cmManager.OpenL(); CleanupClosePushL( cmManager ); - RCmConnectionMethodExt plugin = cmManager.ConnectionMethodL( aIapId ); + RCmConnectionMethod plugin = cmManager.ConnectionMethodL( aIapId ); CleanupClosePushL( plugin ); aNetId = plugin.GetIntAttributeL( ECmNetworkId ); @@ -349,13 +362,16 @@ { DEBUG("CHssIapSettingsHandler::GetClientsIapsL"); TBuf<32> buffer; // Temporary buffer for found UID from destination. - TUidName uidClient = aUId.Name(); // UID of the client. TUint32 iapId = 0; // IAP Identifiier. + TBuf uidClient; // UID of the client. + + uidClient.Copy( aUId.Name() ); + ModifyClientUid( uidClient ); RArray destArray = RArray( 10 ); // KCmArrayGranularity instead of 10 CleanupClosePushL( destArray ); - RCmManagerExt cmManager; + RCmManager cmManager; cmManager.OpenL(); CleanupClosePushL( cmManager ); @@ -363,7 +379,7 @@ for (TInt i = 0; i < destArray.Count(); i++) { - RCmDestinationExt dest = cmManager.DestinationL( destArray[i] ); + RCmDestination dest = cmManager.DestinationL( destArray[i] ); CleanupClosePushL( dest ); for (TInt j = 0; j < dest.ConnectionMethodCount(); j++) @@ -402,4 +418,23 @@ CleanupStack::PopAndDestroy( &destArray ); } +// ----------------------------------------------------------------------------- +// ModifyClientUid +// ----------------------------------------------------------------------------- +// +void CHssIapHandler::ModifyClientUid( TDes& aUid ) + { + DEBUG("CHssIapHandler::ModifyClientUid"); + TInt indx = aUid.Find( KMark1 ); + if ( KErrNotFound != indx ) + { + aUid.Delete( indx, 1 ); + indx = aUid.Find( KMark2 ); + if ( KErrNotFound != indx ) + { + aUid.Delete( indx, 1 ); + } + } + } + // End of File diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsserver/group/hotspotserver.mmp --- a/hotspotfw/hsserver/group/hotspotserver.mmp Fri Jun 11 16:27:29 2010 +0100 +++ b/hotspotfw/hsserver/group/hotspotserver.mmp Thu Jul 22 16:44:32 2010 +0100 @@ -15,7 +15,6 @@ * */ - #include TARGET HotSpotServer.exe @@ -36,21 +35,18 @@ USERINCLUDE ../inc USERINCLUDE ../../hsclient/inc -USERINCLUDE ../../internetconnectivitytestservice/inc + MW_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include/ecom LIBRARY euser.lib efsrv.lib esock.lib insock.lib -LIBRARY APPARC.lib apgrfx.lib -LIBRARY http.lib LIBRARY inetprotutil.lib LIBRARY ecom.lib LIBRARY bafl.lib LIBRARY commdb.lib LIBRARY commsdat.lib LIBRARY wlandbif.lib -LIBRARY ictsclientinterface.lib LIBRARY hal.lib LIBRARY estor.lib LIBRARY centralrepository.lib diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsserver/inc/hotspotclientserver.h --- a/hotspotfw/hsserver/inc/hotspotclientserver.h Fri Jun 11 16:27:29 2010 +0100 +++ b/hotspotfw/hsserver/inc/hotspotclientserver.h Thu Jul 22 16:44:32 2010 +0100 @@ -30,7 +30,6 @@ _LIT( KHotSpotPlugin, "NetCfgExtnHotSpot" ); _LIT( KDhcpPlugin, "NetCfgExtnDhcp" ); -const TUint KEasyWlanServiceId = 1; const TUid KHotspotServerUid3={0x10282ECB}; const TUint KHssShutdown = 777; diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsserver/inc/hotspotserver.h --- a/hotspotfw/hsserver/inc/hotspotserver.h Fri Jun 11 16:27:29 2010 +0100 +++ b/hotspotfw/hsserver/inc/hotspotserver.h Thu Jul 22 16:44:32 2010 +0100 @@ -288,13 +288,6 @@ * @param aIapId, IAP id */ void RemoveClientIap( TUint aIapId ); - - /** - * Returns Easy WLAN IAP id. - * @since Series 60 5.2 - * @return Easy WLAN id - */ - TInt GetEasyWlanId(); private: @@ -393,11 +386,7 @@ * Array for storing client IAPs and their UIDs. */ RArray iClientIaps; - - /** - * Easy WLAN IAP Id - */ - TInt iEasyWlanId; + }; #endif diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsserver/inc/hotspotsession.h --- a/hotspotfw/hsserver/inc/hotspotsession.h Fri Jun 11 16:27:29 2010 +0100 +++ b/hotspotfw/hsserver/inc/hotspotsession.h Thu Jul 22 16:44:32 2010 +0100 @@ -27,8 +27,6 @@ #include #include #include -#include -#include #include "hssnotif.h" #include "hssiapsettingshandler.h" #include "hssclientinterface.h" @@ -51,8 +49,7 @@ * @lib HotSpotServer.exe * @since Series 60 3.0 */ -NONSHARABLE_CLASS( CHotSpotSession ) : public CSession2, - public MIctsObserver, +NONSHARABLE_CLASS( CHotSpotSession ) : public CSession2, public MHssLoginTimerObserver, public MHssLogoutTimerObserver, public MWlanMgmtNotifications @@ -96,16 +93,6 @@ void DispatchMessageL( const RMessage2& aMessage ); /** - * From MICTSObserver. Called when internet connectivity tests are - * being done. - * @param aResult Result of tests - * @param aString String containing possible HTML response - * @return None - */ - void ConnectivityObserver( TIctsTestResult aResult, - const TDesC& aString ); - - /** * From MHssLoginTimerObserver. Called when time used for Login(..) * has run out for client. * @return None @@ -150,30 +137,20 @@ */ void ConstructL(); - /** - * Initialize Scan to WlanEngine - * @return None - */ - - /** - * Launch Intenet Connectivity Test Service - * @return None - */ - void TestInternetConnectivityL(); - + /** * Starts client register procedures * @param aMessage, RMessage from client side * @return None */ - void ProcessRegisterL( const RMessage2& aMessage ); + void ProcessRegister( const RMessage2& aMessage ); /** * Starts client unregister procedures * @param aMessage, RMessage from client side * @return None */ - void ProcessUnRegisterL( const RMessage2& aMessage ); + void ProcessUnRegister( const RMessage2& aMessage ); /** * Starts login procedures @@ -181,7 +158,7 @@ * @param aNetId, Network id * @return KErrNone, if successful, otherwice one of system wide errorcodes. */ - TInt ProcessStartLoginL( const TUint aIapId, const TUint aNetId ); + TInt ProcessStartLogin( const TUint aIapId, const TUint aNetId ); /** * Starts Join procedures @@ -226,18 +203,6 @@ void ProcessServerShutdown( const RMessage2& aMessage ); /** - * Updates UI state of HotSpot browser logon application. - * @param aMessage, Message for completing request - */ - void ProcessUiState( const RMessage2& aMessage ); - - /** - * Start HotSpot browser logon application. - * @param aString, redirect URL - */ - void AuthenticateL( const TDesC& aString ); - - /** * Removes brackets from the UID * @param aUid, UID of the client */ @@ -317,12 +282,6 @@ * Own */ CHssIapSettingsHandler* iIapSettingsHandler; - - /** - * Internet Connectivity testing instance - * Own - */ - CIctsClientInterface* iIcts; /** * Timer used for client Login procedure diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsserver/inc/hssiapsettingshandler.h --- a/hotspotfw/hsserver/inc/hssiapsettingshandler.h Fri Jun 11 16:27:29 2010 +0100 +++ b/hotspotfw/hsserver/inc/hssiapsettingshandler.h Thu Jul 22 16:44:32 2010 +0100 @@ -135,11 +135,6 @@ const TDesC& aUid ); /** - * Create new IAP to Internet SNAP. - */ - void CreateIapL(); - - /** * Deletes the IAP * @param aIapID, IAP id */ diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsserver/src/hotspotserver.cpp --- a/hotspotfw/hsserver/src/hotspotserver.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/hotspotfw/hsserver/src/hotspotserver.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -25,12 +25,12 @@ #include #include -#include +#include #include #include -#include +#include #include -#include +#include #include "hotspotserver.h" #include "am_debug.h" @@ -158,8 +158,7 @@ iLoginValue = ETrue; iAssociationValue = EFalse; iClientIapsChecked = KErrNone; - iEasyWlanId = KEasyWlanServiceId; // Set to default value just in case - + TRAP( iClientIapsChecked, FindClientIapsL() ); // Activate notifications for IAP check purposes. Done with every server startup. @@ -204,7 +203,7 @@ void CHotSpotServer::FindClientIapsL() { DEBUG("CHotSpotServer::FindClientIapsL()"); - RCmManagerExt cmManager; + RCmManager cmManager; cmManager.OpenL(); CleanupClosePushL(cmManager); @@ -218,7 +217,7 @@ for( TInt i = 0; i < cmArray.Count(); i++ ) { - RCmConnectionMethodExt cm = cmManager.ConnectionMethodL( cmArray[i] ); + RCmConnectionMethod cm = cmManager.ConnectionMethodL( cmArray[i] ); CleanupClosePushL( cm ); HBufC* daemonName = cm.GetStringAttributeL( ECmConfigDaemonManagerName ); @@ -243,11 +242,8 @@ CleanupStack::PopAndDestroy( &cm ); } CleanupStack::PopAndDestroy( &cmArray ); - - // Read Easy WLAN IAP ID - iEasyWlanId = cmManager.EasyWlanIdL(); CleanupStack::PopAndDestroy( &cmManager ); - DEBUG1("CHotSpotServer::FindClientIapsL() iEasyWlanId: % d", iEasyWlanId); + DEBUG("CHotSpotServer::FindClientIapsL() Done"); } // ----------------------------------------------------------------------------- @@ -280,11 +276,11 @@ if ( error == KErrNotFound ) { // Remove from database - RCmManagerExt cmManager; + RCmManager cmManager; cmManager.OpenL(); CleanupClosePushL(cmManager); - RCmConnectionMethodExt cm; + RCmConnectionMethod cm; cm = cmManager.ConnectionMethodL( iClientIaps[i].iIapId ); CleanupClosePushL( cm ); cmManager.RemoveAllReferencesL( cm ); @@ -665,16 +661,6 @@ } } -// ----------------------------------------------------------------------------- -// GetEasyWlanId -// ----------------------------------------------------------------------------- -// -TInt CHotSpotServer::GetEasyWlanId() - { - DEBUG("CHotspotServer::GetEasyWlanId()"); - return iEasyWlanId; - } - // ========================== OTHER EXPORTED FUNCTIONS ========================= // ----------------------------------------------------------------------------- diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsserver/src/hotspotsession.cpp --- a/hotspotfw/hsserver/src/hotspotsession.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/hotspotfw/hsserver/src/hotspotsession.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -25,14 +25,11 @@ #include "hsslogouttimer.h" #include "hssclientinterface.h" #include "am_debug.h" -#include #include #include -#include #include #include #include -#include // Forward declarations class CWlanMgmtClient; @@ -118,11 +115,7 @@ iLogoutTimer->Cancel(); delete iLogoutTimer; } - - if ( iIcts != NULL ) - { - delete iIcts; - } + DEBUG( "CHotSpotSession::~CHotSpotSession() Done" ); } @@ -179,10 +172,10 @@ HandleCancelNotifications( aMessage ); break; case EHssRegister : - ProcessRegisterL( aMessage ); + ProcessRegister( aMessage ); break; case EHssUnRegister : - ProcessUnRegisterL( aMessage ); + ProcessUnRegister( aMessage ); break; case EHssJoin : iAllowNotifications = EFalse; @@ -294,7 +287,7 @@ } else { - err = ProcessStartLoginL( iIapId, iNetId ); + err = ProcessStartLogin( iIapId, iNetId ); // If client not found, an error was returned. // Otherwise message completed elsewhere. if ( KErrNone != err ) @@ -462,21 +455,11 @@ aMessage.Complete( KErrNone ); break; case EHssUiState: - ProcessUiState( aMessage ); + aMessage.Complete( KErrNotSupported ); break; case EHssStartBrowser: { - TInt len = aMessage.GetDesLength( 0 ); - iIapId = ( TInt )aMessage.Int1(); - iNetId = ( TInt )aMessage.Int2(); - err = iServer.SaveMessage( iIapId, aMessage, EHssStartBrowser ); - HBufC* buf = HBufC::NewLC( len ); - TPtr ptr( buf->Des() ); - User::LeaveIfError( aMessage.Read( 0, ptr ) ); - - AuthenticateL( ptr ); - - CleanupStack::PopAndDestroy(buf); + aMessage.Complete( KErrNotSupported ); break; } case EHssSetTimerValues: @@ -597,70 +580,6 @@ } // ----------------------------------------------------------------------------- -// TestInternetConnectivityL -// ----------------------------------------------------------------------------- -// -void CHotSpotSession::TestInternetConnectivityL() - { - DEBUG("CHotSpotSession::TestInternetConnectivityL"); - if ( iIcts != NULL ) - { - delete iIcts; - iIcts = NULL; - } - - iIcts = CIctsClientInterface::NewL( iIapId, iNetId, *this ); - iIcts->StartL(); - } - -// ----------------------------------------------------------------------------- -// ConnectivityObserver -// ----------------------------------------------------------------------------- -// -void CHotSpotSession::ConnectivityObserver( TIctsTestResult aResult, - const TDesC& aString ) - { - DEBUG1("CHotSpotSession::ConnectivityObserver result: %d", aResult); - TInt indx( KErrNone ); - switch ( aResult ) - { - case EConnectionOk : - indx = iServer.FindMessage( iIapId, EHssStartLogin ); - if ( KErrNotFound != indx ) - { - iServer.CompleteMessage( indx, KErrNone ); - } - TRAPD( trap, iIapSettingsHandler->CreateIapL() ); - if ( trap != KErrNone ) - { - DEBUG1("CHotSpotSession::ConnectivityObserver trap: %d", trap); - } - break; - case EHttpAuthenticationNeeded : - // Start browser for authentication - TRAP_IGNORE( AuthenticateL( aString ) ); - break; - case EConnectionNotOk : - indx = iServer.FindMessage( iIapId, EHssStartLogin ); - if ( KErrNotFound != indx ) - { - iServer.CompleteMessage( indx, KErrNone ); - } - break; - case ETimeout : - indx = iServer.FindMessage( iIapId, EHssStartLogin ); - if ( KErrNotFound != indx ) - { - iServer.CompleteMessage( indx, KErrNone ); - } - - break; - default: - break; - } - } - -// ----------------------------------------------------------------------------- // LoginTimeout // ----------------------------------------------------------------------------- // @@ -713,12 +632,12 @@ } // --------------------------------------------------------- -// ProcessRegisterL +// ProcessRegister // --------------------------------------------------------- // -void CHotSpotSession::ProcessRegisterL( const RMessage2& aMessage ) +void CHotSpotSession::ProcessRegister( const RMessage2& aMessage ) { - DEBUG("CHotSpotSession::ProcessRegisterL"); + DEBUG("CHotSpotSession::ProcessRegister"); iAllowNotifications = EFalse; TBufC< KIapNameLength > iapName; @@ -758,33 +677,25 @@ } // --------------------------------------------------------- -// ProcessUnRegisterL +// ProcessUnRegister // --------------------------------------------------------- // -void CHotSpotSession::ProcessUnRegisterL( const RMessage2& aMessage ) +void CHotSpotSession::ProcessUnRegister( const RMessage2& aMessage ) { - DEBUG("CHotSpotSession::ProcessUnRegisterL"); + DEBUG("CHotSpotSession::ProcessUnRegister"); iAllowNotifications = EFalse; TInt ret( KErrNone ); // Read message TInt iapId = ( TInt )aMessage.Int0(); iServer.RemoveClientIap( iapId ); - // Check that this is not Easy WLAN - TInt easyWlan = iServer.GetEasyWlanId(); - if ( easyWlan != iapId ) + + TRAPD( err, iIapSettingsHandler->DeleteIapL( iapId ) ); + // return KErrGeneral if IAP removal is not successful + if ( err != KErrNone ) { - TRAPD( err, iIapSettingsHandler->DeleteIapL( iapId ) ); - // return KErrGeneral if IAP removal is not successful - if ( err != KErrNone ) - { - ret = KErrGeneral; - } + ret = KErrGeneral; } - else - { - ret = KErrPermissionDenied; - } aMessage.Complete( ret ); DEBUG("CHotSpotSession::ProcessUnRegisterL DONE"); } @@ -793,24 +704,13 @@ // ProcessStartLogin // ----------------------------------------------------------------------------- // -TInt CHotSpotSession::ProcessStartLoginL( const TUint aIapId, const TUint aNetId ) +TInt CHotSpotSession::ProcessStartLogin( const TUint aIapId, const TUint aNetId ) { DEBUG("CHotSpotSession::ProcessStartLogin"); TInt ret( KErrNotFound ); TBuf8 extAPI; iIapId = aIapId; - // Check if Easy WLAN. - TInt easyWlan = iServer.GetEasyWlanId(); - if ( easyWlan == aIapId ) - { - DEBUG("CHotSpotSession::ProcessStartLogin Easy WLAN detected"); - // Just test internet connectivity and complete message later - TestInternetConnectivityL(); - ret = KErrNone; - return ret; - } - TBuf clientUid; TInt err = iServer.GetClientUid( aIapId, clientUid ); @@ -839,7 +739,7 @@ } // ----------------------------------------------------------------------------- -// ProcessStart +// ProcessStartL // ----------------------------------------------------------------------------- // TInt CHotSpotSession::ProcessStartL( const TUint aIapId ) @@ -1035,106 +935,6 @@ } // ----------------------------------------------------------------------------- -// ProcessUiState -// ----------------------------------------------------------------------------- -// -void CHotSpotSession::ProcessUiState( const RMessage2& aMessage ) - { - DEBUG( "CHotSpotSession::ProcessUiState()" ); - TBool completeMsg = EFalse; - TInt indx( KErrNone ); - TInt indxBrowser( KErrNone ); - TInt ret( KErrNone ); - iIapId = ( TInt )aMessage.Int0(); - - indx = iServer.FindMessage( iIapId, EHssStartLogin ); - indxBrowser = iServer.FindMessage( iIapId, EHssStartBrowser ); - THsBrowserUiStates uiState = ( THsBrowserUiStates ) aMessage.Int1(); // UI state - switch ( uiState ) - { - case EHsBrowserUiRunning: - { - DEBUG( "CHotSpotSession::ProcessUiState() EHsBrowserUiRunning" ); - break; - } - case EHsBrowserUiAuthenticatedOk: - { - DEBUG( "CHotSpotSession::ProcessUiState() EHsBrowserUiAuthenticatedOk" ); - - completeMsg = ETrue; - break; - } - case EHsBrowserUiAuthenticatedNok: - { - DEBUG( "CHotSpotSession::ProcessUiState() EHsBrowserUiAuthenticatedNok" ); - completeMsg = ETrue; - break; - } - case EHsBrowserUiClosed: - { - DEBUG( "CHotSpotSession::ProcessUiState() EHsBrowserUiClosed" ); - completeMsg = ETrue; - break; - } - default: - { - DEBUG( "CHotSpotSession::ProcessUiState() default" ); - completeMsg = ETrue; - } - } - - if ( completeMsg ) - { - // complete messages EHssStartLogin/EHssStartBrowser - if ( indx >= 0 ) - { - DEBUG( "CHotSpotSession::ProcessUiState() completing EHssStartLogin" ); - iServer.CompleteMessage( indx , KErrNone ); - aMessage.Complete( KErrNone ); - } - else if ( indxBrowser >= 0 ) - { - DEBUG( "CHotSpotSession::ProcessUiState() completing EHssStartBrowser" ); - iServer.CompleteMessage( indxBrowser, ret ); - aMessage.Complete( KErrNone ); - } - else - { - DEBUG( "CHotSpotSession::ProcessUiState() completing EHssUiState" ); - aMessage.Complete( KErrNotFound ); - } - } - } - -// ----------------------------------------------------------------------------- -// Authenticate() -// ----------------------------------------------------------------------------- -// -void CHotSpotSession::AuthenticateL( const TDesC& aString ) - { - DEBUG("CHotSpotSession::AuthenticateL()"); - - const TInt KBrowserUid = 0x2000AFCC; // hotspot browser application - HBufC* param = HBufC::NewLC( KMaxFileName ); - _LIT(tmpString, "%d, %d, %S"); - param->Des().Format( tmpString, iIapId, iNetId, &aString ); - TUid uid( TUid::Uid( KBrowserUid ) ); - RApaLsSession appArcSession; - User::LeaveIfError( appArcSession.Connect() ); // connect to AppArc server - CleanupClosePushL( appArcSession ); - TThreadId id; - TInt err = appArcSession.StartDocument( *param, TUid::Uid( KBrowserUid ), id ); - if ( err != KErrNone ) - { - DEBUG1( "CHotSpotSession::AuthenticateL() StartDocument: %d", err ); - } - CleanupStack::PopAndDestroy( &appArcSession ); - CleanupStack::PopAndDestroy( param ); - - DEBUG("CHotSpotSession::AuthenticateLC() done"); - } - -// ----------------------------------------------------------------------------- // ModifyClientUid // ----------------------------------------------------------------------------- // diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/hsserver/src/hssiapsettingshandler.cpp --- a/hotspotfw/hsserver/src/hssiapsettingshandler.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/hotspotfw/hsserver/src/hssiapsettingshandler.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -23,10 +23,10 @@ #include "am_debug.h" #include -#include +#include #include -#include -#include +#include +#include using namespace CMManager; @@ -82,7 +82,7 @@ { DEBUG("CHssIapSettingsHandler::CreateClientIapL"); - RCmManagerExt cmManager; + RCmManager cmManager; cmManager.OpenL(); CleanupClosePushL( cmManager ); @@ -91,7 +91,7 @@ CleanupClosePushL( destinations ); cmManager.AllDestinationsL( destinations ); - RCmDestinationExt destination; + RCmDestination destination; // Loop through each destination for( TInt i = 0; i < destinations.Count(); i++ ) { @@ -101,7 +101,7 @@ // Internet destination will have ESnapPurposeInternet set in its metadata. if (destination.MetadataL(CMManager::ESnapMetadataPurpose) == CMManager::ESnapPurposeInternet) { - RCmConnectionMethodExt plugin = cmManager.CreateConnectionMethodL( KUidWlanBearerType ); + RCmConnectionMethod plugin = cmManager.CreateConnectionMethodL( KUidWlanBearerType ); CleanupClosePushL( plugin ); plugin.SetStringAttributeL( ECmName, aIapName ); @@ -125,102 +125,6 @@ } // ----------------------------------------------------------------------------- -// CreateIapL -// ----------------------------------------------------------------------------- -// -void CHssIapSettingsHandler::CreateIapL() - { - DEBUG("CHssIapSettingsHandler::CreateIapL"); - - RCmManagerExt cmManager; - cmManager.OpenL(); - CleanupClosePushL( cmManager ); - - // Read all destination(SNAP) settings into an array - RArray destinations; - CleanupClosePushL( destinations ); - - cmManager.AllDestinationsL( destinations ); - RCmDestinationExt destination; - // Loop through each destination - for( TInt i = 0; i < destinations.Count(); i++ ) - { - destination = cmManager.DestinationL( destinations[i] ); - CleanupClosePushL( destination ); - // Internet destination will always exist in the system. - // Internet destination will have ESnapPurposeInternet - // set in its metadata. - if (destination.MetadataL( CMManager::ESnapMetadataPurpose ) == - CMManager::ESnapPurposeInternet ) - { - CWlanMgmtClient* wlanMgmtClient = CWlanMgmtClient::NewL(); - CleanupStack::PushL( wlanMgmtClient ); - - TWlanConnectionMode connMode; - User::LeaveIfError( - wlanMgmtClient->GetConnectionMode( connMode ) ); - - TWlanConnectionSecurityMode secMode; - User::LeaveIfError( - wlanMgmtClient->GetConnectionSecurityMode( secMode ) ); - - HBufC* ssid( NULL ); - TWlanSsid ssidConn; - - User::LeaveIfError( - wlanMgmtClient->GetConnectionSsid( ssidConn ) ); - ssid = HBufC::NewLC( ssidConn.Length() ); - ssid->Des().Copy( ssidConn ); - - TUint32 serviceId(0); - TUint32 easyWlanIapId(0); - easyWlanIapId = cmManager.EasyWlanIdL(); - - RCmConnectionMethodExt easyWlanPlugin; - easyWlanPlugin = cmManager.ConnectionMethodL( easyWlanIapId ); - CleanupClosePushL( easyWlanPlugin ); - TBool scanSsid = easyWlanPlugin.GetBoolAttributeL( EWlanScanSSID ); - TUint32 easyWlanServiceId = - easyWlanPlugin.GetIntAttributeL( EWlanServiceId ); - CleanupStack::PopAndDestroy(); // easyWlanPlugin; - - RCmConnectionMethodExt plugin = - cmManager.CreateConnectionMethodL( KUidWlanBearerType ); - CleanupClosePushL( plugin ); - plugin.SetStringAttributeL( ECmName, *ssid ); - plugin.SetStringAttributeL( EWlanSSID, *ssid ); - plugin.SetIntAttributeL( CMManager::EWlanSecurityMode, - ConvertConnectionSecurityModeToSecModeL( secMode )); - plugin.SetIntAttributeL( EWlanConnectionMode, - ConvertConnectionModeToNetModeL( connMode ) ); - plugin.SetBoolAttributeL( EWlanScanSSID, scanSsid ); - destination.AddConnectionMethodL( plugin ); - destination.UpdateL(); - serviceId = plugin.GetIntAttributeL( EWlanServiceId ); - - CleanupStack::PopAndDestroy( &plugin ); - if ( secMode == EWlanConnectionSecurityWep ) - { - SaveWEPKeyL( easyWlanServiceId, serviceId ); - } - - if ( secMode == EWlanConnectionSecurityWpaPsk ) - { - SaveWPAKeyL( easyWlanServiceId, serviceId ); - } - - CleanupStack::PopAndDestroy( ssid ); - CleanupStack::PopAndDestroy( wlanMgmtClient ); - } - CleanupStack::PopAndDestroy( &destination ); - } - CleanupStack::PopAndDestroy( &destinations ); - CleanupStack::PopAndDestroy( &cmManager ); - - DEBUG("CHssIapSettingsHandler::CreateIapL Done"); - } - -// ----------------------------------------------------------------------------- // DeleteIapL // ----------------------------------------------------------------------------- // @@ -228,11 +132,11 @@ { DEBUG1("CHssIapSettingsHandler:::DeleteIapL aIapId=%d ", aIapId); - RCmManagerExt cmManager; + RCmManager cmManager; cmManager.OpenL(); CleanupClosePushL( cmManager ); - RCmConnectionMethodExt plugin = cmManager.ConnectionMethodL( aIapId ); + RCmConnectionMethod plugin = cmManager.ConnectionMethodL( aIapId ); CleanupClosePushL( plugin ); cmManager.RemoveAllReferencesL( plugin ); @@ -310,16 +214,12 @@ wlanRecordNew->ModifyL( *dbSession ); CleanupStack::PopAndDestroy( wlanRecordNew ); - dbSession->CommitTransactionL(); - - dbSession->Close(); - CleanupStack::PopAndDestroy( dbSession ); - CleanupStack::Pop( 1 ); // transaction rollback popped dbSession->CommitTransactionL(); - - + + dbSession->Close(); + CleanupStack::PopAndDestroy( dbSession ); DEBUG("CHssIapSettingsHandler::SaveWEPKey Done"); } diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/internetconnectivitytestservice/inc/ictshttphandler.h --- a/hotspotfw/internetconnectivitytestservice/inc/ictshttphandler.h Fri Jun 11 16:27:29 2010 +0100 +++ b/hotspotfw/internetconnectivitytestservice/inc/ictshttphandler.h Thu Jul 22 16:44:32 2010 +0100 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: Contains implementation for HTTP::HEAD test +* Description: Contains implementation for connectivity test with HTTP * */ @@ -31,12 +31,12 @@ /** * Handles HTTP related things. * - * Sends HTTP::HEAD and interact with HTTP FW. Returns results to - * caller. + * Sends HTTP GET using HTTP FW. Returns results to the caller. * * @lib ictsclientinterface.lib */ -class CIctsHttpHandler : public CTimer, public MHTTPTransactionCallback +class CIctsHttpHandler : public CTimer, + public MHTTPTransactionCallback { public: @@ -53,7 +53,7 @@ virtual ~CIctsHttpHandler(); /** - * Send HTTP::HEAD request + * Send HTTP GET request * * @param aIPAddress IP address * @param aIapID IAP id @@ -61,11 +61,11 @@ * @return KErrNone if successful */ TInt SendHttpRequestL( TDesC8& aIPAddress, - TUint32 aIapID, - TUint32 aNetworkId ); + TUint32 aIapID, + TUint32 aNetworkId ); /** - * Cancels HTTP::HEAD request + * Cancels HTTP GET request * * @return None */ @@ -94,7 +94,6 @@ virtual TInt MHFRunError( TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& aEvent); - protected: // Functions from base classes @@ -126,7 +125,7 @@ * @return None */ void SetHttpConnectionInfoL( RConnection& aConnection, - RSocketServ& aSocketServ ); + RSocketServ& aSocketServ ); /** * Send HTTP request * @@ -142,6 +141,14 @@ * @return ETrue if found, else EFalse */ TBool CheckHttp( TDesC8& aIPAddress ); + + /** + * Checks if HTTP status code is a redirect (301,302,303,307) + * + * @param aTransaction HTTP transactionL + * @return ETrue if found, else EFalse + */ + TBool CheckStatusCodeL( RHTTPTransaction aTransaction ); private: // data diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/internetconnectivitytestservice/src/ictshttphandler.cpp --- a/hotspotfw/internetconnectivitytestservice/src/ictshttphandler.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/hotspotfw/internetconnectivitytestservice/src/ictshttphandler.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: HTTP class for HTTP::HEAD testing +* Description: Class for HTTP GET testing * */ @@ -33,9 +33,9 @@ const TInt KFound = 302; const TInt KSeeOther = 303; const TInt KTemporaryRedirect = 307; + // ======== MEMBER FUNCTIONS ======== - // --------------------------------------------------------------------------- // CIctsHttpHandler::CIctsHttpHandler // C++ default constructor can NOT contain any code, that @@ -76,7 +76,8 @@ TInt aHttpResponseTime ) { DEBUG("CIctsHttpHandler::NewL()"); - CIctsHttpHandler* self = new( ELeave ) CIctsHttpHandler( aOwner, aHttpResponseTime ); + CIctsHttpHandler* self = new( ELeave ) CIctsHttpHandler( aOwner, + aHttpResponseTime ); CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop( self ); @@ -126,42 +127,47 @@ RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo(); // Clear RConnection and Socket Server instances - connInfo.RemoveProperty(strPool.StringF(HTTP::EHttpSocketServ,RHTTPSession::GetTable())); - connInfo.RemoveProperty(strPool.StringF(HTTP::EHttpSocketConnection,RHTTPSession::GetTable())); + connInfo.RemoveProperty( strPool.StringF( HTTP::EHttpSocketServ, + RHTTPSession::GetTable() ) ); + connInfo.RemoveProperty( strPool.StringF( HTTP::EHttpSocketConnection, + RHTTPSession::GetTable() ) ); // Clear the proxy settings - THTTPHdrVal proxyUsage(strPool.StringF(HTTP::EUseProxy,RHTTPSession::GetTable())); - connInfo.RemoveProperty(strPool.StringF(HTTP::EProxyUsage,RHTTPSession::GetTable())); - connInfo.RemoveProperty(strPool.StringF(HTTP::EProxyAddress,RHTTPSession::GetTable())); + THTTPHdrVal proxyUsage( strPool.StringF( HTTP::EUseProxy, + RHTTPSession::GetTable() ) ); + connInfo.RemoveProperty( strPool.StringF( HTTP::EProxyUsage, + RHTTPSession::GetTable() ) ); + connInfo.RemoveProperty( strPool.StringF( HTTP::EProxyAddress, + RHTTPSession::GetTable() ) ); // RConnection has been started, set proxy (if defined) and RConnection and // Socket Server session properties. // Proxy - result = aConnection.EnumerateConnections(connCount); - User::LeaveIfError(result); + result = aConnection.EnumerateConnections( connCount ); + User::LeaveIfError( result) ; // Get service and service type for this connection // _LIT(string, "%s\\%s"); - query.Format(string, IAP, IAP_SERVICE); - result = aConnection.GetIntSetting(query, serviceId); + query.Format( string, IAP, IAP_SERVICE ); + result = aConnection.GetIntSetting( query, serviceId ); - query.Format(string, IAP, IAP_SERVICE_TYPE); - result = aConnection.GetDesSetting(query, serviceType); - User::LeaveIfError(result); + query.Format( string, IAP, IAP_SERVICE_TYPE ); + result = aConnection.GetDesSetting( query, serviceType ); + User::LeaveIfError( result ); // RConnection and Socket Server // Now bind the HTTP session with the socket server connection connInfo.SetPropertyL ( - strPool.StringF(HTTP::EHttpSocketServ, RHTTPSession::GetTable()), - THTTPHdrVal (aSocketServ.Handle()) ); + strPool.StringF( HTTP::EHttpSocketServ, RHTTPSession::GetTable() ), + THTTPHdrVal (aSocketServ.Handle() ) ); - TInt connPtr1 = reinterpret_cast(&aConnection); + TInt connPtr1 = reinterpret_cast( &aConnection) ; connInfo.SetPropertyL ( - strPool.StringF(HTTP::EHttpSocketConnection, - RHTTPSession::GetTable() ), THTTPHdrVal (connPtr1) ); + strPool.StringF( HTTP::EHttpSocketConnection, + RHTTPSession::GetTable() ), THTTPHdrVal ( connPtr1 ) ); } @@ -188,7 +194,7 @@ if ( !iAttachDone ) { - err = iConnection.Attach( pckgInfo, RConnection::EAttachTypeMonitor); + err = iConnection.Attach( pckgInfo, RConnection::EAttachTypeMonitor ); DEBUG1("CIctsHttpHandler::SendHttpRequestL attach: %d", err); } @@ -199,11 +205,13 @@ // Remove redirect filter RStringPool stringPool = iHttpSession.StringPool(); - RStringF filterName = stringPool.StringF(HTTP::ERedirect, RHTTPSession::GetTable()); - iHttpSession.FilterCollection().RemoveFilter(filterName); - + RStringF filterName = + stringPool.StringF( HTTP::ERedirect, RHTTPSession::GetTable() ); + iHttpSession.FilterCollection().RemoveFilter( filterName ); + RStringPool strPool = iHttpSession.StringPool(); - RStringF method = strPool.StringF(HTTP::EHEAD,RHTTPSession::GetTable()); + RStringF method = + strPool.StringF( HTTP::EGET, RHTTPSession::GetTable() ); TBuf8 ip; @@ -217,7 +225,7 @@ // Parse string to URI TUriParser8 uri; uri.Parse(ip); - iHttpTransaction = iHttpSession.OpenTransactionL(uri, *this, method); + iHttpTransaction = iHttpSession.OpenTransactionL( uri, *this, method ); RHTTPHeaders hdr = iHttpTransaction.Request().GetHeaderCollection(); RStringF headerStrName = strPool.OpenFStringL( KHeaderName() ); @@ -279,35 +287,27 @@ // Called by framework to pass transaction events. // --------------------------------------------------------------------------- // -void CIctsHttpHandler::MHFRunL(RHTTPTransaction aTransaction, - const THTTPEvent& aEvent) +void CIctsHttpHandler::MHFRunL( RHTTPTransaction aTransaction, + const THTTPEvent& aEvent ) { - DEBUG("CIctsHttpHandler::MHFRunL"); - + DEBUG1("CIctsHttpHandler::MHFRunL aEvent.iStatus: %d", + aEvent.iStatus); + // See HTTP event statuses. Only ESucceeded and EFailed are needed. switch (aEvent.iStatus) { - case THTTPEvent::EGotResponseHeaders: { DEBUG("CIctsHttpHandler::THTTPEvent::EGotResponseHeaders"); - } - break; - - case THTTPEvent::EGotResponseBodyData: - { - DEBUG("CIctsHttpHandler::THTTPEvent::EGotResponseBodyData"); + if ( CheckStatusCodeL( aTransaction ) ) + { + // Redirection found. Transaction can be canceled. + aTransaction.Cancel(); + } } break; - - case THTTPEvent::EResponseComplete: - { - DEBUG("CIctsHttpHandler::THTTPEvent::EResponseComplete"); - } - break; - case THTTPEvent::ESucceeded: { - DEBUG("CIctsHttpHandler::THTTPEvent::ESucceeded"); + DEBUG("CIctsHttpHandler::MHFRunL Succeeded"); CTimer::Cancel(); iOwner.HttpEventL( EConnectionOk, iString ); iString = KNullDesC; @@ -316,79 +316,17 @@ case THTTPEvent::EFailed: { + DEBUG("CIctsHttpHandler::MHFRunL Failed"); CTimer::Cancel(); - DEBUG("CIctsHttpHandler::THTTPEvent::EFailed"); - - RHTTPResponse resp = aTransaction.Response(); - TInt status = resp.StatusCode(); - - // Check if redirect was cause of EFailed - if( status == KMovedPermanently || status == KFound || - status == KSeeOther || status == KTemporaryRedirect ) - { - - // Inform the hotspot server that authentication is needed - RHTTPHeaders hdr =aTransaction.Response().GetHeaderCollection(); - RStringPool strP = aTransaction.Session().StringPool(); - RStringF location = strP.StringF(HTTP::ELocation,RHTTPSession::GetTable()); - - //parse the headers and look for location header - THTTPHdrVal hVal; - if(hdr.GetField(location,0,hVal)== KErrNone) - { - DEBUG("CIctsHttpHandler::THTTPEvent::GetField"); - // Location header is present - RStringF fieldValStr = strP.StringF(hVal.StrF()); - const TDesC8& fieldValDesC = fieldValStr.DesC(); - iString.Copy(fieldValDesC); - iOwner.HttpEventL( EHttpAuthenticationNeeded, iString ); - } - else - { - // No location header. Can't use authentication -> redirect. - iOwner.HttpEventL( EConnectionNotOk, iString ); - } - } - else - { - // Failed for other reason than redirect - iOwner.HttpEventL( EConnectionNotOk, iString ); - } - - iString = KNullDesC; + iOwner.HttpEventL( EConnectionNotOk, iString ); + iString = KNullDesC; } break; - case THTTPEvent::ERedirectedPermanently: - { - // Nothing here - DEBUG("CIctsHttpHandler::THTTPEvent::ERedirectedPermanently"); - } - break; - - case THTTPEvent::ERedirectedTemporarily: - { - // Nothing here - DEBUG("CIctsHttpHandler::THTTPEvent::ERedirectedTemporarily"); - } - break; - default: { - DEBUG1( "CIctsHttpHandler::MHFRunL::default iStatus: %d", aEvent.iStatus ); - CTimer::Cancel(); - if ( aEvent.iStatus < 0 ) - { - _LIT(string, "Unknown error"); - iString = string; - iOwner.HttpEventL( EConnectionNotOk, iString ); - } - else - { - _LIT(string, "Default"); - iString = string; - iOwner.HttpEventL( EConnectionNotOk, iString ); - } + DEBUG1( "CIctsHttpHandler::MHFRunL default: %d", aEvent.iStatus ); + // Do nothing. Timer will take care of error situations. } break; } @@ -418,4 +356,57 @@ return ( 0 == aIPAddress.Find( KHttpPrefix ) ); } +// ---------------------------------------------------------------------------- +// CIctsHttpHandler::CheckStatusCodeL +// ---------------------------------------------------------------------------- +TBool CIctsHttpHandler::CheckStatusCodeL( RHTTPTransaction aTransaction ) + { + DEBUG1("CIctsHttpHandler::CheckStatusCodeL response statuscode: %d", + aTransaction.Response().StatusCode()); + + TBool ret ( EFalse ); + + switch ( aTransaction.Response().StatusCode() ) + { + case KMovedPermanently: + case KFound: + case KSeeOther: + case KTemporaryRedirect: + { + DEBUG("CIctsHttpHandler::CheckStatusCodeL Redirect"); + CTimer::Cancel(); + ret = ETrue; + + //parse the headers and look for location header + RHTTPHeaders hdr =aTransaction.Response().GetHeaderCollection(); + RStringPool strP = aTransaction.Session().StringPool(); + RStringF location = + strP.StringF( HTTP::ELocation,RHTTPSession::GetTable() ); + THTTPHdrVal hVal; + if( hdr.GetField( location, 0, hVal ) == KErrNone ) + { + DEBUG("CIctsHttpHandler::CheckStatusCodeL location header"); + // Location header is present + RStringF fieldValStr = strP.StringF(hVal.StrF()); + const TDesC8& fieldValDesC = fieldValStr.DesC(); + iString.Copy( fieldValDesC ); + iOwner.HttpEventL( EHttpAuthenticationNeeded, iString ); + } + else + { + DEBUG("CIctsHttpHandler::CheckStatusCodeL no location header"); + // No location header. Can't redirect. + iOwner.HttpEventL( EConnectionNotOk, iString ); + iString = KNullDesC; + } + } + break; + + default: + // Do nothing + break; + } + return ret; + } + // End of File diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/rom/hotspot.iby --- a/hotspotfw/rom/hotspot.iby Fri Jun 11 16:27:29 2010 +0100 +++ b/hotspotfw/rom/hotspot.iby Thu Jul 22 16:44:32 2010 +0100 @@ -27,7 +27,6 @@ #ifdef __PROTOCOL_WLAN -*** DLLs file=ABI_DIR\BUILD_DIR\hotspotclient.dll SHARED_LIB_DIR\hotspotclient.dll file=ABI_DIR\BUILD_DIR\ictsclientinterface.dll SHARED_LIB_DIR\ictsclientinterface.dll @@ -37,12 +36,6 @@ ECOM_PLUGIN( HssMgmtImpl.dll, 10282ecc.rsc ) ECOM_PLUGIN( wlanagthotspotimpl.dll, 1028309b.rss ) -S60_APP_EXE( HsBrowser ) -S60_APP_AIF_RSC( HsBrowser ) - -// appshell icon -S60_APP_AIF_ICONS( hsbrowsericon ) - data=ZPRIVATE\10282EC5\backup_registration.xml private\10282EC5\backup_registration.xml data=DATAZ_\system\install\hotspotfwstub.sis system\install\hotspotfwstub.sis data=DATAZ_\system\install\ictsstub.sis system\install\ictsstub.sis diff -r 30a5f517c615 -r b3d8f88532b7 hotspotfw/rom/hotspotResources.iby --- a/hotspotfw/rom/hotspotResources.iby Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Image description file for project HotSpot FW -* -*/ - - - - -#ifndef HOTSPOTRESOURCES_IBY -#define HOTSPOTRESOURCES_IBY - -#ifdef __PROTOCOL_WLAN - -S60_APP_RESOURCE(HsBrowser) - -#endif // __PROTOCOL_WLAN -#endif // HOTSPOTSRESOURCES_IBY \ No newline at end of file diff -r 30a5f517c615 -r b3d8f88532b7 layers.sysdef.xml --- a/layers.sysdef.xml Fri Jun 11 16:27:29 2010 +0100 +++ b/layers.sysdef.xml Thu Jul 22 16:44:32 2010 +0100 @@ -7,7 +7,6 @@ - diff -r 30a5f517c615 -r b3d8f88532b7 wirelessacc.pro --- a/wirelessacc.pro Fri Jun 11 16:27:29 2010 +0100 +++ b/wirelessacc.pro Thu Jul 22 16:44:32 2010 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available # under the terms of "Eclipse Public License v1.0" @@ -12,14 +12,15 @@ # Contributors: # # Description: +# Qt project file for wirelessacc package. # TEMPLATE = subdirs -SUBDIRS += wlanutilities - CONFIG += ordered -symbian*: { - SYMBIAN_PLATFORMS = WINSCW ARMV5 -} +SUBDIRS += wlanutilities + +symbian { + BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include \"./group/bld.inf\"" +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/cpwlansettingsplugin/src/cpwlansettingsgroupitemdata.cpp --- a/wlanutilities/cpwlansettingsplugin/src/cpwlansettingsgroupitemdata.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/cpwlansettingsplugin/src/cpwlansettingsgroupitemdata.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -119,6 +119,8 @@ mJoinWlanItem = new CpSettingFormItemData( HbDataFormModelItem::ComboBoxItem, hbTrId( "txt_occ_setlabel_join_wlan_networks"), this); + // name the object for test automation purposes + mJoinWlanItem->setObjectName("switchToWlan"); QStringList joinWlanItems; @@ -142,6 +144,8 @@ mScanNetworkItem = new CpSettingFormItemData( HbDataFormModelItem::ComboBoxItem, hbTrId( "txt_occ_setlabel_scan_for_networks"), this); + // name the object for test automation purposes + mScanNetworkItem->setObjectName("scanNetworkItem"); QStringList scanNetworkItems; @@ -171,6 +175,8 @@ mPowerSavingItem = new CpSettingFormItemData( HbDataFormModelItem::ComboBoxItem, hbTrId( "txt_occ_setlabel_power_saving"), this); + // name the object for test automation purposes + mPowerSavingItem->setObjectName("powerSaving"); QStringList powerSavingItems; diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/bwins/eapwizardu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/bwins/eapwizardu.def Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,17 @@ +EXPORTS + ?tr@EapWizard@@SA?AVQString@@PBD0H@Z @ 1 NONAME ; class QString EapWizard::tr(char const *, char const *, int) + ?staticMetaObject@EapWizard@@2UQMetaObject@@B @ 2 NONAME ; struct QMetaObject const EapWizard::staticMetaObject + ?qt_metacast@EapWizard@@UAEPAXPBD@Z @ 3 NONAME ; void * EapWizard::qt_metacast(char const *) + ?tr@EapWizard@@SA?AVQString@@PBD0@Z @ 4 NONAME ; class QString EapWizard::tr(char const *, char const *) + ?getStaticMetaObject@EapWizard@@SAABUQMetaObject@@XZ @ 5 NONAME ; struct QMetaObject const & EapWizard::getStaticMetaObject(void) + ??0EapWizard@@QAE@PAVWlanWizardHelper@@@Z @ 6 NONAME ; EapWizard::EapWizard(class WlanWizardHelper *) + ?trUtf8@EapWizard@@SA?AVQString@@PBD0@Z @ 7 NONAME ; class QString EapWizard::trUtf8(char const *, char const *) + ??1EapWizard@@UAE@XZ @ 8 NONAME ; EapWizard::~EapWizard(void) + ?metaObject@EapWizard@@UBEPBUQMetaObject@@XZ @ 9 NONAME ; struct QMetaObject const * EapWizard::metaObject(void) const + ?summary@EapWizard@@UAE_NW4Summary@WlanWizardPlugin@@AAVQString@@1@Z @ 10 NONAME ; bool EapWizard::summary(enum WlanWizardPlugin::Summary, class QString &, class QString &) + ?qt_metacall@EapWizard@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 11 NONAME ; int EapWizard::qt_metacall(enum QMetaObject::Call, int, void * *) + ?trUtf8@EapWizard@@SA?AVQString@@PBD0H@Z @ 12 NONAME ; class QString EapWizard::trUtf8(char const *, char const *, int) + ?errorString@EapWizard@@UAE?AVQString@@H@Z @ 13 NONAME ; class QString EapWizard::errorString(int) + ?storeSettings@EapWizard@@UAE_NXZ @ 14 NONAME ; bool EapWizard::storeSettings(void) + ??_EEapWizard@@UAE@I@Z @ 15 NONAME ; EapWizard::~EapWizard(unsigned int) + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/eabi/eapwizardu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/eabi/eapwizardu.def Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,20 @@ +EXPORTS + _ZN9EapWizard11errorStringEi @ 1 NONAME + _ZN9EapWizard11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME + _ZN9EapWizard11qt_metacastEPKc @ 3 NONAME + _ZN9EapWizard13storeSettingsEv @ 4 NONAME + _ZN9EapWizard16staticMetaObjectE @ 5 NONAME DATA 16 + _ZN9EapWizard19getStaticMetaObjectEv @ 6 NONAME + _ZN9EapWizard7summaryEN16WlanWizardPlugin7SummaryER7QStringS3_ @ 7 NONAME + _ZN9EapWizardC1EP16WlanWizardHelper @ 8 NONAME + _ZN9EapWizardC2EP16WlanWizardHelper @ 9 NONAME + _ZN9EapWizardD0Ev @ 10 NONAME + _ZN9EapWizardD1Ev @ 11 NONAME + _ZN9EapWizardD2Ev @ 12 NONAME + _ZNK9EapWizard10metaObjectEv @ 13 NONAME + _ZTI9EapWizard @ 14 NONAME + _ZTV9EapWizard @ 15 NONAME + _ZThn8_N9EapWizard11errorStringEi @ 16 NONAME + _ZThn8_N9EapWizard13storeSettingsEv @ 17 NONAME + _ZThn8_N9EapWizard7summaryEN16WlanWizardPlugin7SummaryER7QStringS3_ @ 18 NONAME + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/eapwizard.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/eapwizard.pro Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,86 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# +# Description: +# EAP Settings Wizard plugin for WLAN Wizard +# + +TEMPLATE = lib +TARGET = eapwizard + +DEFINES += BUILD_EAP_WIZARD_DLL + +VERSION = 0.0.1 + +CONFIG += hb + +MOC_DIR = build +RCC_DIR = build + +RESOURCES += resources/eapwizard_resource.qrc + +TRANSLATIONS = eapwizard.ts + +HEADERS += \ + inc/eapwizard.h \ + inc/eapwizard_p.h \ + inc/eapwizardpage.h \ + inc/eapwizardpagecertca.h \ + inc/eapwizardpagecertuser.h \ + inc/eapwizardpageidentity.h \ + inc/eapwizardpageinnertype.h \ + inc/eapwizardpagenewpacstore.h \ + inc/eapwizardpageoutertype.h \ + inc/eapwizardpagepacstorepasswordconfirm.h \ + inc/eapwizardpageusernamepassword.h + +SOURCES += \ + src/eapwizard.cpp \ + src/eapwizard_p.cpp \ + src/eapwizardpage.cpp \ + src/eapwizardpagecertca.cpp \ + src/eapwizardpagecertuser.cpp \ + src/eapwizardpageidentity.cpp \ + src/eapwizardpageinnertype.cpp \ + src/eapwizardpagenewpacstore.cpp \ + src/eapwizardpageoutertype.cpp \ + src/eapwizardpagepacstorepasswordconfirm.cpp \ + src/eapwizardpageusernamepassword.cpp + +LIBS += -leapqtconfiginterface -leapqtplugininfo + +INCLUDEPATH += \ + inc \ + ../inc + +symbian { + TARGET.UID3 = 0x2002C2FE + TARGET.CAPABILITY = CAP_GENERAL_DLL + TARGET.EPOCALLOWDLLDATA = 1 + + # Location of directories for def files + defFilePath = . + + # OST trace system requires traces directory to be in USERINCLUDES + MMP_RULES += "USERINCLUDE traces" + + BLD_INF_RULES.prj_exports += \ + "rom/eapwizard.iby CORE_MW_LAYER_IBY_EXPORT_PATH(eapwizard.iby)" + + BLD_INF_RULES.prj_exports += \ + "rom/eapwizard_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(eapwizard_resources.iby)" + + # interface of eapwizard + BLD_INF_RULES.prj_exports += "inc/eapwizard.h |../inc/eapwizard.h" +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/inc/eapwizard.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/inc/eapwizard.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard API + * + */ + +#ifndef EAPWIZARD_H +#define EAPWIZARD_H + +// System includes +#include + +// User includes +#include "wlanwizardplugin.h" + +// Forward declarations +class WlanWizardHelper; +class EapWizardPrivate; +class TestWlanWizardContext; + +// External data types + +// Constants +#ifdef BUILD_EAP_WIZARD_DLL +#define EAP_WIZARD_EXPORT Q_DECL_EXPORT +#else +#define EAP_WIZARD_EXPORT Q_DECL_IMPORT +#endif + +/*! + * @addtogroup group_eap_wizard + * @{ + */ + +// Class declaration + +class EAP_WIZARD_EXPORT EapWizard : public QObject, public WlanWizardPlugin +{ + Q_OBJECT + +public: + explicit EapWizard(WlanWizardHelper *wizardHelper); + ~EapWizard(); + +public: // From WlanWizardPlugin + virtual bool summary(WlanWizardPlugin::Summary sum, QString &item, QString &value); + virtual bool storeSettings(); + virtual QString errorString(int errorCode); + +signals: + +public slots: + +protected: + +protected slots: + +private: + Q_DISABLE_COPY(EapWizard) + +private slots: + +private: // data + QScopedPointer d_ptr; + + // Friend classes + friend class EapWizardPrivate; + friend class TestWlanWizardContext; +}; + +/*! @} */ + +#endif /* EAPWIZARD_H */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/inc/eapwizard_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/inc/eapwizard_p.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard: Private implementation. + * + */ + +#ifndef EAPWIZARD_P_H +#define EAPWIZARD_P_H + +// System includes +#include +#include + +// User includes +#include "wlanwizardplugin.h" + +// Forward declarations +class HbTranslator; +class HbStackedWidget; +class HbWidget; +class HbLabel; +class HbView; +class HbAction; +class HbDocumentLoader; +class WlanWizardHelper; +class EapWizardPage; +class EapQtConfigInterface; +class EapQtPluginHandle; +class EapQtConfig; +class EapWizard; +class TestWlanWizardContext; +// External data types + +// Constants + +/*! + @addtogroup group_eap_wizard + @{ + */ + +// Class declaration + +class EapWizardPrivate : public QObject +{ + Q_OBJECT +public: + /*! + Enumerator for internal EAP configuration cache. This cache is used to + store user input and selections. see configurations() and + setConfigurations() for howto access the configurations. + + Below is descripted which configuration can be used with a specific EAP + type. + EAP-TTLS & EAP-PEAP & EAP-TLS + - CertificateCa + - TunnelUsernameAutomatic + - TunnelUsername + - TunnelRealmAutomatic + - TunnelRealm + + EAP-TTLS & EAP-PEAP & EAP-FAST + - InnerType + + EAP-TLS + - CertificateUser + + EAP-FAST + - PacStorePassword + - PacStoreState + + LEAP, PAP, EAP-GTC, EAP/Plain-MSChapv2 + - Username + - Password + + PAP, EAP-GTC, EAP/Plain-MSChapv2 + - OuterType + + Remember to update trace.properties upon changes. + */ + enum ConfigurationId + { + //! EapQtPluginHandle::Plugin (int), EAP outer type + OuterType = 0, + //! EapQtPluginHandle::Plugin (int), EAP inner type + InnerType = 1, + //! CertificateInformation, NULL: automatic, CA Certificate + CertificateCa = 2, + //! CertificateInformation, User Certificate + CertificateUser = 3, + //! bool, automatic username for EAP identify (outer type) + TunnelUsernameAutomatic = 4, + //! QString, username for EAP identify (outer type) + TunnelUsername = 5, + //! bool, automatic realm for EAP identify (outer type) + TunnelRealmAutomatic = 6, + //! QString, realm for EAP identify (outer type) + TunnelRealm = 7, + //! QString, username for inner methods or for LEAP + Username = 8, + //! QString, password for inner methods or for LEAP + Password = 9, + //! QString, PAC store password + PacStorePassword = 10, + //! EapQtPacStoreConfig::PacStoreState (int), PAC store state + PacStoreState = 11, + }; + +public: + explicit EapWizardPrivate(WlanWizardHelper *wizardHelper); + ~EapWizardPrivate(); + +public: // From WlanWizardPlugin + bool summary(WlanWizardPlugin::Summary sum, QString &item, QString &value); + bool storeSettings(); + QString errorString(int errorCode); + +public: + QVariant configurations(ConfigurationId confId) const; + void setConfigurations(ConfigurationId confId, const QVariant &value); + EapQtConfigInterface* eapConfigurationInterface() const; + QString eapTypeToString(int id) const; + WlanWizardHelper *wizardHelper() const; + +signals: + +public slots: + +protected: + +protected slots: + +private: + Q_DISABLE_COPY(EapWizardPrivate) + void createPages(); + bool hasInnerMethod() const; + void handleTlsMethodsSettings( + EapQtConfig &eapConf, + EapQtPluginHandle &outerType); + + bool handleEapFastSettings(EapQtConfig &eapConf); + + void handleEapAkaSimSettings(EapQtConfig &eapConf); + + void handleLeapSettings(EapQtConfig &eapConf); + + bool storeOuterTypeSettings(EapQtPluginHandle &outerType); + + bool storeInnerTypeSettings(EapQtPluginHandle &outerType); + +private slots: + +private: // data + // NOT owned pointers + //! Wizard framework services (WLAN Wizard Plugin API) + WlanWizardHelper *mWizardHelper; + + // Owned pointers + //! Translator + QScopedPointer mTranslator; + //! EAP configuration and services (EAP Qt Configuration Interface API) + QScopedPointer mEapConfIf; + //! Internal container for EAP specific settings + QHash mConfigurations; + + // Friend classes + friend class TestWlanWizardContext; +}; + +/*! @} */ + +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/inc/eapwizardpage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/inc/eapwizardpage.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard: API for EAP specific wizard pages. + * + */ + +#ifndef EAPWIZARD_PAGE_H +#define EAPWIZARD_PAGE_H + +// System includes +#include + +// User includes +#include "wlanwizardpage.h" + +// Forward declarations +class EapWizardPrivate; +class HbDocumentLoader; + +// External data types + +// Constants + +/*! + @addtogroup group_eap_wizard + @{ + + Interface for EAP specific wizard pages. + */ + +// Class declaration + +class EapWizardPage : public QObject, public WlanWizardPage +{ + Q_OBJECT + +public: + /*! + Page IDs for EAP Wizard. + */ + enum EapPageIds { + //! Outer Type selection + PageOuterType = WlanWizardPage::PageEapStart, + /*! Certificate Authority certificate selection for EAP-TTLS, EAP-TLS + and PEAP. + */ + PageCertificateCa, + //! User Authority certificate selection for EAP-TLS + PageCertificateUser, + //! EAP Identity for TLS methods, EAP-TTLS, EAP-TLS, PEAP + PageIdentity, + //! EAP Inner type selection for PEAP + PageInnerTypePeap, + //! EAP Inner type selection for EAP-TTLS + PageInnerTypeEapTtls, + //! New PAC Store password for EAP-FAST + PageNewPacStorePassword, + //! PAC store confirmation for EAP-FAST + PagePromptPacStorePassword, + //! Username and password page + PageUsernamePassword, + }; +public: + explicit EapWizardPage(EapWizardPrivate* parent); + virtual ~EapWizardPage(); + +public: // From WlanWizardPage + virtual HbWidget* initializePage() = 0; + virtual int nextId(bool &removeFromStack) const; + virtual int nextId() const = 0; + +signals: + +public slots: + +protected: + void loadDocmlSection( + HbDocumentLoader *loader, + Qt::Orientation orientation, + const QString &filename, + const QString &portraitSection, + const QString &landscapeSection) const; + +protected slots: + +protected: // data + //! Pointer to Eap Wizard private implementation + EapWizardPrivate* mWizard; + +private: + Q_DISABLE_COPY(EapWizardPage) + +private slots: + +private: // data + +}; + +/*! @} */ + +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/inc/eapwizardpagecertca.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/inc/eapwizardpagecertca.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard Page: Certificate Authority Selection. + * + */ + +#ifndef EAPWIZARDPAGECERTCA_H +#define EAPWIZARDPAGECERTCA_H + +// System includes +#include + +// User includes +#include "eapwizardpage.h" + +// Forward declarations +class HbRadioButtonList; +class HbDocumentLoader; +class HbLabel; +class EapWizardPrivate; +class EapQtCertificateInfo; + +// External data types + +// Constants + +/*! + @addtogroup group_eap_wizard + @{ + */ + +// Class declaration + +class EapWizardPageCertCa : public EapWizardPage +{ + Q_OBJECT +public: + explicit EapWizardPageCertCa(EapWizardPrivate* parent); + ~EapWizardPageCertCa(); + +public: // From WlanWizardPage + HbWidget* initializePage(); + int nextId() const; + +signals: + +public slots: + +protected: + +protected slots: + +private: + static const int IndexForAutomatic = 0; + static const int AmountOfNonCertItems = 1; + +private: + Q_DISABLE_COPY(EapWizardPageCertCa) + +private slots: + void loadDocmlSection(Qt::Orientation orientation); + +private: // data + // OWNED + + //! docml document loader + QScopedPointer mDocumentLoader; + //! System's CA certificates + QList mCerts; + + // NOT OWNED + + //! Visualization of the page + HbWidget *mWidget; + //! Title text for "Select authority certificate" + HbLabel *mTitle; + //! visualization of CA certificate list + HbRadioButtonList *mCertList; + +}; + +/*! @} */ + +#endif /* EAPWIZARDPAGECERTCA_H */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/inc/eapwizardpagecertuser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/inc/eapwizardpagecertuser.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard Page: User Certificate Selection. + * + */ + +#ifndef EAPWIZARDPAGECERTUSER_H +#define EAPWIZARDPAGECERTUSER_H + +// System includes +#include + +// User includes +#include "eapwizardpage.h" + +// Forward declarations +class HbDocumentLoader; +class HbRadioButtonList; +class HbLabel; +class EapQtCertificateInfo; +class EapWizardPrivate; + +// External data types + +// Constants + +/*! + @addtogroup group_eap_wizard + @{ + */ + +// Class declaration + +class EapWizardPageCertUser : public EapWizardPage +{ + Q_OBJECT +public: + explicit EapWizardPageCertUser(EapWizardPrivate* parent); + ~EapWizardPageCertUser(); + +public: // From WlanWizardPage + HbWidget* initializePage(); + int nextId() const; + bool showPage(); + +signals: + +public slots: + +protected: + +protected slots: + +private: + Q_DISABLE_COPY(EapWizardPageCertUser) + void createPages(); + bool hasInnerMethod() const; + +private slots: + void loadDocmlSection(Qt::Orientation orientation); + void itemSelected(int index); + +private: // data + // NOT OWNED + //! Visualization of the page + HbWidget *mWidget; + //! Certificate list + HbRadioButtonList *mCertList; + //! Error text used when there are not any certificates + HbLabel *mErrorLabel; + + // OWNED + //! docml document loader + QScopedPointer mDocumentLoader; + //! Is page valid? it is when a certificate has been selected + bool mValid; + //! List of system's user certificates + QList mCerts; +}; + +/*! @} */ + +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/inc/eapwizardpageidentity.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/inc/eapwizardpageidentity.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard Page: EAP Identity. + * + */ + +#ifndef EAPWIZARDPAGEIDENTITY_H +#define EAPWIZARDPAGEIDENTITY_H + +// System includes +#include + +// User includes +#include "eapwizardpage.h" + +// Forward declarations +class HbLineEdit; +class HbCheckBox; +class HbLabel; +class HbDocumentLoader; +class EapQtValidator; +class EapWizardPrivate; + +// External data types + +// Constants + +/*! + @addtogroup group_eap_wizard + @{ + */ + +// Class declaration + +class EapWizardPageIdentity : public EapWizardPage +{ + Q_OBJECT +public: + explicit EapWizardPageIdentity(EapWizardPrivate* parent); + ~EapWizardPageIdentity(); + +public: // From WlanWizardPage + HbWidget* initializePage(); + int nextId() const; + bool showPage(); + +signals: + +public slots: + +protected: + +protected slots: + +private: + Q_DISABLE_COPY(EapWizardPageIdentity) + bool validateGroup( + HbLineEdit *edit, + HbCheckBox *checkBox, + EapQtValidator* validator) const; + +private slots: + void loadDocmlSection(Qt::Orientation orientation); + void textChanged(const QString &text); + void stateChanged(int state); + +private: // data + // OWNED + //! docml document loader + QScopedPointer mDocumentLoader; + //! Content validator and configurator for line edit of realm + QScopedPointer mValidatorRealm; + //! Content validator and configurator for line edit of username + QScopedPointer mValidatorUsername; + + // NOT OWNED + //! Visualization of the page + HbWidget *mWidget; + //! Line editor for username + HbLineEdit *mEditUsername; + //! Line editor for realm + HbLineEdit *mEditRealm; + //! Checkbox for username + HbCheckBox *mCheckUsername; + //! Checkbox for realm + HbCheckBox *mCheckRealm; + //! Title text for realm + HbLabel *mLabelRealm; + //! Title text for username + HbLabel *mLabelUsername; +}; + +/*! @} */ + +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/inc/eapwizardpageinnertype.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/inc/eapwizardpageinnertype.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard Page: Inner Type selection + * + */ + +#ifndef EAPWIZARDPAGEINNERTYPE_H +#define EAPWIZARDPAGEINNERTYPE_H + +// System includes +#include +#include + +// User includes +#include "eapwizardpage.h" + +// Forward declarations +class HbRadioButtonList; +class HbWidget; +class HbDocumentLoader; +class HbLabel; +class EapWizardPrivate; + +// External data types + +// Constants + +/*! + @addtogroup group_eap_wizard + @{ + */ + +// Class declaration + +class EapWizardPageInnerType : public EapWizardPage +{ + Q_OBJECT +public: + EapWizardPageInnerType(EapWizardPrivate* parent, int outerType); + ~EapWizardPageInnerType(); + +public: // From WlanWizardPage + HbWidget* initializePage(); + int nextId() const; + bool showPage(); + +signals: + +public slots: + void itemSelected(int index); + void loadDocmlSection(Qt::Orientation orientation); + +protected: + +protected slots: + +private: + Q_DISABLE_COPY(EapWizardPageInnerType) + + void appendToList( + QStringList &items, + EapQtPluginHandle::Plugin innerType); + +private slots: + +private: // data + // NOT OWNED + //! Visualization of the page + HbWidget *mWidget; + //! List of innertypes + HbRadioButtonList *mRadio; + //! Title for inner types + HbLabel *mTitle; + + // OWNED + //! Document loader for docml + QScopedPointer mDocumentLoader; + //! Page ID for this page + int mOuterType; + //! Is content of the page valid? + bool mValid; + //! Mapped from index (0..n) in radiobuttonlist to eap types + QList mEapTypes; +}; + +/*! @} */ + +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/inc/eapwizardpagenewpacstore.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/inc/eapwizardpagenewpacstore.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard Page: New PAC store password + * + */ + +#ifndef EAPWIZARDPAGENEWPACSTORE_H +#define EAPWIZARDPAGENEWPACSTORE_H + +// System includes +#include + +// User includes +#include "eapwizardpage.h" + +// Forward declarations +class HbDocumentLoader; +class HbLineEdit; +class HbLabel; +class EapQtValidator; + +// External data types + +// Constants + +/*! + @addtogroup group_eap_wizard + @{ + */ + +// Class declaration + +class EapWizardPageNewPacStore : public EapWizardPage +{ + Q_OBJECT +public: + explicit EapWizardPageNewPacStore(EapWizardPrivate* parent); + ~EapWizardPageNewPacStore(); + +public: // From WlanWizardPage + HbWidget* initializePage(); + int nextId() const; + bool showPage(); + +signals: + +public slots: + +protected: + +protected slots: + +private: + Q_DISABLE_COPY(EapWizardPageNewPacStore) + +private slots: + void textChanged(const QString &text); + void loadDocmlSection(Qt::Orientation orientation); + +private: // data + // OWNED + //! Document loader for docml + QScopedPointer mDocumentLoader; + //! Validator for PAC store password + QScopedPointer mValidator; + + // NOT OWNED + //! Visualization of the page + HbWidget *mWidget; + //! Line editor for new password + HbLineEdit *mEditPasswordNew; + //! Line editor for new password confirmation + HbLineEdit *mEditPasswordConfirm; + //! Title for new password + HbLabel *mTitlePasswordNew; + //! Title for new password confirmation + HbLabel *mTitlePasswordConfirm; +}; + +/*! @} */ + +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/inc/eapwizardpageoutertype.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/inc/eapwizardpageoutertype.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard Page: Outer type selection + * + */ + +#ifndef EAPWIZARDPAGEOUTERTYPE_H +#define EAPWIZARDPAGEOUTERTYPE_H + +// System includes +#include + +// User includes +#include "eapwizardpage.h" + +// Forward declarations +class HbRadioButtonList; +class HbWidget; +class HbDocumentLoader; +class HbLabel; +class EapWizardPrivate; + +// External data types + +// Constants + +/*! + @addtogroup group_eap_wizard + @{ + */ + +// Class declaration + +class EapWizardPageOuterType : public EapWizardPage +{ + Q_OBJECT +public: + explicit EapWizardPageOuterType(EapWizardPrivate* parent); + ~EapWizardPageOuterType(); + +public: // From WizardPage + HbWidget* initializePage(); + int nextId() const; + bool showPage(); + +signals: + +public slots: + +protected: + +protected slots: + +private: + Q_DISABLE_COPY(EapWizardPageOuterType) + void appendToList( + QStringList &items, + int pluginHandle ); + + int nextIdForEapFast() const; + +private slots: + void itemSelected(int index); + void loadDocmlSection(Qt::Orientation orientation); + +private: // data + // NOT OWNED + //! Visualization of the page + HbWidget *mWidget; + //! List of outer types + HbRadioButtonList *mRadio; + //! Title for radio button list + HbLabel *mTitle; + + // OWNED + //! Document loader for docml + QScopedPointer mDocumentLoader; + //! Is page content valid? + bool mValid; + //! Mapped from index (0..n) in radiobuttonlist to eap types + QList mEapTypes; +}; + +/*! @} */ + +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/inc/eapwizardpagepacstorepasswordconfirm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/inc/eapwizardpagepacstorepasswordconfirm.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard Page: PAC store password confirmation + * + */ + +#ifndef EAPWIZARDPAGENPACSTOREPASSWORDCONFIRM_H +#define EAPWIZARDPAGENPACSTOREPASSWORDCONFIRM_H + +// System includes +#include + +// User includes +#include "eapwizardpage.h" + +// Forward declarations +class HbDocumentLoader; +class HbLineEdit; +class HbLabel; +class EapQtValidator; +class EapWizardPrivate; + +// External data types + +// Constants + + +/*! + * @addtogroup group_eap_wizard + * @{ + */ + +// Class declaration + +class EapWizardPagePacStorePasswordConfirm: public EapWizardPage +{ + Q_OBJECT +public: + explicit EapWizardPagePacStorePasswordConfirm(EapWizardPrivate* parent); + ~EapWizardPagePacStorePasswordConfirm(); + +public: // From WlanWizardPage + HbWidget* initializePage(); + int nextId() const; + bool showPage(); + +signals: + +public slots: + +protected: + bool eventFilter(QObject *obj, QEvent *event); + +protected slots: + +private: + Q_DISABLE_COPY(EapWizardPagePacStorePasswordConfirm) + void createPages(); + bool hasInnerMethod() const; + +private slots: + void loadDocmlSection(Qt::Orientation orientation); + +private: // data + // OWNED + //! Document loader for docml + QScopedPointer mDocumentLoader; + //! Validator for PAC store password + QScopedPointer mValidator; + + // NOT OWNED + //! Visualization of the page + HbWidget *mWidget; + //! line editor for PAC store password confirmation + HbLineEdit *mEditPasswordConfirm; + //! Label for embadded error string + HbLabel *mLabelError; +}; + +/*! @} */ + +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/inc/eapwizardpageusernamepassword.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/inc/eapwizardpageusernamepassword.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard Page: Common Username & password query. + * + */ + +#ifndef EAPWIZARDPAGEUSERNAMEPASSWORD_H +#define EAPWIZARDPAGEUSERNAMEPASSWORD_H + +// System includes +#include + +// User includes +#include "eapwizardpage.h" + +// Forward declarations +class HbDocumentLoader; +class HbLineEdit; +class HbLabel; +class EapWizardPrivate; +class EapQtValidator; + +// External data types + +// Constants + +/*! + @addtogroup group_eap_wizard + @{ + */ + +// Class declaration + +class EapWizardPageUsernamePassword : public EapWizardPage +{ + Q_OBJECT +public: + explicit EapWizardPageUsernamePassword(EapWizardPrivate* parent); + ~EapWizardPageUsernamePassword(); + +public: // From WlanWizardPage + HbWidget* initializePage(); + int nextId() const; + bool showPage(); + +signals: + +public slots: + +protected: + +protected slots: + +private: + Q_DISABLE_COPY(EapWizardPageUsernamePassword) + void createPages(); + bool hasInnerMethod() const; + +private slots: + void textChanged(const QString &text); + void loadDocmlSection(Qt::Orientation orientation); + +private: // data + // OWNED + //! Document loader for docml + QScopedPointer mDocumentLoader; + //! Validator for username + QScopedPointer mValidatorUsername; + //! Validator for password + QScopedPointer mValidatorPassword; + + // NOT OWNED + //! Visualization of the page + HbWidget *mWidget; + //! Line editor for username + HbLineEdit *mEditUsername; + //! Line editor for password + HbLineEdit *mEditPassword; + //! Title/label for username + HbLabel *mTitleUsername; + //! Title/label for password + HbLabel *mTitlePassword; +}; + +/*! @} */ + +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/inc/eapwizarduistrings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/inc/eapwizarduistrings.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP String definitions for UI + * + */ + +#ifndef EAPWIZARDUISTRINGS_H +#define EAPWIZARDUISTRINGS_H + +// System includes +#include + +// User includes + +// Forward declarations + +// External data types + +// Constants + +/*! + @addtogroup group_eap_wizard + @{ + */ + +//! Namespace for EAP UI String in the context of EapWizard +namespace EapWizardUiStrings +{ + //! String for EAP-AKA + static const QString EapAka = "EAP-AKA"; + //! String for EAP-FAST + static const QString EapFast = "EAP-FAST"; + //! String for EAP-GTC + static const QString EapGtc = "EAP-GTC"; + //! String for EAP-MSCHAPv2 + static const QString EapMschapv2 = "EAP-MSCHAPv2"; + //! String for EAP-SIM + static const QString EapSim = "EAP-SIM"; + //! String for EAP-TLS + static const QString EapTls = "EAP-TLS"; + //! String for EAP-TTLS + static const QString EapTtls = "EAP-TTLS"; + //! String for LEAP + static const QString Leap = "LEAP"; + //! String for Plain-MSCHAPv2 + static const QString Mschapv2 = "MSCHAPv2"; + //! String for PAP + static const QString Pap = "PAP"; + //! String for PEAP + static const QString Peap = "PEAP"; +} + +/*! @} */ + +#endif /* EAPWIZARDUISTRINGS_H */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/resources/eapwizard_resource.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/resources/eapwizard_resource.qrc Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,9 @@ + + + occ_eap_wizard_01_02_04.docml + occ_eap_wizard_03.docml + occ_eap_wizard_05_07.docml + occ_eap_wizard_06.docml + occ_eap_wizard_08.docml + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/resources/occ_eap_wizard_01_02_04.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/resources/occ_eap_wizard_01_02_04.docml Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,50 @@ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + +
+ + + + + +
diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/resources/occ_eap_wizard_03.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/resources/occ_eap_wizard_03.docml Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/resources/occ_eap_wizard_05_07.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/resources/occ_eap_wizard_05_07.docml Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/resources/occ_eap_wizard_06.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/resources/occ_eap_wizard_06.docml Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + +
+ + + + + +
diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/resources/occ_eap_wizard_08.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/resources/occ_eap_wizard_08.docml Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + +
+ + + + + +
diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/rom/eapwizard.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/rom/eapwizard.iby Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* EAP Wizard IBY +*/ + +#ifndef EAPWIZARD_IBY +#define EAPWIZARD_IBY + +#include + +#ifdef __PROTOCOL_WLAN + +file=ABI_DIR/BUILD_DIR/eapwizard.dll SHARED_LIB_DIR/eapwizard.dll + +#endif // __PROTOCOL_WLAN + +#endif // EAPWIZARD_IBY diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/rom/eapwizard_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/rom/eapwizard_resources.iby Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* EAP Wizard resource iby. +*/ + +#ifndef EAPWIZARD_RESOURCES_IBY +#define EAPWIZARD_RESOURCES_IBY + +#include +#include + +#ifdef __PROTOCOL_WLAN + +data=DATAZ_/QT_TRANSLATIONS_DIR/eapwizard.qm QT_TRANSLATIONS_DIR/eapwizard.qm + +#endif // __PROTOCOL_WLAN + +#endif // EAPWIZARD_RESOURCES_IBY diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/src/eapwizard.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/src/eapwizard.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard: API implementation. + */ + +// System includes + +// User includes +#include "eapwizard.h" +#include "eapwizard_p.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "eapwizardTraces.h" +#endif + +/*! + \class EapWizard + \brief EAP plugin for WLAN wizard. + */ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor of EAP Wizard. + + @param [in] wizardHelper pointer to the helpper instance. + */ +EapWizard::EapWizard(WlanWizardHelper *wizardHelper) : d_ptr(NULL) +{ + OstTraceFunctionEntry0(EAPWIZARD_EAPWIZARD_ENTRY); + + d_ptr.reset( new EapWizardPrivate(wizardHelper)); + + OstTraceFunctionExit0(EAPWIZARD_EAPWIZARD_EXIT); +} + +/*! + Destructor. + */ +EapWizard::~EapWizard() +{ + OstTraceFunctionEntry0(EAPWIZARD_DEAPWIZARD_ENTRY); + OstTraceFunctionExit0(EAPWIZARD_DEAPWIZARD_EXIT); +} + +/*! + See WlanWizardPlugin::summary(). + + This method is used to query eap plugin specific summary items. + + Both item and value are localized strings. + + @param [in] sum Summary id to be queried + @param [in,out] item The item string is returned here + @param [in,out] value The value of item is returned here. + + @return true if summary item is found, false otherwise. + */ +bool EapWizard::summary(WlanWizardPlugin::Summary sum, QString &item, QString &value) +{ + OstTraceFunctionEntry0(EAPWIZARD_SUMMARY_ENTRY); + bool ret = d_ptr->summary(sum, item, value); + OstTraceFunctionExit0(EAPWIZARD_SUMMARY_EXIT); + return ret; +} + +/*! + See WlanWizardPlugin::storeSettings(). + + Stores EAP specific settings. + */ +bool EapWizard::storeSettings() +{ + OstTraceFunctionEntry0(EAPWIZARD_STORESETTINGS_ENTRY); + + bool ret = d_ptr->storeSettings(); + + OstTraceFunctionExit0(EAPWIZARD_STORESETTINGS_EXIT); + + return ret; +} + + +/*! + See WlanWizardPlugin::errorString(). + + Gets EAP Wizard specific error code. In case mapping cannot be done an empty + string is returned. + */ +QString EapWizard::errorString(int errorCode) +{ + OstTraceFunctionEntry0(EAPWIZARD_ERRORSTRING_ENTRY); + + QString string = d_ptr->errorString(errorCode); + + OstTraceFunctionExit0(EAPWIZARD_ERRORSTRING_EXIT); + return string; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/src/eapwizard_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/src/eapwizard_p.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,663 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard: Private implementation. + */ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "wlanwizardhelper.h" +#include "wlanwizardplugin.h" +#include "eapwizard.h" +#include "eapwizard_p.h" +#include "eapwizarduistrings.h" +#include "eapwizardpageoutertype.h" +#include "eapwizardpagecertca.h" +#include "eapwizardpagecertuser.h" +#include "eapwizardpageidentity.h" +#include "eapwizardpageinnertype.h" +#include "eapwizardpageusernamepassword.h" +#include "eapwizardpagenewpacstore.h" +#include "eapwizardpagepacstorepasswordconfirm.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "eapwizard_pTraces.h" +#endif + +/*! + \class EapWizardPrivate + \brief Implements the EAP wizard plugin for WLAN wizard. + */ + +// External function prototypes + +// Local constants + + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor of EAP Wizard. + + @param [in] wizardHelper pointer to the helper instance. + */ +EapWizardPrivate::EapWizardPrivate( + WlanWizardHelper *wizardHelper) : + mWizardHelper(wizardHelper), + mTranslator(new HbTranslator("eapwizard")), + mEapConfIf(new EapQtConfigInterface( + EapQtConfigInterface::EapBearerTypeWlan, + EapQtConfigInterface::IapIdUndefined)) +{ + Q_ASSERT(wizardHelper); + createPages(); +} + +/*! + Destructor. + */ +EapWizardPrivate::~EapWizardPrivate() +{ +} + +/*! + See EapWizard::summary(). + */ +bool EapWizardPrivate::summary( + WlanWizardPlugin::Summary sum, + QString &item, + QString &value) +{ + bool ret = false; + int outerType = configurations(EapWizardPrivate::OuterType).toInt(); + + switch (sum) { + case WlanWizardPlugin::SummaryEapInnerType: + if (hasInnerMethod()) { + item = hbTrId("txt_occ_dblist_inner_eap"); + value = eapTypeToString(configurations(EapWizardPrivate::InnerType).toInt()); + ret = true; + } + break; + + case WlanWizardPlugin::SummaryEapFastProvisioningMode: + if (outerType == EapQtPluginHandle::PluginEapFast) { + item = hbTrId("txt_occ_dblist_provisioning_mode_for_eapfast"); + value = hbTrId("txt_occ_dblist_provisioning_mode_for_val_unauthent"); + ret = true; + } + break; + + default: + Q_ASSERT(sum == WlanWizardPlugin::SummaryEapOuterType); + item = hbTrId("txt_occ_dblist_outer_eap"); + value = eapTypeToString(outerType); + ret = true; + break; + + } + return ret; +} + +/*! + See EapWizard::storeSettings(). + + @return true - ok, false - failed + */ +bool EapWizardPrivate::storeSettings() +{ + bool ret = false; + EapQtPluginHandle outerType(static_cast( + configurations(OuterType).toInt())); + + int iapId = mWizardHelper->configuration(WlanWizardHelper::ConfIapId).toInt(); + + if (mEapConfIf->setConfigurationReference(iapId) + && storeOuterTypeSettings(outerType) + && storeInnerTypeSettings(outerType)) { + ret = true; + } + + return ret; +} + +/*! + See WlanWizardPlugin::errorString(). + + Returns EAP spesific error string. + */ +QString EapWizardPrivate::errorString(int errorCode) +{ + char* textId = NULL; + int eapType = EapQtPluginHandle::PluginUndefined; + + switch (errorCode){ + case KErrWlanUserRejected: + textId = "txt_occ_dialog_1_auth_failed_user_cert_rej"; + eapType = configurations(OuterType).toInt(); + break; + + case KErrWlanUserCertificateExpired: + textId = "txt_occ_dialog_1_auth_failed_user_cert_exp"; + eapType = configurations(OuterType).toInt(); + break; + + case KErrWlanServerCertificateExpired: + textId = "txt_occ_dialog_1_authentication_failed_server_ce"; + eapType = configurations(OuterType).toInt(); + break; + + case KErrWlanCerficateVerifyFailed: + textId = "txt_occ_dialog_1_authentication_failed_could_not"; + eapType = configurations(OuterType).toInt(); + break; + + case KErrWlanNoCipherSuite: + textId = "txt_occ_dialog_1_authentication_failed_cipher_su"; + eapType = configurations(OuterType).toInt(); + break; + + case KErrWlanSimNotInstalled: + textId = "txt_occ_dialog_1_authentication_failed_check_sim"; + eapType = configurations(OuterType).toInt(); + break; + + case KErrWlanEapFastPacStoreCorrupted: + textId = "txt_occ_dialog_1_authentication_failed_reset_pac"; + eapType = EapQtPluginHandle::PluginEapFast; + break; + + case KErrWlanEapSimFailed: + case KErrWlanEapTlsFailed: + case KErrWlanEapPeapFailed: + case KErrWlanEapAkaFailed: + case KErrWlanEapTtlsFailed: + case KErrWlanLeapFailed: + case KErrWlanNoUserCertificate: + case KErrWlanEapFastTunnelCompromiseError: + case KErrWlanEapFastUnexpextedTlvExhanged: + case KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled: + case KErrWlanEapFastNoMatchingPacForAid: + case KErrWlanEapFastAuthFailed: + textId = "txt_occ_dialog_1_authentication_failed"; + eapType = configurations(OuterType).toInt(); + break; + + case KErrWlanEapMsChapv2: + case KErrWlanEapGtcFailed: + textId = "txt_occ_dialog_1_authentication_failed"; + eapType = configurations(InnerType).toInt(); + break; + + case KErrWlanNotSubscribed: + case KErrWlanAccessBarred: + case KErrWlanPasswordExpired: + case KErrWlanNoDialinPermissions: + case KErrWlanAccountDisabled: + case KErrWlanRestrictedLogonHours: + textId = "txt_occ_dialog_1_authentication_failed"; + if (hasInnerMethod()){ + eapType = configurations(InnerType).toInt(); + } else { + eapType = configurations(OuterType).toInt(); + } + break; + + default: + // Return empty string + break; + } + + QString string; + if (textId) { + string = HbParameterLengthLimiter(hbTrId(textId)).arg(eapTypeToString(eapType)); + } + + return string; +} + +/*! + Reader method for eap configurations. + + See ConfigurationId for further details about the data types in QVariant. + + @param [in] confId Defines what configuration is read. + + @return configuration value. + */ +QVariant EapWizardPrivate::configurations(ConfigurationId confId) const +{ + Q_ASSERT(mConfigurations.contains(confId)); + +#ifdef OST_TRACE_COMPILER_IN_USE + QString tmp; + QDebug tmpStream(&tmp ); + tmpStream << mConfigurations[confId]; + TPtrC16 string(tmp.utf16(), tmp.length() ); + + OstTraceExt2( + TRACE_NORMAL, + EAPWIZARDPRIVATE_CONFIGURATIONS, + "EapWizardPrivate::configurations;confId=%{ConfigurationId};string=%S", + (TUint)confId, string ); +#endif + + return mConfigurations[confId]; +} + +/*! + Sets EAP configuration value for given configuration identifier. + See ConfigurationId for further details about the data types in QVariant. + + @param [in] confId Configuration Identifier do to be set + @param [in] value Value for configuration. + */ +void EapWizardPrivate::setConfigurations( + ConfigurationId confId, const QVariant &value) +{ +#ifdef OST_TRACE_COMPILER_IN_USE + QString tmp; + QDebug tmpStream(&tmp ); + tmpStream << value; + TPtrC16 string( tmp.utf16(), tmp.length() ); + + OstTraceExt2( + TRACE_NORMAL, + EAPWIZARDPRIVATE_SETCONFIGURATIONS, + "EapWizardPrivate::setConfigurations;confId=%{ConfigurationId};string=%S", + (TUint)confId, string ); +#endif + + mConfigurations[confId] = value; +} + +/*! + @return pointer to EapQtConfigInterface. + */ +EapQtConfigInterface* EapWizardPrivate::eapConfigurationInterface() const +{ + Q_ASSERT(mEapConfIf.data()); + return mEapConfIf.data(); +} + +/*! + Maps given EAP Qt Plugin handle into string. + + @param [in] id EapQtPluginHandle::Handle, id to be mapped to string. + + @return EAP String. + */ +QString EapWizardPrivate::eapTypeToString(int id) const +{ + QString locId; + switch (id) { + case EapQtPluginHandle::PluginEapAka: + locId = EapWizardUiStrings::EapAka; + break; + + case EapQtPluginHandle::PluginEapFast: + locId = EapWizardUiStrings::EapFast; + break; + + case EapQtPluginHandle::PluginLeap: + locId = EapWizardUiStrings::Leap; + break; + + case EapQtPluginHandle::PluginPeap: + locId = EapWizardUiStrings::Peap; + break; + + case EapQtPluginHandle::PluginEapSim: + locId = EapWizardUiStrings::EapSim; + break; + + case EapQtPluginHandle::PluginEapTls: + locId = EapWizardUiStrings::EapTls; + break; + + case EapQtPluginHandle::PluginEapTtls: + locId = EapWizardUiStrings::EapTtls; + break; + + case EapQtPluginHandle::PluginEapMschapv2: + locId = EapWizardUiStrings::EapMschapv2; + break; + + case EapQtPluginHandle::PluginEapGtc: + locId = EapWizardUiStrings::EapGtc; + break; + + case EapQtPluginHandle::PluginPap: + locId = EapWizardUiStrings::Pap; + break; + + default: + // Invalid enum + Q_ASSERT(EapQtPluginHandle::PluginPlainMschapv2 == id); + locId = EapWizardUiStrings::Mschapv2; + break; + } + + return locId; +} + +/*! + Accessor to WLAN Wizard Helper objects. + + @return a pointer to helper object. + */ +WlanWizardHelper *EapWizardPrivate::wizardHelper() const +{ + Q_ASSERT(mWizardHelper); + return mWizardHelper; +} + +/*! + Creates EAP Wizard pages and add those to the wizard framework. + */ +void EapWizardPrivate::createPages() +{ + mWizardHelper->addPage( + EapWizardPage::PageOuterType, + new EapWizardPageOuterType(this)); + + mWizardHelper->addPage( + EapWizardPage::PageCertificateCa, + new EapWizardPageCertCa(this)); + + mWizardHelper->addPage( + EapWizardPage::PageCertificateUser, + new EapWizardPageCertUser(this)); + + mWizardHelper->addPage( + EapWizardPage::PageIdentity, + new EapWizardPageIdentity(this)); + + mWizardHelper->addPage( + EapWizardPage::PageInnerTypeEapTtls, + new EapWizardPageInnerType( + this, + EapQtPluginHandle::PluginEapTtls)); + + mWizardHelper->addPage( + EapWizardPage::PageInnerTypePeap, + new EapWizardPageInnerType( + this, + EapQtPluginHandle::PluginPeap)); + + mWizardHelper->addPage( + EapWizardPage::PageUsernamePassword, + new EapWizardPageUsernamePassword(this)); + + mWizardHelper->addPage( + EapWizardPage::PageNewPacStorePassword, + new EapWizardPageNewPacStore(this)); + + mWizardHelper->addPage( + EapWizardPage::PagePromptPacStorePassword, + new EapWizardPagePacStorePasswordConfirm(this)); +} + +/*! + Check whether selected outer type has inner method. + + @return true if inner method exists, false otherwise. + */ +bool EapWizardPrivate::hasInnerMethod() const +{ + int outerType = configurations(EapWizardPrivate::OuterType).toInt(); + bool ret = false; + + switch (outerType){ + case EapQtPluginHandle::PluginEapTtls: + case EapQtPluginHandle::PluginPeap: + case EapQtPluginHandle::PluginEapFast: + ret = true; + break; + } + + return ret; +} + + +/* + Handles TLS methods (PEAP, EAP-TLS and EAP-TTLS) settings. + + Stores configurations to eapConf + + @param [in,out] eapConf configuration is written to this object. + @param [in] outerType Outer EAP method + */ +void EapWizardPrivate::handleTlsMethodsSettings( + EapQtConfig &eapConf, + EapQtPluginHandle &outerType) +{ + // Common stuff for all tls methods + eapConf.setValue(EapQtConfig::UseIdentityPrivacy, false); + eapConf.setValue(EapQtConfig::VerifyServerRealm, false); + eapConf.setValue(EapQtConfig::ClientAuthenticationRequired, false); + eapConf.setValue(EapQtConfig::UsernameAutomatic, configurations(TunnelUsernameAutomatic)); + eapConf.setValue(EapQtConfig::Username, configurations(TunnelUsername)); + eapConf.setValue(EapQtConfig::RealmAutomatic, configurations(TunnelRealmAutomatic)); + eapConf.setValue(EapQtConfig::Realm, configurations(TunnelRealm)); + + QVariant certVariant = configurations(CertificateCa); + + if (certVariant.canConvert ()) { + QList caCerts; + caCerts.append(certVariant); + eapConf.setValue(EapQtConfig::AuthorityCertificate, caCerts); + eapConf.setValue(EapQtConfig::AuthorityCertificateAutomatic, false); + } else { + eapConf.setValue(EapQtConfig::AuthorityCertificateAutomatic, true); + } + + // type specific configurations + if (outerType == EapQtPluginHandle::PluginEapTls) { + QList userCerts; + userCerts.append(configurations(CertificateUser)); + eapConf.setValue(EapQtConfig::ClientAuthenticationRequired, true); + eapConf.setValue(EapQtConfig::UserCertificate, userCerts); + + } else if (outerType == EapQtPluginHandle::PluginPeap) { + + switch (configurations(InnerType).toInt()) { + case EapQtPluginHandle::PluginEapMschapv2: + // EAP-MSCHAPv2: enable v0 only + eapConf.setValue(EapQtConfig::PeapVersion0Allowed, true); + eapConf.setValue(EapQtConfig::PeapVersion1Allowed, false); + break; + + case EapQtPluginHandle::PluginEapGtc: + // EAP-GTC: enable v1 only + eapConf.setValue(EapQtConfig::PeapVersion0Allowed, false); + eapConf.setValue(EapQtConfig::PeapVersion1Allowed, true); + break; + } + eapConf.setValue(EapQtConfig::PeapVersion2Allowed, false); + } +} + +/*! + Handles configurations for EAP-FAST. + + @param [in,out] eapConf EAP Configuration + + @param false in case of failure. + */ +bool EapWizardPrivate::handleEapFastSettings(EapQtConfig &eapConf) +{ + bool ret = true; + EapQtPacStoreConfig pacStoreConf; + + eapConf.setValue(EapQtConfig::ProvisioningModeAuthenticated, false); + eapConf.setValue(EapQtConfig::ProvisioningModeUnauthenticated, true); + eapConf.setValue(EapQtConfig::VerifyServerRealm, false); + eapConf.setValue(EapQtConfig::UseIdentityPrivacy, false); + + switch (configurations(PacStoreState).toInt()) { + case EapQtPacStoreConfig::PacStoreStateStoreNotExists: + case EapQtPacStoreConfig::PacStoreStatePasswordRequired: + pacStoreConf.setValue( + EapQtPacStoreConfig::PacStorePassword, + configurations(PacStorePassword)); + + pacStoreConf.setValue( + EapQtPacStoreConfig::PacStoreSavePassword, + true); + + if (!mEapConfIf->savePacStoreConfiguration(pacStoreConf)) { + // no cleaning required + ret = false; + } + break; + + default: + // Do nothing + break; + } + + return ret; +} + +/*! + Handles configurations for EAP-AKA and EAP-SIM. + + @param [in,out] eapConf EAP Configuration + */ +void EapWizardPrivate::handleEapAkaSimSettings(EapQtConfig &eapConf) +{ + eapConf.setValue(EapQtConfig::UsernameAutomatic, true); + eapConf.setValue(EapQtConfig::RealmAutomatic, true); +} + +/*! + Handles configurations for LEAP. + + @param [in,out] eapConf EAP Configuration + */ +void EapWizardPrivate::handleLeapSettings(EapQtConfig &eapConf) +{ + eapConf.setValue(EapQtConfig::UsernameAutomatic, false); + eapConf.setValue(EapQtConfig::Username, configurations(Username)); + eapConf.setValue(EapQtConfig::PasswordPrompt, false); + eapConf.setValue(EapQtConfig::Password, configurations(Password)); +} + +/*! + Store outer type settings. + + @param outerType reference to outertype + + @return false in case of failure. + */ +bool EapWizardPrivate::storeOuterTypeSettings(EapQtPluginHandle &outerType) +{ + EapQtConfig eapConf; + + // 1. Store outer type settings + switch (outerType.pluginId()) { + case EapQtPluginHandle::PluginEapTtls: + case EapQtPluginHandle::PluginPeap: + case EapQtPluginHandle::PluginEapTls: + handleTlsMethodsSettings(eapConf, outerType); + break; + + case EapQtPluginHandle::PluginEapFast: + if (!handleEapFastSettings(eapConf)) { + return false; + } + break; + + case EapQtPluginHandle::PluginEapAka: + case EapQtPluginHandle::PluginEapSim: + handleEapAkaSimSettings(eapConf); + break; + + default: + Q_ASSERT(outerType == EapQtPluginHandle::PluginLeap); + handleLeapSettings(eapConf); + break; + } + + if (hasInnerMethod()) { + EapQtPluginHandle inner = static_cast( + configurations(InnerType).toInt()); + + QList innerType; + innerType.append(qVariantFromValue(inner)); + eapConf.setValue(EapQtConfig::InnerType, innerType); + } + + // store outer type configurations + if (!mEapConfIf->saveConfiguration(outerType, eapConf)){ + mEapConfIf->deleteConfiguration(); + return false; + } + + QList selectedOuterTypes; + selectedOuterTypes.append(outerType); + if (!mEapConfIf->setSelectedOuterTypes(selectedOuterTypes)){ + mEapConfIf->deleteConfiguration(); + return false; + } + + return true; +} + + +/*! + Store inner type settings if exists. + + @param outerType reference to outertype + + @return false in case of failure. + */ +bool EapWizardPrivate::storeInnerTypeSettings(EapQtPluginHandle &outerType) +{ + bool ret = true; + + if (hasInnerMethod()) { + EapQtPluginHandle inner = static_cast( + configurations(InnerType).toInt()); + + // All inner methods supported by wizard use password / username. + EapQtConfig eapConfInner; + eapConfInner.setValue(EapQtConfig::OuterType, qVariantFromValue(outerType)); + eapConfInner.setValue(EapQtConfig::UsernameAutomatic, false); + eapConfInner.setValue(EapQtConfig::Username, configurations(Username)); + eapConfInner.setValue(EapQtConfig::PasswordPrompt, false); + eapConfInner.setValue(EapQtConfig::Password, configurations(Password)); + + if (!mEapConfIf->saveConfiguration(inner, eapConfInner)){ + mEapConfIf->deleteConfiguration(); + ret = false; + } + } + return ret; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/src/eapwizardpage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/src/eapwizardpage.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard: API for wizard pages. + * + */ + +// System includes +#include +#include +#include + +// User includes +#include "eapwizardpage.h" +#include "eapwizard_p.h" + +/*! + \class EapWizardPage + \brief Defines the interface for EAP specific wizard pages. + */ + +/*! + \fn HbWidget* EapWizardPage::initializePage() + See WlanWizardPage. + */ + +/*! + \fn int EapWizardPage::nextId() const + See WlanWizardPage. + */ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +/*! + Constructor. + + @param [in] parent Pointer to EAP Wizard private implementation. + */ +EapWizardPage::EapWizardPage(EapWizardPrivate* parent) : + QObject(parent), + mWizard(parent) +{ +} + +/*! + Destructor. + */ +EapWizardPage::~EapWizardPage() +{ + mWizard = NULL; +} + +/*! + See WlanWizardPage. + */ +int EapWizardPage::nextId(bool &removeFromStack) const +{ + removeFromStack = false; + return nextId(); +} + +/*! + Loads requested section from given docml file. + + @param [in] loader Document loader for docml + @param [in] orientation Orientation to be loaded + @param [in] filename the name of docml filename + @param [in] portraitSection the name of section to be loaded in portrait mode + @param [in] landscapeSection the name of section to be loaded in landscape mode + */ +void EapWizardPage::loadDocmlSection( + HbDocumentLoader *loader, + Qt::Orientation orientation, + const QString &filename, + const QString &portraitSection, + const QString &landscapeSection) const +{ + bool ok; + + // Then load the orientation specific section + if (orientation == Qt::Horizontal) { + loader->load(filename, landscapeSection, &ok); + Q_ASSERT(ok); + } else { + Q_ASSERT(orientation == Qt::Vertical); + loader->load(filename, portraitSection, &ok); + Q_ASSERT(ok); + } +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/src/eapwizardpagecertca.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/src/eapwizardpagecertca.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard Page: Certificate Authority Selection. + * + */ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "wlanwizardhelper.h" +#include "eapwizard_p.h" +#include "eapwizardpagecertca.h" + +/*! + \class EapWizardPageCertCa + \brief Implements EAP wizard page: Certificate Authority selection + */ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +/*! + Constructor. + + @param [in] parent Pointer to EAP Wizard private implementation. + */ +EapWizardPageCertCa::EapWizardPageCertCa(EapWizardPrivate* parent) : + EapWizardPage(parent), + mDocumentLoader(NULL), + mWidget(NULL), + mTitle(NULL), + mCertList(NULL) +{ +} + +/*! + Destructor. + */ +EapWizardPageCertCa::~EapWizardPageCertCa() +{ +} + +/*! + See WlanWizardPage. + */ +HbWidget* EapWizardPageCertCa::initializePage() +{ + if (!mWidget) { + mDocumentLoader.reset( new HbDocumentLoader( + mWizard->wizardHelper()->mainWindow()) ); + + bool ok; + mDocumentLoader->load(":/docml/occ_eap_wizard_01_02_04.docml", &ok); + Q_ASSERT(ok); + + loadDocmlSection(mWizard->wizardHelper()->mainWindow()->orientation()); + + mWidget = qobject_cast ( + mDocumentLoader->findWidget("occ_eap_wizard_01")); + Q_ASSERT(mWidget); + + mCertList = qobject_cast ( + mDocumentLoader->findWidget("list")); + Q_ASSERT(mCertList); + + mTitle = qobject_cast (mDocumentLoader->findWidget("title")); + Q_ASSERT(mTitle); + + mTitle->setPlainText( + hbTrId("txt_occ_title_select_authority_certificate")); + + ok = connect( + mWizard->wizardHelper()->mainWindow(), + SIGNAL(orientationChanged(Qt::Orientation)), + this, + SLOT(loadDocmlSection(Qt::Orientation))); + Q_ASSERT(ok); + } + + EapQtConfigInterface* confIf = mWizard->eapConfigurationInterface(); + // ignore return value + confIf->updateCertificates(); + mCerts = confIf->certificateAuthorityCertificates(); + + QStringList list; + list << hbTrId("txt_occ_setlabel_val_select_automatically"); + + for (int i = 0; i < mCerts.count(); ++i) { + // TODO: workaround for BBHA-863EJN + // graphics memory runs out for long lists and items + QString tmp(mCerts.at(i).value( + EapQtCertificateInfo::CertificateLabel).toString()); + tmp.truncate(10); + list << tmp; + } + + // If certificate list has been changed update the content otherwise do not + // change it + if (list != mCertList->items()) { + mCertList->setItems(list); + // Automatic is selected by default + mCertList->setSelected(IndexForAutomatic); + } + return mWidget; +} + +/*! + Loads the required orientation of docml. + + @param [in] orientation Orientation to be loaded. + */ +void EapWizardPageCertCa::loadDocmlSection(Qt::Orientation orientation) +{ + EapWizardPage::loadDocmlSection( + mDocumentLoader.data(), + orientation, + ":/docml/occ_eap_wizard_01_02_04.docml", + "portrait_section", + "landscape_section"); +} + +/*! + See WlanWizardPage. + + @return next wizard page: + - EapWizardPage::PageCertificateUser: For EAP-TLS + - EapWizardPage::PageIdentity: For EAP-TTLS and PEAP + */ +int EapWizardPageCertCa::nextId() const +{ + int id = WlanWizardPage::PageNone; + bool ok; + int type = mWizard->configurations(EapWizardPrivate::OuterType).toInt(&ok); + Q_ASSERT(ok); + + if (type == EapQtPluginHandle::PluginEapTls) { + id = EapWizardPage::PageCertificateUser; + } else { + Q_ASSERT(type == EapQtPluginHandle::PluginEapTtls || + type == EapQtPluginHandle::PluginPeap); + id = EapWizardPage::PageIdentity; + } + + int selected = mCertList->selected(); + if (selected == IndexForAutomatic) { + mWizard->setConfigurations(EapWizardPrivate::CertificateCa, QVariant()); + } else { + mWizard->setConfigurations( + EapWizardPrivate::CertificateCa, qVariantFromValue(mCerts.at( + selected - AmountOfNonCertItems))); + } + + return id; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/src/eapwizardpagecertuser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/src/eapwizardpagecertuser.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard Page: User Certificate Selection. + * + */ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "wlanwizardhelper.h" +#include "eapwizardpagecertuser.h" +#include "eapwizard_p.h" + +/*! + \class EapWizardPageCertUser + \brief Implements EAP wizard page: User Certificate selection + */ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +/*! + Constructor. + + @param [in] parent Pointer to EAP Wizard private implementation. + */ + +EapWizardPageCertUser::EapWizardPageCertUser(EapWizardPrivate* parent) : + EapWizardPage(parent), + mWidget(NULL), + mCertList(NULL), + mErrorLabel(NULL), + mDocumentLoader(NULL), + mValid(false) +{ +} + +/*! + Destructor. + */ +EapWizardPageCertUser::~EapWizardPageCertUser() +{ +} + +/*! + See WlanWizardPage. + */ +HbWidget* EapWizardPageCertUser::initializePage() +{ + if (!mWidget) { + bool ok; + mDocumentLoader.reset(new HbDocumentLoader(mWizard->wizardHelper()->mainWindow())); + mDocumentLoader->load(":/docml/occ_eap_wizard_06.docml", &ok); + Q_ASSERT(ok); + loadDocmlSection(mWizard->wizardHelper()->mainWindow()->orientation()); + + mWidget = qobject_cast (mDocumentLoader->findWidget("occ_eap_wizard_06")); + Q_ASSERT(mWidget); + + mCertList = qobject_cast (mDocumentLoader->findWidget("list")); + Q_ASSERT(mCertList); + + mErrorLabel = qobject_cast (mDocumentLoader->findWidget("errorLabel")); + Q_ASSERT(mErrorLabel); + + mErrorLabel->setPlainText(hbTrId("txt_occ_dialog_no_certificates_installed_wizard_c")); + + ok = connect( + mWizard->wizardHelper()->mainWindow(), + SIGNAL(orientationChanged(Qt::Orientation)), + this, + SLOT(loadDocmlSection(Qt::Orientation))); + Q_ASSERT(ok); + + ok = connect( + mCertList, SIGNAL(itemSelected(int)), + this, SLOT(itemSelected(int))); + Q_ASSERT(ok); + } + + EapQtConfigInterface* confIf = mWizard->eapConfigurationInterface(); + // ignore return value + confIf->updateCertificates(); + mCerts = confIf->userCertificates(); + + QStringList list; + for (int i = 0; i < mCerts.count(); ++i) { + list << mCerts.at(i).value(EapQtCertificateInfo::CertificateLabel).toString(); + } + + if (list.isEmpty()) { + mErrorLabel->setVisible(true); + mCertList->setVisible(false); + mValid = false; + } else if (list != mCertList->items()){ + // in case the user cert list has been changed, update UI + mCertList->setItems(list); + mErrorLabel->setVisible(false); + mCertList->setVisible(true); + + if (list.count() == 1) { + mValid = true; + mCertList->setSelected(0); + } else { + mValid = false; + } + } + return mWidget; +} + +/*! + Loads the required orientation of docml. + + @param [in] orientation Orientation to be loaded. + */ +void EapWizardPageCertUser::loadDocmlSection(Qt::Orientation orientation) +{ + EapWizardPage::loadDocmlSection( + mDocumentLoader.data(), + orientation, + ":/docml/occ_eap_wizard_06.docml", + "portrait_section", + "landscape_section"); +} + +/*! + See WlanWizardPage. + + @return next wizard page: EapWizardPage::PageIdentity + */ +int EapWizardPageCertUser::nextId() const +{ + mWizard->setConfigurations( + EapWizardPrivate::CertificateUser, + qVariantFromValue( + mCerts.at(mCertList->selected()))); + + return EapWizardPage::PageIdentity; +} + +/*! + See WlanWizardPage. + + Validates the content of the page. + + @return true if content is valid. + */ +bool EapWizardPageCertUser::showPage() +{ + return mValid; +} + +/*! + Handler for itemsSelected() signal from HbRadioButtonList. + + @param [in] index NOT USED + */ +void EapWizardPageCertUser::itemSelected(int index) +{ + Q_UNUSED(index); + mValid = true; + mWizard->wizardHelper()->enableNextButton(mValid); +} + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/src/eapwizardpageidentity.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/src/eapwizardpageidentity.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,293 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard Page: EAP Identity. + * + */ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "wlanwizardhelper.h" +#include "eapwizardpageidentity.h" +#include "eapwizard_p.h" + +/*! + \class EapWizardPageIdentity + \brief Implements EAP wizard page: Identify for outer EAP type + */ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +/*! + Constructor. + + @param [in] parent Pointer to EAP Wizard private implementation. + */ +EapWizardPageIdentity::EapWizardPageIdentity(EapWizardPrivate* parent) : + EapWizardPage(parent), + mDocumentLoader(NULL), + mValidatorRealm(NULL), + mValidatorUsername(NULL), + mWidget(NULL), + mEditUsername(NULL), + mEditRealm(NULL), + mCheckUsername(NULL), + mCheckRealm(NULL), + mLabelRealm(NULL), + mLabelUsername(NULL) +{ +} + +/*! + Destructor. + */ +EapWizardPageIdentity::~EapWizardPageIdentity() +{ +} + +/*! + See WlanWizardPage. + */ +HbWidget* EapWizardPageIdentity::initializePage() +{ + if (!mWidget) { + bool ok = true; + mDocumentLoader.reset( + new HbDocumentLoader(mWizard->wizardHelper()->mainWindow())); + mDocumentLoader->load(":/docml/occ_eap_wizard_03.docml", &ok); + Q_ASSERT(ok); + + loadDocmlSection(mWizard->wizardHelper()->mainWindow()->orientation()); + + mWidget = qobject_cast (mDocumentLoader->findWidget("occ_eap_wizard_03")); + Q_ASSERT(mWidget); + + mEditUsername = qobject_cast (mDocumentLoader->findWidget("lineEditUsername")); + Q_ASSERT(mEditUsername); + + mEditRealm = qobject_cast (mDocumentLoader->findWidget("lineEditRealm")); + Q_ASSERT(mEditRealm); + + mCheckUsername = qobject_cast (mDocumentLoader->findWidget("setlabel_53_val")); + Q_ASSERT(mCheckUsername); + + mCheckRealm = qobject_cast (mDocumentLoader->findWidget("setlabel_54_val")); + Q_ASSERT(mCheckRealm); + + mLabelUsername = qobject_cast (mDocumentLoader->findWidget("setlabel_53")); + Q_ASSERT(mLabelUsername); + + mLabelRealm = qobject_cast (mDocumentLoader->findWidget("setlabel_54")); + Q_ASSERT(mLabelRealm); + + ok = connect( + mWizard->wizardHelper()->mainWindow(), + SIGNAL(orientationChanged(Qt::Orientation)), + this, + SLOT(loadDocmlSection(Qt::Orientation))); + Q_ASSERT(ok); + + ok = connect( + mEditUsername, SIGNAL(textChanged(const QString &)), + this, SLOT(textChanged(const QString &))); + Q_ASSERT(ok); + + ok = connect( + mEditRealm, SIGNAL(textChanged(const QString &)), + this, SLOT(textChanged(const QString &))); + Q_ASSERT(ok); + + ok = connect( + mCheckUsername, SIGNAL(stateChanged(int)), + this, SLOT(stateChanged(int))); + Q_ASSERT(ok); + + ok = connect( + mCheckRealm, SIGNAL(stateChanged(int)), + this, SLOT(stateChanged(int))); + Q_ASSERT(ok); + // by default both checkboxes are checked + } + EapQtPluginHandle plugin((EapQtPluginHandle::Plugin) + mWizard->configurations(EapWizardPrivate::OuterType).toInt() ); + + mLabelUsername->setPlainText( + HbParameterLengthLimiter( + hbTrId("txt_occ_setlabel_user_name_for_1")).arg( + mWizard->eapTypeToString(plugin.pluginId()))); + + // Configure editors properties + mValidatorUsername.reset( + mWizard->eapConfigurationInterface()->validatorEap( + plugin.type(), + EapQtConfig::Username) ); + Q_ASSERT(mValidatorUsername.data()); + mValidatorUsername->updateEditor(mEditUsername); + + mValidatorRealm.reset( + mWizard->eapConfigurationInterface()->validatorEap( + plugin.type(), + EapQtConfig::Realm) ); + Q_ASSERT(mValidatorRealm.data()); + mValidatorRealm->updateEditor(mEditRealm); + + return mWidget; +} + +/*! + Loads the required orientation of docml. + + @param [in] orientation Orientation to be loaded. + */ +void EapWizardPageIdentity::loadDocmlSection(Qt::Orientation orientation) +{ + EapWizardPage::loadDocmlSection( + mDocumentLoader.data(), + orientation, + ":/docml/occ_eap_wizard_03.docml", + "portrait_section", + "landscape_section"); +} + +/*! + See WlanWizardPage. + + @return next wizard page: + - WlanWizardPage::PageProcessSettings: For EAP-TLS + - EapWizardPage::PageInnerTypeEapTtls: For EAP-TTLS + - EapWizardPage::PageInnerTypePeap: For PEAP + */ +int EapWizardPageIdentity::nextId() const +{ + int id = WlanWizardPage::PageNone; + bool ok; + int type = mWizard->configurations(EapWizardPrivate::OuterType).toInt(&ok); + Q_ASSERT(ok); + + switch (type) { + case EapQtPluginHandle::PluginEapTls: + id = WlanWizardPage::PageProcessSettings; + break; + + case EapQtPluginHandle::PluginEapTtls: + id = EapWizardPage::PageInnerTypeEapTtls; + break; + + case EapQtPluginHandle::PluginPeap: + id = EapWizardPage::PageInnerTypePeap; + break; + } + + mWizard->setConfigurations(EapWizardPrivate::TunnelUsernameAutomatic, + mCheckUsername->isChecked()); + + mWizard->setConfigurations( + EapWizardPrivate::TunnelUsername, mEditUsername->text()); + + mWizard->setConfigurations( + EapWizardPrivate::TunnelRealmAutomatic, mCheckRealm->isChecked()); + + mWizard->setConfigurations(EapWizardPrivate::TunnelRealm, mEditRealm->text()); + + return id; +} + +/*! + See WlanWizardPage. + + Validates the content of the page. + + @return true if content is valid. + */ +bool EapWizardPageIdentity::showPage() +{ + bool valid = false; + + if (validateGroup(mEditUsername, mCheckUsername, mValidatorUsername.data()) && + validateGroup(mEditRealm, mCheckRealm, mValidatorRealm.data())) { + valid = true; + } + + return valid; +} + +/*! + Slot for textChanged() signal from HbLineEdit. + + @param [in] text NOT USED. + */ +void EapWizardPageIdentity::textChanged(const QString & text) +{ + Q_UNUSED(text); + mWizard->wizardHelper()->enableNextButton(showPage()); +} + +/*! + Slot for stateChanged() signal from HbCheckBox. + + @param [in] state NOT USED. + */ +void EapWizardPageIdentity::stateChanged(int state ) +{ + Q_UNUSED(state); + mEditUsername->setEnabled(!mCheckUsername->isChecked()); + mEditRealm->setEnabled(!mCheckRealm->isChecked()); + mWizard->wizardHelper()->enableNextButton(showPage()); +} + +/*! + Validates the settings group, that is line edit and checkbox using + given validator. + + @param [in] edit pointer to line edit to which content must be validated + @param [in] checkBox pointer to checkbox + @param [in] validator pointer to validator which is used to validate the content + of the line editor. + + @return true if validation is ok, false otherwise. + */ +bool EapWizardPageIdentity::validateGroup( + HbLineEdit *edit, + HbCheckBox *checkBox, + EapQtValidator *validator) const +{ + bool status = false; + if (checkBox->isChecked() || + checkBox->isChecked() == false && + EapQtValidator::StatusOk == validator->validate(edit->text())) { + status = true; + } + return status; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/src/eapwizardpageinnertype.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/src/eapwizardpageinnertype.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard Page: Inner Type selection + * + */ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "wlanwizardhelper.h" +#include "eapwizardpageinnertype.h" +#include "eapwizard_p.h" + + +/*! + \class EapWizardPageInnerType + \brief Implements EAP wizard page: Inner EAP type selection. + */ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +/*! + Constructor. + + @param [in] parent Pointer to EAP Wizard private implementation. + @param [in] outerType Identifies the outer type: Peap or EapTtls + */ +EapWizardPageInnerType::EapWizardPageInnerType( + EapWizardPrivate* parent, int outerType) : + EapWizardPage(parent), + mWidget(NULL), + mRadio(NULL), + mTitle(NULL), + mDocumentLoader(NULL), + mOuterType(outerType), + mValid(false) +{ +} + +/*! + Destructor. + */ +EapWizardPageInnerType::~EapWizardPageInnerType() +{ +} + +/*! + See WlanWizardPage. + */ +HbWidget* EapWizardPageInnerType::initializePage() +{ + if (!mWidget) { + bool ok; + mDocumentLoader.reset( + new HbDocumentLoader(mWizard->wizardHelper()->mainWindow())); + mDocumentLoader->load(":/docml/occ_eap_wizard_01_02_04.docml", &ok); + Q_ASSERT(ok); + + loadDocmlSection(mWizard->wizardHelper()->mainWindow()->orientation()); + + mWidget = qobject_cast (mDocumentLoader->findWidget("occ_eap_wizard_01")); + Q_ASSERT(mWidget); + + mTitle = qobject_cast (mDocumentLoader->findWidget("title")); + Q_ASSERT(mTitle); + + mRadio = qobject_cast (mDocumentLoader->findWidget("list")); + Q_ASSERT(mRadio); + + ok = connect( + mWizard->wizardHelper()->mainWindow(), + SIGNAL(orientationChanged(Qt::Orientation)), + this, + SLOT(loadDocmlSection(Qt::Orientation))); + Q_ASSERT(ok); + + QStringList list; + switch (mOuterType){ + case EapQtPluginHandle::PluginPeap: + appendToList(list, EapQtPluginHandle::PluginEapMschapv2); + break; + + default: + Q_ASSERT(mOuterType == EapQtPluginHandle::PluginEapTtls); + appendToList(list, EapQtPluginHandle::PluginPlainMschapv2); + appendToList(list, EapQtPluginHandle::PluginPap); + break; + } + appendToList(list, EapQtPluginHandle::PluginEapGtc); + mRadio->setItems(list); + + ok = connect(mRadio, SIGNAL(itemSelected(int)), this, SLOT(itemSelected(int))); + Q_ASSERT(ok); + } + + mTitle->setPlainText( + HbParameterLengthLimiter( + hbTrId("txt_occ_title_select_innear_eap_type_for_1")).arg( + mWizard->eapTypeToString( + mWizard->configurations( + EapWizardPrivate::OuterType).toInt()))); + + return mWidget; +} + +/*! + Loads the required orientation of docml. + + @param [in] orientation Orientation to be loaded. + */ +void EapWizardPageInnerType::loadDocmlSection(Qt::Orientation orientation) +{ + EapWizardPage::loadDocmlSection( + mDocumentLoader.data(), + orientation, + ":/docml/occ_eap_wizard_01_02_04.docml", + "portrait_section", + "landscape_section"); +} + +/*! + See WlanWizardPage. + + @return next wizard page: EapWizardPage::PageUsernamePassword + */ +int EapWizardPageInnerType::nextId() const +{ + mWizard->setConfigurations( + EapWizardPrivate::InnerType, + mEapTypes.at(mRadio->selected())); + + return EapWizardPage::PageUsernamePassword; +} + +/*! + See WlanWizardPage. + + Validates the content of the page. + + @return true if content is valid. + */ +bool EapWizardPageInnerType::showPage() +{ + return mValid; +} + +/*! + Handler for itemsSelected() signal from HbRadioButtonList. + + @param [in] index NOT USED + */ +void EapWizardPageInnerType::itemSelected(int index ) +{ + Q_UNUSED(index); + mValid = true; + mWizard->wizardHelper()->enableNextButton(mValid); +} + +/*! + Appends given method to radiobutton list if plugin (method) is supported + + @param [in,out] items the content of radiobutton list + @param [in] pluginHandle EAP Type plugin handle to be added. + */ +void EapWizardPageInnerType::appendToList( + QStringList &items, + EapQtPluginHandle::Plugin innerType) +{ + if (mWizard->eapConfigurationInterface()->isSupportedInnerType( + static_cast(mOuterType), innerType)) { + items << mWizard->eapTypeToString(innerType); + mEapTypes.append(innerType); + } +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/src/eapwizardpagenewpacstore.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/src/eapwizardpagenewpacstore.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard Page: New PAC store password + * + */ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "wlanwizardhelper.h" +#include "eapwizardpagenewpacstore.h" +#include "eapwizard_p.h" + +/*! + \class EapWizardPageNewPacStore + \brief Implements EAP wizard page: New PAC store password + */ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +/*! + Constructor. + + @param [in] parent Pointer to EAP Wizard private implementation. + */ +EapWizardPageNewPacStore::EapWizardPageNewPacStore( + EapWizardPrivate* parent) : + EapWizardPage(parent), + mDocumentLoader(NULL), + mValidator(NULL), + mWidget(NULL), + mEditPasswordNew(NULL), + mEditPasswordConfirm(NULL), + mTitlePasswordNew(NULL), + mTitlePasswordConfirm(NULL) +{ +} + +/*! + Destructor. + */ +EapWizardPageNewPacStore::~EapWizardPageNewPacStore() +{ +} + +/*! + See WlanWizardPage. + */ +HbWidget* EapWizardPageNewPacStore::initializePage() +{ + if (!mWidget) { + bool ok; + mDocumentLoader.reset( + new HbDocumentLoader(mWizard->wizardHelper()->mainWindow())); + mDocumentLoader->load(":/docml/occ_eap_wizard_05_07.docml", &ok); + Q_ASSERT(ok); + + loadDocmlSection(mWizard->wizardHelper()->mainWindow()->orientation()); + + mWidget = qobject_cast (mDocumentLoader->findWidget("view")); + Q_ASSERT(mWidget); + + mTitlePasswordNew = qobject_cast (mDocumentLoader->findWidget("setlabel_55")); + Q_ASSERT(mTitlePasswordNew); + + mTitlePasswordConfirm = qobject_cast (mDocumentLoader->findWidget("setlabel_56")); + Q_ASSERT(mTitlePasswordConfirm); + + mEditPasswordNew = qobject_cast (mDocumentLoader->findWidget("lineEditUsername")); + Q_ASSERT(mEditPasswordNew); + + mEditPasswordConfirm = qobject_cast (mDocumentLoader->findWidget("lineEditPassword")); + Q_ASSERT(mEditPasswordConfirm); + + mValidator.reset( + mWizard->eapConfigurationInterface()->validatorPacStore( + EapQtPacStoreConfig::PacStorePassword)); + Q_ASSERT(mValidator.data()); + + mTitlePasswordNew->setPlainText(hbTrId("txt_occ_setlabel_new_pac_store_password")); + mTitlePasswordConfirm->setPlainText(hbTrId("txt_occ_setlabel_confirm_password")); + + // Configure editors properties + mValidator->updateEditor(mEditPasswordNew); + mValidator->updateEditor(mEditPasswordConfirm); + + ok = connect( + mWizard->wizardHelper()->mainWindow(), + SIGNAL(orientationChanged(Qt::Orientation)), + this, + SLOT(loadDocmlSection(Qt::Orientation))); + Q_ASSERT(ok); + + ok = connect( + mEditPasswordNew, SIGNAL(textChanged(const QString &)), + this, SLOT(textChanged(const QString &))); + Q_ASSERT(ok); + + ok = connect( + mEditPasswordConfirm, SIGNAL(textChanged(const QString &)), + this, SLOT(textChanged(const QString &))); + Q_ASSERT(ok); + } + return mWidget; +} + +/*! + Loads the required orientation of docml. + + @param [in] orientation Orientation to be loaded. + */ +void EapWizardPageNewPacStore::loadDocmlSection(Qt::Orientation orientation) +{ + EapWizardPage::loadDocmlSection( + mDocumentLoader.data(), + orientation, + ":/docml/occ_eap_wizard_05_07.docml", + "portrait_section", + "landscape_section"); +} + +/*! + See WlanWizardPage. + + Validates the content of the page. + + @return true if content is valid. + */ +bool EapWizardPageNewPacStore::showPage() +{ + bool valid = false; + if (mValidator->validate(mEditPasswordNew->text()) == EapQtValidator::StatusOk && + mEditPasswordNew->text() == mEditPasswordConfirm->text()) { + valid = true; + } + return valid; +} + +/*! + See WlanWizardPage. + + @return next wizard page: EapWizardPage::PageUsernamePassword + */ +int EapWizardPageNewPacStore::nextId() const +{ + mWizard->setConfigurations(EapWizardPrivate::PacStorePassword, mEditPasswordNew->text()); + return EapWizardPage::PageUsernamePassword; +} + +/*! + Slot for textChanged() signal from HbLineEdit. + + @param [in] text NOT USED. + */ +void EapWizardPageNewPacStore::textChanged(const QString &text) +{ + Q_UNUSED(text); + mWizard->wizardHelper()->enableNextButton(showPage()); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/src/eapwizardpageoutertype.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/src/eapwizardpageoutertype.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,260 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard Page: Outer type selection + * + */ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "wlanwizardhelper.h" +#include "eapwizard_p.h" +#include "eapwizardpageoutertype.h" + +/*! + \class EapWizardPageOuterType + \brief Implements EAP wizard page: Outer EAP type selection + */ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +/*! + Constructor. + + @param [in] parent Pointer to EAP Wizard private implementation. + */ +EapWizardPageOuterType::EapWizardPageOuterType(EapWizardPrivate* parent) : + EapWizardPage(parent), + mWidget(NULL), + mRadio(NULL), + mTitle(NULL), + mDocumentLoader(NULL), + mValid(false) +{ +} + +/*! + Destructor. + */ +EapWizardPageOuterType::~EapWizardPageOuterType() +{ +} + +/*! + See WlanWizardPage. + */ +HbWidget* EapWizardPageOuterType::initializePage() +{ + if (!mWidget) { + bool ok; + mDocumentLoader.reset( + new HbDocumentLoader(mWizard->wizardHelper()->mainWindow())); + mDocumentLoader->load(":/docml/occ_eap_wizard_01_02_04.docml", &ok); + Q_ASSERT(ok); + + loadDocmlSection(mWizard->wizardHelper()->mainWindow()->orientation()); + + mWidget = qobject_cast (mDocumentLoader->findWidget("occ_eap_wizard_01")); + Q_ASSERT(mWidget); + + mRadio = qobject_cast (mDocumentLoader->findWidget("list")); + Q_ASSERT(mRadio); + + mTitle = qobject_cast (mDocumentLoader->findWidget("title")); + Q_ASSERT(mTitle); + + mTitle->setPlainText(hbTrId("txt_occ_title_select_eap_type")); + + QStringList items; + appendToList(items, EapQtPluginHandle::PluginPeap); + appendToList(items, EapQtPluginHandle::PluginEapTtls); + appendToList(items, EapQtPluginHandle::PluginEapTls); + appendToList(items, EapQtPluginHandle::PluginEapFast); + appendToList(items, EapQtPluginHandle::PluginLeap); + appendToList(items, EapQtPluginHandle::PluginEapAka); + appendToList(items, EapQtPluginHandle::PluginEapSim); + mRadio->setItems(items); + + ok = connect( + mRadio, SIGNAL(itemSelected(int)), + this, SLOT(itemSelected(int))); + Q_ASSERT(ok); + + ok = connect( + mWizard->wizardHelper()->mainWindow(), + SIGNAL(orientationChanged(Qt::Orientation)), + this, + SLOT(loadDocmlSection(Qt::Orientation))); + Q_ASSERT(ok); + } + return mWidget; +} + +/*! + Loads the required orientation of docml. + + @param [in] orientation Orientation to be loaded. + */ +void EapWizardPageOuterType::loadDocmlSection(Qt::Orientation orientation) +{ + EapWizardPage::loadDocmlSection( + mDocumentLoader.data(), + orientation, + ":/docml/occ_eap_wizard_01_02_04.docml", + "portrait_section", + "landscape_section"); +} + +/*! + See WlanWizardPage. + + @return next wizard page: + - WlanWizardPage::PageProcessSettings: For EAP-AKA and EAP-SIM + - EapWizardPage::PageCertificateCa: For PEAP, EAP-TLS and EAP-TTLS + - EapWizardPage::PageUsernamePassword: For LEAP and EAP-FAST (pac confirmed) + - EapWizardPage::PageNewPacStorePassword: For EAP-FAST (no pac store) + - EapWizardPage::PagePromptPacStorePassword: For EAP-FAST (confirm pac store) + */ +int EapWizardPageOuterType::nextId() const +{ + int id = WlanWizardPage::PageNone; + EapQtPluginHandle::Plugin handle = + static_cast(mEapTypes.at(mRadio->selected())); + switch (handle) { + case EapQtPluginHandle::PluginPeap: + case EapQtPluginHandle::PluginEapTtls: + case EapQtPluginHandle::PluginEapTls: + id = EapWizardPage::PageCertificateCa; + break; + + case EapQtPluginHandle::PluginEapFast: + id = nextIdForEapFast(); + break; + + case EapQtPluginHandle::PluginLeap: + id = EapWizardPage::PageUsernamePassword; + break; + + default: + Q_ASSERT(EapQtPluginHandle::PluginEapAka == handle || + EapQtPluginHandle::PluginEapSim == handle); + id = WlanWizardPage::PageProcessSettings; + break; + } + + mWizard->setConfigurations(EapWizardPrivate::OuterType, handle); + + return id; +} + +/*! + See WlanWizardPage. + + Validates the content of the page. + + @return true if content is valid. + */ +bool EapWizardPageOuterType::showPage() +{ + return mValid; +} + +/*! + Slot for itemSelected() signal from HbRadioButtonList. + + @param [in] index NOT USED. + */ +void EapWizardPageOuterType::itemSelected(int index) +{ + Q_UNUSED(index); + mValid = true; + mWizard->wizardHelper()->enableNextButton(mValid); +} + +/*! + Appends given method to radiobutton list if plugin (method) is supported + + @param [in,out] items the content of radiobutton list + @param [in] pluginHandle EAP Type plugin handle to be added. + */ +void EapWizardPageOuterType::appendToList( + QStringList &items, int pluginHandle) +{ + if (mWizard->eapConfigurationInterface()->isSupportedOuterType( + (EapQtPluginHandle::Plugin)pluginHandle)) { + items << mWizard->eapTypeToString(pluginHandle); + mEapTypes.append(pluginHandle); + } +} + +/* + Getter for next page id when outer eap type is EAP-FAST. + + @return Page ID. + */ +int EapWizardPageOuterType::nextIdForEapFast() const +{ + int pageId; + + mWizard->setConfigurations(EapWizardPrivate::InnerType, + EapQtPluginHandle::PluginEapMschapv2); + + EapQtPacStoreConfig pacStoreConf; + int pacStoreState = EapQtPacStoreConfig::PacStoreStateStoreNotExists; + + if (mWizard->eapConfigurationInterface()->readPacStoreConfiguration(pacStoreConf)) { + pacStoreState = pacStoreConf.value(EapQtPacStoreConfig::PacStoreState).toInt(); + } else { + pacStoreConf.clear(); + pacStoreConf.setValue(EapQtPacStoreConfig::PacStoreReset, true); + mWizard->eapConfigurationInterface()->savePacStoreConfiguration(pacStoreConf); + } + + mWizard->setConfigurations(EapWizardPrivate::PacStoreState, pacStoreState); + + switch (pacStoreState) { + case EapQtPacStoreConfig::PacStoreStateStoreNotExists: + pageId = EapWizardPage::PageNewPacStorePassword; + break; + + case EapQtPacStoreConfig::PacStoreStatePasswordRequired: + pageId = EapWizardPage::PagePromptPacStorePassword; + break; + + default: + Q_ASSERT(pacStoreState == EapQtPacStoreConfig::PacStoreStatePasswordStored); + pageId = EapWizardPage::PageUsernamePassword; + break; + } + + return pageId; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/src/eapwizardpagepacstorepasswordconfirm.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/src/eapwizardpagepacstorepasswordconfirm.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard Page: New PAC store password + * + */ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "wlanwizardhelper.h" +#include "eapwizardpagepacstorepasswordconfirm.h" +#include "eapwizard_p.h" + +/*! + \class EapWizardPagePacStorePasswordConfirm + \brief Implements EAP wizard page: Confirm PAC store password + */ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +/*! + Constructor. + + @param [in] parent Pointer to EAP Wizard private implementation. + */ +EapWizardPagePacStorePasswordConfirm::EapWizardPagePacStorePasswordConfirm( + EapWizardPrivate* parent) : + EapWizardPage(parent), + mDocumentLoader(NULL), + mValidator(NULL), + mWidget(NULL), + mEditPasswordConfirm(NULL), + mLabelError(NULL) +{ +} + +/*! + Destructor. + */ +EapWizardPagePacStorePasswordConfirm::~EapWizardPagePacStorePasswordConfirm() +{ +} + +/*! + See WlanWizardPage. + */ +HbWidget* EapWizardPagePacStorePasswordConfirm::initializePage() +{ + if (!mWidget) { + bool ok; + mDocumentLoader.reset( + new HbDocumentLoader(mWizard->wizardHelper()->mainWindow())); + mDocumentLoader->load(":/docml/occ_eap_wizard_08.docml", &ok); + Q_ASSERT(ok); + + loadDocmlSection(mWizard->wizardHelper()->mainWindow()->orientation()); + + mWidget = qobject_cast (mDocumentLoader->findWidget("view")); + Q_ASSERT(mWidget); + + mEditPasswordConfirm = qobject_cast (mDocumentLoader->findWidget( + "lineEditPasswordConfirm")); + Q_ASSERT(mEditPasswordConfirm); + + mLabelError = qobject_cast (mDocumentLoader->findWidget("labelError")); + Q_ASSERT(mLabelError); + + mValidator.reset( + mWizard->eapConfigurationInterface()->validatorPacStore( + EapQtPacStoreConfig::PacStorePasswordConfirmation)); + Q_ASSERT(mValidator.data()); + + mLabelError->setPlainText(""); + // Configurate editor properties and configurations + mValidator->updateEditor(mEditPasswordConfirm); + + mEditPasswordConfirm->installEventFilter(this); + + ok = connect( + mWizard->wizardHelper()->mainWindow(), + SIGNAL(orientationChanged(Qt::Orientation)), + this, + SLOT(loadDocmlSection(Qt::Orientation))); + Q_ASSERT(ok); + } + + return mWidget; +} + + +/*! + Loads the required orientation of docml. + + @param [in] orientation Orientation to be loaded. + */ +void EapWizardPagePacStorePasswordConfirm::loadDocmlSection(Qt::Orientation orientation) +{ + EapWizardPage::loadDocmlSection( + mDocumentLoader.data(), + orientation, + ":/docml/occ_eap_wizard_08.docml", + "portrait_section", + "landscape_section"); +} + +/*! + See WlanWizardPage. + + @return next wizard page: + - EapWizardPage::PageUsernamePassword: When password is ok + - WlanWizardPage::PageNone: When password is not ok + */ +int EapWizardPagePacStorePasswordConfirm::nextId() const +{ + int id; + if (mValidator->validate(mEditPasswordConfirm->text()) == + EapQtValidator::StatusOk) { + + mWizard->setConfigurations( + EapWizardPrivate::PacStorePassword, + mEditPasswordConfirm->text()); + + id = EapWizardPage::PageUsernamePassword; + } else { + id = WlanWizardPage::PageNone; + mLabelError->setPlainText(hbTrId("txt_occ_info_incorrect_password")); + } + + return id; +} + +/*! + See WlanWizardPage::showPage(). + + Sets the focus to line editor, opens virtual keyboard. + + @return true, content is valid always. + */ +bool EapWizardPagePacStorePasswordConfirm::showPage() +{ + mEditPasswordConfirm->setFocus(); + return true; +} + +/*! + Event filter for HbLineEdit. When editor gets focus a possible error text + is cleared. + + @param [in] obj Pointer to object to where the event is sent + @param [in] event Event + */ +bool EapWizardPagePacStorePasswordConfirm::eventFilter( + QObject *obj, QEvent *event) +{ + if (obj == mEditPasswordConfirm && event->type() == QEvent::FocusIn) { + mLabelError->setPlainText(""); + } + return false; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/src/eapwizardpageusernamepassword.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/src/eapwizardpageusernamepassword.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,210 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard Page: Common Username & password query. + * + */ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "wlanwizardhelper.h" +#include "eapwizardpageusernamepassword.h" +#include "eapwizard_p.h" + +/*! + \class EapWizardPageUsernamePassword + \brief Implements EAP wizard page: Generic Username & Password page + */ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +/*! + Constructor. + + @param [in] parent Pointer to EAP Wizard private implementation. + */ +EapWizardPageUsernamePassword::EapWizardPageUsernamePassword( + EapWizardPrivate* parent) : + EapWizardPage(parent), + mDocumentLoader(NULL), + mValidatorUsername(NULL), + mValidatorPassword(NULL), + mWidget(NULL), + mEditUsername(NULL), + mEditPassword(NULL), + mTitleUsername(NULL), + mTitlePassword(NULL) +{ +} + +/*! + Destructor. + */ +EapWizardPageUsernamePassword::~EapWizardPageUsernamePassword() +{ +} + +/*! + See WlanWizardPage. + */ +HbWidget* EapWizardPageUsernamePassword::initializePage() +{ + if (!mWidget) { + bool ok = true; + mDocumentLoader.reset( + new HbDocumentLoader(mWizard->wizardHelper()->mainWindow())); + mDocumentLoader->load(":/docml/occ_eap_wizard_05_07.docml", &ok); + Q_ASSERT(ok); + loadDocmlSection(mWizard->wizardHelper()->mainWindow()->orientation()); + + mWidget = qobject_cast (mDocumentLoader->findWidget("view")); + Q_ASSERT(mWidget); + + mTitleUsername = qobject_cast (mDocumentLoader->findWidget("setlabel_55")); + Q_ASSERT(mTitleUsername); + + mTitlePassword = qobject_cast (mDocumentLoader->findWidget("setlabel_56")); + Q_ASSERT(mTitlePassword); + + mEditUsername = qobject_cast (mDocumentLoader->findWidget("lineEditUsername")); + Q_ASSERT(mEditUsername); + + mEditPassword = qobject_cast (mDocumentLoader->findWidget("lineEditPassword")); + Q_ASSERT(mEditPassword); + + mTitlePassword->setPlainText(hbTrId("txt_occ_setlabel_eap_password")); + + ok = connect( + mWizard->wizardHelper()->mainWindow(), + SIGNAL(orientationChanged(Qt::Orientation)), + this, + SLOT(loadDocmlSection(Qt::Orientation))); + Q_ASSERT(ok); + + ok = connect( + mEditUsername, SIGNAL(textChanged(const QString &)), + this, SLOT(textChanged(const QString &))); + Q_ASSERT(ok); + + ok = connect( + mEditPassword, SIGNAL(textChanged(const QString &)), + this, SLOT(textChanged(const QString &))); + Q_ASSERT(ok); + } + + int eapType = mWizard->configurations(EapWizardPrivate::OuterType).toInt(); + + if (eapType != EapQtPluginHandle::PluginLeap) { + eapType = mWizard->configurations(EapWizardPrivate::InnerType).toInt(); + } + + EapQtPluginHandle plugin(static_cast(eapType)); + + mValidatorUsername.reset( + mWizard->eapConfigurationInterface()->validatorEap( + plugin.type(), + EapQtConfig::Username)); + Q_ASSERT(mValidatorUsername.data()); + mValidatorUsername->updateEditor(mEditUsername); + + mValidatorPassword.reset( + mWizard->eapConfigurationInterface()->validatorEap( + plugin.type(), + EapQtConfig::Password)); + Q_ASSERT(mValidatorPassword.data()); + mValidatorPassword->updateEditor(mEditPassword); + + mTitleUsername->setPlainText( + HbParameterLengthLimiter( + hbTrId("txt_occ_setlabel_user_name_for_1")).arg( + mWizard->eapTypeToString(eapType))); + + return mWidget; +} + +/*! + Loads the required orientation of docml. + + @param [in] orientation Orientation to be loaded. + */ +void EapWizardPageUsernamePassword::loadDocmlSection(Qt::Orientation orientation) +{ + EapWizardPage::loadDocmlSection( + mDocumentLoader.data(), + orientation, + ":/docml/occ_eap_wizard_05_07.docml", + "portrait_section", + "landscape_section"); +} + +/*! + See WlanWizardPage. + + Validates the content of the page. + + @return true if content is valid. + */ +bool EapWizardPageUsernamePassword::showPage() +{ + bool valid = false; + if (mValidatorUsername->validate(mEditUsername->text()) == + EapQtValidator::StatusOk && + mValidatorPassword->validate(mEditPassword->text()) == + EapQtValidator::StatusOk) { + valid = true; + } + return valid; +} + +/*! + See WlanWizardPage. + + @return next wizard page: EapWizardPage::PageProcessSettings + */ +int EapWizardPageUsernamePassword::nextId() const +{ + mWizard->setConfigurations(EapWizardPrivate::Username, mEditUsername->text()); + mWizard->setConfigurations(EapWizardPrivate::Password, mEditPassword->text()); + return EapWizardPage::PageProcessSettings; +} + +/*! + Slot for textChanged() signal from HbLineEdit. + + @param [in] text NOT USED. + */ +void EapWizardPageUsernamePassword::textChanged(const QString & text ) +{ + Q_UNUSED(text); + mWizard->wizardHelper()->enableNextButton(showPage()); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/traces/OstTraceDefinitions.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Trace definition file for wlanwizard + */ + +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +#include +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/eapwizard/traces/trace.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/traces/trace.properties Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,17 @@ + + + + OuterType + InnerType + CertificateCa + CertificateUser + TunnelUsernameAutomatic + TunnelUsername + TunnelRealmAutomatic + TunnelRealm + Username + Password + PacStorePassword + PacStoreState + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/testwizard/inc/FirstView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/testwizard/inc/FirstView.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Test Application for wizards + * + */ + +#ifndef FIRSTVIEW_H_ +#define FIRSTVIEW_H_ + +#include + +class HbComboBox; +class HbLineEdit; +class HbCheckBox; +class WlanWizard; +class HbLabel; + +/*! + * @addtogroup group_test_eap_wizard + * @{ + */ + +class FirstView : public HbView +{ +Q_OBJECT + +public: + FirstView(); + virtual ~FirstView(); + + +private slots: + void start(bool); + void finished(int iapId, bool connected); + void cancelled(); + +private: + void deleteWizard(); + +private: + WlanWizard *mWizard; + + HbCheckBox *mUseConf; + HbLineEdit *mSsid; + HbComboBox *mNetworkMode; + HbComboBox *mSecurityMode; + HbCheckBox *mHidden; + HbCheckBox *mUseWpaPsk; + HbCheckBox *mUseWps; + HbLabel *mStatus; + +}; + +/*! @} */ + +#endif /* FIRSTVIEW_H_ */ + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/testwizard/inc/MyAppEngine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/testwizard/inc/MyAppEngine.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Test Application for wizards + * + */ + +#ifndef MYAPPENGINE_H_ +#define MYAPPENGINE_H_ + +#include + +/*! + * @addtogroup group_test_eap_wizard + * @{ + */ + +class MyAppEngine : public QObject + { + Q_OBJECT + +public: + MyAppEngine(QObject *parent = 0); + virtual ~MyAppEngine(); + +signals: + void toFirstView(); + void toSecondView(); + + }; + +/*! @} */ + +#endif /* MYAPPENGINE_H_ */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/testwizard/inc/MyAppMainWindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/testwizard/inc/MyAppMainWindow.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Test Application for wizards + * + */ + +#ifndef MYAPPMAINWINDOW_H_ +#define MYAPPMAINWINDOW_H_ + +#include +#include + +// Forward declarations +class FirstView; + +class HbDocumentLoader; + +/*! + * @addtogroup group_test_eap_wizard + * @{ + */ +class MyAppMainWindow : public HbMainWindow + { + +public: + MyAppMainWindow(); + virtual ~MyAppMainWindow(); + +public slots: + void toFirstView(); + +private: + void addFirstView(); + +private: + FirstView *mFirstView; + + }; + +/*! @} */ + +#endif /* MYAPPMAINWINDOW_H_ */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/testwizard/inc/MyApplication.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/testwizard/inc/MyApplication.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Test Application for wizards + * + */ + +#ifndef MYAPPLICATION_H_ +#define MYAPPLICATION_H_ + +#include +#include + +// forward declarations +class MyAppEngine; +class MyAppMainWindow; + +/*! + * @addtogroup group_test_eap_wizard + * @{ + */ + +class MyApplication : public HbApplication + { +public: + MyApplication(int argc, char* argv[]); + virtual ~MyApplication(); + +private: + QSharedPointer engine; // owned + QSharedPointer mainWindow; // owned + }; + +/*! @} */ + +#endif /* MYAPPLICATION_H_ */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/testwizard/resources/mainview.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/testwizard/resources/mainview.docml Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/testwizard/resources/resource.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/testwizard/resources/resource.qrc Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,5 @@ + + + mainview.docml + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/testwizard/rom/testwizard.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/testwizard/rom/testwizard.iby Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Test wizard application for WLAN wizard +*/ + +#ifndef TESTWIZARD_IBY +#define TESTWIZARD_IBY + +#include + +#ifdef __PROTOCOL_WLAN + +file=ABI_DIR\BUILD_DIR\testwizard.exe SHARED_LIB_DIR\testwizard.exe +data=/epoc32/data/z/private/10003a3f/import/Apps/testwizard_reg.rsc /private/10003a3f/import/apps/testwizard_reg.rsc +data=/epoc32/data/z/resource/apps/testwizard.rsc /resource/apps/testwizard.rsc + +#endif // __PROTOCOL_WLAN + +#endif // TESTWIZARD_IBY + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/testwizard/src/FirstView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/testwizard/src/FirstView.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Test application for wizards. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "firstview.h" +#include "wlanwizard.h" + +FirstView::FirstView() : + mWizard(NULL) +{ + qDebug("FirstView::FirstView()"); + bool ok = false; + HbDocumentLoader loader; + loader.load(":/docml/mainview.docml", &ok); + Q_ASSERT_X(ok, "EAP Wizard EXE", "Invalid docml file"); + + QGraphicsWidget *widget = loader.findWidget("view"); + Q_ASSERT_X(widget != 0, "TestEapWizard", "View not found"); + + HbPushButton *action = qobject_cast (loader.findObject("startWizard")); + Q_ASSERT_X(action != 0, "TestEapWizard", "startWizard not found"); + connect(action, SIGNAL(clicked(bool)), this, SLOT(start(bool))); + + mUseConf = qobject_cast (loader.findWidget("useConf")); + Q_ASSERT_X(mUseConf != 0, "TestEapWizard", "useConf not found"); + + mSsid = qobject_cast (loader.findWidget("ssid")); + Q_ASSERT_X(mSsid != 0, "TestEapWizard", "ssid not found"); + + mNetworkMode = qobject_cast (loader.findWidget("networkMode")); + Q_ASSERT_X(mNetworkMode != 0, "TestEapWizard", "networkMode not found"); + + mSecurityMode = qobject_cast (loader.findWidget("securityMode")); + Q_ASSERT_X(mSecurityMode != 0, "TestEapWizard", "securityMode not found"); + + mHidden = qobject_cast (loader.findWidget("isHidden")); + Q_ASSERT_X(mHidden != 0, "TestEapWizard", "isHidden not found"); + + mUseWpaPsk = qobject_cast (loader.findWidget("useWpaPsk")); + Q_ASSERT_X(mUseWpaPsk != 0, "TestEapWizard", "useWpaPsk not found"); + + mUseWps = qobject_cast (loader.findWidget("useWps")); + Q_ASSERT_X(mUseConf != 0, "TestEapWizard", "useWps not found"); + + mStatus = qobject_cast (loader.findWidget("labelWizardStatus")); + Q_ASSERT_X(mStatus != 0, "TestEapWizard", "labelWizardStatus not found"); + + setWidget(widget); + qDebug("FirstView::FirstView() - done %d", action); +} + +FirstView::~FirstView() +{ + delete mWizard; +} + +void FirstView::start(bool) +{ + qDebug("FirstView::Start"); + if (!mWizard) { + mWizard = new WlanWizard(mainWindow()); + + connect(mWizard, SIGNAL(finished(int, bool)), this, SLOT(finished(int, bool))); + connect(mWizard, SIGNAL(cancelled()), this, SLOT(cancelled())); + } + + if (mUseConf->isChecked()) { + mWizard->setParameters( + mSsid->text(), + mNetworkMode->currentIndex(), + 1 << mSecurityMode->currentIndex(), + mUseWpaPsk->isChecked(), + mHidden->isChecked(), + mUseWps->isChecked()); + } + + mWizard->show(); +} + +void FirstView::deleteWizard() +{ + qDebug("FirstView::deleteWizard"); + + Q_ASSERT(mWizard); + mWizard->deleteLater(); + mWizard = NULL; + +} + +void FirstView::finished(int iapId, bool connected) +{ + qDebug("FirstView::complete(), iap id: %d, connected: %d", iapId, connected); + QString text; + text.setNum(iapId); + text.prepend("Finished, IAP ID: "); + mStatus->setPlainText(text); + deleteWizard(); +} + +void FirstView::cancelled() +{ + qDebug("FirstView::cancelled()"); + mStatus->setPlainText("Cancelled"); + deleteWizard(); +} + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/testwizard/src/MyAppEngine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/testwizard/src/MyAppEngine.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Test application for wizards. + * + */ + +#include "MyAppEngine.h" + +MyAppEngine::MyAppEngine(QObject *parent) + : QObject(parent) +{ + +} + +MyAppEngine::~MyAppEngine() +{ + +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/testwizard/src/MyAppMainWindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/testwizard/src/MyAppMainWindow.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Test application for wizards. + * + */ + +#include "myappmainwindow.h" +#include "myappengine.h" +#include "firstview.h" + +// ViewManager Constructor +MyAppMainWindow::MyAppMainWindow() +{ + + // Add the views to the main window + addFirstView(); + // show the main window (which will display the last view that was added) + toFirstView(); + show(); +} + +// Destructor +MyAppMainWindow::~MyAppMainWindow() +{ +} + +// Methods to add views to the main window +void MyAppMainWindow::addFirstView() +{ + mFirstView = new FirstView(); + addView(mFirstView); +} + + +// Slots to handle view change +void MyAppMainWindow::toFirstView() +{ + setCurrentView(mFirstView); +} + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/testwizard/src/MyApplication.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/testwizard/src/MyApplication.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Test application for wizards. + * + */ + +#include "myapplication.h" +#include "myappmainwindow.h" +#include "myappengine.h" + +MyApplication::MyApplication(int argc, char* argv[]) : + HbApplication(argc, argv), + engine(new MyAppEngine), + mainWindow(new MyAppMainWindow()) +{ +} + +MyApplication::~MyApplication() +{ +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/testwizard/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/testwizard/src/main.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Test application for wizards. + * + */ + +#include "myapplication.h" + +int main(int argc, char *argv[]) +{ + MyApplication app(argc, argv); + return app.exec(); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/testwizard/testwizard.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/testwizard/testwizard.pro Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,56 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# Test application for wizards +# + + +TEMPLATE = app +TARGET = testwizard +CONFIG += hb + +MOC_DIR = build +RCC_DIR = build + +DEPENDPATH += . +INCLUDEPATH += . \ + ../inc + +HEADERS = inc/MyApplication.h \ + inc/MyAppMainWindow.h \ + inc/FirstView.h \ + inc/MyAppEngine.h + +SOURCES += src/MyAppEngine.cpp \ + src/MyApplication.cpp \ + src/MyAppMainWindow.cpp \ + src/FirstView.cpp \ + src/main.cpp + +RESOURCES = resources/resource.qrc + +symbian { + # TODO: gain UID + TARGET.UID3 = 0xE5C15256 + TARGET.CAPABILITY = ALL -TCB +} + +LIBS += -lwlanwizard + +myDependencies.sources = wlanwizard.dll eapwizard.dll wpswizard.dll wlanqtutilities.dll +DEPLOYMENT += myDependencies + +BLD_INF_RULES.prj_exports += \ + "rom/testwizard.iby CORE_MW_LAYER_IBY_EXPORT_PATH(testwizard.iby)" + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanentryplugin/inc/cpwlanentryitemdata.h --- a/wlanutilities/wlanentryplugin/inc/cpwlanentryitemdata.h Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanentryplugin/inc/cpwlanentryitemdata.h Thu Jul 22 16:44:32 2010 +0100 @@ -2,7 +2,7 @@ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" +* under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * @@ -11,8 +11,8 @@ * * Contributors: * -* Description: -* +* Description: +* WLAN Entry plugin item data implementation. */ #ifndef CPWLANENTRYITEMDATA_H @@ -66,7 +66,7 @@ private: // data - WlanStatusInfo *mWlanStatusInfo; + WlanStatusInfo *mWlanStatusInfo; //!< WLAN status info handler // Friend classes diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanentryplugin/inc/wlanstatusinfo.h --- a/wlanutilities/wlanentryplugin/inc/wlanstatusinfo.h Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanentryplugin/inc/wlanstatusinfo.h Thu Jul 22 16:44:32 2010 +0100 @@ -1,19 +1,19 @@ /* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Status Info wrapper for WLAN entry plugin. +*/ #ifndef WLANSTATUSINFO_H #define WLANSTATUSINFO_H @@ -27,6 +27,7 @@ // Forward declarations class WlanQtUtils; +class XQSettingsManager; // External data types @@ -42,15 +43,15 @@ // Data types - /** + /*! * WLAN Status value. */ enum { - /** WLAN is configured OFF. */ + //! WLAN is configured OFF. WlanStatusOff = 0, - /** No WLAN connections. */ + //! No WLAN connections. WlanStatusIdle, - /** WLAN IAP is connected. */ + //! WLAN IAP is connected. WlanStatusConnected, }; @@ -58,9 +59,9 @@ ~WlanStatusInfo(); - int status(); + int status() const; - QString statusText(); + QString statusText() const; signals: @@ -79,18 +80,27 @@ Q_DISABLE_COPY(WlanStatusInfo) + bool isWlanOn() const; + private slots: void updateStatus(); private: // data - WlanQtUtils *mWlanQtUtils; // WlanQtUtils instance. - QString mStatusText; // WLAN status text. - int mStatus; // WLAN status value WlanStatus*. + //! WlanQtUtils instance. + WlanQtUtils *mWlanQtUtils; + + //! Settings manager for platform settings reading, writing & status changes. + XQSettingsManager *mSettingsManager; + + //! WLAN status text. + QString mStatusText; + + //! WLAN status value WlanStatus*. + int mStatus; // Friend classes - }; #endif // WLANSTATUSINFO_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanentryplugin/rom/wlanentryplugin.iby --- a/wlanutilities/wlanentryplugin/rom/wlanentryplugin.iby Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanentryplugin/rom/wlanentryplugin.iby Thu Jul 22 16:44:32 2010 +0100 @@ -11,8 +11,8 @@ * * Contributors: * -* Description: -* +* Description: +* WLAN Entry Plugin iby file. */ #ifndef WLANENTRYPLUGIN_IBY diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanentryplugin/rom/wlanentryplugin_resources.iby --- a/wlanutilities/wlanentryplugin/rom/wlanentryplugin_resources.iby Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanentryplugin/rom/wlanentryplugin_resources.iby Thu Jul 22 16:44:32 2010 +0100 @@ -1,19 +1,19 @@ /* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Entry Plugin resource iby file. +*/ #ifndef WLANENTRYPLUGIN_RESOURCES_IBY #define WLANENTRYPLUGIN_RESOURCES_IBY diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanentryplugin/src/cpwlanentryitemdata.cpp --- a/wlanutilities/wlanentryplugin/src/cpwlanentryitemdata.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanentryplugin/src/cpwlanentryitemdata.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -1,8 +1,8 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" +* under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * @@ -11,34 +11,40 @@ * * Contributors: * -* Description: -* +* Description: +* WLAN Entry plugin item data implementation. */ // System includes +#include +#include +#include + #ifdef WLANENTRYPLUGIN_SERVICETRACES #include #endif -#include +#include +#include -#include -#include +// This workaround can be removed when XQOP_WLAN_SNIFFER is correctly +// defined without the "void" parameter restriction: +#undef XQOP_WLAN_SNIFFER +#define XQOP_WLAN_SNIFFER QLatin1String("listView()") #include #include // User includes +#include "wlanstatusinfo.h" +#include "cpwlanentryitemdata.h" + #include "OstTraceDefinitions.h" #ifdef OST_TRACE_COMPILER_IN_USE #include "cpwlanentryitemdataTraces.h" #endif -#include "wlanstatusinfo.h" - -#include "cpwlanentryitemdata.h" - /*! \class CpWlanEntryItemData \brief Implementation of WLAN Status Plugin entry item data. @@ -55,13 +61,15 @@ /*! Constructor. + + @param[in,out] itemDataHelper Control Panel item data helper object. */ CpWlanEntryItemData::CpWlanEntryItemData(CpItemDataHelper &itemDataHelper) : CpSettingFormEntryItemData(itemDataHelper, hbTrId("txt_occ_dblist_wireless_lan")), mWlanStatusInfo(new WlanStatusInfo(this)) { - OstTraceFunctionEntry1(CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_ENTRY, this); + OstTraceFunctionEntry0(CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_ENTRY); // Listen for WLAN status updates bool connectStatus = connect( @@ -74,7 +82,7 @@ // Update to show initial WLAN status. statusUpdate(); - OstTraceFunctionExit1(CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_EXIT, this); + OstTraceFunctionExit0(CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_EXIT); } /*! @@ -83,8 +91,8 @@ CpWlanEntryItemData::~CpWlanEntryItemData() { - OstTraceFunctionEntry1(DUP1_CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_ENTRY, this); - OstTraceFunctionExit1(DUP1_CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_EXIT, this); + OstTraceFunctionEntry0(DUP1_CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_ENTRY); + OstTraceFunctionExit0(DUP1_CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_EXIT); } /*! @@ -93,7 +101,7 @@ CpBaseSettingView *CpWlanEntryItemData::createSettingView() const { - OstTraceFunctionEntry1(CPWLANENTRYITEMDATA_CREATESETTINGVIEW_ENTRY, this); + OstTraceFunctionEntry0(CPWLANENTRYITEMDATA_CREATESETTINGVIEW_ENTRY); #ifdef WLANENTRYPLUGIN_SERVICETRACES qInstallMsgHandler(XQSERVICEMESSAGEHANDLER); @@ -101,15 +109,33 @@ #endif // Execute synchronous WLAN Sniffer list view - XQServiceRequest* snd = new XQServiceRequest("com.nokia.services.wlansniffer.list","listView()",true); - bool status = snd->send(); + XQApplicationManager aiwMgr; + XQAiwRequest *request = aiwMgr.create( + "wlansniffer", + XQI_WLAN_SNIFFER, + XQOP_WLAN_SNIFFER, + true); + + // The WLAN Sniffer service must always exist + Q_ASSERT(request); + + // The service is synchronous & embedded + request->setSynchronous(true); + + // Window title needs to be set to "Control Panel" + XQRequestInfo reqInfo; + // TODO: Start using the official define when available + reqInfo.setInfo("WindowTitle", hbTrId("txt_cp_title_control_panel")); + request->setInfo(reqInfo); + + bool status = request->send(); #ifdef WLANENTRYPLUGIN_SERVICETRACES XQSERVICE_DEBUG_PRINT("CpWlanEntryItemData::createSettingView listView() service request completed"); #endif Q_ASSERT(status); - delete snd; + delete request; - OstTraceFunctionExit1(CPWLANENTRYITEMDATA_CREATESETTINGVIEW_EXIT, this); + OstTraceFunctionExit0(CPWLANENTRYITEMDATA_CREATESETTINGVIEW_EXIT); return 0; } @@ -119,31 +145,37 @@ */ void CpWlanEntryItemData::statusUpdate() { - OstTraceFunctionEntry1(CPWLANENTRYITEMDATA_STATUSUPDATE_ENTRY, this); + OstTraceFunctionEntry0(CPWLANENTRYITEMDATA_STATUSUPDATE_ENTRY); // Build icon with (possible) badge - HbIcon wlanIcon("qtg_large_wlan"); + HbIcon wlanIcon; switch (mWlanStatusInfo->status()) { + case WlanStatusInfo::WlanStatusIdle: + wlanIcon = HbIcon("qtg_large_wlan"); + break; + case WlanStatusInfo::WlanStatusOff: -#ifdef WLANSTATUSICONBADGING // TODO: Remove flagging when icon badging is supported - wlanIcon.addBadge( - Qt::AlignTop | Qt::AlignRight, - HbIcon("pri_small_super_off")); -#endif + wlanIcon = HbIcon("qtg_large_wlan_off"); break; case WlanStatusInfo::WlanStatusConnected: -#ifdef WLANSTATUSICONBADGING // TODO: Remove flagging when icon badging is supported + wlanIcon = HbIcon("qtg_large_wlan"); wlanIcon.addBadge( - Qt::AlignTop | Qt::AlignRight, - HbIcon("qtg_small_online")); + Qt::AlignBottom | Qt::AlignRight, + HbIcon("qtg_small_connection")); + break; + +#ifndef QT_NO_DEBUG + default: + // Unsupported status type detected + Q_ASSERT(0); + break; #endif - break; } // Set the updated WLAN status this->setEntryItemIcon(wlanIcon); this->setDescription(mWlanStatusInfo->statusText()); - OstTraceFunctionExit1(CPWLANENTRYITEMDATA_STATUSUPDATE_EXIT, this); + OstTraceFunctionExit0(CPWLANENTRYITEMDATA_STATUSUPDATE_EXIT); } diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanentryplugin/src/wlanstatusinfo.cpp --- a/wlanutilities/wlanentryplugin/src/wlanstatusinfo.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanentryplugin/src/wlanstatusinfo.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -12,16 +12,18 @@ * Contributors: * * Description: +* WLAN Status Info wrapper for WLAN entry plugin. */ // System includes #include +#include +#include // User includes #include "wlanqtutils.h" -#include "wlanqtutilswlaniap.h" #include "wlanstatusinfo.h" @@ -33,14 +35,25 @@ /*! \class WlanStatusInfo \brief Class for maintaining and updating the WLAN status for the WLAN - Status Control Panel Plugin. - + Status Control Panel Plugin. */ // External function prototypes // Local constants +//! Master WLAN ON/OFF setting key +static const XQSettingsKey masterWlanKey( + XQSettingsKey::TargetCentralRepository, + KCRUidWlanDeviceSettingsRegistryId.iUid, + KWlanOnOff); + +//! WLAN forced OFF setting key +static const XQSettingsKey wlanForceKey( + XQSettingsKey::TargetCentralRepository, + KCRUidWlanDeviceSettingsRegistryId.iUid, + KWlanForceDisable); + // ======== LOCAL FUNCTIONS ======== // ======== MEMBER FUNCTIONS ======== @@ -52,18 +65,21 @@ WlanStatusInfo::WlanStatusInfo(QObject *parent) : QObject(parent), mWlanQtUtils(new WlanQtUtils()), + mSettingsManager(new XQSettingsManager(this)), mStatusText(""), mStatus(WlanStatusOff) { - OstTraceFunctionEntry1(WLANSTATUSINFO_WLANSTATUSINFO_ENTRY, this); + OstTraceFunctionEntry0(WLANSTATUSINFO_WLANSTATUSINFO_ENTRY); // Listen for WLAN ON/OFF switching bool connectStatus = connect( - mWlanQtUtils, - SIGNAL(masterWlanStatus(bool)), - this, + mSettingsManager, + SIGNAL(valueChanged(XQSettingsKey, QVariant)), + this, SLOT(updateStatus())); - Q_ASSERT(connectStatus == true); + Q_ASSERT(connectStatus); + mSettingsManager->startMonitoring(masterWlanKey); + mSettingsManager->startMonitoring(wlanForceKey); // Listen for WLAN connection statuses connectStatus = connect( @@ -74,7 +90,7 @@ Q_ASSERT(connectStatus == true); connectStatus = connect( mWlanQtUtils, - SIGNAL(wlanNetworkClosed(int)), + SIGNAL(wlanNetworkClosed(int, int)), this, SLOT(updateStatus())); Q_ASSERT(connectStatus == true); @@ -82,7 +98,7 @@ // Set initial status updateStatus(); - OstTraceFunctionExit1(WLANSTATUSINFO_WLANSTATUSINFO_EXIT, this); + OstTraceFunctionExit0(WLANSTATUSINFO_WLANSTATUSINFO_EXIT); } /*! @@ -91,21 +107,21 @@ WlanStatusInfo::~WlanStatusInfo() { - OstTraceFunctionEntry1(DUP1_WLANSTATUSINFO_WLANSTATUSINFO_ENTRY, this); + OstTraceFunctionEntry0(DUP1_WLANSTATUSINFO_WLANSTATUSINFO_ENTRY); delete mWlanQtUtils; - OstTraceFunctionExit1(DUP1_WLANSTATUSINFO_WLANSTATUSINFO_EXIT, this); + OstTraceFunctionExit0(DUP1_WLANSTATUSINFO_WLANSTATUSINFO_EXIT); } /*! Function for getting current WLAN status value (WlanStatusInfo::WlanStatus*). */ -int WlanStatusInfo::status() +int WlanStatusInfo::status() const { - OstTraceFunctionEntry1(WLANSTATUSINFO_STATUS_ENTRY, this); - OstTraceFunctionExit1(WLANSTATUSINFO_STATUS_EXIT, this); + OstTraceFunctionEntry0(WLANSTATUSINFO_STATUS_ENTRY); + OstTraceFunctionExit0(WLANSTATUSINFO_STATUS_EXIT); return mStatus; } @@ -113,34 +129,58 @@ Returns the current WLAN status text. */ -QString WlanStatusInfo::statusText() +QString WlanStatusInfo::statusText() const { - OstTraceFunctionEntry1(WLANSTATUSINFO_STATUSTEXT_ENTRY, this); - OstTraceFunctionExit1(WLANSTATUSINFO_STATUSTEXT_EXIT, this); + OstTraceFunctionEntry0(WLANSTATUSINFO_STATUSTEXT_ENTRY); + OstTraceFunctionExit0(WLANSTATUSINFO_STATUSTEXT_EXIT); return mStatusText; } /*! + Function for checking if WLAN is ON. + WLAN is enabled if the WLAN OnOff key is true and the force disable + wlan key is false. + + @return Returns true if WLAN is ON. +*/ + +bool WlanStatusInfo::isWlanOn() const +{ + OstTraceFunctionEntry0(WLANSTATUSINFO_ISWLANON_ENTRY); + + bool wlanOn = mSettingsManager->readItemValue(masterWlanKey).toBool(); + bool forcedOff = mSettingsManager->readItemValue(wlanForceKey).toBool(); + + OstTraceExt2( + TRACE_NORMAL, + WLANSTATUSINFO_ISWLANON, + "WlanStatusInfo::isWlanOn;wlanOn=%hhu;forcedOff=%hhu", + wlanOn, + forcedOff); + + OstTraceFunctionExit0(WLANSTATUSINFO_ISWLANON_EXIT); + return wlanOn && !forcedOff; +} + +/*! Slot used for updating the WLAN status. */ void WlanStatusInfo::updateStatus() { - OstTraceFunctionEntry1(WLANSTATUSINFO_UPDATESTATUS_ENTRY, this); + OstTraceFunctionEntry0(WLANSTATUSINFO_UPDATESTATUS_ENTRY); // Backup old status to detect changes QString oldStatusText = mStatusText; - int connectedIapId = mWlanQtUtils->connectedWlanId(); - + // Figure out current WLAN status - if (mWlanQtUtils->masterWlan() == false) { + if (!isWlanOn()) { // WLAN is switched OFF. mStatus = WlanStatusOff; mStatusText = hbTrId("txt_occ_dblist_wireless_lan_val_off"); - } else if (connectedIapId != WlanQtUtilsInvalidIapId) { + } else if (mWlanQtUtils->connectionStatus() == WlanQtUtils::ConnStatusConnected) { mStatus = WlanStatusConnected; - mStatusText = hbTrId("txt_occ_dblist_wireless_lan_val_connected_to_1") - .arg(mWlanQtUtils->iap(connectedIapId)->name()); + mStatusText = mWlanQtUtils->iapName(mWlanQtUtils->activeIap()); } else { mStatus = WlanStatusIdle; mStatusText = hbTrId("txt_occ_dblist_wireless_lan_val_wlan_is_on"); @@ -151,5 +191,5 @@ emit statusUpdated(); } - OstTraceFunctionExit1(WLANSTATUSINFO_UPDATESTATUS_EXIT, this); + OstTraceFunctionExit0(WLANSTATUSINFO_UPDATESTATUS_EXIT); } diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanentryplugin/traces/OstTraceDefinitions.h --- a/wlanutilities/wlanentryplugin/traces/OstTraceDefinitions.h Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanentryplugin/traces/OstTraceDefinitions.h Thu Jul 22 16:44:32 2010 +0100 @@ -1,18 +1,19 @@ /* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* OST trace definition header. +*/ #ifndef __OSTTRACEDEFINITIONS_H__ #define __OSTTRACEDEFINITIONS_H__ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanentryplugin/wlanentryplugin.pro --- a/wlanutilities/wlanentryplugin/wlanentryplugin.pro Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanentryplugin/wlanentryplugin.pro Thu Jul 22 16:44:32 2010 +0100 @@ -12,6 +12,7 @@ # Contributors: # # Description: +# WLAN Entry Plugin Qt project file. # TEMPLATE = lib @@ -22,10 +23,17 @@ # wlanutilities Private API INCLUDEPATH += ../inc CONFIG += hb plugin -MOC_DIR = moc -OBJECTS_DIR = obj -RCC_DIR = rcc -LIBS += -lwlanqtutilities -lcpframework -lxqservice -lqtsysteminfo +LIBS += -lwlanqtutilities -lcpframework -lxqservice -lxqserviceutil -lqtsysteminfo -lxqsettingsmanager + +# Temporary solution to fix tracecompiler +# When tracecompiler is fixed, this can be removed +symbian: { + MMP_RULES += "USERINCLUDE traces" +} + +#Store generated files to their own directory +MOC_DIR = build +RCC_DIR = build # Sources HEADERS += \ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanindicatorplugin/inc/wlanindicatorplugin.h --- a/wlanutilities/wlanindicatorplugin/inc/wlanindicatorplugin.h Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanindicatorplugin/inc/wlanindicatorplugin.h Thu Jul 22 16:44:32 2010 +0100 @@ -51,9 +51,6 @@ bool handleClientRequest (RequestType type, const QVariant ¶meter); bool handleInteraction (InteractionType type); QVariant indicatorData(int role) const; - -private slots: - void processError(QProcess::ProcessError err); // handler for error codes private: diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanindicatorplugin/src/wlanindicatorplugin.cpp --- a/wlanutilities/wlanindicatorplugin/src/wlanindicatorplugin.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanindicatorplugin/src/wlanindicatorplugin.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -15,7 +15,7 @@ * */ -#include +#include #include #include #include @@ -96,11 +96,7 @@ Q_UNUSED(indicatorType) // Install localization - QTranslator *translator = new QTranslator(this); - QString lang = QLocale::system().name(); - QString path = "Z:/resource/qt/translations/"; - translator->load("wlanindicatorplugin_" + lang, path); - qApp->installTranslator(translator); + HbTranslator *translator(new HbTranslator("wlanindicatorplugin")); OstTraceFunctionExit1(WLANINDICATORPLUGIN_CREATEINDICATOR_EXIT, this); return this; @@ -125,14 +121,11 @@ OstTraceFunctionEntry1(WLANINDICATORPLUGIN_HANDLEINTERACTION_ENTRY, this); bool handled = false; + QVariantMap data; switch (type) { case InteractionActivated: - //connect error() to slot processError() to get error, - QObject::connect( &process, SIGNAL(error(QProcess::ProcessError)), - this, SLOT(processError(QProcess::ProcessError))); - - // Show WLAN list view - process.start("WlanSniffer"); + // Emit a signal that will inform the client to start the wlan list view + emit userActivated(data); handled = true; break; default: @@ -197,9 +190,7 @@ } else if (indicatorText[0] == wlanConnected){ - QString iapName = indicatorText[1].toString(); - QString str = QString(hbTrId("txt_occ_dblist_wireless_lan_val_1_connected")); - qvariant = str.arg(iapName); + qvariant = indicatorText[1].toString(); } } else @@ -214,14 +205,14 @@ if (mParameter.isValid() && mParameter.type() == QVariant::List) { indicatorText = mParameter.toList(); if ((indicatorText.size() > 0) && (indicatorText[0] == wlanConnected)) { - qvariant = HbIcon("qtg_status_wlan"); + qvariant = QString("qtg_status_wlan"); } } break; // this is the icon in the indicator case DecorationNameRole: OstTraceFunctionExit1(DUP2_WLANINDICATORPLUGIN_INDICATORDATA_EXIT, this); - qvariant = HbIcon("qtg_small_wlan"); + qvariant = QString("qtg_small_wlan"); break; default: OstTraceFunctionExit1(DUP3_WLANINDICATORPLUGIN_INDICATORDATA_EXIT, this); @@ -230,25 +221,3 @@ return qvariant; } -/*! - The processError is a handler for error codes. -*/ -void WlanIndicatorPlugin::processError(QProcess::ProcessError err) - { - OstTraceFunctionEntry1(WLANINDICATORPLUGIN_PROCESSERROR_ENTRY, this); - - switch (err) { - case QProcess::FailedToStart: - case QProcess::Crashed: - case QProcess::Timedout: - case QProcess::ReadError: - case QProcess::WriteError: - case QProcess::UnknownError: - OstTrace1( WLANINDICATORPLUGIN_ERR,PROCESSERROR_KNOWN,"Process Error %u", err); - break; - default: - OstTrace1( WLANINDICATORPLUGIN_ERR,PROCESSERROR_UNKNOWN,"Unknown Process Error %u", err); - break; - } - OstTraceFunctionExit1(WLANINDICATORPLUGIN_PROCESSERROR_EXIT, this); - } diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/ictsqtwrapper/bwins/ictsqtwrapperu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/ictsqtwrapper/bwins/ictsqtwrapperu.def Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,20 @@ +EXPORTS + ?trUtf8@IctsWrapper@@SA?AVQString@@PBD0H@Z @ 1 NONAME ; class QString IctsWrapper::trUtf8(char const *, char const *, int) + ?isPolling@IctsWrapper@@QBE_NXZ @ 2 NONAME ; bool IctsWrapper::isPolling(void) const + ??_EIctsWrapper@@UAE@I@Z @ 3 NONAME ; IctsWrapper::~IctsWrapper(unsigned int) + ?emitConnectivityTestResult@IctsWrapper@@QAEXW4ConnectivityTestResult@1@VQUrl@@@Z @ 4 NONAME ; void IctsWrapper::emitConnectivityTestResult(enum IctsWrapper::ConnectivityTestResult, class QUrl) + ?stopPolling@IctsWrapper@@QAEXXZ @ 5 NONAME ; void IctsWrapper::stopPolling(void) + ?connectivityTestResult@IctsWrapper@@IAEXW4ConnectivityTestResult@1@VQUrl@@@Z @ 6 NONAME ; void IctsWrapper::connectivityTestResult(enum IctsWrapper::ConnectivityTestResult, class QUrl) + ?tr@IctsWrapper@@SA?AVQString@@PBD0@Z @ 7 NONAME ; class QString IctsWrapper::tr(char const *, char const *) + ?trUtf8@IctsWrapper@@SA?AVQString@@PBD0@Z @ 8 NONAME ; class QString IctsWrapper::trUtf8(char const *, char const *) + ??0IctsWrapper@@QAE@HHPAVQObject@@@Z @ 9 NONAME ; IctsWrapper::IctsWrapper(int, int, class QObject *) + ?getStaticMetaObject@IctsWrapper@@SAABUQMetaObject@@XZ @ 10 NONAME ; struct QMetaObject const & IctsWrapper::getStaticMetaObject(void) + ?startPolling@IctsWrapper@@QAEXHH@Z @ 11 NONAME ; void IctsWrapper::startPolling(int, int) + ??1IctsWrapper@@UAE@XZ @ 12 NONAME ; IctsWrapper::~IctsWrapper(void) + ?metaObject@IctsWrapper@@UBEPBUQMetaObject@@XZ @ 13 NONAME ; struct QMetaObject const * IctsWrapper::metaObject(void) const + ?qt_metacall@IctsWrapper@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 14 NONAME ; int IctsWrapper::qt_metacall(enum QMetaObject::Call, int, void * *) + ?qt_metacast@IctsWrapper@@UAEPAXPBD@Z @ 15 NONAME ; void * IctsWrapper::qt_metacast(char const *) + ?staticMetaObject@IctsWrapper@@2UQMetaObject@@B @ 16 NONAME ; struct QMetaObject const IctsWrapper::staticMetaObject + ?tr@IctsWrapper@@SA?AVQString@@PBD0H@Z @ 17 NONAME ; class QString IctsWrapper::tr(char const *, char const *, int) + ?startConnectivityTest@IctsWrapper@@QAEXXZ @ 18 NONAME ; void IctsWrapper::startConnectivityTest(void) + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/ictsqtwrapper/eabi/ictsqtwrapperu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/ictsqtwrapper/eabi/ictsqtwrapperu.def Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,20 @@ +EXPORTS + _ZN11IctsWrapper11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME + _ZN11IctsWrapper11qt_metacastEPKc @ 2 NONAME + _ZN11IctsWrapper11stopPollingEv @ 3 NONAME + _ZN11IctsWrapper12startPollingEii @ 4 NONAME + _ZN11IctsWrapper16staticMetaObjectE @ 5 NONAME DATA 16 + _ZN11IctsWrapper19getStaticMetaObjectEv @ 6 NONAME + _ZN11IctsWrapper21startConnectivityTestEv @ 7 NONAME + _ZN11IctsWrapper22connectivityTestResultENS_22ConnectivityTestResultE4QUrl @ 8 NONAME + _ZN11IctsWrapper26emitConnectivityTestResultENS_22ConnectivityTestResultE4QUrl @ 9 NONAME + _ZN11IctsWrapperC1EiiP7QObject @ 10 NONAME + _ZN11IctsWrapperC2EiiP7QObject @ 11 NONAME + _ZN11IctsWrapperD0Ev @ 12 NONAME + _ZN11IctsWrapperD1Ev @ 13 NONAME + _ZN11IctsWrapperD2Ev @ 14 NONAME + _ZNK11IctsWrapper10metaObjectEv @ 15 NONAME + _ZNK11IctsWrapper9isPollingEv @ 16 NONAME + _ZTI11IctsWrapper @ 17 NONAME + _ZTV11IctsWrapper @ 18 NONAME + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/ictsqtwrapper/ictsqtwrapper.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/ictsqtwrapper/ictsqtwrapper.pro Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,48 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Project file for ictsqtwrapper.dll +# + +TEMPLATE = lib +TARGET = ictsqtwrapper +TARGET.CAPABILITY = CAP_GENERAL_DLL + +#BUILD_DLL macro is used to define export macro +DEFINES += BUILD_ICTSQTWRAPPER_DLL +DEPENDPATH += . + +#Store generated .moc files to their own directory +MOC_DIR = build + +INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \ + inc \ + traces + +HEADERS += inc/ictsqtwrapper.h \ + traces/OstTraceDefinitions.h + +SOURCES += src/ictsqtwrapper.cpp + +defFilePath = . + +symbian: { + LIBS += -lictsclientinterface + HEADERS += inc/ictsqtwrapper_symbian.h + SOURCES += src/ictsqtwrapper_symbian.cpp + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.UID3 = 0x2002E6F7 + MMP_RULES += "USERINCLUDE traces" + BLD_INF_RULES.prj_exports += "rom/ictsqtwrapper.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ictsqtwrapper.iby)" + BLD_INF_RULES.prj_exports += "inc/ictsqtwrapper.h |../../inc/ictsqtwrapper.h" +} \ No newline at end of file diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/ictsqtwrapper/inc/ictsqtwrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/ictsqtwrapper/inc/ictsqtwrapper.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for IctsWrapper class +* +*/ + +#ifndef ICTSQTWRAPPER_H +#define ICTSQTWRAPPER_H + +// System includes +#include +#include + +// User includes + +// Forward declarations +class IctsWrapperPrivate; + +// External data types +// Constants + +// Library's export macro definitions +#ifdef BUILD_ICTSQTWRAPPER_DLL +#define ICTSQTWRAPPERDLL_EXPORT Q_DECL_EXPORT +#else +#define ICTSQTWRAPPERDLL_EXPORT Q_DECL_IMPORT +#endif + +// Class declaration +class ICTSQTWRAPPERDLL_EXPORT IctsWrapper: public QObject +{ + Q_OBJECT + +public: + + /*! + Internet connectivity test result type + */ + enum ConnectivityTestResult { + ConnectionOk, //!< Test passed + HttpAuthenticationNeeded, //!< HTTP authentication needed i.e. hotspot AP + ConnectionNotOk, //!< Connection failure + Timeout, //!< Timeout for HTTP request + UnspecifiedError //!< Unspecified error + }; + + IctsWrapper(int iap, int netId, QObject *parent = 0); + + ~IctsWrapper(); + + void startConnectivityTest(); + + void startPolling(int pollingTime, int pollingInterval); + + void stopPolling(); + + void emitConnectivityTestResult(IctsWrapper::ConnectivityTestResult result, QUrl redirectUrl); + + bool isPolling() const; + +signals: + + void connectivityTestResult(IctsWrapper::ConnectivityTestResult, QUrl result); + +private: + + bool mIsPolling; //!< variable to store whether ICTS polling is ongoing + + QScopedPointer d_ptr; //!< Pointer to Symbian private implementation +}; + +#endif // ICTSQTWRAPPER_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/ictsqtwrapper/inc/ictsqtwrapper_symbian.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/ictsqtwrapper/inc/ictsqtwrapper_symbian.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Private symbian implementation of ICTS client interface wrapper +* +*/ + +#ifndef ICTSQTWRAPPERSYMBIAN_H +#define ICTSQTWRAPPERSYMBIAN_H + +// System includes +#include + +// User includes + +// Forward declarations + +// External data types + +// Constants + +// Class declaration +class IctsWrapperPrivate: public MIctsObserver +{ + +public: + + IctsWrapperPrivate(int aIapId, int aNetId, IctsWrapper *aWrapper); + + ~IctsWrapperPrivate(); + + void ConnectivityObserver( TIctsTestResult aResult, const TDesC& aString ); + + void startConnectivityTest(); + + void startPolling(int pollingTime, int pollingInterval); + + void stopPolling(); + +private: + + IctsWrapper *q_ptr; //!< Pointer to public implementation + + CIctsClientInterface* iIct; //!< Pointer to ICTS client interface +}; + +#endif // ICTSQTWRAPPERSYMBIAN_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/ictsqtwrapper/rom/ictsqtwrapper.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/ictsqtwrapper/rom/ictsqtwrapper.iby Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef ICTSQTWRAPPER_IBY +#define ICTSQTWRAPPER_IBY + +#include + +#ifdef __PROTOCOL_WLAN +file=ABI_DIR/BUILD_DIR/ictsqtwrapper.dll SHARED_LIB_DIR/ictsqtwrapper.dll +#endif // __PROTOCOL_WLAN + +#endif //ICTSQTWRAPPER_IBY diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/ictsqtwrapper/src/ictsqtwrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/ictsqtwrapper/src/ictsqtwrapper.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of IctsWrapper class +* +*/ + +// System includes + +// User includes + +#include "ictsqtwrapper.h" +#include "ictsqtwrapper_symbian.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "ictsqtwrapperTraces.h" +#endif + +/*! + \class IctsWrapper + \brief This is a wrapper implementation for symbian side ICTS client interface +*/ + +// External function prototypes + +// Local constants + + +// ======== LOCAL FUNCTIONS ======== + + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor + + */ +IctsWrapper::IctsWrapper(int iap, int netId, QObject *parent) : + QObject(parent), + mIsPolling(false), + d_ptr(new IctsWrapperPrivate(iap, netId, this)) +{ + OstTraceFunctionEntry0( ICTSWRAPPER_ICTSWRAPPER_ENTRY ); + + OstTraceFunctionExit0( ICTSWRAPPER_ICTSWRAPPER_EXIT ); +} + +/*! + Destructor + + */ +IctsWrapper::~IctsWrapper() +{ + OstTraceFunctionEntry0( ICTSWRAPPER_DESTRUCTOR_ENTRY ); + + OstTraceFunctionExit0( ICTSWRAPPER_DESTRUCTOR_EXIT ); +} + +/*! + This function emits connectivityTestResult signal + @param [in] result result of internet connectivity test + @param [in] redirectUrl Possible redirection URL that was received + */ +void IctsWrapper::emitConnectivityTestResult(IctsWrapper::ConnectivityTestResult result, QUrl redirectUrl) +{ + OstTraceFunctionEntry0( ICTSWRAPPER_EMITCONNECTIVITYTESTRESULT_ENTRY ); + + OstTrace1( TRACE_NORMAL, ICTSWRAPPER_EMITCONNECTIVITYTESTRESULT_RESULT_TRACE, "IctsWrapper::emitConnectivityTestResult;result=%d", result ); + +#ifdef OST_TRACE_COMPILER_IN_USE + QString url = redirectUrl.toString(); + TPtrC tmp(url.utf16(),url.length() ); + + OstTraceExt1( TRACE_NORMAL, ICTSWRAPPER_EMITCONNECTIVITYTESTRESULT_URL_TRACE, + "IctsWrapper::emitConnectivityTestResult;redirectUrl=%S", tmp ); +#endif + + emit connectivityTestResult(result, redirectUrl); + mIsPolling = false; + + OstTraceFunctionExit0( ICTSWRAPPER_EMITCONNECTIVITYTESTRESULT_EXIT ); +} + +/*! + This function starts connectivity test + */ + +void IctsWrapper::startConnectivityTest() +{ + OstTraceFunctionEntry0( ICTSWRAPPER_STARTCONNECTIVITYTEST_ENTRY ); + + d_ptr->startConnectivityTest(); + + OstTraceFunctionExit0( ICTSWRAPPER_STARTCONNECTIVITYTEST_EXIT ); +} + +/*! + This function starts connectivity test in polling mode + + @param [in] pollingTime Total polling time + @param [in] pollingInterval Interval between polls + */ +void IctsWrapper::startPolling(int pollingTime, int pollingInterval) +{ + OstTraceFunctionEntry0( ICTSWRAPPER_STARTPOLLING_ENTRY ); + + d_ptr->startPolling(pollingTime, pollingInterval); + mIsPolling = true; + + OstTraceFunctionExit0( ICTSWRAPPER_STARTPOLLING_EXIT ); +} + +/*! + This function stops polling mode + */ +void IctsWrapper::stopPolling() +{ + OstTraceFunctionEntry0( ICTSWRAPPER_STOPPOLLING_ENTRY ); + + d_ptr->stopPolling(); + + OstTraceFunctionExit0( ICTSWRAPPER_STOPPOLLING_EXIT ); +} + +/*! + This function returns whether we are polling or not + */ +bool IctsWrapper::isPolling() const +{ + OstTraceFunctionEntry0( ICTSWRAPPER_ISPOLLING_ENTRY ); + + OstTraceFunctionExit0( ICTSWRAPPER_ISPOLLING_EXIT ); + + return mIsPolling; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/ictsqtwrapper/src/ictsqtwrapper_symbian.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/ictsqtwrapper/src/ictsqtwrapper_symbian.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,162 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Private Symbian implementation of ICTS client wrapper +* +*/ + +// System includes +#include +#include + + +// User includes +#include "ictsqtwrapper.h" +#include "ictsqtwrapper_symbian.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "ictsqtwrapper_symbianTraces.h" +#endif + +/*! + \class IctsWrapper + \brief This is a wrapper implementation for symbian side ICTS client interface +*/ + +// External function prototypes + +// Local constants + + +// ======== LOCAL FUNCTIONS ======== + + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor + + */ +IctsWrapperPrivate::IctsWrapperPrivate(int aIapId, int aNetId, IctsWrapper *aWrapper) : + q_ptr(aWrapper), + iIct(NULL) +{ + OstTraceFunctionEntry0(ICTSWRAPPERPRIVATE_ICTSWRAPPERPRIVATE_ENTRY); + + TRAPD(error,iIct = CIctsClientInterface::NewL(aIapId, aNetId, *this)); + qt_symbian_throwIfError(error); + + OstTraceFunctionExit0(ICTSWRAPPERPRIVATE_ICTSWRAPPERPRIVATE_EXIT); +} + +/*! + Destructor + + */ +IctsWrapperPrivate::~IctsWrapperPrivate() +{ + OstTraceFunctionEntry0(ICTSWRAPPERPRIVATE_DESTRUCTOR_ENTRY); + + delete iIct; + + OstTraceFunctionExit0(ICTSWRAPPERPRIVATE_DESTRUCTOR_EXIT); +} + +/*! + This function is called when connectivity test is ready. This is from MICTSObserver. + + @param [in] aResult result of internet connectivity test + @param [in] aString Possible redirection URL that was received. + Valid only when result is EHttpAuthenticationNeeded + */ + +void IctsWrapperPrivate::ConnectivityObserver(TIctsTestResult aResult, const TDesC& aString) +{ + OstTraceFunctionEntry0(ICTSWRAPPERPRIVATE_CONNECTIVITYOBSERVER_ENTRY); + + QUrl redirectUrl; + + switch (aResult) + { + case EConnectionOk: + q_ptr->emitConnectivityTestResult(IctsWrapper::ConnectionOk, QUrl("")); + break; + + case EHttpAuthenticationNeeded : + //Convert descriptor to QString + redirectUrl = QString::fromUtf16(aString.Ptr(), aString.Length()); + q_ptr->emitConnectivityTestResult(IctsWrapper::HttpAuthenticationNeeded, redirectUrl); + break; + + case EConnectionNotOk : + q_ptr->emitConnectivityTestResult(IctsWrapper::ConnectionNotOk, QUrl("")); + break; + + case ETimeout : + q_ptr->emitConnectivityTestResult(IctsWrapper::Timeout, QUrl("")); + break; + + default: + q_ptr->emitConnectivityTestResult(IctsWrapper::UnspecifiedError, QUrl("")); + break; + } + + OstTraceFunctionExit0(ICTSWRAPPERPRIVATE_CONNECTIVITYOBSERVER_EXIT); +} + +/*! + This non leaving function starts internet connectivity test + + */ +void IctsWrapperPrivate::startConnectivityTest() +{ + OstTraceFunctionEntry0(ICTSWRAPPERPRIVATE_STARTCONNECTIVITYTEST_ENTRY); + + TRAPD(err, iIct->StartL()); + + // Check if startConnectivityTestL() leaved. + if (KErrNone != err) + { + q_ptr->emitConnectivityTestResult(IctsWrapper::UnspecifiedError, QUrl("")); + } + + OstTraceFunctionExit0(ICTSWRAPPERPRIVATE_STARTCONNECTIVITYTEST_EXIT); +} + +/*! + This function starts connectivity test in polling mode + + @param [in] pollingTime Polling time in microseconds + @param [in] pollingInterval Polling interval in microseconds + */ +void IctsWrapperPrivate::startPolling(int pollingTime, int pollingInterval) +{ + OstTraceFunctionEntry0(ICTSWRAPPERPRIVATE_STARTPOLLING_ENTRY); + + iIct->StartPolling(pollingTime, pollingInterval); + + OstTraceFunctionExit0( ICTSWRAPPERPRIVATE_STARTPOLLING_EXIT ); +} + +/*! + This function stops connectivity test polling mode + */ +void IctsWrapperPrivate::stopPolling() +{ + OstTraceFunctionEntry0(ICTSWRAPPERPRIVATE_STOPPOLLING_ENTRY); + + iIct->StopPolling(); + + OstTraceFunctionExit0(ICTSWRAPPERPRIVATE_STOPPOLLING_EXIT); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/ictsqtwrapper/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/ictsqtwrapper/traces/OstTraceDefinitions.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for OST traces +* +*/ + +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +#include +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/ictswlanlogininterface/bwins/ictswlanlogininterfaceu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/ictswlanlogininterface/bwins/ictswlanlogininterfaceu.def Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,22 @@ +EXPORTS + ?stop@IctsWlanLoginInterface@@QAEXXZ @ 1 NONAME ; void IctsWlanLoginInterface::stop(void) + ?ictsResult@IctsWlanLoginInterface@@IAEXH@Z @ 2 NONAME ; void IctsWlanLoginInterface::ictsResult(int) + ?qt_metacall@IctsWlanLoginInterface@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 3 NONAME ; int IctsWlanLoginInterface::qt_metacall(enum QMetaObject::Call, int, void * *) + ?hotspotCase@IctsWlanLoginInterface@@IAEXXZ @ 4 NONAME ; void IctsWlanLoginInterface::hotspotCase(void) + ??1IctsWlanLoginInterface@@UAE@XZ @ 5 NONAME ; IctsWlanLoginInterface::~IctsWlanLoginInterface(void) + ?handleConnectivityTestResult@IctsWlanLoginInterface@@QAEXW4ConnectivityTestResult@IctsWrapper@@VQUrl@@@Z @ 6 NONAME ; void IctsWlanLoginInterface::handleConnectivityTestResult(enum IctsWrapper::ConnectivityTestResult, class QUrl) + ?trUtf8@IctsWlanLoginInterface@@SA?AVQString@@PBD0H@Z @ 7 NONAME ; class QString IctsWlanLoginInterface::trUtf8(char const *, char const *, int) + ??_EIctsWlanLoginInterface@@UAE@I@Z @ 8 NONAME ; IctsWlanLoginInterface::~IctsWlanLoginInterface(unsigned int) + ?handleOk@IctsWlanLoginInterface@@AAEXABVQVariant@@@Z @ 9 NONAME ; void IctsWlanLoginInterface::handleOk(class QVariant const &) + ?staticMetaObject@IctsWlanLoginInterface@@2UQMetaObject@@B @ 10 NONAME ; struct QMetaObject const IctsWlanLoginInterface::staticMetaObject + ??0IctsWlanLoginInterface@@QAE@PAVQObject@@@Z @ 11 NONAME ; IctsWlanLoginInterface::IctsWlanLoginInterface(class QObject *) + ?handleError@IctsWlanLoginInterface@@AAEXH@Z @ 12 NONAME ; void IctsWlanLoginInterface::handleError(int) + ?tr@IctsWlanLoginInterface@@SA?AVQString@@PBD0@Z @ 13 NONAME ; class QString IctsWlanLoginInterface::tr(char const *, char const *) + ?getStaticMetaObject@IctsWlanLoginInterface@@SAABUQMetaObject@@XZ @ 14 NONAME ; struct QMetaObject const & IctsWlanLoginInterface::getStaticMetaObject(void) + ?start@IctsWlanLoginInterface@@QAEXHH@Z @ 15 NONAME ; void IctsWlanLoginInterface::start(int, int) + ?metaObject@IctsWlanLoginInterface@@UBEPBUQMetaObject@@XZ @ 16 NONAME ; struct QMetaObject const * IctsWlanLoginInterface::metaObject(void) const + ?tr@IctsWlanLoginInterface@@SA?AVQString@@PBD0H@Z @ 17 NONAME ; class QString IctsWlanLoginInterface::tr(char const *, char const *, int) + ?qt_metacast@IctsWlanLoginInterface@@UAEPAXPBD@Z @ 18 NONAME ; void * IctsWlanLoginInterface::qt_metacast(char const *) + ?wlanLoginAppStart@IctsWlanLoginInterface@@AAEXHHVQUrl@@@Z @ 19 NONAME ; void IctsWlanLoginInterface::wlanLoginAppStart(int, int, class QUrl) + ?trUtf8@IctsWlanLoginInterface@@SA?AVQString@@PBD0@Z @ 20 NONAME ; class QString IctsWlanLoginInterface::trUtf8(char const *, char const *) + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/ictswlanlogininterface/eabi/ictswlanlogininterfaceu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/ictswlanlogininterface/eabi/ictswlanlogininterfaceu.def Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,22 @@ +EXPORTS + _ZN22IctsWlanLoginInterface10ictsResultEi @ 1 NONAME + _ZN22IctsWlanLoginInterface11handleErrorEi @ 2 NONAME + _ZN22IctsWlanLoginInterface11hotspotCaseEv @ 3 NONAME + _ZN22IctsWlanLoginInterface11qt_metacallEN11QMetaObject4CallEiPPv @ 4 NONAME + _ZN22IctsWlanLoginInterface11qt_metacastEPKc @ 5 NONAME + _ZN22IctsWlanLoginInterface16staticMetaObjectE @ 6 NONAME DATA 16 + _ZN22IctsWlanLoginInterface17wlanLoginAppStartEii4QUrl @ 7 NONAME + _ZN22IctsWlanLoginInterface19getStaticMetaObjectEv @ 8 NONAME + _ZN22IctsWlanLoginInterface28handleConnectivityTestResultEN11IctsWrapper22ConnectivityTestResultE4QUrl @ 9 NONAME + _ZN22IctsWlanLoginInterface4stopEv @ 10 NONAME + _ZN22IctsWlanLoginInterface5startEii @ 11 NONAME + _ZN22IctsWlanLoginInterface8handleOkERK8QVariant @ 12 NONAME + _ZN22IctsWlanLoginInterfaceC1EP7QObject @ 13 NONAME + _ZN22IctsWlanLoginInterfaceC2EP7QObject @ 14 NONAME + _ZN22IctsWlanLoginInterfaceD0Ev @ 15 NONAME + _ZN22IctsWlanLoginInterfaceD1Ev @ 16 NONAME + _ZN22IctsWlanLoginInterfaceD2Ev @ 17 NONAME + _ZNK22IctsWlanLoginInterface10metaObjectEv @ 18 NONAME + _ZTI22IctsWlanLoginInterface @ 19 NONAME + _ZTV22IctsWlanLoginInterface @ 20 NONAME + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/ictswlanlogininterface/ictswlanlogininterface.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/ictswlanlogininterface/ictswlanlogininterface.pro Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,54 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# Project file of the ictswlanlogininterface. +# + +TEMPLATE = lib +TARGET = ictswlanlogininterface + +# BUILD_DLL macro is used to define import/export macro +DEFINES += BUILD_ICTSWLANLOGININTERFACE_DLL +DEPENDPATH += . +CONFIG += hb +LIBS += -lxqservice -lictsqtwrapper -lxqserviceutil + +#Store generated files to their own directory +MOC_DIR = build + +INCLUDEPATH += \ + inc \ + traces\ + ../inc \ + ../../inc \ + ../wlanloginapp/inc + +HEADERS += \ + inc/ictswlanlogininterface.h \ + traces/OstTraceDefinitions.h + +SOURCES += \ + src/ictswlanlogininterface.cpp + +defFilePath = . + +symbian: { + TARGET.CAPABILITY = CAP_GENERAL_DLL + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.UID3 = 0x2002EA66 + MMP_RULES += "USERINCLUDE traces" + BLD_INF_RULES.prj_exports += "rom/ictswlanlogininterface.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ictswlanlogininterface.iby)" + BLD_INF_RULES.prj_exports += "inc/ictswlanlogininterface.h |../../inc/ictswlanlogininterface.h" + LIBS += -lictsclientinterface -lflogger +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/ictswlanlogininterface/inc/ictswlanlogininterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/ictswlanlogininterface/inc/ictswlanlogininterface.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Entry library for launching Wlan Login application. +*/ + +#ifndef ICTSWLANLOGININTERFACE_H +#define ICTSWLANLOGININTERFACE_H + +// System includes +#include +#include +#include + + +// User includes +#include "ictsqtwrapper.h" + +// Forward declarations + +// External data types + +// Constants + +// Library's export macro definitions +#ifdef BUILD_ICTSWLANLOGININTERFACE_DLL +#define ICTSWLANLOGININTERFACEDLL_EXPORT Q_DECL_EXPORT +#else +#define ICTSWLANLOGININTERFACEDLL_EXPORT Q_DECL_IMPORT +#endif + +// Class declaration +class ICTSWLANLOGININTERFACEDLL_EXPORT IctsWlanLoginInterface: public QObject +{ + Q_OBJECT + +public: + + // Data types + + /*! + Internet connectivity test result type + */ + enum ictsResultType { + IctsPassed = 0, //!< Internet connectivity test passed + IctsHotspotPassed, //!< Internet connectivity test passed against hotspot access point + IctsCanceled, //!< Internet connectivity test was cancelled due to user action + IctsFailed //!< internet connectivity test failed + }; + + IctsWlanLoginInterface(QObject *parent); + + ~IctsWlanLoginInterface(); + +public: + + void start(int iapId, int netId); + + void stop(); + +public slots: + + void handleConnectivityTestResult(IctsWrapper::ConnectivityTestResult result, QUrl redirectUrl); + +signals: + + /*! + Signal that informs about ICTS result. + + @param [in] ictsResult ICTS result (IctsWlanLoginInterface::ictsResultType). + */ + void ictsResult(int ictsResult); + + void hotspotCase(); + +private slots: + + void handleOk(const QVariant &result); + + void handleError(int errorCode); + +private: // functions + + void wlanLoginAppStart(int iapId, int netId, QUrl url); + +private: // data + + IctsWrapper* mIctsWrapper; //!< Icts wrapper instance + XQApplicationManager* mAiwMgr; //!< Application interworking manager + XQAiwRequest* mAsyncRequest; //!< Pointer to async AIW Request + int mIapId; //!< IAP identifier + int mNetId; //!< Network identifier + + // Friend classes +}; + +#endif // ICTSWLANLOGININTERFACE_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/ictswlanlogininterface/rom/ictswlanlogininterface.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/ictswlanlogininterface/rom/ictswlanlogininterface.iby Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* ictswlanlogininterface.dll IBY file for ROM image. +* +*/ + +#ifndef ICTSWLANLOGININTERFACE_IBY +#define ICTSWLANLOGININTERFACE_IBY + +#include + +#ifdef __PROTOCOL_WLAN +file=ABI_DIR/BUILD_DIR/ictswlanlogininterface.dll SHARED_LIB_DIR/ictswlanlogininterface.dll +#endif // __PROTOCOL_WLAN + +#endif //ICTSWLANLOGININTERFACE_IBY diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/ictswlanlogininterface/src/ictswlanlogininterface.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/ictswlanlogininterface/src/ictswlanlogininterface.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,328 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Entry library for launching Wlan Login application. +*/ + +// System includes + +#include +#include + +// User includes + +#include "ictswlanlogininterface.h" +#include "wlanloginservice.h" +#include "ictsqtwrapper.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "ictswlanlogininterfaceTraces.h" +#endif + +/*! + \class IctsWlanLoginInterface + \brief This class provides a Qt API for running Internet connectivity test + against WLAN accesspoint. If authentication is needed this component + launches WLAN Login application through Qt Highway to render + authentication Web page. +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. +*/ +IctsWlanLoginInterface::IctsWlanLoginInterface(QObject *parent) : + QObject(parent), + mIctsWrapper(NULL), + mAiwMgr(NULL), + mAsyncRequest(NULL), + mIapId(0), + mNetId(0) +{ + OstTraceFunctionEntry0(ICTSWLANLOGININTERFACE_CONSTRUCTOR_ENTRY); + + mAiwMgr = new XQApplicationManager(); + + OstTraceFunctionExit0(ICTSWLANLOGININTERFACE_CONSTRUCTOR_EXIT); +} + +/*! + Destructor. +*/ +IctsWlanLoginInterface::~IctsWlanLoginInterface() +{ + OstTraceFunctionEntry0(ICTSWLANLOGININTERFACE_DESTRUCTOR_ENTRY); + + if (mAsyncRequest){ + delete mAsyncRequest; + } + + OstTraceFunctionExit0(ICTSWLANLOGININTERFACE_DESTRUCTOR_EXIT); +} + +/*! + Function for launching Wlan login application. + + @param [in] iapId Internet accesspoint id to be tested + @param [in] netId network identifier of the connection to be used +*/ +void IctsWlanLoginInterface::start(int iapId, int netId) +{ + OstTraceFunctionEntry0(ICTSWLANLOGININTERFACE_START_ENTRY); + + // Create ICTS instance as we know needed parameters now + mIctsWrapper = new IctsWrapper(iapId, netId, this); + + // Store identifiers for later use + mIapId = iapId; + mNetId = netId; + + bool connectStatus = connect( + mIctsWrapper, + SIGNAL(connectivityTestResult(IctsWrapper::ConnectivityTestResult, QUrl)), + this, + SLOT(handleConnectivityTestResult(IctsWrapper::ConnectivityTestResult, QUrl))); + Q_ASSERT(connectStatus); + + mIctsWrapper->startConnectivityTest(); + + OstTraceFunctionExit0(ICTSWLANLOGININTERFACE_START_EXIT); +} + +/*! + Function for launching Wlan login application. + + @param [in] iapId Internet accesspoint id to be used + @param [in] netId network id of the connection to be used + @param [in] url Redirection URL to be loaded + +*/ +void IctsWlanLoginInterface::wlanLoginAppStart(int iapId, int netId, QUrl url) +{ + OstTraceFunctionEntry0(ICTSWLANLOGININTERFACE_WLANLOGINAPPSTART_ENTRY); + + // Execution of asynchronous and embedded Wlan Login start + mAsyncRequest = mAiwMgr->create( + "wlanlogin", + "com.nokia.symbian.IWlanLogin", + "start(int,int,QUrl)", + false); + + // The Wlan Login service must always exist + Q_ASSERT(mAsyncRequest); + + // Connect result handling signal + bool connectStatus = connect( + mAsyncRequest, + SIGNAL(requestOk(const QVariant&)), + this, + SLOT(handleOk(const QVariant&))); + Q_ASSERT(connectStatus == true); + + // Connect error handling signal or apply lastError function instead. + connectStatus = connect( + mAsyncRequest, + SIGNAL(requestError(int,const QString&)), + this, + SLOT(handleError(int))); // Error string is ignored. + Q_ASSERT(connectStatus == true); + + // Set function parameters + QList args; + args << iapId; + args << netId; + args << url; + + mAsyncRequest->setArguments(args); + + // The service is set asynchronous + mAsyncRequest->setSynchronous(false); + + // Send the request + bool status = mAsyncRequest->send(); + Q_ASSERT(status); + + OstTraceFunctionExit0(ICTSWLANLOGININTERFACE_WLANLOGINAPPSTART_EXIT); +} + +/*! + Function for handling request's response from QtHighway framework + when transaction is OK. This is used only with asynchronous requests. + + @param [in] result Status received from WLAN Login application +*/ +void IctsWlanLoginInterface::handleOk(const QVariant& result) +{ + OstTraceFunctionEntry0(ICTSWLANLOGININTERFACE_HANDLEOK_ENTRY); + + ictsResultType ictsRes = IctsFailed; + + // Handling of result received from service. + int i = result.toInt(); + WlanLoginService::WlanLoginStatus status = + static_cast(i); + + switch (status) { + case WlanLoginService::WlanLoginStatusConnectionDropped: + case WlanLoginService::WlanLoginStatusCancel: + OstTrace0( + TRACE_NORMAL, + ICTSWLANLOGININTERFACE_HANDLEOK_CANCEL_TRACE, + "WlanLoginStatusCancel or WlanLoginStatusConnectionDropped received "); + // User has canceled Wlan Login and it has to be stopped + stop(); + ictsRes = IctsCanceled; + break; + + case WlanLoginService::WlanLoginStatusNext: + OstTrace0( + TRACE_NORMAL, + ICTSWLANLOGININTERFACE_HANDLEOK_NEXT_TRACE, + "WlanLoginStatusNext received"); + ictsRes = IctsHotspotPassed; + break; + + case WlanLoginService::WlanLoginStatusFailed: + OstTrace0( TRACE_NORMAL, + ICTSWLANLOGININTERFACE_HANDLEOK_FAILED_TRACE, + "WlanLoginStatusFailed received "); + stop(); + ictsRes = IctsFailed; + break; + + default: + OstTrace0( + TRACE_NORMAL, + ICTSWLANLOGININTERFACE_HANDLEOK_UNEXPECTED_STATUS_TRACE, + "Unexpected WlanLoginStatus received"); + break; + + } + emit ictsResult(ictsRes); + + delete mAsyncRequest; + mAsyncRequest = NULL; + + OstTraceFunctionExit0(ICTSWLANLOGININTERFACE_HANDLEOK_EXIT); +} + +/*! + Function for handling request's response from QtHighway framework + when errors occured. This is used only with asynchronous requests. + + @param [in] errorCode Error code that was received +*/ +void IctsWlanLoginInterface::handleError(int errorCode) +{ + OstTraceFunctionEntry0(ICTSWLANLOGININTERFACE_HANDLEERROR_ENTRY); + + OstTrace1( + TRACE_NORMAL, + ICTSWLANLOGININTERFACE_ERRORCODE_TRACE, + "errorCode=%d", + errorCode); + + delete mAsyncRequest; + mAsyncRequest = NULL; + + OstTraceFunctionExit0(ICTSWLANLOGININTERFACE_HANDLEERROR_EXIT); +} + +/*! + Function for stopping launched Wlan login application. +*/ +void IctsWlanLoginInterface::stop() +{ + OstTraceFunctionEntry0(ICTSWLANLOGININTERFACE_STOP_ENTRY); + + // Execution of synchronous and embedded Wlan Login stop + QScopedPointer syncRequest(mAiwMgr->create( + "wlanlogin", + "com.nokia.symbian.IWlanLogin", + "stop()", + false)); + + // The Wlan Login service must always exist + Q_ASSERT(syncRequest); + + // The service is set synchronous + syncRequest->setSynchronous(true); + + // Send the request + bool status = syncRequest->send(); + Q_ASSERT(status); + + OstTraceFunctionExit0(ICTSWLANLOGININTERFACE_STOP_EXIT); +} + +/*! + Function for handling connectivityTestResult signal + + @param [in] result Internet connectivity test result + @param [in] redirectUrl Possible redirection URL. Valid only when HttpAuthenticationNeeded result received. +*/ +void IctsWlanLoginInterface::handleConnectivityTestResult(IctsWrapper::ConnectivityTestResult result, QUrl redirectUrl) +{ + OstTraceFunctionEntry0(ICTSWLANLOGININTERFACE_HANDLECONNECTIVITYTESTRESULT_ENTRY); + + OstTrace1(TRACE_NORMAL, + ICTSWLANLOGININTERFACE_HANDLECONNECTIVITYRESULT_RESULT_TRACE, + "ConnectivityTestResult=%d", + result); + + switch (result) + { + case IctsWrapper::ConnectionOk: + + OstTrace1( + TRACE_BORDER, + ICTSWLANLOGININTERFACE_HANDLECONNECTIVITYTESTRESULT_EMIT_ICTSRESULT_PASSED, + "IctsWlanLoginInterface::handleConnectivityTestResult emit ictsResult;result=%d", + IctsPassed); + + emit ictsResult(IctsPassed); + break; + + case IctsWrapper::HttpAuthenticationNeeded: + // Inform client that Hotspot authentication is needed. + OstTrace0( + TRACE_BORDER, + ICTSWLANLOGININTERFACE_HANDLECONNECTIVITYTESTRESULT_EMIT_HOTSPOTCASE, + "IctsWlanLoginInterface::handleConnectivityTestResult emit hotspotCase"); + + emit hotspotCase(); + wlanLoginAppStart(mIapId, mNetId, redirectUrl); + break; + + default: + OstTrace1( + TRACE_BORDER, + ICTSWLANLOGININTERFACE_HANDLECONNECTIVITYTESTRESULT_EMIT_ICTS_RESULT_FAILED, + "IctsWlanLoginInterface::handleConnectivityTestResult emit ictsResult;result=%d", + IctsFailed); + emit ictsResult(IctsFailed); + break; + + } + + OstTraceFunctionExit0(ICTSWLANLOGININTERFACE_HANDLECONNECTIVITYTESTRESULT_EXIT); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/ictswlanlogininterface/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/ictswlanlogininterface/traces/OstTraceDefinitions.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,4 @@ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +#include +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanlogin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanlogin.pro Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,24 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Project file for WLAN Login related components +# + +TEMPLATE = subdirs + +SUBDIRS += ictsqtwrapper \ + wlanloginapp \ + ictswlanlogininterface + +CONFIG += ordered + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginapplication.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginapplication.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for WlanLoginApplication class +* +*/ + +#ifndef WLANLOGINAPPLICATION_H +#define WLANLOGINAPPLICATION_H + +// System includes +#include + +//User includes + +// forward declarations +class WlanLoginService; +class WlanLoginEngine; +class WlanLoginMainWindow; +class HbTranslator; + +// External data types + +// Constants + +// Class declaration +class WlanLoginApplication : public HbApplication + { +public: + WlanLoginApplication(int argc, char* argv[]); + ~WlanLoginApplication(); + + WlanLoginService* service() const; + WlanLoginEngine* engine() const; + QSharedPointer mainWindow(); + + +private: // data + + // Not owned data + + // Owned data + WlanLoginService* mService; //!< Pointer to Qt Highway service provider + QSharedPointer mTranslator; //!< Pointer to HB translator + WlanLoginEngine* mEngine; //!< Pointer to WLAN login engine + QSharedPointer mMainWindow; //!< Pointer to WLAN login application main window + }; + +#endif // WLANLOGINAPPLICATION_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginengine.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Engine of Wlan Login application. + */ + +#ifndef WLANLOGINENGINE_H +#define WLANLOGINENGINE_H + +// System includes +#include +#include + +// User includes +#include "qnetworkconfigmanager.h" +#include "qnetworkconfiguration.h" +#include "qnetworksession.h" +#include "wlanloginservice.h" +#include "ictsqtwrapper.h" +#include "wlanloginnetworkaccessmanager.h" + +// Forward declarations + +// External data types + +// Constants + +/*! + Total polling time for ICTS in microseconds +*/ +const int totalPollingTime = 20000000; + +/*! + Polling interval time for ICTS in microseconds +*/ +const int pollingInterval = 4000000; + +/*! + Message box time out value in milliseconds +*/ +const int messageBoxTimeout = 3000; + + +QTM_USE_NAMESPACE + +// Class declaration +class WlanLoginEngine : public QObject + { + Q_OBJECT + +public: + + /*! + Enumeration type for storing current engine state + */ + enum EngineState { + WaitingForStart = 0, //!< Engine waiting start from Qt Highway + UpdatingNetworkConfigurations, //!< Engine is updating netowk configuration states + OpeningNetworkSession, //!< Engine is opening network session + NetworkSessionOpened, //!< Network session is opened by engine + RunningIcts, //!< Internet connectivity test ongoing + IctsRan //!< Internet connectivity test has been ran + }; + + explicit WlanLoginEngine(QObject *parent = 0); + ~WlanLoginEngine(); + + void openSession(); + void stopIcts(); + void showConnectionDroppedMessageBox(); + void emitCompleteServiceRequest(WlanLoginService::WlanLoginStatus status); + WlanLoginNetworkAccessManager* networkAccessManager() const; + EngineState engineState(); + void setEngineState(EngineState newState); + +signals: + void completeServiceRequest(int status); + void connectionReady(QUrl url); + void ictsOk(); + +private slots: + void handleStartLogin(int iapId, int netId, QUrl redirectionUrl); + void handleStopLogin(); + void handleUpdateCompleted(); + void handleSessionOpened(); + + void handleSessionStateChanged(QNetworkSession::State newState); + void handleSessionError(QNetworkSession::SessionError error); + void connectionDroppedMessageBoxClosed(HbAction* action); + + void handleStartIcts(); + void handleConnectivityTestResult(IctsWrapper::ConnectivityTestResult result, QUrl redirectUrl); + void handleCancelTriggered(); + void handleNextTriggered(); + void handleContinueTriggered(); + +private: // Data + + // Not owned data + + // Owned data + EngineState mEngineState; //!< current state of the Engine + bool mServiceRequestCompleted; //!< Variable for storing service request state + QNetworkConfigurationManager* mNetConfigurationManager; //!< pointer to network configuration manager + WlanLoginNetworkAccessManager* mNetworkAccessManager; //!< pointer to network access manager + QNetworkSession* mNetworkSession; //!< pointer to network session + IctsWrapper* mIctsWrapper; //!< pointer to ICTS client wrapper + bool mIctsFirstRun; //!< Flag to check if we are running ICTS first time + int mIap; //!< IAP that was provided in startup + int mNetId; //!< network ID that was provided in startup + QUrl mRedirectionUrl; //!< redirection URL that was provided in startup + }; + +#endif // WLANLOGINENGINE_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginmainwindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginmainwindow.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef WLANLOGINMAINWINDOW_H +#define WLANLOGINMAINWINDOW_H + +// System includes +#include + +// User includes + +// Forward declarations + +// External data types + +// Constants + +// Forward declarations +class WlanLoginView; +class WlanLoginApplication; + +// Class declaration +class WlanLoginMainWindow : public HbMainWindow + { + Q_OBJECT + +public: + explicit WlanLoginMainWindow(WlanLoginApplication* appRef); + ~WlanLoginMainWindow(); + + WlanLoginView* loginView() const; + +private: + void addLoginView(); + + +private: //Data + + // Not owned data + + // Owned data + WlanLoginApplication* mAppRef; //!< pointer to application instance + WlanLoginView* mLoginView; //!< pointer to login view + + }; + +#endif // WLANLOGINMAINWINDOW_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginnetworkaccessmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginnetworkaccessmanager.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Engine of Wlan Login application. +*/ + +#ifndef WLANLOGINNETWORKACCESSMANAGER_H +#define WLANLOGINNETWORKACCESSMANAGER_H + +// System includes +#include + +// User includes + +// Forward declarations + +// External data types + +// Constants + +// Class declaration +class WlanLoginNetworkAccessManager : public QNetworkAccessManager +{ + Q_OBJECT + +public: + explicit WlanLoginNetworkAccessManager(QObject *parent = 0); + ~WlanLoginNetworkAccessManager(); + +private slots: + void handleSslErrors(QNetworkReply *reply, const QList &errors); + void handleNetworkRequestFinished(QNetworkReply* reply); +}; + +#endif // WLANLOGINNETWORKACCESSMANAGER_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginservice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginservice.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Wlan login QtHighway Service. +*/ + +#ifndef WLANLOGINSERVICE_H +#define WLANLOGINSERVICE_H + +// System includes +#include +#include +// User includes + +// Forward declarations + +// External data types + +// Constants + +// Class declaration +class WlanLoginService: public XQServiceProvider +{ + Q_OBJECT + +public: + // Data types + + /*! + Enumeration for WLAN Login application service request return values + */ + enum WlanLoginStatus { + WlanLoginStatusNone = 0, //!< No status + WlanLoginStatusCancel, //!< User cancel + WlanLoginStatusNext, //!< Proceed to next phase + WlanLoginStatusConnectionDropped, //!< WLAN connection dropped during login + WlanLoginStatusFailed //!< Login process failed + }; + + explicit WlanLoginService(QObject *parent = 0); + ~WlanLoginService(); + +signals: + + void startLogin(int iapId, int netId, QUrl url); + void stopLogin(); + +public slots: + + void start(int iapId, int netId, QUrl url); + void stop(); + void completeServiceRequest(int status); + +private: + + QVariant mReturnValue; //!< Return value deliverd to back to entry + int mAsyncRequestIndex; //!< Service request ID +}; + +#endif //WLANLOGINSERVICE_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginview.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef WLANLOGINVIEW_H +#define WLANLOGINVIEW_H + +// System includes +#include +#include +#include +#include + +// User includes +#include "wlanloginapplication.h" +#include "wlanloginwebpage.h" +#include "ictsqtwrapper.h" + +// Forward declarations +class HbProgressBar; +class WlanLoginWebView; +class QNetworkAccessManager; +class HbWidget; + +// External data types + +// Constants + +// Class declaration +class WlanLoginView : public HbView + { + Q_OBJECT + +public: + WlanLoginView(WlanLoginApplication* appref); + virtual ~WlanLoginView(); + + /*! + Enumeration type for current toolbar action in use + */ + enum ActionType { + Cancel, //!< "Cancel" button + Next, //!< "Next" button + Continue //!< "Continue" button + }; + void setActiveToolBarAction(ActionType newAction); + +private slots: + + void handleConnectionReady(QUrl url); + void handleOrientationChanged(Qt::Orientation orientation); + void adjustViewSize(); + + void handleUrlChanged(const QUrl& newUrl); + void handleLoadStarted(); + void handleLoadProgress(int progressValue); + void handleLoadFinished(bool status ); + + void handleFormSubmitted(); + void handleCancelAction(); + void handleNextAction(); + void handleContinueAction(); + + void handleIctsOk(); + +signals: + void cancelTriggered(); + void nextTriggered(); + void continueTriggered(); + void startIcts(); + +private: // Data + + // Not owned data + WlanLoginApplication* mAppRef; //!< pointer to application instance + + // Owned data + + QGraphicsLinearLayout* mMainLayout; //!< pointer to main layout + QGraphicsLinearLayout* mContentLayout; //!< pointer to scroall area content layout + + HbProgressBar* mProgressBar; //!< pointer to HB progressbar + HbScrollArea* mScrollArea; //!< pointer to HB scroll area + HbWidget* mScrollAreaContent; + WlanLoginWebView* mWebView; //!< pointer to web view + HbToolBar* mToolBar; //!< pointer to HB toolbar + HbAction* mCancelAction; //!< pointer to "cancel" action + HbAction* mNextAction; //!< pointer to "next" action + HbAction* mContinueAction; //!< pointer to "continue" action + + }; + +#endif // WLANLOGINWEBVIEW_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginwebpage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginwebpage.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Wlan Login web page class definition + * + */ + +#ifndef WLANLOGINWEBPAGE_H +#define WLANLOGINWEBPAGE_H + +// System includes +#include + +// User includes + +// Forward declarations + +// External data types + +// Constants + +// Class declaration +class WlanLoginWebPage : public QWebPage + { + Q_OBJECT + +public: + explicit WlanLoginWebPage(QObject* parent=0); + ~WlanLoginWebPage(); + +protected: + bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type); + +signals: + void formSubmitted(); + }; + +#endif // WLANLOGINWEBPAGE_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginwebview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginwebview.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Wlan Login web view class definition +* +*/ + +#ifndef WLANLOGINWEBVIEW_H +#define WLANLOGINWEBVIEW_H + +// System includes +#include + +// User includes + +// Forward declarations +class WlanLoginWebPage; + +// External data types + +// Constants + +// Class declaration +class WlanLoginWebView: public QGraphicsWebView +{ + Q_OBJECT + +public: + explicit WlanLoginWebView(QGraphicsWidget* parent = 0); + ~WlanLoginWebView(); + +protected: + bool eventFilter(QObject *, QEvent *event); + +private: // Data + + // Not owned data + + // Owned data + WlanLoginWebPage* mWebPage; //!< Pointer to subclassed QWebPage + bool mMousePressed; //!< Variable to hold whether mouse(finger) is pressed down +}; + +#endif //WLANLOGINWEBVIEW_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/res/service_conf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/res/service_conf.xml Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,11 @@ + + + wlanlogin + No path + WLAN Login + + com.nokia.symbian.IWlanLogin + 1.0 + WLAN login start + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/rom/wlanlogin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/rom/wlanlogin.iby Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Login application IBY file. +*/ + +#ifndef WLANLOGIN_IBY +#define WLANLOGIN_IBY + +#include + +#ifdef __PROTOCOL_WLAN + +#define UPGRADABLE_APP_REG_RSC(NAME) data=DATAZ_/PRIVATE/10003A3F/IMPORT/APPS/ ## NAME ## _reg.rsc Private/10003a3f/import/apps/ ## NAME ## _reg.rsc + +S60_APP_EXE(wlanlogin) +S60_APP_RESOURCE(wlanlogin) +UPGRADABLE_APP_REG_RSC(wlanlogin) + +#endif //__PROTOCOL_WLAN + +#endif // WLANLOGIN_IBY \ No newline at end of file diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/rom/wlanlogin_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/rom/wlanlogin_resources.iby Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN login application resource IBY file. +*/ + +#ifndef WLANLOGIN_RESOURCES_IBY +#define WLANLOGIN_RESOURCES_IBY + +#include +#include + +#ifdef __PROTOCOL_WLAN +data=DATAZ_/QT_TRANSLATIONS_DIR/wlanlogin.qm QT_TRANSLATIONS_DIR/wlanlogin.qm +#endif //__PROTOCOL_WLAN + +#endif // WLANLOGIN_RESOURCES_IBY diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/src/main.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "wlanloginapplication.h" +#include + +int main(int argc, char *argv[]) +{ + // Check WLAN dynamic configuration & exit if WLAN is not enabled + QtMobility::QSystemInfo sysinfo; + if (!sysinfo.hasFeatureSupported(QtMobility::QSystemInfo::WlanFeature)) { + return -1; + } + + WlanLoginApplication app(argc, argv); + return app.exec(); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/src/wlanloginapplication.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginapplication.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,191 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Wlan Login application class implementation. +* +*/ + + +// System includes +#include +#include +#include +#include +#include + +//User includes +#include "wlanloginapplication.h" +#include "wlanloginservice.h" +#include "wlanloginmainwindow.h" +#include "wlanloginengine.h" +#include "wlanloginview.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanloginapplicationTraces.h" +#endif + +/*! + \class WlanLoginApplication + \brief WLAN Login application class implementation. +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. + + @param [in] argc Parameter count. + @param [in] argv Parameters. + */ +WlanLoginApplication::WlanLoginApplication(int argc, char* argv[]) : + HbApplication( argc, argv ), + mService(new WlanLoginService(this)), + mTranslator(new HbTranslator()), + mEngine(new WlanLoginEngine(this)), + mMainWindow(new WlanLoginMainWindow(this)) +{ + OstTraceFunctionEntry0(WLANLOGINAPPLICATION_WLANLOGINAPPLICATION_ENTRY); + + bool connectStatus = connect( + mService, + SIGNAL(startLogin(int,int,QUrl)), + mEngine, + SLOT(handleStartLogin(int,int,QUrl))); + Q_ASSERT(connectStatus == true); + + connectStatus = connect( + mService, + SIGNAL(stopLogin()), + mEngine, + SLOT(handleStopLogin())); + Q_ASSERT(connectStatus == true); + + connectStatus = connect( + mEngine, + SIGNAL(completeServiceRequest(int)), + mService, + SLOT(completeServiceRequest(int))); + Q_ASSERT(connectStatus == true); + + connectStatus = connect( + mEngine, + SIGNAL(connectionReady(QUrl)), + mMainWindow->loginView(), + SLOT(handleConnectionReady(QUrl))); + Q_ASSERT(connectStatus == true); + + connectStatus = connect( + mMainWindow->loginView(), + SIGNAL(startIcts()), + mEngine, + SLOT(handleStartIcts())); + Q_ASSERT(connectStatus == true); + + connectStatus = connect( + mEngine, + SIGNAL(ictsOk()), + mMainWindow->loginView(), + SLOT(handleIctsOk())); + Q_ASSERT(connectStatus == true); + + connectStatus = connect( + mMainWindow->loginView(), + SIGNAL(cancelTriggered()), + mEngine, + SLOT(handleCancelTriggered())); + Q_ASSERT(connectStatus == true); + + connectStatus = connect( + mMainWindow->loginView(), + SIGNAL(nextTriggered()), + mEngine, + SLOT(handleNextTriggered())); + Q_ASSERT(connectStatus == true); + + connectStatus = connect( + mMainWindow->loginView(), + SIGNAL(continueTriggered()), + mEngine, + SLOT(handleContinueTriggered())); + Q_ASSERT(connectStatus == true); + + connectStatus = connect( + mMainWindow.data(), + SIGNAL(orientationChanged(Qt::Orientation)), + mMainWindow->loginView(), + SLOT(handleOrientationChanged(Qt::Orientation))); + Q_ASSERT(connectStatus == true); + + OstTraceFunctionExit0(WLANLOGINAPPLICATION_WLANLOGINAPPLICATION_EXIT); +} + + +/*! + Destructor. + */ +WlanLoginApplication::~WlanLoginApplication() +{ + OstTraceFunctionEntry0(WLANLOGINAPPLICATION_DESTRUCTOR_ENTRY); + + OstTraceFunctionExit0(WLANLOGINAPPLICATION_DESTRUCTOR_EXIT); +} + + +/*! + Function that returns pointer to Qt Highway service instance. + + @return Pointer to XQServiceProvider + */ +WlanLoginService* WlanLoginApplication::service() const +{ + OstTraceFunctionEntry0(WLANLOGINAPPLICATION_SERVICE_ENTRY); + OstTraceFunctionExit0(WLANLOGINAPPLICATION_SERVICE_EXIT); + + return mService; +} + + +/*! + Function that returns pointer to WLAN login engine + + @return Pointer to engine + */ +WlanLoginEngine* WlanLoginApplication::engine() const +{ + OstTraceFunctionEntry0(WLANLOGINAPPLICATION_ENGINE_ENTRY); + OstTraceFunctionExit0(WLANLOGINAPPLICATION_ENGINE_EXIT); + + return mEngine; +} + + +/*! + Function that returns pointer to WLAN login application main window + + @return Pointer to application main window + */ +QSharedPointer WlanLoginApplication::mainWindow() +{ + OstTraceFunctionEntry0(WLANLOGINAPPLICATION_MAINWINDOW_ENTRY); + OstTraceFunctionExit0(WLANLOGINAPPLICATION_MAINWINDOW_EXIT); + + return mMainWindow; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/src/wlanloginengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginengine.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,542 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Wlan Login engine class implementation +* +*/ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include + +//User includes +#include "wlanloginengine.h" +#include "wlanloginapplication.h" +#include "wlanloginmainwindow.h" +#include "ictsqtwrapper.h" +#include "wlanloginnetworkaccessmanager.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanloginengineTraces.h" +#endif + +/*! + \class WlanLoginEngine + \brief WLAN Login engine class implementation. +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. + */ +WlanLoginEngine::WlanLoginEngine(QObject *parent): + QObject(parent), + mEngineState(WaitingForStart), + mServiceRequestCompleted(false), + mNetConfigurationManager(new QNetworkConfigurationManager(this)), + mNetworkAccessManager(new WlanLoginNetworkAccessManager(this)), + mNetworkSession(NULL), + mIctsWrapper(NULL), + mIctsFirstRun(true), + mIap(0), + mNetId(0), + mRedirectionUrl(QUrl("")) +{ + OstTraceFunctionEntry0(WLANLOGINENGINE_WLANLOGINENGINE_ENTRY); + + bool connectStatus = connect( + mNetConfigurationManager, + SIGNAL(updateCompleted()), + this, + SLOT(handleUpdateCompleted())); + Q_ASSERT(connectStatus == true); + + OstTraceFunctionExit0(WLANLOGINENGINE_WLANLOGINENGINE_EXIT); +} + + +/*! + Destructor. + */ +WlanLoginEngine::~WlanLoginEngine() +{ + OstTraceFunctionEntry0(WLANLOGINENGINE_DESTRUCTOR_ENTRY); + + mNetworkSession->close(); + + OstTraceFunctionExit0(WLANLOGINENGINE_DESTRUCTOR_EXIT); +} + + +/*! + Function that returns pointer to network access manager. + + @return Pointer to WlanLoginNetworkAccessManager + */ +WlanLoginNetworkAccessManager* WlanLoginEngine::networkAccessManager() const +{ + return mNetworkAccessManager; +} + + +/*! + Function that returns current state of the engine. + + @return engine state + */ +WlanLoginEngine::EngineState WlanLoginEngine::engineState() +{ + return mEngineState; +} + + +/*! + Function that sets the current state of the engine. + + @param [in] newState New state of the engine to be set + */ +void WlanLoginEngine::setEngineState(WlanLoginEngine::EngineState newState) +{ + mEngineState = newState; +} + + +/*! + This slot handles startLogin signal from Qt Highway service provider + + @param [in] iapId Internet access point ID for a connection that we should attach to' + @param [in] netId Network Id for the connection to be used + @param [in] redirectionUrl The URL that we were redirected to by the first internet connectivity test + + */ +void WlanLoginEngine::handleStartLogin(int iapId, int netId, QUrl redirectionUrl) +{ + OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLESTARTLOGIN_ENTRY); + + mIap = iapId; + OstTrace1( + TRACE_NORMAL, + WLANLOGINENGINE_HANDLESTARTLOGIN_IAP_TRACE, + "WlanLoginEngine::handleStartLogin;mIap=%d", + mIap); + + mNetId = netId; + OstTrace1( + TRACE_NORMAL, + WLANLOGINENGINE_HANDLESTARTLOGIN_NETID_TRACE, + "WlanLoginEngine::handleStartLogin;mNetId=%d", + mNetId); + + mRedirectionUrl = redirectionUrl; + +#ifdef OST_TRACE_COMPILER_IN_USE + QString url = mRedirectionUrl.toString(); + TPtrC tmp(url.utf16(),url.length() ); + + OstTraceExt1( + TRACE_NORMAL, + WLANLOGINENGINE_HANDLESTARTLOGIN_URL_TRACE, + "WlanLoginEngine::handleStartLogin;mRedirectionUrl=%S", + tmp); +#endif + + //Create ICTS instance as we know needed parameters now + mIctsWrapper = new IctsWrapper(mIap, mNetId, this); + + bool connectStatus = connect( + mIctsWrapper, + SIGNAL(connectivityTestResult(IctsWrapper::ConnectivityTestResult, QUrl)), + this, + SLOT(handleConnectivityTestResult(IctsWrapper::ConnectivityTestResult, QUrl))); + Q_ASSERT(connectStatus == true); + + //Update network configurations as only states of the cellular IAP's are reliable + //after creating network configuration manager + + setEngineState(UpdatingNetworkConfigurations); + mNetConfigurationManager->updateConfigurations(); + + OstTraceFunctionExit0(WLANLOGINENGINE_HANDLESTARTLOGIN_EXIT); +} + +/*! + This slot handles stopLogin signal from Qt Highway service provider + + */ +void WlanLoginEngine::handleStopLogin() +{ + OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLESTOPLOGIN_ENTRY); + + // Exit application + qApp->quit(); + + OstTraceFunctionExit0(WLANLOGINENGINE_HANDLESTOPLOGIN_EXIT); +} + + +/*! + This slot handles updateCompleted signal from QNetworkConfigManager + + */ +void WlanLoginEngine::handleUpdateCompleted() +{ + OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLEUPDATECOMPLETED_ENTRY); + + //States of the available configurations are now updated and + //we can open the network session to provided IAP + + openSession(); + + OstTraceFunctionExit0(WLANLOGINENGINE_HANDLEUPDATECOMPLETED_EXIT); +} + +/*! + This function handles opening of the network session to the specified IAP. + If IAP is not already in connected state, function completes service request + with connection dropped status and show a message box to user. + + */ +void WlanLoginEngine::openSession() +{ + OstTraceFunctionEntry0(WLANLOGINENGINE_OPENSESSION_ENTRY); + + setEngineState(WlanLoginEngine::OpeningNetworkSession); + + //Get configuration that matches the provided IAP + QNetworkConfiguration netConfiguration = mNetConfigurationManager->configurationFromIdentifier(QString::number(mIap)); + + OstTrace1( + TRACE_NORMAL, + WLANLOGINENGINE_OPENSESSION_CONFIGURATION_IDENTIFIER_TRACE, + "WlanLoginEngine::openSession;netConfiguration identifier=%d", + netConfiguration.identifier().toInt()); + + OstTrace1(TRACE_NORMAL, + WLANLOGINENGINE_OPENSESSION_CONFIGURATION_STATE_TRACE, + "WlanLoginEngine::openSession;netConfiguration state=%d", + netConfiguration.state()); + +#ifdef OST_TRACE_COMPILER_IN_USE + QString string = netConfiguration.name(); + TPtrC tmp(string.utf16(),string.length() ); + + OstTraceExt1( + TRACE_NORMAL, + WLANLOGINENGINE_OPENSESSION_CONFIGURATION_NAME_TRACE, + "WlanLoginEngine::openSession;netConfiguration name=%S", + tmp ); + + string = netConfiguration.bearerName(); + tmp.Set(string.utf16(),string.length()); + + OstTraceExt1( + TRACE_NORMAL, + WLANLOGINENGINE_OPENSESSION_CONFIGURATION_BEARER_NAME_TRACE, + "WlanLoginEngine::openSession;netConfiguration bearerName=%S", + tmp ); +#endif + + //Check that configuration state is active before opening session + //Otherwise show disconnected message box + + if (netConfiguration.state() == QNetworkConfiguration::Active) + { + //Create network session to IAP that was provided in startup + mNetworkSession = new QNetworkSession(netConfiguration, this); + + bool connectStatus = connect( + mNetworkSession, + SIGNAL(opened()), + this, + SLOT(handleSessionOpened())); + Q_ASSERT(connectStatus == true); + + connectStatus = connect( + mNetworkSession, + SIGNAL(stateChanged(QNetworkSession::State)), + this, + SLOT(handleSessionStateChanged(QNetworkSession::State))); + Q_ASSERT(connectStatus == true); + + connectStatus = connect( + mNetworkSession, + SIGNAL(error(QNetworkSession::SessionError)), + this, + SLOT(handleSessionError(QNetworkSession::SessionError))); + Q_ASSERT(connectStatus == true); + + mNetworkSession->open(); + } else { + showConnectionDroppedMessageBox(); + } + + OstTraceFunctionExit0(WLANLOGINENGINE_OPENSESSION_EXIT); +} + + +/*! + This function handles sessionOpened signal from QNetworkSession. It informs view that + connection is ready to be used. + + */ +void WlanLoginEngine::handleSessionOpened() +{ + OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLESESSIONOPENED_ENTRY); + + setEngineState(NetworkSessionOpened); + //Send indication to view that connection is ready + emit connectionReady(mRedirectionUrl); + + OstTraceFunctionExit0(WLANLOGINENGINE_HANDLESESSIONOPENED_EXIT); +} + + +/*! + This function handles sessionStateChanged signal from QNetworkSession. + @param [in] newState New state of the session + */ +void WlanLoginEngine::handleSessionStateChanged(QNetworkSession::State newState) +{ + OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLESESSIONSTATECHANGED_ENTRY); + + OstTrace1( + TRACE_NORMAL, + WLANLOGINENGINE_HANDLESESSIONSTATECHANGED_STATE_TRACE, + "WlanLoginEngine::handleSessionStateChanged;newState=%d", + newState ); + + OstTraceFunctionExit0(WLANLOGINENGINE_HANDLESESSIONSTATECHANGED_EXIT); +} + + +/*! + This function handles sessionError signal from QNetworkSession + @param [in] error session error + */ +void WlanLoginEngine::handleSessionError(QNetworkSession::SessionError error) +{ + OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLESESSIONERROR_ENTRY); + + OstTrace1( + TRACE_NORMAL, + WLANLOGINENGINE_SESSION_ERROR_TRACE, + "WlanLoginEngine::handleSessionError;error=%d", + error); + + switch (engineState()) { + case OpeningNetworkSession: + showConnectionDroppedMessageBox(); + break; + + case NetworkSessionOpened: + case IctsRan: + if (error == QNetworkSession::SessionAbortedError ) { + showConnectionDroppedMessageBox(); + } + break; + + case RunningIcts: + if (error == QNetworkSession::SessionAbortedError ) { + stopIcts(); + showConnectionDroppedMessageBox(); + } + break; + + default: + break; + } + + OstTraceFunctionExit0(WLANLOGINENGINE_HANDLESESSIONERROR_EXIT); +} + +/*! + This function handles startIcts signal and starts connectivity test in polling mode + + */ +void WlanLoginEngine::handleStartIcts() +{ + OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLESTARTICTS_ENTRY); + + if (!mIctsWrapper->isPolling()) { + setEngineState(RunningIcts); + mIctsWrapper->startPolling(totalPollingTime, pollingInterval); + } + + OstTraceFunctionExit0(WLANLOGINENGINE_HANDLESTARTICTS_EXIT); +} + +/*! + This function stops internet connectivity test + + */ +void WlanLoginEngine::stopIcts() +{ + OstTraceFunctionEntry0(WLANLOGINENGINE_STOPICTS_ENTRY); + + if (mIctsWrapper->isPolling()) { + mIctsWrapper->stopPolling(); + } + + OstTraceFunctionExit0(WLANLOGINENGINE_STOPICTS_EXIT); +} + +/*! + This slot handles connectivityTestResult signal from ICTS wrapper + @param [in] result Result of the internet connectivity test + @param [in] redirectionUrl The URL that we are being redirected, valid only if result is HttpAuthenticationNeeded + */ + +void WlanLoginEngine::handleConnectivityTestResult(IctsWrapper::ConnectivityTestResult result, QUrl redirectUrl) +{ + OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLECONNECTIVITYTESTRESULT_ENTRY); + + Q_UNUSED(redirectUrl); + + setEngineState(IctsRan); + mIctsFirstRun = false; + + if (result == IctsWrapper::ConnectionOk){ + emit ictsOk(); + } + + OstTraceFunctionExit0(WLANLOGINENGINE_HANDLECONNECTIVITYTESTRESULT_EXIT); +} + +/*! + This slot handles cancelTriggered signal from the view + + */ +void WlanLoginEngine::handleCancelTriggered() +{ + OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLECANCELTRIGGERED_ENTRY); + + //Stop ICTS if it is running: + if (engineState() == RunningIcts) { + stopIcts(); + if (mIctsFirstRun) { + emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusCancel); + } else { + //Previous ICTS must have failed as cancel action can't be selected from UI if + //it has passed + emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusFailed); + } + } else if (engineState() == IctsRan) { + //ICTS must have failed as cancel action can't be selected from UI if + //it has passed + emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusFailed); + } else { + //ICTS not run yet + emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusCancel); + } + + OstTraceFunctionExit0(WLANLOGINENGINE_HANDLECANCELTRIGGERED_EXIT); +} + +/*! + This slot handles nextTriggered signal from the view + + */ +void WlanLoginEngine::handleNextTriggered() +{ + OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLENEXTTRIGGERED_ENTRY); + + emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusNext); + + //put application to background: + WlanLoginApplication* app = static_cast(this->parent()); + app->mainWindow()->lower(); + + OstTraceFunctionExit0(WLANLOGINENGINE_HANDLENEXTTRIGGERED_EXIT); +} + +/*! + This slot handles continueTriggered signal from the view + + */ +void WlanLoginEngine::handleContinueTriggered() +{ + OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLECONTINUETRIGGERED_ENTRY); + + //put application to background: + WlanLoginApplication* app = static_cast(this->parent()); + app->mainWindow()->lower(); + + OstTraceFunctionExit0(WLANLOGINENGINE_HANDLECONTINUETRIGGERED_EXIT); +} + +/*! + This function shows connection dropped message box to the user + + */ +void WlanLoginEngine::showConnectionDroppedMessageBox() +{ + OstTraceFunctionEntry0(WLANLOGINENGINE_SHOWCONNECTIONDROPPEDMESSAGEBOX_ENTRY); + + HbMessageBox *messageBox = new HbMessageBox(hbTrId("txt_occ_info_wlan_connection_closed_login_applica")); + messageBox->setAttribute(Qt::WA_DeleteOnClose); + messageBox->setTimeout(messageBoxTimeout); + messageBox->open(this,SLOT(connectionDroppedMessageBoxClosed(HbAction*))); + + OstTraceFunctionExit0(WLANLOGINENGINE_SHOWCONNECTIONDROPPEDMESSAGEBOX_EXIT); +} + +void WlanLoginEngine::connectionDroppedMessageBoxClosed(HbAction* action) +{ + OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLEMESSAGEBOXCLOSED_ENTRY); + + Q_UNUSED(action); + + if (mServiceRequestCompleted == false ) { + emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusConnectionDropped); + + } else { + //If Qt Highway service request is already completed when connection drops, we have to make exit by our own + qApp->exit(); + } + + OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLEMESSAGEBOXCLOSED_EXIT); +} + +/*! + This function completes Qt Highway service request + @param [in] status completeing status of the service request + */ +void WlanLoginEngine::emitCompleteServiceRequest(WlanLoginService::WlanLoginStatus status ) +{ + OstTraceFunctionEntry0(WLANLOGINENGINE_EMITCOMPLETESERVICEREQUEST_ENTRY); + + mServiceRequestCompleted = true; + OstTrace1( + TRACE_BORDER, + WLANLOGINENGINE_EMITCOMPLETESERVICEREQUEST_EMIT_TRACE, + "WlanLoginEngine::emitCompleteServiceRequest with status:;status=%d", + status); + emit completeServiceRequest(status); + + OstTraceFunctionExit0(WLANLOGINENGINE_EMITCOMPLETESERVICEREQUEST_EXIT); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/src/wlanloginmainwindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginmainwindow.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Wlan Login main window class implementation +* +*/ + +// System includes + +//User includes + +#include "wlanloginmainwindow.h" +#include "wlanloginengine.h" +#include "wlanloginview.h" +#include "wlanloginapplication.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanloginmainwindowTraces.h" +#endif + +/*! + \class WlanLoginMainWindow + \brief WLAN Login main window class implementation. +*/ + +/*! + Constructor. + */ +WlanLoginMainWindow::WlanLoginMainWindow(WlanLoginApplication* appRef) : + mAppRef(appRef), + mLoginView(NULL) +{ + OstTraceFunctionEntry0(WLANLOGINMAINWINDOW_WLANLOGINMAINWINDOW_ENTRY); + + addLoginView(); + setCurrentView(mLoginView); + show(); + + OstTraceFunctionExit0(WLANLOGINMAINWINDOW_WLANLOGINMAINWINDOW_EXIT); +} + + +/*! + Destructor. + */ +WlanLoginMainWindow::~WlanLoginMainWindow() +{ + OstTraceFunctionEntry0(WLANLOGINMAINWINDOW_DESTRUCTOR_ENTRY); + + OstTraceFunctionExit0(WLANLOGINMAINWINDOW_DESTRUCTOR_EXIT); +} + + +/*! + This function creates login view + */ +void WlanLoginMainWindow::addLoginView() +{ + OstTraceFunctionEntry0(WLANLOGINMAINWINDOW_ADDLOGINVIEW_ENTRY); + + mLoginView = new WlanLoginView(mAppRef); + addView(mLoginView); + + OstTraceFunctionExit0(WLANLOGINMAINWINDOW_ADDLOGINVIEW_EXIT); +} + + +/*! + This function returns pointer to login view + */ +WlanLoginView* WlanLoginMainWindow::loginView() const +{ + OstTraceFunctionEntry0(WLANLOGINMAINWINDOW_LOGINVIEW_ENTRY); + OstTraceFunctionExit0(WLANLOGINMAINWINDOW_LOGINVIEW_EXIT); + + return mLoginView; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/src/wlanloginnetworkaccessmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginnetworkaccessmanager.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,139 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Wlan Login network access manager class implementation +* +*/ + + +// System includes +#include +#include +#include +#include + +//User includes +#include "wlanloginnetworkaccessmanager.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanloginnetworkaccessmanagerTraces.h" +#endif + +/*! + \class WlanLoginNetworkAccessManager + \brief WLAN Login network access manager class implementation. +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +WlanLoginNetworkAccessManager::WlanLoginNetworkAccessManager(QObject *parent): + QNetworkAccessManager(parent) +{ + OstTraceFunctionEntry0(WLANLOGINNETWORKACCESSMANAGER_WLANLOGINNETWORKACCESSMANAGER_ENTRY); + + QSslConfiguration sslConfig = QSslConfiguration::defaultConfiguration(); + sslConfig.setPeerVerifyMode(QSslSocket::VerifyNone); + QSslConfiguration::setDefaultConfiguration(sslConfig); + + bool connectStatus = connect( + this, + SIGNAL(sslErrors(QNetworkReply*, const QList&)), + SLOT(handleSslErrors(QNetworkReply*, const QList&)) + ); + Q_ASSERT(connectStatus == true); + + connectStatus = connect( + this, + SIGNAL(finished(QNetworkReply*)), + this, + SLOT(handleNetworkRequestFinished(QNetworkReply*)) + ); + Q_ASSERT(connectStatus == true); + + OstTraceFunctionExit0(WLANLOGINNETWORKACCESSMANAGER_WLANLOGINNETWORKACCESSMANAGER_EXIT); + +} + +WlanLoginNetworkAccessManager::~WlanLoginNetworkAccessManager() +{ + OstTraceFunctionEntry0( WLANLOGINNETWORKACCESSMANAGER_DESTRUCTOR_ENTRY ); + + OstTraceFunctionExit0( WLANLOGINNETWORKACCESSMANAGER_DESTRUCTOR_EXIT ); +} + +/*! + This function handles sslError signal from QNetworkAccessManager + + */ +void WlanLoginNetworkAccessManager::handleSslErrors(QNetworkReply *reply, const QList &errors) +{ + OstTraceFunctionEntry0(WLANLOGINNETWORKACCESSMANAGER_HANDLESSLERRORS_ENTRY); + +#ifdef OST_TRACE_COMPILER_IN_USE + for (int i=0; iignoreSslErrors(); + + OstTraceFunctionExit0( WLANLOGINNETWORKACCESSMANAGER_HANDLESSLERRORS_EXIT ); +} + +/*! + This function handles finished signal from QNetworkAccessManager + + */ +void WlanLoginNetworkAccessManager::handleNetworkRequestFinished(QNetworkReply* reply) +{ + OstTraceFunctionEntry0(WLANLOGINNETWORKACCESSMANAGER_HANDLENETWORKREQUESTFINISHED_ENTRY); + + OstTrace1( + TRACE_NORMAL, WLANLOGINNETWORKACCESSMANAGER_HANDLENETWORKREQUESTFINISHED_ERROR_CODE_TRACE, + "WlanLoginNetworkAccessManager::handleNetworkRequestFinished;QNetworkReply error code=%d", + reply->error() + ); + +#ifdef OST_TRACE_COMPILER_IN_USE + QString string = reply->errorString(); + TPtrC tmp(string.utf16(),string.length() ); + + OstTraceExt1( TRACE_NORMAL, WLANLOGINNETWORKACCESSMANAGER_HANDLENETWORKREQUESTFINISHED_ERROR_STRING_TRACE, + "WlanLoginNetworkAccessManager::handleNetworkRequestFinished;QNetworkReply error string=%S", tmp ); +#endif //OST_TRACE_COMPILER_IN_USE + + OstTraceFunctionExit0( WLANLOGINNETWORKACCESSMANAGER_HANDLENETWORKREQUESTFINISHED_EXIT ); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/src/wlanloginservice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginservice.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Wlan Login QtHighway Service. +*/ + +// System includes +#include + +// User includes +#include "wlanloginservice.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanloginserviceTraces.h" +#endif + +/*! + \class WlanLoginService + \brief Wlan Login QtHighway service implementation. + + This class implements a QtHighway service that is used to launch + Wlan login application. +*/ + +/*! + Constructor. + + @param[in] parent Object parent. + */ +WlanLoginService::WlanLoginService(QObject* parent) + : XQServiceProvider(QLatin1String("wlanlogin.com.nokia.symbian.IWlanLogin"), parent), + mReturnValue(WlanLoginStatusNone) +{ + OstTraceFunctionEntry0(WLANLOGINSERVICE_WLANLOGINSERVICE_ENTRY); + + publishAll(); + + OstTraceFunctionExit0(WLANLOGINSERVICE_WLANLOGINSERVICE_EXIT); +} + +/*! + Destructor. + */ +WlanLoginService::~WlanLoginService() +{ + OstTraceFunctionEntry0(WLANLOGINSERVICE_DESTRUCTOR_ENTRY); + + OstTraceFunctionExit0(WLANLOGINSERVICE_DESTRUCTOR_EXIT); +} + +/*! + Completes the current service. + + @param [in] status completeing status of the service request + */ +void WlanLoginService::completeServiceRequest(int status) +{ + OstTraceFunctionEntry0(WLANLOGINSERVICE_COMPLETESERVICEREQUEST_ENTRY); + + mReturnValue.setValue(status); + bool ret = completeRequest(mAsyncRequestIndex, mReturnValue); + Q_ASSERT(ret); + + OstTraceFunctionExit0(WLANLOGINSERVICE_COMPLETESERVICEREQUEST_EXIT); +} + +/*! + Launches Wlan Login application giving needed information. + + @param [in] iapId of the connection that we need to attach to + @param [in] netId of the connection that we need to attach to + @param [in] url redirection URL of the login page to be loaded + + */ +void WlanLoginService::start(int iapId, int netId, QUrl url) +{ + OstTraceFunctionEntry0( WLANLOGINSERVICE_START_ENTRY ); + + mAsyncRequestIndex = setCurrentRequestAsync(); + emit startLogin(iapId, netId, url); + + OstTraceFunctionExit0(WLANLOGINSERVICE_START_EXIT); +} + +/*! + Stop launched Wlan Login application. + */ +void WlanLoginService::stop() +{ + OstTraceFunctionEntry0(WLANLOGINSERVICE_STOP_ENTRY); + + mAsyncRequestIndex = setCurrentRequestAsync(); + emit stopLogin(); + + OstTraceFunctionExit0(WLANLOGINSERVICE_STOP_EXIT); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/src/wlanloginview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginview.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,482 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Main view for the WLAN Login application +* +*/ + + +#include +#include + +// System includes +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "wlanloginview.h" +#include "wlanloginwebview.h" +#include "wlanloginwebpage.h" +#include "wlanloginmainwindow.h" +#include "wlanloginengine.h" +#include "ictsqtwrapper.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanloginviewTraces.h" +#endif + +/*! + \class WlanLoginView + \brief Main view for the WLAN Login application +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor + */ +WlanLoginView::WlanLoginView(WlanLoginApplication* appRef): + mAppRef(appRef), + mMainLayout(NULL), + mContentLayout(NULL), + mProgressBar(NULL), + mScrollArea(NULL), + mScrollAreaContent(NULL), + mWebView(NULL), + mToolBar(NULL), + mCancelAction(NULL), + mNextAction(NULL), + mContinueAction(NULL) +{ + OstTraceFunctionEntry0(WLANLOGINVIEW_WLANLOGINVIEW_ENTRY); + + setTitleBarVisible(false); + setStatusBarVisible(false); + + mMainLayout = new QGraphicsLinearLayout(Qt::Vertical); + mMainLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + mMainLayout->setContentsMargins(0,0,0,0); + setLayout(mMainLayout); + + mScrollArea = new HbScrollArea(); + mScrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + mScrollArea->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff); + mScrollArea->setHorizontalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff); + mScrollArea->setScrollDirections(Qt::Vertical | Qt::Horizontal); + mScrollArea->setClampingStyle( HbScrollArea::StrictClamping ); + mScrollArea->setScrollingStyle( HbScrollArea::PanWithFollowOn ); + mMainLayout->addItem(mScrollArea); + + mScrollAreaContent = new HbWidget(); + mScrollAreaContent->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + mContentLayout = new QGraphicsLinearLayout(Qt::Vertical); + mContentLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + mContentLayout->setContentsMargins(0,0,0,0); + mScrollAreaContent->setLayout(mContentLayout); + mScrollArea->setContentWidget(mScrollAreaContent); + + // Set white background to content widget + QPixmap pixmap(10,10); + pixmap.fill(Qt::white); + QGraphicsPixmapItem *pixmapItem = new QGraphicsPixmapItem(pixmap); + mScrollAreaContent->setBackgroundItem(pixmapItem); + + //Note: Progress bar is added to layout when loadStarted signal is handled and + //removed when loadFinished signal is handled + mProgressBar = new HbProgressBar(); + mProgressBar->setRange( 0,100); + mProgressBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + mProgressBar->setVisible(false); + + mWebView = new WlanLoginWebView(); + mContentLayout->addItem(mWebView); + mWebView->page()->setNetworkAccessManager(appRef->engine()->networkAccessManager()); + + //Create tool bar + mToolBar = new HbToolBar(); + mCancelAction = mToolBar->addAction(HbIcon("qtg_mono_exit"),""); + mNextAction = mToolBar->addAction(HbIcon("qtg_mono_arrow_right"),""); + mContinueAction = mToolBar->addAction(HbIcon("qtg_mono_tick"),""); + + setToolBar(mToolBar); + setActiveToolBarAction(Cancel); + + mToolBar->show(); + mWebView->show(); + mScrollArea->show(); + + bool connectStatus = connect( + mWebView, + SIGNAL(loadStarted()), + this, + SLOT(handleLoadStarted())); + Q_ASSERT(connectStatus == true); + + connectStatus = connect( + mWebView, + SIGNAL(loadProgress(int)), + this, + SLOT(handleLoadProgress(int))); + Q_ASSERT(connectStatus == true); + + connectStatus = connect( + mWebView, + SIGNAL(loadFinished(bool)), + this, + SLOT(handleLoadFinished(bool))); + Q_ASSERT(connectStatus == true); + + connectStatus = connect( + mWebView, + SIGNAL(urlChanged(const QUrl&)), + this, + SLOT(handleUrlChanged(const QUrl&))); + Q_ASSERT(connectStatus == true); + + connectStatus = connect( + mWebView->page(), + SIGNAL(formSubmitted()), + this, + SLOT(handleFormSubmitted())); + Q_ASSERT(connectStatus == true); + + connectStatus = connect( + mCancelAction, + SIGNAL(triggered()), + this, + SLOT(handleCancelAction())); + Q_ASSERT(connectStatus == true); + + connectStatus = connect( + mNextAction, + SIGNAL(triggered()), + this, + SLOT(handleNextAction())); + Q_ASSERT(connectStatus == true); + + connectStatus = connect( + mContinueAction, + SIGNAL(triggered()), + this, + SLOT(handleContinueAction())); + Q_ASSERT(connectStatus == true); + + show(); + + OstTraceFunctionExit0(WLANLOGINVIEW_WLANLOGINVIEW_EXIT); +} + + +/*! + Destructor + */ +WlanLoginView::~WlanLoginView() +{ + OstTraceFunctionEntry0(WLANLOGINVIEW_DESTRUCTOR_ENTRY); + + //delete progress bar here as it is not on the layout all the time and + //thus may not have a parent at all. + if (mProgressBar) { + delete mProgressBar; + } + + OstTraceFunctionExit0(WLANLOGINVIEW_DESTRUCTOR_EXIT); +} + + +/*! + This function handles connectionReady signal from engine and starts loading of + provided web page + + @param [in] url URL to be loaded + */ +void WlanLoginView::handleConnectionReady(QUrl url) +{ + OstTraceFunctionEntry0(WLANLOGINVIEW_HANDLECONNECTIONREADY_ENTRY); + + mWebView->load(url); + + OstTraceFunctionExit0(WLANLOGINVIEW_HANDLECONNECTIONREADY_EXIT); +} + + +/*! + This function handles orientationChanged signal + + @param [in] orientation New Orientation of the screen + */ +void WlanLoginView::handleOrientationChanged(Qt::Orientation orientation) +{ + Q_UNUSED(orientation); + OstTraceFunctionEntry0( WLANLOGINVIEW_ORIENTATIONCHANGED_ENTRY ); + + adjustViewSize(); + + OstTraceFunctionEntry0( WLANLOGINVIEW_ORIENTATIONCHANGED_EXIT ); +} + +void WlanLoginView::adjustViewSize() +{ + OstTraceFunctionEntry0( WLANLOGINVIEW_ADJUSTVIEWSIZE_ENTRY ); + + //Store current screen size + QSizeF screenSize = mAppRef->mainWindow()->layoutRect().size(); + + //Store current content size + QSize contentSize = mWebView->page()->mainFrame()->contentsSize(); + + //Set viewPortSize to biggest values of content size or current screen size + QSize newViewPortSize; + if (screenSize.toSize().width() > contentSize.width()) { + newViewPortSize.setWidth(screenSize.toSize().width()); + } else { + newViewPortSize.setWidth(contentSize.width()); + } + + if (screenSize.toSize().height() > contentSize.height()) { + newViewPortSize.setHeight(screenSize.toSize().height()); + } else { + newViewPortSize.setHeight(contentSize.height()); + } + mWebView->page()->setViewportSize(newViewPortSize); + + + //Set Web View size to same size as viewport + mWebView->setMinimumWidth((qreal)newViewPortSize.width()); + mWebView->setMaximumWidth((qreal)newViewPortSize.width()); + mWebView->setPreferredWidth((qreal)newViewPortSize.width()); + + mWebView->setMinimumHeight((qreal)newViewPortSize.height()); + mWebView->setMaximumHeight((qreal)newViewPortSize.height()); + mWebView->setPreferredHeight((qreal)newViewPortSize.height()); + + + //Set preferred content size to current screen size + mWebView->page()->setPreferredContentsSize(mAppRef->mainWindow()->layoutRect().size().toSize()); + + OstTraceFunctionEntry0( WLANLOGINVIEW_ADJUSTVIEWSIZE_EXIT ); +} + + +/*! + This function handles urlChanged signal from QGraphicsWebView + + @param [in] newUrl New URL + */ +void WlanLoginView::handleUrlChanged(const QUrl& newUrl ) +{ + OstTraceFunctionEntry0(WLANLOGINVIEW_HANDLEURLCHANGED_ENTRY); + +#ifdef OST_TRACE_COMPILER_IN_USE + QString url = newUrl.toString(); + TPtrC tmp(url.utf16(),url.length() ); + + OstTraceExt1( + TRACE_NORMAL, + WLANLOGINVIEW_HANDLEURLCHANGED_URL_TRACE, + "WlanLoginEngine::handleUrlChanged;newUrl=%S", + tmp); +#endif + + OstTraceFunctionExit0(WLANLOGINVIEW_HANDLEURLCHANGED_EXIT); +} + + +/*! + This function handles loadStarted signal from QGraphicsWebView + */ +void WlanLoginView::handleLoadStarted() +{ + OstTraceFunctionEntry0(WLANLOGINVIEW_HANDLELOADSTARTED_ENTRY); + + mContentLayout->insertItem(0, mProgressBar); + mProgressBar->setVisible(true); + + OstTraceFunctionExit0(WLANLOGINVIEW_HANDLELOADSTARTED_EXIT); +} + + +/*! + This function handles loadProgress signal from QGraphicsWebView + + @param [in] progressValue Indicates page loading progress: 0..100 + */ +void WlanLoginView::handleLoadProgress(int progressValue) +{ + OstTraceFunctionEntry0(WLANLOGINVIEW_HANDLELOADPROGRESS_ENTRY); + + mProgressBar->setProgressValue(progressValue); + + OstTraceFunctionExit0(WLANLOGINVIEW_HANDLELOADPROGRESS_EXIT); +} + + +/*! + This function handles loadfinished signal from QGraphicsWebView + + @param [in] status Success status + */ +void WlanLoginView::handleLoadFinished(bool status) +{ + OstTraceFunctionEntry0(WLANLOGINVIEW_HANDLELOADFINISHED_ENTRY); + + if(status) + { + adjustViewSize(); + } + + mProgressBar->setVisible(false); + mContentLayout->removeItem(mProgressBar); + + OstTraceFunctionExit0(WLANLOGINVIEW_HANDLELOADFINISHED_EXIT); +} + + +/*! + This function handles formSumitted signal from WlanLoginWebPage + + */ +void WlanLoginView::handleFormSubmitted() +{ + OstTraceFunctionEntry0(WLANLOGINVIEW_HANDLEFORMSUBMITTED_ENTRY); + + //TODO: Check why QWebPage sends this signal to times in a row when user pushes submit button in a web page + + //User has submitted credentials, let's start internet connectivity test + emit startIcts(); + + OstTraceFunctionExit0(WLANLOGINVIEW_HANDLEFORMSUBMITTED_EXIT); +} + + +/*! + This function handles triggered signal from "cancel" button + + */ +void WlanLoginView::handleCancelAction() +{ + OstTraceFunctionEntry0(WLANLOGINVIEW_HANDLECANCELACTION_ENTRY); + + emit cancelTriggered(); + + OstTraceFunctionExit0(WLANLOGINVIEW_HANDLECANCELACTION_EXIT); +} + + +/*! + This function handles triggered signal from "next" button + + */ +void WlanLoginView::handleNextAction() +{ + OstTraceFunctionEntry0(WLANLOGINVIEW_HANDLENEXTACTION_ENTRY); + + emit nextTriggered(); + + //Change toolabr action to "Continue" as we are going to background + setActiveToolBarAction(Continue); + + OstTraceFunctionExit0(WLANLOGINVIEW_HANDLENEXTACTION_EXIT); +} + + +/*! + This function handles triggered signal from "continue" button + + */ +void WlanLoginView::handleContinueAction() +{ + OstTraceFunctionEntry0(WLANLOGINVIEW_HANDLECONTINUEACTION_ENTRY); + + emit continueTriggered(); + + OstTraceFunctionExit0(WLANLOGINVIEW_HANDLECONTINUEACTION_EXIT); +} + + +/*! + This function handles ictsOk signal from engine + + */ +void WlanLoginView::handleIctsOk() +{ + OstTraceFunctionEntry0(WLANLOGINVIEW_HANDLEICTSRESULT_ENTRY); + + setActiveToolBarAction(Next); + + OstTraceFunctionExit0(WLANLOGINVIEW_HANDLEICTSRESULT_EXIT); +} + +/*! + This function sets active action to the toolbar and hides other actions + + @param [in] newAction Action to be set to toolbar + */ +void WlanLoginView::setActiveToolBarAction(ActionType newAction) +{ + OstTraceFunctionEntry0( WLANLOGINVIEW_SETACTIVETOOLBARACTION_ENTRY ); + + switch (newAction) { + case Cancel: + mNextAction->setEnabled(false); + mNextAction->setVisible(false); + + mContinueAction->setEnabled(false); + mContinueAction->setVisible(false); + + mCancelAction->setVisible(true); + mCancelAction->setEnabled(true); + break; + + case Next: + mCancelAction->setEnabled(false); + mCancelAction->setVisible(false); + + mContinueAction->setEnabled(false); + mContinueAction->setVisible(false); + + mNextAction->setVisible(true); + mNextAction->setEnabled(true); + break; + + case Continue: + mCancelAction->setEnabled(false); + mCancelAction->setVisible(false); + + mNextAction->setEnabled(false); + mNextAction->setVisible(false); + + mContinueAction->setVisible(true); + mContinueAction->setEnabled(true); + break; + + default: + break; + + } + + OstTraceFunctionExit0( WLANLOGINVIEW_SETACTIVETOOLBARACTION_EXIT ); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/src/wlanloginwebpage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginwebpage.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +// System includes +#include +#include +#include + +// User includes +#include "wlanloginwebpage.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanloginwebpageTraces.h" +#endif + +/*! + \class WlanLoginWebPage + \brief WLAN Login web page class implementation. +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +/*! + Constructor. + */ +WlanLoginWebPage::WlanLoginWebPage(QObject *parent): QWebPage(parent) +{ + OstTraceFunctionEntry0( WLANLOGINWEBPAGE_WLANLOGINWEBPAGE_ENTRY ); + + //Hide scrollbars + mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff ); + mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff ); + + setContentEditable(false); + + OstTraceFunctionExit0( WLANLOGINWEBPAGE_WLANLOGINWEBPAGE_EXIT ); +} + + +WlanLoginWebPage::~WlanLoginWebPage() +{ + OstTraceFunctionEntry0( WLANLOGINWEBPAGE_DESTRUCTOR_ENTRY ); + + OstTraceFunctionExit0( WLANLOGINWEBPAGE_DESTRUCTOR_EXIT ); +} + + +/*! + This function checks navigation events. This was rewritten as we needed + indication to login view when user has submitted the password and user name. That + corresponds to value QWebPage::NavigationTypeFormSubmitted. This triggers starting of + internet connectivity test. + + @param [in] frame + @param [in] request + @param [in] type + */ +bool WlanLoginWebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type) +{ + OstTraceFunctionEntry0( WLANLOGINWEBPAGE_ACCEPTNAVIGATIONREQUEST_ENTRY ); + + if (type== QWebPage::NavigationTypeFormSubmitted) { + + OstTrace0( + TRACE_BORDER, + WLANLOGINWEBPAGE_ACCEPTNAVIGATIONREQUEST_EMITTING_TRACE, + "WlanLoginWebPage::acceptNavigationRequest emitting formSubmitted() signal"); + + emit formSubmitted(); + } + + OstTraceFunctionExit0( WLANLOGINWEBPAGE_ACCEPTNAVIGATIONREQUEST_EXIT ); + + return QWebPage::acceptNavigationRequest(frame,request,type); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/src/wlanloginwebview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginwebview.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// System includes +#include + +// User includes +#include "wlanloginwebview.h" +#include "wlanloginwebpage.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanloginwebviewTraces.h" +#endif + +/*! + \class WlanLoginWebView + \brief WLAN Login web view class implementation. +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor + */ +WlanLoginWebView::WlanLoginWebView(QGraphicsWidget* parent): + QGraphicsWebView(parent), + mWebPage(NULL), + mMousePressed(false) +{ + OstTraceFunctionEntry0( WLANLOGINWEBVIEW_WLANLOGINWEBVIEW_ENTRY ); + + installEventFilter(this); //Event filter for preventing text selection when scrolling + + mWebPage = new WlanLoginWebPage(this); + setPage(mWebPage); + setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + + OstTraceFunctionExit0( WLANLOGINWEBVIEW_WLANLOGINWEBVIEW_EXIT ); +} + + +/*! + Destructor + + */ +WlanLoginWebView::~WlanLoginWebView() +{ + OstTraceFunctionEntry0( WLANLOGINWEBVIEW_DESTRUCTOR_ENTRY ); + OstTraceFunctionExit0( WLANLOGINWEBVIEW_DESTRUCTOR_EXIT ); +} + +/*! + This eventfilter filters QEvent::GraphicsSceneMouseMove events from Web View while + mouse (finger) is pressed down. If filtering is not done it causes text selection on + the web page when page is scrolled with finger. + + @param [in] event Pointer to received event + + */ +bool WlanLoginWebView::eventFilter(QObject *, QEvent *event) +{ + switch (event->type()) { + case QEvent::GraphicsSceneMousePress: + mMousePressed = true; + break; + case QEvent::GraphicsSceneMouseRelease: + mMousePressed = false; + break; + case QEvent::GraphicsSceneMouseMove: + if (mMousePressed) + return true; + break; + default: + break; + } + return false; +} + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/traces/OstTraceDefinitions.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for OST traces +* +*/ + +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +#include +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanlogin/wlanloginapp/wlanloginapp.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/wlanloginapp.pro Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,77 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# Project file for WLAN Login application. +# + +TEMPLATE = app +TARGET = wlanlogin +DEPENDPATH += . +INCLUDEPATH += \ + . \ + /epoc32/include/mw \ + ../inc \ + ../../inc + +LIBS += -lxqservice -lxqserviceutil -lictsqtwrapper -lqtsysteminfo + +CONFIG += hb service mobility +MOBILITY += bearer + +QT += \ + core \ + network \ + webkit + +#Store generated .moc files to their own directory +MOC_DIR = build + +# Input +SOURCES += \ + src/main.cpp \ + src/wlanloginapplication.cpp \ + src/wlanloginengine.cpp \ + src/wlanloginmainwindow.cpp \ + src/wlanloginnetworkaccessmanager.cpp \ + src/wlanloginservice.cpp \ + src/wlanloginview.cpp \ + src/wlanloginwebpage.cpp \ + src/wlanloginwebview.cpp + +HEADERS += \ + inc/wlanloginapplication.h \ + inc/wlanloginengine.h \ + inc/wlanloginmainwindow.h \ + inc/wlanloginnetworkaccessmanager.h \ + inc/wlanloginservice.h \ + inc/wlanloginview.h \ + inc/wlanloginwebpage.h \ + inc/wlanloginwebview.h \ + traces/OstTraceDefinitions.h + +TRANSLATIONS = wlanlogin.ts + +SERVICE.FILE = res/service_conf.xml + +# Temporary solution to fix tracecompiler +# When tracecompiler is fixed, this can be removed +MMP_RULES += "USERINCLUDE traces" + +symbian*: { + LIBS += -lictsclientinterface + TARGET.UID3 = 0x2002E6D0 + TARGET.CAPABILITY = CAP_APPLICATION NetworkControl + BLD_INF_RULES.prj_exports += "rom/wlanlogin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wlanlogin.iby)" + BLD_INF_RULES.prj_exports += "rom/wlanlogin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(wlanlogin_resources.iby)" +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/base/inc/wlanqtutils.h --- a/wlanutilities/wlanqtutilities/base/inc/wlanqtutils.h Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanqtutilities/base/inc/wlanqtutils.h Thu Jul 22 16:44:32 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -12,151 +12,193 @@ * Contributors: * * Description: +* WLAN Qt Utilities interface. */ #ifndef WLANQTUTILS_H #define WLANQTUTILS_H -#include +// System includes -#include "wlanqtutilscommon.h" +#include +#include +#include + +// User includes + +// Forward declarations class WlanQtUtilsIap; -class WlanQtUtilsWlanIap; -class WlanQtUtilsWlanAp; +class WlanQtUtilsAp; class WlanQtUtilsPrivate; -const int WlanQtUtilsInvalidIapId = -1; +// External data types + +// Constants -/** - * Wlan Qt Utilities. - * - * This class provides a Qt API to UI components for retrieving different kind of information - * related to WLAN functionality. - */ -class WLANQTUTILITIESDLL_EXPORT WlanQtUtils : public QObject +//! Library interface export macro +#ifdef BUILD_WLANQTUTILITIES_DLL +#define WLANQTUTILS_EXPORT Q_DECL_EXPORT +#else +#define WLANQTUTILS_EXPORT Q_DECL_IMPORT +#endif + +// Class declaration + +class WLANQTUTILS_EXPORT WlanQtUtils : public QObject { Q_OBJECT public: + + // Data types + + //! "None" IAP ID value (e.g. for "not found" cases) + static const int IapIdNone = -1; + + /*! + WLAN connection status. + Remember to update traces/trace.properties when modifying this enum. + */ + enum ConnStatus { + ConnStatusNone = 0, //!< Reserved. + ConnStatusConnecting, //!< Connecting. + ConnStatusConnected, //!< Connected. + ConnStatusDisconnected //!< Disconnected. + }; - /** - * Constructor. - */ + /*! + WLAN scan status + Remember to update traces/trace.properties when modifying this enum. + */ + enum ScanStatus { + ScanStatusOk = 0, //!< Scan succeeded. + ScanStatusCancelled, //!< Scan was cancelled. + ScanStatusError //!< Scan failed. + }; + + /*! + Internet Connectivity Test status. + Remember to update traces/trace.properties when modifying this enum. + */ + enum IctStatus { + IctPassed = 0, //!< Normal ICT passed. + IctHotspotPassed, //!< Hotspot ICT passed. + IctCancelled, //!< ICT was cancelled. + IctFailed //!< ICT failed. + }; + WlanQtUtils(); - /** - * Destructor. - */ ~WlanQtUtils(); - /** - * Function to request details of available WLAN networks. Can be called at any time, calling right - * after wlanScanReady() signal ensures you get the most recent results. - * - * @param[out] wlanIapList List of available WLAN IAPs. - * @param[out] wlanApList List of unknown WLAN APs. - */ - void availableWlanAps( - QList &wlanIapList, - QList &wlanApList); + void scanWlans(); + + void scanWlanAps(); + + void scanWlanDirect(const QString &ssid); + + void stopWlanScan(); + + void availableWlans( + QList< QSharedPointer > &wlanIapList, + QList< QSharedPointer > &wlanApList) const; - /** - * Function to create an IAP from the given WLAN access point. - * - * @param[in] wlanAp Access point containing parameters to include in the new IAP. - * @return ID of the newly created IAP. - */ - int createWlanIap(const WlanQtUtilsWlanAp *wlanAp); + void availableWlanAps( + QList< QSharedPointer > &wlanApList) const; + + int createIap(const WlanQtUtilsAp *wlanAp); - /** - * Function to start connection creation for the given IAP. connectionStatus() signal will be emitted - * when connection creation succeeds or fails. - * - * @param[in] iapId ID of the IAP to be connected. - */ - void connectIap(int iapId); + bool updateIap(int iapId, const WlanQtUtilsAp *wlanAp); - /** - * Function to disconnect the given IAP. - * - * @param[in] iapId ID of the IAP to be disconnected. - */ + void deleteIap(int iapId); + + void connectIap(int iapId, bool runIct = false); + void disconnectIap(int iapId); - /** - * Function to retrieve a pointer to the IAP with the given ID. - * - * @param[in] iapId ID of the requested IAP. - * @return Pointer to the found IAP, NULL if not found. - */ - WlanQtUtilsIap *iap(int iapId) const; + ConnStatus connectionStatus() const; + + int activeIap() const; + + QString iapName(int iapId) const; + +signals: + + /*! + Signal indicating that WLAN scan is complete when scanning + is requested with scanWlans() method. + + @param [in] status Scan status code (ScanStatus). + */ + void wlanScanReady(int status); - /** - * Function for getting the master WLAN status. - * - * @return Master WLAN status: true if enabled, otherwise false. - */ - bool masterWlan() const; + /*! + Signal indicating that WLAN scan is complete when scanning + is requested with scanWlanAps() method. + + @param [in] status Scan status code (ScanStatus). + */ + void wlanScanApReady(int status); - /** - * Function for switching the master WLAN status ON or OFF. - * - * @param[in] enabled If set to true, WLAN is switched ON, and vice versa. - */ - void setMasterWlan(bool enabled); + /*! + Signal indicating that WLAN scan is complete when scanning + is requested with scanWlanDirect() method. + + @param [in] status Scan status code (ScanStatus). + */ + void wlanScanDirectReady(int status); - /** - * Function for getting the ID of the (possibly) connected WLAN IAP. - * - * @return ID of the connected IAP, WlanQtUtilsInvalidIapId if not valid. - */ - int connectedWlanId() const; + /*! + Signal indicating that new WLAN network has been opened. - /** - * Function for requesting a WLAN scan to be triggered. Currently triggers - * only a single scan, but can be extended to perform also periodic scans, - * if needed in the future. - * - * Signal wlanScanReady() is emitted when new scan results are available. - */ - void scanWlans(); - -signals: - - /** - * Signal indicating that WLAN scan results are available. - */ - void wlanScanReady(); - - /** - * Signal indicating that new WLAN network has been opened. - * - * @param[in] iapId ID of the opened IAP. - */ + @param [in] iapId ID of the opened IAP. + */ void wlanNetworkOpened(int iapId); + + /*! + Signal indicating that a WLAN network has been closed. - /** - * Signal indicating that a WLAN network has been closed. - * - * @param[in] iapId ID of the closed IAP. - */ - void wlanNetworkClosed(int iapId); + @param [in] iapId ID of the closed IAP. + @param [in] reason RConnection::Start() error code. + This is the reason of the closure if user requested + connection creation and it failed. + Otherwise KErrNone. + */ + void wlanNetworkClosed(int iapId, int reason); + + /*! + Signal indicating result of finished ICT run. - /** - * Signal indicating that the WLAN master status has changed. - */ - void masterWlanStatus(bool enabled); + @param [in] iapId ID of IAP ICT was run for. + @param [in] result IctPassed: Normal ICT passed, + IctHotspotPassed: Hotspot ICT passed, + IctCancelled: ICT was cancelled, + IctFailed: ICT failed + */ + void ictResult(int iapId, int result); -private: // Data +public slots: + +protected: + +protected slots: - /** Pointer to private implementation */ - WlanQtUtilsPrivate *d_ptr; +private: + + Q_DISABLE_COPY(WlanQtUtils) + +private slots: + +private: // data -private: // Friend classes + //! Pointer to private implementation + QScopedPointer d_ptr; - // This is defined as a friend class in order to be able to emit public signals - // directly from private implementation code. + // Friend classes + + // This is defined as a friend class in order to be able to emit public + // signals directly from private implementation code. friend class WlanQtUtilsPrivate; // This is defined as a friend class in order to be able to @@ -164,6 +206,4 @@ friend class TestWlanQtUtils; }; -#endif /* WLANQTUTILS_H */ - -// End of File +#endif // WLANQTUTILS_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/base/inc/wlanqtutils_p.h --- a/wlanutilities/wlanqtutilities/base/inc/wlanqtutils_p.h Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanqtutilities/base/inc/wlanqtutils_p.h Thu Jul 22 16:44:32 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -12,228 +12,176 @@ * Contributors: * * Description: +* WLAN Qt Utilities private implementation interface. */ #ifndef WLANQTUTILS_P_H #define WLANQTUTILS_P_H +// System includes + #include -#include +#include +#include + +// User includes -#include "wlanqtutilscommon.h" +#include "wlanqtutils.h" +#include "ictswlanlogininterface.h" + +// Forward declarations class WlanQtUtils; class WlanQtUtilsIap; -class WlanQtUtilsWlanIap; -class WlanQtUtilsWlanAp; -class WlanQtUtilsActiveConn; -class ConMonWrapper; -class CmmWrapper; -class EsockWrapper; -class ConnTestWrapper; +class WlanQtUtilsAp; +class WlanQtUtilsConnection; +class WlanQtUtilsIapSettings; +class WlanQtUtilsConMonWrapper; +class WlanQtUtilsEsockWrapper; +class WlanQtUtilsScan; -/** - * Private implementation of Wlan Qt Utilities. - */ +// External data types + +// Constants + +// Class declaration + class WlanQtUtilsPrivate : public QObject { Q_OBJECT public: - - /** - * Constructor. - */ - WlanQtUtilsPrivate(WlanQtUtils *publicPtr); - - /** - * Destructor. - */ - ~WlanQtUtilsPrivate(); + + // Data types - // Functions duplicating WlanQtUtils public interface - - /** - * Function to request details of available WLAN networks. Can be called at any time, calling right - * after wlanScanReady() signal ensures you get the most recent results. - * - * @param[out] wlanIapList List of available WLAN IAPs. - * @param[out] wlanApList List of unknown WLAN APs. - */ - void availableWlanAps( - QList &wlanIapList, - QList &wlanApList); + explicit WlanQtUtilsPrivate(WlanQtUtils *q_ptr); - /** - * Function to create an IAP from the given WLAN access point. - * - * @param[in] wlanAp Access point containing parameters to include in the new IAP. - * @return ID of the newly created IAP. - */ - int createWlanIap(const WlanQtUtilsWlanAp *wlanAp); - - /** - * Function to start connection creation for the given IAP. connectionStatus() signal will be emitted - * when connection creation succeeds or fails. - * - * @param[in] iapId ID of the IAP to be connected. - */ - void connectIap(int iapId); + virtual ~WlanQtUtilsPrivate(); - /** - * Function to disconnect the given IAP. - * - * @param[in] iapId ID of the IAP to be disconnected. - */ - void disconnectIap(int iapId); - - /** - * Function to retrieve a pointer to the IAP with the given ID. - * - * @param[in] iapId ID of the requested IAP. - * @return Pointer to the found IAP, NULL if not found. - */ - WlanQtUtilsIap *iap(int iapId) const; - - /** - * Function for getting the master WLAN status. - * - * @return Master WLAN status: true if enabled, otherwise false. - */ - bool masterWlan() const; - - /** - * Function for switching the master WLAN status ON or OFF. - * - * @param[in] enabled If set to true, WLAN is switched ON, and vice versa. - */ - void setMasterWlan(bool enabled); - - /** - * Function for getting the ID of the (possibly) connected WLAN IAP. - * - * @return ID of the connected IAP, WlanQtUtilsInvalidIapId if not valid. - */ - int connectedWlanId() const; - - /** - * Function for requesting a WLAN scan to be triggered. Currently triggers - * only a single scan, but can be extended to perform also periodic scans, - * if needed in the future. - * - * Signal wlanScanReady() is emitted when new scan results are available. - */ void scanWlans(); + void scanWlanAps(); + + void scanWlanDirect(const QString &ssid); + + void stopWlanScan(); + + void availableWlans( + QList< QSharedPointer > &wlanIapList, + QList< QSharedPointer > &wlanApList) const; + + void availableWlanAps( + QList< QSharedPointer > &wlanApList) const; + + int createIap(const WlanQtUtilsAp *wlanAp); + + bool updateIap(int iapId, const WlanQtUtilsAp *wlanAp); + + void deleteIap(int iapId); + + void connectIap(int iapId, bool runIct); + + void disconnectIap(int iapId); + + WlanQtUtils::ConnStatus connectionStatus() const; + + int activeIap() const; + + QString iapName(int iapId) const; + +signals: + +public slots: + +protected: + +protected slots: + +private: + + Q_DISABLE_COPY(WlanQtUtilsPrivate) + + bool wlanIapExists( + const QList< QSharedPointer > list, + const WlanQtUtilsAp *ap) const; + + void traceIapsAndAps( + const QList< QSharedPointer > &iaps, + const QList< QSharedPointer > &aps) const; + private slots: - /** - * Slot for handling WLAN scan result event from wrapper. Results are stored in member variable - * (possible duplicates are removed). - * - * @param[in] availableWlans WLAN networks found in scan. - */ - void updateAvailableWlanAps(QList &availableWlans); - - /** - * Slot for handling connection setup status event from wrapper. - * - * @param[in] isOpened Was connection setup successful? - */ + void updateAvailableWlanAps( + QList< QSharedPointer > &availableWlans); + + void reportScanResult(int status); + void updateConnectionStatus(bool isOpened); - - /** - * Slot for handling connectivity test result event from wrapper. Tested IAP is stored to - * Internet SNAP, if test was successful. - * - * @param[in] result Was the test successful? - */ - void updateConnectivityTestResult(bool result); - /** - * Slot for updating active connection status from wrapper. - * - * @param[in] connectionId ID of the new connection. - */ void addActiveConnection(uint connectionId); - /** - * Slot for updating active connection status from wrapper. - * - * @param[in] connectionId ID of the deleted connection. - */ void removeActiveConnection(uint connectionId); - /** - * Slot for updating active connection status from wrapper. - * - * @param[in] connectionId ID of the updated connection. - * @param[in] connectionStatus New status of the connection. - */ - void updateActiveConnection(uint connectionId, WlanQtUtilsConnectionStatus connectionStatus); - -private: + void updateActiveConnection( + uint connectionId, + WlanQtUtils::ConnStatus connectionStatus); - int fetchIaps(); + void updateIctResult(int ictsResult); - /** - * This function searches for a WLAN IAP with the given WLAN parameters. - * - * @param[in] ssid SSID to search for. - * @param[in] secMode Security mode to search for. - * @return True, if suitable WLAN IAP found, false otherwise. - */ - bool wlanIapExists(QString ssid, WlanQtUtilsWlanSecMode secMode); + void updateIctHotspotCase(); + +private: // data - /** - * This function updates the connection status of: - * - IAP with the given ID - * - all other IAPs, which represent the same network (SSID & security mode match) - * - * @param[in] iapId ID of the IAP whose status is to be updated. - * @param[in] status Updated connection status. - */ - void updateIapConnectionStatuses(int iapId, WlanQtUtilsConnectionStatus status); + //! Current scan mode + enum ScanMode { + ScanModeNone = 0, //!< No scan active + ScanModeAvailableWlans, //!< Available AP's & IAPS + ScanModeAvailableWlanAps, //!< Available AP's + ScanModeDirect //!< Direct SSID scan + }; + + // Not owned data -private: // Data + //! Pointer to public implementation. + WlanQtUtils *q_ptr; + + // Owned data + + //! Iap settings handler. + WlanQtUtilsIapSettings *mSettings; - /** Pointer to public implementation */ - WlanQtUtils *q_ptr; - - /** Wrapper object for Connection Method Manager. */ - CmmWrapper *cmmWrapper_; + //! Wrapper object for Connection Monitor and other parts of connmon library. + WlanQtUtilsConMonWrapper *mConMonWrapper; + + //! Wrapper object for WLAN scanning. + WlanQtUtilsScan *mScanWrapper; - /** Wrapper object for Connection Monitor and other parts of connmon library. */ - ConMonWrapper *conMonWrapper_; - - /** Wrapper object for esock library. */ - EsockWrapper *esockWrapper_; + //! Wrapper object for esock library. + WlanQtUtilsEsockWrapper *mEsockWrapper; - /** Wrapper object for Internet Connectivity Test library. */ - ConnTestWrapper *connTestWrapper_; + //! Instance of Icts Wlan Login Interface. + QSharedPointer mIctService; - /** List of available WLAN APs according to the latest scan. */ - QList wlanScanList_; + //! Current WLAN scan mode. + ScanMode mScanMode; - /** List of WLAN IAPs configured to the device. */ - QMap wlanIapList_; - - /** ID of IAP requiring ICT running, -1 if not valid. */ - int toBeTestedIapId_; + //! List of available WLAN APs according to the latest scan. + QList< QSharedPointer > mWlanScanList; + + //! ID of IAP requiring ICT running, IapIdNone if not valid. + int mToBeTestedIapId; - /** ID of IAP being connected by us (requested by UI), -1 if not valid. */ - int connectingIapId_; + //! ID of IAP being connected by us (requested by UI), IapIdNone if not valid. + int mConnectingIapId; - /** Information of possible active connection. */ - WlanQtUtilsActiveConn *activeConnection_; + //! Information of possible active connection. + QSharedPointer mConnection; + + // Friend classes -private: // Friend classes - // This is defined as a friend class in order to be able to // call event handlers of wrappers from test code. friend class TestWlanQtUtils; }; -#endif /* WLANQTUTILS_P_H */ - -// End of File +#endif // WLANQTUTILS_P_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/base/inc/wlanqtutilsactiveconn.h --- a/wlanutilities/wlanqtutilities/base/inc/wlanqtutilsactiveconn.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This is the header file for WlanQtUtilsActiveConn class. -*/ - -#ifndef WLANQTUTILSACTIVECONN_H -#define WLANQTUTILSACTIVECONN_H - -#include -#include "wlanqtutilscommon.h" - - -/** - * This class represents an active connection. - * TODO: consider deriving own classes for WLAN and Cellular connections. - * Still, we can keep the same interface and avoid dynamic_casts. - */ -class WlanQtUtilsActiveConn : public QObject -{ -public: - - /** - * Constructor. - */ - WlanQtUtilsActiveConn(); - - /** - * Destructor. - */ - virtual ~WlanQtUtilsActiveConn(); - - /** - * Getter. - * - * @return Connection ID specific for Connection Monitor Server. - */ - uint connectionId() const; - - /** - * Setter. - * - * @param[in] connectionId Connection ID specific for Connection Monitor Server. - */ - void setConnectionId(uint connectionId); - - /** - * Getter. - * - * @return IAP ID. - */ - uint iapId() const; - - /** - * Setter. - * - * @param[in] iapId IAP ID. - */ - void setIapId(uint iapId); - - /** - * Getter. - * - * @return Status of the connection. - */ - WlanQtUtilsConnectionStatus connectionStatus() const; - - /** - * Setter. - * - * @param[in] connectionStatus Status of the connection. - */ - void setConnectionStatus(WlanQtUtilsConnectionStatus connectionStatus); - - /** - * Getter. - * - * @return Bearer type. - */ - WlanQtUtilsBearerType bearerType() const; - - /** - * Setter. - * - * @param[in] bearerType Bearer type. - */ - void setBearerType(WlanQtUtilsBearerType bearerType); - -private: // Data - - /** Connection Monitor Server specific connection ID. */ - uint connectionId_; - /** IAP ID. */ - uint iapId_; - - /** Connection status. */ - WlanQtUtilsConnectionStatus connectionStatus_; - /** Bearer type. */ - WlanQtUtilsBearerType bearerType_; -}; - -#endif /* WLANQTUTILSACTIVECONN_H */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/base/inc/wlanqtutilsap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/base/inc/wlanqtutilsap.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,177 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN AP (Access Point, unknown network) class. +*/ + +#ifndef WLANQTUTILSAP_H +#define WLANQTUTILSAP_H + +// System includes + +#include +#include +#include +#include + +// User includes + +// Forward declarations + +class WlanQtUtilsApPrivate; + +// External data types + +// Constants + +//! Library interface export macro +#ifdef BUILD_WLANQTUTILITIES_DLL +#define WLANQTUTILSAP_EXPORT Q_DECL_EXPORT +#else +#define WLANQTUTILSAP_EXPORT Q_DECL_IMPORT +#endif + +// Class declaration + +class WLANQTUTILSAP_EXPORT WlanQtUtilsAp +{ + +public: + + // Data types + + /*! + Configuration IDs that can be read and set in this class. + Remember to update traces/trace.properties file when modifying + this enum (tracing is also the cause for fixing the enum values). + + ConfID's available for scan results: + - ConfIdSsid + - ConfIdBssid + - ConfIdSignalStrength + - ConfIdConnectionMode + - ConfIdSecurityMode + - ConfIdWpaPskUse + - ConfIdWpsSupported + + ConfID's for IAP creation and updates, these are + mandatory for all security modes: + - ConfIdSsid + - ConfIdConnectionMode + - ConfIdSecurityMode + - ConfIdWepKey1 (Empty if not used) + - ConfIdWepKey2 (Empty if not used) + - ConfIdWepKey3 (Empty if not used) + - ConfIdWepKey4 (Empty if not used) + - ConfIdWepDefaultIndex + - ConfIdWpaPskUse + - ConfIdWpaPsk (Empty if not used) + - ConfIdHidden + */ + enum ConfId { + //! QString: WLAN Network Name (SSID) + ConfIdSsid = 0, + //! QByteArray: Basic Service Set Identifier + ConfIdBssid = 1, + //! int: signal strength in RSSI (dBm) + ConfIdSignalStrength = 2, + //! int: (CMManagerShim::WlanNetMode) + ConfIdConnectionMode = 3, + //! int: (CMManagerShim::WlanSecMode) + ConfIdSecurityMode = 4, + //! bool: true - WPA PSK, false - WPA EAP + ConfIdWpaPskUse = 5, + //! QString: Pre-Shared Key for WPA + //! Length: 8-63 - Ascii key + //! Length: 64 - Hex key + ConfIdWpaPsk = 6, + //! QString: WEP Key for index 1: + //! HEX: + //! - 64 bit: allowed key length = 10 + //! - 128 bit: allowed key length = 26 + //! + //! ASCII: + //! - 64 bit: allowed key length = 5 + //! - 128 bit: allowed key length = 13 + ConfIdWepKey1 = 7, + //! QString: WEP Key for index 2 + ConfIdWepKey2 = 8, + //! QString: WEP Key for index 3 + ConfIdWepKey3 = 9, + //! QString: WEP Key for index 4 + ConfIdWepKey4 = 10, + //! int: (CMManagerShim::WlanWepKeyIndex): Default WEP Key index + ConfIdWepDefaultIndex = 11, + //! bool: Is WLAN hidden (CMManager::ECmHidden). + ConfIdHidden = 12, + //! bool: true - Wifi Protected setup is supported, false - not + ConfIdWpsSupported = 13 + }; + + /*! + Function pointer type for string comparison operation customization. + Used for AP comparison in \a compare. + + @param [in] string1 String #1 to compare. + @param [in] string2 String #2 to compare. + + @return Zero (0), if strings are considered to be same, + Positive (>0) if string1 is considered to be "greater than" string2. + Negative (<0) if string1 is considered to be "less than" string2. + */ + typedef int (*StringComparator)( + const QString &string1, + const QString &string2); + + WlanQtUtilsAp(); + + WlanQtUtilsAp(const WlanQtUtilsAp &ref); + + virtual ~WlanQtUtilsAp(); + + QVariant value(int identifier) const; + + void setValue(int identifier, QVariant value); + + static int compare( + const WlanQtUtilsAp *ap1, + const WlanQtUtilsAp *ap2, + StringComparator comparator = 0); + +signals: + +public slots: + +protected: + +protected slots: + +private: + + // Disabling implicit assignment operator + WlanQtUtilsAp &operator=(const WlanQtUtilsAp &); + +private slots: + +private: // data + + QScopedPointer d_ptr; //!< Private implementation + + // Friend classes +}; + +// Metatype support is needed since we use this class with QVariant +Q_DECLARE_METATYPE(WlanQtUtilsAp) + +#endif // WLANQTUTILSAP_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/base/inc/wlanqtutilscommon.h --- a/wlanutilities/wlanqtutilities/base/inc/wlanqtutilscommon.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef WLANQTUTILSCOMMON_H -#define WLANQTUTILSCOMMON_H - -#ifdef BUILD_WLANQTUTILITIES_DLL -#define WLANQTUTILITIESDLL_EXPORT Q_DECL_EXPORT -#else -#define WLANQTUTILITIESDLL_EXPORT Q_DECL_IMPORT -#endif - -// Maximum length of WLAN SSID (limit also for number of characters for user input) -static const int KMaxSsidLen = 32; -// Maximum length of WEP key -static const int KMaxWEPKeyLen = 64; -// Maximum length of WPA key -static const int KMaxWPAKeyLen = 256; - -/** - * Bearer type. - */ -enum WlanQtUtilsBearerType { - WlanQtUtilsBearerTypeNone = 0, ///< None of the bearer types. - WlanQtUtilsBearerTypeCellular , ///< Cellular (2G, 3G, 3.5G) bearer type. - WlanQtUtilsBearerTypeWlan ///< WLAN bearer type. -}; - -/** - * Connection status. - */ -enum WlanQtUtilsConnectionStatus { - WlanQtUtilsConnectionStatusNone = 0, ///< None of the connection statuses. - WlanQtUtilsConnectionStatusConnecting, ///< Connecting. - WlanQtUtilsConnectionStatusConnected, ///< Connected. - WlanQtUtilsConnectionStatusDisconnected ///< Disconnected. -}; - -/** - * Signal strength category boundaries in dB (absolute value). - * Smaller value means better signal. - */ -// TODO: WLAN signal level values valid are copied from 08wk41 Sniffer. OK? -// (WINS emulator gives just 0 which is equal to "Absolute max"...) -enum -{ - WlanQtUtilsWlanSignalStrengthAbsoluteMax = 0, ///< Absolute maximum signal strength. - WlanQtUtilsWlanSignalStrengthMax = 60, ///< Maximum signal strength. - WlanQtUtilsWlanSignalStrengthGood = 74, ///< Good signal strength. - WlanQtUtilsWlanSignalStrengthLow = 87, ///< signal strength. - WlanQtUtilsWlanSignalStrengthMin = 100, ///< Minimum signal strength. - WlanQtUtilsWlanSignalUnavailable = 9999, ///< Signal is unavailable. -}; - -/** WLAN signal is unknown. */ -const int WlanQtUtilsWlanSignalUnknown = 1000000; - -/** WLAN transmit power is unknown. */ -const unsigned WlanQtUtilsWlanTransmitPowerUnknown = 0xFFFFFFFF; - -/** - * WLAN security modes. - * Mapping functions exist for reading and writing these values - * from / to ConnMon and CMM. - */ -enum WlanQtUtilsWlanSecMode -{ - WlanQtUtilsWlanSecModeNone = 100, ///< None of the security modes. - WlanQtUtilsWlanSecModeOpen = 101, ///< Open security mode. - WlanQtUtilsWlanSecModeWep = 102, ///< WEP security mode. - WlanQtUtilsWlanSecMode802_1x = 103, ///< 802.1x security mode. - WlanQtUtilsWlanSecModeWpa = 104, ///< WPA security mode. - WlanQtUtilsWlanSecModeWpa2 = 105 ///< WPA@ security mode. -}; - -/** - * WLAN connection modes. - */ -enum WlanQtUtilsWlanConnMode -{ - WlanQtUtilsWlanConnModeNone = 200, ///< None of the connection modes. - WlanQtUtilsWlanConnModeInfraStructure = 201, ///< Infrastructure connection mode. - WlanQtUtilsWlanConnModeAdHoc = 202, ///< Adhoc connection mode. - WlanQtUtilsWlanConnModeSecureInfra = 203, ///< Secure infrastructure connection mode.´ -}; - -#endif // WLANQTUTILSCOMMON_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/base/inc/wlanqtutilsconnection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/base/inc/wlanqtutilsconnection.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Qt Utilities WLAN connection status handler. +*/ + +#ifndef WLANQTUTILSCONNECTION_H +#define WLANQTUTILSCONNECTION_H + +// System includes + +#include + +// User includes + +#include "wlanqtutils.h" + +// Forward declarations + +// External data types + +// Constants + +// Class declaration + +class WlanQtUtilsConnection +{ + +public: + + // Data types + + WlanQtUtilsConnection(); + + virtual ~WlanQtUtilsConnection(); + + uint connectionId() const; + + void setConnectionId(uint connectionId); + + uint iapId() const; + + void setIapId(uint iapId); + + WlanQtUtils::ConnStatus connectionStatus() const; + + void setConnectionStatus( + WlanQtUtils::ConnStatus connectionStatus); + +signals: + +public slots: + +protected: + +protected slots: + +private: + +private slots: + +private: // data + + //! Connection Monitor Server specific connection ID. + uint mConnectionId; + + //! IAP ID. + uint mIapId; + + //! Connection status. + WlanQtUtils::ConnStatus mConnectionStatus; + + // Friend classes +}; + +#endif // WLANQTUTILSCONNECTION_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/base/inc/wlanqtutilsiap.h --- a/wlanutilities/wlanqtutilities/base/inc/wlanqtutilsiap.h Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanqtutilities/base/inc/wlanqtutilsiap.h Thu Jul 22 16:44:32 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -12,49 +12,94 @@ * Contributors: * * Description: -* This is a header file for WlanQtUtilsIap class. +* WLAN IAP (Internet Access Point, known network) class. */ #ifndef WLANQTUTILSIAP_H #define WLANQTUTILSIAP_H -#include -#include "wlanqtutilscommon.h" +// System includes + +#include + +// User includes + +#include "wlanqtutilsap.h" + +// Forward declarations + +class WlanQtUtilsIapPrivate; + +// External data types -class QString; +// Constants -class WLANQTUTILITIESDLL_EXPORT WlanQtUtilsIap : public QObject +//! Library interface export macro +#ifdef BUILD_WLANQTUTILITIES_DLL +#define WLANQTUTILSIAP_EXPORT Q_DECL_EXPORT +#else +#define WLANQTUTILSIAP_EXPORT Q_DECL_IMPORT +#endif + +// Class declaration + +class WLANQTUTILSIAP_EXPORT WlanQtUtilsIap : public WlanQtUtilsAp { - + public: + // Data types + + /*! + Configuration IDs that can be read and set in this class (via + functions declared in the parent class). Values under 100 are + reserved for the parent class. + + Remember to update traces/trace.properties file when modifying + this enum (tracing is also the cause for fixing the enum values). + + Values available for IAPs: + - ConfIdIapId + - ConfIdName + - ConfIdNetworkId + - WlanQtUtilsAp::ConfIdSsid + - WlanQtUtilsAp::ConfIdSignalStrength + - WlanQtUtilsAp::ConfIdConnectionMode + - WlanQtUtilsAp::ConfIdSecurityMode + - WlanQtUtilsAp::ConfIdWpaPskUse + */ + enum ConfId { + //! int: IAP ID + ConfIdIapId = 100, + //! QString: Name + ConfIdName = 101, + //! int: Network ID + ConfIdNetworkId = 102 + }; + WlanQtUtilsIap(); - WlanQtUtilsIap( - int id, - int netId, - QString name, - WlanQtUtilsBearerType bearerType); + virtual ~WlanQtUtilsIap(); - int id() const; - int networkId() const; - QString name() const; - WlanQtUtilsBearerType bearerType() const; - WlanQtUtilsConnectionStatus connectionStatus() const; - - void setId(int id); - void setNetworkId(int NetId); - void setName(QString name); - void setBearerType(WlanQtUtilsBearerType bearerType); - void setConnectionStatus(WlanQtUtilsConnectionStatus connectionStatus); +signals: + +public slots: + +protected: + +protected slots: private: - int id_; - int netId_; - QString name_; - WlanQtUtilsBearerType bearerType_; - WlanQtUtilsConnectionStatus connectionStatus_; - // TODO: SNAP ID list + + Q_DISABLE_COPY(WlanQtUtilsIap) + +private slots: + +private: // data + + QScopedPointer d_ptr; //!< Private implementation + + // Friend classes }; -#endif /* WLANQTUTILSIAP_H */ +#endif // WLANQTUTILSIAP_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/base/inc/wlanqtutilsiapsettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/base/inc/wlanqtutilsiapsettings.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Qt Utilities WLAN IAP settings handling. +*/ + +#ifndef WLANQTUTILSIAPSETTINGS_H +#define WLANQTUTILSIAPSETTINGS_H + +// System includes + +#include +#include +#include +#include + +// User includes + +// Forward declarations + +class CmManagerShim; +class CmConnectionMethodShim; +class WlanQtUtilsIap; +class WlanQtUtilsAp; + +// External data types + +// Constants + +// Class declaration + +class WlanQtUtilsIapSettings : public QObject +{ + Q_OBJECT + +public: + + // Data types + + explicit WlanQtUtilsIapSettings(QObject *parent = 0); + + virtual ~WlanQtUtilsIapSettings(); + + void fetchIaps(QList< QSharedPointer > &iapList) const; + + QSharedPointer fetchIap(uint iapId) const; + + int createIap(const WlanQtUtilsAp *wlanAp); + + bool updateIap(int iapId, const WlanQtUtilsAp *wlanAp); + + void deleteIap(int iapId); + + void moveIapToInternetSnap(int iapId); + + void setAsHotspotIap(int iapId); + +signals: + +public slots: + +protected: + +protected slots: + +private: + + Q_DISABLE_COPY(WlanQtUtilsIapSettings) + + void storeSettings( + const WlanQtUtilsAp *wlanAp, + CmConnectionMethodShim *iap); + + void storeWepKey( + const QString &key, + int index, + CmConnectionMethodShim *iap); + + CMManagerShim::ConnectionMethodAttribute mapWepKeyIndexHex(int index); + + CMManagerShim::ConnectionMethodAttribute mapWepKeyIndexAscii(int index); + + void traceIap( + const WlanQtUtilsAp *ap, + int traceType, + uint iapId) const; + +private slots: + +private: // data + + CmManagerShim *mCmManager; //!< CmManager instance + + // Friend classes +}; + +#endif // WLANQTUTILSIAPSETTINGS_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/base/inc/wlanqtutilswlanap.h --- a/wlanutilities/wlanqtutilities/base/inc/wlanqtutilswlanap.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,167 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This is the header file for WlanQtUtilsWlanAp class. -*/ - -#ifndef WLANQTUTILSWLANAP_H -#define WLANQTUTILSWLANAP_H - -#include -#include -#include "wlanqtutilscommon.h" - -class QString; - -/** - * This class represents WLAN access point (AP). - */ -class WLANQTUTILITIESDLL_EXPORT WlanQtUtilsWlanAp : public QObject -{ -public: - - /** - * Constructor. - */ - WlanQtUtilsWlanAp(); - - /** - * Copy constructor. - */ - WlanQtUtilsWlanAp(const WlanQtUtilsWlanAp &ref); - - /** - * Constructor. - * - * @param ssid SSID. - * @param bssid BSSID, that is, MAC address. - * @param signalStrength Signal strength. - * @param connectionMode Connection mode as TConnMonNetworkMode. - * @param securityMode WLAN Security mode. - */ - WlanQtUtilsWlanAp( - QString ssid, - QString bssid, - int signalStrength, - int connectionMode, - WlanQtUtilsWlanSecMode securityMode); - - /** - * Destructor. - */ - virtual ~WlanQtUtilsWlanAp(); - - /** - * Returns SSID. - * - * @return SSID. - */ - QString ssid() const; - - /** - * Getter. - * - * @return BSSID. - */ - QString bssid() const; - - /** - * Getter. - * - * @return Signal strength. - */ - int signalStrength() const; - - /** - * Getter. - * - * @return Connection mode as TConnMonNetworkMode. - */ - int connectionMode() const; - - /** - * Getter. - * - * @return Security mode as WlanQtUtilsWlanSecMode. - */ - WlanQtUtilsWlanSecMode securityMode() const; - - /** - * Getter. - * - * @return Security key. - */ - QString securityKey() const; - - /** - * Setter. - * - * @param SSID. - */ - void setSsid(QString ssid); - - /** - * Setter. - * - * @param BSSID. - */ - void setBssid(QString bssid); - - /** - * Setter. - * - * @param Signal strength. - */ - void setSignalStrength(int signalStrength); - - /** - * Setter. - * - * @param connectionMode Connection mode as TConnMonNetworkMode. - */ - void setConnectionMode(int connectionMode); - - /** - * Setter. - * - * @param securityMode WLAN Security mode. - */ - void setSecurityMode(WlanQtUtilsWlanSecMode securityMode); - - /** - * Setter. - * - * @param securityKey WLAN Security key. - */ - void setSecurityKey(QString securityKey); - -private: //data - - /** SSID */ - QString ssid_; - /** BSSID, that is, MAC address. */ - QString bssid_; // TODO: Check if QString is suitable - /** Signal strength. */ - int signalStrength_; - /** Connection mode as TConnMonNetworkMode. */ - int connectionMode_; - /** WLAN security mode. */ - WlanQtUtilsWlanSecMode securityMode_; - /** Security key, if available. */ - QString securityKey_; -}; - -Q_DECLARE_METATYPE(WlanQtUtilsWlanAp) - -#endif /* WLANQTUTILSWLANIAP_H */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/base/inc/wlanqtutilswlaniap.h --- a/wlanutilities/wlanqtutilities/base/inc/wlanqtutilswlaniap.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This is a header file for WlanQtUtilsWlanIap class. -*/ - -#ifndef WLANQTUTILSWLANIAP_H -#define WLANQTUTILSWLANIAP_H - -#include "wlanqtutilscommon.h" -#include "wlanqtutilsiap.h" - -class WLANQTUTILITIESDLL_EXPORT WlanQtUtilsWlanIap : public WlanQtUtilsIap -{ - // Q_OBJECT macro needed for qobject_cast to work - Q_OBJECT - -public: - WlanQtUtilsWlanIap(); - WlanQtUtilsWlanIap(int id, int netId, QString name, WlanQtUtilsBearerType bearerType, QString ssid, WlanQtUtilsWlanSecMode securityMode); - virtual ~WlanQtUtilsWlanIap(); - - QString ssid() const; - int signalStrength() const; - WlanQtUtilsWlanSecMode securityMode() const; - - void setSsid(QString ssid); - void setSignalStrength(int signalStrength); - void setSecurityMode(WlanQtUtilsWlanSecMode securityMode); - -private: - QString ssid_; - int signalStrength_; - WlanQtUtilsWlanSecMode securityMode_; - // TODO: secKey_ (type unknown) -}; - -#endif /* WLANQTUTILSWLANIAP_H */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/base/src/wlanqtutils.cpp --- a/wlanutilities/wlanqtutilities/base/src/wlanqtutils.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanqtutilities/base/src/wlanqtutils.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -12,69 +12,244 @@ * Contributors: * * Description: +* WLAN Qt Utilities implementation. */ -#include "wlanqtutilswlanap.h" -#include "wlanqtutilswlaniap.h" +// System includes +// User includes + +#include "wlanqtutilsap.h" +#include "wlanqtutilsiap.h" #include "wlanqtutils_p.h" #include "wlanqtutils.h" -WlanQtUtils::WlanQtUtils() +/*! + \class WlanQtUtils + \brief Wlan Qt Utilities. This class provides a Qt API for UI components + for retrieving different kind of information related to WLAN + functionality. +*/ + + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. +*/ + +WlanQtUtils::WlanQtUtils() : + d_ptr(new WlanQtUtilsPrivate(this)) { - d_ptr = new WlanQtUtilsPrivate(this); } +/*! + Destructor. +*/ + WlanQtUtils::~WlanQtUtils() { - delete d_ptr; +} + +/*! + Function for requesting a single WLAN scan to be triggered. + + Signal wlanScanReady(int) is emitted when new scan results are available. + + NOTE: Requesting a new scan while there is an ongoing scan (for this + WlanQtUtils instance) is not allowed. +*/ + +void WlanQtUtils::scanWlans() +{ + d_ptr->scanWlans(); +} + +/*! + Function for requesting a WLAN AP scan to be triggered. + + Signal availableWlanAps() is emitted when new scan results are available. + + NOTE: Requesting a new scan while there is an ongoing scan (for this + WlanQtUtils instance) is not allowed. +*/ + +void WlanQtUtils::scanWlanAps() +{ + d_ptr->scanWlanAps(); } -void WlanQtUtils::availableWlanAps( - QList &wlanIapList, - QList &wlanApList) +/*! + Function for requesting a direct WLAN scan with given SSID. + + Signal wlanScanDirectReady(int) is emitted when new scan results are + available. + + NOTE: Requesting a new scan while there is an ongoing scan (for this + WlanQtUtils instance) is not allowed. + + @param [in] ssid Network name to be found +*/ + +void WlanQtUtils::scanWlanDirect(const QString &ssid) { - d_ptr->availableWlanAps(wlanIapList, wlanApList); + d_ptr->scanWlanDirect(ssid); +} + +/*! + Function for stopping a (possibly) ongoing WLAN scan. + This function can also be called when there is no scan in progres. + If a scan is actually cancelled, the corresponding scan result signal + is sent with ScanStatusCancelled status. +*/ + +void WlanQtUtils::stopWlanScan() +{ + d_ptr->stopWlanScan(); +} + +/*! + Function to request details of available WLAN networks. Can be called + at any time. Calling right after wlanScanReady(int) signal ensures you get + the most recent results. + + @param [out] wlanIapList List of available WLAN IAPs. + @param [out] wlanApList List of unknown WLAN APs. +*/ + +void WlanQtUtils::availableWlans( + QList< QSharedPointer > &wlanIapList, + QList< QSharedPointer > &wlanApList) const +{ + d_ptr->availableWlans(wlanIapList, wlanApList); } -int WlanQtUtils::createWlanIap(const WlanQtUtilsWlanAp *wlanAp) +/*! + Function to request details of available WLAN networks. This function is + used to get the results that are informed by following signals: + -wlanScanApReady(int) + -wlanScanDirectReady(int) + + @param [out] wlanApList List of unknown WLAN APs. +*/ + +void WlanQtUtils::availableWlanAps( + QList< QSharedPointer > &wlanApList) const { - return d_ptr->createWlanIap(wlanAp); + d_ptr->availableWlanAps(wlanApList); +} + +/*! + Function to create an IAP from the given WLAN access point. + + @param [in] wlanAp Access point containing parameters to include in the new IAP. + + @return IAP ID if creation succeeds, IapIdNone otherwise. +*/ + +int WlanQtUtils::createIap(const WlanQtUtilsAp *wlanAp) +{ + return d_ptr->createIap(wlanAp); } -void WlanQtUtils::connectIap(int iapId) +/*! + Function to update an IAP from the given WLAN access point. + + @param [in] iapId ID of the IAP to be updated. + @param [in] wlanAp Access point containing parameters to update in the IAP. + + @return Was update successful? +*/ + +bool WlanQtUtils::updateIap(int iapId, const WlanQtUtilsAp *wlanAp) +{ + return d_ptr->updateIap(iapId, wlanAp); +} + +/*! + Function to delete an IAP. + + @param [in] iapId ID of the IAP to be deleted. +*/ + +void WlanQtUtils::deleteIap(int iapId) { - d_ptr->connectIap(iapId); + d_ptr->deleteIap(iapId); } +/*! + Function to start connection creation for the given IAP. Runs also + Internet Connectivity Test (ICT), if requested with the optional + parameter. + + Connecting while there is already a connection is also supported. + + wlanNetworkOpened() or wlanNetworkClosed() signal will be emitted + when connection status changes. + + ictResult() signal will be emitted when (possible) ICT result is + available. + + @param [in] iapId ID of the IAP to be connected. + @param [in] runIct Should ICT be run or not? +*/ + +void WlanQtUtils::connectIap(int iapId, bool runIct) +{ + d_ptr->connectIap(iapId, runIct); +} + +/*! + Function to disconnect the given IAP. + Disconnecting when there is no connection is also supported. + + @param [in] iapId ID of the IAP to be disconnected. +*/ + void WlanQtUtils::disconnectIap(int iapId) { d_ptr->disconnectIap(iapId); } -WlanQtUtilsIap *WlanQtUtils::iap(int iapId) const +/*! + Function to retrieve the name of the IAP with the given ID. + + @param [in] iapId ID of the requested IAP. + + @return Name of the IAP or empty QString if IAP is not found. +*/ + +QString WlanQtUtils::iapName(int iapId) const { - return d_ptr->iap(iapId); -} - -bool WlanQtUtils::masterWlan() const -{ - return d_ptr->masterWlan(); + return d_ptr->iapName(iapId); } -void WlanQtUtils::setMasterWlan(bool enabled) +/*! + Connection status getter. + + @return Current WLAN connection status. +*/ + +WlanQtUtils::ConnStatus WlanQtUtils::connectionStatus() const { - d_ptr->setMasterWlan(enabled); + return d_ptr->connectionStatus(); } -int WlanQtUtils::connectedWlanId() const -{ - return d_ptr->connectedWlanId(); -} +/*! + Function for getting the ID of the (possibly) active WLAN IAP. + Active here means non-disconnected. + Use connectionStatus() for retrieving the actual status. -void WlanQtUtils::scanWlans() + @return ID of the active IAP, IapIdNone if not valid. +*/ + +int WlanQtUtils::activeIap() const { - d_ptr->scanWlans(); + return d_ptr->activeIap(); } - -// End of File diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/base/src/wlanqtutils_p.cpp --- a/wlanutilities/wlanqtutilities/base/src/wlanqtutils_p.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanqtutilities/base/src/wlanqtutils_p.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -12,479 +12,827 @@ * Contributors: * * Description: +* WLAN Qt Utilities private implementation. */ -#include "wlanqtutilswlanap.h" -#include "wlanqtutilswlaniap.h" -#include "wlanqtutilsactiveconn.h" -#include "wlanqtutilscmmwrapper.h" +// System includes + +#include + +// User includes + +#include "wlanqtutilsap.h" +#include "wlanqtutilsiap.h" +#include "wlanqtutilsconnection.h" +#include "wlanqtutilsiapsettings.h" #include "wlanqtutilsconmonwrapper.h" #include "wlanqtutilsesockwrapper.h" -#include "wlanqtutilsconntestwrapper.h" +#include "wlanqtutilsscan.h" #include "wlanqtutils.h" #include "wlanqtutils_p.h" -#ifdef WLANQTUTILS_NO_OST_TRACES_FLAG -#include -#else #include "OstTraceDefinitions.h" -#endif #ifdef OST_TRACE_COMPILER_IN_USE #include "wlanqtutils_pTraces.h" #endif +/*! + \class WlanQtUtilsPrivate + \brief Private implementation class for WLAN Qt Utilities. -WlanQtUtilsPrivate::WlanQtUtilsPrivate(WlanQtUtils *publicPtr) : - q_ptr(publicPtr), - wlanScanList_(), - wlanIapList_(), - toBeTestedIapId_(WlanQtUtilsInvalidIapId), - connectingIapId_(WlanQtUtilsInvalidIapId), - activeConnection_(NULL) + The private interface functions are identical to those in WlanQtUtils + class, so refer to that for descriptions. Other functions contain + implementation documentation. +*/ + + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. +*/ + +WlanQtUtilsPrivate::WlanQtUtilsPrivate(WlanQtUtils *q_ptr) : + q_ptr(q_ptr), + mSettings(new WlanQtUtilsIapSettings(this)), + mConMonWrapper(new WlanQtUtilsConMonWrapper(this)), + mScanWrapper(new WlanQtUtilsScan(this)), + mEsockWrapper(new WlanQtUtilsEsockWrapper(this)), + mIctService(), + mScanMode(ScanModeNone), + mWlanScanList(), + mToBeTestedIapId(WlanQtUtils::IapIdNone), + mConnectingIapId(WlanQtUtils::IapIdNone), + mConnection() { - OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_WLANQTUTILSPRIVATE_ENTRY, this ); + OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_WLANQTUTILSPRIVATE_ENTRY, this); + + // Make all connections. + bool connectStatus = connect( + mScanWrapper, + SIGNAL(availableWlanAps(QList< QSharedPointer >&)), + this, + SLOT(updateAvailableWlanAps(QList< QSharedPointer >&))); + Q_ASSERT(connectStatus); - // Let's allocate memory for wrapper objects. - // Engine is set as a parent for wrapper objects. - cmmWrapper_ = new CmmWrapper(this); - conMonWrapper_ = new ConMonWrapper(this); - esockWrapper_ = new EsockWrapper(this); - connTestWrapper_ = new ConnTestWrapper(this); - - // Make all connections. - // Todo: having these as signals from the wrappers doesn't bring much benefit - // -> could be optimized as normal callbacks - connect( - conMonWrapper_, - SIGNAL(availableWlanApsFromWrapper(QList&)), + connectStatus = connect( + mScanWrapper, + SIGNAL(scanFailed(int)), this, - SLOT(updateAvailableWlanAps(QList&))); + SLOT(reportScanResult(int))); + Q_ASSERT(connectStatus); - connect( - esockWrapper_, - SIGNAL(connectionStatusFromWrapper(bool)), + connectStatus = connect( + mEsockWrapper, + SIGNAL(connectionStatusFromWrapper(bool)), this, SLOT(updateConnectionStatus(bool))); + Q_ASSERT(connectStatus); - connect( - connTestWrapper_, - SIGNAL(connectivityTestResult(bool)), - this, - SLOT(updateConnectivityTestResult(bool))); - - connect( - conMonWrapper_, - SIGNAL(connCreatedEventFromWrapper(uint)), + connectStatus = connect( + mConMonWrapper, + SIGNAL(connCreatedEventFromWrapper(uint)), this, SLOT(addActiveConnection(uint))); + Q_ASSERT(connectStatus); - connect( - conMonWrapper_, - SIGNAL(connDeletedEventFromWrapper(uint)), + connectStatus = connect( + mConMonWrapper, + SIGNAL(connDeletedEventFromWrapper(uint)), this, SLOT(removeActiveConnection(uint))); - - connect( - conMonWrapper_, - SIGNAL(connStatusEventFromWrapper(uint, WlanQtUtilsConnectionStatus)), - this, - SLOT(updateActiveConnection(uint, WlanQtUtilsConnectionStatus))); + Q_ASSERT(connectStatus); - // Fetch the initial IAP configuration - fetchIaps(); + connectStatus = connect( + mConMonWrapper, + SIGNAL(connStatusEventFromWrapper(uint, WlanQtUtils::ConnStatus)), + this, + SLOT(updateActiveConnection(uint, WlanQtUtils::ConnStatus))); + Q_ASSERT(connectStatus); - // Retrieve initial status of active connections and update IAPs, if needed. - activeConnection_ = conMonWrapper_->activeConnection(); - if (activeConnection_ != NULL) { - updateIapConnectionStatuses(activeConnection_->iapId(), activeConnection_->connectionStatus()); - } + // Retrieve initial status of active connections + mConnection = QSharedPointer( + mConMonWrapper->activeConnection()); - // TODO: error handling + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_WLANQTUTILSPRIVATE_EXIT, this); +} - OstTraceFunctionExit1( WLANQTUTILSPRIVATE_WLANQTUTILSPRIVATE_EXIT, this ); -} +/*! + Destructor. +*/ WlanQtUtilsPrivate::~WlanQtUtilsPrivate() { - OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_WLANQTUTILSPRIVATEDESTR_ENTRY, this ); - - // Delete WLAN scan list - for (int i = 0; i < wlanScanList_.count(); i++) { - delete wlanScanList_[i]; - } - wlanScanList_.clear(); + OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_WLANQTUTILSPRIVATEDESTR_ENTRY, this); + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_WLANQTUTILSPRIVATEDESTR_EXIT, this); +} + +/*! + See WlanQtUtils::scanWlans(). +*/ + +void WlanQtUtilsPrivate::scanWlans() +{ + OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_SCANWLANS_ENTRY, this); + + // Scanning while there is an ongoing scan is not supported + Q_ASSERT(mScanMode == ScanModeNone); - delete activeConnection_; + // Just forward the request to wrapper, which triggers a broadcast WLAN scan + mScanMode = ScanModeAvailableWlans; + mScanWrapper->scanWlanAps(); + + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_SCANWLANS_EXIT, this); +} + +/*! + See WlanQtUtils::scanWlanAps(). +*/ + +void WlanQtUtilsPrivate::scanWlanAps() +{ + OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_SCANWLANAPS_ENTRY, this); - delete cmmWrapper_; - delete conMonWrapper_; - delete esockWrapper_; - delete connTestWrapper_; + // Scanning while there is an ongoing scan is not supported + Q_ASSERT(mScanMode == ScanModeNone); + + // Just forward the request to wrapper, which triggers a broadcast WLAN scan + mScanMode = ScanModeAvailableWlanAps; + mScanWrapper->scanWlanAps(); - OstTraceFunctionExit1( WLANQTUTILSPRIVATE_WLANQTUTILSPRIVATEDESTR_EXIT, this ); + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_SCANWLANAPS_EXIT, this); } -void WlanQtUtilsPrivate::availableWlanAps( - QList &wlanIapList, - QList &wlanApList) +/*! + See WlanQtUtils::scanWlanDirect(). +*/ + +void WlanQtUtilsPrivate::scanWlanDirect(const QString &ssid) +{ + OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_SCANWLANDIRECT_ENTRY, this); + + // Scanning while there is an ongoing scan is not supported + Q_ASSERT(mScanMode == ScanModeNone); + + // Just forward the request to wrapper, which triggers a direct WLAN scan + mScanMode = ScanModeDirect; + mScanWrapper->scanWlanDirect(ssid); + + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_SCANWLANDIRECT_EXIT, this); +} + +/*! + See WlanQtUtils::stopWlanScan(). +*/ + +void WlanQtUtilsPrivate::stopWlanScan() { - OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_AVAILABLEWLANAPS_ENTRY, this ); + OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_STOPWLANSCAN_ENTRY, this); + + if (mScanMode != ScanModeNone) { + // Inform that scan was cancelled + reportScanResult(WlanQtUtils::ScanStatusCancelled); + + // Stop the scan + mScanMode = ScanModeNone; + mScanWrapper->stopScan(); + } + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_STOPWLANSCAN_EXIT, this); +} + +/*! + See WlanQtUtils::availableWlans(). +*/ + +void WlanQtUtilsPrivate::availableWlans( + QList< QSharedPointer > &wlanIapList, + QList< QSharedPointer > &wlanApList) const +{ + OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_AVAILABLEWLAN_ENTRY, this); + wlanIapList.clear(); wlanApList.clear(); - - // Add possible connected or connecting IAP as the first item in the list - int activeIapId = WlanQtUtilsInvalidIapId; - if (activeConnection_ != NULL) { - activeIapId = activeConnection_->iapId(); - } else if (connectingIapId_ != WlanQtUtilsInvalidIapId) { - activeIapId = connectingIapId_; - } - if (wlanIapList_.contains(activeIapId)) { - wlanIapList_[activeIapId]->setSignalStrength(WlanQtUtilsWlanSignalStrengthMax); - wlanIapList_[activeIapId]->setConnectionStatus(WlanQtUtilsConnectionStatusConnected); - wlanIapList.append(wlanIapList_[activeIapId]); - } - - // Todo: IAPs with same SSID and security mode? probably we want to show only one of them? - + + // Read the list of configured IAPs + QList< QSharedPointer > configuredIapList; + mSettings->fetchIaps(configuredIapList); + // Match IAPs against WLAN scan results - foreach (WlanQtUtilsWlanIap *iap, wlanIapList_) { - foreach (WlanQtUtilsWlanAp *scanAp, wlanScanList_) { - // Todo: security mode check - if (iap->ssid() == scanAp->ssid()) { - // IAP found, add it to caller's list of known IAPs (signal strength needs to be - // updated manually since the IAP in our list does not have that information yet) - iap->setSignalStrength(scanAp->signalStrength()); - if (iap->id() != activeIapId) { - wlanIapList.append(iap); - } // else: connected IAP, added as the first item in the list already + foreach (QSharedPointer iap, configuredIapList) { + foreach (QSharedPointer scanAp, mWlanScanList) { + if (WlanQtUtilsAp::compare(iap.data(), scanAp.data()) == 0) { + // IAP found, add it to caller's list of known IAPs + // (signal strength needs to be updated manually since + // the IAP in our list does not have that information yet) + iap->setValue( + WlanQtUtilsAp::ConfIdSignalStrength, + scanAp->value(WlanQtUtilsAp::ConfIdSignalStrength)); + wlanIapList.append(iap); break; } } } // Go through the scan results to find unknown APs - for (int i = 0; i < wlanScanList_.count(); i++) { - // Skip networks with empty SSID (hidden networks are handled by UI currently) - if (wlanScanList_[i]->ssid().isEmpty() == FALSE) { - // Check whether an IAP with these parameters exists in any SNAP (in which case this - // network should not be shown as available in this SNAP) - if (wlanIapExists(wlanScanList_[i]->ssid(), wlanScanList_[i]->securityMode()) == false) { - // No IAP found in any SNAP, copy the AP to caller's list of unknown APs - wlanApList.append(wlanScanList_[i]); - } + for (int i = 0; i < mWlanScanList.count(); i++) { + // Check whether an IAP with these parameters exists (in which + // case this network is already added as an IAP in the loop above) + if (!wlanIapExists(configuredIapList, mWlanScanList[i].data())) { + // No IAP found in, copy the AP to caller's list of + // unknown APs + wlanApList.append(mWlanScanList[i]); } } + + traceIapsAndAps(wlanIapList, wlanApList); + + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_AVAILABLEWLAN_EXIT, this); +} + +/*! + See WlanQtUtils::availableWlanAps(). +*/ + +void WlanQtUtilsPrivate::availableWlanAps( + QList< QSharedPointer > &wlanApList) const +{ + OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_AVAILABLEWLANAPS_ENTRY, this); - // Sort APs by their SSIDs. - QMap wlanApMap; - // Loop the AP list copying the keys (lower case SSID) and elements - // into the map. - for (int i = 0; i < wlanApList.count(); i++ ) { - wlanApMap.insertMulti(wlanApList[i]->ssid().toLower(), wlanApList[i]); - } - wlanApList = wlanApMap.values(); + // Just copy the results + wlanApList = mWlanScanList; + + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_AVAILABLEWLANAPS_EXIT, this); +} + +/*! + See WlanQtUtils::createIap(). +*/ - OstTraceFunctionExit1( WLANQTUTILSPRIVATE_AVAILABLEWLANAPS_EXIT, this ); +int WlanQtUtilsPrivate::createIap(const WlanQtUtilsAp *wlanAp) +{ + OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_CREATEIAP_ENTRY, this); + + // Create the new IAP and return its ID + int newIapId = mSettings->createIap(wlanAp); + + OstTrace1( + TRACE_BORDER, + WLANQTUTILSPRIVATE_CREATEIAP, + "WlanQtUtilsPrivate::createIap;New IAP ID=%d", + newIapId); + + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_CREATEIAP_EXIT, this); + return newIapId; } -int WlanQtUtilsPrivate::createWlanIap(const WlanQtUtilsWlanAp *wlanAp) +/*! + See WlanQtUtils::updateIap(). +*/ + +bool WlanQtUtilsPrivate::updateIap(int iapId, const WlanQtUtilsAp *wlanAp) { - OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_CREATEWLANIAP_ENTRY, this ); + OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_UPDATEIAP_ENTRY, this); + + bool success = mSettings->updateIap(iapId, wlanAp); - // Create the new IAP. Store its ID, because we need to run ICT for it later - WlanQtUtilsWlanIap *newIap = cmmWrapper_->createWlanIap(wlanAp); - toBeTestedIapId_ = newIap->id(); - wlanIapList_.insert(newIap->id(), newIap); - - OstTrace1( - TRACE_API, - WLANQTUTILSPRIVATE_CREATEWLANIAP, - "WlanQtUtilsPrivate::createWlanIap;New IAP ID=%d", toBeTestedIapId_ ); - OstTraceFunctionExit1( WLANQTUTILSPRIVATE_CREATEWLANIAP_EXIT, this ); - return toBeTestedIapId_; + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_UPDATEIAP_EXIT, this); + return success; +} + +/*! + See WlanQtUtils::deleteIap(). +*/ + +void WlanQtUtilsPrivate::deleteIap(int iapId) +{ + OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_DELETEIAP_ENTRY, this); + + mSettings->deleteIap(iapId); + + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_DELETEIAP_EXIT, this); } -void WlanQtUtilsPrivate::connectIap(int iapId) +/*! + See WlanQtUtils::connectIap(). +*/ + +void WlanQtUtilsPrivate::connectIap(int iapId, bool runIct) { - OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_CONNECTIAP_ENTRY, this ); - OstTrace1( TRACE_API, WLANQTUTILSPRIVATE_CONNECTIAP, "WlanQtUtilsPrivate::connectIap;IAP ID=%d", iapId ); + OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_CONNECTIAP_ENTRY, this); - Q_ASSERT(activeConnection_ == NULL); - connectingIapId_ = iapId; - esockWrapper_->connectIap(iapId); + OstTraceExt2( + TRACE_BORDER, + WLANQTUTILSPRIVATE_CONNECTIAP, + "WlanQtUtilsPrivate::connectIap;IAP ID=%d;runIct=%hhu", + iapId, + runIct); + + Q_ASSERT(iapId != WlanQtUtils::IapIdNone); - OstTraceFunctionExit1( WLANQTUTILSPRIVATE_CONNECTIAP_EXIT, this ); + if (runIct) { + // Mark this IAP for ICT testing after it has been opened + mToBeTestedIapId = iapId; + } + mConnectingIapId = iapId; + mEsockWrapper->connectIap(iapId); + + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_CONNECTIAP_EXIT, this); } +/*! + See WlanQtUtils::disconnectIap(). +*/ + void WlanQtUtilsPrivate::disconnectIap(int iapId) { - OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_DISCONNECTIAP_ENTRY, this ); - OstTrace1( TRACE_API, WLANQTUTILSPRIVATE_DISCONNECTIAP, "WlanQtUtilsPrivate::disconnectIap;IAP ID=%d", iapId ); - - Q_ASSERT(activeConnection_ != NULL); - Q_ASSERT(activeConnection_->iapId() == iapId); - Q_ASSERT(wlanIapList_.contains(iapId)); + OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_DISCONNECTIAP_ENTRY, this); - // Todo: IAP may have been opened by someone else... how to know when to disconnect RConnection? - esockWrapper_->disconnectIap(); - - // In order to close connection even if there are other users for the IAP, close also via ConMon - conMonWrapper_->disconnectIap(iapId); - // Change status of the IAP to non-connected - wlanIapList_[iapId]->setConnectionStatus(WlanQtUtilsConnectionStatusDisconnected); + OstTrace1( + TRACE_BORDER, + WLANQTUTILSPRIVATE_DISCONNECTIAP, + "WlanQtUtilsPrivate::disconnectIap;IAP ID=%d", + iapId); - OstTraceFunctionExit1( WLANQTUTILSPRIVATE_DISCONNECTIAP_EXIT, this ); + if (iapId != WlanQtUtils::IapIdNone) { + // Close our RConnection handle, if needed. Wrapper ignores call, if + // no handle exists. + mEsockWrapper->disconnectIap(); + + // In order to close connection even if there are other users for the + // IAP, close also via ConMon + mConMonWrapper->disconnectIap(iapId); + } // else: just ignore call + + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_DISCONNECTIAP_EXIT, this); } -WlanQtUtilsIap *WlanQtUtilsPrivate::iap(int iapId) const +/*! + See WlanQtUtils::connectionStatus(). +*/ + +WlanQtUtils::ConnStatus WlanQtUtilsPrivate::connectionStatus() const { - if (wlanIapList_.contains(iapId)) { - return wlanIapList_.value(iapId); + OstTraceFunctionEntry0(WLANQTUTILSPRIVATE_CONNECTIONSTATUS_ENTRY); + + WlanQtUtils::ConnStatus status = WlanQtUtils::ConnStatusDisconnected; + + if (mConnection) { + status = mConnection->connectionStatus(); } - // else: no match - return NULL; + OstTrace1( + TRACE_BORDER, + WLANQTUTILSPRIVATE_CONNECTIONSTATUS, + "WlanQtUtilsPrivate::connectionStatus;status=%{ConnStatus};", + (TUint)status); + + OstTraceFunctionExit0(WLANQTUTILSPRIVATE_CONNECTIONSTATUS_EXIT); + return status; } -bool WlanQtUtilsPrivate::masterWlan() const +/*! + See WlanQtUtils::activeIap(). +*/ + +int WlanQtUtilsPrivate::activeIap() const { - OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_MASTERWLAN_ENTRY, this ); + OstTraceFunctionEntry0(WLANQTUTILSPRIVATE_ACTIVEIAP_ENTRY); + + int iapId = WlanQtUtils::IapIdNone; + + if (mConnection) { + iapId = mConnection->iapId(); + } + OstTrace1( + TRACE_BORDER, + WLANQTUTILSPRIVATE_ACTIVEIAP, + "WlanQtUtilsPrivate::activeIap;iapId=%d", + iapId); - // TODO: Add actual implementation, this is just temporary dummy for testing wlanentryplugin! + OstTraceFunctionExit0(WLANQTUTILSPRIVATE_ACTIVEIAP_EXIT); + return iapId; +} + +/*! + See WlanQtUtils::iapName(). +*/ - OstTraceFunctionExit1( WLANQTUTILSPRIVATE_MASTERWLAN_EXIT, this ); - return true; +QString WlanQtUtilsPrivate::iapName(int iapId) const +{ + OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_IAPNAME_ENTRY, this); + + QString name; + // Read the IAP from settings and return its name + QSharedPointer iap = mSettings->fetchIap(iapId); + if (iap) { + name = iap->value(WlanQtUtilsIap::ConfIdName).toString(); + } + + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_IAPNAME_EXIT, this); + return name; } -void WlanQtUtilsPrivate::setMasterWlan(bool enabled) -{ - OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_SETMASTERWLAN_ENTRY, this ); +/*! + This function searches for a WLAN IAP matching the given WLAN AP. + + @param [in] list List to search from. + @param [in] ap Access point to search for. - // TODO: Add actual implementation. - (void)enabled; - - OstTraceFunctionExit1( WLANQTUTILSPRIVATE_SETMASTERWLAN_EXIT, this ); -} + @return True, if suitable WLAN IAP found, false otherwise. +*/ -int WlanQtUtilsPrivate::connectedWlanId() const +bool WlanQtUtilsPrivate::wlanIapExists( + const QList< QSharedPointer > list, + const WlanQtUtilsAp *ap) const { - OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_CONNECTEDWLANID_ENTRY, this ); - - int retVal = WlanQtUtilsInvalidIapId; - if (activeConnection_ != NULL) { - retVal = activeConnection_->iapId(); + bool match = false; // Return value + + foreach (QSharedPointer iap, list) { + if (WlanQtUtilsAp::compare(iap.data(), ap) == 0) { + // Match found + match = true; + break; + } } - OstTraceFunctionExit1( WLANQTUTILSPRIVATE_CONNECTEDWLANID_EXIT, this ); - return retVal; + + return match; } -void WlanQtUtilsPrivate::scanWlans() -{ - OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_SCANWLANS_ENTRY, this ); +/*! + This function traces the given IAPs and APs. + + @param [in] iaps IAPs to trace. + @param [in] aps APs to trace. +*/ - // Just forward the request to wrapper, which triggers a single WLAN scan - conMonWrapper_->scanAvailableWlanAPs(); - - OstTraceFunctionExit1( WLANQTUTILSPRIVATE_SCANWLANS_EXIT, this ); +void WlanQtUtilsPrivate::traceIapsAndAps( + const QList > &iaps, + const QList > &aps) const +{ +#ifndef OST_TRACE_COMPILER_IN_USE + Q_UNUSED(iaps); + Q_UNUSED(aps); +#else + foreach (QSharedPointer iap, iaps) { + QString tmp(iap->value(WlanQtUtilsIap::ConfIdName).toString()); + TPtrC16 name(tmp.utf16(), tmp.length()); + OstTraceExt3( + TRACE_NORMAL, + WLANQTUTILSPRIVATE_TRACEAVAILABLEWLANAPS_IAP, + "WlanQtUtilsPrivate::traceAvailableWlanAps IAP;name=%S;secMode=%{WlanSecMode};signalStrength=%d", + name, + iap->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(), + iap->value(WlanQtUtilsAp::ConfIdSignalStrength).toInt()); + } + foreach (QSharedPointer ap, aps) { + QString tmp(ap->value(WlanQtUtilsAp::ConfIdSsid).toString()); + TPtrC16 ssid(tmp.utf16(), tmp.length()); + OstTraceExt3( + TRACE_NORMAL, + WLANQTUTILSPRIVATE_TRACEAVAILABLEWLANAPS_AP, + "WlanQtUtilsPrivate::traceAvailableWlanAps AP;ssid=%S;secMode=%{WlanSecMode};signalStrength=%d", + ssid, + ap->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(), + ap->value(WlanQtUtilsAp::ConfIdSignalStrength).toInt()); + } +#endif } -void WlanQtUtilsPrivate::updateAvailableWlanAps(QList &availableWlanList) +/*! + Slot for handling WLAN scan result event from wrapper. Results are + stored in member variable (possible duplicates are removed). + + @param [in] availableWlanList WLAN networks found in scan. +*/ + +void WlanQtUtilsPrivate::updateAvailableWlanAps( + QList< QSharedPointer > &availableWlanList) { - OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_UPDATEAVAILABLEWLANAPS_ENTRY, this ); - + OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_UPDATEAVAILABLEWLANAPS_ENTRY, this); + // Old results are removed - wlanScanList_.clear(); - // Copy available WLAN's to engine's scan result list (duplicates are removed) + mWlanScanList.clear(); + // Copy available WLANs to scan result list (duplicates are removed) for (int i = 0; i < availableWlanList.count(); i++) { bool duplicate = false; - for (int j = 0; j < wlanScanList_.count(); j++) { - if (availableWlanList[i]->ssid() == wlanScanList_[j]->ssid() - && availableWlanList[i]->securityMode() == wlanScanList_[j]->securityMode()) { + for (int j = 0; j < mWlanScanList.count(); j++) { + if (WlanQtUtilsAp::compare( + availableWlanList[i].data(), + mWlanScanList[j].data()) == 0) { duplicate = true; break; } } if (duplicate == false) { - wlanScanList_.append(availableWlanList[i]); + mWlanScanList.append(availableWlanList[i]); } - // Todo: else deallocate? } - // the information is forwarded to the UI - emit q_ptr->wlanScanReady(); + // The information is forwarded to the client + reportScanResult(WlanQtUtils::ScanStatusOk); + + // Scan is complete + mScanMode = ScanModeNone; + + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_UPDATEAVAILABLEWLANAPS_EXIT, this); +} + +/*! + Scan result handler. Reports the scanning result to the client. + + @param [in] status Scan status code (WlanQtUtils::ScanStatus). +*/ + +void WlanQtUtilsPrivate::reportScanResult(int status) +{ + switch (mScanMode) { + case ScanModeAvailableWlans: + OstTrace1( + TRACE_BORDER, + WLANQTUTILSPRIVATE_WLANSCANREADY, + "WlanQtUtilsPrivate::reportScanResult emit wlanScanReady;status=%{ScanStatus};", + status); + emit q_ptr->wlanScanReady(status); + break; - OstTraceFunctionExit1( WLANQTUTILSPRIVATE_UPDATEAVAILABLEWLANAPS_EXIT, this ); + case ScanModeAvailableWlanAps: + OstTrace1( + TRACE_BORDER, + WLANQTUTILSPRIVATE_WLANSCANAPREADY, + "WlanQtUtilsPrivate::reportScanResult emit wlanScanApReady;status=%{ScanStatus};", + status); + emit q_ptr->wlanScanApReady(status); + break; + + case ScanModeDirect: + OstTrace1( + TRACE_BORDER, + WLANQTUTILSPRIVATE_WLANSCANDIRECTREADY, + "WlanQtUtilsPrivate::reportScanResult emit wlanScanDirectReady;status=%{ScanStatus};", + status); + emit q_ptr->wlanScanDirectReady(status); + break; + +#ifndef QT_NO_DEBUG + default: + // Invalid scan mode detected + Q_ASSERT(0); + break; +#endif + } } +/*! + Slot for handling connection setup status event from wrapper. + + @param [in] isOpened Was connection setup successful? +*/ + void WlanQtUtilsPrivate::updateConnectionStatus(bool isOpened) { - OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_UPDATECONNECTIONSTATUS_ENTRY, this ); - OstTrace1( - TRACE_API, - WLANQTUTILSPRIVATE_UPDATECONNECTIONSTATUS, - "WlanQtUtilsPrivate::updateConnectionStatus;isOpened=%d", isOpened ); - + OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_UPDATECONNECTIONSTATUS_ENTRY, this); + if (isOpened == false) { - // Opening failed, update connection statuses, but don't inform UI about - // connection closing here. It is done always in removeActiveConnection(). - if (activeConnection_ != NULL) { - activeConnection_->setConnectionStatus(WlanQtUtilsConnectionStatusDisconnected); + // Opening failed, update connection status and inform UI + if (mConnection) { + mConnection->setConnectionStatus( + WlanQtUtils::ConnStatusDisconnected); } - updateIapConnectionStatuses(connectingIapId_, WlanQtUtilsConnectionStatusDisconnected); + + // Include the status code from connection wrapper + int status = mEsockWrapper->lastStatusCode(); + OstTraceExt2( + TRACE_BORDER, + WLANQTUTILSPRIVATE_WLANNETWORKCLOSED, + "WlanQtUtilsPrivate::emit wlanNetworkClosed;IAP ID=%d;status=%d", + mConnectingIapId, + status); + emit q_ptr->wlanNetworkClosed(mConnectingIapId, status); } else { - // Opening succeeded, update connection statuses and inform UI - if (activeConnection_ != NULL) { - activeConnection_->setConnectionStatus(WlanQtUtilsConnectionStatusConnected); + // Opening succeeded, update connection status and inform UI + if (mConnection) { + mConnection->setConnectionStatus(WlanQtUtils::ConnStatusConnected); } - updateIapConnectionStatuses(connectingIapId_, WlanQtUtilsConnectionStatusConnected); - emit q_ptr->wlanNetworkOpened(connectingIapId_); + + OstTrace1( + TRACE_BORDER, + WLANQTUTILSPRIVATE_WLANNETWORKOPENED, + "WlanQtUtilsPrivate::emit wlanNetworkOpened;IAP ID=%d", + mConnectingIapId); + emit q_ptr->wlanNetworkOpened(mConnectingIapId); // Start ICT, if needed - if (connectingIapId_ == toBeTestedIapId_) { - WlanQtUtilsIap *iap = WlanQtUtilsPrivate::iap(toBeTestedIapId_); - connTestWrapper_->startConnectivityTest(toBeTestedIapId_, iap->networkId()); + if (mConnectingIapId == mToBeTestedIapId) { + QSharedPointer iap(mSettings->fetchIap(mConnectingIapId)); + + mIctService = QSharedPointer( + new IctsWlanLoginInterface(this)); + + // IctsWlanLoginInterface instance is created for each connectivity test + // Note: Queued connection is required since mIctService is deleted + // when signal comes + bool connectStatus = connect( + mIctService.data(), + SIGNAL(ictsResult(int)), + this, + SLOT(updateIctResult(int)), + Qt::QueuedConnection); + Q_ASSERT(connectStatus); + connectStatus = connect( + mIctService.data(), + SIGNAL(hotspotCase()), + this, + SLOT(updateIctHotspotCase()), + Qt::QueuedConnection); + Q_ASSERT(connectStatus); + + mIctService->start( + mToBeTestedIapId, + iap->value(WlanQtUtilsIap::ConfIdNetworkId).toInt()); } } // IAP is no more in connecting state - connectingIapId_ = WlanQtUtilsInvalidIapId; + mConnectingIapId = WlanQtUtils::IapIdNone; - OstTraceFunctionExit1( WLANQTUTILSPRIVATE_UPDATECONNECTIONSTATUS_EXIT, this ); + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_UPDATECONNECTIONSTATUS_EXIT, this); } -void WlanQtUtilsPrivate::updateConnectivityTestResult(bool result) +/*! + Slot for handling internet connectivity test result event from wrapper. + Tested IAP is stored to Internet SNAP, if test was successful. If the + IAP needs Hotspot authentication, it remains ungategorized. + + @param [in] result Result of internet connectivity test and hotspot + authentication (IctsWlanLoginInterface::ictsResultType). +*/ + +void WlanQtUtilsPrivate::updateIctResult(int ictsResult) { - OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_UPDATECONNECTIVITYTESTRESULT_ENTRY, this ); - OstTrace1( - TRACE_API, - WLANQTUTILSPRIVATE_UPDATECONNECTIVITYTESTRESULT, - "WlanQtUtilsPrivate::updateConnectivityTestResult;result=%d", result ); + OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_UPDATEICTRESULT_ENTRY, this); + + Q_ASSERT(mToBeTestedIapId != WlanQtUtils::IapIdNone); + WlanQtUtils::IctStatus result = WlanQtUtils::IctFailed; - if (result == true) { + if (ictsResult == IctsWlanLoginInterface::IctsPassed) { // Move the tested IAP to Internet SNAP since the test passed - Q_ASSERT(toBeTestedIapId_ != WlanQtUtilsInvalidIapId); - cmmWrapper_->moveIapToInternetSnap(toBeTestedIapId_); - } // else: do nothing, IAP remains to be uncategorized - else - { - // TODO: Remove this. This is needed now since the connectivity test fails - // and thus the IAP is not shown correctly. - cmmWrapper_->moveIapToInternetSnap(toBeTestedIapId_); + Q_ASSERT(mToBeTestedIapId != WlanQtUtils::IapIdNone); + mSettings->moveIapToInternetSnap(mToBeTestedIapId); + result = WlanQtUtils::IctPassed; + } else if (ictsResult == IctsWlanLoginInterface::IctsHotspotPassed) { + Q_ASSERT(mToBeTestedIapId != WlanQtUtils::IapIdNone); + result = WlanQtUtils::IctHotspotPassed; + } else if (ictsResult == IctsWlanLoginInterface::IctsCanceled) { + Q_ASSERT(mToBeTestedIapId != WlanQtUtils::IapIdNone); + result = WlanQtUtils::IctCancelled; + } else { + // ICTS failed - IAP remains to be uncategorized and mIctService is deleted. + mIctService.clear(); + } + + // Inform UI + OstTraceExt2( + TRACE_NORMAL, + WLANQTUTILSPRIVATE_ICTRESULT, + "WlanQtUtilsPrivate::emit ictResult;iapId=%d;result=%{IctStatus}", + mToBeTestedIapId, + result); + + emit q_ptr->ictResult(mToBeTestedIapId, result); + + // This IAP is now tested + mToBeTestedIapId = WlanQtUtils::IapIdNone; - } - // This IAP is now tested - toBeTestedIapId_ = WlanQtUtilsInvalidIapId; + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_UPDATEICTRESULT_EXIT, this); +} + +/*! + Slot for setting IAP to be tested as hotspot IAP. +*/ + +void WlanQtUtilsPrivate::updateIctHotspotCase() +{ + OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_UPDATEICTHOTSPOTCASE_ENTRY, this); - OstTraceFunctionExit1( WLANQTUTILSPRIVATE_UPDATECONNECTIVITYTESTRESULT_EXIT, this ); + mSettings->setAsHotspotIap(mToBeTestedIapId); + + Q_ASSERT(mToBeTestedIapId != WlanQtUtils::IapIdNone); + OstTrace1( + TRACE_BORDER, + WLANQTUTILSPRIVATE_UPDATEICTHOTSPOTCASE, + "WlanQtUtilsPrivate::updateIctHotspotCase set as hotspot IAP;iapId=%d", + mToBeTestedIapId); + + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_UPDATEICTHOTSPOTCASE_EXIT, this); } +/*! + Slot for updating active connection status from wrapper. + + @param [in] connectionId ID of the new connection. +*/ + void WlanQtUtilsPrivate::addActiveConnection(uint connectionId) { - OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_ADDACTIVECONNECTION_ENTRY, this ); + OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_ADDACTIVECONNECTION_ENTRY, this); OstTrace1( - TRACE_API, + TRACE_BORDER, WLANQTUTILSPRIVATE_ADDACTIVECONNECTION, - "WlanQtUtilsPrivate::addActiveConnection;connectionId=%u", connectionId ); + "WlanQtUtilsPrivate::addActiveConnection;connectionId=%u", + connectionId); - Q_ASSERT(activeConnection_ == NULL); - activeConnection_ = conMonWrapper_->connectionInfo(connectionId); - Q_ASSERT(wlanIapList_.contains(activeConnection_->iapId())); - updateIapConnectionStatuses(activeConnection_->iapId(), activeConnection_->connectionStatus()); + Q_ASSERT(mConnection == NULL); + mConnection = QSharedPointer( + mConMonWrapper->connectionInfo(connectionId)); - OstTraceFunctionExit1( WLANQTUTILSPRIVATE_ADDACTIVECONNECTION_EXIT, this ); + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_ADDACTIVECONNECTION_EXIT, this); } +/*! + Slot for updating active connection status from wrapper. + + @param [in] connectionId ID of the deleted connection. +*/ + void WlanQtUtilsPrivate::removeActiveConnection(uint connectionId) { - OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_REMOVEACTIVECONNECTION_ENTRY, this ); + OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_REMOVEACTIVECONNECTION_ENTRY, this); OstTrace1( - TRACE_API, + TRACE_BORDER, WLANQTUTILSPRIVATE_REMOVEACTIVECONNECTION, - "WlanQtUtilsPrivate::removeActiveConnection;connectionId=%u", connectionId ); - - Q_ASSERT(activeConnection_ != NULL); - if (activeConnection_->connectionId() == connectionId) { - // Connection is closed, update connection statuses and inform UI. - // wlanNetworkClosed is sent from here (and only from here), because, in some cases, - // connection may be removed without any connection status updates. - int closedIapId = activeConnection_->iapId(); - updateIapConnectionStatuses(activeConnection_->iapId(), WlanQtUtilsConnectionStatusDisconnected); - delete activeConnection_; - activeConnection_ = NULL; - emit q_ptr->wlanNetworkClosed(closedIapId); + "WlanQtUtilsPrivate::removeActiveConnection;connectionId=%u", + connectionId); + + Q_ASSERT(mConnection); + if (mConnection->connectionId() == connectionId) { + int closedIapId = mConnection->iapId(); + mConnection.clear(); + + if (mConnectingIapId != closedIapId) { + // Connection is closed, inform UI. wlanNetworkClosed is sent + // from here instead of updateActiveConnection(closed), + // because, in some cases, connection may be removed without + // any connection status updates. + // Note: reason parameter is not accurate here, because it is + // only relevant for connections opened by this dll + // (updateConnectionStatus) + OstTraceExt2( + TRACE_BORDER, + DUP1_WLANQTUTILSPRIVATE_WLANNETWORKCLOSED, + "WlanQtUtilsPrivate::emit wlanNetworkClosed;iapID=%d;status=%d", + closedIapId, + KErrNone); + emit q_ptr->wlanNetworkClosed(closedIapId, KErrNone); + } + // else: connection creation started by thid dll, but creation failed + // -> wlanNetworkClosed is sent from updateConnectionStatus } - OstTraceFunctionExit1( WLANQTUTILSPRIVATE_REMOVEACTIVECONNECTION_EXIT, this ); -} - -void WlanQtUtilsPrivate::updateActiveConnection(uint connectionId, WlanQtUtilsConnectionStatus connectionStatus) -{ - OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_UPDATEACTIVECONNECTION_ENTRY, this ); - OstTraceExt2( - TRACE_API, - WLANQTUTILSPRIVATE_UPDATEACTIVECONNECTION, - "WlanQtUtilsPrivate::updateActiveConnection;connectionId=%u;connectionStatus=%u", connectionId, connectionStatus ); - - Q_ASSERT(activeConnection_ != NULL); - if (activeConnection_->connectionId() == connectionId - && activeConnection_->connectionStatus() != connectionStatus) { - // Update connection statuses and inform UI, if necessary - activeConnection_->setConnectionStatus(connectionStatus); - updateIapConnectionStatuses(activeConnection_->iapId(), connectionStatus); - if (connectionStatus == WlanQtUtilsConnectionStatusConnected) { - emit q_ptr->wlanNetworkOpened(activeConnection_->iapId()); - } - // Do not inform UI about connection closing here. It is done always in - // removeActiveConnection(), because that may occur without any connection status updates. - } // else: connection status did not change - - OstTraceFunctionExit1( WLANQTUTILSPRIVATE_UPDATEACTIVECONNECTION_EXIT, this ); + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_REMOVEACTIVECONNECTION_EXIT, this); } -int WlanQtUtilsPrivate::fetchIaps() +/*! + Slot for updating active connection status from wrapper. + + @param [in] connectionId ID of the updated connection. + @param [in] connectionStatus New status of the connection. +*/ + +void WlanQtUtilsPrivate::updateActiveConnection( + uint connectionId, + WlanQtUtils::ConnStatus connectionStatus) { - OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_FETCHIAPS_ENTRY, this ); - - QList list; - int error = 0; - // Read the IAP list and store WLAN IAPs in our internal map data structure - error = cmmWrapper_->fetchIaps(list); - foreach (WlanQtUtilsIap *iap, list) { - if (iap->bearerType() == WlanQtUtilsBearerTypeWlan) { - // Notice that insertMulti not used, because IAP IDs should be unique - wlanIapList_.insert(iap->id(), qobject_cast(iap)); - } - } - - OstTraceFunctionExit1( WLANQTUTILSPRIVATE_FETCHIAPS_EXIT, this ); - return error; -} + OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_UPDATEACTIVECONNECTION_ENTRY, this); + OstTraceExt2( + TRACE_BORDER, + WLANQTUTILSPRIVATE_UPDATEACTIVECONNECTION, + "WlanQtUtilsPrivate::updateActiveConnection;connectionId=%u;connectionStatus=%{ConnStatus}", + connectionId, + (uint)connectionStatus); -bool WlanQtUtilsPrivate::wlanIapExists(QString ssid, WlanQtUtilsWlanSecMode secMode) -{ - foreach (WlanQtUtilsWlanIap *iap, wlanIapList_) { - // todo: secmode - (void)secMode; - if (iap->ssid() == ssid) { - return true; + Q_ASSERT(mConnection); + if (mConnection->connectionId() == connectionId + && mConnection->connectionStatus() != connectionStatus) { + // Update connection status and inform UI, if necessary + mConnection->setConnectionStatus(connectionStatus); + if (connectionStatus == WlanQtUtils::ConnStatusConnected) { + OstTrace1( + TRACE_BORDER, + DUP1_WLANQTUTILSPRIVATE_WLANNETWORKOPENED, + "WlanQtUtilsPrivate::emit wlanNetworkOpened;iapId=%d", + mConnection->iapId()); + emit q_ptr->wlanNetworkOpened(mConnection->iapId()); } - } - - return false; -} + // Do not inform UI about connection closing here. It is done in + // removeActiveConnection(), because that may occur without any + // connection status updates. + } // else: connection status did not change -void WlanQtUtilsPrivate::updateIapConnectionStatuses(int iapId, WlanQtUtilsConnectionStatus status) -{ - OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_UPDATEIAPCONNECTIONSTATUSES_ENTRY, this ); - - const WlanQtUtilsWlanIap *referenceIap = qobject_cast(iap(iapId)); - foreach (WlanQtUtilsWlanIap *iap, wlanIapList_) { - // todo: security mode checking - if (iap->id() == referenceIap->id() || iap->ssid() == referenceIap->ssid()) { - iap->setConnectionStatus(status); - } - } - - OstTraceFunctionExit1( WLANQTUTILSPRIVATE_UPDATEIAPCONNECTIONSTATUSES_EXIT, this ); + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_UPDATEACTIVECONNECTION_EXIT, this); } diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/base/src/wlanqtutilsactiveconn.cpp --- a/wlanutilities/wlanqtutilities/base/src/wlanqtutilsactiveconn.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This is a source file for WlanQtUtilsActiveConn class. -*/ - -#include "wlanqtutilsactiveconn.h" - -WlanQtUtilsActiveConn::WlanQtUtilsActiveConn() : - connectionId_(0), - iapId_(0), - connectionStatus_(WlanQtUtilsConnectionStatusNone), - bearerType_(WlanQtUtilsBearerTypeNone) -{ -} - -WlanQtUtilsActiveConn::~WlanQtUtilsActiveConn() -{ -} - -uint WlanQtUtilsActiveConn::connectionId() const -{ - return connectionId_; -} - -void WlanQtUtilsActiveConn::setConnectionId(uint connectionId) -{ - connectionId_ = connectionId; -} - -uint WlanQtUtilsActiveConn::iapId() const -{ - return iapId_; -} - -void WlanQtUtilsActiveConn::setIapId(uint iapId) -{ - iapId_ = iapId; -} - -WlanQtUtilsConnectionStatus WlanQtUtilsActiveConn::connectionStatus() const -{ - return connectionStatus_; -} - -void WlanQtUtilsActiveConn::setConnectionStatus(WlanQtUtilsConnectionStatus connectionStatus) -{ - connectionStatus_ = connectionStatus; -} - -WlanQtUtilsBearerType WlanQtUtilsActiveConn::bearerType() const -{ - return bearerType_; -} - -void WlanQtUtilsActiveConn::setBearerType(WlanQtUtilsBearerType bearerType) -{ - bearerType_ = bearerType; -} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/base/src/wlanqtutilsap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/base/src/wlanqtutilsap.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,173 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN AP (Access Point, unknown network) class. +*/ + +// System includes + +#include +#include +#include +#include +#include + +// User includes + +#include "wlanqtutilsap.h" + +/*! + \class WlanQtUtilsApPrivate + \brief Private implementation of WlanQtUtilsAp. +*/ + +class WlanQtUtilsApPrivate +{ +private: + //! Access Point configuration data + QHash mConfigurations; + + friend class WlanQtUtilsAp; +}; + +/*! + \class WlanQtUtilsAp + \brief WLAN Access Point class. + + Contains the information related to unknown WLAN access points. +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. +*/ + +WlanQtUtilsAp::WlanQtUtilsAp() : + d_ptr(new WlanQtUtilsApPrivate()) +{ +} + +/*! + Copy constructor. + + @param [in] ref AP to create a copy of. +*/ + +WlanQtUtilsAp::WlanQtUtilsAp(const WlanQtUtilsAp &ref) : + d_ptr(new WlanQtUtilsApPrivate()) +{ + d_ptr->mConfigurations = ref.d_ptr->mConfigurations; +} + +/*! + Destructor. +*/ + +WlanQtUtilsAp::~WlanQtUtilsAp() +{ +} + +/*! + Getter for AP data. + + @param [in] identifier Identifier of value to get. + + @return Value. +*/ + +QVariant WlanQtUtilsAp::value(int identifier) const +{ + // The configuration must exist + Q_ASSERT(d_ptr->mConfigurations.contains(identifier)); + Q_ASSERT(d_ptr->mConfigurations[identifier].isValid()); + return d_ptr->mConfigurations[identifier]; +} + +/*! + Setter for AP data. + + @param [in] identifier Identifier of value to set. + @param [in] value Value to set. +*/ + +void WlanQtUtilsAp::setValue(int identifier, QVariant value) +{ + d_ptr->mConfigurations[identifier] = value; +} + +/*! + AP comparison function. Does AP comparison based on following configs: + -SSID. + -Security mode. + -WPA PSK usage. + -Connection mode. + + @param [in] ap1 First AP to compare. + @param [in] ap2 Second AP to compare. + @param [in] comparator String comparator for SSID. + Default comparator is QString::compare() direct memory + comparison which does not take the localization into account. + + @return Zero (0), if APs are considered to be same, + Negative (>0) if ap1 is considered to be "greater than" ap2. + Negative (<0) if ap1 is considered to be "less than" ap2. +*/ + +int WlanQtUtilsAp::compare( + const WlanQtUtilsAp *ap1, + const WlanQtUtilsAp *ap2, + StringComparator comparator) +{ + int result = 0; + + // Compare SSID + QString ssid1 = ap1->value(WlanQtUtilsAp::ConfIdSsid).toString(); + QString ssid2 = ap2->value(WlanQtUtilsAp::ConfIdSsid).toString(); + if (comparator != NULL) { + result = comparator(ssid1, ssid2); + } else { + result = QString::compare(ssid1, ssid2); + } + + // Compare security mode + if (result == 0) { + result = ap1->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(); + result -= ap2->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(); + } + + // Compare WPA PSK usage + int secMode = ap1->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(); + if (result == 0 && + (secMode == CMManagerShim::WlanSecModeWpa || + secMode == CMManagerShim::WlanSecModeWpa2)) { + // WPA PSK value is boolean, but it can be converted to integer + result = ap1->value(WlanQtUtilsAp::ConfIdWpaPskUse).toInt(); + result -= ap2->value(WlanQtUtilsAp::ConfIdWpaPskUse).toInt(); + } + + // Compare connection mode + if (result == 0) { + result = ap1->value(WlanQtUtilsAp::ConfIdConnectionMode).toInt(); + result -= ap2->value(WlanQtUtilsAp::ConfIdConnectionMode).toInt(); + } + + return result; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/base/src/wlanqtutilsconnection.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/base/src/wlanqtutilsconnection.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Qt Utilities WLAN connection status handler. +*/ + +// System includes + +// User includes + +#include "wlanqtutilsconnection.h" + +/*! + \class WlanQtUtilsConnection + \brief WLAN connection status handler for WLAN Qt Utilities. +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. +*/ + +WlanQtUtilsConnection::WlanQtUtilsConnection() : + mConnectionId(0), + mIapId(0), + mConnectionStatus(WlanQtUtils::ConnStatusNone) +{ +} + +/*! + Destructor. +*/ + +WlanQtUtilsConnection::~WlanQtUtilsConnection() +{ +} + +/*! + Connection ID getter. + + @return Connection ID specific for Connection Monitor Server. +*/ + +uint WlanQtUtilsConnection::connectionId() const +{ + return mConnectionId; +} + +/*! + Connection ID setter. + + @param [in] connectionId Connection Monitor Server Connection ID. +*/ + +void WlanQtUtilsConnection::setConnectionId(uint connectionId) +{ + mConnectionId = connectionId; +} + +/*! + IAP ID getter. + + @return IAP ID. +*/ + +uint WlanQtUtilsConnection::iapId() const +{ + return mIapId; +} + +/*! + IAP ID setter. + + @param [in] iapId IAP ID. +*/ + +void WlanQtUtilsConnection::setIapId(uint iapId) +{ + mIapId = iapId; +} + +/*! + Connection status getter. + + @return Status of the connection. +*/ + +WlanQtUtils::ConnStatus WlanQtUtilsConnection::connectionStatus() const +{ + return mConnectionStatus; +} + +/*! + Connection status setter. + + @param [in] connectionStatus Status of the connection. +*/ + +void WlanQtUtilsConnection::setConnectionStatus( + WlanQtUtils::ConnStatus connectionStatus) +{ + mConnectionStatus = connectionStatus; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/base/src/wlanqtutilsiap.cpp --- a/wlanutilities/wlanqtutilities/base/src/wlanqtutilsiap.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanqtutilities/base/src/wlanqtutilsiap.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -12,81 +12,60 @@ * Contributors: * * Description: -* +* WLAN IAP (Internet Access Point, known network) class. */ -#include +// System includes + +// User includes + #include "wlanqtutilsiap.h" -WlanQtUtilsIap::WlanQtUtilsIap() : - id_(0), - netId_(0), - name_(""), - bearerType_(WlanQtUtilsBearerTypeNone), - connectionStatus_(WlanQtUtilsConnectionStatusNone) +/*! + \class WlanQtUtilsIapPrivate + \brief Private implementation of WlanQtUtilsIap. + + This class is reserved for WlanQtUtilsIap private implementation. + + NOTE: Even though there is currently no implementation, this is + required for possible later additions to avoid binary compatibility + break. +*/ + +class WlanQtUtilsIapPrivate { + friend class WlanQtUtilsIap; +}; +/*! + \class WlanQtUtilsIap + \brief WLAN Internet Access Point class. + + Contains the information related to known WLAN access points. +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. +*/ + +WlanQtUtilsIap::WlanQtUtilsIap() : + WlanQtUtilsAp(), + d_ptr(new WlanQtUtilsIapPrivate()) +{ } -WlanQtUtilsIap::WlanQtUtilsIap( - int id, - int netId, - QString name, - WlanQtUtilsBearerType bearerType) : - id_(id), netId_(netId), name_(name), bearerType_(bearerType), connectionStatus_(WlanQtUtilsConnectionStatusNone) -{ -} +/*! + Destructor. +*/ WlanQtUtilsIap::~WlanQtUtilsIap() { } - -int WlanQtUtilsIap::id() const -{ - return id_; -} - -int WlanQtUtilsIap::networkId() const -{ - return netId_; -} - -QString WlanQtUtilsIap::name() const -{ - return name_; -} - -WlanQtUtilsBearerType WlanQtUtilsIap::bearerType() const -{ - return bearerType_; -} - -WlanQtUtilsConnectionStatus WlanQtUtilsIap::connectionStatus() const -{ - return connectionStatus_; -} - -void WlanQtUtilsIap::setId(int id) -{ - id_ = id; -} - -void WlanQtUtilsIap::setNetworkId(int netId) -{ - netId_ = netId; -} - -void WlanQtUtilsIap::setName(QString name) -{ - name_ = name; -} - -void WlanQtUtilsIap::setBearerType(WlanQtUtilsBearerType bearerType) -{ - bearerType_ = bearerType; -} - -void WlanQtUtilsIap::setConnectionStatus(WlanQtUtilsConnectionStatus connectionStatus) -{ - connectionStatus_ = connectionStatus; -} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/base/src/wlanqtutilsiapsettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/base/src/wlanqtutilsiapsettings.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,627 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Qt Utilities WLAN IAP settings handling. +*/ + +// System includes + +#include +#include +#include + +#include +#include +#include + +// User includes + +#include "wlanqtutils.h" +#include "wlanqtutilsap.h" +#include "wlanqtutilsiap.h" +#include "wlanqtutilsiapsettings.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanqtutilsiapsettingsTraces.h" +#endif + +/*! + \class WlanQtUtilsIapSettings + \brief WLAN IAP related settings handler. + + Provides functionality to manipulate WLAN IAPs via the CM Manager Shim + interface. + + NOTE: Shim functions may throw exceptions that need to be catched in + this class. +*/ + +// External function prototypes + +// Local constants + +//! IAP trace types +#define WLANQTUTILS_IAP_TRACE_FETCH 1 +#define WLANQTUTILS_IAP_TRACE_CREATE 2 +#define WLANQTUTILS_IAP_TRACE_UPDATE 3 + +// WEP key lengths used to determine key format +static const int WepHex64BitMaxLength = 10; +static const int WepHex128BitMaxLength = 26; +static const int WepAscii64BitMaxLength = 5; +static const int WepAscii128BitMaxLength = 13; + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. + + @param [in] parent Parent object. +*/ + +WlanQtUtilsIapSettings::WlanQtUtilsIapSettings(QObject *parent) : + QObject(parent), + mCmManager(new CmManagerShim()) +{ + OstTraceFunctionEntry0(WLANQTUTILSIAPSETTINGS_WLANQTUTILSIAPSETTINGS_ENTRY); + OstTraceFunctionExit0(WLANQTUTILSIAPSETTINGS_WLANQTUTILSIAPSETTINGS_EXIT); +} + +/*! + Destructor. +*/ + +WlanQtUtilsIapSettings::~WlanQtUtilsIapSettings() +{ + OstTraceFunctionEntry0(DUP1_WLANQTUTILSIAPSETTINGS_WLANQTUTILSIAPSETTINGS_ENTRY); + + delete mCmManager; + + OstTraceFunctionExit0(DUP1_WLANQTUTILSIAPSETTINGS_WLANQTUTILSIAPSETTINGS_EXIT); +} + +/*! + Fetch all WLAN IAPs. + + @param [out] iapList List of WLAN IAPs. +*/ + +void WlanQtUtilsIapSettings::fetchIaps( + QList< QSharedPointer > &iapList) const +{ + OstTraceFunctionEntry0(WLANQTUTILSIAPSETTINGS_FETCHIAPS_ENTRY); + + // Clear the list content first for safety + iapList.clear(); + + QList iapIds; + try { + mCmManager->connectionMethod(iapIds, false); + } catch (const std::exception &ex) { + int error = qt_symbian_exception2Error(ex); + OstTrace1( + TRACE_NORMAL, + WLANQTUTILSIAPSETTINGS_FETCHIAPS_EXCEPTION, + "WlanQtUtilsIapSettings::fetchIaps exception;error=%d", + error); + } + +#ifdef OST_TRACE_COMPILER_IN_USE + int iapCount = iapIds.count(); + OstTrace1( + TRACE_NORMAL, + WLANQTUTILSIAPSETTINGS_FETCHIAPS_COUNT, + "WlanQtUtilsIapSettings::fetchIaps;iapCount=%d", + iapCount); +#endif + + foreach (uint iapId, iapIds) { + QSharedPointer wlanIap = fetchIap(iapId); + if (wlanIap) { + iapList.append(wlanIap); + } + } + + OstTraceFunctionExit0(WLANQTUTILSIAPSETTINGS_FETCHIAPS_EXIT); +} + +/*! + Fetch WLAN IAP with the given ID + + @param [in] iapId ID of IAP to fetch. + + @return Found IAP, NULL if not found. +*/ + +QSharedPointer WlanQtUtilsIapSettings::fetchIap(uint iapId) const +{ + OstTraceFunctionEntry0(WLANQTUTILSIAPSETTINGS_FETCHIAP_ENTRY); + + QSharedPointer wlanIap; + try { + QScopedPointer iap( + mCmManager->connectionMethod(iapId)); + if (iap && iap->getIntAttribute(CMManagerShim::CmBearerType) == + KUidWlanBearerType) { + + // Get WLAN IAP parameters + int netId = iap->getIntAttribute(CMManagerShim::CmNetworkId); + QString name = iap->getStringAttribute(CMManagerShim::CmName); + QString ssid = iap->getStringAttribute(CMManagerShim::WlanSSID); + int connMode = iap->getIntAttribute(CMManagerShim::WlanConnectionMode); + int secMode = iap->getIntAttribute( + CMManagerShim::WlanSecurityMode); + bool wpaPskUse = iap->getBoolAttribute( + CMManagerShim::WlanEnableWpaPsk); + + // Create a WLAN Qt Utils IAP + wlanIap = QSharedPointer(new WlanQtUtilsIap()); + wlanIap->setValue(WlanQtUtilsIap::ConfIdIapId, iapId); + wlanIap->setValue(WlanQtUtilsIap::ConfIdNetworkId, netId); + wlanIap->setValue(WlanQtUtilsIap::ConfIdName, name); + wlanIap->setValue(WlanQtUtilsAp::ConfIdSsid, ssid); + wlanIap->setValue(WlanQtUtilsAp::ConfIdConnectionMode, connMode); + wlanIap->setValue(WlanQtUtilsAp::ConfIdSecurityMode, secMode); + wlanIap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, wpaPskUse); + + // Trace the fetched IAP + traceIap( + wlanIap.data(), + WLANQTUTILS_IAP_TRACE_FETCH, + iapId); + } + } catch (const std::exception &ex) { + int error = qt_symbian_exception2Error(ex); + OstTrace1( + TRACE_NORMAL, + WLANQTUTILSIAPSETTINGS_FETCHIAP_EXCEPTION, + "WlanQtUtilsIapSettings::fetchIap exception;error=%d", + error); + } + + OstTraceFunctionExit0(WLANQTUTILSIAPSETTINGS_FETCHIAP_EXIT); + return wlanIap; +} + +/*! + Create a new WLAN IAP as an uncategorized IAP. + + @param [in] wlanAp Information about the WLAN AP. + + @return ID of the created IAP, IapIdNone in error cases. +*/ + +int WlanQtUtilsIapSettings::createIap(const WlanQtUtilsAp *wlanAp) +{ + OstTraceFunctionEntry0(WLANQTUTILSIAPSETTINGS_CREATEIAP_ENTRY); + + int iapId = WlanQtUtils::IapIdNone; + + try { + // Create the new IAP + QScopedPointer iap( + mCmManager->createConnectionMethod(KUidWlanBearerType)); + storeSettings(wlanAp, iap.data()); + iapId = iap->getIntAttribute(CMManagerShim::CmIapId); + + // Trace the created IAP + traceIap( + wlanAp, + WLANQTUTILS_IAP_TRACE_CREATE, + iapId); + } catch (const std::exception &ex) { + // Trace error cause and return failure (default value) to caller. + int error = qt_symbian_exception2Error(ex); + OstTrace1( + TRACE_NORMAL, + WLANQTUTILSIAPSETTINGS_CREATEIAP_EXCEPTION, + "WlanQtUtilsIapSettings::createIap exception;error=%d", + error); + } + + OstTraceFunctionExit0(WLANQTUTILSIAPSETTINGS_CREATEIAP_EXIT); + return iapId; +} + +/*! + Update the WLAN IAP given as parameter. All settings are stored to + database (again) without checking whether they have actually changed + or not. + + @param [in] iapId ID of IAP to update. + @param [in] wlanAp Information about the WLAN AP. + + @return Was update succesful or not? +*/ + +bool WlanQtUtilsIapSettings::updateIap( + int iapId, + const WlanQtUtilsAp *wlanAp) +{ + OstTraceFunctionEntry0(WLANQTUTILSIAPSETTINGS_UPDATEIAP_ENTRY); + + bool success = false; + + try { + QScopedPointer iap( + mCmManager->connectionMethod(iapId)); + storeSettings(wlanAp, iap.data()); + // Trace the updated IAP + traceIap( + wlanAp, + WLANQTUTILS_IAP_TRACE_UPDATE, + iapId); + success = true; + } catch (const std::exception &ex) { + // Trace error cause and return failure (default value) to caller. + int error = qt_symbian_exception2Error(ex); + OstTrace1( + TRACE_NORMAL, + WLANQTUTILSIAPSETTINGS_UPDATEIAP_EXCEPTION, + "WlanQtUtilsIapSettings::updateIap exception;error=%d", + error); + } + + OstTraceFunctionExit0(WLANQTUTILSIAPSETTINGS_UPDATEIAP_EXIT); + return success; +} + +/*! + Delete the WLAN IAP given as parameter. + + @param [in] iapId ID of IAP to delete. +*/ + +void WlanQtUtilsIapSettings::deleteIap(int iapId) +{ + OstTraceFunctionEntry0(WLANQTUTILSIAPSETTINGS_DELETEIAP_ENTRY); + + try { + QScopedPointer iap( + mCmManager->connectionMethod(iapId)); + iap->deleteConnectionMethod(); + } catch (const std::exception &ex) { + // Just trace error cause. It is not fatal, if we are not able to + // delete the IAP. No need to retry, since errors should be very + // rare and user can delete the IAP later from Control Panel, if + // needed. + int error = qt_symbian_exception2Error(ex); + OstTrace1( + TRACE_NORMAL, + WLANQTUTILSIAPSETTINGS_DELETEIAP_EXCEPTION, + "WlanQtUtilsIapSettings::deleteIap exception;error=%d", + error); + } + + OstTraceFunctionExit0(WLANQTUTILSIAPSETTINGS_DELETEIAP_EXIT); +} + +/*! + Move IAP to the Internet SNAP. + + @param [in] iapId ID of the IAP to move. +*/ + +void WlanQtUtilsIapSettings::moveIapToInternetSnap(int iapId) +{ + OstTraceFunctionEntry0(WLANQTUTILSIAPSETTINGS_MOVEIAPTOINTERNETSNAP_ENTRY); + + // Read all destination (SNAP) IDs + QList destinations; + try { + mCmManager->allDestinations(destinations); + foreach (int destId, destinations) { + QScopedPointer destination( + mCmManager->destination(destId)); + + // Internet destination will always exist in the system. It has + // SnapPurposeInternet set in its metadata. + if (destination->metadata(CMManagerShim::SnapMetadataPurpose) + == CMManagerShim::SnapPurposeInternet) { + QScopedPointer iap( + mCmManager->connectionMethod(iapId)); + destination->addConnectionMethod(iap.data()); + destination->update(); + break; + } + } + } catch (const std::exception &ex) { + int error = qt_symbian_exception2Error(ex); + OstTrace1( + TRACE_NORMAL, + WLANQTUTILSIAPSETTINGS_MOVEIAPTOINTERNETSNAP_EXCEPTION, + "WlanQtUtilsIapSettings::moveIapToInternetSnap exception;error=%d", + error); + } + + OstTraceFunctionExit0(WLANQTUTILSIAPSETTINGS_MOVEIAPTOINTERNETSNAP_EXIT); +} + +/*! + Set Hotspot metadata to the Hotspot IAP given as parameter. + + @param [in] iapId ID of IAP to set. +*/ + +void WlanQtUtilsIapSettings::setAsHotspotIap(int iapId) +{ + OstTraceFunctionEntry0(WLANQTUTILSIAPSETTINGS_SETASHOTSPOTIAP_ENTRY); + + try { + QScopedPointer iap( + mCmManager->connectionMethod(iapId)); + iap->setBoolAttribute(CMManagerShim::CmMetaHotSpot, true); + iap->update(); + } catch (const std::exception &ex) { + // Just trace error cause. It is not fatal, if we are not able to + // set IAP as hotspot IAP. No need to retry, since errors should be very + // rare and it does not prevent connection opening of the hotspot IAP. + int error = qt_symbian_exception2Error(ex); + OstTrace1( + TRACE_NORMAL, + WLANQTUTILSIAPSETTINGS_SETASHOTSPOTIAP_EXCEPTION, + "WlanQtUtilsIapSettings::setAsHotspotIap exception;error=%d", + error); + } + + OstTraceFunctionExit0(WLANQTUTILSIAPSETTINGS_SETASHOTSPOTIAP_EXIT); +} + +/*! + Stores the given Wlan AP settings to database using CM Manager Shim. + + @param [in] wlanAp WLAN AP settings to store. + @param [in] iap WLAN IAP to store to. +*/ + +void WlanQtUtilsIapSettings::storeSettings( + const WlanQtUtilsAp *wlanAp, + CmConnectionMethodShim *iap) +{ + OstTraceFunctionEntry0(WLANQTUTILSIAPSETTINGS_STORESETTINGS_ENTRY); + + int secMode = wlanAp->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(); + QString ssid = wlanAp->value(WlanQtUtilsAp::ConfIdSsid).toString(); + + // Store general settings + iap->setStringAttribute(CMManagerShim::CmName, ssid); + iap->setStringAttribute(CMManagerShim::WlanSSID, ssid); + iap->setIntAttribute(CMManagerShim::WlanSecurityMode, secMode); + iap->setIntAttribute( + CMManagerShim::WlanConnectionMode, + wlanAp->value(WlanQtUtilsAp::ConfIdConnectionMode).toInt()); + + // Store the WEP settings + storeWepKey( + wlanAp->value(WlanQtUtilsAp::ConfIdWepKey1).toString(), + 1, + iap); + storeWepKey( + wlanAp->value(WlanQtUtilsAp::ConfIdWepKey2).toString(), + 2, + iap); + storeWepKey( + wlanAp->value(WlanQtUtilsAp::ConfIdWepKey3).toString(), + 3, + iap); + storeWepKey( + wlanAp->value(WlanQtUtilsAp::ConfIdWepKey4).toString(), + 4, + iap); + iap->setIntAttribute( + CMManagerShim::WlanWepKeyIndex, + wlanAp->value(WlanQtUtilsAp::ConfIdWepDefaultIndex).toInt()); + + // Store WPA PSK settings + bool usePsk = wlanAp->value(WlanQtUtilsAp::ConfIdWpaPskUse).toBool(); + iap->setBoolAttribute(CMManagerShim::WlanEnableWpaPsk, usePsk); + QString wpaKey(wlanAp->value(WlanQtUtilsAp::ConfIdWpaPsk).toString()); + iap->setString8Attribute(CMManagerShim::WlanWpaPreSharedKey, wpaKey); + + // Write the settings. + iap->update(); + + OstTraceFunctionExit0(WLANQTUTILSIAPSETTINGS_STORESETTINGS_EXIT); +} + +/*! + Stores the given valid WEP key to database using CM Manager Shim. If key + is not used an empty key must be provided. + + @note This method MUST not be called for invalid WEP Keys and/or indexes. + Wlanwizard validates keys, before accepting user input. + + @param [in] key Key to write. + @param [in] index Key index. Valid range is [0,4]. + @param [in] iap WLAN IAP to store the key into. +*/ + +void WlanQtUtilsIapSettings::storeWepKey( + const QString &key, + int index, + CmConnectionMethodShim *iap) +{ + OstTraceFunctionEntry0(WLANQTUTILSIAPSETTINGS_STOREWEPKEY_ENTRY); + + int length = key.length(); + if (length == WepHex64BitMaxLength || length == WepHex128BitMaxLength) { + // HEX + iap->setString8Attribute(mapWepKeyIndexHex(index), key); + } else if (length == WepAscii64BitMaxLength || length == WepAscii128BitMaxLength) { + // ASCII + iap->setString8Attribute(mapWepKeyIndexAscii(index), key); + } else { + // Length must always be a valid one or zero + Q_ASSERT(length == 0); + + // Write default value. Note that the key is stored in the same data + // field regardless of the format so writing only one key is enough. + iap->setString8Attribute(mapWepKeyIndexHex(index), key); + } + + OstTraceFunctionExit0(WLANQTUTILSIAPSETTINGS_STOREWEPKEY_EXIT); +} + +/*! + Maps given Hex WEP key index into the corresponding CM Manager Connection + Method attribute. + + @param [in] index Hex WEP key index [1,4]. + + @return Connection Method attribute. +*/ + +CMManagerShim::ConnectionMethodAttribute WlanQtUtilsIapSettings::mapWepKeyIndexHex( + int index) +{ + CMManagerShim::ConnectionMethodAttribute attribute = + CMManagerShim::WlanWepKey1InHex; + + switch (index) { + case 1: + attribute = CMManagerShim::WlanWepKey1InHex; + break; + + case 2: + attribute = CMManagerShim::WlanWepKey2InHex; + break; + + case 3: + attribute = CMManagerShim::WlanWepKey3InHex; + break; + + case 4: + attribute = CMManagerShim::WlanWepKey4InHex; + break; + +#ifndef QT_NO_DEBUG + default: + // Invalid key index detected + Q_ASSERT(0); + break; +#endif + } + + return attribute; +} + +/*! + Maps given Ascii WEP key index into the corresponding CM Manager Connection + Method attribute. + + @param [in] index Ascii WEP key index [1,4]. + + @return Connection Method attribute. +*/ + +CMManagerShim::ConnectionMethodAttribute WlanQtUtilsIapSettings::mapWepKeyIndexAscii( + int index) +{ + CMManagerShim::ConnectionMethodAttribute attribute = + CMManagerShim::WlanWepKey1InAscii; + + switch (index) { + case 1: + attribute = CMManagerShim::WlanWepKey1InAscii; + break; + + case 2: + attribute = CMManagerShim::WlanWepKey2InAscii; + break; + + case 3: + attribute = CMManagerShim::WlanWepKey3InAscii; + break; + + case 4: + attribute = CMManagerShim::WlanWepKey4InAscii; + break; + +#ifndef QT_NO_DEBUG + default: + // Invalid key index detected + Q_ASSERT(0); + break; +#endif + } + + return attribute; +} + +/* + Traces given IAP (which is taken in as an AP). + + @param [in] ap IAP to trace. + @param [in] traceType Trace type (WLANQTUTILS_IAP_TRACE_*). + @param [in] iapId IAP ID. +*/ + +void WlanQtUtilsIapSettings::traceIap( + const WlanQtUtilsAp *ap, + int traceType, + uint iapId) const +{ +#ifndef OST_TRACE_COMPILER_IN_USE + Q_UNUSED(ap); + Q_UNUSED(traceType); + Q_UNUSED(iapId); +#else + QString ssid_string(ap->value(WlanQtUtilsAp::ConfIdSsid).toString()); + TPtrC16 ssid(ssid_string.utf16(), ssid_string.length()); + int secMode = ap->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(); + int connMode = ap->value(WlanQtUtilsAp::ConfIdConnectionMode).toInt(); + bool useWpaPsk = ap->value(WlanQtUtilsAp::ConfIdWpaPskUse).toBool(); + + switch (traceType) { + case WLANQTUTILS_IAP_TRACE_FETCH: + OstTraceExt5( + TRACE_NORMAL, + WLANQTUTILSIAPSETTINGS_TRACEIAP_FETCH, + "WlanQtUtilsIapSettings::traceIap Fetched;iapId=%u;ssid=%S;secMode=%{WlanSecMode};useWpaPsk=%u;connMode=%{WlanConnMode}", + iapId, + ssid, + secMode, + useWpaPsk, + connMode); + break; + + case WLANQTUTILS_IAP_TRACE_CREATE: + OstTraceExt5( + TRACE_NORMAL, + WLANQTUTILSIAPSETTINGS_TRACEIAP_CREATE, + "WlanQtUtilsIapSettings::traceIap Created;iapId=%u;ssid=%S;secMode=%{WlanSecMode};useWpaPsk=%u;connMode=%{WlanConnMode}", + iapId, + ssid, + secMode, + useWpaPsk, + connMode); + break; + + case WLANQTUTILS_IAP_TRACE_UPDATE: + OstTraceExt5( + TRACE_NORMAL, + WLANQTUTILSIAPSETTINGS_TRACEIAP_UPDATE, + "WlanQtUtilsIapSettings::traceIap Updated;iapId=%u;ssid=%S;secMode=%{WlanSecMode};useWpaPsk=%u;connMode=%{WlanConnMode}", + iapId, + ssid, + secMode, + useWpaPsk, + connMode); + break; + } +#endif +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/base/src/wlanqtutilswlanap.cpp --- a/wlanutilities/wlanqtutilities/base/src/wlanqtutilswlanap.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This is the source file for WlanQtUtilsWlanAp class. -*/ - -#include -#include "wlanqtutilscommon.h" -#include "wlanqtutilswlanap.h" - -WlanQtUtilsWlanAp::WlanQtUtilsWlanAp() : ssid_(""), bssid_(""), signalStrength_(0), connectionMode_(0), - securityMode_(WlanQtUtilsWlanSecModeOpen), securityKey_("") -{ -} - -WlanQtUtilsWlanAp::WlanQtUtilsWlanAp(const WlanQtUtilsWlanAp &ref) : - ssid_(ref.ssid()), - bssid_(ref.bssid()), - signalStrength_(ref.signalStrength()), - connectionMode_(ref.connectionMode()), - securityMode_(ref.securityMode()), - securityKey_(ref.securityKey()) -{ -} - -WlanQtUtilsWlanAp::WlanQtUtilsWlanAp( - QString ssid, - QString bssid, - int signalStrength, - int connectionMode, - WlanQtUtilsWlanSecMode securityMode) : ssid_(ssid), bssid_(bssid), signalStrength_(signalStrength), - connectionMode_(connectionMode), securityMode_(securityMode), securityKey_("") -{ -} - -WlanQtUtilsWlanAp::~WlanQtUtilsWlanAp() -{ -} - -QString WlanQtUtilsWlanAp::ssid() const -{ - return ssid_; -} - -QString WlanQtUtilsWlanAp::bssid() const -{ - return bssid_; -} - -int WlanQtUtilsWlanAp::signalStrength() const -{ - return signalStrength_; -} - -int WlanQtUtilsWlanAp::connectionMode() const -{ - return connectionMode_; -} - -WlanQtUtilsWlanSecMode WlanQtUtilsWlanAp::securityMode() const -{ - return securityMode_; -} - -QString WlanQtUtilsWlanAp::securityKey() const -{ - return securityKey_; -} - -void WlanQtUtilsWlanAp::setSsid(QString ssid) -{ - ssid_ = ssid; -} - -void WlanQtUtilsWlanAp::setBssid(QString bssid) -{ - bssid_ = bssid; -} - -void WlanQtUtilsWlanAp::setSignalStrength(int signalStrength) -{ - signalStrength_ = signalStrength; -} - -void WlanQtUtilsWlanAp::setConnectionMode(int connectionMode) -{ - connectionMode_ = connectionMode; -} - -void WlanQtUtilsWlanAp::setSecurityMode(WlanQtUtilsWlanSecMode securityMode) -{ - securityMode_ = securityMode; -} - -void WlanQtUtilsWlanAp::setSecurityKey(QString securityKey) -{ - securityKey_ = securityKey; -} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/base/src/wlanqtutilswlaniap.cpp --- a/wlanutilities/wlanqtutilities/base/src/wlanqtutilswlaniap.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This is a source file for WlanQtUtilsWlanIap class. -*/ - -#include -#include "wlanqtutilscommon.h" -#include "wlanqtutilsiap.h" -#include "wlanqtutilswlaniap.h" - -WlanQtUtilsWlanIap::WlanQtUtilsWlanIap() : WlanQtUtilsIap(), ssid_(""), signalStrength_(WlanQtUtilsWlanSignalUnavailable), securityMode_(WlanQtUtilsWlanSecModeOpen) -{ -} - -WlanQtUtilsWlanIap::WlanQtUtilsWlanIap(int id, int netId, QString name, WlanQtUtilsBearerType bearerType, QString ssid, WlanQtUtilsWlanSecMode secMode) : - WlanQtUtilsIap(id, netId, name, bearerType), ssid_(ssid), signalStrength_(WlanQtUtilsWlanSignalUnavailable), securityMode_(secMode) -{ -} - -WlanQtUtilsWlanIap::~WlanQtUtilsWlanIap() -{ -} - -/** Returns IAP's SSID */ -QString WlanQtUtilsWlanIap::ssid() const -{ - return ssid_; -} - -/** Returns IAP's signal strength */ -int WlanQtUtilsWlanIap::signalStrength() const -{ - return signalStrength_; -} - -/** Returns IAP's security mode */ -WlanQtUtilsWlanSecMode WlanQtUtilsWlanIap::securityMode() const -{ - return securityMode_; -} - -/** Sets IAP's SSID */ -void WlanQtUtilsWlanIap::setSsid(QString ssid) -{ - ssid_ = ssid; -} - -/** Sets IAP's signal strength */ -void WlanQtUtilsWlanIap::setSignalStrength(int signalStrength) -{ - signalStrength_ = signalStrength; -} - -/** Sets IAP's security mode */ -void WlanQtUtilsWlanIap::setSecurityMode(WlanQtUtilsWlanSecMode securityMode) -{ - securityMode_ = securityMode; -} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/bwins/wlanqtutilitiesu.def --- a/wlanutilities/wlanqtutilities/bwins/wlanqtutilitiesu.def Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanqtutilities/bwins/wlanqtutilitiesu.def Thu Jul 22 16:44:32 2010 +0100 @@ -1,80 +1,46 @@ EXPORTS - ?getStaticMetaObject@WlanQtUtilsWlanIap@@SAABUQMetaObject@@XZ @ 1 NONAME ; struct QMetaObject const & WlanQtUtilsWlanIap::getStaticMetaObject(void) - ?connectedWlanId@WlanQtUtils@@QBEHXZ @ 2 NONAME ; int WlanQtUtils::connectedWlanId(void) const - ?masterWlanStatus@WlanQtUtils@@IAEX_N@Z @ 3 NONAME ; void WlanQtUtils::masterWlanStatus(bool) - ?Start@RConnection@@QAEXAAVTConnPref@@AAVTRequestStatus@@@Z @ 4 NONAME ; void RConnection::Start(class TConnPref &, class TRequestStatus &) - ?connectionMode@WlanQtUtilsWlanAp@@QBEHXZ @ 5 NONAME ; int WlanQtUtilsWlanAp::connectionMode(void) const - ??1WlanQtUtilsIap@@UAE@XZ @ 6 NONAME ; WlanQtUtilsIap::~WlanQtUtilsIap(void) - ??0WlanQtUtilsWlanAp@@QAE@VQString@@0HHW4WlanQtUtilsWlanSecMode@@@Z @ 7 NONAME ; WlanQtUtilsWlanAp::WlanQtUtilsWlanAp(class QString, class QString, int, int, enum WlanQtUtilsWlanSecMode) - ?staticMetaObject@WlanQtUtilsWlanIap@@2UQMetaObject@@B @ 8 NONAME ; struct QMetaObject const WlanQtUtilsWlanIap::staticMetaObject + ?iapName@WlanQtUtils@@QBE?AVQString@@H@Z @ 1 NONAME ; class QString WlanQtUtils::iapName(int) const + ??0WlanQtUtilsAp@@QAE@XZ @ 2 NONAME ; WlanQtUtilsAp::WlanQtUtilsAp(void) + ?updateIap@WlanQtUtils@@QAE_NHPBVWlanQtUtilsAp@@@Z @ 3 NONAME ; bool WlanQtUtils::updateIap(int, class WlanQtUtilsAp const *) + ?createIap@WlanQtUtils@@QAEHPBVWlanQtUtilsAp@@@Z @ 4 NONAME ; int WlanQtUtils::createIap(class WlanQtUtilsAp const *) + ?Start@RConnection@@QAEXAAVTConnPref@@AAVTRequestStatus@@@Z @ 5 NONAME ; void RConnection::Start(class TConnPref &, class TRequestStatus &) + ?value@WlanQtUtilsAp@@QBE?AVQVariant@@H@Z @ 6 NONAME ; class QVariant WlanQtUtilsAp::value(int) const + ??1WlanQtUtilsIap@@UAE@XZ @ 7 NONAME ; WlanQtUtilsIap::~WlanQtUtilsIap(void) + ?qt_metacast@WlanQtUtils@@UAEPAXPBD@Z @ 8 NONAME ; void * WlanQtUtils::qt_metacast(char const *) ?qt_metacall@WlanQtUtils@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 9 NONAME ; int WlanQtUtils::qt_metacall(enum QMetaObject::Call, int, void * *) - ?metaObject@WlanQtUtilsWlanIap@@UBEPBUQMetaObject@@XZ @ 10 NONAME ; struct QMetaObject const * WlanQtUtilsWlanIap::metaObject(void) const - ?tr@WlanQtUtilsWlanIap@@SA?AVQString@@PBD0H@Z @ 11 NONAME ; class QString WlanQtUtilsWlanIap::tr(char const *, char const *, int) - ?networkId@WlanQtUtilsIap@@QBEHXZ @ 12 NONAME ; int WlanQtUtilsIap::networkId(void) const - ?qt_metacall@WlanQtUtilsWlanIap@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 13 NONAME ; int WlanQtUtilsWlanIap::qt_metacall(enum QMetaObject::Call, int, void * *) - ?staticMetaObject@WlanQtUtils@@2UQMetaObject@@B @ 14 NONAME ; struct QMetaObject const WlanQtUtils::staticMetaObject - ?disconnectIap@WlanQtUtils@@QAEXH@Z @ 15 NONAME ; void WlanQtUtils::disconnectIap(int) - ??0WlanQtUtilsIap@@QAE@HHVQString@@W4WlanQtUtilsBearerType@@@Z @ 16 NONAME ; WlanQtUtilsIap::WlanQtUtilsIap(int, int, class QString, enum WlanQtUtilsBearerType) - ?ssid@WlanQtUtilsWlanAp@@QBE?AVQString@@XZ @ 17 NONAME ; class QString WlanQtUtilsWlanAp::ssid(void) const - ??1WlanQtUtilsWlanAp@@UAE@XZ @ 18 NONAME ; WlanQtUtilsWlanAp::~WlanQtUtilsWlanAp(void) - ?bearerType@WlanQtUtilsIap@@QBE?AW4WlanQtUtilsBearerType@@XZ @ 19 NONAME ; enum WlanQtUtilsBearerType WlanQtUtilsIap::bearerType(void) const - ?GetPckgAttribute@RConnectionMonitor@@QBEXIIIAAVTDes16@@AAVTRequestStatus@@@Z @ 20 NONAME ; void RConnectionMonitor::GetPckgAttribute(unsigned int, unsigned int, unsigned int, class TDes16 &, class TRequestStatus &) const - ?signalStrength@WlanQtUtilsWlanIap@@QBEHXZ @ 21 NONAME ; int WlanQtUtilsWlanIap::signalStrength(void) const - ??_EWlanQtUtilsWlanIap@@UAE@I@Z @ 22 NONAME ; WlanQtUtilsWlanIap::~WlanQtUtilsWlanIap(unsigned int) - ?wlanNetworkOpened@WlanQtUtils@@IAEXH@Z @ 23 NONAME ; void WlanQtUtils::wlanNetworkOpened(int) - ?metaObject@WlanQtUtils@@UBEPBUQMetaObject@@XZ @ 24 NONAME ; struct QMetaObject const * WlanQtUtils::metaObject(void) const - ?setId@WlanQtUtilsIap@@QAEXH@Z @ 25 NONAME ; void WlanQtUtilsIap::setId(int) - ?setConnectionStatus@WlanQtUtilsIap@@QAEXW4WlanQtUtilsConnectionStatus@@@Z @ 26 NONAME ; void WlanQtUtilsIap::setConnectionStatus(enum WlanQtUtilsConnectionStatus) - ?createWlanIap@WlanQtUtils@@QAEHPBVWlanQtUtilsWlanAp@@@Z @ 27 NONAME ; int WlanQtUtils::createWlanIap(class WlanQtUtilsWlanAp const *) - ?setName@WlanQtUtilsIap@@QAEXVQString@@@Z @ 28 NONAME ; void WlanQtUtilsIap::setName(class QString) - ?setSsid@WlanQtUtilsWlanIap@@QAEXVQString@@@Z @ 29 NONAME ; void WlanQtUtilsWlanIap::setSsid(class QString) - ?setSecurityMode@WlanQtUtilsWlanIap@@QAEXW4WlanQtUtilsWlanSecMode@@@Z @ 30 NONAME ; void WlanQtUtilsWlanIap::setSecurityMode(enum WlanQtUtilsWlanSecMode) - ?tr@WlanQtUtils@@SA?AVQString@@PBD0H@Z @ 31 NONAME ; class QString WlanQtUtils::tr(char const *, char const *, int) - ?name@WlanQtUtilsIap@@QBE?AVQString@@XZ @ 32 NONAME ; class QString WlanQtUtilsIap::name(void) const - ?masterWlan@WlanQtUtils@@QBE_NXZ @ 33 NONAME ; bool WlanQtUtils::masterWlan(void) const - ?qt_metacast@WlanQtUtilsWlanIap@@UAEPAXPBD@Z @ 34 NONAME ; void * WlanQtUtilsWlanIap::qt_metacast(char const *) - ?securityKey@WlanQtUtilsWlanAp@@QBE?AVQString@@XZ @ 35 NONAME ; class QString WlanQtUtilsWlanAp::securityKey(void) const - ??0WlanQtUtilsIap@@QAE@XZ @ 36 NONAME ; WlanQtUtilsIap::WlanQtUtilsIap(void) - ?iap@WlanQtUtils@@QBEPAVWlanQtUtilsIap@@H@Z @ 37 NONAME ; class WlanQtUtilsIap * WlanQtUtils::iap(int) const - ??_EWlanQtUtilsWlanAp@@UAE@I@Z @ 38 NONAME ; WlanQtUtilsWlanAp::~WlanQtUtilsWlanAp(unsigned int) - ?tr@WlanQtUtilsWlanIap@@SA?AVQString@@PBD0@Z @ 39 NONAME ; class QString WlanQtUtilsWlanIap::tr(char const *, char const *) - ?setSecurityKey@WlanQtUtilsWlanAp@@QAEXVQString@@@Z @ 40 NONAME ; void WlanQtUtilsWlanAp::setSecurityKey(class QString) - ??0WlanQtUtilsWlanAp@@QAE@XZ @ 41 NONAME ; WlanQtUtilsWlanAp::WlanQtUtilsWlanAp(void) - ?qt_metacast@WlanQtUtils@@UAEPAXPBD@Z @ 42 NONAME ; void * WlanQtUtils::qt_metacast(char const *) - ?ssid@WlanQtUtilsWlanIap@@QBE?AVQString@@XZ @ 43 NONAME ; class QString WlanQtUtilsWlanIap::ssid(void) const - ?setNetworkId@WlanQtUtilsIap@@QAEXH@Z @ 44 NONAME ; void WlanQtUtilsIap::setNetworkId(int) - ?availableWlanAps@WlanQtUtils@@QAEXAAV?$QList@PAVWlanQtUtilsWlanIap@@@@AAV?$QList@PAVWlanQtUtilsWlanAp@@@@@Z @ 45 NONAME ; void WlanQtUtils::availableWlanAps(class QList &, class QList &) - ?trUtf8@WlanQtUtilsWlanIap@@SA?AVQString@@PBD0@Z @ 46 NONAME ; class QString WlanQtUtilsWlanIap::trUtf8(char const *, char const *) - ??0WlanQtUtilsWlanIap@@QAE@HHVQString@@W4WlanQtUtilsBearerType@@0W4WlanQtUtilsWlanSecMode@@@Z @ 47 NONAME ; WlanQtUtilsWlanIap::WlanQtUtilsWlanIap(int, int, class QString, enum WlanQtUtilsBearerType, class QString, enum WlanQtUtilsWlanSecMode) - ?tr@WlanQtUtils@@SA?AVQString@@PBD0@Z @ 48 NONAME ; class QString WlanQtUtils::tr(char const *, char const *) - ??0WlanQtUtilsWlanIap@@QAE@XZ @ 49 NONAME ; WlanQtUtilsWlanIap::WlanQtUtilsWlanIap(void) - ?setBssid@WlanQtUtilsWlanAp@@QAEXVQString@@@Z @ 50 NONAME ; void WlanQtUtilsWlanAp::setBssid(class QString) - ?setSsid@WlanQtUtilsWlanAp@@QAEXVQString@@@Z @ 51 NONAME ; void WlanQtUtilsWlanAp::setSsid(class QString) - ?signalStrength@WlanQtUtilsWlanAp@@QBEHXZ @ 52 NONAME ; int WlanQtUtilsWlanAp::signalStrength(void) const - ?setBearerType@WlanQtUtilsIap@@QAEXW4WlanQtUtilsBearerType@@@Z @ 53 NONAME ; void WlanQtUtilsIap::setBearerType(enum WlanQtUtilsBearerType) - ?setSignalStrength@WlanQtUtilsWlanAp@@QAEXH@Z @ 54 NONAME ; void WlanQtUtilsWlanAp::setSignalStrength(int) - ??1WlanQtUtils@@UAE@XZ @ 55 NONAME ; WlanQtUtils::~WlanQtUtils(void) - ?scanWlans@WlanQtUtils@@QAEXXZ @ 56 NONAME ; void WlanQtUtils::scanWlans(void) - ?setSignalStrength@WlanQtUtilsWlanIap@@QAEXH@Z @ 57 NONAME ; void WlanQtUtilsWlanIap::setSignalStrength(int) - ?EventType@CConnMonEventBase@@QBEHXZ @ 58 NONAME ; int CConnMonEventBase::EventType(void) const - ?setSecurityMode@WlanQtUtilsWlanAp@@QAEXW4WlanQtUtilsWlanSecMode@@@Z @ 59 NONAME ; void WlanQtUtilsWlanAp::setSecurityMode(enum WlanQtUtilsWlanSecMode) - ?trUtf8@WlanQtUtilsWlanIap@@SA?AVQString@@PBD0H@Z @ 60 NONAME ; class QString WlanQtUtilsWlanIap::trUtf8(char const *, char const *, int) - ?id@WlanQtUtilsIap@@QBEHXZ @ 61 NONAME ; int WlanQtUtilsIap::id(void) const - ??1WlanQtUtilsWlanIap@@UAE@XZ @ 62 NONAME ; WlanQtUtilsWlanIap::~WlanQtUtilsWlanIap(void) - ?securityMode@WlanQtUtilsWlanIap@@QBE?AW4WlanQtUtilsWlanSecMode@@XZ @ 63 NONAME ; enum WlanQtUtilsWlanSecMode WlanQtUtilsWlanIap::securityMode(void) const - ??_EWlanQtUtilsIap@@UAE@I@Z @ 64 NONAME ; WlanQtUtilsIap::~WlanQtUtilsIap(unsigned int) - ??_EWlanQtUtils@@UAE@I@Z @ 65 NONAME ; WlanQtUtils::~WlanQtUtils(unsigned int) - ?wlanScanReady@WlanQtUtils@@IAEXXZ @ 66 NONAME ; void WlanQtUtils::wlanScanReady(void) - ?wlanNetworkClosed@WlanQtUtils@@IAEXH@Z @ 67 NONAME ; void WlanQtUtils::wlanNetworkClosed(int) - ?bssid@WlanQtUtilsWlanAp@@QBE?AVQString@@XZ @ 68 NONAME ; class QString WlanQtUtilsWlanAp::bssid(void) const - ??0WlanQtUtilsWlanAp@@QAE@ABV0@@Z @ 69 NONAME ; WlanQtUtilsWlanAp::WlanQtUtilsWlanAp(class WlanQtUtilsWlanAp const &) - ??0WlanQtUtils@@QAE@XZ @ 70 NONAME ; WlanQtUtils::WlanQtUtils(void) - ?getStaticMetaObject@WlanQtUtils@@SAABUQMetaObject@@XZ @ 71 NONAME ; struct QMetaObject const & WlanQtUtils::getStaticMetaObject(void) - ?setConnectionMode@WlanQtUtilsWlanAp@@QAEXH@Z @ 72 NONAME ; void WlanQtUtilsWlanAp::setConnectionMode(int) - ?trUtf8@WlanQtUtils@@SA?AVQString@@PBD0@Z @ 73 NONAME ; class QString WlanQtUtils::trUtf8(char const *, char const *) - ?setMasterWlan@WlanQtUtils@@QAEX_N@Z @ 74 NONAME ; void WlanQtUtils::setMasterWlan(bool) - ?connectionStatus@WlanQtUtilsIap@@QBE?AW4WlanQtUtilsConnectionStatus@@XZ @ 75 NONAME ; enum WlanQtUtilsConnectionStatus WlanQtUtilsIap::connectionStatus(void) const - ?securityMode@WlanQtUtilsWlanAp@@QBE?AW4WlanQtUtilsWlanSecMode@@XZ @ 76 NONAME ; enum WlanQtUtilsWlanSecMode WlanQtUtilsWlanAp::securityMode(void) const - ?connectIap@WlanQtUtils@@QAEXH@Z @ 77 NONAME ; void WlanQtUtils::connectIap(int) - ?trUtf8@WlanQtUtils@@SA?AVQString@@PBD0H@Z @ 78 NONAME ; class QString WlanQtUtils::trUtf8(char const *, char const *, int) + ?availableWlanAps@WlanQtUtils@@QBEXAAV?$QList@V?$QSharedPointer@VWlanQtUtilsAp@@@@@@@Z @ 10 NONAME ; void WlanQtUtils::availableWlanAps(class QList > &) const + ??1WlanQtUtilsAp@@UAE@XZ @ 11 NONAME ; WlanQtUtilsAp::~WlanQtUtilsAp(void) + ?wlanScanApReady@WlanQtUtils@@IAEXH@Z @ 12 NONAME ; void WlanQtUtils::wlanScanApReady(int) + ?staticMetaObject@WlanQtUtils@@2UQMetaObject@@B @ 13 NONAME ; struct QMetaObject const WlanQtUtils::staticMetaObject + ??0WlanQtUtilsAp@@QAE@ABV0@@Z @ 14 NONAME ; WlanQtUtilsAp::WlanQtUtilsAp(class WlanQtUtilsAp const &) + ??_EWlanQtUtilsAp@@UAE@I@Z @ 15 NONAME ; WlanQtUtilsAp::~WlanQtUtilsAp(unsigned int) + ?disconnectIap@WlanQtUtils@@QAEXH@Z @ 16 NONAME ; void WlanQtUtils::disconnectIap(int) + ?scanWlanDirect@WlanQtUtils@@QAEXABVQString@@@Z @ 17 NONAME ; void WlanQtUtils::scanWlanDirect(class QString const &) + ?tr@WlanQtUtils@@SA?AVQString@@PBD0@Z @ 18 NONAME ; class QString WlanQtUtils::tr(char const *, char const *) + ?wlanNetworkClosed@WlanQtUtils@@IAEXHH@Z @ 19 NONAME ; void WlanQtUtils::wlanNetworkClosed(int, int) + ?ictResult@WlanQtUtils@@IAEXHH@Z @ 20 NONAME ; void WlanQtUtils::ictResult(int, int) + ?compare@WlanQtUtilsAp@@SAHPBV1@0P6AHABVQString@@1@Z@Z @ 21 NONAME ; int WlanQtUtilsAp::compare(class WlanQtUtilsAp const *, class WlanQtUtilsAp const *, int (*)(class QString const &, class QString const &)) + ?connectionStatus@WlanQtUtils@@QBE?AW4ConnStatus@1@XZ @ 22 NONAME ; enum WlanQtUtils::ConnStatus WlanQtUtils::connectionStatus(void) const + ?setValue@WlanQtUtilsAp@@QAEXHVQVariant@@@Z @ 23 NONAME ; void WlanQtUtilsAp::setValue(int, class QVariant) + ??1WlanQtUtils@@UAE@XZ @ 24 NONAME ; WlanQtUtils::~WlanQtUtils(void) + ?scanWlans@WlanQtUtils@@QAEXXZ @ 25 NONAME ; void WlanQtUtils::scanWlans(void) + ?EventType@CConnMonEventBase@@QBEHXZ @ 26 NONAME ; int CConnMonEventBase::EventType(void) const + ?activeIap@WlanQtUtils@@QBEHXZ @ 27 NONAME ; int WlanQtUtils::activeIap(void) const + ?scanWlanAps@WlanQtUtils@@QAEXXZ @ 28 NONAME ; void WlanQtUtils::scanWlanAps(void) + ?wlanNetworkOpened@WlanQtUtils@@IAEXH@Z @ 29 NONAME ; void WlanQtUtils::wlanNetworkOpened(int) + ?connectIap@WlanQtUtils@@QAEXH_N@Z @ 30 NONAME ; void WlanQtUtils::connectIap(int, bool) + ??_EWlanQtUtilsIap@@UAE@I@Z @ 31 NONAME ; WlanQtUtilsIap::~WlanQtUtilsIap(unsigned int) + ?metaObject@WlanQtUtils@@UBEPBUQMetaObject@@XZ @ 32 NONAME ; struct QMetaObject const * WlanQtUtils::metaObject(void) const + ??_EWlanQtUtils@@UAE@I@Z @ 33 NONAME ; WlanQtUtils::~WlanQtUtils(unsigned int) + ?wlanScanReady@WlanQtUtils@@IAEXH@Z @ 34 NONAME ; void WlanQtUtils::wlanScanReady(int) + ??0WlanQtUtils@@QAE@XZ @ 35 NONAME ; WlanQtUtils::WlanQtUtils(void) + ?stopWlanScan@WlanQtUtils@@QAEXXZ @ 36 NONAME ; void WlanQtUtils::stopWlanScan(void) + ?availableWlans@WlanQtUtils@@QBEXAAV?$QList@V?$QSharedPointer@VWlanQtUtilsIap@@@@@@AAV?$QList@V?$QSharedPointer@VWlanQtUtilsAp@@@@@@@Z @ 37 NONAME ; void WlanQtUtils::availableWlans(class QList > &, class QList > &) const + ?tr@WlanQtUtils@@SA?AVQString@@PBD0H@Z @ 38 NONAME ; class QString WlanQtUtils::tr(char const *, char const *, int) + ?getStaticMetaObject@WlanQtUtils@@SAABUQMetaObject@@XZ @ 39 NONAME ; struct QMetaObject const & WlanQtUtils::getStaticMetaObject(void) + ?trUtf8@WlanQtUtils@@SA?AVQString@@PBD0@Z @ 40 NONAME ; class QString WlanQtUtils::trUtf8(char const *, char const *) + ?deleteIap@WlanQtUtils@@QAEXH@Z @ 41 NONAME ; void WlanQtUtils::deleteIap(int) + ??0WlanQtUtilsIap@@QAE@XZ @ 42 NONAME ; WlanQtUtilsIap::WlanQtUtilsIap(void) + ?wlanScanDirectReady@WlanQtUtils@@IAEXH@Z @ 43 NONAME ; void WlanQtUtils::wlanScanDirectReady(int) + ?trUtf8@WlanQtUtils@@SA?AVQString@@PBD0H@Z @ 44 NONAME ; class QString WlanQtUtils::trUtf8(char const *, char const *, int) diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/eabi/wlanqtutilitiesu.def --- a/wlanutilities/wlanqtutilities/eabi/wlanqtutilitiesu.def Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanqtutilities/eabi/wlanqtutilitiesu.def Thu Jul 22 16:44:32 2010 +0100 @@ -1,89 +1,53 @@ EXPORTS - _ZN11WlanQtUtils10connectIapEi @ 1 NONAME + _ZN11WlanQtUtils10connectIapEib @ 1 NONAME _ZN11WlanQtUtils11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME _ZN11WlanQtUtils11qt_metacastEPKc @ 3 NONAME - _ZN11WlanQtUtils13createWlanIapEPK17WlanQtUtilsWlanAp @ 4 NONAME - _ZN11WlanQtUtils13disconnectIapEi @ 5 NONAME - _ZN11WlanQtUtils13setMasterWlanEb @ 6 NONAME - _ZN11WlanQtUtils13wlanScanReadyEv @ 7 NONAME - _ZN11WlanQtUtils16availableWlanApsER5QListIP18WlanQtUtilsWlanIapERS0_IP17WlanQtUtilsWlanApE @ 8 NONAME - _ZN11WlanQtUtils16masterWlanStatusEb @ 9 NONAME + _ZN11WlanQtUtils11scanWlanApsEv @ 4 NONAME + _ZN11WlanQtUtils12stopWlanScanEv @ 5 NONAME + _ZN11WlanQtUtils13disconnectIapEi @ 6 NONAME + _ZN11WlanQtUtils13wlanScanReadyEi @ 7 NONAME + _ZN11WlanQtUtils14scanWlanDirectERK7QString @ 8 NONAME + _ZN11WlanQtUtils15wlanScanApReadyEi @ 9 NONAME _ZN11WlanQtUtils16staticMetaObjectE @ 10 NONAME DATA 16 - _ZN11WlanQtUtils17wlanNetworkClosedEi @ 11 NONAME + _ZN11WlanQtUtils17wlanNetworkClosedEii @ 11 NONAME _ZN11WlanQtUtils17wlanNetworkOpenedEi @ 12 NONAME _ZN11WlanQtUtils19getStaticMetaObjectEv @ 13 NONAME - _ZN11WlanQtUtils9scanWlansEv @ 14 NONAME - _ZN11WlanQtUtilsC1Ev @ 15 NONAME - _ZN11WlanQtUtilsC2Ev @ 16 NONAME - _ZN11WlanQtUtilsD0Ev @ 17 NONAME - _ZN11WlanQtUtilsD1Ev @ 18 NONAME - _ZN11WlanQtUtilsD2Ev @ 19 NONAME - _ZN14WlanQtUtilsIap12setNetworkIdEi @ 20 NONAME - _ZN14WlanQtUtilsIap13setBearerTypeE21WlanQtUtilsBearerType @ 21 NONAME - _ZN14WlanQtUtilsIap19setConnectionStatusE27WlanQtUtilsConnectionStatus @ 22 NONAME - _ZN14WlanQtUtilsIap5setIdEi @ 23 NONAME - _ZN14WlanQtUtilsIap7setNameE7QString @ 24 NONAME - _ZN14WlanQtUtilsIapC1Eii7QString21WlanQtUtilsBearerType @ 25 NONAME - _ZN14WlanQtUtilsIapC1Ev @ 26 NONAME - _ZN14WlanQtUtilsIapC2Eii7QString21WlanQtUtilsBearerType @ 27 NONAME - _ZN14WlanQtUtilsIapC2Ev @ 28 NONAME - _ZN14WlanQtUtilsIapD0Ev @ 29 NONAME - _ZN14WlanQtUtilsIapD1Ev @ 30 NONAME - _ZN14WlanQtUtilsIapD2Ev @ 31 NONAME - _ZN17WlanQtUtilsWlanAp14setSecurityKeyE7QString @ 32 NONAME - _ZN17WlanQtUtilsWlanAp15setSecurityModeE22WlanQtUtilsWlanSecMode @ 33 NONAME - _ZN17WlanQtUtilsWlanAp17setConnectionModeEi @ 34 NONAME - _ZN17WlanQtUtilsWlanAp17setSignalStrengthEi @ 35 NONAME - _ZN17WlanQtUtilsWlanAp7setSsidE7QString @ 36 NONAME - _ZN17WlanQtUtilsWlanAp8setBssidE7QString @ 37 NONAME - _ZN17WlanQtUtilsWlanApC1E7QStringS0_ii22WlanQtUtilsWlanSecMode @ 38 NONAME - _ZN17WlanQtUtilsWlanApC1ERKS_ @ 39 NONAME - _ZN17WlanQtUtilsWlanApC1Ev @ 40 NONAME - _ZN17WlanQtUtilsWlanApC2E7QStringS0_ii22WlanQtUtilsWlanSecMode @ 41 NONAME - _ZN17WlanQtUtilsWlanApC2ERKS_ @ 42 NONAME - _ZN17WlanQtUtilsWlanApC2Ev @ 43 NONAME - _ZN17WlanQtUtilsWlanApD0Ev @ 44 NONAME - _ZN17WlanQtUtilsWlanApD1Ev @ 45 NONAME - _ZN17WlanQtUtilsWlanApD2Ev @ 46 NONAME - _ZN18WlanQtUtilsWlanIap11qt_metacallEN11QMetaObject4CallEiPPv @ 47 NONAME - _ZN18WlanQtUtilsWlanIap11qt_metacastEPKc @ 48 NONAME - _ZN18WlanQtUtilsWlanIap15setSecurityModeE22WlanQtUtilsWlanSecMode @ 49 NONAME - _ZN18WlanQtUtilsWlanIap16staticMetaObjectE @ 50 NONAME DATA 16 - _ZN18WlanQtUtilsWlanIap17setSignalStrengthEi @ 51 NONAME - _ZN18WlanQtUtilsWlanIap19getStaticMetaObjectEv @ 52 NONAME - _ZN18WlanQtUtilsWlanIap7setSsidE7QString @ 53 NONAME - _ZN18WlanQtUtilsWlanIapC1Eii7QString21WlanQtUtilsBearerTypeS0_22WlanQtUtilsWlanSecMode @ 54 NONAME - _ZN18WlanQtUtilsWlanIapC1Ev @ 55 NONAME - _ZN18WlanQtUtilsWlanIapC2Eii7QString21WlanQtUtilsBearerTypeS0_22WlanQtUtilsWlanSecMode @ 56 NONAME - _ZN18WlanQtUtilsWlanIapC2Ev @ 57 NONAME - _ZN18WlanQtUtilsWlanIapD0Ev @ 58 NONAME - _ZN18WlanQtUtilsWlanIapD1Ev @ 59 NONAME - _ZN18WlanQtUtilsWlanIapD2Ev @ 60 NONAME - _ZNK11WlanQtUtils10masterWlanEv @ 61 NONAME - _ZNK11WlanQtUtils10metaObjectEv @ 62 NONAME - _ZNK11WlanQtUtils15connectedWlanIdEv @ 63 NONAME - _ZNK11WlanQtUtils3iapEi @ 64 NONAME - _ZNK14WlanQtUtilsIap10bearerTypeEv @ 65 NONAME - _ZNK14WlanQtUtilsIap16connectionStatusEv @ 66 NONAME - _ZNK14WlanQtUtilsIap2idEv @ 67 NONAME - _ZNK14WlanQtUtilsIap4nameEv @ 68 NONAME - _ZNK14WlanQtUtilsIap9networkIdEv @ 69 NONAME - _ZNK17WlanQtUtilsWlanAp11securityKeyEv @ 70 NONAME - _ZNK17WlanQtUtilsWlanAp12securityModeEv @ 71 NONAME - _ZNK17WlanQtUtilsWlanAp14connectionModeEv @ 72 NONAME - _ZNK17WlanQtUtilsWlanAp14signalStrengthEv @ 73 NONAME - _ZNK17WlanQtUtilsWlanAp4ssidEv @ 74 NONAME - _ZNK17WlanQtUtilsWlanAp5bssidEv @ 75 NONAME - _ZNK18WlanQtUtilsWlanIap10metaObjectEv @ 76 NONAME - _ZNK18WlanQtUtilsWlanIap12securityModeEv @ 77 NONAME - _ZNK18WlanQtUtilsWlanIap14signalStrengthEv @ 78 NONAME - _ZNK18WlanQtUtilsWlanIap4ssidEv @ 79 NONAME - _ZTI11WlanQtUtils @ 80 NONAME - _ZTI14WlanQtUtilsIap @ 81 NONAME - _ZTI17WlanQtUtilsWlanAp @ 82 NONAME - _ZTI18WlanQtUtilsWlanIap @ 83 NONAME - _ZTV11WlanQtUtils @ 84 NONAME - _ZTV14WlanQtUtilsIap @ 85 NONAME - _ZTV17WlanQtUtilsWlanAp @ 86 NONAME - _ZTV18WlanQtUtilsWlanIap @ 87 NONAME + _ZN11WlanQtUtils19wlanScanDirectReadyEi @ 14 NONAME + _ZN11WlanQtUtils9createIapEPK13WlanQtUtilsAp @ 15 NONAME + _ZN11WlanQtUtils9deleteIapEi @ 16 NONAME + _ZN11WlanQtUtils9ictResultEii @ 17 NONAME + _ZN11WlanQtUtils9scanWlansEv @ 18 NONAME + _ZN11WlanQtUtils9updateIapEiPK13WlanQtUtilsAp @ 19 NONAME + _ZN11WlanQtUtilsC1Ev @ 20 NONAME + _ZN11WlanQtUtilsC2Ev @ 21 NONAME + _ZN11WlanQtUtilsD0Ev @ 22 NONAME + _ZN11WlanQtUtilsD1Ev @ 23 NONAME + _ZN11WlanQtUtilsD2Ev @ 24 NONAME + _ZN13WlanQtUtilsAp7compareEPKS_S1_PFiRK7QStringS4_E @ 25 NONAME + _ZN13WlanQtUtilsAp8setValueEi8QVariant @ 26 NONAME + _ZN13WlanQtUtilsApC1ERKS_ @ 27 NONAME + _ZN13WlanQtUtilsApC1Ev @ 28 NONAME + _ZN13WlanQtUtilsApC2ERKS_ @ 29 NONAME + _ZN13WlanQtUtilsApC2Ev @ 30 NONAME + _ZN13WlanQtUtilsApD0Ev @ 31 NONAME + _ZN13WlanQtUtilsApD1Ev @ 32 NONAME + _ZN13WlanQtUtilsApD2Ev @ 33 NONAME + _ZN14WlanQtUtilsIapC1Ev @ 34 NONAME + _ZN14WlanQtUtilsIapC2Ev @ 35 NONAME + _ZN14WlanQtUtilsIapD0Ev @ 36 NONAME + _ZN14WlanQtUtilsIapD1Ev @ 37 NONAME + _ZN14WlanQtUtilsIapD2Ev @ 38 NONAME + _ZNK11WlanQtUtils10metaObjectEv @ 39 NONAME + _ZNK11WlanQtUtils14availableWlansER5QListI14QSharedPointerI14WlanQtUtilsIapEERS0_IS1_I13WlanQtUtilsApEE @ 40 NONAME + _ZNK11WlanQtUtils16availableWlanApsER5QListI14QSharedPointerI13WlanQtUtilsApEE @ 41 NONAME + _ZNK11WlanQtUtils16connectionStatusEv @ 42 NONAME + _ZNK11WlanQtUtils7iapNameEi @ 43 NONAME + _ZNK11WlanQtUtils9activeIapEv @ 44 NONAME + _ZNK13WlanQtUtilsAp5valueEi @ 45 NONAME + _ZTI11WlanQtUtils @ 46 NONAME + _ZTI13WlanQtUtilsAp @ 47 NONAME + _ZTI14WlanQtUtilsIap @ 48 NONAME + _ZTV11WlanQtUtils @ 49 NONAME + _ZTV13WlanQtUtilsAp @ 50 NONAME + _ZTV14WlanQtUtilsIap @ 51 NONAME diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/rom/wlanqtutilities.iby --- a/wlanutilities/wlanqtutilities/rom/wlanqtutilities.iby Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanqtutilities/rom/wlanqtutilities.iby Thu Jul 22 16:44:32 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -12,7 +12,7 @@ * Contributors: * * Description: -* +* WLAN Qt Utilities IBY file. */ #ifndef WLANQTUTILITIES_IBY @@ -22,7 +22,7 @@ #ifdef __PROTOCOL_WLAN -file=ABI_DIR\BUILD_DIR\wlanqtutilities.dll SHARED_LIB_DIR\wlanqtutilities.dll +file=ABI_DIR/BUILD_DIR/wlanqtutilities.dll SHARED_LIB_DIR/wlanqtutilities.dll #endif // __PROTOCOL_WLAN diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/stubs/stub_connmon.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/stubs/stub_connmon.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is a source file for connmon library stub functions for emulator. +*/ + +#include +#include +#include +#include +#include +#include + +#include "wlanqtutilsap.h" + +#ifdef __WINS__ + +// ----------------------------------------------------------------------------- +// CConnMonEventBase::CConnMonEventBase +// ----------------------------------------------------------------------------- +// +CConnMonEventBase::CConnMonEventBase( const TInt aEventType, const TUint aConnectionId ) + { + iEventType = aEventType; + iConnectionId = aConnectionId; + } + +// Destructor +CConnMonEventBase::~CConnMonEventBase() + { + } + +// ----------------------------------------------------------------------------- +// CConnMonEventBase::EventType +// ----------------------------------------------------------------------------- +// +TInt CConnMonEventBase::EventType() const + { + return iEventType; + } + +// ----------------------------------------------------------------------------- +// CConnMonConnectionStatusChange::CConnMonConnectionStatusChange +// ----------------------------------------------------------------------------- +// +CConnMonConnectionStatusChange::CConnMonConnectionStatusChange( + const TUint aConnectionId, + const TUint aSubConnectionId, + const TInt aConnectionStatus ) : + CConnMonEventBase(EConnMonConnectionStatusChange, aConnectionId) + { + iSubConnectionId = aSubConnectionId; + iConnectionStatus = aConnectionStatus; + } + +// Destructor +CConnMonConnectionStatusChange::~CConnMonConnectionStatusChange() + { + } + +#endif // __WINS__ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/stubs/stub_esock.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/stubs/stub_esock.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is a source file for esock library stub functions for emulator. +*/ + +#include + +// ---------------------------------------------------- +// Stub functions for esock library, used in emulator +// ---------------------------------------------------- + +/** + * Return always success in emulator. + */ +void RConnection::Start(class TConnPref &, class TRequestStatus &aStatus) +{ + User::RequestComplete(&aStatus, KErrNone); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/stubs/stub_wlanmgmtclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/stubs/stub_wlanmgmtclient.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Management API stubbing for WLAN Qt Utilities use in emulator. +*/ + +#include +#include +#include "wlanmgmtclient.h" + +// --------------------------------------------------------- +// CWlanScanRequest::NewL +// --------------------------------------------------------- +// +CWlanMgmtClient* CWlanMgmtClient::NewL() + { + CWlanMgmtClient* self = new CWlanMgmtClient; + return self; + } + +// --------------------------------------------------------- +// CWlanScanRequest::~CWlanMgmtClient +// --------------------------------------------------------- +// +CWlanMgmtClient::~CWlanMgmtClient() + { + } + +// --------------------------------------------------------- +// CWlanScanRequest::CWlanMgmtClient +// --------------------------------------------------------- +// +CWlanMgmtClient::CWlanMgmtClient() + { + } + +// --------------------------------------------------------- +// CWlanScanRequest::GetScanResults +// --------------------------------------------------------- +// +void CWlanMgmtClient::GetScanResults( + TRequestStatus& aStatus, + CWlanScanInfo& aResults ) + { + // Complete the request immediately + TRequestStatus *status = &aStatus; + User::RequestComplete(status, KErrNone); + + // Results are returned when asked per AP + (void)aResults; + } + +// --------------------------------------------------------- +// CWlanScanRequest::GetScanResults +// --------------------------------------------------------- +// +void CWlanMgmtClient::GetScanResults( + TWlanSsid& aSsid, + TRequestStatus& aStatus, + CWlanScanInfo& aResults ) + { + // Complete the request immediately + TRequestStatus *status = &aStatus; + User::RequestComplete(status, KErrNone); + + // Results are returned when asked per AP + (void)aSsid; + (void)aResults; + } + +// --------------------------------------------------------- +// CWlanScanRequest::CancelGetScanResults +// --------------------------------------------------------- +// +void CWlanMgmtClient::CancelGetScanResults() + { + } diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/stubs/stub_wlanscaninfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/stubs/stub_wlanscaninfo.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,335 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Management API stubbing for WLAN Qt Utilities use in emulator. +*/ + +#include +#include "wlanscaninfo.h" + +#include + +#include "wlanqtutilsap.h" + +// Information Element ID for SSID as specified in 802.11. +static const TUint8 KWlan802Dot11SsidIE = 0; + +// Bit mask for Capability info field to get type (Infra/AdHoc). +static const TUint8 KWlan802Dot11CapabilityEssMask = 0x0001; + +// Scan result list iterator. Holds the current index, starting from zero (0). +static int ScanResultIterator = 0; + +// Scan result toggler. Used for switching between two different scan result lists. +static bool ScanResultPrimary = true; + +// --------------------------------------------------------- +// CWlanScanInfo::NewL +// --------------------------------------------------------- +// +CWlanScanInfo* CWlanScanInfo::NewL() + { + CWlanScanInfo* self = new CWlanScanInfo; + return self; + } + +// --------------------------------------------------------- +// CWlanScanInfo::~CWlanScanInfo +// --------------------------------------------------------- +// +CWlanScanInfo::~CWlanScanInfo() + { + } + +// --------------------------------------------------------- +// CWlanScanInfo::~First +// --------------------------------------------------------- +// +const TWlanScanInfoFrame* CWlanScanInfo::First() + { + // Rewind to the beginning of scan result list + ScanResultIterator = 0; + + return (TWlanScanInfoFrame*)1; // Info frame is not supported + } + +// --------------------------------------------------------- +// CWlanScanInfo::~Next +// --------------------------------------------------------- +// +const TWlanScanInfoFrame* CWlanScanInfo::Next() + { + // Go to next AP in scan results + ScanResultIterator++; + + return (TWlanScanInfoFrame*)1; // Info frame is not supported + } + +// --------------------------------------------------------- +// CWlanScanInfo::~IsDone +// --------------------------------------------------------- +// +TBool CWlanScanInfo::IsDone() const + { + TBool result = EFalse; + + // Amount of scan results is toggled for every scan + int scanResultCount; + if (ScanResultPrimary) { + scanResultCount = 6; + } else { + scanResultCount = 3; + } + + // Iterating is complete when iterator is one past the last item + if (ScanResultIterator >= scanResultCount) { + result = ETrue; + + // Toggle scan result count + ScanResultPrimary = !ScanResultPrimary; + } + + return result; + } + +// --------------------------------------------------------- +// CWlanScanInfo::RXLevel +// --------------------------------------------------------- +// +TUint8 CWlanScanInfo::RXLevel() const + { + QSharedPointer ap(GetCurrentAp()); + int rxlevel = ap->value(WlanQtUtilsAp::ConfIdSignalStrength).toInt(); + + return (TUint8)rxlevel; + } + +// --------------------------------------------------------- +// CWlanScanInfo::Bssid +// --------------------------------------------------------- +// +void CWlanScanInfo::Bssid( + TWlanBssid& aBssid ) const + { + QSharedPointer ap(GetCurrentAp()); + QByteArray bssid = ap->value(WlanQtUtilsAp::ConfIdBssid).toByteArray(); + + // Length must match, since BSSID is always the same length + Q_ASSERT(bssid.length() == KWlanMaxBssidLength); + + // Copy the BSSID + aBssid.Copy((const unsigned char *)bssid.constData(), bssid.length()); + } + +// --------------------------------------------------------- +// CWlanScanInfo::Capability +// --------------------------------------------------------- +// +TUint16 CWlanScanInfo::Capability() const + { + QSharedPointer ap(GetCurrentAp()); + + TUint16 capabilities = 0; + + // Only connection mode cabability is supported + int connMode = ap->value(WlanQtUtilsAp::ConfIdConnectionMode).toInt(); + if (connMode == CMManagerShim::Infra) { + capabilities |= KWlan802Dot11CapabilityEssMask; + } + + return capabilities; + } + +// --------------------------------------------------------- +// CWlanScanInfo::InformationElement +// --------------------------------------------------------- +// +TInt CWlanScanInfo::InformationElement( + TUint8 aIE, + TUint8& aLength, + const TUint8** aData ) + { + // Static SSID buffer + static TBuf8<255> ssidBuffer; + + QSharedPointer ap(GetCurrentAp()); + + aLength = 0; + + // Only SSID IE is supported + Q_ASSERT(aIE == KWlan802Dot11SsidIE); + (void)aIE; + + // Cypy the SSID + QString ssid = ap->value(WlanQtUtilsAp::ConfIdSsid).toString(); + QByteArray ssidData(ssid.toUtf8()); + ssidBuffer.Copy( + (TUint8*)ssidData.data(), + ssidData.length()); + + // Give reference to the buffer to the caller + *aData = ssidBuffer.Ptr(); + aLength = (TUint8)ssidBuffer.Length(); + + return KErrNone; + } + +// --------------------------------------------------------- +// CWlanScanInfo::IsProtectedSetupSupported +// --------------------------------------------------------- +// +TBool CWlanScanInfo::IsProtectedSetupSupported() + { + QSharedPointer ap(GetCurrentAp()); + + TBool wpsSupport; + bool wps = ap->value(WlanQtUtilsAp::ConfIdWpsSupported).toBool(); + if (wps) { + wpsSupport = ETrue; + } else { + wpsSupport = EFalse; + } + + return wpsSupport; + } + +// --------------------------------------------------------- +// CWlanScanInfo::ExtendedSecurityMode +// --------------------------------------------------------- +// +TWlanConnectionExtentedSecurityMode CWlanScanInfo::ExtendedSecurityMode() const + { + QSharedPointer ap(GetCurrentAp()); + int secMode = ap->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(); + bool pskUse = ap->value(WlanQtUtilsAp::ConfIdWpaPskUse).toBool(); + + TWlanConnectionExtentedSecurityMode ret; + switch (secMode) { + case CMManagerShim::WlanSecModeWep: + // Both WEP security modes are mapped to same WEP sec mode value. + // We test both of them, and toggle the used value each time. + static bool wepOpen = true; + if (wepOpen) { + ret = EWlanConnectionExtentedSecurityModeWepOpen; + } else { + ret = EWlanConnectionExtentedSecurityModeWepShared; + } + wepOpen = !wepOpen; + break; + + case CMManagerShim::WlanSecMode802_1x: + ret = EWlanConnectionExtentedSecurityMode802d1x; + break; + + case CMManagerShim::WlanSecModeWpa: + if (pskUse) + { + ret = EWlanConnectionExtentedSecurityModeWpaPsk; + } + else + { + ret = EWlanConnectionExtentedSecurityModeWpa; + } + break; + + case CMManagerShim::WlanSecModeWpa2: + if (pskUse) + { + ret = EWlanConnectionExtentedSecurityModeWpa2Psk; + } + else + { + ret = EWlanConnectionExtentedSecurityModeWpa2; + } + break; + + case CMManagerShim::WlanSecModeWapi: + if (pskUse) + { + ret = EWlanConnectionExtentedSecurityModeWapiPsk; + } + else + { + ret = EWlanConnectionExtentedSecurityModeWapi; + } + break; + + default: + ret = EWlanConnectionExtentedSecurityModeOpen; + break; + } + + return ret; + } + +// --------------------------------------------------------- +// CWlanScanInfo::CWlanScanInfo +// --------------------------------------------------------- +// +CWlanScanInfo::CWlanScanInfo() + { + } + +// --------------------------------------------------------- +// CWlanScanInfo::GetCurrentAp +// --------------------------------------------------------- +// +QSharedPointer CWlanScanInfo::GetCurrentAp() const + { + // If this fails, client iterates erroneously + Q_ASSERT(!IsDone()); + + // Get the currently iterated AP + QSharedPointer ap(new WlanQtUtilsAp()); + + // Store default setting data + QString ssid("Test AP "); + ssid.append(QString::number(ScanResultIterator + 1)); + ap->setValue(WlanQtUtilsAp::ConfIdSsid, ssid); + ap->setValue(WlanQtUtilsAp::ConfIdBssid, QByteArray("123456")); + ap->setValue(WlanQtUtilsAp::ConfIdSignalStrength, 20); + ap->setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Infra); + ap->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); + ap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, false); + ap->setValue(WlanQtUtilsAp::ConfIdWpsSupported, false); + + // Custom settings for AP # 1 + if (ScanResultIterator == 0) { + ap->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa2); + ap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); + } + + // Custom settings for AP # 2 + if (ScanResultIterator == 1) { + if (ScanResultPrimary) { + ap->setValue(WlanQtUtilsAp::ConfIdSignalStrength, 70); + } else { + ap->setValue(WlanQtUtilsAp::ConfIdSignalStrength, 90); + } + } + + // Custom settings for AP # 3 + if (ScanResultIterator == 2) { + ap->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa2); + ap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); + ap->setValue(WlanQtUtilsAp::ConfIdWpsSupported, true); + } + + // Custom settings for AP's above 3 + if (ScanResultIterator >= 3) { + ap->setValue(WlanQtUtilsAp::ConfIdSignalStrength, 90); + } + + return ap; + } diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/stubs/stubs.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/stubs/stubs.pri Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,29 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# Stubs for Wlan Qt Utilities emulator usage +# + +symbian { + mmpStubRules = \ + "$${LITERAL_HASH}ifdef WINSCW" \ + "USERINCLUDE stubs" \ + "SOURCEPATH stubs" \ + "SOURCE stub_connmon.cpp" \ + "SOURCE stub_esock.cpp" \ + "SOURCE stub_wlanmgmtclient.cpp" \ + "SOURCE stub_wlanscaninfo.cpp" \ + "$${LITERAL_HASH}endif" + MMP_RULES += mmpStubRules +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/stubs/wlanmgmtclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/stubs/wlanmgmtclient.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Management API stubbing for WLAN Qt Utilities use in emulator. +*/ + +#ifndef WLANMGMTCLIENT_H +#define WLANMGMTCLIENT_H + +#include "wlanmgmtcommon.h" +#include "wlanscaninfo.h" + +// CLASS DECLARATION + +class CWlanMgmtClient : public CBase + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + * @return Pointer to the constructed object. + */ + static CWlanMgmtClient* NewL(); + + /** + * Destructor. + */ + ~CWlanMgmtClient(); + + /** + * Perform a broadcast scan and return the detected WLAN networks. + * + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aResults Results of the scan. + */ + void GetScanResults( + TRequestStatus& aStatus, + CWlanScanInfo& aResults ); + + /** + * Perform a direct scan for an SSID and return the detected WLAN networks. + * If the SSID has zero length, a broadcast scan will be done. + * + * @param aSsid name of the WLAN network + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aResults Results of the scan. + */ + void GetScanResults( + TWlanSsid& aSsid, + TRequestStatus& aStatus, + CWlanScanInfo& aResults ); + + /** + * Cancel an outstanding scan request. + */ + void CancelGetScanResults(); + + private: // Data + + CWlanMgmtClient(); + }; + +#endif // WLANMGMTCLIENT_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/stubs/wlanscaninfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/stubs/wlanscaninfo.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Management API stubbing for WLAN Qt Utilities use in emulator. +*/ + +#ifndef WLANSCANINFO_H +#define WLANSCANINFO_H + +// INCLUDES +#include +#include +#include + +#include +#include "wlanqtutilsap.h" + +typedef TUint8 TWlanScanInfoFrame; + +// CLASS DECLARATION +class CWlanScanInfo : public CBase + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + * @return Pointer to the constructed object. + */ + static CWlanScanInfo* NewL(); + + /** + * Destructor. + */ + ~CWlanScanInfo(); + + /** + * Find the data of the first access point. + * @return Pointer at the beginning of the first access point stored + * in the scan list. NULL if not any. + */ + const TWlanScanInfoFrame* First(); + + /** + * Find the data of the next access point. + * @return Pointer at the beginning of the next access point stored + * in the scan list. NULL if not any. + */ + const TWlanScanInfoFrame* Next(); + + /** + * Find is there any more unhandled access points. + * @return EFalse if there is access points in the list left, + * ETrue if not. + */ + TBool IsDone() const; + + /** + * Return RX level of the BSS. + * @return RX level. + */ + TUint8 RXLevel() const; + + /** + * Return BSSID of the BSS. + * @param aBssid ID of the access point or IBSS network. + * @return Pointer to the beginning of the BSSID. Length is always 6 bytes. + */ + void Bssid( + TWlanBssid& aBssid ) const; + + /** + * Get capability of the BSS (see IEEE 802.11 section 7.3.1.4. + * @return The capability information. + */ + TUint16 Capability() const; + + /** + * Return requested information element. + * @param aIE Id of the requested IE data. + * @param aLength Length of the IE. Zero if IE not found. + * @param aData Pointer to the beginning of the IE data. NULL if IE not found. + * @return General error message. + */ + TInt InformationElement( + TUint8 aIE, + TUint8& aLength, + const TUint8** aData ); + + /** + * Find whether Wi-Fi Protected Setup is supported. + * @return ETrue if AP supports Wi-Fi Protected Setup, + * EFalse if not. + */ + TBool IsProtectedSetupSupported(); + + /** + * Get security mode of the BSS. + * @return security mode. + */ + TWlanConnectionExtentedSecurityMode ExtendedSecurityMode() const; + + private: // Data + + /** + * Constructor. + */ + CWlanScanInfo(); + + /** + * Returns the currently iterated AP. + */ + QSharedPointer GetCurrentAp() const; + + }; + +#endif // WLANSCANINFO_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/traces/OstTraceDefinitions.h --- a/wlanutilities/wlanqtutilities/traces/OstTraceDefinitions.h Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanqtutilities/traces/OstTraceDefinitions.h Thu Jul 22 16:44:32 2010 +0100 @@ -1,18 +1,19 @@ /* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* OST trace definition header. +*/ #ifndef __OSTTRACEDEFINITIONS_H__ #define __OSTTRACEDEFINITIONS_H__ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/traces/trace.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/traces/trace.properties Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,77 @@ + + + + ConnStatusNone + ConnStatusConnecting + ConnStatusConnected + ConnStatusDisconnected + + + ScanStatusOk + ScanStatusCancelled + ScanStatusError + + + IctPassed + IctHotspotPassed + IctCancelled + IctFailed + + + + WlanSecModeOpen + WlanSecModeWep + WlanSecMode802_1x + WlanSecModeWpa + WlanSecModeWpa2 + WlanSecModeWapi + + + + Adhoc + Infra + + + + EConnMonCreateConnection + EConnMonDeleteConnection + EConnMonCreateSubConnection + EConnMonDeleteSubConnection + EConnMonDownlinkDataThreshold + EConnMonUplinkDataThreshold + EConnMonNetworkStatusChange + EConnMonConnectionStatusChange + EConnMonConnectionActivityChange + EConnMonNetworkRegistrationChange + EConnMonBearerChange + EConnMonSignalStrengthChange + EConnMonBearerAvailabilityChange + EConnMonIapAvailabilityChange + EConnMonTransmitPowerChange + EConnMonSNAPsAvailabilityChange + EConnMonNewWLANNetworkDetected + EConnMonOldWLANNetworkLost + EConnMonPacketDataAvailable + EConnMonPacketDataUnavailable + EConnMonBearerInfoChange + EConnMonBearerGroupChange + + + + KConnectionUninitialised + KStartingSelection + KFinishedSelection + KConnectionFailure + KDataTransferTemporarilyBlocked + KLinkLayerOpen + KLinkLayerClosed + KConfigDaemonLoading + KConfigDaemonLoaded + KConfigDaemonStartingRegistration + KConfigDaemonFinishedRegistration + KConfigDaemonStartingDeregistration + KConfigDaemonFinishedDeregistrationStop + KConfigDaemonUnloading + KConfigDaemonUnloaded + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/tsrc/context/wlanqtutilstestcontext.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/tsrc/context/wlanqtutilstestcontext.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,263 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is the source file for Connection Utilities test context. +*/ + +#include +#include +#include +#include +#include +#include + +#include "wlanqtutils.h" +#include "wlanqtutilstestcontext.h" +#include "wlanqtutilsap.h" +#include "wlanqtutilsconnection.h" + +// --------------------------------------------------------- +// class WlanQtUtilsCtxEsock +// --------------------------------------------------------- + +WlanQtUtilsCtxEsock::WlanQtUtilsCtxEsock() : + startRetValue_(KErrNone) +{ +} + +WlanQtUtilsCtxEsock::~WlanQtUtilsCtxEsock() +{ +} + +void WlanQtUtilsCtxEsock::initialize() +{ + startRetValue_ = KErrNone; +} + +// --------------------------------------------------------- +// class WlanQtUtilsCtxActiveConn +// --------------------------------------------------------- + +WlanQtUtilsCtxActiveConn::WlanQtUtilsCtxActiveConn() : + WlanQtUtilsConnection(), connMonBearerType_(EBearerUnknown), connMonConnectionStatus_( + KConnectionUninitialised), connMonWlanConnectionMode_(-1), connMonWlanSecurityMode_(-1), + applicationUids_() +{ +} + +WlanQtUtilsCtxActiveConn::~WlanQtUtilsCtxActiveConn() +{ +} + +// --------------------------------------------------------- +// class WlanQtUtilsCtxActiveConnections +// --------------------------------------------------------- + +WlanQtUtilsCtxActiveConnections::WlanQtUtilsCtxActiveConnections() : + activeConnList_() +{ +} + +WlanQtUtilsCtxActiveConnections::~WlanQtUtilsCtxActiveConnections() +{ + clearActiveConnList(); +} + +void WlanQtUtilsCtxActiveConnections::initialize() +{ + clearActiveConnList(); +} + +void WlanQtUtilsCtxActiveConnections::createDefaultActiveConnList(int numberOfActiveConns, + int firstIapId) +{ + clearActiveConnList(); + for (int i = 0; i < numberOfActiveConns; i++) { + WlanQtUtilsCtxActiveConn *activeConn = new WlanQtUtilsCtxActiveConn(); + + activeConn->setConnectionId((i + 1) * 100); + activeConn->setIapId(firstIapId + i); + activeConn->connMonConnectionStatus_ = KLinkLayerOpen; + activeConn->setConnectionStatus(WlanQtUtils::ConnStatusConnected); + + // WLAN connection. + activeConn->connMonBearerType_ = EBearerWLAN; + activeConn->connMonWlanSecurityMode_ = EConnMonSecurityOpen; + activeConn->connMonWlanConnectionMode_ = EConnMonInfraStructure; + activeConnList_.append(activeConn); + } +} + +void WlanQtUtilsCtxActiveConnections::clearActiveConnList() +{ + Q_FOREACH(WlanQtUtilsCtxActiveConn* activeConn, activeConnList_) + { + delete activeConn; + } + activeConnList_.clear(); +} + +void WlanQtUtilsCtxActiveConnections::verifyActiveConnList( + QList activeConnList) +{ + QCOMPARE(activeConnList.count(), activeConnList_.count()); + + for (int i = 0; i < activeConnList_.count(); i++) { + QCOMPARE(activeConnList[i]->connectionId(), activeConnList_[i]->connectionId()); + QCOMPARE(activeConnList[i]->iapId(), activeConnList_[i]->iapId()); + QCOMPARE(activeConnList[i]->connectionStatus(), activeConnList_[i]->connectionStatus()); + } +} + +WlanQtUtilsCtxActiveConn *WlanQtUtilsCtxActiveConnections::findActiveConn(uint connectionId) const +{ + WlanQtUtilsCtxActiveConn *activeConn = NULL; + for (int i = 0; i < activeConnList_.count(); i++) { + if (activeConnList_[i]->connectionId() == connectionId) { + activeConn = activeConnList_[i]; + } + } + Q_ASSERT(activeConn != NULL); + return activeConn; +} + +// --------------------------------------------------------- +// class WlanQtUtilsWlanScanResult +// --------------------------------------------------------- + +WlanQtUtilsWlanScan::WlanQtUtilsWlanScan() : + mScanResultIterator(0), + mWlanScanResultList(), + mCompleteWlanScan(true), + mScanRetValue(KErrNone) +{ +} + +WlanQtUtilsWlanScan::~WlanQtUtilsWlanScan() +{ + clearWlanScanResultList(); +} + +void WlanQtUtilsWlanScan::initialize() +{ + clearWlanScanResultList(); + mCompleteWlanScan = true; + mScanRetValue = KErrNone; +} + +void WlanQtUtilsWlanScan::createDefaultWlanScanResultList(int numberOfWlanAps) +{ + clearWlanScanResultList(); + for (int i = 0; i < numberOfWlanAps; i++) { + QSharedPointer ap(new WlanQtUtilsAp()); + ap->setValue(WlanQtUtilsAp::ConfIdSsid, "TestWlanAp" + QString::number(i + 1)); + ap->setValue(WlanQtUtilsAp::ConfIdBssid, QByteArray("123456")); + ap->setValue(WlanQtUtilsAp::ConfIdSignalStrength, 20); + ap->setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Infra); + ap->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); + ap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, false); + ap->setValue(WlanQtUtilsAp::ConfIdWpsSupported, false); + mWlanScanResultList.append(ap); + } +} + +void WlanQtUtilsWlanScan::clearWlanScanResultList() +{ + mWlanScanResultList.clear(); +} + +void WlanQtUtilsWlanScan::verifyWlanScanResultList( + QList< QSharedPointer > wlanApList) +{ + QCOMPARE(wlanApList.count(), mWlanScanResultList.count()); + + for (int i = 0; i < mWlanScanResultList.count(); i++) { + QCOMPARE( + wlanApList[i]->value(WlanQtUtilsAp::ConfIdSsid), + mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdSsid)); + QCOMPARE( + wlanApList[i]->value(WlanQtUtilsAp::ConfIdBssid), + mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdBssid)); + QCOMPARE( + wlanApList[i]->value(WlanQtUtilsAp::ConfIdSignalStrength), + mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdSignalStrength)); + QCOMPARE( + wlanApList[i]->value(WlanQtUtilsAp::ConfIdConnectionMode), + mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdConnectionMode)); + QCOMPARE( + wlanApList[i]->value(WlanQtUtilsAp::ConfIdSecurityMode), + mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdSecurityMode)); + QCOMPARE( + wlanApList[i]->value(WlanQtUtilsAp::ConfIdWpaPskUse), + mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdWpaPskUse)); + QCOMPARE( + wlanApList[i]->value(WlanQtUtilsAp::ConfIdWpsSupported), + mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdWpsSupported)); + } +} + +// --------------------------------------------------------- +// class WlanQtUtilsCtxConnMon +// --------------------------------------------------------- + +WlanQtUtilsCtxConnMon::WlanQtUtilsCtxConnMon() : + activeConnections_() +{ +} + +WlanQtUtilsCtxConnMon::~WlanQtUtilsCtxConnMon() +{ +} + +void WlanQtUtilsCtxConnMon::initialize() +{ + activeConnections_.initialize(); +} + +// --------------------------------------------------------- +// class WlanQtUtilsCtxIct +// --------------------------------------------------------- + +WlanQtUtilsCtxIct::WlanQtUtilsCtxIct() +{ +} + +WlanQtUtilsCtxIct::~WlanQtUtilsCtxIct() +{ +} + +void WlanQtUtilsCtxIct::initialize() +{ +} + +// --------------------------------------------------------- +// class WlanQtUtilsTestContext +// --------------------------------------------------------- + +WlanQtUtilsTestContext::WlanQtUtilsTestContext() : + esock_(), connMon_(), ict_() +{ +} + +WlanQtUtilsTestContext::~WlanQtUtilsTestContext() +{ +} + +void WlanQtUtilsTestContext::initialize() +{ + esock_.initialize(); + connMon_.initialize(); + ict_.initialize(); + mScan.initialize(); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/tsrc/context/wlanqtutilstestcontext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/tsrc/context/wlanqtutilstestcontext.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,258 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is the header file for Wlan Qt Utilities test context. +*/ + +#ifndef WLANQTUTILSTESTCONTEXT_H +#define WLANQTUTILSTESTCONTEXT_H + +#include +#include +#include "wlanqtutilsconnection.h" + +class WlanQtUtilsAp; + +/** + * This is context for esock library. + */ +class WlanQtUtilsCtxEsock : public QObject +{ + Q_OBJECT + +public: + WlanQtUtilsCtxEsock(); + ~WlanQtUtilsCtxEsock(); + + /** + * Initializes context. + */ + void initialize(); + + /** Return value of RConnection::Start(). */ + int startRetValue_; +}; + +/** + * This class is a helper class for testing purposes. It derives all properties of WlanQtUtilsConnection. + * In addition, this class contains member variables for setting some Connection Monitor specific + * values which cannot be easily generated from member variables of WlanQtUtilsConnection. + * E.g., connection status has different enum in Connection Monitor and Wlan Qt Utilities. This class + * enables setting both of those. Connmon version is set so that the stub can return it when + * requested, and Wlan Qt Utilities version is used for verifying that tested code returns right + * value. + */ +class WlanQtUtilsCtxActiveConn : public WlanQtUtilsConnection +{ +public: + WlanQtUtilsCtxActiveConn(); + ~WlanQtUtilsCtxActiveConn(); + + /** Bearer type in connmon format. */ + int connMonBearerType_; + /** Connection status in connmon format. */ + int connMonConnectionStatus_; + /** WLAN connection mode in connmon format. */ + int connMonWlanConnectionMode_; + /** WLAN security mode in connmon format. */ + int connMonWlanSecurityMode_; + /** Application UIDs that map to application strings. */ + QList applicationUids_; +}; + +/** + * This class represents active connections. + */ +class WlanQtUtilsCtxActiveConnections : public QObject +{ + Q_OBJECT + +public: + WlanQtUtilsCtxActiveConnections(); + ~WlanQtUtilsCtxActiveConnections(); + + /** + * Initializes context. + */ + void initialize(); + + /** + * Creates a list of active connections for scan results. + * + * @param[in] numberOfActiveConns Number of active connections that are created. + * @param[in] firstIapId IAP ID of the first connection to be created. + */ + void createDefaultActiveConnList(int numberOfActiveConns, int firstIapId); + + /** + * Verifies that the given active connection list returned by the real application matches + * with the one in the context. + * + * @param[in] activeConnList Active connections that are verified against the context. + */ + void verifyActiveConnList(QList activeConnList); + + /** + * Finds an active connection matching with the given connection ID from the context. + * Asserts if connection with given connection ID is not found. + * + * @param connectionId Connection ID. + * @return Active connection. + */ + WlanQtUtilsCtxActiveConn *findActiveConn(uint connectionId) const; + + /** + * List of active connections that RConnectionMonitor stub will return in response to + * RConnectionMonitor::Get*Attribute() functions. + */ + QList activeConnList_; + + // TODO: We need return values for all different RConnectionMonitor::Get*Attribute() functions + // to test error cases. + +private: + + /** + * Destroys and clears the list of WLAN APs. + */ + void clearActiveConnList(); +}; + +/** + * This class represents WLAN functionality test context. E.g. APs that + * represent the results of WLAN scanning are stored here. + */ +class WlanQtUtilsWlanScan : public QObject +{ + Q_OBJECT + +public: + WlanQtUtilsWlanScan(); + ~WlanQtUtilsWlanScan(); + + /** + * Initializes context. + */ + void initialize(); + + /** + * Creates a list of WLAN APs for scan results. + * + * @param[in] numberOfWlanAps Number of WLAN APs that are created. + */ + void createDefaultWlanScanResultList(int numberOfWlanAps); + + /** + * Verifies that the given WLAN AP list returned by the real application matches + * with the one in the context. + * + * @param[in] wlanApList WLAN APs that are verified against the context. + */ + void verifyWlanScanResultList( + QList< QSharedPointer > wlanApList); // TODO: Maybe boolean return value + + // Scan result list iterator. Holds the current index, starting from zero (0). + int mScanResultIterator; + + // List of WLAN access points that WLAN Management API stub will return when + // requesting for wlan scan results. + QList< QSharedPointer > mWlanScanResultList; + + /** + * Should scan be completed immediately or not? + */ + bool mCompleteWlanScan; + + /** Return value of scan request. */ + int mScanRetValue; + +private: + + /** + * Destroys and clears the list of WLAN APs. + */ + void clearWlanScanResultList(); +}; + +/** + * Test context for RConnectionMonitor. + */ +class WlanQtUtilsCtxConnMon : public QObject +{ + Q_OBJECT + +public: + WlanQtUtilsCtxConnMon(); + ~WlanQtUtilsCtxConnMon(); + + /** + * Initializes context. + */ + void initialize(); + + /** List of active connections. */ + WlanQtUtilsCtxActiveConnections activeConnections_; +}; + +/** + * Test context for Internet connectivity test library. + */ +class WlanQtUtilsCtxIct : public QObject +{ + Q_OBJECT + +public: + WlanQtUtilsCtxIct(); + ~WlanQtUtilsCtxIct(); + + /** + * Initializes context. + */ + void initialize(); +}; + +/** + * Test context. The purpose of this context is to provide values that are used in stubs + * and in verification of outputs in test cases. + * + * In stubs, context is used to verify the inputs of parameters and to set output + * parameters into a specific value. + * + * In test cases, context is used to verify that the output parameters match with the once + * set in the stub. + */ +class WlanQtUtilsTestContext : public QObject +{ + Q_OBJECT + +public: + WlanQtUtilsTestContext(); + ~WlanQtUtilsTestContext(); + + /** + * Initializes context. + */ + void initialize(); + + /** Context for esock library. */ + WlanQtUtilsCtxEsock esock_; + /** Context for connmon library. */ + WlanQtUtilsCtxConnMon connMon_; + /** Context for ICTS library. */ + WlanQtUtilsCtxIct ict_; + /** Context for scan results. */ + WlanQtUtilsWlanScan mScan; +}; + +#endif // WLANQTUTILSTESTCONTEXT_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/tsrc/stubs/stub_connmon.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/tsrc/stubs/stub_connmon.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is a source file for connmon library stub functions for UT. +*/ + +#include +#include +#include +#include +#include +#include + +#include "wlanqtutilsap.h" + +#ifdef __WINS__ + +#include "wlanqtutilstestcontext.h" + +extern WlanQtUtilsTestContext testContext; + +// ----------------------------------------------------------------------------- +// CConnMonEventBase::CConnMonEventBase +// ----------------------------------------------------------------------------- +// +CConnMonEventBase::CConnMonEventBase( const TInt aEventType, const TUint aConnectionId ) + { + iEventType = aEventType; + iConnectionId = aConnectionId; + } + +// Destructor +CConnMonEventBase::~CConnMonEventBase() + { + } + +// ----------------------------------------------------------------------------- +// CConnMonEventBase::EventType +// ----------------------------------------------------------------------------- +// +TInt CConnMonEventBase::EventType() const + { + return iEventType; + } + +// ----------------------------------------------------------------------------- +// CConnMonConnectionStatusChange::CConnMonConnectionStatusChange +// ----------------------------------------------------------------------------- +// +CConnMonConnectionStatusChange::CConnMonConnectionStatusChange( + const TUint aConnectionId, + const TUint aSubConnectionId, + const TInt aConnectionStatus ) : + CConnMonEventBase(EConnMonConnectionStatusChange, aConnectionId) + { + iSubConnectionId = aSubConnectionId; + iConnectionStatus = aConnectionStatus; + } + +// Destructor +CConnMonConnectionStatusChange::~CConnMonConnectionStatusChange() + { + } + +// Request status for canceling stubbed async request +TRequestStatus* iStubRequestStatus = 0; + +void RConnectionMonitor::CancelAsyncRequest( + TInt aReqToCancel) +{ + (void)aReqToCancel; + User::RequestComplete(iStubRequestStatus, KErrCancel); + iStubRequestStatus = 0; +} + +void RConnectionMonitor::GetConnectionCount( + TUint& aConnectionCount, + TRequestStatus& aStatus) +{ + aConnectionCount = testContext.connMon_.activeConnections_.activeConnList_.count(); + User::RequestComplete(&aStatus, KErrNone); +} + +TInt RConnectionMonitor::GetConnectionInfo( + const TUint aIndex, + TUint& aConnectionId, + TUint& aSubConnectionCount ) const +{ + aConnectionId = testContext.connMon_.activeConnections_.activeConnList_[aIndex - 1]->connectionId(); + aSubConnectionCount = 0; + return KErrNone; // TODO: put return value into context. +} + +void RConnectionMonitor::GetIntAttribute( + const TUint aConnectionId, + const TUint /* aSubConnectionId */, + const TUint aAttribute, + TInt& aValue, + TRequestStatus& aStatus ) +{ + WlanQtUtilsCtxActiveConn *activeConn = testContext.connMon_.activeConnections_.findActiveConn(aConnectionId); + if (aAttribute == KBearer) { + aValue = activeConn->connMonBearerType_; + } else if (aAttribute == KConnectionStatus) { + aValue = activeConn->connMonConnectionStatus_; + } else { + Q_ASSERT(false); + } + User::RequestComplete(&aStatus, KErrNone); // TODO: Take return value from the context. +} + +void RConnectionMonitor::GetUintAttribute( + const TUint aConnectionId, + const TUint /* aSubConnectionId */, + const TUint aAttribute, + TUint& aValue, + TRequestStatus& aStatus ) +{ + WlanQtUtilsCtxActiveConn *activeConn = testContext.connMon_.activeConnections_.findActiveConn(aConnectionId); + if (aAttribute == KIAPId) { + aValue = activeConn->iapId(); + } else { + Q_ASSERT(false); + } + + User::RequestComplete(&aStatus, KErrNone); // TODO: Take return value from the context. +} + +#endif // __WINS__ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/tsrc/stubs/stub_esock.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/tsrc/stubs/stub_esock.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is a source file for esock library stub functions +*/ + +#include + +#ifdef __WINS__ + +// ---------------------------------------------- +// Stub functions for esock library, used in UT +// ---------------------------------------------- + +#include "wlanqtutilstestcontext.h" + +extern WlanQtUtilsTestContext testContext; + +/** + * Returns value from test context. + * + * TConnPref value cannot be verified easily because the real value passed to the function is + * TCommDbConnPref. Dynamic cast from TConnPref to TCommDbConnPref does not work because + * TConnPref does not have virtual functions which means that type information for the + * class hierarchy is not created by the compiler. + */ +void RConnection::Start(class TConnPref &, class TRequestStatus &aStatus) +{ + User::RequestComplete(&aStatus, testContext.esock_.startRetValue_); +} + +#endif // __WINS__ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/tsrc/stubs/stub_wlanmgmtclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/tsrc/stubs/stub_wlanmgmtclient.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Management API stubbing for WLAN Qt Utilities. +*/ + +#include +#include +#include "wlanmgmtclient.h" + +#include "wlanqtutilstestcontext.h" + +extern WlanQtUtilsTestContext testContext; + +// Request status for canceling stubbed async request +static TRequestStatus* iStubRequestStatus = 0; + +// --------------------------------------------------------- +// CWlanScanRequest::NewL +// --------------------------------------------------------- +// +CWlanMgmtClient* CWlanMgmtClient::NewL() + { + CWlanMgmtClient* self = new CWlanMgmtClient; + return self; + } + +// --------------------------------------------------------- +// CWlanScanRequest::~CWlanMgmtClient +// --------------------------------------------------------- +// +CWlanMgmtClient::~CWlanMgmtClient() + { + } + +// --------------------------------------------------------- +// CWlanScanRequest::CWlanMgmtClient +// --------------------------------------------------------- +// +CWlanMgmtClient::CWlanMgmtClient() + { + } + +// --------------------------------------------------------- +// CWlanScanRequest::GetScanResults +// --------------------------------------------------------- +// +void CWlanMgmtClient::GetScanResults( + TRequestStatus& aStatus, + CWlanScanInfo& aResults ) + { + if (testContext.mScan.mCompleteWlanScan) { + // Complete the request immediately + TRequestStatus *status = &aStatus; + User::RequestComplete( + status, + testContext.mScan.mScanRetValue); + } else { + iStubRequestStatus = &aStatus; + } + + // Results are returned when asked per AP + (void)aResults; + } + +// --------------------------------------------------------- +// CWlanScanRequest::GetScanResults +// --------------------------------------------------------- +// +void CWlanMgmtClient::GetScanResults( + TWlanSsid& aSsid, + TRequestStatus& aStatus, + CWlanScanInfo& aResults ) + { + if (testContext.mScan.mCompleteWlanScan) { + // Complete the request immediately + TRequestStatus *status = &aStatus; + User::RequestComplete( + status, + testContext.mScan.mScanRetValue); + } else { + iStubRequestStatus = &aStatus; + } + + // Results are returned when asked per AP + (void)aSsid; + (void)aResults; + } + +// --------------------------------------------------------- +// CWlanScanRequest::CancelGetScanResults +// --------------------------------------------------------- +// +void CWlanMgmtClient::CancelGetScanResults() + { + User::RequestComplete(iStubRequestStatus, KErrCancel); + iStubRequestStatus = 0; + } diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/tsrc/stubs/stub_wlanscaninfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/tsrc/stubs/stub_wlanscaninfo.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,286 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Management API stubbing for WLAN Qt Utilities. +*/ + +#include +#include "wlanscaninfo.h" + +#include + +#include "wlanqtutilstestcontext.h" +#include "wlanqtutilsap.h" + +extern WlanQtUtilsTestContext testContext; + +// Information Element ID for SSID as specified in 802.11. +static const TUint8 KWlan802Dot11SsidIE = 0; + +// Bit mask for Capability info field to get type (Infra/AdHoc). +static const TUint8 KWlan802Dot11CapabilityEssMask = 0x0001; + +// --------------------------------------------------------- +// CWlanScanInfo::NewL +// --------------------------------------------------------- +// +CWlanScanInfo* CWlanScanInfo::NewL() + { + CWlanScanInfo* self = new CWlanScanInfo; + return self; + } + +// --------------------------------------------------------- +// CWlanScanInfo::~CWlanScanInfo +// --------------------------------------------------------- +// +CWlanScanInfo::~CWlanScanInfo() + { + } + +// --------------------------------------------------------- +// CWlanScanInfo::~First +// --------------------------------------------------------- +// +const TWlanScanInfoFrame* CWlanScanInfo::First() + { + // Rewind to the beginning of scan result list + testContext.mScan.mScanResultIterator = 0; + + return (TWlanScanInfoFrame*)1; // Info frame is not supported + } + +// --------------------------------------------------------- +// CWlanScanInfo::~Next +// --------------------------------------------------------- +// +const TWlanScanInfoFrame* CWlanScanInfo::Next() + { + // Go to next AP in scan results + testContext.mScan.mScanResultIterator++; + + return (TWlanScanInfoFrame*)1; // Info frame is not supported + } + +// --------------------------------------------------------- +// CWlanScanInfo::~IsDone +// --------------------------------------------------------- +// +TBool CWlanScanInfo::IsDone() const + { + TBool result = EFalse; + + // Iterating is complete when iterator is one past the last item + if (testContext.mScan.mScanResultIterator >= + testContext.mScan.mWlanScanResultList.count()) { + result = ETrue; + } + + return result; + } + +// --------------------------------------------------------- +// CWlanScanInfo::RXLevel +// --------------------------------------------------------- +// +TUint8 CWlanScanInfo::RXLevel() const + { + QSharedPointer ap(GetCurrentAp()); + int rxlevel = ap->value(WlanQtUtilsAp::ConfIdSignalStrength).toInt(); + + return (TUint8)rxlevel; + } + +// --------------------------------------------------------- +// CWlanScanInfo::Bssid +// --------------------------------------------------------- +// +void CWlanScanInfo::Bssid( + TWlanBssid& aBssid ) const + { + QSharedPointer ap(GetCurrentAp()); + QByteArray bssid = ap->value(WlanQtUtilsAp::ConfIdBssid).toByteArray(); + + // Length must match, since BSSID is always the same length + Q_ASSERT(bssid.length() == KWlanMaxBssidLength); + + // Copy the BSSID + aBssid.Copy((const unsigned char *)bssid.constData(), bssid.length()); + } + +// --------------------------------------------------------- +// CWlanScanInfo::Capability +// --------------------------------------------------------- +// +TUint16 CWlanScanInfo::Capability() const + { + QSharedPointer ap(GetCurrentAp()); + + TUint16 capabilities = 0; + + // Only connection mode cabability is supported + int connMode = ap->value(WlanQtUtilsAp::ConfIdConnectionMode).toInt(); + if (connMode == CMManagerShim::Infra) { + capabilities |= KWlan802Dot11CapabilityEssMask; + } + + return capabilities; + } + +// --------------------------------------------------------- +// CWlanScanInfo::InformationElement +// --------------------------------------------------------- +// +TInt CWlanScanInfo::InformationElement( + TUint8 aIE, + TUint8& aLength, + const TUint8** aData ) + { + // Static SSID buffer + static TBuf8<255> ssidBuffer; + + QSharedPointer ap(GetCurrentAp()); + + aLength = 0; + + // Only SSID IE is supported + Q_ASSERT(aIE == KWlan802Dot11SsidIE); + (void)aIE; + + // Cypy the SSID + QString ssid = ap->value(WlanQtUtilsAp::ConfIdSsid).toString(); + QByteArray ssidData(ssid.toUtf8()); + ssidBuffer.Copy( + (TUint8*)ssidData.data(), + ssidData.length()); + + // Give reference to the buffer to the caller + *aData = ssidBuffer.Ptr(); + aLength = (TUint8)ssidBuffer.Length(); + + return KErrNone; + } + +// --------------------------------------------------------- +// CWlanScanInfo::IsProtectedSetupSupported +// --------------------------------------------------------- +// +TBool CWlanScanInfo::IsProtectedSetupSupported() + { + QSharedPointer ap(GetCurrentAp()); + + TBool wpsSupport; + bool wps = ap->value(WlanQtUtilsAp::ConfIdWpsSupported).toBool(); + if (wps) { + wpsSupport = ETrue; + } else { + wpsSupport = EFalse; + } + + return wpsSupport; + } + +// --------------------------------------------------------- +// CWlanScanInfo::ExtendedSecurityMode +// --------------------------------------------------------- +// +TWlanConnectionExtentedSecurityMode CWlanScanInfo::ExtendedSecurityMode() const + { + QSharedPointer ap(GetCurrentAp()); + int secMode = ap->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(); + bool pskUse = ap->value(WlanQtUtilsAp::ConfIdWpaPskUse).toBool(); + + TWlanConnectionExtentedSecurityMode ret; + switch (secMode) { + case CMManagerShim::WlanSecModeWep: + // Both WEP security modes are mapped to same WEP sec mode value. + // We test both of them, and toggle the used value each time. + static bool wepOpen = true; + if (wepOpen) { + ret = EWlanConnectionExtentedSecurityModeWepOpen; + } else { + ret = EWlanConnectionExtentedSecurityModeWepShared; + } + wepOpen = !wepOpen; + break; + + case CMManagerShim::WlanSecMode802_1x: + ret = EWlanConnectionExtentedSecurityMode802d1x; + break; + + case CMManagerShim::WlanSecModeWpa: + if (pskUse) + { + ret = EWlanConnectionExtentedSecurityModeWpaPsk; + } + else + { + ret = EWlanConnectionExtentedSecurityModeWpa; + } + break; + + case CMManagerShim::WlanSecModeWpa2: + if (pskUse) + { + ret = EWlanConnectionExtentedSecurityModeWpa2Psk; + } + else + { + ret = EWlanConnectionExtentedSecurityModeWpa2; + } + break; + + case CMManagerShim::WlanSecModeWapi: + if (pskUse) + { + ret = EWlanConnectionExtentedSecurityModeWapiPsk; + } + else + { + ret = EWlanConnectionExtentedSecurityModeWapi; + } + break; + + default: + ret = EWlanConnectionExtentedSecurityModeOpen; + break; + } + + return ret; + } + +// --------------------------------------------------------- +// CWlanScanInfo::CWlanScanInfo +// --------------------------------------------------------- +// +CWlanScanInfo::CWlanScanInfo() + { + } + +// --------------------------------------------------------- +// CWlanScanInfo::GetCurrentAp +// --------------------------------------------------------- +// +QSharedPointer CWlanScanInfo::GetCurrentAp() const + { + // If this fails, client iterates erroneously + Q_ASSERT(!IsDone()); + + // Get the currently iterated AP + QSharedPointer ap( + testContext.mScan.mWlanScanResultList[ + testContext.mScan.mScanResultIterator]); + + return ap; + } diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/tsrc/stubs/wlanmgmtclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/tsrc/stubs/wlanmgmtclient.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Management API stubbing for WLAN Qt Utilities. +*/ + +#ifndef WLANMGMTCLIENT_H +#define WLANMGMTCLIENT_H + +#include "wlanmgmtcommon.h" +#include "wlanscaninfo.h" + +// CLASS DECLARATION + +class CWlanMgmtClient : public CBase + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + * @return Pointer to the constructed object. + */ + static CWlanMgmtClient* NewL(); + + /** + * Destructor. + */ + ~CWlanMgmtClient(); + + /** + * Perform a broadcast scan and return the detected WLAN networks. + * + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aResults Results of the scan. + */ + void GetScanResults( + TRequestStatus& aStatus, + CWlanScanInfo& aResults ); + + /** + * Perform a direct scan for an SSID and return the detected WLAN networks. + * If the SSID has zero length, a broadcast scan will be done. + * + * @param aSsid name of the WLAN network + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aResults Results of the scan. + */ + void GetScanResults( + TWlanSsid& aSsid, + TRequestStatus& aStatus, + CWlanScanInfo& aResults ); + + /** + * Cancel an outstanding scan request. + */ + void CancelGetScanResults(); + + private: // Data + + CWlanMgmtClient(); + }; + +#endif // WLANMGMTCLIENT_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/tsrc/stubs/wlanscaninfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/tsrc/stubs/wlanscaninfo.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Management API stubbing for WLAN Qt Utilities. +*/ + +#ifndef WLANSCANINFO_H +#define WLANSCANINFO_H + +// INCLUDES +#include +#include +#include + +#include +#include "wlanqtutilsap.h" + +typedef TUint8 TWlanScanInfoFrame; + +// CLASS DECLARATION +class CWlanScanInfo : public CBase + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + * @return Pointer to the constructed object. + */ + static CWlanScanInfo* NewL(); + + /** + * Destructor. + */ + ~CWlanScanInfo(); + + /** + * Find the data of the first access point. + * @return Pointer at the beginning of the first access point stored + * in the scan list. NULL if not any. + */ + const TWlanScanInfoFrame* First(); + + /** + * Find the data of the next access point. + * @return Pointer at the beginning of the next access point stored + * in the scan list. NULL if not any. + */ + const TWlanScanInfoFrame* Next(); + + /** + * Find is there any more unhandled access points. + * @return EFalse if there is access points in the list left, + * ETrue if not. + */ + TBool IsDone() const; + + /** + * Return RX level of the BSS. + * @return RX level. + */ + TUint8 RXLevel() const; + + /** + * Return BSSID of the BSS. + * @param aBssid ID of the access point or IBSS network. + * @return Pointer to the beginning of the BSSID. Length is always 6 bytes. + */ + void Bssid( + TWlanBssid& aBssid ) const; + + /** + * Get capability of the BSS (see IEEE 802.11 section 7.3.1.4. + * @return The capability information. + */ + TUint16 Capability() const; + + /** + * Return requested information element. + * @param aIE Id of the requested IE data. + * @param aLength Length of the IE. Zero if IE not found. + * @param aData Pointer to the beginning of the IE data. NULL if IE not found. + * @return General error message. + */ + TInt InformationElement( + TUint8 aIE, + TUint8& aLength, + const TUint8** aData ); + + /** + * Find whether Wi-Fi Protected Setup is supported. + * @return ETrue if AP supports Wi-Fi Protected Setup, + * EFalse if not. + */ + TBool IsProtectedSetupSupported(); + + /** + * Get security mode of the BSS. + * @return security mode. + */ + TWlanConnectionExtentedSecurityMode ExtendedSecurityMode() const; + + private: // Data + + /** + * Constructor. + */ + CWlanScanInfo(); + + /** + * Returns the currently iterated AP. + */ + QSharedPointer GetCurrentAp() const; + + }; + +#endif // WLANSCANINFO_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,1440 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is the source file for testing Wlan Qt Utilities library. +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wlanqtutilsap.h" +#include "wlanqtutilsiap.h" +#include "wlanqtutils.h" +#include "wlanqtutils_p.h" +#include "wlanqtutilsconmonwrapper.h" +#include "wlanqtutilsconmonwrapperinfo_symbian.h" +#include "testwlanqtutils.h" +#include "wlanqtutilstestcontext.h" + +WlanQtUtilsTestContext testContext; + +const QString TestWlanQtUtils::commsDatDefault_ = "default.cre"; + +// --------------------------------------------------------- +// FRAMEWORK FUNCTIONS +// --------------------------------------------------------- + +/** + * Test main function. Runs all test cases. + */ +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\wlanqtutils_qtest_log.txt"; + + TestWlanQtUtils tc; + int res = QTest::qExec(&tc, 3, pass); + + return res; +} + +/** + * This function will be called before the first test function is executed. + */ +void TestWlanQtUtils::initTestCase() +{ + wlanQtUtils_ = NULL; + mSignalScanReady = NULL; + mSignalScanApReady = NULL; + mSignalScanDirectReady = NULL; + signalWlanNetworkOpened_ = NULL; + signalWlanNetworkClosed_ = NULL; + signalIctResult_ = NULL; + + //If Active scheduler exists then don't install a new one as it will cause panic + if (CActiveScheduler::Current() == NULL) { + CActiveScheduler *scheduler = new CActiveScheduler(); + CActiveScheduler::Install(scheduler); + } +} + +/** + * This function will be called after the last test function was executed. + */ +void TestWlanQtUtils::cleanupTestCase() +{ + // CommsDat file is initialized. + subTestLoadCommsDatFile(commsDatDefault_); +} + +/** + * This function will be called before each test function is executed. + */ +void TestWlanQtUtils::init() +{ + // CommsDat file is initialized. + subTestLoadCommsDatFile(commsDatDefault_); + + testContext.initialize(); + + QVERIFY(wlanQtUtils_ == NULL); + QVERIFY(mSignalScanReady == NULL); + QVERIFY(mSignalScanApReady == NULL); + QVERIFY(mSignalScanDirectReady == NULL); + QVERIFY(signalWlanNetworkOpened_ == NULL); + QVERIFY(signalWlanNetworkClosed_ == NULL); + QVERIFY(signalIctResult_ == NULL); + subTestNewWlanQtUtils(); +} + +/** + * This function will be called after each test function is executed. + */ +void TestWlanQtUtils::cleanup() +{ + delete wlanQtUtils_; + wlanQtUtils_ = NULL; + + QCOMPARE(mSignalScanReady->count(), 0); + delete mSignalScanReady; + mSignalScanReady = NULL; + + QCOMPARE(mSignalScanApReady->count(), 0); + delete mSignalScanApReady; + mSignalScanApReady = NULL; + + QCOMPARE(mSignalScanDirectReady->count(), 0); + delete mSignalScanDirectReady; + mSignalScanDirectReady = NULL; + + QCOMPARE(signalWlanNetworkOpened_->count(), 0); + delete signalWlanNetworkOpened_; + signalWlanNetworkOpened_ = NULL; + + QCOMPARE(signalWlanNetworkClosed_->count(), 0); + delete signalWlanNetworkClosed_; + signalWlanNetworkClosed_ = NULL; + + QCOMPARE(signalIctResult_->count(), 0); + delete signalIctResult_; + signalIctResult_ = NULL; +} + +// --------------------------------------------------------- +// TEST CASES +// --------------------------------------------------------- + +/** + * Test available WLAN APs when scan is triggered by client. + */ +void TestWlanQtUtils::testAvailableWlan() +{ + testContext.mScan.createDefaultWlanScanResultList(4); + + // Request a scan to get result signal + wlanQtUtils_->scanWlans(); + + // Let active object run and verify signal. + subTestScanResultSignal(mSignalScanReady, WlanQtUtils::ScanStatusOk); + + // Get and verify the list of available WLAN APs. + QList< QSharedPointer > iaps; + QList< QSharedPointer > aps; + wlanQtUtils_->availableWlans(iaps, aps); + + testContext.mScan.verifyWlanScanResultList(aps); + QCOMPARE(iaps.count(), 0); + aps.clear(); +} + +/** + * Test available WLAN APs when scan is triggered by client. + * Two scan results have the same SSID and the latter one of those will be removed. + * Two scan results have the same SSID but different security mode + * Two scan results have the same SSID and security mode but different WpaPsk value + * and both are included in the results. + * Two scan results have the same SSID but different connection mode + */ +void TestWlanQtUtils::testAvailableWlanDuplicates() +{ + testContext.mScan.createDefaultWlanScanResultList(11); + testContext.mScan.mWlanScanResultList[0]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID"); + testContext.mScan.mWlanScanResultList[2]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID"); + testContext.mScan.mWlanScanResultList[5]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID, different SecMode"); + testContext.mScan.mWlanScanResultList[5]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa); + testContext.mScan.mWlanScanResultList[6]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID, different SecMode"); + testContext.mScan.mWlanScanResultList[6]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeOpen); + testContext.mScan.mWlanScanResultList[7]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID & SecMode diff Psk"); + testContext.mScan.mWlanScanResultList[7]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa2); + testContext.mScan.mWlanScanResultList[9]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID & SecMode diff Psk"); + testContext.mScan.mWlanScanResultList[9]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa2); + testContext.mScan.mWlanScanResultList[9]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse,true); + testContext.mScan.mWlanScanResultList[10]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID"); + testContext.mScan.mWlanScanResultList[10]->setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Adhoc); + + // Request a scan to get result signal + wlanQtUtils_->scanWlans(); + + // Let active object run and verify signal. + subTestScanResultSignal(mSignalScanReady, WlanQtUtils::ScanStatusOk); + + // Get and verify the list of available WLAN APs. + QList< QSharedPointer > iaps; + QList< QSharedPointer > aps; + wlanQtUtils_->availableWlans(iaps, aps); + + // First remove AP that has duplicate SSID. + testContext.mScan.mWlanScanResultList.removeAt(2); + testContext.mScan.verifyWlanScanResultList(aps); + QCOMPARE(iaps.count(), 0); + aps.clear(); +} + +/** + * Test available WLAN APs when scan is triggered by client. + * Include all supported security modes. + */ +void TestWlanQtUtils::testAvailableWlanSecModes() +{ + testContext.mScan.createDefaultWlanScanResultList(11); + testContext.mScan.mWlanScanResultList[0]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); + testContext.mScan.mWlanScanResultList[0]->setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Adhoc); + testContext.mScan.mWlanScanResultList[1]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWep); + testContext.mScan.mWlanScanResultList[2]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWep); + testContext.mScan.mWlanScanResultList[3]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecMode802_1x); + testContext.mScan.mWlanScanResultList[4]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa); + testContext.mScan.mWlanScanResultList[5]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa); + testContext.mScan.mWlanScanResultList[5]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); + testContext.mScan.mWlanScanResultList[6]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa2); + testContext.mScan.mWlanScanResultList[7]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa2); + testContext.mScan.mWlanScanResultList[7]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); + testContext.mScan.mWlanScanResultList[8]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWapi); + testContext.mScan.mWlanScanResultList[9]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWapi); + // Let's trick the stub to return WapiPsk by putting WpaPskUse on * + testContext.mScan.mWlanScanResultList[9]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); + testContext.mScan.mWlanScanResultList[10]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa2); + testContext.mScan.mWlanScanResultList[10]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); + testContext.mScan.mWlanScanResultList[10]->setValue(WlanQtUtilsAp::ConfIdWpsSupported, true); + + // Request a scan to get result signal + wlanQtUtils_->scanWlans(); + + // Let active object run and verify signal. + subTestScanResultSignal(mSignalScanReady, WlanQtUtils::ScanStatusOk); + + // Get and verify the list of available WLAN APs. + QList< QSharedPointer > iaps; + QList< QSharedPointer > aps; + wlanQtUtils_->availableWlans(iaps, aps); + + // Remove the trick *. WapiPsk and Wapi both map to just Wapi + testContext.mScan.mWlanScanResultList[9]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse,false); + testContext.mScan.verifyWlanScanResultList(aps); + QCOMPARE(iaps.count(), 0); + aps.clear(); +} + +/** + * Test available WLAN APs when scan is triggered by client. + * Include some exotic ssids. + */ +void TestWlanQtUtils::testAvailableWlanSsids() +{ + testContext.mScan.createDefaultWlanScanResultList(6); + testContext.mScan.mWlanScanResultList[1]->setValue(WlanQtUtilsAp::ConfIdSsid, " "); + testContext.mScan.mWlanScanResultList[2]->setValue(WlanQtUtilsAp::ConfIdSsid, " whitespace around ssid "); + testContext.mScan.mWlanScanResultList[3]->setValue(WlanQtUtilsAp::ConfIdSsid, QString(QChar())); + testContext.mScan.mWlanScanResultList[4]->setValue(WlanQtUtilsAp::ConfIdSsid, "maximum length ssid that is 32 c"); + testContext.mScan.mWlanScanResultList[5]->setValue(WlanQtUtilsAp::ConfIdSsid, "A"); + + // Request a scan to get result signal + wlanQtUtils_->scanWlans(); + + // Let active object run and verify signal. + subTestScanResultSignal(mSignalScanReady, WlanQtUtils::ScanStatusOk); + + // Get and verify the list of available WLAN APs. + QList< QSharedPointer > iaps; + QList< QSharedPointer > aps; + wlanQtUtils_->availableWlans(iaps, aps); + + // Empty ssids are removed from results + testContext.mScan.mWlanScanResultList.removeAt(3); + testContext.mScan.mWlanScanResultList.removeAt(1); + testContext.mScan.verifyWlanScanResultList(aps); + QCOMPARE(iaps.count(), 0); + aps.clear(); +} + +/** + * Test available WLAN APs when there are also WLAN IAPs available. + */ +void TestWlanQtUtils::testAvailableWlanWithIaps() +{ + testContext.mScan.createDefaultWlanScanResultList(7); + testContext.mScan.mWlanScanResultList[1]->setValue(WlanQtUtilsAp::ConfIdSsid, "WLAN IAP 3"); + testContext.mScan.mWlanScanResultList[1]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa); + testContext.mScan.mWlanScanResultList[1]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse,true); + testContext.mScan.mWlanScanResultList[5]->setValue(WlanQtUtilsAp::ConfIdSsid, "WLAN IAP 1"); + // SSID is found in Internet Snap, but security mode does not match: + testContext.mScan.mWlanScanResultList[6]->setValue(WlanQtUtilsAp::ConfIdSsid, "WLAN IAP 2"); + testContext.mScan.mWlanScanResultList[6]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa); + + // Request a scan to get result signal + wlanQtUtils_->scanWlans(); + + // Let active object run and verify signal. + subTestScanResultSignal(mSignalScanReady, WlanQtUtils::ScanStatusOk); + + // Get and verify the list of available WLAN APs. + QList< QSharedPointer > iaps; + QList< QSharedPointer > aps; + wlanQtUtils_->availableWlans(iaps, aps); + + // Verify WLAN AP list. First, remove scan results that will not appear + // because they are WLAN IAPs. + testContext.mScan.mWlanScanResultList.removeAt(5); + testContext.mScan.mWlanScanResultList.removeAt(1); + testContext.mScan.verifyWlanScanResultList(aps); + + // Verify WLAN IAP list + QCOMPARE(iaps.count(), 2); + QCOMPARE(iaps[0]->value(WlanQtUtilsIap::ConfIdIapId).toInt(), 5); + QCOMPARE(iaps[0]->value(WlanQtUtilsIap::ConfIdName).toString(), QString("WLAN IAP 1")); + QCOMPARE(iaps[0]->value(WlanQtUtilsAp::ConfIdSsid).toString(), QString("WLAN IAP 1")); + QCOMPARE(iaps[1]->value(WlanQtUtilsIap::ConfIdIapId).toInt(), 7); + QCOMPARE(iaps[1]->value(WlanQtUtilsIap::ConfIdName).toString(), QString("WLAN IAP 3")); + QCOMPARE(iaps[1]->value(WlanQtUtilsAp::ConfIdSsid).toString(), QString("WLAN IAP 3")); + iaps.clear(); + aps.clear(); +} + +/** + * Test refereshing of WLAN APs when client requests sequential scans. + */ +void TestWlanQtUtils::testAvailableWlanSequence() +{ + // **************** Before 1st scan ******************** + QList< QSharedPointer > iaps; + QList< QSharedPointer > aps; + wlanQtUtils_->availableWlans(iaps, aps); + // Verify we have no results + QCOMPARE(aps.count(), 0); + QCOMPARE(iaps.count(), 0); + + // **************** 1st scan ******************** + // 6 APs are required for this scan + testContext.mScan.createDefaultWlanScanResultList(6); + + wlanQtUtils_->scanWlans(); + subTestScanResultSignal(mSignalScanReady, WlanQtUtils::ScanStatusOk); + + // Get the results for the 1st scan + wlanQtUtils_->availableWlans(iaps, aps); + // Verify the results for the scan + testContext.mScan.verifyWlanScanResultList(aps); + QCOMPARE(iaps.count(), 0); + aps.clear(); + + // **************** 2nd scan ******************** + // 2 APs are required for this scan + testContext.mScan.createDefaultWlanScanResultList(2); + + wlanQtUtils_->scanWlans(); + subTestScanResultSignal(mSignalScanReady, WlanQtUtils::ScanStatusOk); + + // Get the results for the 2nd scan + wlanQtUtils_->availableWlans(iaps, aps); + // Verify the results for the scan + testContext.mScan.verifyWlanScanResultList(aps); + QCOMPARE(iaps.count(), 0); + aps.clear(); + + // **************** 3rd scan ******************** + // 4 APs are required for the 3rd scan + testContext.mScan.createDefaultWlanScanResultList(4); + + wlanQtUtils_->scanWlans(); + subTestScanResultSignal(mSignalScanReady, WlanQtUtils::ScanStatusOk); + + // Get the results for the 3rd scan + wlanQtUtils_->availableWlans(iaps, aps); + // Verify the results for the scan + testContext.mScan.verifyWlanScanResultList(aps); + QCOMPARE(iaps.count(), 0); + aps.clear(); +} + +/** + * Test availability scan that finds nothing. + */ +void TestWlanQtUtils::testAvailableWlanScanEmpty() +{ + // Form result list + testContext.mScan.createDefaultWlanScanResultList(0); + + // Request a direct scan to get result signal + wlanQtUtils_->scanWlans(); + + // Let active object run and verify signal. + subTestScanResultSignal(mSignalScanReady, WlanQtUtils::ScanStatusOk); + + // Get and verify the list of available WLAN APs. + QList< QSharedPointer > iaps; + QList< QSharedPointer > aps; + wlanQtUtils_->availableWlans(iaps, aps); + testContext.mScan.verifyWlanScanResultList(aps); + QCOMPARE(iaps.count(), 0); +} + +/** + * Test WLAN availability scan failure. + */ +void TestWlanQtUtils::testAvailableWlanScanError() +{ + // Set the scan to fail + testContext.mScan.mScanRetValue = KErrGeneral; + + // Start the scan + wlanQtUtils_->scanWlans(); + + // Catch & check the scan result signal + subTestScanResultSignal(mSignalScanReady, WlanQtUtils::ScanStatusError); +} + +/** + * Test available WLAN APs when scan is triggered by client. + */ +void TestWlanQtUtils::testAvailableWlanAps() +{ + testContext.mScan.createDefaultWlanScanResultList(4); + + // Request a scan to get result signal + wlanQtUtils_->scanWlanAps(); + + // Let active object run and verify signal. + subTestScanResultSignal(mSignalScanApReady, WlanQtUtils::ScanStatusOk); + + // Get and verify the list of available WLAN APs. + QList< QSharedPointer > aps; + wlanQtUtils_->availableWlanAps(aps); + + testContext.mScan.verifyWlanScanResultList(aps); + aps.clear(); +} + +/** + * Test a direct scan that finds nothing. + */ +void TestWlanQtUtils::testAvailableWlanApsScanEmpty() +{ + // Form result list + testContext.mScan.createDefaultWlanScanResultList(0); + + // Request a direct scan to get result signal + wlanQtUtils_->scanWlanAps(); + + // Let active object run and verify signal. + subTestScanResultSignal(mSignalScanApReady, WlanQtUtils::ScanStatusOk); + + // Get and verify the list of available WLAN APs. + QList< QSharedPointer > aps; + wlanQtUtils_->availableWlanAps(aps); + testContext.mScan.verifyWlanScanResultList(aps); +} + +/** + * Test cancellation of WLAN AP scan. + */ +void TestWlanQtUtils::testStopWlanApScan() +{ + // Do not complete scan request immediately + testContext.mScan.mCompleteWlanScan = false; + + // Start the scan + wlanQtUtils_->scanWlanAps(); + // Cancel the scan + wlanQtUtils_->stopWlanScan(); + + // Catch & check the scan result signal + subTestScanResultSignal(mSignalScanApReady, WlanQtUtils::ScanStatusCancelled); +} + +/** + * Test WLAN AP scan failure. + */ +void TestWlanQtUtils::testWlanApScanError() +{ + // Set the scan to fail + testContext.mScan.mScanRetValue = KErrGeneral; + + // Start the scan + wlanQtUtils_->scanWlanAps(); + + // Catch & check the scan result signal + subTestScanResultSignal(mSignalScanApReady, WlanQtUtils::ScanStatusError); +} + +/** + * Test a basic direct scan. + */ +void TestWlanQtUtils::testDirectScanBasic() +{ + // Form result list + testContext.mScan.createDefaultWlanScanResultList(2); + testContext.mScan.mWlanScanResultList[0]->setValue(WlanQtUtilsAp::ConfIdSsid, "testssid"); + testContext.mScan.mWlanScanResultList[0]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); + testContext.mScan.mWlanScanResultList[1]->setValue(WlanQtUtilsAp::ConfIdSsid, "testssid"); + testContext.mScan.mWlanScanResultList[1]->setValue(WlanQtUtilsAp::ConfIdBssid, "654321"); + testContext.mScan.mWlanScanResultList[1]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa); + + // Request a direct scan to get result signal + wlanQtUtils_->scanWlanDirect(QString("testssid")); + + // Let active object run and verify signal. + subTestScanResultSignal(mSignalScanDirectReady, WlanQtUtils::ScanStatusOk); + + // Get and verify the list of available WLAN APs. + QList< QSharedPointer > aps; + wlanQtUtils_->availableWlanAps(aps); + + testContext.mScan.verifyWlanScanResultList(aps); + aps.clear(); +} + +/** + * Test a direct scan that finds nothing. + */ +void TestWlanQtUtils::testDirectScanEmpty() +{ + // Form result list + testContext.mScan.createDefaultWlanScanResultList(0); + + // Request a direct scan to get result signal + wlanQtUtils_->scanWlanDirect(QString("notavailable")); + + // Let active object run and verify signal. + subTestScanResultSignal(mSignalScanDirectReady, WlanQtUtils::ScanStatusOk); + + // Get and verify the list of available WLAN APs. + QList< QSharedPointer > aps; + wlanQtUtils_->availableWlanAps(aps); + testContext.mScan.verifyWlanScanResultList(aps); +} + +/** + * Test cancellation of direct scan. + */ +void TestWlanQtUtils::testDirectScanStop() +{ + // Do not complete scan request immediately + testContext.mScan.mCompleteWlanScan = false; + + // Start the scan + wlanQtUtils_->scanWlanDirect(QString("testssid")); + // Cancel the scan + wlanQtUtils_->stopWlanScan(); + + // Catch & check the scan result signal + subTestScanResultSignal(mSignalScanDirectReady, WlanQtUtils::ScanStatusCancelled); +} + +/** + * Test direct scan failure. + */ +void TestWlanQtUtils::testDirectScanError() +{ + // Set the scan to fail + testContext.mScan.mScanRetValue = KErrGeneral; + + // Start the scan + wlanQtUtils_->scanWlanDirect(QString("boundtofail")); + + // Catch & check the scan result signal + subTestScanResultSignal(mSignalScanDirectReady, WlanQtUtils::ScanStatusError); +} + +/** + * This function tests creation of WLAN IAP in a succesful manner. + * - WLAN scan is made because otherwise we cannot verify that IAP creation is successful. + * - Check that there are no available WLAN IAPs. + * - Fetch SNAP list. + * - Create WLAN IAP. + * - Check that WLAN IAP has been created and that this IAP is not in WLAN AP scan results. + */ +void TestWlanQtUtils::testCreateIapOk() +{ + testContext.mScan.createDefaultWlanScanResultList(1); + testContext.mScan.mWlanScanResultList[0]->setValue(WlanQtUtilsAp::ConfIdSsid, "testCreateIapOk"); + testContext.mScan.mWlanScanResultList[0]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa); + testContext.mScan.mWlanScanResultList[0]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse,true); + + // Request a scan to get result signal + wlanQtUtils_->scanWlans(); + + // Let active object run and verify signal. + subTestScanResultSignal(mSignalScanReady, WlanQtUtils::ScanStatusOk); + + // Ensure there are no WLAN IAPs but there is one scan result. + QList< QSharedPointer > iaps; + QList< QSharedPointer > aps; + wlanQtUtils_->availableWlans(iaps, aps); + + QCOMPARE(iaps.count(), 0); + testContext.mScan.verifyWlanScanResultList(aps); + + // Execute createIap() function + QScopedPointer wlanAp(subTestNewAp()); + wlanAp->setValue(WlanQtUtilsAp::ConfIdSsid, "testCreateIapOk"); + wlanAp->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa); + wlanAp->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); + wlanAp->setValue(WlanQtUtilsAp::ConfIdWpaPsk, "100euronlounas"); + int iapId = wlanQtUtils_->createIap(wlanAp.data()); + QVERIFY(iapId != WlanQtUtils::IapIdNone); + + // Verify that created IAP is in the IAP list and AP list is empty. + wlanQtUtils_->availableWlans(iaps, aps); + QCOMPARE(iaps.count(), 1); + QCOMPARE(iaps[0]->value(WlanQtUtilsIap::ConfIdIapId).toInt(), iapId); + QCOMPARE(iaps[0]->value(WlanQtUtilsIap::ConfIdName).toString(), QString("testCreateIapOk")); + QCOMPARE(iaps[0]->value(WlanQtUtilsAp::ConfIdSsid).toString(), QString("testCreateIapOk")); + QCOMPARE(iaps[0]->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(), (int)(CMManagerShim::WlanSecModeWpa)); + QCOMPARE(iaps[0]->value(WlanQtUtilsAp::ConfIdWpaPskUse).toBool(), true); + QCOMPARE(aps.count(), 0); + iaps.clear(); +} + +/** + * This function tests creation of WLAN IAP in unsuccesful manner. + */ +void TestWlanQtUtils::testCreateIapErr() +{ + // Execute createIap() function with invalid parameters + QScopedPointer wlanAp(subTestNewAp()); + wlanAp->setValue(WlanQtUtilsAp::ConfIdSsid, "testCreateIapErr"); + wlanAp->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, false); + // Invalid security mode -> exception + wlanAp->setValue( + WlanQtUtilsAp::ConfIdSecurityMode, + CMManager::EWlanSecModeWAPI + 1111); + int iapId = wlanQtUtils_->createIap(wlanAp.data()); + QVERIFY(iapId == WlanQtUtils::IapIdNone); +} + +/** + * This function tests creation of WLAN IAPs with different WEP keys. + */ +void TestWlanQtUtils::testCreateIapWepKeys() +{ + // Create the IAPs with different kind of WEP keys + QScopedPointer wlanAp(subTestNewAp()); + wlanAp->setValue(WlanQtUtilsAp::ConfIdSsid, "testCreateIapWepKeys"); + wlanAp->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWep); + wlanAp->setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex2); + // All keys in HEX format + wlanAp->setValue(WlanQtUtilsAp::ConfIdWepKey1, "1234567891"); + wlanAp->setValue(WlanQtUtilsAp::ConfIdWepKey2, "1234567891"); + wlanAp->setValue(WlanQtUtilsAp::ConfIdWepKey3, "1234567891"); + wlanAp->setValue(WlanQtUtilsAp::ConfIdWepKey4, "1234567891"); + + int iapId = wlanQtUtils_->createIap(wlanAp.data()); + QVERIFY(iapId != WlanQtUtils::IapIdNone); + + wlanAp->setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex3); + // All keys in ASCII format + wlanAp->setValue(WlanQtUtilsAp::ConfIdWepKey1, "12345"); + wlanAp->setValue(WlanQtUtilsAp::ConfIdWepKey2, "12345"); + wlanAp->setValue(WlanQtUtilsAp::ConfIdWepKey3, "12345"); + wlanAp->setValue(WlanQtUtilsAp::ConfIdWepKey4, "12345"); + + iapId = wlanQtUtils_->createIap(wlanAp.data()); + QVERIFY(iapId != WlanQtUtils::IapIdNone); + + wlanAp->setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex4); + // Different keys, including a missing one + wlanAp->setValue(WlanQtUtilsAp::ConfIdWepKey1, ""); + wlanAp->setValue(WlanQtUtilsAp::ConfIdWepKey2, "12345678911234567892123456"); + wlanAp->setValue(WlanQtUtilsAp::ConfIdWepKey3, "12345"); + wlanAp->setValue(WlanQtUtilsAp::ConfIdWepKey4, "1234567891123"); + + iapId = wlanQtUtils_->createIap(wlanAp.data()); + QVERIFY(iapId != WlanQtUtils::IapIdNone); +} + +/** + * This function tests updating of WLAN IAP in a succesful manner. + */ +void TestWlanQtUtils::testUpdateIapOk() +{ + // Create an IAP that can be updated + QScopedPointer wlanAp(subTestNewAp()); + wlanAp->setValue(WlanQtUtilsAp::ConfIdSsid, "testUpdateIapOk"); + int iapId = wlanQtUtils_->createIap(wlanAp.data()); + + // Update the name and verify it changed + wlanAp->setValue(WlanQtUtilsAp::ConfIdSsid, "UPDATED_testUpdateIapOk"); + + bool success = wlanQtUtils_->updateIap(iapId, wlanAp.data()); + QVERIFY(success == true); + QString name = wlanQtUtils_->iapName(iapId); + QCOMPARE(name, QString("UPDATED_testUpdateIapOk")); +} + +/** + * This function tests updating of WLAN IAP in unsuccesful manner. + */ +void TestWlanQtUtils::testUpdateIapErr() +{ + // Try to update a non-existing IAP + WlanQtUtilsAp wlanAp; + bool success = wlanQtUtils_->updateIap(200, &wlanAp); + QVERIFY(success == false); +} + +/** + * This function tests deletion of WLAN IAP in a succesful manner. + */ +void TestWlanQtUtils::testDeleteIapOk() +{ + // Create an IAP that can be deleted + QScopedPointer wlanAp(subTestNewAp()); + wlanAp->setValue(WlanQtUtilsAp::ConfIdSsid, "testDeleteIapOk"); + int iapId = wlanQtUtils_->createIap(wlanAp.data()); + + // Check that IAP now exists + QString name = wlanQtUtils_->iapName(iapId); + QCOMPARE(name, QString("testDeleteIapOk")); + + // Delete it and verify it does not exist anymore + wlanQtUtils_->deleteIap(iapId); + name = wlanQtUtils_->iapName(iapId); + QVERIFY(name.isEmpty()); +} + +/** + * This function tests deletion of WLAN IAP in unsuccesful manner. + */ +void TestWlanQtUtils::testDeleteIapErr() +{ + // Try to delete a non-existing IAP + wlanQtUtils_->deleteIap(200); + + // No signals or return values to verify +} + +/** + * This function tests connecting to IAP in a succesful manner. + */ +void TestWlanQtUtils::testConnectIapOk() +{ + testContext.esock_.startRetValue_ = KErrNone; + + // Esock stub completes connection creation immediately + wlanQtUtils_->connectIap(5); + + // Connection creation in ConnMon interface + testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, 5); + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonEventBase( + EConnMonCreateConnection, + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); + + // Connection status change in ConnMon interface + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KConnectionOpen)); + + // Receive signal for connection opening (caused by connectIap, which completed immediately) + QList arguments; + subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); + QCOMPARE(arguments.at(0).toInt(), 5); + + // Connection status change to opened in ConnMon interface. Sub test cases between test + // cases check that no extra signals are sent + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KLinkLayerOpen)); +} + +/** + * This function tests connecting to IAP in unsuccesful manner. + */ +void TestWlanQtUtils::testConnectIapErr() +{ + testContext.esock_.startRetValue_ = KErrGeneral; + + wlanQtUtils_->connectIap(7); + + testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, 7); + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonEventBase( + EConnMonCreateConnection, + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KConnectionOpen)); + + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonEventBase( + EConnMonDeleteConnection, + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); + + QList arguments; + subTestSignalWaitAndTake(signalWlanNetworkClosed_, &arguments); + QCOMPARE(arguments.at(0).toInt(), 7); + QCOMPARE(arguments.at(1).toInt(), KErrGeneral); +} + +// TODO: testDisconnectFail cases are needed when fail branches are +// implemented into the connmon wrapper +/** + * This function tests IAP disconnecting functionality. + */ +void TestWlanQtUtils::testDisconnectIapOk() +{ + // Create and connect an IAP we can then disconnect + QScopedPointer wlanAp(subTestNewAp()); + wlanAp->setValue(WlanQtUtilsAp::ConfIdSsid, "testDisconnectIapOk"); + wlanAp->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa); + + int iapId = wlanQtUtils_->createIap(wlanAp.data()); + testContext.esock_.startRetValue_ = KErrNone; + wlanQtUtils_->connectIap(iapId); + QList arguments; + subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); + QCOMPARE(arguments.at(0).toInt(), iapId); + + // Make sure there is the newly created connection active and also + // another one to gain coverage + testContext.connMon_.activeConnections_.createDefaultActiveConnList(2, iapId - 1); + // The disconnect function does not have any return values or + // signals related to the disconnection, thus plain + // function call is done for the test. + wlanQtUtils_->disconnectIap(iapId); +} + +/** + * This function tests IAP disconnecting functionality when there is no + * IAP to disconnect. + */ +void TestWlanQtUtils::testDisconnectIapIgnored() +{ + testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, 150); + wlanQtUtils_->disconnectIap(200); + wlanQtUtils_->disconnectIap(WlanQtUtils::IapIdNone); +} + +/** + * This function tests connection status getter. + */ +void TestWlanQtUtils::testConnectionStatus() +{ + // Request status when there is no connection + WlanQtUtils::ConnStatus status = wlanQtUtils_->connectionStatus(); + QCOMPARE(status, WlanQtUtils::ConnStatusDisconnected); + + // Make a connection and request its status + testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, 5); + // Send event for connection creation. + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonEventBase( + EConnMonCreateConnection, + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); + // Send events for connection status change -> connecting + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KStartingConnection)); + + // Request status when there is connection in connecting state + status = wlanQtUtils_->connectionStatus(); + QCOMPARE(status, WlanQtUtils::ConnStatusConnecting); + + // Send events for connection status change -> connected + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KLinkLayerOpen)); + + QList arguments; + subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); + QCOMPARE(arguments.at(0).toInt(), 5); + + // Request status when there is connection in connected state + status = wlanQtUtils_->connectionStatus(); + QCOMPARE(status, WlanQtUtils::ConnStatusConnected); +} + +/** + * This function tests IAP name getter with existing IAP ID. + */ +void TestWlanQtUtils::testIapNameFound() +{ + // Create the IAP we want to find with the getter + QScopedPointer wlanAp(subTestNewAp()); + wlanAp->setValue(WlanQtUtilsAp::ConfIdSsid, "testIapFound"); + wlanAp->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa2); + + int iapId = wlanQtUtils_->createIap(wlanAp.data()); + + // Execute the function under test and check that we got the correct name + QString name = wlanQtUtils_->iapName(iapId); + QCOMPARE(name, QString("testIapFound")); +} + +/** + * This function tests IAP name getter with non-existing IAP ID. + */ +void TestWlanQtUtils::testIapNameNotFound() +{ + // Execute the function under test and check that we get no name as result + QString name = wlanQtUtils_->iapName(200); // id in valid range, but not found -> KErrNotFound + QVERIFY(name.isEmpty()); + + name = wlanQtUtils_->iapName(1000); // id not in valid range -> KErrArgument + QVERIFY(name.isEmpty()); + + name = wlanQtUtils_->iapName(3); // id of cellular IAP -> discarded + QVERIFY(name.isEmpty()); +} + +/** + * This function tests active WLAN IAP getter with existing connection. + */ +void TestWlanQtUtils::testActiveIapFound() +{ + // Create the IAP we want to find with the getter + QScopedPointer wlanAp(subTestNewAp()); + wlanAp->setValue(WlanQtUtilsAp::ConfIdSsid, "testConnectedWlanIdFound"); + wlanAp->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa); + + int iapId = wlanQtUtils_->createIap(wlanAp.data()); + + testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, iapId); + + // Send event for connection creation. + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonEventBase( + EConnMonCreateConnection, + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); + + // Send events for connection status change -> opened. + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KStartingConnection)); + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KLinkLayerOpen)); + + QList arguments; + subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); + QCOMPARE(arguments.at(0).toInt(), iapId); + + // Execute the function under test and check that we get valid ID as result + int id = wlanQtUtils_->activeIap(); + QCOMPARE(id, iapId); +} + +/** + * This function tests active WLAN IAP getter with connection existing already during dll construction. + */ +void TestWlanQtUtils::testActiveIapFoundConstructor() +{ + // IAP IDs 4 and 5 exist in default commsdat file, 4 is GPRS, 5 is WLAN + testContext.connMon_.activeConnections_.createDefaultActiveConnList(2, 4); + testContext.connMon_.activeConnections_.activeConnList_[0]->connMonBearerType_ = EBearerGPRS; + + // Create a new instance in order to test functionality triggered in constructor. + WlanQtUtils *utils = new WlanQtUtils(); + + // Execute the function under test and check that we get valid ID as result + int id = utils->activeIap(); + QCOMPARE(id, 5); + + delete utils; +} + +/** + * This function tests active WLAN IAP getter without existing connection. + */ +void TestWlanQtUtils::testActiveIapNotFound() +{ + // Execute the function under test and check that we get invalid ID as result + int id = wlanQtUtils_->activeIap(); + QCOMPARE(id, WlanQtUtils::IapIdNone); +} + +/** + * Test WLAN scan triggering interface. + */ +void TestWlanQtUtils::testScanWlans() +{ + // Execute function under test + wlanQtUtils_->scanWlans(); + + // No need to verify scan results here, testAvailableWlan* test cases + // are for that. Just make sure the result signal is received. + subTestScanResultSignal(mSignalScanReady, WlanQtUtils::ScanStatusOk); +} + +/** + * Test WLAN scan result ignoring & deletion during an ongoing request. + */ +void TestWlanQtUtils::testScanWlansIgnored() +{ + // Do not complete scan request immediately + testContext.mScan.mCompleteWlanScan = false; + + // Execute function under test + wlanQtUtils_->scanWlans(); + + // Ongoing scan is cancelled in destructors +} + +/** + * Test WLAN scan stopping interface when scan is active. + */ +void TestWlanQtUtils::testStopWlanScanOk() +{ + // Do not complete scan request immediately + testContext.mScan.mCompleteWlanScan = false; + // Start a scan + wlanQtUtils_->scanWlans(); + // Execute function under test + wlanQtUtils_->stopWlanScan(); + + // Catch & check the scan result signal + subTestScanResultSignal(mSignalScanReady, WlanQtUtils::ScanStatusCancelled); +} + +/** + * Test WLAN scan stopping interface when no scan is ongoing. + */ +void TestWlanQtUtils::testStopWlanScanIgnored() +{ + // Stop without having an active scan + wlanQtUtils_->stopWlanScan(); + + // No return values or signals to verify +} + +/** + * This function tests Wlan network opening signal when network is not opened by the dll. + */ +void TestWlanQtUtils::testWlanNetworkOpened() +{ + testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, 5); + + // Send event for connection creation. + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonEventBase( + EConnMonCreateConnection, + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); + + // Send events for connection status change -> opened. + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KConnectionOpen)); + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KConfigDaemonFinishedRegistration)); + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KLinkLayerOpen)); + + QList arguments; + subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); + QCOMPARE(arguments.at(0).toInt(), 5); + + // Send uninteresting event to gain coverage + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonEventBase( + EConnMonNetworkStatusChange, + 10)); +} + +/** + * This function tests Wlan network closing signal when network is not closed by the dll. + */ +void TestWlanQtUtils::testWlanNetworkClosed() +{ + // First create a connection + testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, 5); + + // Send event for connection creation. + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonEventBase( + EConnMonCreateConnection, + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); + + // Send events for connection status change -> opened. + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KConnectionOpen)); + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KLinkLayerOpen)); + + QList arguments; + subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); + QCOMPARE(arguments.at(0).toInt(), 5); + + // Send event for connection status change -> closed. + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KLinkLayerClosed)); + + // Send event for connection deletion. + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonEventBase( + EConnMonDeleteConnection, + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); + + subTestSignalWaitAndTake(signalWlanNetworkClosed_, &arguments); + QCOMPARE(arguments.at(0).toInt(), 5); + QCOMPARE(arguments.at(1).toInt(), KErrNone); +} + +/** + * This function tests WlanQtUtilsAp copy constructor. + */ +void TestWlanQtUtils::testApCopyConstructor() +{ + WlanQtUtilsAp firstAp; + firstAp.setValue(WlanQtUtilsAp::ConfIdSsid, "testApCopyConstructor"); + firstAp.setValue(WlanQtUtilsAp::ConfIdSignalStrength, 90); + firstAp.setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Infra); + firstAp.setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa); + firstAp.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); + firstAp.setValue(WlanQtUtilsAp::ConfIdWpaPsk, "100euronlounas"); + + // Create the copy AP + WlanQtUtilsAp secondAp(firstAp); + QCOMPARE(secondAp.value(WlanQtUtilsAp::ConfIdSsid).toString(), QString("testApCopyConstructor")); + QCOMPARE(secondAp.value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(), (int)(CMManagerShim::WlanSecModeWpa)); + QCOMPARE(secondAp.value(WlanQtUtilsAp::ConfIdWpaPskUse).toBool(), true); + QCOMPARE(secondAp.value(WlanQtUtilsAp::ConfIdSignalStrength).toInt(), 90); + QCOMPARE(secondAp.value(WlanQtUtilsAp::ConfIdConnectionMode).toInt(), (int)(CMManagerShim::Infra)); + QCOMPARE(secondAp.value(WlanQtUtilsAp::ConfIdWpaPsk).toString(), QString("100euronlounas")); +} + +/** + * This function tests ICT when connection test passes. + */ +void TestWlanQtUtils::testConnectionTestOk() +{ + // Create new IAP to test + QScopedPointer wlanAp(subTestNewAp()); + wlanAp->setValue(WlanQtUtilsAp::ConfIdSsid, "testConnectionTestOk"); + int iapId = wlanQtUtils_->createIap(wlanAp.data()); + QVERIFY(iapId != WlanQtUtils::IapIdNone); + + testContext.esock_.startRetValue_ = KErrNone; + + // Esock stub completes connection creation immediately + wlanQtUtils_->connectIap(iapId, true); + + // Connection creation in ConnMon interface + testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, iapId); + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonEventBase( + EConnMonCreateConnection, + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); + + // Connection status change in ConnMon interface + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KConnectionOpen)); + + // Receive signal for connection opening (caused by connectIap, which completed immediately) + QList arguments; + subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); + QCOMPARE(arguments.at(0).toInt(), iapId); + + // Connection status change to opened in ConnMon interface. Sub test cases between test + // cases check that no extra signals are sent + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KLinkLayerOpen)); + + // Connection test automatically started at this point. Call result function explicitly + // No interface exists that we could check that the IAP is moved to Internet SNAP correctly +#if 0 // TODO: Make this work with the new WLAN login interface + TBuf<5> string; + wlanQtUtils_->d_ptr->mConnTestWrapper->d_ptr_->ConnectivityObserver(EConnectionOk, string); + + subTestSignalWaitAndTake(signalIctResult_, &arguments); + QCOMPARE(arguments.at(0).toInt(), iapId); + QCOMPARE(arguments.at(1).toBool(), true); +#endif +} + +/** + * This function tests ICT when connection test fails. + */ +void TestWlanQtUtils::testConnectionTestErr() +{ + // Create and connect an IAP and request ICT to be run + QScopedPointer wlanAp(subTestNewAp()); + wlanAp->setValue(WlanQtUtilsAp::ConfIdSsid, "testConnectionTestErr"); + wlanAp->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa); + + int iapId = wlanQtUtils_->createIap(wlanAp.data()); + wlanQtUtils_->connectIap(iapId, true); + + testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, iapId); + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonEventBase( + EConnMonCreateConnection, + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KConnectionOpen)); + QList arguments; + subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); + QCOMPARE(arguments.at(0).toInt(), iapId); + + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KLinkLayerOpen)); + + // Connection test automatically started at this point. Call result function explicitly + // No interface exists that we could check that IAP is not moved to another SNAP +#if 0 // TODO: Make this work with the new WLAN login interface + TBuf<5> string; + wlanQtUtils_->d_ptr->mConnTestWrapper->d_ptr_->ConnectivityObserver(EHttpAuthenticationNeeded, string); + + subTestSignalWaitAndTake(signalIctResult_, &arguments); + QCOMPARE(arguments.at(0).toInt(), iapId); + QCOMPARE(arguments.at(1).toBool(), false); +#endif +} + +/** + * This function tests that Gprs connection events are ignored. + */ +void TestWlanQtUtils::testConnMonEventGprs() +{ + // First create a connection + testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, 4); + testContext.connMon_.activeConnections_.activeConnList_[0]->connMonBearerType_ = EBearerGPRS; + + // Send event for connection creation. + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonEventBase( + EConnMonCreateConnection, + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); + + // Send events for connection status change -> opened. + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KConnectionOpen)); + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KLinkLayerOpen)); + + // Send event for connection status change -> closed. + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KLinkLayerClosed)); + + // Send event for connection deletion. + wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonEventBase( + EConnMonDeleteConnection, + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); +} + +/** + * This function tests ConnMon event handling with connection existing already during dll construction. + */ +void TestWlanQtUtils::testConnMonEventCreatedBeforeConstructor() +{ + // IAP ID 5 exists in default commsdat file + testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, 5); + + // Create a new instance in order to test functionality triggered in constructor. + WlanQtUtils *utils = new WlanQtUtils(); + + QSignalSpy *signalWlanNetworkOpened = new QSignalSpy(utils, SIGNAL(wlanNetworkOpened(int))); + QVERIFY(signalWlanNetworkOpened->isValid() == true); + QSignalSpy *signalWlanNetworkClosed = new QSignalSpy(utils, SIGNAL(wlanNetworkClosed(int, int))); + QVERIFY(signalWlanNetworkClosed->isValid() == true); + + // Send events for connection status change -> opened. + utils->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KConnectionOpen)); + utils->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KLinkLayerOpen)); + + QList arguments; + subTestSignalWaitAndTake(signalWlanNetworkOpened, &arguments); + QCOMPARE(arguments.at(0).toInt(), 5); + + // Send event for connection status change -> closed. + utils->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KLinkLayerClosed)); + + // Send event for connection deletion. + utils->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonEventBase( + EConnMonDeleteConnection, + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); + + subTestSignalWaitAndTake(signalWlanNetworkClosed, &arguments); + QCOMPARE(arguments.at(0).toInt(), 5); + QCOMPARE(arguments.at(1).toInt(), KErrNone); + + delete signalWlanNetworkOpened; + delete signalWlanNetworkClosed; + delete utils; +} + +// --------------------------------------------------------- +// SUB TEST CASES +// --------------------------------------------------------- + +/** + * This function waits for active objects to get time to run, takes the arguments of the + * first signal and returns them from the given signal spy. + * This function also verifies that the number of signals is 1. + * + * @param[in] spy Signal spy. + * @param[out] arguments Arguments of the first signal in the given signal spy. NULL if arguments not needed. + */ +void TestWlanQtUtils::subTestSignalWaitAndTake(QSignalSpy* spy, QList* arguments) +{ + QTest::qWait(1); + QCOMPARE(spy->count(), 1); + QList arguments_tmp = spy->takeFirst(); + if (arguments != NULL) { + *arguments = arguments_tmp; + } +} + +/** + * Test case for catching and verifying the scan result signal. + * + * @param [in] status Scan result status. + */ +void TestWlanQtUtils::subTestScanResultSignal(QSignalSpy* spy, int status) +{ + QList arguments; + subTestSignalWaitAndTake(spy, &arguments); + QCOMPARE(arguments.length(), 1); + QCOMPARE(arguments.at(0).toInt(), status); +} + +/** + * This function loads given CommsDat file, replacing current one. + * If CommsDat file doesn't exist, it can be re-created by commanding WST script. + * Using help switch is a quick way: + * run_wst HELP + * + * @param newCommsdatFilename Filename of the new CommsDat to be loaded. + */ +void TestWlanQtUtils::subTestLoadCommsDatFile(QString newCommsdatFilename) +{ + // EPOC's CommsDat filename + const QString epocCommsdatFilename("cccccc00.cre"); + // EPOC's directory for CommsDat file + const QString commsdatDir("c:\\private\\10202be9\\persists\\"); + // Created backup directory under EPOC for CommsDat files + const QString storeDir("c:\\private\\10202be9\\persists\\backup\\"); + QString nameOld = commsdatDir + epocCommsdatFilename; + QString nameDefault = storeDir + newCommsdatFilename; + + // First remove the old CommsDat file. + Q_ASSERT(QFile::remove(nameOld) == TRUE); + + // Copy the stored default CommsDat file. + Q_ASSERT(QFile::copy(nameDefault, nameOld) == TRUE); +} + +/** + * + */ +void TestWlanQtUtils::subTestNewWlanQtUtils() +{ + delete wlanQtUtils_; + wlanQtUtils_ = new WlanQtUtils(); + + delete mSignalScanReady; + mSignalScanReady = new QSignalSpy(wlanQtUtils_, SIGNAL(wlanScanReady(int))); + QVERIFY(mSignalScanReady->isValid() == true); + + delete mSignalScanApReady; + mSignalScanApReady = new QSignalSpy(wlanQtUtils_, SIGNAL(wlanScanApReady(int))); + QVERIFY(mSignalScanApReady->isValid() == true); + + delete mSignalScanDirectReady; + mSignalScanDirectReady = new QSignalSpy(wlanQtUtils_, SIGNAL(wlanScanDirectReady(int))); + QVERIFY(mSignalScanDirectReady->isValid() == true); + + delete signalWlanNetworkOpened_; + signalWlanNetworkOpened_ = new QSignalSpy(wlanQtUtils_, SIGNAL(wlanNetworkOpened(int))); + QVERIFY(signalWlanNetworkOpened_->isValid() == true); + + delete signalWlanNetworkClosed_; + signalWlanNetworkClosed_ = new QSignalSpy(wlanQtUtils_, SIGNAL(wlanNetworkClosed(int, int))); + QVERIFY(signalWlanNetworkClosed_->isValid() == true); + + delete signalIctResult_; + signalIctResult_ = new QSignalSpy(wlanQtUtils_, SIGNAL(ictResult(int, int))); + QVERIFY(signalIctResult_->isValid() == true); +} + +/** + * Create a new AP and fill it with default values. + */ +WlanQtUtilsAp *TestWlanQtUtils::subTestNewAp() +{ + WlanQtUtilsAp *ap = new WlanQtUtilsAp; + + // Set default values + ap->setValue(WlanQtUtilsAp::ConfIdSsid, QString()); + ap->setValue(WlanQtUtilsAp::ConfIdSignalStrength, 90); + ap->setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Infra); + ap->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); + ap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, false); + ap->setValue(WlanQtUtilsAp::ConfIdWpaPsk, QString()); + ap->setValue(WlanQtUtilsAp::ConfIdWepKey1, QString()); + ap->setValue(WlanQtUtilsAp::ConfIdWepKey2, QString()); + ap->setValue(WlanQtUtilsAp::ConfIdWepKey3, QString()); + ap->setValue(WlanQtUtilsAp::ConfIdWepKey4, QString()); + ap->setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1); + ap->setValue(WlanQtUtilsAp::ConfIdHidden, false); + + return ap; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,142 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is the header file for testing Wlan Qt Utilities library. +*/ + +#ifndef TESTWLANQTUTILS_H +#define TESTWLANQTUTILS_H + +#include + +class QSignalSpy; +class WlanQtUtils; +class WlanQtUtilsAp; + +class TestWlanQtUtils: public QObject +{ + Q_OBJECT + +private slots: + + // Functions from QTest framework. + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + + // Test functions for public interface. + + // scanWlans() + void testAvailableWlan(); + void testAvailableWlanDuplicates(); + void testAvailableWlanSecModes(); + void testAvailableWlanSsids(); + void testAvailableWlanWithIaps(); + void testAvailableWlanSequence(); + void testAvailableWlanScanEmpty(); + void testAvailableWlanScanError(); + + // scanWlanAps() + void testAvailableWlanAps(); + void testAvailableWlanApsScanEmpty(); + void testStopWlanApScan(); + void testWlanApScanError(); + + // scanWlanDirect() + void testDirectScanBasic(); + void testDirectScanEmpty(); + void testDirectScanStop(); + void testDirectScanError(); + + void testCreateIapOk(); + void testCreateIapErr(); + void testCreateIapWepKeys(); + + void testUpdateIapOk(); + void testUpdateIapErr(); + + void testDeleteIapOk(); + void testDeleteIapErr(); + + void testConnectIapOk(); + void testConnectIapErr(); + + void testDisconnectIapOk(); + void testDisconnectIapIgnored(); + + void testConnectionStatus(); + + void testIapNameFound(); + void testIapNameNotFound(); + + void testActiveIapFound(); + void testActiveIapFoundConstructor(); + void testActiveIapNotFound(); + + void testScanWlans(); + void testScanWlansIgnored(); + + void testStopWlanScanOk(); + void testStopWlanScanIgnored(); + + void testWlanNetworkOpened(); + void testWlanNetworkClosed(); + + void testApCopyConstructor(); + + // Test functions for private implementation (tested via public interface) + void testConnectionTestOk(); + void testConnectionTestErr(); + + void testConnMonEventGprs(); + void testConnMonEventCreatedBeforeConstructor(); + +private: + + // Helper functions, that is, sub test cases. + void subTestSignalWaitAndTake(QSignalSpy *spy, QList *arguments); + void subTestScanResultSignal(QSignalSpy* spy, int status); + void subTestLoadCommsDatFile(QString newCommsdatFilename); + void subTestNewWlanQtUtils(); + WlanQtUtilsAp *subTestNewAp(); + + // Member variables. + WlanQtUtils *wlanQtUtils_; + QSignalSpy *mSignalScanReady; + QSignalSpy *mSignalScanApReady; + QSignalSpy *mSignalScanDirectReady; + QSignalSpy *signalWlanNetworkOpened_; + QSignalSpy *signalWlanNetworkClosed_; + QSignalSpy *signalIctResult_; + + /* Default CommsDat file name + SNAP ID=3: Internet: + IAP ID = 1: packet data 1 + IAP ID = 3: packet data 2 + IAP ID = 4: packet data 3 + IAP ID = 5: WLAN IAP 1, EWlanSecModeOpen + IAP ID = 6: WLAN IAP 2, EWlanSecModeWep, w2key + IAP ID = 7: WLAN IAP 3, EWlanSecModeWpa, wlan3key + SNAP ID = 4: Multimedia msg. + SNAP ID = 5: WAP services + SNAP ID = 6: My Snap: + IAP ID = 8: Home WLAN, EWlanSecModeOpen + IAP ID = 9: Streaming + */ + static const QString commsDatDefault_; +}; + +#endif // TESTWLANQTUTILS_H + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.pro Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,95 @@ +# +# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# Test library for WlanQtUtils class. +# + +QT += testlib + +TEMPLATE = app +TARGET = t_wlanqtutils + +TARGET.CAPABILITY = ALL -TCB + +DEPENDPATH += . + +#Store generated files to their own directory +MOC_DIR = build + +# Temporary solution to fix tracecompiler +# When tracecompiler is fixed, this can be removed +symbian: { + MMP_RULES += "USERINCLUDE traces" +} + +#BUILD_DLL macro is used to define export macro +DEFINES += BUILD_WLANQTUTILITIES_DLL + +INCLUDEPATH += \ + . \ + ../../inc \ + stubs \ + ../base/inc \ + ../wrapper/inc \ + ../traces + +# Input +HEADERS += \ + testwlanqtutils.h \ + context/wlanqtutilstestcontext.h \ + ../base/inc/wlanqtutils.h \ + ../base/inc/wlanqtutils_p.h \ + ../base/inc/wlanqtutilsiap.h \ + ../base/inc/wlanqtutilsiapsettings.h \ + ../base/inc/wlanqtutilsap.h \ + ../base/inc/wlanqtutilsconnection.h \ + ../wrapper/inc/wlanqtutilsconmonwrapper.h \ + ../wrapper/inc/wlanqtutilsesockwrapper.h \ + ../wrapper/inc/wlanqtutilsscan.h \ + ../traces/OstTraceDefinitions.h + +SOURCES += \ + testwlanqtutils.cpp \ + context/wlanqtutilstestcontext.cpp \ + ../base/src/wlanqtutils.cpp \ + ../base/src/wlanqtutils_p.cpp \ + ../base/src/wlanqtutilsiap.cpp \ + ../base/src/wlanqtutilsap.cpp \ + ../base/src/wlanqtutilsconnection.cpp \ + ../base/src/wlanqtutilsiapsettings.cpp \ + ../wrapper/src/wlanqtutilsconmonwrapper.cpp \ + ../wrapper/src/wlanqtutilsesockwrapper.cpp \ + ../wrapper/src/wlanqtutilsscan.cpp + +symbian: { + HEADERS += \ + ../wrapper/inc/wlanqtutilsconmonwrapperdisconnect_symbian.h \ + ../wrapper/inc/wlanqtutilsconmonwrapperinfo_symbian.h \ + ../wrapper/inc/wlanqtutilsesockwrapper_symbian.h \ + ../wrapper/inc/wlanqtutilsscan_symbian.h \ + stubs/wlanmgmtclient.h \ + stubs/wlanscaninfo.h + + SOURCES += \ + ../wrapper/src/wlanqtutilsconmonwrapperdisconnect_symbian.cpp \ + ../wrapper/src/wlanqtutilsconmonwrapperinfo_symbian.cpp \ + ../wrapper/src/wlanqtutilsesockwrapper_symbian.cpp \ + ../wrapper/src/wlanqtutilsscan_symbian.cpp \ + stubs/stub_connmon.cpp \ + stubs/stub_esock.cpp \ + stubs/stub_wlanmgmtclient.cpp \ + stubs/stub_wlanscaninfo.cpp +} + +LIBS += -lconnmon -lconnection_settings_shim -lextendedconnpref -lnetmeta -lesock -lictswlanlogininterface diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/tsrc/tools/default.cre Binary file wlanutilities/wlanqtutilities/tsrc/tools/default.cre has changed diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/tsrc/tools/make_wst.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/tsrc/tools/make_wst.bat Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,197 @@ +::============================================================================= +:: Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +:: All rights reserved. +:: This component and the accompanying materials are made available +:: under the terms of "Eclipse Public License v1.0" +:: which accompanies this distribution, and is available +:: at the URL "http://www.eclipse.org/legal/epl-v10.html". +:: +:: Initial Contributors: +:: Nokia Corporation - initial contribution. +:: +:: Contributors: +:: +:: Description: +:: Wlan Qt Utilities test execution script +::============================================================================= +:: +:: Following commands are implemented: +:: - CLEAN_OLD_FILES +:: - COMPILE_WLANQTUTILS +:: - COMPILE_TEST_CASES +:: - RUN_TEST_CASES +:: - GENERATE_REPORTS +:: - SHOW_RESULTS +:: - START_BROWSER +::============================================================================= + +::----------------------------------------------------------------------------- +:: Do the preparations: +:: - Don't show the commands +:: - Use local parameters -- don't pollute the global one +::----------------------------------------------------------------------------- +@echo off + +echo *** WST_MAKE: START: +setlocal + +::----------------------------------------------------------------------------- +:: Check input +:: +:: Parameters that are required: +:: 1) wst_root_dir +:: 2) log_file_name +:: 3) the command +::----------------------------------------------------------------------------- + +:: (1) +if not exist %1 goto ERROR +if [%1]==[] goto ERROR +set wst_root_dir=%1 +set wst_log_dir=%1\wst_log +set wst_report_dir=%1\wst_report +set wlanqtutils_root_dir=%1\..\.. +set wlanqtutils_test_dir=%1\.. + +:: (2) +if [%2]==[] goto ERROR +set log_file_name=%2 +set log_file=%wst_log_dir%\%log_file_name% +if not exist %log_file% goto ERROR +echo *** DATE AND TIME: %date%, %time% >> %log_file% +echo *** WST_MAKE: INFO: Wlan Qt Utilities root dir: %wlanqtutils_root_dir% +echo *** WST_MAKE: INFO: Wlan Qt Utilities test dir: %wlanqtutils_test_dir% +echo *** WST_MAKE: INFO: WST log dir: %wst_log_dir% +echo *** WST_MAKE: INFO: WST log file: %log_file% + +:: (3) +if [%3]==[] goto ERROR +goto %3 + +:: Error if label not found. +goto ERROR + +::----------------------------------------------------------------------------- +:CLEAN_OLD_FILES +::----------------------------------------------------------------------------- + +echo *** WST_MAKE: CLEAN_OLD_FILES: +echo *** WST_LOG: CLEAN_OLD_FILES >> %log_file% + +move %wst_log_dir%\%log_file_name% %wst_root_dir% +del /F /S /Q %wst_log_dir%\* +del /F /S /Q %wst_report_dir%\* +rmdir /S /Q %wst_log_dir%\CMTHTML +rmdir /S /Q %wst_log_dir%\CTCHTML +move %wst_root_dir%\%log_file_name% %wst_log_dir% +del \epoc32\winscw\c\data\wlanqtutils_qtest_log.txt + +goto THE_END + +::----------------------------------------------------------------------------- +:COMPILE_WLANQTUTILS +::----------------------------------------------------------------------------- + +echo *** WST_MAKE: COMPILE_WLANQTUTILS: +echo *** WST_LOG: COMPILE_WLANQTUTILS >> %log_file% + +cd %wlanqtutils_root_dir% +call qmake >> %log_file% 2>&1 +call sbs -c winscw reallyclean >> %log_file% 2>&1 +call sbs -c winscw_udeb >> %log_file% 2>&1 + +goto THE_END + +::----------------------------------------------------------------------------- +:COMPILE_TEST_CASES +::----------------------------------------------------------------------------- + +echo *** WST_MAKE: COMPILE_TEST_CASES: +echo *** WST_LOG: COMPILE_TEST_CASES >> %log_file% + +cd %wlanqtutils_test_dir% +call qmake "CONFIG -= debug" >> %log_file% 2>&1 +call sbs -c winscw reallyclean >> %log_file% 2>&1 +:: Call CTC instrumentation script. Source directories hard coded, because NO_EXCLUDE does not like % characters... +call ctcwrap -C EXCLUDE=* -C NO_EXCLUDE+..\base\src\*.cpp,..\wrapper\src\*.cpp -2comp -n %wst_log_dir%\MON.sym -i m -v sbs -c winscw_udeb >> %log_file% 2>&1 + +goto THE_END + +::----------------------------------------------------------------------------- +:RUN_TEST_CASES +::----------------------------------------------------------------------------- + +echo *** WST_MAKE: RUN_TEST_CASES: +echo *** WST_LOG: RUN_TEST_CASES >> %log_file% + +call \epoc32\release\winscw\udeb\t_wlanqtutils.exe -o c:\data\wlanqtutils_qtest_log.txt + +goto THE_END + +::----------------------------------------------------------------------------- +:GENERATE_REPORTS +::----------------------------------------------------------------------------- + +echo *** WST_MAKE: GENERATE_REPORTS: +echo *** WST_LOG: GENERATE_REPORTS >> %log_file% + +cd %wst_log_dir% + +call ctcpost -p %wst_log_dir%\ctc_coverage.txt +call ctc2html -nsb -i %wst_log_dir%\ctc_coverage.txt + +call dir /s /b %wlanqtutils_root_dir%\*.cpp > %wst_log_dir%\raw_filelist.txt + +call findstr /I /V "moc_" %wst_log_dir%\raw_filelist.txt > %wst_log_dir%\filelist.txt +call cmt -f %wst_log_dir%\filelist.txt -o cmt_metrics.txt >> %log_file% +call cmt2html -nsb -i cmt_metrics.txt + +:: Clean up temp files +call del %wst_log_dir%\*filelist.txt + +echo *** WST_MAKE: COPY LOGS: +call copy %TEMP%\epocwind.out %wst_log_dir%\epocwind.txt + +goto THE_END + +::----------------------------------------------------------------------------- +:SHOW_RESULTS +::----------------------------------------------------------------------------- + +echo *** WST_MAKE: SHOW_RESULTS: +echo *** WST_LOG: SHOW_RESULTS >> %log_file% +echo *** Module tests: +call findstr /C:"Totals: " \epoc32\winscw\c\data\wlanqtutils_qtest_log.txt +echo *** Coverage: +call findstr /C:"Number of " %wst_log_dir%\ctc_coverage.txt +call findstr /C:"TER " %wst_log_dir%\ctc_coverage.txt + +goto THE_END + +::----------------------------------------------------------------------------- +:START_BROWSER +::----------------------------------------------------------------------------- + +echo *** WST_MAKE: START_BROWSER: +echo *** WST_LOG: START_BROWSER >> %log_file% +echo. +echo Starting up browser to show the results + +start %wst_root_dir%\wst_report\coverage.html + +goto THE_END + +::----------------------------------------------------------------------------- +:ERROR +::----------------------------------------------------------------------------- + +echo *** WST_MAKE: ERROR: +endlocal +echo wst_make *** Error (unknown parameter) >> %log_file% + +goto THE_END + +::----------------------------------------------------------------------------- +:THE_END +::----------------------------------------------------------------------------- +echo *** WST_MAKE: END: diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/tsrc/tools/run_wst.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/tsrc/tools/run_wst.bat Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,173 @@ +::============================================================================= +:: Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +:: All rights reserved. +:: This component and the accompanying materials are made available +:: under the terms of "Eclipse Public License v1.0" +:: which accompanies this distribution, and is available +:: at the URL "http://www.eclipse.org/legal/epl-v10.html". +:: +:: Initial Contributors: +:: Nokia Corporation - initial contribution. +:: +:: Contributors: +:: +:: Description: +:: Wlan Qt Utilities test execution script +::============================================================================= + +:: Script(s) uses following environment settings: +:: - CD +:: - DATE +:: - TIME +:: - TEMP + + +::----------------------------------------------------------------------------- +:: Do the preparations: +:: - Don't show the commands +:: - Use local parameters -- don't pollute the global one +:: - Dim the lights for time of script execution +:: - Store the current working directory +::----------------------------------------------------------------------------- + +@echo off +echo *** RUN_WST: START: +setlocal +color 08 +pushd . +if not exist run_wst.bat goto INVALID_DIR + + +::----------------------------------------------------------------------------- +:: Set the local variables +::----------------------------------------------------------------------------- + +echo *** RUN_WST: SET VARIABLES: +set wst_root_dir=%cd% +set wst_log_dir=%wst_root_dir%\wst_log +set wst_report_dir=%wst_root_dir%\wst_report +set log_file=%wst_log_dir%\wst_log.txt +set build_script=make_wst.bat +set epoc_commsdat_dir=\epoc32\winscw\c\private\10202be9\persists +if not exist %epoc_commsdat_dir% goto INVALID_DIR +set epoc_backup_dir=%epoc_commsdat_dir%\backup +set ut_commsdat_dir=%wst_root_dir% +if not exist %ut_commsdat_dir% goto INVALID_DIR +set ut_commsdat_file_default=%ut_commsdat_dir%\default.cre +if not exist %ut_commsdat_file_default% goto INVALID_DIR +set ut_commsdat_files=%ut_commsdat_dir%\*.cre +if not exist %ut_commsdat_files% goto INVALID_DIR + + +::----------------------------------------------------------------------------- +:: Copy commsdat file to emulator directory and also to backup directory +::----------------------------------------------------------------------------- + +echo *** RUN_WST: COPY FILES: +copy %ut_commsdat_file_default% %epoc_commsdat_dir%\cccccc00.cre /y +if not exist %epoc_backup_dir% mkdir %epoc_backup_dir% +copy %ut_commsdat_files% %epoc_backup_dir% /y + + +::----------------------------------------------------------------------------- +:: Check that script exists +::----------------------------------------------------------------------------- + +echo *** RUN_WST: SOME CHECKS: +if not exist %build_script% goto INVALID_DIR +:: Create output directory if it does not exist +if not exist %wst_log_dir% mkdir %wst_log_dir% +if not exist %wst_report_dir% mkdir %wst_report_dir% +:: Create log file +echo *** WST_LOG: BEGIN *** > %log_file% + + +::----------------------------------------------------------------------------- +:: Check parameters +::----------------------------------------------------------------------------- + +set command=ERROR +if [%1]==[] set command=CLEAN_OLD_FILES COMPILE_WLANQTUTILS COMPILE_TEST_CASES RUN_TEST_CASES GENERATE_REPORTS SHOW_RESULTS +if [%1]==[CLEAN_OLD] set command=CLEAN_OLD_FILES +if [%1]==[WLANQTUTILS] set command=COMPILE_WLANQTUTILS +if [%1]==[CASES] set command=COMPILE_TEST_CASES +if [%1]==[RUN] set command=RUN_TEST_CASES +if [%1]==[REPORTS] set command=GENERATE_REPORTS +if [%1]==[RESULTS] set command=SHOW_RESULTS +if [%1]==[BROWSE] set command=START_BROWSER +if [%1]==[/?] goto HELP +if [%1]==[HELP] goto HELP +if [%1]==[/h] goto HELP +if [%1]==[-h] goto HELP + +::----------------------------------------------------------------------------- +:PARSE_COMMANDS +::----------------------------------------------------------------------------- + +echo *** RUN_WST: COMMAND: %command% +echo *** RUN_WST: CALL SCRIPT: +for %%i IN ( %command% ) DO ( + call %build_script% %wst_root_dir% wst_log.txt %%i + for /f "tokens=3 delims= " %%x in ('find /C " Error " %log_file%') do ( + if not [%%x]==[0] goto ERROR + ) +) + +goto THE_END + + +::----------------------------------------------------------------------------- +:INVALID_DIR +::----------------------------------------------------------------------------- + +echo *** RUN_WST: INVALID DIR: +echo *** Test script sub-script not found! +echo *** Please be sure to run the script in same directory, +echo *** i.e. .\run_wst.bat , and NOT .\tools\run_wst.bat + +goto THE_END + + +::----------------------------------------------------------------------------- +:ERROR +::----------------------------------------------------------------------------- + +echo *** RUN_WST: ERROR: +color 48 +echo Error in compilation: +findstr /C:" Error " < %log_file% +echo. +Echo Quitting WST. + +goto THE_END + + +::----------------------------------------------------------------------------- +:HELP +::----------------------------------------------------------------------------- + +echo *** RUN_WST: HELP: +echo Run Wlan Qt Utilities Workstation Testing +echo. +echo RUN_WST [param] +echo. +echo param +echo [none] - Do all, from CLEAN_OLD to RESULTS +echo. +echo CLEAN_OLD - Clean metrics and other generated files +echo WLANQTUTILS - Build only Wlan Qt Utilities components +echo CASES - Build only Tester components +echo RUN - Run Tester +echo REPORTS - Generate reports +echo RESULTS - Show results +echo BROWSE - Start browser +echo. + + +::----------------------------------------------------------------------------- +:THE_END +::----------------------------------------------------------------------------- + +echo *** RUN_WST: END: +color +popd diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/ut/context/commsdat_files/50_default.cre Binary file wlanutilities/wlanqtutilities/ut/context/commsdat_files/50_default.cre has changed diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/ut/context/commsdat_files/default.cre Binary file wlanutilities/wlanqtutilities/ut/context/commsdat_files/default.cre has changed diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/ut/context/wlanqtutilstestcontext.cpp --- a/wlanutilities/wlanqtutilities/ut/context/wlanqtutilstestcontext.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,237 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This is the source file for Connection Utilities test context. -*/ - -#include -#include -#include -#include -#include "wlanqtutilscommon.h" -#include "wlanqtutilstestcontext.h" -#include "wlanqtutilswlanap.h" -#include "wlanqtutilsactiveconn.h" - -// --------------------------------------------------------- -// class WlanQtUtilsCtxEsock -// --------------------------------------------------------- - -WlanQtUtilsCtxEsock::WlanQtUtilsCtxEsock() : startRetValue_(KErrNone) -{ -} - -WlanQtUtilsCtxEsock::~WlanQtUtilsCtxEsock() -{ -} - -void WlanQtUtilsCtxEsock::initialize() -{ - startRetValue_ = KErrNone; -} - -// --------------------------------------------------------- -// class WlanQtUtilsCtxActiveConn -// --------------------------------------------------------- - -WlanQtUtilsCtxActiveConn::WlanQtUtilsCtxActiveConn() : - WlanQtUtilsActiveConn(), - connMonBearerType_(EBearerUnknown), - connMonConnectionStatus_(KConnectionUninitialised), - connMonWlanConnectionMode_(-1), - connMonWlanSecurityMode_(-1), - applicationUids_() -{ -} - -WlanQtUtilsCtxActiveConn::~WlanQtUtilsCtxActiveConn() -{ -} - -// --------------------------------------------------------- -// class WlanQtUtilsCtxActiveConnections -// --------------------------------------------------------- - -WlanQtUtilsCtxActiveConnections::WlanQtUtilsCtxActiveConnections() : activeConnList_() -{ -} - -WlanQtUtilsCtxActiveConnections::~WlanQtUtilsCtxActiveConnections() -{ - clearActiveConnList(); -} - -void WlanQtUtilsCtxActiveConnections::initialize() -{ - clearActiveConnList(); -} - -void WlanQtUtilsCtxActiveConnections::createDefaultActiveConnList(int numberOfActiveConns, int firstIapId) -{ - clearActiveConnList(); - for (int i = 0; i < numberOfActiveConns; i++) { - WlanQtUtilsCtxActiveConn *activeConn = new WlanQtUtilsCtxActiveConn(); - - activeConn->setConnectionId((i + 1) * 100); - activeConn->setIapId(firstIapId + i); - activeConn->connMonConnectionStatus_ = KConnectionOpen; - activeConn->setConnectionStatus(WlanQtUtilsConnectionStatusConnected); - - // WLAN connection. - activeConn->connMonBearerType_ = EBearerWLAN; - activeConn->setBearerType(WlanQtUtilsBearerTypeWlan); - activeConn->connMonWlanSecurityMode_ = EConnMonSecurityOpen; - activeConn->connMonWlanConnectionMode_ = EConnMonInfraStructure; - activeConnList_.append(activeConn); - } -} - -void WlanQtUtilsCtxActiveConnections::clearActiveConnList() -{ - Q_FOREACH(WlanQtUtilsCtxActiveConn* activeConn, activeConnList_) { - delete activeConn; - } - activeConnList_.clear(); -} - -void WlanQtUtilsCtxActiveConnections::verifyActiveConnList(QList activeConnList) -{ - QCOMPARE(activeConnList.count(), activeConnList_.count()); - - for (int i = 0; i < activeConnList_.count(); i++) { - QCOMPARE(activeConnList[i]->connectionId(), activeConnList_[i]->connectionId()); - QCOMPARE(activeConnList[i]->iapId(), activeConnList_[i]->iapId()); - QCOMPARE(activeConnList[i]->connectionStatus(), activeConnList_[i]->connectionStatus()); - QCOMPARE(activeConnList[i]->bearerType(), activeConnList_[i]->bearerType()); - } -} - -WlanQtUtilsCtxActiveConn *WlanQtUtilsCtxActiveConnections::findActiveConn(uint connectionId) const -{ - WlanQtUtilsCtxActiveConn *activeConn = NULL; - for (int i = 0; i < activeConnList_.count(); i++) { - if (activeConnList_[i]->connectionId() == connectionId) { - activeConn = activeConnList_[i]; - } - } - Q_ASSERT(activeConn != NULL); - return activeConn; -} - -// --------------------------------------------------------- -// class WlanQtUtilsWlanScanResult -// --------------------------------------------------------- - -WlanQtUtilsWlanScanResult::WlanQtUtilsWlanScanResult() : wlanScanResultList_() -{ -} - -WlanQtUtilsWlanScanResult::~WlanQtUtilsWlanScanResult() -{ - clearWlanScanResultList(); -} - -void WlanQtUtilsWlanScanResult::initialize() -{ - clearWlanScanResultList(); -} - -void WlanQtUtilsWlanScanResult::createDefaultWlanScanResultList(int numberOfWlanAps) -{ - clearWlanScanResultList(); - for (int i = 0; i < numberOfWlanAps; i++) { - WlanQtUtilsWlanAp *ap = new WlanQtUtilsWlanAp(); - ap->setSsid("TestWlanAp" + QString::number(i+1)); - ap->setBssid("addMAC"); // TODO: Generate something when bssid retrieval works. - ap->setSignalStrength(20); - ap->setConnectionMode(EConnMonInfraStructure); - ap->setSecurityMode(WlanQtUtilsWlanSecModeOpen); - // TODO: Create constructor to WlanQtUtilsWlanAp which takes all member variables as parameter. - wlanScanResultList_.append(ap); - } -} - -void WlanQtUtilsWlanScanResult::clearWlanScanResultList() -{ - Q_FOREACH(WlanQtUtilsWlanAp* ap, wlanScanResultList_) { - delete ap; - } - wlanScanResultList_.clear(); -} - -void WlanQtUtilsWlanScanResult::verifyWlanScanResultList(QList wlanApList) -{ - QCOMPARE(wlanApList.count(), wlanScanResultList_.count()); - - for (int i = 0; i < wlanScanResultList_.count(); i++) { - QCOMPARE(wlanApList[i]->ssid(), wlanScanResultList_[i]->ssid()); - QCOMPARE(wlanApList[i]->bssid(), wlanScanResultList_[i]->bssid()); - QCOMPARE(wlanApList[i]->signalStrength(), wlanScanResultList_[i]->signalStrength()); - QCOMPARE(wlanApList[i]->connectionMode(), wlanScanResultList_[i]->connectionMode()); - QCOMPARE(wlanApList[i]->securityMode(), wlanScanResultList_[i]->securityMode()); - } -} - -// --------------------------------------------------------- -// class WlanQtUtilsCtxConnMon -// --------------------------------------------------------- - -WlanQtUtilsCtxConnMon::WlanQtUtilsCtxConnMon() : wlanScanResult_() -{ -} - -WlanQtUtilsCtxConnMon::~WlanQtUtilsCtxConnMon() -{ -} - -void WlanQtUtilsCtxConnMon::initialize() -{ - wlanScanResult_.initialize(); - activeConnections_.initialize(); -} - -// --------------------------------------------------------- -// class WlanQtUtilsCtxIct -// --------------------------------------------------------- - -WlanQtUtilsCtxIct::WlanQtUtilsCtxIct() -{ -} - -WlanQtUtilsCtxIct::~WlanQtUtilsCtxIct() -{ -} - -void WlanQtUtilsCtxIct::initialize() -{ -} - -// --------------------------------------------------------- -// class WlanQtUtilsTestContext -// --------------------------------------------------------- - -WlanQtUtilsTestContext::WlanQtUtilsTestContext() : esock_(), connMon_(), ict_() -{ -} - -WlanQtUtilsTestContext::~WlanQtUtilsTestContext() -{ -} - -void WlanQtUtilsTestContext::initialize() -{ - esock_.initialize(); - connMon_.initialize(); - ict_.initialize(); -} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/ut/context/wlanqtutilstestcontext.h --- a/wlanutilities/wlanqtutilities/ut/context/wlanqtutilstestcontext.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,250 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This is the header file for Wlan Qt Utilities test context. -*/ - -#ifndef WLANQTUTILSTESTCONTEXT_H -#define WLANQTUTILSTESTCONTEXT_H - -#include - -#include "wlanqtutilsactiveconn.h" - -class WlanQtUtilsWlanAp; - -/** - * This is context for esock library. - */ -class WlanQtUtilsCtxEsock : public QObject -{ - Q_OBJECT - -public: - WlanQtUtilsCtxEsock(); - ~WlanQtUtilsCtxEsock(); - - /** - * Initializes context. - */ - void initialize(); - - /** Return value of RConnection::Start(). */ - int startRetValue_; -}; - -/** - * This class is a helper class for testing purposes. It derives all properties of WlanQtUtilsActiveConn. - * In addition, this class contains member variables for setting some Connection Monitor specific - * values which cannot be easily generated from member variables of WlanQtUtilsActiveConn. - * E.g., connection status has different enum in Connection Monitor and Wlan Qt Utilities. This class - * enables setting both of those. Connmon version is set so that the stub can return it when - * requested, and Wlan Qt Utilities version is used for verifying that tested code returns right - * value. - */ -class WlanQtUtilsCtxActiveConn : public WlanQtUtilsActiveConn -{ -public: - WlanQtUtilsCtxActiveConn(); - ~WlanQtUtilsCtxActiveConn(); - - /** Bearer type in connmon format. */ - int connMonBearerType_; - /** Connection status in connmon format. */ - int connMonConnectionStatus_; - /** WLAN connection mode in connmon format. */ - int connMonWlanConnectionMode_; - /** WLAN security mode in connmon format. */ - int connMonWlanSecurityMode_; - /** Application UIDs that map to application strings. */ - QList applicationUids_; -}; - -/** - * This class represents active connections. - */ -class WlanQtUtilsCtxActiveConnections : public QObject -{ - Q_OBJECT - -public: - WlanQtUtilsCtxActiveConnections(); - ~WlanQtUtilsCtxActiveConnections(); - - /** - * Initializes context. - */ - void initialize(); - - /** - * Creates a list of active connections for scan results. - * - * @param[in] numberOfActiveConns Number of active connections that are created. - * @param[in] firstIapId IAP ID of the first connection to be created. - */ - void createDefaultActiveConnList(int numberOfActiveConns, int firstIapId); - - /** - * Verifies that the given active connection list returned by the real application matches - * with the one in the context. - * - * @param[in] activeConnList Active connections that are verified against the context. - */ - void verifyActiveConnList(QList activeConnList); - - /** - * Finds an active connection matching with the given connection ID from the context. - * Asserts if connection with given connection ID is not found. - * - * @param connectionId Connection ID. - * @return Active connection. - */ - WlanQtUtilsCtxActiveConn *findActiveConn(uint connectionId) const; - - /** - * List of active connections that RConnectionMonitor stub will return in response to - * RConnectionMonitor::Get*Attribute() functions. - */ - QList activeConnList_; - - // TODO: We need return values for all different RConnectionMonitor::Get*Attribute() functions - // to test error cases. - -private: - - /** - * Destroys and clears the list of WLAN APs. - */ - void clearActiveConnList(); -}; - -/** - * This class represents WLAN APs that represent the results of WLAN scanning triggered by - * RConnectionMonitor::GetPckgAttribute() - */ -class WlanQtUtilsWlanScanResult : public QObject -{ - Q_OBJECT - -public: - WlanQtUtilsWlanScanResult(); - ~WlanQtUtilsWlanScanResult(); - - /** - * Initializes context. - */ - void initialize(); - - /** - * Creates a list of WLAN APs for scan results. - * - * @param[in] numberOfWlanAps Number of WLAN APs that are created. - */ - void createDefaultWlanScanResultList(int numberOfWlanAps); - - /** - * Verifies that the given WLAN AP list returned by the real application matches - * with the one in the context. - * - * @param[in] wlanApList WLAN APs that are verified against the context. - */ - void verifyWlanScanResultList(QList wlanApList); // TODO: Maybe boolean return value - - /** - * List of WLAN access points that RConnectionMonitor stub will return in response to - * RConnectionMonitor::GetPckgAttribute(). - */ - QList wlanScanResultList_; - -private: - - /** - * Destroys and clears the list of WLAN APs. - */ - void clearWlanScanResultList(); -}; - -/** - * Test context for RConnectionMonitor. - */ -class WlanQtUtilsCtxConnMon : public QObject -{ - Q_OBJECT - -public: - WlanQtUtilsCtxConnMon(); - ~WlanQtUtilsCtxConnMon(); - - /** - * Initializes context. - */ - void initialize(); - - /** Results of WLAN scanning. */ - WlanQtUtilsWlanScanResult wlanScanResult_; - - /** List of active connections. */ - WlanQtUtilsCtxActiveConnections activeConnections_; -}; - -/** - * Test context for Internet connectivity test library. - */ -class WlanQtUtilsCtxIct : public QObject -{ - Q_OBJECT - -public: - WlanQtUtilsCtxIct(); - ~WlanQtUtilsCtxIct(); - - /** - * Initializes context. - */ - void initialize(); -}; - -/** - * Test context. The purpose of this context is to provide values that are used in stubs - * and in verification of outputs in test cases. - * - * In stubs, context is used to verify the inputs of parameters and to set output - * parameters into a specific value. - * - * In test cases, context is used to verify that the output parameters match with the once - * set in the stub. - */ -class WlanQtUtilsTestContext : public QObject -{ - Q_OBJECT - -public: - WlanQtUtilsTestContext(); - ~WlanQtUtilsTestContext(); - - /** - * Initializes context. - */ - void initialize(); - - /** Context for esock library. */ - WlanQtUtilsCtxEsock esock_; - /** Context for connmon library. */ - WlanQtUtilsCtxConnMon connMon_; - /** Context for ICTS library. */ - WlanQtUtilsCtxIct ict_; -}; - -#endif /* WLANQTUTILSTESTCONTEXT_H */ - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/ut/stubs/wlanqtutilsconnmonstub.cpp --- a/wlanutilities/wlanqtutilities/ut/stubs/wlanqtutilsconnmonstub.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,637 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This is a source file for connmon library stub functions -*/ - -#include -#include -#include -#include -#include "wlanqtutilswlanap.h" - -#ifdef __WINS__ - -// TODO: This function is copied from ConnMonWLANNetworksArrayPckg_v2.cpp because this -// function, although being in rconnmon.h, is not in the interface because IMPORT_C/EXPORT_C -// declarations are not used for this particular constructor. The only change that was made to -// this version was to remove traces and some empty lines. This function is needed when -// creating output in RConnectionMonitor::GetPckgAttribute() for WLAN scan results. -// This is needed for both UT and emulator compilation. -CConnMonWlanNetworksPtrArrayPckg::CConnMonWlanNetworksPtrArrayPckg( - const RPointerArray& aRef, - TUint aBufLen ) - { - RPointerArray items; - TUint len( 0 ); - - for ( TUint i( 0 ); i < aRef.Count(); ++i ) - { - const HBufC* item( aRef[i]->ToBuf() ); - if ( item ) - { - // Is there room in buffer - TUint countFields( 3 ); // aRef.Count(); items->Count(); item->Length() - if ( (countFields + len + item->Length()) > aBufLen ) - { - delete item; - item = NULL; - break; - } - items.Append( item ); - ++( len += item->Length() ); // ++ is for item's size - } - else - { - ; // There was a trace. - } - } - // Check that given buflen (aBufLen) is not smaller than one - // item (TConnMonWLANNetwork) + aRef count + items count - // + item length - if ( items.Count() == 0 && aRef.Count() > 0 ) - { - aBufLen = 2; // aRef.Count(), items.Count() - } - - iBuf = HBufC::New( aBufLen ); // Set size exactly to a buffer length - if ( !iBuf ) - { - items.ResetAndDestroy(); - items.Close(); - return; - } - iBuf->Des().Append( aRef.Count() ); // Total amount of data - iBuf->Des().Append( items.Count() ); // Amount of transferring data - for ( TUint i(0); iDes().Append( items[i]->Length() ); - iBuf->Des().Append( *items[i] ); - } - items.ResetAndDestroy(); - items.Close(); - } - -// ----------------------------------------------------------------------------- -// CConnMonEventBase::CConnMonEventBase -// ----------------------------------------------------------------------------- -// -CConnMonEventBase::CConnMonEventBase( const TInt aEventType, const TUint aConnectionId ) - { - iEventType = aEventType; - iConnectionId = aConnectionId; - } - -// Destructor -CConnMonEventBase::~CConnMonEventBase() - { - } - -// ----------------------------------------------------------------------------- -// CConnMonEventBase::EventType -// ----------------------------------------------------------------------------- -// -TInt CConnMonEventBase::EventType() const - { - return iEventType; - } - -// ----------------------------------------------------------------------------- -// CConnMonConnectionStatusChange::CConnMonConnectionStatusChange -// ----------------------------------------------------------------------------- -// -CConnMonConnectionStatusChange::CConnMonConnectionStatusChange( - const TUint aConnectionId, - const TUint aSubConnectionId, - const TInt aConnectionStatus ) : - CConnMonEventBase(EConnMonConnectionStatusChange, aConnectionId) - { - iSubConnectionId = aSubConnectionId; - iConnectionStatus = aConnectionStatus; - } - -// Destructor -CConnMonConnectionStatusChange::~CConnMonConnectionStatusChange() - { - } - -#ifdef WLANQTUTILS_T_WLANQTUTILS_UT_FLAG - -// ---------------------------------------------- -// Stub functions for connmon library, used in UT -// ---------------------------------------------- - -#include "wlanqtutilstestcontext.h" - -extern WlanQtUtilsTestContext testContext; - -EXPORT_C void RConnectionMonitor::GetConnectionCount( - TUint& aConnectionCount, - TRequestStatus& aStatus) -{ - aConnectionCount = testContext.connMon_.activeConnections_.activeConnList_.count(); - User::RequestComplete(&aStatus, KErrNone); -} - -EXPORT_C TInt RConnectionMonitor::GetConnectionInfo( - const TUint aIndex, - TUint& aConnectionId, - TUint& aSubConnectionCount ) const -{ - aConnectionId = testContext.connMon_.activeConnections_.activeConnList_[aIndex - 1]->connectionId(); - aSubConnectionCount = 0; - return KErrNone; // TODO: put return value into context. -} - -EXPORT_C void RConnectionMonitor::GetIntAttribute( - const TUint aConnectionId, - const TUint /* aSubConnectionId */, - const TUint aAttribute, - TInt& aValue, - TRequestStatus& aStatus ) -{ - WlanQtUtilsCtxActiveConn *activeConn = testContext.connMon_.activeConnections_.findActiveConn(aConnectionId); - if (aAttribute == KBearer) { - aValue = activeConn->connMonBearerType_; - } else if (aAttribute == KConnectionStatus) { - aValue = activeConn->connMonConnectionStatus_; - } else { - Q_ASSERT(false); - } - User::RequestComplete(&aStatus, KErrNone); // TODO: Take return value from the context. -} - -EXPORT_C void RConnectionMonitor::GetUintAttribute( - const TUint aConnectionId, - const TUint /* aSubConnectionId */, - const TUint aAttribute, - TUint& aValue, - TRequestStatus& aStatus ) -{ - WlanQtUtilsCtxActiveConn *activeConn = testContext.connMon_.activeConnections_.findActiveConn(aConnectionId); - if (aAttribute == KIAPId) { - aValue = activeConn->iapId(); - } else { - Q_ASSERT(false); - } - - User::RequestComplete(&aStatus, KErrNone); // TODO: Take return value from the context. -} - -EXPORT_C void RConnectionMonitor::GetPckgAttribute( - const TUint aConnectionId, - const TUint aSubConnectionId, - const TUint aAttribute, - TDes8& aValue, - TRequestStatus& aStatus ) const -{ - // This is copy-paste from real implementation and we'll use that for other requests. - TIpcArgs args(aConnectionId, aSubConnectionId, aAttribute, &aValue); - SendReceive(EReqGetPckgAttribute, args, aStatus); -} - -// --------------------------------------------------------- -// connUtils2ConnMonSecModeMap() -// Local function to map WlanQtUtilsWlanSecMode into Connection -// monitor's security mode. Currently for UT use only. -// --------------------------------------------------------- -// -static TUint connUtils2ConnMonSecModeMap(WlanQtUtilsWlanSecMode connUtilsWlanSecMode) -{ - TUint ret; - switch (connUtilsWlanSecMode) { - case WlanQtUtilsWlanSecModeWep: - ret = EConnMonSecurityWep; - break; - case WlanQtUtilsWlanSecMode802_1x: - ret = EConnMonSecurity802d1x; - break; - case WlanQtUtilsWlanSecModeWpa: - ret = EConnMonSecurityWpa; - break; - case WlanQtUtilsWlanSecModeWpa2: - ret = EConnMonSecurityWpaPsk; - break; - default: - ret = EConnMonSecurityOpen; - break; - } - return ret; -} - - - -EXPORT_C void RConnectionMonitor::GetPckgAttribute( - const TUint /* aConnectionId */, - const TUint /* aSubConnectionId */, - const TUint /* aAttribute */, - TDes16& aValue, - TRequestStatus& aStatus ) const - { - // TODO: verify input parameters, i.e., first three params... - - RConnMonWlanNetworksPtrArray wlanPtrArray; - RBuf vendorData; - - for (int i = 0; i < testContext.connMon_.wlanScanResult_.wlanScanResultList_.count(); i++) { - WlanQtUtilsWlanAp* ap = testContext.connMon_.wlanScanResult_.wlanScanResultList_[i]; - TBufC name(ap->ssid().utf16()); - - TBufC bssid16(QString("addMAC").utf16()); - TBuf8 bssid; - bssid.Copy(bssid16); - - CConnMonWlanNetwork* wlanAp = CConnMonWlanNetwork::NewL( - name, - ap->connectionMode(), - ap->signalStrength(), - connUtils2ConnMonSecModeMap(ap->securityMode()), - bssid, - vendorData ); - wlanPtrArray.Append(wlanAp); - } - - CConnMonWlanNetworksPtrArrayPckg wlanBuf(wlanPtrArray, 2560); - aValue.Copy(wlanBuf.Buf()->Des()); - - User::RequestComplete(&aStatus, KErrNone); // TODO: enable return value modification. - } - -#else // WLANQTUTILS_T_WLANQTUTILS_UT_FLAG - -// ---------------------------------------------------- -// Stub functions for connmon library, used in emulator -// ---------------------------------------------------- - -#if 0 -// In emulator, there are always two active connections. -// The following functions return different properties of these active connection -// so that it's easy to test in emulator. - -EXPORT_C void RConnectionMonitor::GetConnectionCount( - TUint& aConnectionCount, - TRequestStatus& aStatus) -{ - aConnectionCount = 2; - User::RequestComplete(&aStatus, KErrNone); -} - -EXPORT_C TInt RConnectionMonitor::GetConnectionInfo( - const TUint aIndex, - TUint& aConnectionId, - TUint& aSubConnectionCount ) const -{ - if (aIndex == 1) { - aConnectionId = 10; - } else if (aIndex == 2) { - aConnectionId = 20; - } else { - Q_ASSERT(false); - } - - aSubConnectionCount = 0; - return KErrNone; -} - -EXPORT_C void RConnectionMonitor::GetIntAttribute( - const TUint aConnectionId, - const TUint /* aSubConnectionId */, - const TUint aAttribute, - TInt& aValue, - TRequestStatus& aStatus ) -{ - if (aAttribute == KBearer) { - if (aConnectionId == 10) { - aValue = EBearerGPRS; - } else if (aConnectionId == 20) { - aValue = EBearerWLAN; - } else { - Q_ASSERT(false); - } - } else if (aAttribute == KConnectionStatus) { - if (aConnectionId == 10) { - aValue = KConnectionOpen; - } else if (aConnectionId == 20) { - aValue = KStartingConnection; - } else { - Q_ASSERT(false); - } - } else if (aAttribute == KSignalStrength) { - if (aConnectionId == 10) { - Q_ASSERT(false); - } else if (aConnectionId == 20) { - aValue = 78; - } else { - Q_ASSERT(false); - } - } else if (aAttribute == KNetworkMode) { - if (aConnectionId == 10) { - Q_ASSERT(false); - } else if (aConnectionId == 20) { - aValue = EConnMonInfraStructure; - } else { - Q_ASSERT(false); - } - } else if (aAttribute == KSecurityMode) { - if (aConnectionId == 10) { - Q_ASSERT(false); - } else if (aConnectionId == 20) { - aValue = EConnMonSecurityWpaPsk; - } else { - Q_ASSERT(false); - } - } else { - Q_ASSERT(false); - } - User::RequestComplete(&aStatus, KErrNone); -} - -EXPORT_C void RConnectionMonitor::GetUintAttribute( - const TUint aConnectionId, - const TUint /* aSubConnectionId */, - const TUint aAttribute, - TUint& aValue, - TRequestStatus& aStatus ) -{ - if (aAttribute == KIAPId) { - if (aConnectionId == 10) { - aValue = 1; - } else if (aConnectionId == 20) { - aValue = 10; - } else { - Q_ASSERT(false); - } - } else if (aAttribute == KDownlinkData) { - if (aConnectionId == 10) { - aValue = 123; - } else if (aConnectionId == 20) { - aValue = 12345; - } else { - Q_ASSERT(false); - } - } else if (aAttribute == KUplinkData) { - if (aConnectionId == 10) { - aValue = 987654321; - } else if (aConnectionId == 20) { - aValue = 1234567890; - } else { - Q_ASSERT(false); - } - } else if (aAttribute == KTransmitPower) { - if (aConnectionId == 10) { - Q_ASSERT(false); - } else if (aConnectionId == 20) { - aValue = 50; - } else { - Q_ASSERT(false); - } - } else { - Q_ASSERT(false); - } - - User::RequestComplete(&aStatus, KErrNone); -} - -EXPORT_C void RConnectionMonitor::GetBoolAttribute( - const TUint aConnectionId, - const TUint /* aSubConnectionId */, - const TUint aAttribute, - TBool& aValue, - TRequestStatus& aStatus ) -{ - if (aAttribute == KConnectionActive) { - if (aConnectionId == 10) { - aValue = EFalse; - } else if (aConnectionId == 20) { - aValue = ETrue; - } else { - Q_ASSERT(false); - } - } else { - Q_ASSERT(false); - } - - User::RequestComplete(&aStatus, KErrNone); -} - -EXPORT_C void RConnectionMonitor::GetStringAttribute( - const TUint aConnectionId, - const TUint /* aSubConnectionId */, - const TUint aAttribute, - TDes& aValue, - TRequestStatus& aStatus ) const -{ - if (aAttribute == KIAPName) { - if (aConnectionId == 10) { - _LIT(iapNameLit, "PACKET DATA 1"); - TBufC iapName(iapNameLit); - aValue = iapName.Des(); - } else if (aConnectionId == 20) { - _LIT(iapNameLit, "WLAN IAP 3"); - TBufC iapName(iapNameLit); - aValue = iapName.Des(); - } else { - Q_ASSERT(false); - } - } else if (aAttribute == KNetworkName) { - if (aConnectionId == 10) { - Q_ASSERT(false); - } else if (aConnectionId == 20) { - _LIT(ssidLit, "WLAN SSID 3"); - TBufC ssid(ssidLit); - aValue = ssid.Des(); - } else { - Q_ASSERT(false); - } - } else if (aAttribute == KAccessPointName) { - if (aConnectionId == 10) { - _LIT(iapNameLit, "PACKET DATA 1"); - TBufC iapName(iapNameLit); - aValue = iapName.Des(); - } else if (aConnectionId == 20) { - Q_ASSERT(false); - } else { - Q_ASSERT(false); - } - } else { - Q_ASSERT(false); - } - - User::RequestComplete(&aStatus, KErrNone); -} - -EXPORT_C void RConnectionMonitor::GetPckgAttribute( - const TUint aConnectionId, - const TUint aSubConnectionId, - const TUint aAttribute, - TDes8& aValue, - TRequestStatus& aStatus ) const -{ - if (aAttribute == KStartTime) { - if (aConnectionId == 10) { - TDateTime dateTime(2009, EMarch, 31-1, 15, 15, 15, 0); - TTime time(dateTime); - TConnMonTimeBuf timePckg(time); - aValue.Copy(timePckg); - } else if (aConnectionId == 20) { - TTime time; - time.UniversalTime(); - TConnMonTimeBuf timePckg(time); - aValue.Copy(timePckg); - } else { - Q_ASSERT(false); - } - User::RequestComplete(&aStatus, KErrNone); - } else if (aAttribute == KClientInfo) { - TConnMonClientEnum applications; - if (aConnectionId == 10) { - applications.iCount = 1; - applications.iUid[0].iUid = 0x10008D39; // Web - applications.iUid[1].iUid = 0; - applications.iUid[2].iUid = 0; - applications.iUid[3].iUid = 0; - applications.iUid[4].iUid = 0; - applications.iUid[5].iUid = 0; - applications.iUid[6].iUid = 0; - applications.iUid[7].iUid = 0; - applications.iUid[8].iUid = 0; - applications.iUid[9].iUid = 0; - } else if (aConnectionId == 20) { - applications.iCount = 7; - applications.iUid[0].iUid = 0x101fd9c5; // KBannedServerUID - applications.iUid[1].iUid = 0x1020728E; // KFeedsServerUid - applications.iUid[2].iUid = 0x10008D60; // KDownloadMgrServerUid - applications.iUid[3].iUid = 0x1000484b; // KMessagingServerUid - applications.iUid[4].iUid = 0x102033E6; // KJavaVMUid - applications.iUid[5].iUid = 0x102073CA; // KSUPLServerUid - applications.iUid[6].iUid = 0x200212F3; // Connect Screen - applications.iUid[7].iUid = 0; - applications.iUid[8].iUid = 0; - applications.iUid[9].iUid = 0; - } else { - Q_ASSERT(false); - } - TPckgBuf< TConnMonClientEnum > applicationsPckg( applications ); - aValue.Copy(applicationsPckg); - User::RequestComplete(&aStatus, KErrNone); - } else { - // This is copy-paste from real implementation and we'll use that for other requests. - TIpcArgs args( aConnectionId, aSubConnectionId, aAttribute, &aValue ); - SendReceive( EReqGetPckgAttribute, args, aStatus ); - } -} -#endif - -// This function returns WLAN scan results. -// Six results in every second scan and the others have two. -EXPORT_C void RConnectionMonitor::GetPckgAttribute( - const TUint /* aConnectionId */, - const TUint /* aSubConnectionId */, - const TUint aAttribute, - TDes16& aValue, - TRequestStatus& aStatus ) const { - - if (aAttribute == KWlanNetworks) { - RConnMonWlanNetworksPtrArray wlanPtrArray; - RBuf vendorData; - - TBufC bssid16(QString("addMAC").utf16()); - TBuf8 bssid; - bssid.Copy(bssid16); - - _LIT(wlanAp1Name, "Test AP 1"); - TBufC name1(wlanAp1Name); - CConnMonWlanNetwork* wlanAp1 = CConnMonWlanNetwork::NewL( - name1, - EConnMonInfraStructure, - 20, - EConnMonSecurityOpen, - bssid, - vendorData ); - wlanPtrArray.Append(wlanAp1); - - _LIT(wlanAp2Name, "Test AP 2"); - TBufC name2(wlanAp2Name); - CConnMonWlanNetwork* wlanAp2 = CConnMonWlanNetwork::NewL( - name2, - EConnMonAdHoc, - 20, - EConnMonSecurityOpen, - bssid, - vendorData ); - wlanPtrArray.Append(wlanAp2); - - static bool refresh = true; - - if (refresh) { - _LIT(wlanAp3Name, "Test AP 3"); - TBufC name3(wlanAp3Name); - CConnMonWlanNetwork* wlanAp3 = CConnMonWlanNetwork::NewL( - name3, - EConnMonInfraStructure, - 20, - EConnMonSecurityWep, - bssid, - vendorData ); - wlanPtrArray.Append(wlanAp3); - - _LIT(wlanAp4Name, "Test AP 4"); - TBufC name4(wlanAp4Name); - CConnMonWlanNetwork* wlanAp4 = CConnMonWlanNetwork::NewL( - name4, - EConnMonInfraStructure, - 20, - EConnMonSecurityOpen, - bssid, - vendorData ); - wlanPtrArray.Append(wlanAp4); - - _LIT(wlanAp5Name, "Test AP 5"); - TBufC name5(wlanAp5Name); - CConnMonWlanNetwork* wlanAp5 = CConnMonWlanNetwork::NewL( - name5, - EConnMonInfraStructure, - 20, - EConnMonSecurityWpa, - bssid, - vendorData ); - wlanPtrArray.Append(wlanAp5); - - _LIT(wlanAp6Name, "Test AP 6"); - TBufC name6(wlanAp6Name); - CConnMonWlanNetwork* wlanAp6 = CConnMonWlanNetwork::NewL( - name6, - EConnMonInfraStructure, - 20, - EConnMonSecurityWpaPsk, - bssid, - vendorData ); - wlanPtrArray.Append(wlanAp6); - - refresh = false; - } else { - refresh = true; - } - - CConnMonWlanNetworksPtrArrayPckg wlanBuf(wlanPtrArray, 2560); // TODO: buffer size to more dynamic or use constant - aValue.Copy(wlanBuf.Buf()->Des()); - } else { - Q_ASSERT(false); - } - - User::RequestComplete(&aStatus, KErrNone); -} - -#endif // WLANQTUTILS_T_WLANQTUTILS_UT_FLAG -#endif // __WINS__ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/ut/stubs/wlanqtutilsconnteststub.cpp --- a/wlanutilities/wlanqtutilities/ut/stubs/wlanqtutilsconnteststub.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This is a source file for connmon library stub functions -*/ - -#include - -#ifdef __WINS__ - -#ifdef WLANQTUTILS_T_WLANQTUTILS_UT_FLAG - -// ---------------------------------------------- -// Stub functions for ICT library, used in UT -// ---------------------------------------------- - -#include "wlanqtutilstestcontext.h" - -extern WlanQtUtilsTestContext testContext; - -// ---------------------------------------------------- -// NewL is not stubbed -> parameters are not checked at all -// ---------------------------------------------------- - -/** - * Empty implementation to prevent actual ICT from starting. Result callback is called directly - * in the test cases. - */ -EXPORT_C void CIctsClientInterface::StartL() - { - } - -#endif // WLANQTUTILS_T_WLANQTUTILS_UT_FLAG - -// ---------------------------------------------------- -// No stubs used in emulator -// ---------------------------------------------------- -#endif // __WINS__ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/ut/stubs/wlanqtutilsesockstub.cpp --- a/wlanutilities/wlanqtutilities/ut/stubs/wlanqtutilsesockstub.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This is a source file for esock library stub functions -*/ - -#include - -#ifdef __WINS__ - -#ifdef WLANQTUTILS_T_WLANQTUTILS_UT_FLAG - -// ---------------------------------------------- -// Stub functions for esock library, used in UT -// ---------------------------------------------- - -#include "wlanqtutilstestcontext.h" - -extern WlanQtUtilsTestContext testContext; - -/** - * Returns value from test context. - * - * TConnPref value cannot be verified easily because the real value passed to the function is - * TCommDbConnPref. Dynamic cast from TConnPref to TCommDbConnPref does not work because - * TConnPref does not have virtual functions which means that type information for the - * class hierarchy is not created by the compiler. - */ -void RConnection::Start(class TConnPref &, class TRequestStatus &aStatus) -{ - User::RequestComplete(&aStatus, testContext.esock_.startRetValue_); -} - -#else // WLANQTUTILS_T_WLANQTUTILS_UT_FLAG - -// ---------------------------------------------------- -// Stub functions for esock library, used in emulator -// ---------------------------------------------------- - -/** - * Return always success in emulator. - */ -void RConnection::Start(class TConnPref &, class TRequestStatus &aStatus) -{ - User::RequestComplete(&aStatus, KErrNone); -} - -#endif // WLANQTUTILS_T_WLANQTUTILS_UT_FLAG -#endif // __WINS__ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/ut/t_wlanqtutils/t_wlanqtutils.pro --- a/wlanutilities/wlanqtutilities/ut/t_wlanqtutils/t_wlanqtutils.pro Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -QT += testlib - -TEMPLATE = app -TARGET = t_wlanqtutils - -TARGET.CAPABILITY = ALL -TCB - -DEPENDPATH += . - -#Store generated .moc files to their own directory -MOC_DIR = moc - -#BUILD_DLL macro is used to define export macro -DEFINES += BUILD_WLANQTUTILITIES_DLL - -#Following macros MW_LAYER_SYSTEMINCLUDE and OS_LAYER_SYSTEMINCLUDE are defined -#in X:\QT\mkspecs\features\symbian\platform_paths.prf that is always inluded in -#QT compilation - -INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \ - $$OS_LAYER_SYSTEMINCLUDE \ - . \ - ../../base/inc \ - ../../wrapper/inc \ - ../../traces \ - /epoc32/include/domain/osextensions - -# Input -HEADERS += testwlanqtutils.h \ - ../context/wlanqtutilstestcontext.h \ - ../../base/inc/wlanqtutils.h \ - ../../base/inc/wlanqtutils_p.h \ - ../../base/inc/wlanqtutilsiap.h \ - ../../base/inc/wlanqtutilswlaniap.h \ - ../../base/inc/wlanqtutilswlanap.h \ - ../../base/inc/wlanqtutilsactiveconn.h \ - ../../wrapper/inc/wlanqtutilscmmwrapper.h \ - ../../wrapper/inc/wlanqtutilsconmonwrapper.h \ - ../../wrapper/inc/wlanqtutilsconntestwrapper.h \ - ../../wrapper/inc/wlanqtutilsesockwrapper.h \ - ../../traces/OstTraceDefinitions.h - -SOURCES += testwlanqtutils.cpp \ - ../context/wlanqtutilstestcontext.cpp \ - ../../base/src/wlanqtutils.cpp \ - ../../base/src/wlanqtutils_p.cpp \ - ../../base/src/wlanqtutilsiap.cpp \ - ../../base/src/wlanqtutilswlaniap.cpp \ - ../../base/src/wlanqtutilswlanap.cpp \ - ../../base/src/wlanqtutilsactiveconn.cpp \ - ../../wrapper/src/wlanqtutilscmmwrapper.cpp \ - ../../wrapper/src/wlanqtutilsconmonwrapper.cpp \ - ../../wrapper/src/wlanqtutilsconntestwrapper.cpp \ - ../../wrapper/src/wlanqtutilsesockwrapper.cpp - -symbian: { - HEADERS += ../../wrapper/inc/wlanqtutilscmmwrapper_s60_p.h \ - ../../wrapper/inc/wlanqtutilsconmonwrapper_s60_p.h \ - ../../wrapper/inc/wlanqtutilsconntestwrapper_s60_p.h \ - ../../wrapper/inc/wlanqtutilsesockwrapper_s60_p.h - - SOURCES += ../../wrapper/src/wlanqtutilscmmwrapper_s60.cpp \ - ../../wrapper/src/wlanqtutilsconmonwrapper_s60.cpp \ - ../../wrapper/src/wlanqtutilsconntestwrapper_s60.cpp \ - ../../wrapper/src/wlanqtutilsesockwrapper_s60.cpp \ - ../stubs/wlanqtutilsconnmonstub.cpp \ - ../stubs/wlanqtutilsconnteststub.cpp \ - ../stubs/wlanqtutilsesockstub.cpp -} - -LIBS += -lcmmanager -lconnmon -lcommdb -lesock -lictsclientinterface - -#UT flag is set -DEFINES += WLANQTUTILS_T_WLANQTUTILS_UT_FLAG - -coverage_test: { -message(*** Coverage test mode build - no OST traces.) -#NO_OST_TRACES flag is set -DEFINES += WLANQTUTILS_NO_OST_TRACES_FLAG 'Q_ASSERT(test)=' -} -else { -message(*** Normal Symbian-mode build.) -} \ No newline at end of file diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/ut/t_wlanqtutils/testwlanqtutils.cpp --- a/wlanutilities/wlanqtutilities/ut/t_wlanqtutils/testwlanqtutils.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,683 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This is the source file for testing Wlan Qt Utilities library. -*/ - -#include -#include -#include -#include -#include -#include "wlanqtutilscommon.h" -#include "wlanqtutilswlanap.h" -#include "wlanqtutilsiap.h" -#include "wlanqtutilswlaniap.h" -#include "wlanqtutils.h" -#include "wlanqtutils_p.h" -#include "wlanqtutilsconmonwrapper.h" -#include "wlanqtutilsconmonwrapper_s60_p.h" -#include "wlanqtutilsconntestwrapper.h" -#include "wlanqtutilsconntestwrapper_s60_p.h" -#include "testwlanqtutils.h" -#include "wlanqtutilstestcontext.h" - -WlanQtUtilsTestContext testContext; - -const QString TestWlanQtUtils::commsDatDefault_ = "default.cre"; - -// --------------------------------------------------------- -// FRAMEWORK FUNCTIONS -// --------------------------------------------------------- - -/** - * This function will be called before the first test function is executed. - */ -void TestWlanQtUtils::initTestCase() -{ - wlanQtUtils_ = NULL; - signalScanReady_ = NULL; - signalWlanNetworkOpened_ = NULL; - signalWlanNetworkClosed_ = NULL; - - //If Active scheduler exists then don't install a new one as it will cause panic - if (CActiveScheduler::Current() == NULL) { - CActiveScheduler *scheduler = new CActiveScheduler(); - CActiveScheduler::Install(scheduler); - } -} - -/** - * This function will be called after the last test function was executed. - */ -void TestWlanQtUtils::cleanupTestCase() -{ - // CommsDat file is initialized. - subTestLoadCommsDatFile(commsDatDefault_); - - // TODO: Can we get rid of this delay? - QWARN(": \n *********** \n * PASSED! * \n *********** \n\n\n"); - QWARN(": \n *** Window will be closed in 5s... \n\n\n"); - QTest::qSleep(5000); -} - -/** - * This function will be called before each test function is executed. - */ -void TestWlanQtUtils::init() -{ - // CommsDat file is initialized. - subTestLoadCommsDatFile(commsDatDefault_); - - testContext.initialize(); - - QVERIFY(wlanQtUtils_ == NULL); - QVERIFY(signalScanReady_ == NULL); - QVERIFY(signalWlanNetworkOpened_ == NULL); - QVERIFY(signalWlanNetworkClosed_ == NULL); - subTestNewWlanQtUtils(); -} - -/** - * This function will be called after each test function is executed. - */ -void TestWlanQtUtils::cleanup() -{ - delete wlanQtUtils_; - wlanQtUtils_ = NULL; - - QCOMPARE(signalScanReady_->count(), 0); - delete signalScanReady_; - signalScanReady_ = NULL; - - QCOMPARE(signalWlanNetworkOpened_->count(), 0); - delete signalWlanNetworkOpened_; - signalWlanNetworkOpened_ = NULL; - - QCOMPARE(signalWlanNetworkClosed_->count(), 0); - delete signalWlanNetworkClosed_; - signalWlanNetworkClosed_ = NULL; -} - -// --------------------------------------------------------- -// TEST CASES -// --------------------------------------------------------- - -/** - * Test available WLAN APs when scan is triggered by client. - * Two scan results have the same SSID and the latter one of those will be removed. - * Two scan results have the same SSID but different security mode - * and both are included in the results. - */ -void TestWlanQtUtils::testAvailableWlanAps() -{ - testContext.connMon_.wlanScanResult_.createDefaultWlanScanResultList(10); - testContext.connMon_.wlanScanResult_.wlanScanResultList_[0]->setSsid("Same SSID"); - testContext.connMon_.wlanScanResult_.wlanScanResultList_[2]->setSsid("Same SSID"); - testContext.connMon_.wlanScanResult_.wlanScanResultList_[5]->setSsid("Same SSID, different SecMode"); - testContext.connMon_.wlanScanResult_.wlanScanResultList_[5]->setSecurityMode(WlanQtUtilsWlanSecModeWpa); - testContext.connMon_.wlanScanResult_.wlanScanResultList_[8]->setSsid("Same SSID, different SecMode"); - testContext.connMon_.wlanScanResult_.wlanScanResultList_[8]->setSecurityMode(WlanQtUtilsWlanSecModeOpen); - - // Request a scan to get result signal - wlanQtUtils_->scanWlans(); - - // Let active object run and verify signal. - subTestSignalWaitAndTake(signalScanReady_, NULL); - - // Get and verify the list of available WLAN APs. - QList iaps; - QList aps; - wlanQtUtils_->availableWlanAps(iaps, aps); - - // First remove AP that has duplicate SSID. - // Then order APs alphabetically. - testContext.connMon_.wlanScanResult_.wlanScanResultList_.removeAt(2); - testContext.connMon_.wlanScanResult_.wlanScanResultList_.move(4, 1); - testContext.connMon_.wlanScanResult_.wlanScanResultList_.move(7, 1); - testContext.connMon_.wlanScanResult_.wlanScanResultList_.move(8, 3); - testContext.connMon_.wlanScanResult_.verifyWlanScanResultList(aps); - QCOMPARE(iaps.count(), 0); - aps.clear(); // TODO: Free AP pointers too. -} - -/** - * Test available WLAN APs when there are also WLAN IAPs available. - */ -void TestWlanQtUtils::testAvailableWlanApsWithIaps() -{ - testContext.connMon_.wlanScanResult_.createDefaultWlanScanResultList(7); - testContext.connMon_.wlanScanResult_.wlanScanResultList_[1]->setSsid("WLAN IAP 3"); - testContext.connMon_.wlanScanResult_.wlanScanResultList_[1]->setSecurityMode(WlanQtUtilsWlanSecModeWpa); - testContext.connMon_.wlanScanResult_.wlanScanResultList_[3]->setSsid(""); - testContext.connMon_.wlanScanResult_.wlanScanResultList_[5]->setSsid("WLAN IAP 1"); - // Todo: security mode not compared yet due to an issue with CMM vs ConnMon WLAN security - // modes under investigation - // SSID is found in Internet Snap, but security mode does not match: - // testContext.connMon_.wlanScanResult_.wlanScanResultList_[6]->setSsid("WLAN IAP 2"); - // testContext.connMon_.wlanScanResult_.wlanScanResultList_[6]->setSecurityMode(WlanQtUtilsWlanSecModeWpa); - - // Request a scan to get result signal - wlanQtUtils_->scanWlans(); - - // Let active object run and verify signal. - subTestSignalWaitAndTake(signalScanReady_, NULL); - - // Get and verify the list of available WLAN APs. - QList iaps; - QList aps; - wlanQtUtils_->availableWlanAps(iaps, aps); - - // Verify WLAN AP list. First, remove scan results that will not appear - // because they are hidden WLANs or WLAN IAPs. - testContext.connMon_.wlanScanResult_.wlanScanResultList_.removeAt(5); - testContext.connMon_.wlanScanResult_.wlanScanResultList_.removeAt(3); - testContext.connMon_.wlanScanResult_.wlanScanResultList_.removeAt(1); - testContext.connMon_.wlanScanResult_.verifyWlanScanResultList(aps); - - // Verify WLAN IAP list - QCOMPARE(iaps.count(), 2); - QCOMPARE(iaps[0]->id(), 5); - QCOMPARE(iaps[0]->name(), QString("WLAN IAP 1")); - QCOMPARE(iaps[0]->bearerType(), WlanQtUtilsBearerTypeWlan); - QCOMPARE(iaps[0]->ssid(), QString("WLAN IAP 1")); - QCOMPARE(iaps[1]->id(), 7); - QCOMPARE(iaps[1]->name(), QString("WLAN IAP 3")); - QCOMPARE(iaps[1]->bearerType(), WlanQtUtilsBearerTypeWlan); - QCOMPARE(iaps[1]->ssid(), QString("WLAN IAP 3")); - iaps.clear(); // TODO: Free IAP pointers too. - aps.clear(); // TODO: Free AP pointers too. -} - -/** - * Test refereshing of WLAN APs when client requests sequential scans. - */ -void TestWlanQtUtils::testAvailableWlanApsSequence() -{ - // **************** Before 1st scan ******************** - QList iaps; - QList aps; - wlanQtUtils_->availableWlanAps(iaps, aps); - // Verify we have no results - QCOMPARE(aps.count(), 0); - QCOMPARE(iaps.count(), 0); - - // **************** 1st scan ******************** - // 6 APs are required for this scan - testContext.connMon_.wlanScanResult_.createDefaultWlanScanResultList(6); - - wlanQtUtils_->scanWlans(); - subTestSignalWaitAndTake(signalScanReady_, NULL); - - // Get the results for the 1st scan - wlanQtUtils_->availableWlanAps(iaps, aps); - // Verify the results for the scan - testContext.connMon_.wlanScanResult_.verifyWlanScanResultList(aps); - QCOMPARE(iaps.count(), 0); - aps.clear(); // TODO: free memory of pointers too. - - // **************** 2nd scan ******************** - // 2 APs are required for this scan - testContext.connMon_.wlanScanResult_.createDefaultWlanScanResultList(2); - - wlanQtUtils_->scanWlans(); - subTestSignalWaitAndTake(signalScanReady_, NULL); - - // Get the results for the 2nd scan - wlanQtUtils_->availableWlanAps(iaps, aps); - // Verify the results for the scan - testContext.connMon_.wlanScanResult_.verifyWlanScanResultList(aps); - QCOMPARE(iaps.count(), 0); - aps.clear(); // TODO: Free memory - - // **************** 3rd scan ******************** - // 4 APs are required for the 3rd scan - testContext.connMon_.wlanScanResult_.createDefaultWlanScanResultList(4); - - wlanQtUtils_->scanWlans(); - subTestSignalWaitAndTake(signalScanReady_, NULL); - - // Get the results for the 3rd scan - wlanQtUtils_->availableWlanAps(iaps, aps); - // Verify the results for the scan - testContext.connMon_.wlanScanResult_.verifyWlanScanResultList(aps); - QCOMPARE(iaps.count(), 0); - aps.clear(); // TODO: Free memory -} - -/** - * This function tests creation of WLAN IAP in a succesful manner. - * - WLAN scan is made because otherwise we cannot verify that IAP creation is successful. - * - Check that there are no available WLAN IAPs. - * - Fetch SNAP list. - * - Create WLAN IAP. - * - Check that WLAN IAP has been created and that this IAP is not in WLAN AP scan results. - */ -void TestWlanQtUtils::testCreateWlanIapOk() -{ - testContext.connMon_.wlanScanResult_.createDefaultWlanScanResultList(1); - testContext.connMon_.wlanScanResult_.wlanScanResultList_[0]->setSsid("New WLAN IAP"); - testContext.connMon_.wlanScanResult_.wlanScanResultList_[0]->setSecurityMode(WlanQtUtilsWlanSecModeWpa2); - - // Create a new instance in order to test functionality triggered in constructor. - WlanQtUtils *utils = new WlanQtUtils(); - QSignalSpy spy(utils, SIGNAL(wlanScanReady())); - QVERIFY(spy.isValid() == true); - subTestSignalWaitAndTake(&spy, NULL); - - // Ensure there are no WLAN IAPs but there is one scan result. - QList iaps; - QList aps; - utils->availableWlanAps(iaps, aps); - - QCOMPARE(iaps.count(), 0); - testContext.connMon_.wlanScanResult_.verifyWlanScanResultList(aps); - - // Execute createWlanIap() function - WlanQtUtilsWlanAp wlanAp("New WLAN IAP", "abcdef", 90, EConnMonInfraStructure, WlanQtUtilsWlanSecModeWpa2); - int iapId = utils->createWlanIap(&wlanAp); - - // Verify that created IAP is in the IAP list and AP list is empty. - utils->availableWlanAps(iaps, aps); - QCOMPARE(iaps.count(), 1); - QCOMPARE(iaps[0]->id(), iapId); - QCOMPARE(iaps[0]->name(), QString("New WLAN IAP")); - QCOMPARE(iaps[0]->bearerType(), WlanQtUtilsBearerTypeWlan); - QCOMPARE(iaps[0]->ssid(), QString("New WLAN IAP")); - // Todo: should be Wpa2, CMM vs ConnMon WLAN security modes under investigation - QCOMPARE(iaps[0]->securityMode(), WlanQtUtilsWlanSecModeWpa); - QCOMPARE(aps.count(), 0); - iaps.clear(); // TODO: memory leak. - delete utils; -} - -/** - * This function tests connecting to IAP in a succesful manner. - */ -void TestWlanQtUtils::testConnectIapOk() -{ - testContext.esock_.startRetValue_ = KErrNone; - - // Esock stub completes connection creation immediately - wlanQtUtils_->connectIap(5); - - // Connection creation in ConnMon interface - testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, 5); - wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonEventBase( - EConnMonCreateConnection, - testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); - - // Connection status change in ConnMon interface - wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonConnectionStatusChange( - testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), - 0, - KConnectionOpen)); - - // Receive signal for connection opening (caused by connectIap, which completed immediately) - QList arguments; - subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); - QCOMPARE(arguments.at(0).toInt(), 5); - - // Connection status change to opened in ConnMon interface. Sub test cases between test - // cases check that no extra signals are sent - wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonConnectionStatusChange( - testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), - 0, - KLinkLayerOpen)); -} - -/** - * This function tests connecting to IAP in unsuccesful manner. - */ -void TestWlanQtUtils::testConnectIapErr() -{ - testContext.esock_.startRetValue_ = KErrGeneral; - - wlanQtUtils_->connectIap(7); - - testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, 7); - wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonEventBase( - EConnMonCreateConnection, - testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); - wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonConnectionStatusChange( - testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), - 0, - KConnectionOpen)); - - wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonEventBase( - EConnMonDeleteConnection, - testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); - - QList arguments; - subTestSignalWaitAndTake(signalWlanNetworkClosed_, &arguments); - QCOMPARE(arguments.at(0).toInt(), 7); -} - -// TODO: testDisconnectFail cases are needed when fail branches are -// implemented into the connmon wrapper -/** - * This function tests IAP disconnecting functionality. - */ -void TestWlanQtUtils::testDisconnectIapOk() -{ - // Create and connect an IAP we can then disconnect - WlanQtUtilsWlanAp wlanAp("Disconnect IAP", "abcdef", 90, EConnMonInfraStructure, WlanQtUtilsWlanSecModeWpa2); - int iapId = wlanQtUtils_->createWlanIap(&wlanAp); - testContext.esock_.startRetValue_ = KErrNone; - wlanQtUtils_->connectIap(iapId); - QList arguments; - subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); - QCOMPARE(arguments.at(0).toInt(), iapId); - - // The disconnect function does not have any return values or - // signals related to the disconnection, thus plain - // function call is done for the test. - wlanQtUtils_->disconnectIap(iapId); -} - -/** - * This function tests IAP getter with existing IAP ID. - */ -void TestWlanQtUtils::testIapFound() -{ - // Create the IAP we want to find with the getter - WlanQtUtilsWlanAp wlanAp("testIapFound", "abcdef", 90, EConnMonInfraStructure, WlanQtUtilsWlanSecModeWpa2); - int iapId = wlanQtUtils_->createWlanIap(&wlanAp); - - // Execute the function under test and check that we got the correct IAP - WlanQtUtilsIap *iap = wlanQtUtils_->iap(iapId); - QVERIFY(iap != NULL); - QCOMPARE(iap->id(), iapId); - QCOMPARE(iap->name(), QString("testIapFound")); - QCOMPARE(iap->bearerType(), WlanQtUtilsBearerTypeWlan); -} - -/** - * This function tests IAP getter with non-existing IAP ID. - */ -void TestWlanQtUtils::testIapNotFound() -{ - // Execute the function under test and check that we get no IAP as result - WlanQtUtilsIap *iap = wlanQtUtils_->iap(1000); - QVERIFY(iap == NULL); -} - -/** - * This function tests connected WLAN IAP getter with existing connection. - */ -void TestWlanQtUtils::testConnectedWlanIdFound() -{ - // Create the IAP we want to find with the getter - WlanQtUtilsWlanAp wlanAp("testConnectedWlanIdFound", "abcdef", 90, EConnMonInfraStructure, WlanQtUtilsWlanSecModeWpa2); - int iapId = wlanQtUtils_->createWlanIap(&wlanAp); - - testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, iapId); - - // Send event for connection creation. - wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonEventBase( - EConnMonCreateConnection, - testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); - - // Send events for connection status change -> opened. - wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonConnectionStatusChange( - testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), - 0, - KStartingConnection)); - wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonConnectionStatusChange( - testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), - 0, - KLinkLayerOpen)); - - QList arguments; - subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); - QCOMPARE(arguments.at(0).toInt(), iapId); - - // Execute the function under test and check that we get valid ID as result - int id = wlanQtUtils_->connectedWlanId(); - QCOMPARE(id, iapId); -} - -/** - * This function tests connected WLAN IAP getter with connection existing already during dll construction. - */ -void TestWlanQtUtils::testConnectedWlanIdFoundConstructor() -{ - // IAP ID 5 exists in default commsdat file - testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, 5); - - // Create a new instance in order to test functionality triggered in constructor. - WlanQtUtils *utils = new WlanQtUtils(); - - // Execute the function under test and check that we get valid ID as result - int id = utils->connectedWlanId(); - QCOMPARE(id, 5); - - delete utils; -} - -/** - * This function tests connected WLAN IAP getter without existing connection. - */ -void TestWlanQtUtils::testConnectedWlanIdNotFound() -{ - // Execute the function under test and check that we get invalid ID as result - int id = wlanQtUtils_->connectedWlanId(); - QCOMPARE(id, WlanQtUtilsInvalidIapId); -} - -/** - * Test WLAN scan triggering interface. - */ -void TestWlanQtUtils::testScanWlans() -{ - // Execute function under test - wlanQtUtils_->scanWlans(); - - // No need to verify scan results here, testAvailableWlanAps* test cases - // are for that. Just make sure the result signal is received. - subTestSignalWaitAndTake(signalScanReady_, NULL); -} - -/** - * This function tests Wlan network opening signal when network is not opened by the dll. - */ -void TestWlanQtUtils::testWlanNetworkOpened() -{ - testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, 5); - - // Send event for connection creation. - wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonEventBase( - EConnMonCreateConnection, - testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); - - // Send events for connection status change -> opened. - wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonConnectionStatusChange( - testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), - 0, - KConnectionOpen)); - wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonConnectionStatusChange( - testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), - 0, - KLinkLayerOpen)); - - QList arguments; - subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); - QCOMPARE(arguments.at(0).toInt(), 5); -} - -/** - * This function tests Wlan network closing signal when network is not closed by the dll. - */ -void TestWlanQtUtils::testWlanNetworkClosed() -{ - // First create a connection - testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, 5); - - // Send event for connection creation. - wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonEventBase( - EConnMonCreateConnection, - testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); - - // Send events for connection status change -> opened. - wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonConnectionStatusChange( - testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), - 0, - KConnectionOpen)); - wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonConnectionStatusChange( - testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), - 0, - KLinkLayerOpen)); - - QList arguments; - subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); - QCOMPARE(arguments.at(0).toInt(), 5); - - // Send event for connection status change -> closed. - wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonConnectionStatusChange( - testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), - 0, - KLinkLayerClosed)); - - // Send event for connection deletion. - wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonEventBase( - EConnMonDeleteConnection, - testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); - - subTestSignalWaitAndTake(signalWlanNetworkClosed_, &arguments); - QCOMPARE(arguments.at(0).toInt(), 5); -} - -/** - * This function tests ICT when connection test passes. - */ -void TestWlanQtUtils::testConnectionTestPass() -{ - // Create and connect an IAP we can then test - WlanQtUtilsWlanAp wlanAp("Connection test IAP", "abcdef", 90, EConnMonInfraStructure, WlanQtUtilsWlanSecModeWpa2); - int iapId = wlanQtUtils_->createWlanIap(&wlanAp); - testContext.esock_.startRetValue_ = KErrNone; - wlanQtUtils_->connectIap(iapId); - QList arguments; - subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); - QCOMPARE(arguments.at(0).toInt(), iapId); - - // Connection test automatically started at this point. Call result function explicitly - // No interface exists that we could check that the IAP is moved to Internet SNAP correctly - TBuf<5> string; - wlanQtUtils_->d_ptr->connTestWrapper_->d_ptr_->ConnectivityObserver(EConnectionOk, string); -} - -/** - * This function tests ICT when connection test fails. - */ -void TestWlanQtUtils::testConnectionTestFail() -{ - // Create and connect an IAP we can then test - WlanQtUtilsWlanAp wlanAp("Connection test IAP", "abcdef", 90, EConnMonInfraStructure, WlanQtUtilsWlanSecModeWpa2); - int iapId = wlanQtUtils_->createWlanIap(&wlanAp); - testContext.esock_.startRetValue_ = KErrNone; - wlanQtUtils_->connectIap(iapId); - QList arguments; - subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); - QCOMPARE(arguments.at(0).toInt(), iapId); - - // Connection test automatically started at this point. Call result function explicitly - // No interface exists that we could check that IAP is not moved to another SNAP - // Todo: Repeat for all possible error codes to gain coverage - TBuf<5> string; - wlanQtUtils_->d_ptr->connTestWrapper_->d_ptr_->ConnectivityObserver(EHttpAuthenticationNeeded, string); -} - -// --------------------------------------------------------- -// SUB TEST CASES -// --------------------------------------------------------- - -/** - * This function waits for active objects to get time to run, takes the arguments of the - * first signal and returns them from the given signal spy. - * This function also verifies that the number of signals is 1. - * - * @param[in] spy Signal spy. - * @param[out] arguments Arguments of the first signal in the given signal spy. NULL if arguments not needed. - */ -void TestWlanQtUtils::subTestSignalWaitAndTake(QSignalSpy* spy, QList* arguments) -{ - QTest::qWait(1); - QCOMPARE(spy->count(), 1); - QList arguments_tmp = spy->takeFirst(); - if (arguments != NULL) { - *arguments = arguments_tmp; - } -} - -/** - * This function loads given CommsDat file, replacing current one. - * If CommsDat file doesn't exist, it can be re-created by commanding WST script. - * Using help switch is a quick way: - * run_wst HELP - * - * @param newCommsdatFilename Filename of the new CommsDat to be loaded. - */ -void TestWlanQtUtils::subTestLoadCommsDatFile(QString newCommsdatFilename) -{ - // EPOC's CommsDat filename - const QString epocCommsdatFilename("cccccc00.cre"); - // EPOC's directory for CommsDat file - const QString commsdatDir("c:\\private\\10202be9\\persists\\"); - // Created backup directory under EPOC for CommsDat files - const QString storeDir("c:\\private\\10202be9\\persists\\backup\\"); - QString nameOld = commsdatDir + epocCommsdatFilename; - QString nameDefault = storeDir + newCommsdatFilename; - - // First remove the old CommsDat file. - Q_ASSERT(QFile::remove(nameOld) == TRUE); - - // Copy the stored default CommsDat file. - Q_ASSERT(QFile::copy(nameDefault, nameOld) == TRUE); -} - -/** - * - */ -void TestWlanQtUtils::subTestNewWlanQtUtils() -{ - if (wlanQtUtils_ != NULL) { - delete wlanQtUtils_; - } - wlanQtUtils_ = new WlanQtUtils(); - - if (signalScanReady_ != NULL) { - delete signalScanReady_; - } - signalScanReady_ = new QSignalSpy(wlanQtUtils_, SIGNAL(wlanScanReady())); - QVERIFY(signalScanReady_->isValid() == true); - - if (signalWlanNetworkOpened_ != NULL) { - delete signalWlanNetworkOpened_; - } - signalWlanNetworkOpened_ = new QSignalSpy(wlanQtUtils_, SIGNAL(wlanNetworkOpened(int))); - QVERIFY(signalWlanNetworkOpened_->isValid() == true); - - if (signalWlanNetworkClosed_ != NULL) { - delete signalWlanNetworkClosed_; - } - signalWlanNetworkClosed_ = new QSignalSpy(wlanQtUtils_, SIGNAL(wlanNetworkClosed(int))); - QVERIFY(signalWlanNetworkClosed_->isValid() == true); - - // Let first active objects to run. First WLAN scan is done in engine contructor. - subTestSignalWaitAndTake(signalScanReady_, NULL); -} - -// Create main function using QTest marco. -QTEST_MAIN(TestWlanQtUtils) diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/ut/t_wlanqtutils/testwlanqtutils.h --- a/wlanutilities/wlanqtutilities/ut/t_wlanqtutils/testwlanqtutils.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This is the header file for testing Wlan Qt Utilities library. -*/ - -#ifndef TESTWLANQTUTILS_H_ -#define TESTWLANQTUTILS_H_ - -#include - -class QSignalSpy; -class WlanQtUtils; - -class TestWlanQtUtils: public QObject -{ - Q_OBJECT - -private slots: - - // Functions from QTest framework. - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - - // Test functions for public interface. - void testAvailableWlanAps(); - void testAvailableWlanApsWithIaps(); - void testAvailableWlanApsSequence(); - - void testCreateWlanIapOk(); - - void testConnectIapOk(); - void testConnectIapErr(); - - void testDisconnectIapOk(); - - void testIapFound(); - void testIapNotFound(); - - void testConnectedWlanIdFound(); - void testConnectedWlanIdFoundConstructor(); - void testConnectedWlanIdNotFound(); - - void testScanWlans(); - - void testWlanNetworkOpened(); - void testWlanNetworkClosed(); - - // Test functions for private implementation (tested via public interface) - void testConnectionTestPass(); - void testConnectionTestFail(); - -private: - - // Helper functions, that is, sub test cases. - void subTestSignalWaitAndTake(QSignalSpy *spy, QList *arguments); - void subTestLoadCommsDatFile(QString newCommsdatFilename); - void subTestNewWlanQtUtils(); - - // Member variables. - WlanQtUtils *wlanQtUtils_; - QSignalSpy *signalScanReady_; - QSignalSpy *signalWlanNetworkOpened_; - QSignalSpy *signalWlanNetworkClosed_; - - /* Default CommsDat file name - SNAP ID=3: Internet: - IAP ID = 1: packet data 1 - IAP ID = 3: packet data 2 - IAP ID = 4: packet data 3 - IAP ID = 5: WLAN IAP 1, EWlanSecModeOpen - IAP ID = 6: WLAN IAP 2, EWlanSecModeWep, w2key - IAP ID = 7: WLAN IAP 3, EWlanSecModeWpa, wlan3key - SNAP ID = 4: Multimedia msg. - SNAP ID = 5: WAP services - SNAP ID = 6: My Snap: - IAP ID = 8: Home WLAN, EWlanSecModeOpen - IAP ID = 9: Streaming - */ - static const QString commsDatDefault_; -}; - -#endif /* TESTWLANQTUTILS_H_ */ - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wlanqtutilities.pro --- a/wlanutilities/wlanqtutilities/wlanqtutilities.pro Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanqtutilities/wlanqtutilities.pro Thu Jul 22 16:44:32 2010 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available # under the terms of "Eclipse Public License v1.0" @@ -12,81 +12,83 @@ # Contributors: # # Description: +# WLAN Qt Utilities project file. # TEMPLATE = lib TARGET = wlanqtutilities -TARGET.CAPABILITY = ALL -TCB #BUILD_DLL macro is used to define export macro DEFINES += BUILD_WLANQTUTILITIES_DLL DEPENDPATH += . -#Store generated .moc files to their own directory -MOC_DIR = moc +# Store generated files to their own directory +MOC_DIR = build -#Following macros MW_LAYER_SYSTEMINCLUDE and OS_LAYER_SYSTEMINCLUDE are defined -#in X:\QT\mkspecs\features\symbian\platform_paths.prf that is always inluded in -#QT compilation +# Temporary solution to fix tracecompiler +# When tracecompiler is fixed, this can be removed +symbian: { + MMP_RULES += "USERINCLUDE traces" +} -INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \ - $$OS_LAYER_SYSTEMINCLUDE \ - base/inc \ - wrapper/inc \ - traces +INCLUDEPATH += \ + ../inc \ + base/inc \ + wrapper/inc \ + traces -HEADERS += base/inc/wlanqtutils.h \ - base/inc/wlanqtutils_p.h \ - base/inc/wlanqtutilsactiveconn.h \ - base/inc/wlanqtutilscommon.h \ - base/inc/wlanqtutilswlanap.h \ - base/inc/wlanqtutilswlaniap.h \ - base/inc/wlanqtutilsiap.h \ - wrapper/inc/wlanqtutilsconmonwrapper.h \ - wrapper/inc/wlanqtutilscmmwrapper.h \ - wrapper/inc/wlanqtutilsconntestwrapper.h \ - wrapper/inc/wlanqtutilsesockwrapper.h \ - traces/OstTraceDefinitions.h +HEADERS += \ + base/inc/wlanqtutils.h \ + base/inc/wlanqtutils_p.h \ + base/inc/wlanqtutilsap.h \ + base/inc/wlanqtutilsconnection.h \ + base/inc/wlanqtutilsiap.h \ + base/inc/wlanqtutilsiapsettings.h \ + wrapper/inc/wlanqtutilsconmonwrapper.h \ + wrapper/inc/wlanqtutilsesockwrapper.h \ + wrapper/inc/wlanqtutilsscan.h \ + traces/OstTraceDefinitions.h -SOURCES += base/src/wlanqtutils.cpp \ - base/src/wlanqtutils_p.cpp \ - base/src/wlanqtutilsactiveconn.cpp \ - base/src/wlanqtutilswlanap.cpp \ - base/src/wlanqtutilswlaniap.cpp \ - base/src/wlanqtutilsiap.cpp \ - wrapper/src/wlanqtutilsconmonwrapper.cpp \ - wrapper/src/wlanqtutilscmmwrapper.cpp \ - wrapper/src/wlanqtutilsconntestwrapper.cpp \ - wrapper/src/wlanqtutilsesockwrapper.cpp +SOURCES += \ + base/src/wlanqtutils.cpp \ + base/src/wlanqtutils_p.cpp \ + base/src/wlanqtutilsap.cpp \ + base/src/wlanqtutilsconnection.cpp \ + base/src/wlanqtutilsiap.cpp \ + base/src/wlanqtutilsiapsettings.cpp \ + wrapper/src/wlanqtutilsconmonwrapper.cpp \ + wrapper/src/wlanqtutilsesockwrapper.cpp \ + wrapper/src/wlanqtutilsscan.cpp -mmpRuleDeffile = \ - "$${LITERAL_HASH}ifdef WINSCW" \ - "DEFFILE ./bwins/wlanqtutilities.def" \ - "$${LITERAL_HASH}else" \ - "DEFFILE ./eabi/wlanqtutilities.def" \ - "$${LITERAL_HASH}endif" +# Common libraries +LIBS += -lconnection_settings_shim symbian: { - HEADERS += wrapper/inc/wlanqtutilsconmonwrapper_s60_p.h \ - wrapper/inc/wlanqtutilscmmwrapper_s60_p.h \ - wrapper/inc/wlanqtutilsconntestwrapper_s60_p.h \ - wrapper/inc/wlanqtutilsesockwrapper_s60_p.h - SOURCES += wrapper/src/wlanqtutilsconmonwrapper_s60.cpp \ - wrapper/src/wlanqtutilscmmwrapper_s60.cpp \ - wrapper/src/wlanqtutilsconntestwrapper_s60.cpp \ - wrapper/src/wlanqtutilsesockwrapper_s60.cpp \ - ut/stubs/wlanqtutilsconnmonstub.cpp \ - ut/stubs/wlanqtutilsesockstub.cpp + HEADERS += \ + wrapper/inc/wlanqtutilsconmonwrapperdisconnect_symbian.h \ + wrapper/inc/wlanqtutilsconmonwrapperinfo_symbian.h \ + wrapper/inc/wlanqtutilsesockwrapper_symbian.h \ + wrapper/inc/wlanqtutilsscan_symbian.h + SOURCES += \ + wrapper/src/wlanqtutilsconmonwrapperdisconnect_symbian.cpp \ + wrapper/src/wlanqtutilsconmonwrapperinfo_symbian.cpp \ + wrapper/src/wlanqtutilsesockwrapper_symbian.cpp \ + wrapper/src/wlanqtutilsscan_symbian.cpp + + TARGET.CAPABILITY = CAP_GENERAL_DLL TARGET.EPOCALLOWDLLDATA = 1 TARGET.UID3 = 0x20029F52 - SYMBIAN_PLATFORMS = WINSCW ARMV5 - MMP_RULES += mmpRuleDeffile + defFilePath = . + BLD_INF_RULES.prj_exports += "rom/wlanqtutilities.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wlanqtutilities.iby)" - BLD_INF_RULES.prj_exports += "base/inc/wlanqtutils.h |../inc/wlanqtutils.h" \ - "base/inc/wlanqtutilscommon.h |../inc/wlanqtutilscommon.h" \ - "base/inc/wlanqtutilswlanap.h |../inc/wlanqtutilswlanap.h" \ - "base/inc/wlanqtutilsiap.h |../inc/wlanqtutilsiap.h" \ - "base/inc/wlanqtutilswlaniap.h |../inc/wlanqtutilswlaniap.h" + BLD_INF_RULES.prj_exports += \ + "base/inc/wlanqtutils.h |../inc/wlanqtutils.h" \ + "base/inc/wlanqtutilsap.h |../inc/wlanqtutilsap.h" \ + "base/inc/wlanqtutilsiap.h |../inc/wlanqtutilsiap.h" + + # S60 libraries + LIBS += -lconnmon -lecom -lesock -lextendedconnpref -lnetmeta -lictswlanlogininterface -lcharconv } -symbian*::LIBS += -lconnmon -lcmmanager -lesock -lcommdb -lictsclientinterface \ No newline at end of file +# Stubs for emulator +include(stubs/stubs.pri) diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilscmmwrapper.h --- a/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilscmmwrapper.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -*/ - -#ifndef WLANQTUTILSCMMWRAPPER_H_ -#define WLANQTUTILSCMMWRAPPER_H_ - -// INCLUDES -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -// FORWARD DECLARATIONS -class CmmWrapperPrivate; -class WlanQtUtilsIap; -class WlanQtUtilsWlanIap; -class WlanQtUtilsWlanAp; - -// CLASS DECLARATION - -/** - * CmmWrapper class. - */ -class CmmWrapper : public QObject -{ -Q_OBJECT - -public: // Constructor and destructor - - /** - * Default constructor - */ - CmmWrapper( QObject *parent = 0 ); - - /** - * Destructor - */ - ~CmmWrapper(); - -public: - - /** - * Fetch all IAPs - * - * @param[in/out] iapList List of IAPs - */ - int fetchIaps( QList& iapList ); - - /** - * Create a new WLAN IAP as uncategorized - * - * @param[in] wlanAp Information about the WLAN AP - * @return New IAP class - */ - WlanQtUtilsWlanIap *createWlanIap(const WlanQtUtilsWlanAp *wlanAp); - - /** - * Move IAP to the Internet SNAP - * - * @param[in] iapId Which IAP to move - * @param[in] snapId Where to move it - */ - void moveIapToInternetSnap(int iapId); - -private: // Data - - /** - * d_ptr pointer to CmmWrapperPrivate - * Owned by CmmWrapper object, instantiated in - * constructor. - */ - CmmWrapperPrivate *d_ptr; -}; - -QT_END_HEADER - -QT_END_NAMESPACE - -#endif /* WLANQTUTILSCMMWRAPPER_H_ */ - -// End of file diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilscmmwrapper_s60_p.h --- a/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilscmmwrapper_s60_p.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ - -#ifndef WLANQTUTILSCMMWRAPPER_S60_P_H_ -#define WLANQTUTILSCMMWRAPPER_S60_P_H_ - -// INCLUDES -#include -#include "wlanqtutilscommon.h" - -QT_BEGIN_NAMESPACE - -//definitions taken from cmpluginwlandef.h and cmpluginpacketdatadef.h -const TUint KUidPacketDataBearerType = 0x10207378; - -class WlanQtUtilsIap; -class WlanQtUtilsWlanIap; - -// CLASS DECLARATION - -/** - * CmmWrapperPrivate class. - */ -class CmmWrapperPrivate - { - -public: - - /** - * Default constructor - */ - CmmWrapperPrivate(CmmWrapper *wrapper); - - /** - * Destructor - */ - ~CmmWrapperPrivate(); - -public: - // New functions - - /** - * Fetches IAPs from CMM - * - * @iapList, list of IAPs - * @return error code - */ - int fetchIaps(QList &iapList); - - /** - * Creates a new WLAN IAP through CMM - * - * @aWlanAp WLAN parameters to store in IAP - * @return Created IAP, NULL in error cases - */ - WlanQtUtilsWlanIap *createWlanIap(const WlanQtUtilsWlanAp *aWlanAp); - - /** - * Move IAP to the Internet SNAP - * - * @param[in] iapId Which IAP to move - */ - void moveIapToInternetSnap(TInt32 aIapId); - -private: - - /** - * Fetches IAPs from CMM, leaves in error cases - * - * @iapList, list of IAPs - */ - void fetchIapsL(QList &iapList); - - /** - * Creates a new WLAN IAP through CMM, leaves in error cases - * - * @aWlanAp WLAN parameters to store in IAP - * @return Created IAP - */ - WlanQtUtilsWlanIap *createWlanIapL(const WlanQtUtilsWlanAp *aWlanAp); - - /** - * Move IAP to the Internet SNAP, leaves in error cases - * - * @param[in] iapId Which IAP to move - */ - void moveIapToInternetSnapL(TInt32 aIapId); - - /** - * Fetches IAPs of the given SNAP from CMM - * - * @param[in] aSnapId ID of the SNAP whose IAPS are requested - * @param[out] aSnapsIapList Where to store IAPs - * @return Error code - */ - int getIapListFromSnap( - TUint32 aSnapId, - QList& aSnapsIapList); - - /** - * Fetches IAP information of the given ConnectionMethod from CMM - * - * @param[in] aConnectionMethod Where to read info - * @return Created IAP - */ - WlanQtUtilsIap *getIapInfoL( - RCmConnectionMethodExt aConnectionMethod); - - /** - * Maps CMManager's WLAN security mode into WlanQtUtilsWlanSecMode. - * - * @aSecModeFromCmManager security mode read from CMManager - * @return: Mapped security mode to be used in Wlan Qt Utilities. - */ - WlanQtUtilsWlanSecMode cmm2WlanQtUtilsSecModeMap(int aSecModeFromCmManager); - - /** - * Maps WlanQtUtilsWlanSecMode into CMManager's WLAN security mode. - * - * @aWlanQtUtilsSecMode: Wlan Qt Utilities' WLAN security mode - * @return: Mapped CMManager's WLAN security mode. - */ - int wlanQtUtils2CmmSecModeMap(WlanQtUtilsWlanSecMode aWlanQtUtilsSecMode); - -private: - // Data - - /** - * q_ptr pointer to CmmWrapper - * Owned by CmmWrapperPrivate object, instantiated in - * constructor. - */ - CmmWrapper *q_ptr; - - RCmManagerExt iCmManagerExt; - - }; - -QT_END_NAMESPACE - -#endif /* WLANQTUTILSCMMWRAPPER_S60_P_H_ */ - -// End of file diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconmonwrapper.h --- a/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconmonwrapper.h Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconmonwrapper.h Thu Jul 22 16:44:32 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -12,173 +12,109 @@ * Contributors: * * Description: -* +* Wrapper for Symbian Connection Monitor library. */ #ifndef WLANQTUTILSCONMONWRAPPER_H #define WLANQTUTILSCONMONWRAPPER_H -// INCLUDES +// System includes + #include #include -#include - -QT_BEGIN_HEADER +#include +#include -QT_BEGIN_NAMESPACE +// User includes -#include "wlanqtutilscommon.h" +#include "wlanqtutils.h" + +// Forward declarations -// FORWARD DECLARATIONS -class WlanQtUtilsWlanAp; -class WlanQtUtilsActiveConn; -class ConnMonScanWlanAps; -class ConnMonConnInfo; -class ConnMonConnDisconnect; +class WlanQtUtilsAp; +class WlanQtUtilsConnection; +class WlanQtUtilsConMonWrapperInfo; +class WlanQtUtilsConMonWrapperDisconnect; -// CLASS DECLARATION +// External data types + +// Constants -/** -* ConMonWrapper class. -*/ -class ConMonWrapper : public QObject +// Class declaration + +class WlanQtUtilsConMonWrapper : public QObject { Q_OBJECT public: - - /** - * Constructor. - */ - ConMonWrapper(QObject *parent = 0); - - /** - * Destructor. - */ - ~ConMonWrapper(); - /** - * Requests wlan scanning - * - * @return ???. - */ - int scanAvailableWlanAPs(); - - /** - * Emits available WLANs to engine. - * - * @param[in] availableWlanAPs Available WLAN access points found in scan. - */ - void emitAvailableWlans(QList &availableWlanAPs); + // Data types - /** - * Emits signal indicating that a new connection has been created. - * - * @param[in] connectionId Connection ID. - */ - void emitConnCreatedEvent(uint connectionId); + explicit WlanQtUtilsConMonWrapper(QObject *parent = 0); - /** - * Emits signal indicating that a connection has been deleted. - * - * @param[in] connectionId Connection ID. - */ - void emitConnDeletedEvent(uint connectionId); - - /** - * Emits signal indicating that status of a connection has changed. - * - * @param[in] connectionId Connection ID. - * @param[in] connectionStatus Connection status. - */ - void emitConnStatusEvent(uint connectionId, WlanQtUtilsConnectionStatus connectionStatus); + ~WlanQtUtilsConMonWrapper(); - /** - * Return active connection information. - * - * @return Information of active connection, if one exists. - */ - WlanQtUtilsActiveConn *activeConnection(); + WlanQtUtilsConnection *activeConnection() const; - /** - * Returns information of a connection with the given connection ID. - * - * @param[in] connectionId Connection ID. - * @return Information of the given connection, if one exists. - */ - WlanQtUtilsActiveConn *connectionInfo(uint connectionId); + WlanQtUtilsConnection *connectionInfo(uint connectionId) const; - /** - * Stops given connection regardless of how many applications are using it. - * - * @param[in] iapId IAP ID to disconnect. - */ void disconnectIap(int iapId); signals: - /** - * Signal indicating available WLAN access points. - * - * @param[in] availableWlans Available WLAN access points found in scan. - */ - void availableWlanApsFromWrapper(QList &availableWlans); - - /** - * Signal indicating that a new connection has been created. - * - * @param[in] connectionId Connection ID. + /*! + Signal indicating that a new connection has been created. + + @param [in] connectionId Connection ID. */ void connCreatedEventFromWrapper(uint connectionId); - /** - * Signal indicating that a connection has been deleted. - * - * @param[in] connectionId Connection ID. + /*! + Signal indicating that a connection has been deleted. + + @param [in] connectionId Connection ID. */ void connDeletedEventFromWrapper(uint connectionId); - /** - * Signal indicating that status of a connection has changed. - * - * @param[in] connectionId Connection ID. - * @param[in] connectionStatus Connection status. + /*! + Signal indicating that status of a connection has changed. + + @param [in] connectionId Connection ID. + @param [in] connectionStatus Connection status. */ - void connStatusEventFromWrapper(uint connectionId, WlanQtUtilsConnectionStatus connectionStatus); + void connStatusEventFromWrapper( + uint connectionId, + WlanQtUtils::ConnStatus connectionStatus); -private: // Data - - /** - * d_ptrScanWlans pointer to ConMonWrapperPrivate - * Owned by ConMonWrapper object, instantiated in - * constructor. - */ - ConnMonScanWlanAps *d_ptrScanWlans; +public slots: + +protected: + +protected slots: + +private: + +private slots: + +private: // data - /** - * d_ptrConnInfo pointer to ConMonWrapperPrivate - * Owned by ConMonWrapper object, instantiated in - * constructor. - */ - ConnMonConnInfo *d_ptrConnInfo; + // Owned data + + //! Private implementation of connection info interface + QScopedPointer d_ptrInfo; + + //! Private implementation of connection disconnect interface + QScopedPointer d_ptrDisconnect; - /** - * d_ptrConnDisconnect pointer to ConMonWrapperPrivate - * Owned by ConMonWrapper object, instantiated in - * constructor. - */ - ConnMonConnDisconnect *d_ptrConnDisconnect; - -private: // Friend classes - // TestWlanQtUtils is defined as a friend class in order to be able to - // call event handlers of wrappers. + // Friend classes + + // Friend classes in order to be able to emit public signals directly + // from private implementation classes. + friend class WlanQtUtilsConMonWrapperInfo; + + // This is defined as a friend class in order to be able to call + // event handlers of wrappers from unit tests. friend class TestWlanQtUtils; }; -QT_END_HEADER - -QT_END_NAMESPACE - -#endif /* WLANQTUTILSCONMONWRAPPER_H */ - -// End of file +#endif // WLANQTUTILSCONMONWRAPPER_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconmonwrapper_s60_p.h --- a/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconmonwrapper_s60_p.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,291 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * This is a header file for following classes: - * ConnMonScanWlanAps. - */ - -#ifndef WLANQTUTILSCONMONWRAPPER_S60_P_H_ -#define WLANQTUTILSCONMONWRAPPER_S60_P_H_ - -// INCLUDES -#include -#include -#include "wlanqtutilscommon.h" - -class ConMonWrapper; - -QT_BEGIN_NAMESPACE - -// CLASS DECLARATION - -/** - * ConnMonScanWlanAps class. - */ -class ConnMonScanWlanAps : public CActive - { - -public: - // Constructor and destructor - - /** - * Default constructor - */ - ConnMonScanWlanAps(ConMonWrapper *wrapper); - - /** - * Destructor - */ - ~ConnMonScanWlanAps(); - -public: - // New functions - - /** - * scanAvailableWlanAPs - * scans all available WLAN APs - * @return error code - */ - int scanAvailableWlanAPs(); - -private: - // From CActive - - /** - * Implements cancellation of an outstanding request. - */ - void DoCancel(); - - /** - * Handles an active object's request completion event. - */ - void RunL(); - - /** - * conMon2WlanQtUtilsSecModeMap - * Maps Connection monitor's WLAN security mode value into WlanQtUtilsWlanSecMode. - * @aSecMode: security mode, ConnMon style, - * @return: security mode, Wlan Qt Utilities style. - */ - WlanQtUtilsWlanSecMode conMon2WlanQtUtilsSecModeMap(TUint aSecMode); - -private: - // Data - - /** - * q_ptr pointer to ConMonWrapper - * Owned by ConnMonScanWlanAps object, instantiated in - * constructor. - */ - ConMonWrapper *q_ptr; - - /** - * Handle to Connection Monitor Server - */ - RConnectionMonitor iMonitor; - - /** - * Scan package used with Connection Monitor Server scan request - * Owned by ConnMonScanWlanAps object. - */ - CConnMonWlanNetworksPtrArrayPckg* wlanBuf; - - /** - * wlan pointer variable used with Connection Monitor Server scan request - */ - TPtr wlanPtr; - }; - -// CLASS DECLARATION - -/** - * ConnMonConnInfo class. - */ -class ConnMonConnInfo : public MConnectionMonitorObserver - { -public: - // Constructor and destructor - - /** - * Default constructor - */ - ConnMonConnInfo(ConMonWrapper *wrapper); - - /** - * Destructor - */ - ~ConnMonConnInfo(); - -public: - // New functions - - /** - * Return active connection information. - * - * @return Information of active connection, if one exists. - */ - WlanQtUtilsActiveConn *activeConnection(); - - /** - * Returns information of a connection with the given connection ID. - * - * @param[in] connectionId Connection ID. - * @return Information of the given connection, if one exists. - */ - WlanQtUtilsActiveConn *connectionInfo(uint connectionId); - - /** - * Updates information of a given active connection. Missing information will be filled in - * and information that is dynamic in nature will be updated. - * - * @param[in] activeConn Current data of an active connection which will be updated. - * Connection ID and bearer type have to be valid. - */ - void activeConnInfoUpdate( WlanQtUtilsActiveConn *activeConn ); - -private: - // New private functions - - /** - * Starts monitoring observer events - */ - void StartMonitoringL(); - - /** - * Stops monitoring observer events - */ - void StopMonitoring(); - - /** - * Event method is called every time an event occures - */ - void EventL(const CConnMonEventBase& aConnMonEvent); - - /** - * Maps Connection Monitor's WLAN connection mode value into - * WlanQtUtilsWlanConnMode. - * - * @param aConnMode Connection mode in Connection Monitor's style. - * @return Connection mode in Wlan Qt Utilities style. - */ - static WlanQtUtilsWlanConnMode connMon2WlanQtUtilsConnModeMap(TInt aConnMode); - - /** - * Maps Connection Monitor's connection status value into WlanQtUtilsConnectionStatus. - * - * @param aConnectionStatus Connection status as used by Connection Monitor server. - * These status are defined in nifvar.h. - * @return Connection status in Wlan Qt Utilities style. - */ - static WlanQtUtilsConnectionStatus connMon2WlanQtUtilsConnectionStatusMap(TInt aConnectionStatus); - - /** - * Maps Connection Monitor's bearer type value into WlanQtUtilsBearerType. - * - * @param aBearerType Bearer type as used by Connection Monitor server. - * @return Bearer type in Wlan Qt Utilities style. - */ - static WlanQtUtilsBearerType connMon2WlanQtUtilsBearerTypeMap(TInt aBearerType); - -private: - // Data - - /** - * q_ptr pointer to ConMonWrapper - * Owned by ConMonWrapperPrivate object, instantiated in - * constructor. - */ - ConMonWrapper *q_ptr; - - /** Handle to Connection Monitor Server. */ - RConnectionMonitor iMonitor; - - /** Request status. */ - TRequestStatus iStatus; - - /** Indicates whether connection monitoring is ON. */ - TBool iMonitoring; - -private: // Friend classes - - // TestWlanQtUtils is defined as a friend class in order to be able to - // call event handlers of wrappers. - friend class TestWlanQtUtils; - }; - -// CLASS DECLARATION - -/** - * ConnMonConnDisconnect class. - */ -class ConnMonConnDisconnect : public CActive - { - -public: - // Constructor and destructor - - /** - * Default constructor - */ - ConnMonConnDisconnect(ConMonWrapper *wrapper); - - /** - * Destructor - */ - ~ConnMonConnDisconnect(); - -public: - // New functions - - /** - * disconnectConnection - * Stop connection - */ - void disconnectConnection(int iapId); - -private: - // From CActive - - /** - * Implements cancellation of an outstanding request. - */ - void DoCancel(); - - /** - * Handles an active object's request completion event. - */ - void RunL(); - -private: - // Data - - /** - * q_ptr pointer to ConMonWrapper - * Owned by ConMonWrapperPrivate object, instantiated in - * constructor. - */ - ConMonWrapper *q_ptr; - - /** - * Handle to Connection Monitor Server - */ - RConnectionMonitor iMonitor; - }; - -QT_END_NAMESPACE - -#endif /* WLANQTUTILSCONMONWRAPPER_S60_P_H_ */ - -// End of file - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconmonwrapperdisconnect_symbian.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconmonwrapperdisconnect_symbian.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Private implementation of wrapper for Symbian Connection Monitor +* library's connection disconnect interface. +*/ + +#ifndef WLANQTUTILSCONMONWRAPPERDISCONNECT_SYMBIAN_H +#define WLANQTUTILSCONMONWRAPPERDISCONNECT_SYMBIAN_H + +// System includes + +#include + +// User includes + +// Forward declarations + +class WlanQtUtilsConMonWrapper; + +// External data types + +// Constants + +// Class declaration + +class WlanQtUtilsConMonWrapperDisconnect +{ +public: + + // Data types + + WlanQtUtilsConMonWrapperDisconnect(WlanQtUtilsConMonWrapper *wrapper); + + ~WlanQtUtilsConMonWrapperDisconnect(); + + void DisconnectConnection(int iapId); + +protected: + +private: + +private: // data + + // Owned data + + RConnectionMonitor iMonitor; //!< Handle to Connection Monitor Server + + // Not owned data + + //! Public implementation to report progress to + WlanQtUtilsConMonWrapper *q_ptr; + + // Friend classes +}; + +#endif // WLANQTUTILSCONMONWRAPPERDISCONNECT_SYMBIAN_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconmonwrapperinfo_symbian.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconmonwrapperinfo_symbian.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Private implementation of wrapper for Symbian Connection Monitor +* library's connection info interface. +*/ + +#ifndef WLANQTUTILSCONMONWRAPPERINFO_SYMBIAN_H +#define WLANQTUTILSCONMONWRAPPERINFO_SYMBIAN_H + +// System includes + +#include + +// User includes + +#include "wlanqtutils.h" + +// Forward declarations + +class WlanQtUtilsConnection; +class WlanQtUtilsConMonWrapper; + +// External data types + +// Constants + +// Class declaration + +class WlanQtUtilsConMonWrapperInfo : public MConnectionMonitorObserver +{ +public: + + // Data types + + WlanQtUtilsConMonWrapperInfo(WlanQtUtilsConMonWrapper *wrapper); + + ~WlanQtUtilsConMonWrapperInfo(); + + WlanQtUtilsConnection *ActiveConnection(); + + WlanQtUtilsConnection *ConnectionInfo(uint connectionId); + +protected: + +private: + + TBool ConnectionInfoDetails(WlanQtUtilsConnection *connection); + + void EventL(const CConnMonEventBase& connMonEvent); + + WlanQtUtils::ConnStatus ConnMonConnStatusMap(TInt connStatus); + + TBool IsWlanConnection(TUint connectionId); + +private: // data + + // Owned data + + RConnectionMonitor iMonitor; //!< Handle to Connection Monitor Server + + TRequestStatus iStatus; //!< Request status + + //! ID of the connection we are currently monitoring + TUint iMonitoringConnection; + + // Not owned data + + //! Public implementation to report progress to + WlanQtUtilsConMonWrapper *q_ptr; + + // Friend classes + + // TestWlanQtUtils is defined as a friend class in order to be able to + // call event handlers of wrappers. + friend class TestWlanQtUtils; +}; + +#endif // WLANQTUTILSCONMONWRAPPERINFO_SYMBIAN_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconntestwrapper.h --- a/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconntestwrapper.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef WLANQTUTILSCONNTESTWRAPPER_H_ -#define WLANQTUTILSCONNTESTWRAPPER_H_ - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class ConnTestWrapperPrivate; - -/** -* ConnTestWrapper class. -*/ -class ConnTestWrapper: public QObject -{ - Q_OBJECT - - // TestWlanQtUtils is defined as a friend class in order to be able to - // call event handlers of wrappers. - friend class TestWlanQtUtils; - -public: // Constructor and destructor - - /** - * Default constructor - */ - ConnTestWrapper(QObject *parent = 0); - - /** - * Destructor - */ - ~ConnTestWrapper(); - -public: - - /** - * Called by private wrapper when connectivity test is ready. - * - * @param[in] result Result of internet connectivity test - */ - void connectivityTestDone(bool result); - -public slots: - - /** - * Starts internet connectivity test. - * - * @param[in] iapId iap id - * @param[in] netId network id - */ - void startConnectivityTest(int iapId, int netId); - -signals: - - /** - * Signal for emitting connectivity test result. - * - * @param[in] result Result of internet connectivity test - */ - void connectivityTestResult(bool result); - -private: - - /** - * d_ptr pointer to ConnTestWrapperPrivate - * Owned by ConnTestWrapper object, instantiated in constructor. - */ - ConnTestWrapperPrivate *d_ptr_; -}; - -QT_END_HEADER - -QT_END_NAMESPACE - -#endif /* WLANQTUTILSCONNTESTWRAPPER_H_ */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconntestwrapper_s60_p.h --- a/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconntestwrapper_s60_p.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef WLANQTUTILSCONNTESTWRAPPER_S60_P_H_ -#define WLANQTUTILSCONNTESTWRAPPER_S60_P_H_ - -#include - -QT_BEGIN_NAMESPACE - -/** -* ConnTestWrapperPrivate class. -*/ -class ConnTestWrapperPrivate: public MIctsObserver -{ - - // TestWlanQtUtils is defined as a friend class in order to be able to - // call event handlers of wrappers. - friend class TestWlanQtUtils; - -public: - - /** - * Default constructor - */ - ConnTestWrapperPrivate(ConnTestWrapper *aWrapper); - - /** - * Destructor - */ - ~ConnTestWrapperPrivate(); - -public: // From MICTSObserver - - /** - * Called when internet connectivity tests are being done. - * - * @param[in] aResult Result of connectivity test - * @param[in] aString String containing possible HTML response - */ - void ConnectivityObserver( TIctsTestResult aResult, const TDesC& aString ); - -public: - - /** - * Starts internet connectivity test wrapped. - * - * @param[in] iapId iap id - * @param[in] netId network id - */ - void startConnectivityTest( int aIapId, int aNetId ); - - /** - * Starts the actual internet connectivity test. - * - * @param[in] iapId iap id - * @param[in] netId network id - */ - void startConnectivityTestL( TInt aIapId, TInt aNetId ); - -private: - - /** - * Pointer to ConnTestWrapper - * Owned by ConnTestWrapperPrivate object, instantiated in constructor. - */ - ConnTestWrapper *q_ptr; - - /** - * Pointer to Internet Connectivity Test Service - * Owned by ConnTestWrapperPrivate. - */ - CIctsClientInterface* iIct; - -}; - -QT_END_NAMESPACE - -#endif /* WLANQTUTILSCONNTESTWRAPPER_S60_P_H_ */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsesockwrapper.h --- a/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsesockwrapper.h Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsesockwrapper.h Thu Jul 22 16:44:32 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -12,74 +12,72 @@ * Contributors: * * Description: -* This is a header file for EsockWrapper class. +* Wrapper for Symbian Esock library. */ -#ifndef ESOCKWRAPPER_H_ -#define ESOCKWRAPPER_H_ +#ifndef WLANQTUTILSESOCKWRAPPER_H +#define WLANQTUTILSESOCKWRAPPER_H + +// System includes #include +#include -QT_BEGIN_HEADER +// User includes -QT_BEGIN_NAMESPACE +// Forward declarations + +class WlanQtUtilsEsockWrapperPrivate; -class EsockWrapperPrivate; +// External data types + +// Constants -/** - * Wrapper for connection handling. - */ -class EsockWrapper: public QObject +// Class declaration + +class WlanQtUtilsEsockWrapper: public QObject { Q_OBJECT public: - /** - * Default constructor - */ - EsockWrapper(QObject *parent = 0); + // Data types + + WlanQtUtilsEsockWrapper(QObject *parent = 0); + + ~WlanQtUtilsEsockWrapper(); - /** - * Destructor. - */ - ~EsockWrapper(); - -public: + void updateConnection(bool isOpened, int platformStatusCode); + + int lastStatusCode(); - /** - * - */ - void updateConnection(bool isOpened); +signals: + + void connectionStatusFromWrapper(bool isOpened); public slots: - - /** - * Starts connection creation to given IAP. - * - * @param[in] iapId IAP ID. - */ + void connectIap(int iapId); + + void disconnectIap(); + +protected: + +protected slots: + +private: + +private slots: + +private: // data - /** - * Disconnects connection. - */ - void disconnectIap(); + //! Private implementation + QScopedPointer d_ptr; -signals: + //! Platform status code of latest connection creation attempt + int mLastStatusCode; - void connectionStatusFromWrapper(bool isOpened); - -private: // Data - - /** Private esock wrapper. */ - EsockWrapperPrivate *d_ptr; + // Friend classes }; -QT_END_HEADER - -QT_END_NAMESPACE - -#endif /*ESOCKWRAPPER_H_*/ - -// End of file +#endif // WLANQTUTILSESOCKWRAPPER_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsesockwrapper_s60_p.h --- a/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsesockwrapper_s60_p.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef ESOCKWRAPPER_S60_P_H_ -#define ESOCKWRAPPER_S60_P_H_ - -// INCLUDES -#include - -QT_BEGIN_NAMESPACE - -// CLASS DECLARATION - -/** -* EsockWrapperPrivate class. -*/ -class EsockWrapperPrivate: public CActive -{ - -public: // Constructor and destructor - - /** - * Default constructor - */ - EsockWrapperPrivate(EsockWrapper *aWrapper); - - /** - * Destructor - */ - ~EsockWrapperPrivate(); - -public: // New functions - - /** - * connectIap - * Starts connection creation. - */ - void connectIap(int aIapId); - - /** - * dsiconnectIap - * Stops connection. - */ - void disconnectIap(); - -private: // Functions from base class - - /** - * RunL - * Called when the scheduled function ends. - */ - void RunL(); - - /** - * DoCancel - * Cancels operations. - */ - void DoCancel(); - -private: // Data - - /** - * q_ptr pointer to ConnectionWrapper - * Owned by ConnectionWrapperPrivate object, instantiated in - * constructor. - */ - EsockWrapper *q_ptr; - - RSocketServ iSocketServer; - RConnection iConnection; -}; - -QT_END_NAMESPACE - -#endif /*ESOCKWRAPPER_S60_P_H_*/ - -// End of file diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsesockwrapper_symbian.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsesockwrapper_symbian.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Private implementation of wrapper for Symbian Esock library. +*/ + +#ifndef WLANQTUTILSESOCKWRAPPER_SYMBIAN_H +#define WLANQTUTILSESOCKWRAPPER_SYMBIAN_H + +// System includes + +#include + +// User includes + +// Forward declarations + +// External data types + +// Constants + +// Class declaration + +class WlanQtUtilsEsockWrapperPrivate: public CActive +{ + +public: + + // Data types + + WlanQtUtilsEsockWrapperPrivate(WlanQtUtilsEsockWrapper *wrapper); + + ~WlanQtUtilsEsockWrapperPrivate(); + + void ConnectIap(int iapId); + + void DisconnectIap(); + +protected: + +private: + + void RunL(); + + void DoCancel(); + +private: // data + + // Owned data + + RSocketServ iSocketServer; //!< Socket server handle + RConnection iConnection; //!< Connection handle + TBool iConnectionActive; //!< Do we have an active connection handle? + + // Not owned data + + //! Public implementation to report progress to + WlanQtUtilsEsockWrapper *q_ptr; + + // Friend classes +}; + +#endif // WLANQTUTILSESOCKWRAPPER_SYMBIAN_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsscan.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsscan.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN scan platform specific implementation wrapper. +*/ + +#ifndef WLANQTUTILSSCAN_H +#define WLANQTUTILSSCAN_H + +// System includes + +#include +#include +#include + +// User includes + +#include "wlanqtutilsap.h" + +// Forward declarations + +class WlanQtUtilsScanPrivate; + +// External data types + +// Constants + +// Class declaration + +class WlanQtUtilsScan : public QObject +{ + Q_OBJECT + +public: + + // Data types + + explicit WlanQtUtilsScan(QObject *parent = 0); + + ~WlanQtUtilsScan(); + + void scanWlanAps(); + + void scanWlanDirect(const QString &ssid); + + void stopScan(); + +signals: + + /*! + Signal indicating available WLAN access points. + + @param [in] availableWlans Available WLAN access points found in scan. + */ + void availableWlanAps( + QList< QSharedPointer > &availableWlans); + + /*! + Signal indicating that scanning failed. + + @param [in] status Scan status code (ScanStatus). + */ + void scanFailed(int status); + +public slots: + +protected: + +protected slots: + +private: + + Q_DISABLE_COPY(WlanQtUtilsScan) + +private slots: + +private: // data + + // Owned data + + //! Private implementation of scan interface + WlanQtUtilsScanPrivate *d_ptr; + + // Not owned data + + // Friend classes + + // Needed to be able to emit public signals directly from + // private implementation. + friend class WlanQtUtilsScanPrivate; +}; + +#endif // WLANQTUTILSSCAN_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsscan_symbian.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsscan_symbian.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Symbian platform specific implementation of WLAN scanning. +*/ + +#ifndef WLANQTUTILSSCAN_SYMBIAN_H +#define WLANQTUTILSSCAN_SYMBIAN_H + +// System includes + +#include +#include +#include + +// User includes + +#include "wlanqtutilsap.h" + +// Forward declarations + +class CWlanMgmtClient; +class CWlanScanInfo; +class WlanQtUtilsScan; + +// External data types + +// Constants + +// Class declaration + +class WlanQtUtilsScanPrivate : public CActive +{ + +public: + + // Data types + + static WlanQtUtilsScanPrivate *NewL(WlanQtUtilsScan *q_ptr); + + ~WlanQtUtilsScanPrivate(); + + void Scan(); + + void Scan(const QString &ssid); + + void StopScan(); + +protected: + + void RunL(); + + void DoCancel(); + +private: + + explicit WlanQtUtilsScanPrivate(WlanQtUtilsScan *q_ptr); + + void ConstructL(); + + void ExtractScanResults( + QList< QSharedPointer > &scanResults); + + QString ExtractSsid(); + + QByteArray ExtractBssid(); + + void StoreSecMode( + QSharedPointer ap, + TUint wlanSecMode); + +private: // data + + //! Public implementation reference + WlanQtUtilsScan *q_ptr; + + // Owned data + + //! WLAN Management Client + CWlanMgmtClient *mWlanMgmtClient; + + //! Scanned SSID + TWlanSsid mWlanSsid; + + //! Scan results + CWlanScanInfo *mResults; + + // Not owned data + + // Friend classes +}; + +#endif // WLANQTUTILSSCAN_SYMBIAN_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilscmmwrapper.cpp --- a/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilscmmwrapper.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This is a source file for CmmWrapper class. -*/ - -// INCLUDE FILES -#include "wlanqtutilscmmwrapper.h" -#include "wlanqtutilscmmwrapper_s60_p.h" -#include "wlanqtutilsiap.h" -#include "wlanqtutilswlaniap.h" -#include "wlanqtutilswlanap.h" - -// ================= MEMBER FUNCTIONS ======================= -// - -CmmWrapper::CmmWrapper( QObject *parent ) : - QObject( parent ) -{ - d_ptr = new CmmWrapperPrivate( this ); -} - -CmmWrapper::~CmmWrapper() -{ - delete d_ptr; -} - -int CmmWrapper::fetchIaps( QList& iapList ) -{ - int error = d_ptr->fetchIaps( iapList ); - return error; -} - -WlanQtUtilsWlanIap *CmmWrapper::createWlanIap( const WlanQtUtilsWlanAp *wlanAp ) -{ - return d_ptr->createWlanIap( wlanAp ); -} - -void CmmWrapper::moveIapToInternetSnap( int iapId ) -{ - return d_ptr->moveIapToInternetSnap( iapId ); -} - -//end of file diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilscmmwrapper_s60.cpp --- a/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilscmmwrapper_s60.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,388 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * This is a source file for CmmWrapperPrivate class. - */ - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include "wlanqtutilscommon.h" -#include "wlanqtutilsiap.h" -#include "wlanqtutilswlanap.h" -#include "wlanqtutilswlaniap.h" -#include "wlanqtutilscmmwrapper.h" -#include "wlanqtutilscmmwrapper_s60_p.h" - -#ifdef WLANQTUTILS_NO_OST_TRACES_FLAG -#include -#else -#include "OstTraceDefinitions.h" -#endif -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlanqtutilscmmwrapper_s60Traces.h" -#endif - - -// =========== PRIVATE CLASS MEMBER FUNCTIONS =============== -// -// --------------------------------------------------------- -// CmmWrapperPrivate::CmmWrapperPrivate() -// Constructor -// --------------------------------------------------------- -// -CmmWrapperPrivate::CmmWrapperPrivate(CmmWrapper *wrapper) : - q_ptr(wrapper) - { - OstTraceFunctionEntry1( CMMWRAPPERPRIVATE_CMMWRAPPERPRIVATE_ENTRY, this ); - - TRAPD(err, iCmManagerExt.OpenL()); - if (err != KErrNone) { - // todo - } - - OstTraceFunctionExit1( CMMWRAPPERPRIVATE_CMMWRAPPERPRIVATE_EXIT, this ); - } - -// --------------------------------------------------------- -// CmmWrapperPrivate::CmmWrapperPrivate() -// Destructor -// --------------------------------------------------------- -// -CmmWrapperPrivate::~CmmWrapperPrivate() - { - OstTraceFunctionEntry1( CMMWRAPPERPRIVATE_CMMWRAPPERPRIVATEDESTR_ENTRY, this ); - - iCmManagerExt.Close(); - - OstTraceFunctionExit1( CMMWRAPPERPRIVATE_CMMWRAPPERPRIVATEDESTR_EXIT, this ); - } - -// --------------------------------------------------------- -// CmmWrapperPrivate::fetchIaps() -// --------------------------------------------------------- -// -int CmmWrapperPrivate::fetchIaps(QList& iapList) - { - TRAPD(err, fetchIapsL(iapList)); - return err; - } - -// --------------------------------------------------------- -// CmmWrapperPrivate::fetchIapsL() -// --------------------------------------------------------- -// -void CmmWrapperPrivate::fetchIapsL(QList& iapList) - { - OstTraceFunctionEntry1( CMMWRAPPERPRIVATE_FETCHIAPSL_ENTRY, this ); - - // reset the list, just in case - iapList.clear(); - - //Array granularity 10 - RArray destinationIdArray = RArray (10); - - destinationIdArray.Reset(); - iCmManagerExt.AllDestinationsL(destinationIdArray); - - // looping all the SNAPs through - QList snapsIapList; - for (TInt i = 0; i < destinationIdArray.Count(); i++) - { - snapsIapList.clear(); - RCmDestinationExt dest; - dest = iCmManagerExt.DestinationL(destinationIdArray[i]); - TUint32 id = dest.Id(); - - if (getIapListFromSnap(id, snapsIapList) == KErrNone) - { - iapList.append(snapsIapList); - } - } - - OstTraceFunctionExit1( CMMWRAPPERPRIVATE_FETCHIAPSL_EXIT, this ); - } - -// --------------------------------------------------------- -// CmmWrapperPrivate::createWlanIap() -// Creates a new WLAN IAP -// --------------------------------------------------------- -// -WlanQtUtilsWlanIap *CmmWrapperPrivate::createWlanIap(const WlanQtUtilsWlanAp *aWlanAp) - { - WlanQtUtilsWlanIap *iap = NULL; - - TRAPD(err, iap = createWlanIapL(aWlanAp)); - - if (err != KErrNone) - { - // Todo: trace - } - return iap; - } - -// --------------------------------------------------------- -// CmmWrapperPrivate::createWlanIapL() -// Creates a new WLAN IAP -// --------------------------------------------------------- -// -WlanQtUtilsWlanIap *CmmWrapperPrivate::createWlanIapL(const WlanQtUtilsWlanAp *aWlanAp) - { - OstTraceFunctionEntry1( CMMWRAPPERPRIVATE_CREATEWLANIAPL_ENTRY, this ); - - // Create the new IAP - RCmConnectionMethodExt plugin = iCmManagerExt.CreateConnectionMethodL( - KUidWlanBearerType); - CleanupClosePushL(plugin); - - // Convert QString to Symbian buffer - TBufC buffer(aWlanAp->ssid().utf16()); - - WlanQtUtilsWlanSecMode secMode = aWlanAp->securityMode(); - int cmManagersSecMode = wlanQtUtils2CmmSecModeMap(secMode); - - plugin.SetStringAttributeL(CMManager::ECmName, buffer); - plugin.SetStringAttributeL(CMManager::EWlanSSID, buffer); - plugin.SetIntAttributeL(CMManager::EWlanSecurityMode, cmManagersSecMode); - // Todo: other parameters such as security keys -#if 0 - // TODO the security settings API plugin needs to be initialized here - // with the iap id. - // Check if the key value has been given - QString key = aWlanAp->securityKey(); - if ( key.length() > 0 ) - { - // Set the security key values here - if ( secMode == CMManager::EWlanSecModeWpa || - secMode == CMManager::EWlanSecModeWpa2 ) - { - // Store the WPA key to the database using the security settings API - TBufC bufKey(key.utf16()); - plugin.SetStringAttributeL( CMManager::EWlanWpaPreSharedKey, bufKey ); - - } - else if ( secMode == CMManager::EWlanSecModeWep ) - { - // Store the WPA key to the database using the security settings API - TBufC bufKey(key.utf16()); - plugin.SetStringAttributeL( CMManager::EWlanWepKey1, bufKey ); - } - } -#endif - - plugin.UpdateL(); - - TInt iapId = plugin.GetIntAttributeL(CMManager::ECmIapId); - - CleanupStack::PopAndDestroy(&plugin); // Close() called on "plugin" - - // Read details of the new IAP and create the WLAN IAP class - RCmConnectionMethodExt connectionMethod = iCmManagerExt.ConnectionMethodL( iapId ); - WlanQtUtilsIap *newIap = getIapInfoL(connectionMethod); - - OstTraceFunctionExit1( CMMWRAPPERPRIVATE_CREATEWLANIAPL_EXIT, this ); - return qobject_cast(newIap); - } - -// --------------------------------------------------------- -// CmmWrapperPrivate::moveIapToInternetSnap() -// --------------------------------------------------------- -// -void CmmWrapperPrivate::moveIapToInternetSnap( TInt32 aIapId ) - { - TRAPD( err, moveIapToInternetSnapL( aIapId ) ); - if (err != KErrNone) - { - // todo: add trace - } - } - -// --------------------------------------------------------- -// CmmWrapperPrivate::moveIapToInternetSnapL() -// --------------------------------------------------------- -// -void CmmWrapperPrivate::moveIapToInternetSnapL( TInt32 aIapId ) - { - OstTraceFunctionEntry1( CMMWRAPPERPRIVATE_MOVEIAPTOINTERNETSNAPL_ENTRY, this ); - - // Read all destination(SNAP) settings into an array - RArray destinations; - CleanupClosePushL(destinations); - iCmManagerExt.AllDestinationsL(destinations); - RCmDestinationExt destination; - // Loop through each destination - for(TInt i = 0; i < destinations.Count(); i++) - { - destination = iCmManagerExt.DestinationL(destinations[i]); - CleanupClosePushL(destination); - // Internet destination will always exist in the system. - // Internet destination will have ESnapPurposeInternet set in its metadata. - if (destination.MetadataL(CMManager::ESnapMetadataPurpose) == CMManager::ESnapPurposeInternet) - { - RCmConnectionMethodExt iap = iCmManagerExt.ConnectionMethodL( aIapId ); - CleanupClosePushL( iap ); - destination.AddConnectionMethodL( iap ); - destination.UpdateL(); - CleanupStack::PopAndDestroy(); // iap - } - CleanupStack::PopAndDestroy(); // destination - } - CleanupStack::PopAndDestroy(); // destinations - - OstTraceFunctionExit1( CMMWRAPPERPRIVATE_MOVEIAPTOINTERNETSNAPL_EXIT, this ); - } - -// --------------------------------------------------------- -// CmmWrapperPrivate::getIapListFromSnap() -// --------------------------------------------------------- -// -int CmmWrapperPrivate::getIapListFromSnap(TUint32 aDestId, - QList& iapList) - { - OstTraceFunctionEntry1( CMMWRAPPERPRIVATE_GETIAPLISTFROMSNAP_ENTRY, this ); - - RCmDestinationExt dest; - TRAPD(err, dest = iCmManagerExt.DestinationL(aDestId)); - if (err != KErrNone) - { - OstTraceFunctionExit1( CMMWRAPPERPRIVATE_GETIAPLISTFROMSNAP_EXIT, this ); - return err; - } - - // Copy IAPs from the SNAP into iapList. - int destIapCount = dest.ConnectionMethodCount(); - for (TInt i = 0; i < destIapCount; i++) - { - WlanQtUtilsIap* iap = NULL; - TRAP(err, iap = getIapInfoL(dest.ConnectionMethodL(i))); - - if (err == KErrNone) - { - iapList.append(iap); - } - } - - OstTraceFunctionExit1( DUP1_CMMWRAPPERPRIVATE_GETIAPLISTFROMSNAP_EXIT, this ); - return err; - } - -// --------------------------------------------------------- -// CmmWrapperPrivate::getIapInfoL() -// --------------------------------------------------------- -// -WlanQtUtilsIap *CmmWrapperPrivate::getIapInfoL( - RCmConnectionMethodExt aConnectionMethod) - { - OstTraceFunctionEntry1( CMMWRAPPERPRIVATE_GETIAPINFOL_ENTRY, this ); - - TUint iapId = aConnectionMethod.GetIntAttributeL(CMManager::ECmIapId); - - TUint netId = aConnectionMethod.GetIntAttributeL(CMManager::ECmNetworkId); - - HBufC* iapName = aConnectionMethod.GetStringAttributeL(CMManager::ECmName); - - TUint iapBearerType = aConnectionMethod.GetIntAttributeL(CMManager::ECmBearerType); - - QString name = QString::fromUtf16(iapName->Ptr(), iapName->Length()); - WlanQtUtilsBearerType bearer; - - WlanQtUtilsIap* newIap = NULL; - if (iapBearerType == KUidPacketDataBearerType) - { - bearer = WlanQtUtilsBearerTypeCellular; - newIap = new WlanQtUtilsIap(iapId, netId, name, bearer); - } - else - { - TInt secModeFromCmManager = - aConnectionMethod.GetIntAttributeL(CMManager::EWlanSecurityMode); - WlanQtUtilsWlanSecMode secMode = cmm2WlanQtUtilsSecModeMap(secModeFromCmManager); - bearer = WlanQtUtilsBearerTypeWlan; - //Note ssid is set same as iap name - WlanQtUtilsWlanIap* wlanIap = - new WlanQtUtilsWlanIap(iapId, netId, name, bearer, name, secMode); - newIap = wlanIap; - } - - OstTraceFunctionExit1( CMMWRAPPERPRIVATE_GETIAPINFOL_EXIT, this ); - return newIap; - } - -// --------------------------------------------------------- -// CmmWrapperPrivate::cmm2WlanQtUtilsSecModeMap() -// Maps CMManager's WLAN security mode into WlanQtUtilsWlanSecMode. -// CMManager uses sec mode type TConnMonSecurityMode defined -// in rconnmon.h. -// --------------------------------------------------------- -// -WlanQtUtilsWlanSecMode CmmWrapperPrivate::cmm2WlanQtUtilsSecModeMap(int aSecModeFromCmManager) - { - WlanQtUtilsWlanSecMode ret; - switch (aSecModeFromCmManager) - { - case CMManager::EWlanSecModeWep: - ret = WlanQtUtilsWlanSecModeWep; - break; - case CMManager::EWlanSecMode802_1x: - ret = WlanQtUtilsWlanSecMode802_1x; - break; - case CMManager::EWlanSecModeWpa: - ret = WlanQtUtilsWlanSecModeWpa; - break; - case CMManager::EWlanSecModeWpa2: - ret = WlanQtUtilsWlanSecModeWpa2; - break; - default: - ret = WlanQtUtilsWlanSecModeOpen; - break; - } - - return ret; - } - -// --------------------------------------------------------- -// Maps WlanQtUtilsWlanSecMode into CMManager's WLAN security mode -// (TWlanSecMode, defined in cmpluginwlandef.h). -// --------------------------------------------------------- -// -int CmmWrapperPrivate::wlanQtUtils2CmmSecModeMap(WlanQtUtilsWlanSecMode aWlanQtUtilsSecMode) - { - int ret; - switch (aWlanQtUtilsSecMode) - { - case WlanQtUtilsWlanSecModeWep: - ret = CMManager::EWlanSecModeWep; - break; - case WlanQtUtilsWlanSecMode802_1x: - ret = CMManager::EWlanSecMode802_1x; - break; - case WlanQtUtilsWlanSecModeWpa: - ret = CMManager::EWlanSecModeWpa; - break; - case WlanQtUtilsWlanSecModeWpa2: - ret = CMManager::EWlanSecModeWpa2; - break; - default: - ret = CMManager::EWlanSecModeOpen; - break; - } - - return ret; - } - -//end of file - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapper.cpp --- a/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapper.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapper.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -12,68 +12,89 @@ * Contributors: * * Description: -* +* Wrapper for Symbian Connection Monitor library. */ -// INCLUDE FILES -#include -#include +// System includes + +#include +#include + +// User includes + +#include "wlanqtutilsconmonwrapperdisconnect_symbian.h" +#include "wlanqtutilsconmonwrapperinfo_symbian.h" #include "wlanqtutilsconmonwrapper.h" -#include "wlanqtutilsconmonwrapper_s60_p.h" + +/*! + \class WlanQtUtilsConMonWrapper + \brief Wrapper for Symbian Connection Monitor library. + + Provides functionality to retrieve connection information, + and to disconnect connections. +*/ + +// External function prototypes + +// Local constants -// ================= MEMBER FUNCTIONS ======================= +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== -ConMonWrapper::ConMonWrapper(QObject *parent) - : QObject(parent) +/*! + Constructor. + + @param [in] parent Parent object. +*/ + +WlanQtUtilsConMonWrapper::WlanQtUtilsConMonWrapper(QObject *parent) : + QObject(parent), + d_ptrInfo(new WlanQtUtilsConMonWrapperInfo(this)), + d_ptrDisconnect(new WlanQtUtilsConMonWrapperDisconnect(this)) { - d_ptrScanWlans = new ConnMonScanWlanAps(this); - d_ptrConnInfo = new ConnMonConnInfo(this); - d_ptrConnDisconnect = new ConnMonConnDisconnect(this); -} - -ConMonWrapper::~ConMonWrapper() -{ - delete d_ptrScanWlans; - delete d_ptrConnInfo; - delete d_ptrConnDisconnect; -} - -int ConMonWrapper::scanAvailableWlanAPs() -{ - return d_ptrScanWlans->scanAvailableWlanAPs(); } -void ConMonWrapper::emitAvailableWlans(QList &availableWlanAPs) +/*! + Destructor. +*/ + +WlanQtUtilsConMonWrapper::~WlanQtUtilsConMonWrapper() { - emit availableWlanApsFromWrapper(availableWlanAPs); } -void ConMonWrapper::emitConnCreatedEvent(uint connectionId) +/*! + Return active connection information. + + @return Information of active connection, 0 if not found. +*/ + +WlanQtUtilsConnection *WlanQtUtilsConMonWrapper::activeConnection() const { - emit connCreatedEventFromWrapper(connectionId); -} - -void ConMonWrapper::emitConnDeletedEvent(uint connectionId) -{ - emit connDeletedEventFromWrapper(connectionId); + return d_ptrInfo->ActiveConnection(); } -void ConMonWrapper::emitConnStatusEvent(uint connectionId, WlanQtUtilsConnectionStatus connectionStatus) +/*! + Returns information of a connection with the given connection ID. + + @param [in] connectionId Connection ID. + + @return Information of the given connection, 0 if not found. +*/ + +WlanQtUtilsConnection* WlanQtUtilsConMonWrapper::connectionInfo( + uint connectionId) const { - emit connStatusEventFromWrapper(connectionId, connectionStatus); -} - -WlanQtUtilsActiveConn *ConMonWrapper::activeConnection() -{ - return d_ptrConnInfo->activeConnection(); + return d_ptrInfo->ConnectionInfo(connectionId); } -WlanQtUtilsActiveConn* ConMonWrapper::connectionInfo(uint connectionId) -{ - return d_ptrConnInfo->connectionInfo(connectionId); -} +/*! + Stops given connection regardless of how many applications are using it. -void ConMonWrapper::disconnectIap(int iapId) + @param [in] iapId IAP ID to disconnect. +*/ + +void WlanQtUtilsConMonWrapper::disconnectIap(int iapId) { - d_ptrConnDisconnect->disconnectConnection(iapId); + d_ptrDisconnect->DisconnectConnection(iapId); } diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapper_s60.cpp --- a/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapper_s60.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,633 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * This is a source file for following classes: - * ConnMonScanWlanAps, - * ConnMonConnInfo, - * ConnMonConnDisconnect - */ - -// INCLUDE FILES -#include -#include -#include - -#include "wlanqtutilscommon.h" -#include "wlanqtutilswlanap.h" -#include "wlanqtutilsactiveconn.h" -#include "wlanqtutilsconmonwrapper.h" -#include "wlanqtutilsconmonwrapper_s60_p.h" - -#ifdef WLANQTUTILS_NO_OST_TRACES_FLAG -#include -#else -#include "OstTraceDefinitions.h" -#endif -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlanqtutilsconmonwrapper_s60Traces.h" -#endif - - -// =========== PRIVATE CLASS MEMBER FUNCTIONS =============== -// -// --------------------------------------------------------- -// ConnMonScanWlanAps::ConnMonScanWlanAps() -// Constructor -// --------------------------------------------------------- -// -ConnMonScanWlanAps::ConnMonScanWlanAps(ConMonWrapper *wrapper) : - CActive(EPriorityStandard), q_ptr(wrapper), wlanPtr(0, 0) - { - OstTraceFunctionEntry1( CONNMONSCANWLANAPS_CONNMONSCANWLANAPS_ENTRY, this ); - - CActiveScheduler::Add(this); - // TBD: What if this leaves? - // Beware! iConnMon.ConnectL() can - // both leave AND return an error code.. - // User::LeaveIfError( iMonitor.ConnectL() ); - iMonitor.ConnectL(); - - OstTraceFunctionExit1( CONNMONSCANWLANAPS_CONNMONSCANWLANAPS_EXIT, this ); - } - -// --------------------------------------------------------- -// ConnMonScanWlanAps::ConnMonScanWlanAps() -// Destructor -// --------------------------------------------------------- -// -ConnMonScanWlanAps::~ConnMonScanWlanAps() - { - OstTraceFunctionEntry1( CONNMONSCANWLANAPS_CONNMONSCANWLANAPSDESTR_ENTRY, this ); - - Cancel(); - // Cancel notifications and close connection monitor session - iMonitor.Close(); - if (wlanBuf) - { - delete wlanBuf; - } - - OstTraceFunctionExit1( CONNMONSCANWLANAPS_CONNMONSCANWLANAPSDESTR_EXIT, this ); - } - -// --------------------------------------------------------- -// ConnMonScanWlanAps::DoCancel() -// -// --------------------------------------------------------- -// -void ConnMonScanWlanAps::DoCancel() - { - OstTraceFunctionEntry1( CONNMONSCANWLANAPS_DOCANCEL_ENTRY, this ); - // TODO: error handling - OstTraceFunctionExit1( CONNMONSCANWLANAPS_DOCANCEL_EXIT, this ); - } - -// --------------------------------------------------------- -// ConnMonScanWlanAps::RunL() -// Called when scan is ready. Emits scan results in a signal. -// --------------------------------------------------------- -// -void ConnMonScanWlanAps::RunL() - { - OstTraceFunctionEntry1( CONNMONSCANWLANAPS_RUNL_ENTRY, this ); - - if (iStatus == KErrNone) - { - RConnMonWlanNetworksPtrArray wlanPtrArray; - wlanBuf->UnpackToL(wlanPtrArray); - QList wlanScanResult; - - for (TInt i = 0; i < wlanPtrArray.Count(); i++) - { - WlanQtUtilsWlanAp *ap = new WlanQtUtilsWlanAp(); - - // Security mode values defined in enum TConnMonSecurityMode, rconnmon.h. - TUint connMonWlanSecMode; - WlanQtUtilsWlanSecMode wlanQtUtilsWlanSecMode; - - TBuf wlanName = - wlanPtrArray[i]->Name(); - - QString wlanNameInQt = QString::fromUtf16(wlanName.Ptr(), - wlanName.Length()); - - if (wlanNameInQt.length() == 1 && wlanNameInQt.at(0).unicode() - == 0) - { - // QString handles empty strings (single \0 char) strangely, - // so let's initialize them in a different way: - wlanNameInQt = ""; - } - - ap->setSsid(wlanNameInQt); - - // TODO: Won't compile to ARMV5 for some reason. Commented for awhile. - //TBuf8 wlanBssid = wlanPtrArray[i]->WlanBssid(); - //ap->setBssid(QString::fromUtf8(wlanBssid.Ptr(), wlanBssid.Length())); - ap->setBssid("addMAC"); - - TUint wlanConnectionMode = wlanPtrArray[i]->ConnectionMode(); - ap->setConnectionMode(wlanConnectionMode); - - TUint wlanSignalStrength = wlanPtrArray[i]->SignalStrength(); - ap->setSignalStrength(wlanSignalStrength); - - connMonWlanSecMode = wlanPtrArray[i]->SecurityMode(); - wlanQtUtilsWlanSecMode = conMon2WlanQtUtilsSecModeMap(connMonWlanSecMode); - ap->setSecurityMode(wlanQtUtilsWlanSecMode); - - wlanScanResult.append(ap); - delete wlanPtrArray[i]; - } - q_ptr->emitAvailableWlans(wlanScanResult); - wlanPtrArray.Close(); - delete wlanBuf; - wlanBuf = NULL; - // TODO: Is this enough for clearing QList containing ConnUtilsWlanAps? - wlanScanResult.clear(); - } - else - { - // TODO: add error handling - } - - OstTraceFunctionExit1( CONNMONSCANWLANAPS_RUNL_EXIT, this ); - } - -// --------------------------------------------------------- -// ConnMonScanWlanAps::scanAvailableWlanAPs() -// Gets APs from Connection Monitor -// --------------------------------------------------------- -// -int ConnMonScanWlanAps::scanAvailableWlanAPs() - { - OstTraceFunctionEntry1( CONNMONSCANWLANAPS_SCANAVAILABLEWLANAPS_ENTRY, this ); - - if (!IsActive()) - { - // TODO: What size for wlanBuf? How to know exact size? - // 2560 ~ 35 wlan APs - wlanBuf = new (ELeave) CConnMonWlanNetworksPtrArrayPckg(2560); - wlanPtr.Set(wlanBuf->Buf()->Des()); - - iMonitor.GetPckgAttribute(EBearerIdWLAN, 0, KWlanNetworks, wlanPtr, - iStatus); - SetActive(); - } - - OstTraceFunctionExit1( CONNMONSCANWLANAPS_SCANAVAILABLEWLANAPS_EXIT, this ); - return KErrNone; - } - -// --------------------------------------------------------- -// ConMonScanWlanAps::connMon2WlanQtUtilsSecModeMap() -// Map security mode from Connection Monitor into WlanQtUtilsWlanSecMode. -// --------------------------------------------------------- -// -WlanQtUtilsWlanSecMode ConnMonScanWlanAps::conMon2WlanQtUtilsSecModeMap(TUint connMonSecMode) - { - WlanQtUtilsWlanSecMode ret = WlanQtUtilsWlanSecModeNone; - switch (connMonSecMode) - { - case EConnMonSecurityWep: - ret = WlanQtUtilsWlanSecModeWep; - break; - case EConnMonSecurity802d1x: - ret = WlanQtUtilsWlanSecMode802_1x; - break; - case EConnMonSecurityWpa: - ret = WlanQtUtilsWlanSecModeWpa; - break; - case EConnMonSecurityWpaPsk: - ret = WlanQtUtilsWlanSecModeWpa2; - break; - default: - // TODO: should default be None/unknown or should there be assert against EConnMonSecurityOpen. - ret = WlanQtUtilsWlanSecModeOpen; - break; - } - - return ret; - } - - -// --------------------------------------------------------- -// ConnMonConnInfo::ConnMonConnInfo() -// Constructor -// --------------------------------------------------------- -// -ConnMonConnInfo::ConnMonConnInfo(ConMonWrapper *wrapper) : - q_ptr(wrapper) - { - OstTraceFunctionEntry1( CONNMONCONNINFO_CONNMONCONNINFO_ENTRY, this ); - - iMonitor.ConnectL(); - StartMonitoringL(); - - OstTraceFunctionExit1( CONNMONCONNINFO_CONNMONCONNINFO_EXIT, this ); - } - -// --------------------------------------------------------- -// ConnMonConnInfo::~ConnMonConnInfo() -// Destructor -// --------------------------------------------------------- -// -ConnMonConnInfo::~ConnMonConnInfo() - { - OstTraceFunctionEntry1( CONNMONCONNINFO_CONNMONCONNINFODESTR_ENTRY, this ); - - StopMonitoring(); - iMonitor.Close(); - - OstTraceFunctionExit1( CONNMONCONNINFO_CONNMONCONNINFODESTR_EXIT, this ); - } - -// --------------------------------------------------------- -// ConnMonConnInfo::StartMonitoringL() -// Starts monitoring of Connection Monitor Server events -// --------------------------------------------------------- -// -void ConnMonConnInfo::StartMonitoringL() - { - OstTraceFunctionEntry1( CONNMONCONNINFO_STARTMONITORINGL_ENTRY, this ); - - iMonitoring = ETrue; - iMonitor.NotifyEventL(*this); - - OstTraceFunctionExit1( CONNMONCONNINFO_STARTMONITORINGL_EXIT, this ); - } - -// --------------------------------------------------------- -// ConnMonConnInfo::StopMonitoring() -// Stops monitoring of Connection Monitor Server events -// --------------------------------------------------------- -// -void ConnMonConnInfo::StopMonitoring() - { - OstTraceFunctionEntry1( CONNMONCONNINFO_STOPMONITORING_ENTRY, this ); - - iMonitoring = EFalse; - iMonitor.CancelNotifications(); - - OstTraceFunctionExit1( CONNMONCONNINFO_STOPMONITORING_EXIT, this ); - } - -// --------------------------------------------------------- -// ConnMonConnInfo::EventL() -// Handler of Connection Monitor Server events -// --------------------------------------------------------- -// -void ConnMonConnInfo::EventL(const CConnMonEventBase& aConnMonEvent) - { - OstTraceFunctionEntry1( CONNMONCONNINFO_EVENTL_ENTRY, this ); - - TUint connectionId = aConnMonEvent.ConnectionId(); - OstTraceExt2( - TRACE_NORMAL, - CONNMONCONNINFO_EVENTL_EVENTTYPE, - "ConnMonConnInfo::EventL;connectionId=%u;aConnMonEvent.EventType()=%d", connectionId, aConnMonEvent.EventType() ); - - // Note: Conversions from CConnMonEventBase to sub classes cannot be made to use dynamic_cast - // because constructors of CConnMonEventBase and its sub classes are not public in - // connmon library's interface. - - switch (aConnMonEvent.EventType()) - { - case EConnMonCreateConnection: - q_ptr->emitConnCreatedEvent( connectionId ); - break; - case EConnMonDeleteConnection: - - // TODO: take the following into use. - // const CConnMonDeleteConnection* eventDelete; - // eventDelete = static_cast< const CConnMonDeleteConnection*>( &aConnMonEvent ); - //TUint totalDlVolume = eventDelete->DownlinkData(); - //TUint totalUlVolume = eventDelete->UplinkData(); - //TBool authDelete = eventDelete->AuthoritativeDelete(); - - q_ptr->emitConnDeletedEvent( connectionId ); - break; - case EConnMonConnectionStatusChange: - const CConnMonConnectionStatusChange* eventConnectionStatusChange; - eventConnectionStatusChange = - static_cast< const CConnMonConnectionStatusChange* >( &aConnMonEvent ); - WlanQtUtilsConnectionStatus connectionStatus; - connectionStatus = connMon2WlanQtUtilsConnectionStatusMap( - eventConnectionStatusChange->ConnectionStatus() ); - - OstTraceExt2( - TRACE_NORMAL, - CONNMONCONNINFO_EVENTL_CONNSTATUS, - "ConnMonConnInfo::EventL;connectionId=%u;eventConnectionStatusChange->ConnectionStatus()=%d", - connectionId, - eventConnectionStatusChange->ConnectionStatus() ); - - if (connectionStatus != WlanQtUtilsConnectionStatusNone) { - q_ptr->emitConnStatusEvent( connectionId, connectionStatus ); - } - break; - default: - break; - } - - OstTraceFunctionExit1( CONNMONCONNINFO_EVENTL_EXIT, this ); - } - -// --------------------------------------------------------- -// ConnMonConnInfo::activeConnection() -// --------------------------------------------------------- -// -WlanQtUtilsActiveConn *ConnMonConnInfo::activeConnection() - { - OstTraceFunctionEntry1( CONNMONCONNINFO_ACTIVECONNECTION_ENTRY, this ); - - // Get number of active connections - TRequestStatus status; - - TUint numConnections = 0; - iMonitor.GetConnectionCount( numConnections, status ); - User::WaitForRequest( status ); - if ( status.Int() == KErrNone ) - { - // Get connection info of this connection - for ( TUint i = 1; i <= numConnections; i++ ) - { - TUint numSubConnections = 0; - TUint connectionId = 0; - TInt ret = iMonitor.GetConnectionInfo( i, connectionId, numSubConnections ); - Q_ASSERT( ret == KErrNone ); // TODO: error handling - - WlanQtUtilsActiveConn* activeConn = connectionInfo( connectionId ); - if ( activeConn != NULL ) - { - // connectionInfo() only returns WLAN connections, and there may be only - // one active WLAN connection, so this is the one we want to return - OstTraceFunctionExit1( CONNMONCONNINFO_ACTIVECONNECTION_EXIT, this ); - return activeConn; - } - } - } - - OstTraceFunctionExit1( DUP1_CONNMONCONNINFO_ACTIVECONNECTION_EXIT, this ); - return NULL; - } - -// --------------------------------------------------------- -// ConnMonConnInfo::connectionInfo() -// --------------------------------------------------------- -// -WlanQtUtilsActiveConn *ConnMonConnInfo::connectionInfo( uint connectionId ) - { - OstTraceFunctionEntry1( CONNMONCONNINFO_CONNECTIONINFO_ENTRY, this ); - - TRequestStatus status; - WlanQtUtilsActiveConn *activeConn = NULL; - - // Get the connection bearer. - TInt bearer = 0; - iMonitor.GetIntAttribute( - connectionId, - 0, - KBearer, - bearer, - status ); - User::WaitForRequest( status ); - if ( status.Int() == KErrNone ) - { - // We are only interested in WLAN connections. - WlanQtUtilsBearerType bearerType = connMon2WlanQtUtilsBearerTypeMap( bearer ); - if ( bearerType == WlanQtUtilsBearerTypeWlan ) - { - activeConn = new WlanQtUtilsActiveConn(); - activeConn->setConnectionId( connectionId ); - activeConn->setBearerType( bearerType ); - activeConnInfoUpdate( activeConn ); - } - } - - OstTraceFunctionExit1( CONNMONCONNINFO_CONNECTIONINFO_EXIT, this ); - return activeConn; - } - -// --------------------------------------------------------- -// ConnMonConnInfo::activeConnInfoUpdate() -// Requests active connection info from Connection Monitor Server -// --------------------------------------------------------- -// -// TODO: divide this function into smaller pieces depending on the need. -// TODO: optimize so that all the information is not always requested from connmon. -// Only information that is missing is requested. -void ConnMonConnInfo::activeConnInfoUpdate( WlanQtUtilsActiveConn *activeConn ) - { - OstTraceFunctionEntry1( CONNMONCONNINFO_ACTIVECONNINFOUPDATE_ENTRY, this ); - - Q_ASSERT( activeConn != NULL ); - Q_ASSERT( activeConn->bearerType() != WlanQtUtilsBearerTypeNone ); - - TUint connectionId = activeConn->connectionId(); - TRequestStatus status; - - // Get connection IAP ID. - TUint iapId = 0; - iMonitor.GetUintAttribute( - connectionId, - 0, - KIAPId, - iapId, - status ); - User::WaitForRequest( status ); - if ( status.Int() == KErrNone ) - { - activeConn->setIapId( iapId ); - } - - // Get connection status. - TInt connectionStatus = 0; - iMonitor.GetIntAttribute( - connectionId, - 0, - KConnectionStatus, - connectionStatus, - status ); - User::WaitForRequest( status ); - if ( status.Int() == KErrNone ) { - activeConn->setConnectionStatus( connMon2WlanQtUtilsConnectionStatusMap( connectionStatus ) ); - } - - OstTraceFunctionExit1( CONNMONCONNINFO_ACTIVECONNINFOUPDATE_EXIT, this ); - } - -// --------------------------------------------------------- -// ConnMonConnInfo::connMon2WlanQtUtilsConnectionStatusMap() -// Maps connection status of Connection Monitor Server to connection -// status of Wlan Qt Utilities. -// --------------------------------------------------------- -// -WlanQtUtilsConnectionStatus ConnMonConnInfo::connMon2WlanQtUtilsConnectionStatusMap( TInt aConnectionStatus ) - { - // TODO: This mapping is not specific to current status which is unknown to wrapper. - // TODO: This is only current implementation and will need serious modifications and - // verification from connmon guys. - WlanQtUtilsConnectionStatus connUtilsConnectionStatus = WlanQtUtilsConnectionStatusNone; - switch (aConnectionStatus) - { - // KConnectionOpen is not final status for WLAN, because DHCP is run after that - case KConnectionOpen: - case KStartingConnection: - connUtilsConnectionStatus = WlanQtUtilsConnectionStatusConnecting; - break; - case KLinkLayerOpen: - connUtilsConnectionStatus = WlanQtUtilsConnectionStatusConnected; - break; - case KConnectionClosed: - case KLinkLayerClosed: - connUtilsConnectionStatus = WlanQtUtilsConnectionStatusDisconnected; - break; - default: - // Ignore all other values - connUtilsConnectionStatus = WlanQtUtilsConnectionStatusNone; - break; - } - - return connUtilsConnectionStatus; - } - -// --------------------------------------------------------- -// ConnMonConnInfo::connMon2WlanQtUtilsBearerTypeMap() -// Maps bearer type of Connection Monitor Server to bearer -// type of Wlan Qt Utilities. -// --------------------------------------------------------- -// -WlanQtUtilsBearerType ConnMonConnInfo::connMon2WlanQtUtilsBearerTypeMap( TInt aBearerType ) - { - WlanQtUtilsBearerType connUtilsBearerType = WlanQtUtilsBearerTypeNone; - switch ( aBearerType ) { - case EBearerWCDMA: - case EBearerGPRS: - case EBearerEdgeGPRS: - connUtilsBearerType = WlanQtUtilsBearerTypeCellular; - break; - case EBearerWLAN: - connUtilsBearerType = WlanQtUtilsBearerTypeWlan; - break; - default: - break; - } - - return connUtilsBearerType; - } - -// --------------------------------------------------------- -// ConnMonConnDisconnect::ConnMonConnDisconnect() -// Constructor -// --------------------------------------------------------- -// -ConnMonConnDisconnect::ConnMonConnDisconnect(ConMonWrapper *wrapper) : - CActive(EPriorityStandard), q_ptr(wrapper) - { - OstTraceFunctionEntry1( CONNMONCONNDISCONNECT_CONNMONCONNDISCONNECT_ENTRY, this ); - - CActiveScheduler::Add(this); - iMonitor.ConnectL(); - - OstTraceFunctionExit1( CONNMONCONNDISCONNECT_CONNMONCONNDISCONNECT_EXIT, this ); - } - -// --------------------------------------------------------- -// ConnMonConnDisconnect::ConnMonConnDisconnect() -// Destructor -// --------------------------------------------------------- -// -ConnMonConnDisconnect::~ConnMonConnDisconnect() - { - OstTraceFunctionEntry1( CONNMONCONNDISCONNECT_CONNMONCONNDISCONNECTDESTR_ENTRY, this ); - - // Cancel notifications and close connection monitor session - //iMonitor.CancelNotifications(); - iMonitor.Close(); - - OstTraceFunctionExit1( CONNMONCONNDISCONNECT_CONNMONCONNDISCONNECTDESTR_EXIT, this ); - } - -// --------------------------------------------------------- -// ConnMonConnDisconnect::DoCancel() -// -// --------------------------------------------------------- -// -void ConnMonConnDisconnect::DoCancel() - { - OstTraceFunctionEntry1( CONNMONCONNDISCONNECT_DOCANCEL_ENTRY, this ); - // TODO: error handling - OstTraceFunctionExit1( CONNMONCONNDISCONNECT_DOCANCEL_EXIT, this ); - } - -// --------------------------------------------------------- -// ConnMonConnDisconnect::RunL() -// -// --------------------------------------------------------- -// -void ConnMonConnDisconnect::RunL() - { - OstTraceFunctionEntry1( CONNMONCONNDISCONNECT_RUNL_ENTRY, this ); - // TODO: Is anything needed? - OstTraceFunctionExit1( CONNMONCONNDISCONNECT_RUNL_EXIT, this ); - } - -// --------------------------------------------------------- -// ConnMonConnDisconnect::disconnectConnection(int iapId) -// Stop active connection. -// --------------------------------------------------------- -// -void ConnMonConnDisconnect::disconnectConnection(int iapId) - { - OstTraceFunctionEntry1( CONNMONCONNDISCONNECT_DISCONNECTCONNECTION_ENTRY, this ); - OstTrace1( - TRACE_NORMAL, - CONNMONCONNDISCONNECT_DISCONNECTCONNECTION, - "ConnMonConnDisconnect::disconnectConnection;iapId=%d", iapId ); - - // TODO: Error handling - TUint count; - TRequestStatus status; - iMonitor.GetConnectionCount(count, status); - User::WaitForRequest(status); - - for (TInt i = 1; i <= count; i++) - { - TUint numSubConnections; - TUint iap = 0; - TUint connectionId = 0; - TInt ret = iMonitor.GetConnectionInfo(i, connectionId, - numSubConnections); - if (ret != KErrNone) - { - // error - } - iMonitor.GetUintAttribute(connectionId, 0, KIAPId, iap, status); - User::WaitForRequest(status); - if (status.Int() != KErrNone) - { - // error - } - if (iap == iapId) - { - TInt KErr = iMonitor.SetBoolAttribute(connectionId, 0, - KConnectionStop, ETrue); - } - } - - OstTraceFunctionExit1( CONNMONCONNDISCONNECT_DISCONNECTCONNECTION_EXIT, this ); - } - -//end of file diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapperdisconnect_symbian.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapperdisconnect_symbian.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Private implementation of wrapper for Symbian Connection Monitor + * library's connection disconnect interface. + */ + +// System includes + +// User includes + +#include "wlanqtutilsconmonwrapper.h" +#include "wlanqtutilsconmonwrapperdisconnect_symbian.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanqtutilsconmonwrapperdisconnect_symbianTraces.h" +#endif + +/*! + \class WlanQtUtilsConMonWrapperDisconnect + \brief Private wrapper for Symbian Connection Monitor library. + + Provides functionality to disconnect connections regardless of how + many applications are using the connection. +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. + + @param [in] wrapper Wrapper to report progress to. + */ + +WlanQtUtilsConMonWrapperDisconnect::WlanQtUtilsConMonWrapperDisconnect( + WlanQtUtilsConMonWrapper *wrapper) : + q_ptr(wrapper) +{ + OstTraceFunctionEntry1(WLANQTUTILSCONMONWRAPPERDISCONNECT_WLANQTUTILSCONMONWRAPPERDISCONNECT_ENTRY, this); + + // Errors in Connection Monitor Server connection are fatal so just + // throw them as exceptions + QT_TRAP_THROWING(iMonitor.ConnectL()); + + OstTraceFunctionExit1(WLANQTUTILSCONMONWRAPPERDISCONNECT_WLANQTUTILSCONMONWRAPPERDISCONNECT_EXIT, this); +} + +/*! + Destructor. + */ + +WlanQtUtilsConMonWrapperDisconnect::~WlanQtUtilsConMonWrapperDisconnect() +{ + OstTraceFunctionEntry1(DUP1_WLANQTUTILSCONMONWRAPPERDISCONNECT_WLANQTUTILSCONMONWRAPPERDISCONNECT_ENTRY, this); + + iMonitor.Close(); + + OstTraceFunctionExit1(DUP1_WLANQTUTILSCONMONWRAPPERDISCONNECT_WLANQTUTILSCONMONWRAPPERDISCONNECT_EXIT, this); +} + +/*! + Disconnects the connection with the given IAP ID. + + @param [in] wrapper Wrapper to report progress to. + */ + +void WlanQtUtilsConMonWrapperDisconnect::DisconnectConnection(int iapId) +{ + OstTraceFunctionEntry1(WLANQTUTILSCONMONWRAPPERDISCONNECT_DISCONNECTCONNECTION_ENTRY, this); + + OstTrace1( + TRACE_NORMAL, + WLANQTUTILSCONMONWRAPPERDISCONNECT_DISCONNECTCONNECTION, + "WlanQtUtilsConMonWrapperDisconnect::DisconnectConnection;iapId=%d", iapId); + + // Loop through connections to find the one with the IAP ID we want + TUint count; + TRequestStatus status; + iMonitor.GetConnectionCount(count, status); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + for (TInt i = 1; i <= count; i++) { + TUint numSubConnections; + TUint iap = 0; + TUint connectionId = 0; + TInt ret = iMonitor.GetConnectionInfo( + i, + connectionId, + numSubConnections); + if (ret == KErrNone) { + iMonitor.GetUintAttribute(connectionId, 0, KIAPId, iap, status); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + if (iap == iapId) { + OstTrace1( + TRACE_NORMAL, + WLANQTUTILSCONMONWRAPPERDISCONNECT_DISCONNECTCONNECTION_STOP, + "WlanQtUtilsConMonWrapperDisconnect::DisconnectConnection Stopping connection;connectionId=%u", + connectionId); + + // Match found, stop connection + TInt KErr = iMonitor.SetBoolAttribute( + connectionId, + 0, + KConnectionStop, + ETrue); + + OstTrace1( + TRACE_NORMAL, + WLANQTUTILSCONMONWRAPPERDISCONNECT_DISCONNECTCONNECTION_RESULT, + "WlanQtUtilsConMonWrapperDisconnect::DisconnectConnection Result;KErr=%d", KErr); + } + } + } + } + } + + OstTraceFunctionExit1( WLANQTUTILSCONMONWRAPPERDISCONNECT_DISCONNECTCONNECTION_EXIT, this); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapperinfo_symbian.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapperinfo_symbian.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,354 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Private implementation of wrapper for Symbian Connection Monitor +* library's scan interface. +*/ + +// System includes + +#include +#include + +// User includes + +#include "wlanqtutils.h" +#include "wlanqtutilsconnection.h" +#include "wlanqtutilsconmonwrapper.h" +#include "wlanqtutilsconmonwrapperinfo_symbian.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanqtutilsconmonwrapperinfo_symbianTraces.h" +#endif + +/*! + \class WlanQtUtilsConMonWrapperInfo + \brief Private wrapper for Symbian Connection Monitor library. + + Provides functionality to request information about connections. +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. + + @param [in] wrapper Wrapper to report progress to. +*/ + +WlanQtUtilsConMonWrapperInfo::WlanQtUtilsConMonWrapperInfo( + WlanQtUtilsConMonWrapper *wrapper) : + iMonitoringConnection(0), + q_ptr(wrapper) +{ + OstTraceFunctionEntry1(WLANQTUTILSCONMONWRAPPERINFO_WLANQTUTILSCONMONWRAPPERINFO_ENTRY, this); + + // Errors in Connection Monitor Server connection are fatal so just + // throw them as exceptions + QT_TRAP_THROWING( + iMonitor.ConnectL(); + iMonitor.NotifyEventL(*this); + ); + + OstTraceFunctionExit1(WLANQTUTILSCONMONWRAPPERINFO_WLANQTUTILSCONMONWRAPPERINFO_EXIT, this); +} + +/*! + Destructor. +*/ + +WlanQtUtilsConMonWrapperInfo::~WlanQtUtilsConMonWrapperInfo() +{ + OstTraceFunctionEntry1(DUP1_WLANQTUTILSCONMONWRAPPERINFO_WLANQTUTILSCONMONWRAPPERINFO_ENTRY, this); + + iMonitor.CancelNotifications(); + iMonitor.Close(); + + OstTraceFunctionExit1(DUP1_WLANQTUTILSCONMONWRAPPERINFO_WLANQTUTILSCONMONWRAPPERINFO_EXIT, this); +} + +/*! + Getter for active connection information. + + @return Information of active connection, if one exists. +*/ + +WlanQtUtilsConnection *WlanQtUtilsConMonWrapperInfo::ActiveConnection() +{ + OstTraceFunctionEntry1(WLANQTUTILSCONMONWRAPPERINFO_ACTIVECONNECTION_ENTRY, this); + + // Get number of active connections + TRequestStatus status; + + WlanQtUtilsConnection *activeConn = NULL; + TUint numConnections = 0; + iMonitor.GetConnectionCount(numConnections, status); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + // Get connection info of this connection + for (TUint i = 1; i <= numConnections; i++) { + TUint numSubConnections = 0; + TUint connectionId = 0; + TInt ret = iMonitor.GetConnectionInfo( + i, + connectionId, + numSubConnections); + if (ret == KErrNone) { + activeConn = ConnectionInfo(connectionId); + if (activeConn != NULL) { + // ConnectionInfo() only returns WLAN connections, + // and there may be only one active WLAN connection, + // so this is the one we want to return and also + // remember later. + Q_ASSERT(iMonitoringConnection == 0 + || iMonitoringConnection == connectionId); + iMonitoringConnection = connectionId; + break; + } + } + } + } + + OstTraceFunctionExit1(WLANQTUTILSCONMONWRAPPERINFO_ACTIVECONNECTION_EXIT, this); + return activeConn; +} + +/*! + Returns information of a connection with the given connection ID. + + @param[in] connectionId Connection ID. + @return Information of the given connection, if one exists. +*/ + +WlanQtUtilsConnection *WlanQtUtilsConMonWrapperInfo::ConnectionInfo( + uint connectionId) +{ + OstTraceFunctionEntry1(WLANQTUTILSCONMONWRAPPERINFO_CONNECTIONINFO_ENTRY, this); + + WlanQtUtilsConnection *activeConn = NULL; + + if (IsWlanConnection(connectionId)) { + activeConn = new WlanQtUtilsConnection(); + activeConn->setConnectionId(connectionId); + if (!ConnectionInfoDetails(activeConn)) { + delete activeConn; + activeConn = NULL; + } + } + + OstTraceFunctionExit1(WLANQTUTILSCONMONWRAPPERINFO_CONNECTIONINFO_EXIT, this); + return activeConn; +} + +/*! + Gets detailed information of a given connection. + + @param[out] connection Where to store info. Connection ID must already + be valid. + + @return Returns ETrue if detail fetching succeeded. +*/ + +TBool WlanQtUtilsConMonWrapperInfo::ConnectionInfoDetails( + WlanQtUtilsConnection *connection) +{ + OstTraceFunctionEntry1(WLANQTUTILSCONMONWRAPPERINFO_CONNECTIONINFODETAILS_ENTRY, this); + Q_ASSERT(connection != NULL); + + TBool success = EFalse; + TUint connectionId = connection->connectionId(); + TRequestStatus status; + + // Get connection IAP ID. + TUint iapId = 0; + iMonitor.GetUintAttribute( + connectionId, + 0, + KIAPId, + iapId, + status); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + connection->setIapId(iapId); + + // Get connection status. + TInt connectionStatus = 0; + iMonitor.GetIntAttribute( + connectionId, + 0, + KConnectionStatus, + connectionStatus, + status); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + connection->setConnectionStatus( + ConnMonConnStatusMap(connectionStatus)); + success = ETrue; + } + } + + OstTraceFunctionExit1(WLANQTUTILSCONMONWRAPPERINFO_CONNECTIONINFODETAILS_EXIT, this); + return success; +} + +/*! + Handler of Connection Monitor Server events. + + @param [in] connMonEvent Connection monitor event. +*/ + +void WlanQtUtilsConMonWrapperInfo::EventL(const CConnMonEventBase& connMonEvent) +{ + OstTraceFunctionEntry1(WLANQTUTILSCONMONWRAPPERINFO_EVENTL_ENTRY, this); + + TUint connectionId = connMonEvent.ConnectionId(); + + OstTraceExt2( + TRACE_NORMAL, + WLANQTUTILSCONMONWRAPPERINFO_EVENTL_EVENTTYPE, + "WlanQtUtilsConMonWrapperInfo::EventL;connectionId=%u;aConnMonEvent.EventType()=%{ConnMonEvent}", + connectionId, + connMonEvent.EventType()); + + switch (connMonEvent.EventType()) { + case EConnMonCreateConnection: + // Filter out other than WLAN connections + if (IsWlanConnection(connectionId)) { + iMonitoringConnection = connectionId; + emit q_ptr->connCreatedEventFromWrapper(connectionId); + } + break; + + case EConnMonDeleteConnection: + if (iMonitoringConnection == connectionId) { + iMonitoringConnection = 0; + emit q_ptr->connDeletedEventFromWrapper(connectionId); + } + break; + + case EConnMonConnectionStatusChange: + if (iMonitoringConnection == connectionId) { + // Find out the new status for the connection + const CConnMonConnectionStatusChange *connMonStatusEvent; + connMonStatusEvent = + static_cast< const CConnMonConnectionStatusChange* >(&connMonEvent); + WlanQtUtils::ConnStatus connectionStatus; + connectionStatus = + ConnMonConnStatusMap(connMonStatusEvent->ConnectionStatus()); + + OstTraceExt2( + TRACE_NORMAL, + WLANQTUTILSCONMONWRAPPERINFO_EVENTL_CONNSTATUS, + "WlanQtUtilsConMonWrapperInfo::EventL;connectionId=%u;eventConnectionStatusChange->ConnectionStatus()=%{ConnMonConnStatus}", + connectionId, + connMonStatusEvent->ConnectionStatus()); + + if (connectionStatus != WlanQtUtils::ConnStatusNone) { + emit q_ptr->connStatusEventFromWrapper( + connectionId, + connectionStatus); + } + } + break; + + default: + // Not interesting + break; + } + + OstTraceFunctionExit1(WLANQTUTILSCONMONWRAPPERINFO_EVENTL_EXIT, this); +} + +/*! + Maps Connection Monitor's connection status value into + WlanQtUtilsConnectionStatus. + + Note: Mapping is only valid for WLAN connections. + + @param connStatus Connection status as used by Connection + Monitor server. Defined in nifvar.h. + @return Connection status in Wlan Qt Utilities style. +*/ + +WlanQtUtils::ConnStatus WlanQtUtilsConMonWrapperInfo::ConnMonConnStatusMap( + TInt connStatus) + { + OstTraceFunctionEntry1(WLANQTUTILSCONMONWRAPPERINFO_CONNMONCONNSTATUSMAP_ENTRY, this); + + WlanQtUtils::ConnStatus utilsConnStatus; + switch (connStatus) { + // KConnectionOpen is not final status for WLAN, because DHCP is + // run after that + case KConnectionOpen: + case KStartingConnection: + utilsConnStatus = WlanQtUtils::ConnStatusConnecting; + break; + + case KLinkLayerOpen: + utilsConnStatus = WlanQtUtils::ConnStatusConnected; + break; + + case KLinkLayerClosed: + utilsConnStatus = WlanQtUtils::ConnStatusDisconnected; + break; + + default: + // Ignore all other values + utilsConnStatus = WlanQtUtils::ConnStatusNone; + break; + } + + OstTraceFunctionExit1(WLANQTUTILSCONMONWRAPPERINFO_CONNMONCONNSTATUSMAP_EXIT, this); + return utilsConnStatus; +} + +/*! + Checks the bearer of given connection. + Meant for filtering handling only for WLAN IAP's. + + @param [in] connectionId Connection ID. + + @return Returns ETrue if connection a WLAN connection, otherwise false. +*/ + +TBool WlanQtUtilsConMonWrapperInfo::IsWlanConnection(TUint connectionId) +{ + OstTraceFunctionEntry1(WLANQTUTILSCONMONWRAPPERINFO_ISWLANCONNECTION_ENTRY, this); + + TBool result = EFalse; + TRequestStatus status; + + TInt bearer = 0; + iMonitor.GetIntAttribute( + connectionId, + 0, + KBearer, + bearer, + status); + User::WaitForRequest(status); + + if (status.Int() == KErrNone && bearer == EBearerWLAN) { + result = ETrue; + } + + OstTraceFunctionExit1(WLANQTUTILSCONMONWRAPPERINFO_ISWLANCONNECTION_EXIT, this); + return result; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconntestwrapper.cpp --- a/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconntestwrapper.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -// INCLUDE FILES -#include "wlanqtutilsconntestwrapper.h" -#include "wlanqtutilsconntestwrapper_s60_p.h" - -ConnTestWrapper::ConnTestWrapper(QObject *parent) : QObject(parent) -{ - d_ptr_ = new ConnTestWrapperPrivate(this); -} - -ConnTestWrapper::~ConnTestWrapper() -{ - delete d_ptr_; -} - -void ConnTestWrapper::connectivityTestDone(bool result) -{ - emit connectivityTestResult(result); -} - -void ConnTestWrapper::startConnectivityTest(int iapId, int netId) -{ - d_ptr_->startConnectivityTest(iapId, netId); -} - -//end of file diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconntestwrapper_s60.cpp --- a/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconntestwrapper_s60.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -// INCLUDE FILES -#include -#include - -#include "wlanqtutilsconntestwrapper.h" -#include "wlanqtutilsconntestwrapper_s60_p.h" - -#ifdef WLANQTUTILS_NO_OST_TRACES_FLAG -#include -#else -#include "OstTraceDefinitions.h" -#endif -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlanqtutilsconntestwrapper_s60Traces.h" -#endif - - -// =========== PRIVATE CLASS MEMBER FUNCTIONS =============== -// -ConnTestWrapperPrivate::ConnTestWrapperPrivate( - ConnTestWrapper *aWrapper ) -: q_ptr( aWrapper ), iIct( NULL ) - { - OstTraceFunctionEntry1( CONNTESTWRAPPERPRIVATE_CONNTESTWRAPPERPRIVATE_ENTRY, this ); - OstTraceFunctionExit1( CONNTESTWRAPPERPRIVATE_CONNTESTWRAPPERPRIVATE_EXIT, this ); - } - -ConnTestWrapperPrivate::~ConnTestWrapperPrivate() - { - OstTraceFunctionEntry1( CONNTESTWRAPPERPRIVATE_CONNTESTWRAPPERPRIVATEDESTR_ENTRY, this ); - - if ( !NULL ) - { - delete iIct; - } - - OstTraceFunctionExit1( CONNTESTWRAPPERPRIVATE_CONNTESTWRAPPERPRIVATEDESTR_EXIT, this ); - } - -void ConnTestWrapperPrivate::ConnectivityObserver( - TIctsTestResult aResult, - const TDesC& /*aString*/ ) - { - OstTraceFunctionEntry1( CONNTESTWRAPPERPRIVATE_CONNECTIVITYOBSERVER_ENTRY, this ); - OstTrace1( - TRACE_NORMAL, - CONNTESTWRAPPERPRIVATE_CONNECTIVITYOBSERVER, - "ConnTestWrapperPrivate::ConnectivityObserver;aResult=%u", aResult ); - - switch ( aResult ) - { - case EConnectionOk : - q_ptr->connectivityTestDone( ETrue ); - break; - case EHttpAuthenticationNeeded : - case EConnectionNotOk : - case ETimeout : - default: - q_ptr->connectivityTestDone( EFalse ); - break; - } - - delete iIct; - iIct = NULL; - - OstTraceFunctionExit1( CONNTESTWRAPPERPRIVATE_CONNECTIVITYOBSERVER_EXIT, this ); - } - -void ConnTestWrapperPrivate::startConnectivityTest( - int aIapId, int aNetId ) - { - OstTraceFunctionEntry1( CONNTESTWRAPPERPRIVATE_STARTCONNECTIVITYTEST_ENTRY, this ); - OstTraceExt2( - TRACE_NORMAL, - CONNTESTWRAPPERPRIVATE_STARTCONNECTIVITYTEST, - "ConnTestWrapperPrivate::startConnectivityTest;aIapId=%d;aNetId=%d", aIapId, aNetId ); - - TRAPD( err, startConnectivityTestL( aIapId, aNetId ) ); - - // Check if startConnectivityTestL() leaved. - if ( KErrNone != err ) - { - q_ptr->connectivityTestDone( EFalse ); - } - - OstTraceFunctionExit1( CONNTESTWRAPPERPRIVATE_STARTCONNECTIVITYTEST_EXIT, this ); - } - -void ConnTestWrapperPrivate::startConnectivityTestL( - TInt aIapId, TInt aNetId ) - { - OstTraceFunctionEntry1( CONNTESTWRAPPERPRIVATE_STARTCONNECTIVITYTESTL_ENTRY, this ); - - iIct = CIctsClientInterface::NewL( aIapId, aNetId, *this ); - iIct->StartL(); - - OstTraceFunctionExit1( CONNTESTWRAPPERPRIVATE_STARTCONNECTIVITYTESTL_EXIT, this ); - } - -//end of file diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsesockwrapper.cpp --- a/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsesockwrapper.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsesockwrapper.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -12,34 +12,99 @@ * Contributors: * * Description: -* This is a source file for EsockWrapper class. +* Wrapper for Symbian Esock library. */ +// System includes + +#include + +// User includes + #include "wlanqtutilsesockwrapper.h" -#include "wlanqtutilsesockwrapper_s60_p.h" +#include "wlanqtutilsesockwrapper_symbian.h" + +/*! + \class WlanQtUtilsEsockWrapper + \brief Wrapper for Symbian Esock library. + + Provides functionality to connect and disconnect IAPs. +*/ + +// External function prototypes + +// Local constants -EsockWrapper::EsockWrapper(QObject *parent) - : QObject(parent) +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. + + @param [in] parent Parent object. + */ + +WlanQtUtilsEsockWrapper::WlanQtUtilsEsockWrapper(QObject *parent) : + QObject(parent), + d_ptr(new WlanQtUtilsEsockWrapperPrivate(this)), + mLastStatusCode(KErrNone) { - d_ptr = new EsockWrapperPrivate(this); } -EsockWrapper::~EsockWrapper() +/*! + Destructor. + */ + +WlanQtUtilsEsockWrapper::~WlanQtUtilsEsockWrapper() { - delete d_ptr; } -void EsockWrapper::updateConnection(bool isOpened) +/*! + Handles connection status update event. + + @param [in] isOpened Was the connection opened or not? + @param [in] platformStatusCode Platform specific status code. + */ + +void WlanQtUtilsEsockWrapper::updateConnection( + bool isOpened, + int platformStatusCode) { + mLastStatusCode = platformStatusCode; emit connectionStatusFromWrapper(isOpened); } -void EsockWrapper::connectIap(int iapId) +/*! + Returns last received connection creation status code. Clears status. + + @return Platform specific status code of the last connection attempt. + */ + +int WlanQtUtilsEsockWrapper::lastStatusCode() { - d_ptr->connectIap(iapId); + // Return current status and clear it + int status = mLastStatusCode; + mLastStatusCode = KErrNone; + return status; } -void EsockWrapper::disconnectIap() +/*! + Starts connection creation to given IAP. + + @param [in] iapId IAP ID to connect. + */ + +void WlanQtUtilsEsockWrapper::connectIap(int iapId) { - d_ptr->disconnectIap(); + d_ptr->ConnectIap(iapId); } + +/*! + Disconnects connection, if one is active. + */ + +void WlanQtUtilsEsockWrapper::disconnectIap() +{ + d_ptr->DisconnectIap(); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsesockwrapper_s60.cpp --- a/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsesockwrapper_s60.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -// INCLUDE FILES -#include -#include -#include -#include -#include "wlanqtutilsesockwrapper.h" -#include "wlanqtutilsesockwrapper_s60_p.h" - -#ifdef WLANQTUTILS_NO_OST_TRACES_FLAG -#include -#else -#include "OstTraceDefinitions.h" -#endif -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlanqtutilsesockwrapper_s60Traces.h" -#endif - - -// =========== PRIVATE CLASS MEMBER FUNCTIONS =============== -// -// --------------------------------------------------------- -// EsockWrapperPrivate::EsockWrapperPrivate() -// Constructor -// --------------------------------------------------------- -// -EsockWrapperPrivate::EsockWrapperPrivate(EsockWrapper *aWrapper) -: CActive(EPriorityStandard), q_ptr(aWrapper) - { - OstTraceFunctionEntryExt( ESOCKWRAPPERPRIVATE_ESOCKWRAPPERPRIVATE_ENTRY, this ); - - CActiveScheduler::Add(this); - - iSocketServer.Connect(); - - OstTraceFunctionExit1( ESOCKWRAPPERPRIVATE_ESOCKWRAPPERPRIVATE_EXIT, this ); - } - -// --------------------------------------------------------- -// EsockWrapperPrivate::EsockWrapperPrivate() -// Destructor -// --------------------------------------------------------- -// -EsockWrapperPrivate::~EsockWrapperPrivate() - { - OstTraceFunctionEntry1( ESOCKWRAPPERPRIVATE_ESOCKWRAPPERPRIVATEDESTR_ENTRY, this ); - - Cancel(); - // Closing active RConnection is not mandatory, but is recommended. - // ==> add checking here when implementing cancel/error cases. - iSocketServer.Close(); - - OstTraceFunctionExit1( ESOCKWRAPPERPRIVATE_ESOCKWRAPPERPRIVATEDESTR_EXIT, this ); - } - -// --------------------------------------------------------- -// EsockWrapperPrivate::connectIap() -// Start connection creation to given IAP. -// --------------------------------------------------------- -// -void EsockWrapperPrivate::connectIap(int aIapId) - { - OstTraceFunctionEntryExt( ESOCKWRAPPERPRIVATE_CONNECTIAP_ENTRY, this ); - - // Open an RConnection object. - iConnection.Open(iSocketServer); - - // Create overrides to force opening of the given IAP without any user prompts. - TCommDbConnPref prefs; - prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt); - prefs.SetDirection(ECommDbConnectionDirectionOutgoing); - prefs.SetIapId(aIapId); - - // Start the Connection with overrides - iConnection.Start(prefs, iStatus); - - // TODO: Currently SetActive Panics when connecting "furiously" in Visual view... - // Panicking line in SetActive was this: - // __ASSERT_ALWAYS(!(iStatus.iFlags&TRequestStatus::EActive),Panic(EReqAlreadyActive)); - SetActive(); - - OstTraceFunctionExit1( ESOCKWRAPPERPRIVATE_CONNECTIAP_EXIT, this ); - } - -// --------------------------------------------------------- -// EsockWrapperPrivate::disconnectIap() -// Stop connection. -// --------------------------------------------------------- -// -void EsockWrapperPrivate::disconnectIap() - { - OstTraceFunctionEntry1( ESOCKWRAPPERPRIVATE_DISCONNECTIAP_ENTRY, this ); - - // TODO: Error checking - iConnection.Close(); - - OstTraceFunctionExit1( ESOCKWRAPPERPRIVATE_DISCONNECTIAP_EXIT, this ); - } - -// --------------------------------------------------------- -// EsockWrapperPrivate::RunL() -// Called when connection creation has finished. -// --------------------------------------------------------- -// -void EsockWrapperPrivate::RunL() - { - OstTraceFunctionEntry1( ESOCKWRAPPERPRIVATE_RUNL_ENTRY, this ); - OstTrace1( TRACE_NORMAL, ESOCKWRAPPERPRIVATE_RUNL, "EsockWrapperPrivate::RunL;iStatus.Int()=%d", iStatus.Int() ); - - bool success = false; - - if (iStatus == KErrNone) - { - success = true; - } - - q_ptr->updateConnection(success); - - OstTraceFunctionExit1( ESOCKWRAPPERPRIVATE_RUNL_EXIT, this ); - } - -// --------------------------------------------------------- -// EsockWrapperPrivate::DoCancel() -// -// --------------------------------------------------------- -// -void EsockWrapperPrivate::DoCancel() - { - OstTraceFunctionEntry1( ESOCKWRAPPERPRIVATE_DOCANCEL_ENTRY, this ); - OstTraceFunctionExit1( ESOCKWRAPPERPRIVATE_DOCANCEL_EXIT, this ); - } - -//end of file diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsesockwrapper_symbian.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsesockwrapper_symbian.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,196 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Private implementation of wrapper for Symbian Esock library. +*/ + +// System includes + +#include +#include +#include +#include + +// User includes + +#include "wlanqtutilsesockwrapper.h" +#include "wlanqtutilsesockwrapper_symbian.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanqtutilsesockwrapper_symbianTraces.h" +#endif + +/*! + \class WlanQtUtilsWlanQtUtilsEsockWrapperPrivate + \brief Private implementation of wrapper for Symbian Esock library. + + Provides functionality to connect and disconnect IAPs. +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. + + @param [in] wrapper Wrapper to report progress to. + */ + +WlanQtUtilsEsockWrapperPrivate::WlanQtUtilsEsockWrapperPrivate( + WlanQtUtilsEsockWrapper *wrapper) : + CActive(EPriorityStandard), + iConnectionActive(EFalse), + q_ptr(wrapper) +{ + OstTraceFunctionEntry1(WLANQTUTILSESOCKWRAPPERPRIVATE_WLANQTUTILSESOCKWRAPPERPRIVATE_ENTRY, this); + + CActiveScheduler::Add(this); + + // Establish a session to Socket Server. Errors in Socket Server + // connection are fatal so just throw them as exceptions + qt_symbian_throwIfError(iSocketServer.Connect()); + + OstTraceFunctionExit1(WLANQTUTILSESOCKWRAPPERPRIVATE_WLANQTUTILSESOCKWRAPPERPRIVATE_EXIT, this); +} + +/*! + Destructor. + */ + +WlanQtUtilsEsockWrapperPrivate::~WlanQtUtilsEsockWrapperPrivate() +{ + OstTraceFunctionEntry1(DUP1_WLANQTUTILSESOCKWRAPPERPRIVATE_WLANQTUTILSESOCKWRAPPERPRIVATE_ENTRY, this); + + // Close any possibly ongoing connection + Cancel(); + // Close Socket Server session + iSocketServer.Close(); + + OstTraceFunctionExit1(DUP1_WLANQTUTILSESOCKWRAPPERPRIVATE_WLANQTUTILSESOCKWRAPPERPRIVATE_EXIT, this); +} + +/*! + Starts connection creation to given IAP. + + @param [in] iapId IAP ID to connect. + */ + +void WlanQtUtilsEsockWrapperPrivate::ConnectIap(int iapId) +{ + OstTraceFunctionEntry1(WLANQTUTILSESOCKWRAPPERPRIVATE_CONNECTIAP_ENTRY, this); + + // Cancel a (possibly) ongoing previous request + Cancel(); + + OstTrace1( + TRACE_NORMAL, + WLANQTUTILSESOCKWRAPPERPRIVATE_CONNECTIAP, + "WlanQtUtilsEsockWrapperPrivate::connectIap;iapId=%d", + iapId ); + + // Open an RConnection object. Errors in RConnection opening are + // fatal so just throw them as exceptions + qt_symbian_throwIfError(iConnection.Open(iSocketServer)); + + // Create overrides for connection preferences to force opening of the + // given IAP without any user prompts. + TConnPrefList prefList; + TExtendedConnPref prefs; + prefs.SetIapId(iapId); + prefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent); + QT_TRAP_THROWING(prefList.AppendL(&prefs)); + + // Start a connection with connection preferences + iConnection.Start(prefList, iStatus); + + iConnectionActive = ETrue; + + SetActive(); + + OstTraceFunctionExit1(WLANQTUTILSESOCKWRAPPERPRIVATE_CONNECTIAP_EXIT, this); +} + +/*! + Disconnects connection, if one is active. + */ + +void WlanQtUtilsEsockWrapperPrivate::DisconnectIap() +{ + OstTraceFunctionEntry1(WLANQTUTILSESOCKWRAPPERPRIVATE_DISCONNECTIAP_ENTRY, this); + + if (iConnectionActive) { + OstTrace0( + TRACE_NORMAL, + WLANQTUTILSESOCKWRAPPERPRIVATE_DISCONNECTIAP_DISCONNECT, + "WlanQtUtilsEsockWrapperPrivate::disconnectIap Disconnecting connection"); + + iConnectionActive = EFalse; + iConnection.Close(); + } else { + OstTrace0( + TRACE_NORMAL, + WLANQTUTILSESOCKWRAPPERPRIVATE_DISCONNECTIAP_IGNORED, + "WlanQtUtilsEsockWrapperPrivate::disconnectIap Ignored since no active connection"); + } + + OstTraceFunctionExit1(WLANQTUTILSESOCKWRAPPERPRIVATE_DISCONNECTIAP_EXIT, this); +} + +/*! + From CActive: called when async request (RConnection::Start()) + has been completed. + */ + +void WlanQtUtilsEsockWrapperPrivate::RunL() +{ + OstTraceFunctionEntry1(WLANQTUTILSESOCKWRAPPERPRIVATE_RUNL_ENTRY, this); + + OstTrace1( + TRACE_NORMAL, + WLANQTUTILSESOCKWRAPPERPRIVATE_RUNL, + "WlanQtUtilsEsockWrapperPrivate::RunL;iStatus=%d", iStatus.Int()); + + bool success; + if (iStatus == KErrNone) { + success = true; + } else { + success = false; + iConnectionActive = EFalse; + } + + // Report to public wrapper + q_ptr->updateConnection(success, iStatus.Int()); + + OstTraceFunctionExit1(WLANQTUTILSESOCKWRAPPERPRIVATE_RUNL_EXIT, this); +} + +/*! + From CActive: called when active object is cancelled. + */ + +void WlanQtUtilsEsockWrapperPrivate::DoCancel() +{ + OstTraceFunctionEntry1(WLANQTUTILSESOCKWRAPPERPRIVATE_DOCANCEL_ENTRY, this); + + // Disconnect, if needed. + DisconnectIap(); + + OstTraceFunctionExit1(WLANQTUTILSESOCKWRAPPERPRIVATE_DOCANCEL_EXIT, this); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsscan.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsscan.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN scan platform specific implementation wrapper. +*/ + +// System includes + +// User includes + +#include "wlanqtutilsscan_symbian.h" +#include "wlanqtutilsscan.h" + +/*! + \class WlanQtUtilsScan + \brief WLAN scan platform specific implementation wrapper. + + This class implements the WLAN scanning functionality platform independently. + The private implementation class implements the platform specific parts. +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. + + @param [in] parent Parent object. +*/ + +WlanQtUtilsScan::WlanQtUtilsScan(QObject *parent) : + QObject(parent) +{ + QT_TRAP_THROWING(d_ptr = WlanQtUtilsScanPrivate::NewL(this)); +} + +/*! + Destructor. +*/ + +WlanQtUtilsScan::~WlanQtUtilsScan() +{ + delete d_ptr; +} + +/*! + Scans available WLAN AP's (i.e. broadcast scan). +*/ + +void WlanQtUtilsScan::scanWlanAps() +{ + d_ptr->Scan(); +} + +/*! + Scans with given WLAN SSID (i.e. direct scan). + + @param [in] ssid WLAN SSID to scan. +*/ + +void WlanQtUtilsScan::scanWlanDirect(const QString &ssid) +{ + d_ptr->Scan(ssid); +} + +/*! + Stops current scan. Can also be called if there is no scan in progres. +*/ + +void WlanQtUtilsScan::stopScan() +{ + d_ptr->StopScan(); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsscan_symbian.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsscan_symbian.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,418 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Symbian platform specific implementation of WLAN scanning. +*/ + +// System includes + +#include +#include +#include + +// User includes + +#include "wlanqtutils.h" +#include "wlanqtutilsap.h" +#include "wlanqtutilsscan.h" +#include "wlanqtutilsscan_symbian.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanqtutilsscan_symbianTraces.h" +#endif + + +/*! + \class WlanQtUtilsScanPrivate + \brief Symbian platform specific implementation of WLAN scanning. + + Symbian platform specific implementation of WLAN scanning. +*/ + + +// External function prototypes + +// Local constants + +// Information Element ID for SSID as specified in 802.11. +static const TUint8 KWlan802Dot11SsidIE = 0; + +// Bit mask for Capability info field to get type (Infra/AdHoc). +static const TUint8 KWlan802Dot11CapabilityEssMask = 0x0001; + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Static factory constructor. + + @param [in,out] wrapper Public implementation class reference. + + @return New instance of the class. +*/ + +WlanQtUtilsScanPrivate *WlanQtUtilsScanPrivate::NewL(WlanQtUtilsScan *wrapper) +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANPRIVATE_NEWL_ENTRY); + + WlanQtUtilsScanPrivate *self = new (ELeave) WlanQtUtilsScanPrivate(wrapper); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + OstTraceFunctionExit0(WLANQTUTILSSCANPRIVATE_NEWL_EXIT); + return self; +} + +/*! + Destructor. +*/ + +WlanQtUtilsScanPrivate::~WlanQtUtilsScanPrivate() +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANPRIVATE_WLANQTUTILSSCANPRIVATE_ENTRY); + + Cancel(); + delete mWlanMgmtClient; + mWlanMgmtClient = NULL; + delete mResults; + mResults = NULL; + + OstTraceFunctionExit0(WLANQTUTILSSCANPRIVATE_WLANQTUTILSSCANPRIVATE_EXIT); +} + +/*! + Starts a broadcast scan of available access points. +*/ + +void WlanQtUtilsScanPrivate::Scan() +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANPRIVATE_SCAN_ENTRY); + + // Scanning while previous scan is not complete is not supported + Q_ASSERT(!IsActive()); + + // Make the scan + mWlanMgmtClient->GetScanResults(iStatus, *mResults); + SetActive(); + + OstTraceFunctionExit0(WLANQTUTILSSCANPRIVATE_SCAN_EXIT); +} + +/*! + Starts a direct scan of available access points having given SSID. + + @param ssid SSID to scan. +*/ + +void WlanQtUtilsScanPrivate::Scan(const QString &ssid) +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANPRIVATE_SCAN_SSID_ENTRY); + + // Scanning while previous scan is not complete is not supported + Q_ASSERT(!IsActive()); + + // Convert from QString to TBuf8 + TBuf buffer(ssid.utf16()); + TInt error = CnvUtfConverter::ConvertFromUnicodeToUtf8(mWlanSsid, buffer); + qt_symbian_throwIfError(error); + + OstTraceExt1( + TRACE_NORMAL, + WLANQTUTILSSCANPRIVATE_SCAN_SSID, + "WlanQtUtilsScanPrivate::Scan;mWlanSsid=%s", + mWlanSsid); + + // Make the scan + mWlanMgmtClient->GetScanResults(mWlanSsid, iStatus, *mResults); + SetActive(); + + OstTraceFunctionExit0(WLANQTUTILSSCANPRIVATE_SCAN_SSID_EXIT); +} + +/*! + Stops an ongoing scan. +*/ + +void WlanQtUtilsScanPrivate::StopScan() +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANPRIVATE_STOPSCAN_ENTRY); + + Cancel(); + + OstTraceFunctionExit0(WLANQTUTILSSCANPRIVATE_STOPSCAN_EXIT); +} + +/*! + Scan results handler. +*/ + +void WlanQtUtilsScanPrivate::RunL() +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANPRIVATE_RUNL_ENTRY); + + QT_TRYCATCH_LEAVING( + if (iStatus != KErrNone) { + emit q_ptr->scanFailed(WlanQtUtils::ScanStatusError); + } else { + QList< QSharedPointer > scanResults; + ExtractScanResults(scanResults); + + // Inform about the results + emit q_ptr->availableWlanAps(scanResults); + } + ); + + OstTraceFunctionExit0(WLANQTUTILSSCANPRIVATE_RUNL_EXIT); +} + +/*! + Cancels an outstanding request. +*/ + +void WlanQtUtilsScanPrivate::DoCancel() +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANPRIVATE_DOCANCEL_ENTRY); + + mWlanMgmtClient->CancelGetScanResults(); + + OstTraceFunctionExit0(WLANQTUTILSSCANPRIVATE_DOCANCEL_EXIT); +} + +/*! + Constructor. + + @param [in,out] wrapper Public implementation class reference. +*/ + +WlanQtUtilsScanPrivate::WlanQtUtilsScanPrivate(WlanQtUtilsScan *wrapper) : + CActive(EPriorityStandard), + q_ptr(wrapper), + mWlanMgmtClient(NULL), + mResults(NULL) +{ + OstTraceFunctionEntry0(DUP1_WLANQTUTILSSCANPRIVATE_WLANQTUTILSSCANPRIVATE_ENTRY); + OstTraceFunctionExit0(DUP1_WLANQTUTILSSCANPRIVATE_WLANQTUTILSSCANPRIVATE_EXIT); +} + +/*! + Second phase constructor. +*/ + +void WlanQtUtilsScanPrivate::ConstructL() +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANPRIVATE_CONSTRUCTL_ENTRY); + + CActiveScheduler::Add(this); + mWlanMgmtClient = CWlanMgmtClient::NewL(); + mResults = CWlanScanInfo::NewL(); + + OstTraceFunctionExit0(WLANQTUTILSSCANPRIVATE_CONSTRUCTL_EXIT); +} + +/* + Extracts scan results and stores them into the given AP list. + + @param [out] scanResults Scan result list. +*/ + +void WlanQtUtilsScanPrivate::ExtractScanResults( + QList< QSharedPointer > &scanResults) +{ + for (mResults->First(); !mResults->IsDone(); mResults->Next()) { + // Create an access point for each result + QSharedPointer ap(new WlanQtUtilsAp()); + + // SSID + QString ssid = ExtractSsid(); + + // Skip over hidden networks. There is no spec for what + // their names will contain, but at least names with only + // null characters and whitespace characters are seen + // in real life. + if (ssid.trimmed().isEmpty()) { + continue; + } + ap->setValue(WlanQtUtilsAp::ConfIdSsid, ssid); + + // BSSID + QByteArray bssid = ExtractBssid(); + ap->setValue(WlanQtUtilsAp::ConfIdBssid, bssid); + + // Signal strength + ap->setValue( + WlanQtUtilsAp::ConfIdSignalStrength, + (int)mResults->RXLevel()); + + // Connection Mode + CMManagerShim::WlanConnMode connMode; + if (mResults->Capability() & KWlan802Dot11CapabilityEssMask) { + connMode = CMManagerShim::Infra; + } else { + connMode = CMManagerShim::Adhoc; + } + ap->setValue(WlanQtUtilsAp::ConfIdConnectionMode, (int)connMode); + + // Security Mode parameters + StoreSecMode(ap, mResults->ExtendedSecurityMode()); + + // Hidden attribute + // These scan results do not tell if the AP is hidden or not + ap->setValue(WlanQtUtilsAp::ConfIdHidden, false); + + // WPS support + TBool wpsSupported = mResults->IsProtectedSetupSupported(); + ap->setValue( + WlanQtUtilsAp::ConfIdWpsSupported, + (wpsSupported == EFalse) ? false : true); + + // Append the AP to scan result list + scanResults.append(ap); + } +} + +/*! + Extracts and cleans up the WLAN SSID from current scan result element. + + @return SSID string. +*/ + +QString WlanQtUtilsScanPrivate::ExtractSsid() +{ + // Get the SSID in raw data format + TUint8 ieLen; + const TUint8* ieData; + TInt ret = mResults->InformationElement(KWlan802Dot11SsidIE, ieLen, &ieData); + + // Convert into QString + QString ssid; + if (ret == KErrNone && ieLen > 0) { + // Trace the buffer as data to ease low level debugging + OstTraceData( + TRACE_DUMP, + WLANQTUTILSSCANPRIVATE_EXTRACTSSID_DATA, + "WlanQtUtilsScanPrivate::ExtractSsid data 0x%{hex8[]}", + ieData, + ieLen); + + ssid = QString::fromUtf8((char *)ieData, ieLen); + +#ifdef OST_TRACE_COMPILER_IN_USE + TPtrC16 string(ssid.utf16(), ssid.length()); + OstTraceExt1( + TRACE_DUMP, + WLANQTUTILSSCANPRIVATE_EXTRACTSSID_STRING, + "WlanQtUtilsScanPrivate::ExtractSsid string;ssid=%S", + string); +#endif + } + + // Remove nul characters + ssid.remove(QChar()); + + return ssid; +} + +/*! + Extracts the WLAN BSSID from current scan result element. + + @return BSSID array. +*/ + +QByteArray WlanQtUtilsScanPrivate::ExtractBssid() +{ + TWlanBssid wlanBssid; + mResults->Bssid(wlanBssid); + QByteArray bssid; + for (int i = 0; i < (int)wlanBssid.Length(); i++) { + bssid[i] = (char)wlanBssid[i]; + } + +#ifdef OST_TRACE_COMPILER_IN_USE + QString bssidHex(bssid.toHex()); + TPtrC16 string(bssidHex.utf16(), bssidHex.length()); + + OstTraceExt1( + TRACE_DUMP, + WLANQTUTILSSCANPRIVATE_EXTRACTBSSID, + "WlanQtUtilsScanPrivate::ExtractBssid;bssid=%S", + string); +#endif + + return bssid; +} + +/*! + Stores Security mode parameters to \a ap class. + + @param [in,out] ap Access Point object to where the configuration is stored. + @param [in] secMode Security mode to store. +*/ + +void WlanQtUtilsScanPrivate::StoreSecMode( + QSharedPointer ap, + TUint wlanSecMode) +{ + CMManagerShim::WlanSecMode secMode = CMManagerShim::WlanSecModeOpen; + ap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, false); + + switch (wlanSecMode) { + case EWlanConnectionExtentedSecurityModeWepOpen: + case EWlanConnectionExtentedSecurityModeWepShared: + secMode = CMManagerShim::WlanSecModeWep; + break; + + case EWlanConnectionExtentedSecurityMode802d1x: + secMode = CMManagerShim::WlanSecMode802_1x; + break; + + case EWlanConnectionExtentedSecurityModeWpa: + secMode = CMManagerShim::WlanSecModeWpa; + break; + + case EWlanConnectionExtentedSecurityModeWpaPsk: + secMode = CMManagerShim::WlanSecModeWpa; + ap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); + break; + + case EWlanConnectionExtentedSecurityModeWpa2: + secMode = CMManagerShim::WlanSecModeWpa2; + break; + + case EWlanConnectionExtentedSecurityModeWpa2Psk: + secMode = CMManagerShim::WlanSecModeWpa2; + ap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); + break; + + case EWlanConnectionExtentedSecurityModeWapi: + case EWlanConnectionExtentedSecurityModeWapiPsk: + secMode = CMManagerShim::WlanSecModeWapi; + break; + + case EWlanConnectionExtentedSecurityModeOpen: + secMode = CMManagerShim::WlanSecModeOpen; + break; + +#ifndef QT_NO_DEBUG + default: + // Invalid security mode detected + Q_ASSERT(0); + break; +#endif + } + + ap->setValue(WlanQtUtilsAp::ConfIdSecurityMode, secMode); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wst/run_wst.bat --- a/wlanutilities/wlanqtutilities/wst/run_wst.bat Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,173 +0,0 @@ -::============================================================================= -:: Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -:: All rights reserved. -:: This component and the accompanying materials are made available -:: under the terms of "Eclipse Public License v1.0" -:: which accompanies this distribution, and is available -:: at the URL "http://www.eclipse.org/legal/epl-v10.html". -:: -:: Initial Contributors: -:: Nokia Corporation - initial contribution. -:: -:: Contributors: -:: -:: Description: -:: -::============================================================================= - -:: Script(s) uses following environment settings: -:: - CD -:: - DATE -:: - TIME -:: - TEMP - - -::----------------------------------------------------------------------------- -:: Do the preparations: -:: - Don't show the commands -:: - Use local parameters -- don't pollute the global one -:: - Dim the lights for time of script execution -:: - Store the current working directory -::----------------------------------------------------------------------------- - -@echo off -echo *** RUN_WST: START: -setlocal -color 08 -pushd . -if not exist run_wst.bat goto INVALID_DIR - - -::----------------------------------------------------------------------------- -:: Set the local variables -::----------------------------------------------------------------------------- - -echo *** RUN_WST: SET VARIABLES: -set wst_root_dir=%cd% -set wst_log_dir=%wst_root_dir%\wst_log -set wst_report_dir=%wst_root_dir%\wst_report -set log_file=%wst_log_dir%\wst_log.txt -set build_script=%wst_root_dir%\wst_script\wst_make.bat -set epoc_commsdat_dir=\epoc32\winscw\c\private\10202be9\persists -if not exist %epoc_commsdat_dir% goto INVALID_DIR -set epoc_backup_dir=%epoc_commsdat_dir%\backup -set ut_commsdat_dir=%wst_root_dir%\..\ut\context\commsdat_files -if not exist %ut_commsdat_dir% goto INVALID_DIR -set ut_commsdat_file_default=%ut_commsdat_dir%\default.cre -if not exist %ut_commsdat_file_default% goto INVALID_DIR -set ut_commsdat_files=%ut_commsdat_dir%\*.cre -if not exist %ut_commsdat_files% goto INVALID_DIR - - -::----------------------------------------------------------------------------- -:: Copy commsdat file to emulator directory and also to backup directory -::----------------------------------------------------------------------------- - -echo *** RUN_WST: COPY FILES: -copy %ut_commsdat_file_default% %epoc_commsdat_dir%\cccccc00.cre /y -if not exist %epoc_backup_dir% mkdir %epoc_backup_dir% -copy %ut_commsdat_files% %epoc_backup_dir% /y - - -::----------------------------------------------------------------------------- -:: Check that script exists -::----------------------------------------------------------------------------- - -echo *** RUN_WST: SOME CHECKS: -if not exist %build_script% goto INVALID_DIR -:: Create output directory if it does not exist -if not exist %wst_log_dir% mkdir %wst_log_dir% -if not exist %wst_report_dir% mkdir %wst_report_dir% -:: Create log file -echo *** WST_LOG: BEGIN *** > %log_file% - - -::----------------------------------------------------------------------------- -:: Check parameters -::----------------------------------------------------------------------------- - -set command=ERROR -if [%1]==[] set command=CLEAN_OLD_FILES COMPILE_WLANQTUTILS COMPILE_TEST_CASES RUN_TEST_CASES GENERATE_REPORTS SHOW_RESULTS -if [%1]==[CLEAN_OLD] set command=CLEAN_OLD_FILES -if [%1]==[WLANQTUTILS] set command=COMPILE_WLANQTUTILS -if [%1]==[CASES] set command=COMPILE_TEST_CASES -if [%1]==[RUN] set command=RUN_TEST_CASES -if [%1]==[REPORTS] set command=GENERATE_REPORTS -if [%1]==[RESULTS] set command=SHOW_RESULTS -if [%1]==[BROWSE] set command=START_BROWSER -if [%1]==[/?] goto HELP -if [%1]==[HELP] goto HELP -if [%1]==[/h] goto HELP -if [%1]==[-h] goto HELP - -::----------------------------------------------------------------------------- -:PARSE_COMMANDS -::----------------------------------------------------------------------------- - -echo *** RUN_WST: COMMAND: %command% -echo *** RUN_WST: CALL SCRIPT: -for %%i IN ( %command% ) DO ( - call %build_script% %wst_root_dir% wst_log.txt %%i - for /f "tokens=3 delims= " %%x in ('find /C " Error " %log_file%') do ( - if not [%%x]==[0] goto ERROR - ) -) - -goto THE_END - - -::----------------------------------------------------------------------------- -:INVALID_DIR -::----------------------------------------------------------------------------- - -echo *** RUN_WST: INVALID DIR: -echo *** Test script sub-script not found! -echo *** Please be sure to run the script in same directory, -echo *** i.e. .\run_wst.bat , and NOT .\wst\run_wst.bat - -goto THE_END - - -::----------------------------------------------------------------------------- -:ERROR -::----------------------------------------------------------------------------- - -echo *** RUN_WST: ERROR: -color 48 -echo Error in compilation: -findstr /C:" Error " < %log_file% -echo. -Echo Quitting WST. - -goto THE_END - - -::----------------------------------------------------------------------------- -:HELP -::----------------------------------------------------------------------------- - -echo *** RUN_WST: HELP: -echo Run Wlan Qt Utilities Workstation Testing -echo. -echo RUN_WST [param] -echo. -echo param -echo [none] - Do all, from CLEAN_OLD to RESULTS -echo. -echo CLEAN_OLD - Clean metrics and other generated files -echo WLANQTUTILS - Build only Wlan Qt Utilities components -echo CASES - Build only Tester components -echo RUN - Run Tester -echo REPORTS - Generate reports -echo RESULTS - Show results -echo BROWSE - Start browser -echo. - - -::----------------------------------------------------------------------------- -:THE_END -::----------------------------------------------------------------------------- - -echo *** RUN_WST: END: -color -popd diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanqtutilities/wst/wst_script/wst_make.bat --- a/wlanutilities/wlanqtutilities/wst/wst_script/wst_make.bat Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,199 +0,0 @@ -::============================================================================= -:: Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -:: All rights reserved. -:: This component and the accompanying materials are made available -:: under the terms of "Eclipse Public License v1.0" -:: which accompanies this distribution, and is available -:: at the URL "http://www.eclipse.org/legal/epl-v10.html". -:: -:: Initial Contributors: -:: Nokia Corporation - initial contribution. -:: -:: Contributors: -:: -:: Description: -:: -::============================================================================= -:: -:: Following commands are implemented: -:: - CLEAN_OLD_FILES -:: - COMPILE_WLANQTUTILS -:: - COMPILE_TEST_CASES -:: - RUN_TEST_CASES -:: - GENERATE_REPORTS -:: - SHOW_RESULTS -:: - START_BROWSER -::============================================================================= - -::----------------------------------------------------------------------------- -:: Do the preparations: -:: - Don't show the commands -:: - Use local parameters -- don't pollute the global one -::----------------------------------------------------------------------------- -@echo off - -echo *** WST_MAKE: START: -setlocal - -::----------------------------------------------------------------------------- -:: Check input -:: -:: Parameters that are required: -:: 1) wst_root_dir -:: 2) log_file_name -:: 3) the command -::----------------------------------------------------------------------------- - -:: (1) -if not exist %1 goto ERROR -if [%1]==[] goto ERROR -set wst_root_dir=%1 -set wst_log_dir=%1\wst_log -set wst_report_dir=%1\wst_report -set wlanqtutils_root_dir=%1\.. -set wlanqtutils_test_dir=%1\..\ut\t_wlanqtutils - -:: (2) -if [%2]==[] goto ERROR -set log_file_name=%2 -set log_file=%wst_log_dir%\%log_file_name% -if not exist %log_file% goto ERROR -echo *** DATE AND TIME: %date%, %time% >> %log_file% -echo *** WST_MAKE: INFO: Wlan Qt Utilities root dir: %wlanqtutils_root_dir% -echo *** WST_MAKE: INFO: Wlan Qt Utilities test dir: %wlanqtutils_test_dir% -echo *** WST_MAKE: INFO: WST log dir: %wst_log_dir% -echo *** WST_MAKE: INFO: WST log file: %log_file% - -:: (3) -if [%3]==[] goto ERROR -goto %3 - -:: Error if label not found. -goto ERROR - -::----------------------------------------------------------------------------- -:CLEAN_OLD_FILES -::----------------------------------------------------------------------------- - -echo *** WST_MAKE: CLEAN_OLD_FILES: -echo *** WST_LOG: CLEAN_OLD_FILES >> %log_file% - -move %wst_log_dir%\%log_file_name% %wst_root_dir% -del /F /S /Q %wst_log_dir%\* -del /F /S /Q %wst_report_dir%\* -rmdir /S /Q %wst_log_dir%\CMTHTML -rmdir /S /Q %wst_log_dir%\CTCHTML -move %wst_root_dir%\%log_file_name% %wst_log_dir% -del \epoc32\winscw\c\data\wlanqtutils_qtest_log.txt - -goto THE_END - -::----------------------------------------------------------------------------- -:COMPILE_WLANQTUTILS -::----------------------------------------------------------------------------- - -echo *** WST_MAKE: COMPILE_WLANQTUTILS: -echo *** WST_LOG: COMPILE_WLANQTUTILS >> %log_file% - -cd %wlanqtutils_root_dir% -call qmake >> %log_file% 2>&1 -call bldmake bldfiles >> %log_file% 2>&1 -call abld reallyclean winscw >> %log_file% 2>&1 -call abld build winscw udeb >> %log_file% 2>&1 - -goto THE_END - -::----------------------------------------------------------------------------- -:COMPILE_TEST_CASES -::----------------------------------------------------------------------------- - -echo *** WST_MAKE: COMPILE_TEST_CASES: -echo *** WST_LOG: COMPILE_TEST_CASES >> %log_file% - -cd %wlanqtutils_test_dir% -call qmake "CONFIG += coverage_test" >> %log_file% 2>&1 -call bldmake bldfiles >> %log_file% 2>&1 -call abld reallyclean winscw >> %log_file% 2>&1 -:: Call CTC instrumentation script. Source directories hard coded, because NO_EXCLUDE does not like % characters... -call ctcwrap -C EXCLUDE=* -C NO_EXCLUDE+..\..\base\src\*.cpp,..\..\wrapper\src\*.cpp -n %wst_log_dir%\MON.sym -i m -v abld build winscw udeb >> %log_file% 2>&1 - -goto THE_END - -::----------------------------------------------------------------------------- -:RUN_TEST_CASES -::----------------------------------------------------------------------------- - -echo *** WST_MAKE: RUN_TEST_CASES: -echo *** WST_LOG: RUN_TEST_CASES >> %log_file% - -call \epoc32\release\winscw\udeb\t_wlanqtutils.exe -o c:\data\wlanqtutils_qtest_log.txt - -goto THE_END - -::----------------------------------------------------------------------------- -:GENERATE_REPORTS -::----------------------------------------------------------------------------- - -echo *** WST_MAKE: GENERATE_REPORTS: -echo *** WST_LOG: GENERATE_REPORTS >> %log_file% - -cd %wst_log_dir% - -call ctcpost -p %wst_log_dir%\ctc_coverage.txt -call ctc2html -nsb -i %wst_log_dir%\ctc_coverage.txt - -call dir /s /b %wlanqtutils_root_dir%\*.cpp > %wst_log_dir%\raw_filelist.txt - -call findstr /I /V "moc_" %wst_log_dir%\raw_filelist.txt > %wst_log_dir%\filelist.txt -call cmt -f %wst_log_dir%\filelist.txt -o cmt_metrics.txt >> %log_file% -call cmt2html -nsb -i cmt_metrics.txt - -:: Clean up temp files -call del %wst_log_dir%\*filelist.txt - -echo *** WST_MAKE: COPY LOGS: -call copy %TEMP%\epocwind.out %wst_log_dir%\epocwind.txt - -goto THE_END - -::----------------------------------------------------------------------------- -:SHOW_RESULTS -::----------------------------------------------------------------------------- - -echo *** WST_MAKE: SHOW_RESULTS: -echo *** WST_LOG: SHOW_RESULTS >> %log_file% -echo *** Module tests: -call findstr /C:"Totals: " \epoc32\winscw\c\data\wlanqtutils_qtest_log.txt -echo *** Coverage: -call findstr /C:"Number of " %wst_log_dir%\ctc_coverage.txt -call findstr /C:"TER " %wst_log_dir%\ctc_coverage.txt - -goto THE_END - -::----------------------------------------------------------------------------- -:START_BROWSER -::----------------------------------------------------------------------------- - -echo *** WST_MAKE: START_BROWSER: -echo *** WST_LOG: START_BROWSER >> %log_file% -echo. -echo Starting up browser to show the results - -start %wst_root_dir%\wst_report\coverage.html - -goto THE_END - -::----------------------------------------------------------------------------- -:ERROR -::----------------------------------------------------------------------------- - -echo *** WST_MAKE: ERROR: -endlocal -echo wst_make *** Error (unknown parameter) >> %log_file% - -goto THE_END - -::----------------------------------------------------------------------------- -:THE_END -::----------------------------------------------------------------------------- -echo *** WST_MAKE: END: diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansettingsui/group/bld.inf --- a/wlanutilities/wlansettingsui/group/bld.inf Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2001-2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Build information for the wlansettingsui -* -*/ - - -#include - -PRJ_EXPORTS - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -PRJ_MMPFILES diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/inc/wlansniffer.h --- a/wlanutilities/wlansniffer/inc/wlansniffer.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef WLANSNIFFER_H -#define WLANSNIFFER_H - -#include - -class QTranslator; -class WlanSnifferMainWindow; -class WlanQtUtils; - -class WlanSniffer : public HbApplication - { - Q_OBJECT - -public: - WlanSniffer(int argc, char* argv[]); - virtual ~WlanSniffer(); - - /** - * This function (from QObject) handles timers. Initiates a new WLAN scan. - * - * @param Unused. - */ - void timerEvent(QTimerEvent *event); - - WlanQtUtils *wlanQtUtils() const; - -private slots: - void exitApplication(); - -private: - QTranslator* mTranslator; - WlanQtUtils *mWlanQtUtils; - // Todo: why does the example use QSharedPointer for these? - WlanSnifferMainWindow *mMainWindow; // owned - int mScanTimerId; - }; - -#endif - -// End of File diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/inc/wlansnifferlistview.h --- a/wlanutilities/wlansniffer/inc/wlansnifferlistview.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef WLANSNIFFERLISTVIEW_H -#define WLANSNIFFERLISTVIEW_H - -#include -#include "wlanqtutilscommon.h" - -class HbListWidget; -class HbListWidgetItem; -class HbLabel; -class WlanSniffer; -class WlanQtUtilsWlanIap; -class WlanQtUtilsWlanAp; - -class WlanSnifferListView : public HbView - { - Q_OBJECT - -public: - WlanSnifferListView(WlanSniffer *appRef); - virtual ~WlanSnifferListView(); - - void update(); - void updateConnectionOpened(int iapId); - void updateConnectionClosed(int iapId); - -signals: - void detailsTriggered(int); - void completeServiceTriggered(); - -public slots: - void handleContextMenuClosed(); - -private slots: - void handleListItemActivated(HbListWidgetItem *item); - void handleListItemLongPressed(HbListWidgetItem *item, const QPointF &coords); - void handleListItemDisconnect(); - void handleDisconnect(); - -private: - QString signalStrengthIconChoose(int signalStrength, WlanQtUtilsWlanSecMode secMode); - HbListWidgetItem *wlanListItemIapCreate(const WlanQtUtilsWlanIap *iap); - HbListWidgetItem *wlanListItemApCreate(const WlanQtUtilsWlanAp *ap); - -private: - HbListWidget *mWlanList; - HbLabel *mStatusLabel; - WlanSniffer *mAppRef; - int mConnectingIapId; - /*! - * Data identifying the network for which the context menu has been - * opened: WlanQtUtilsAp class, or int IAP ID - */ - QVariant mContextMenuData; - HbMenu *mContextMenu; //!< Context menu reference, if one is open - }; - -#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/inc/wlansniffermainwindow.h --- a/wlanutilities/wlansniffer/inc/wlansniffermainwindow.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef WLANSNIFFERMAINWINDOW_H -#define WLANSNIFFERMAINWINDOW_H - -#include - -#include - -class HbAction; -class WlanSnifferListView; -class WlanSniffer; -class WlanSnifferService; - -class WlanSnifferMainWindow : public HbMainWindow - { - Q_OBJECT - -public: - WlanSnifferMainWindow(WlanSniffer *appRef); - virtual ~WlanSnifferMainWindow(); - -public slots: - void toListView(); - void toDetailsView(int iapId); - - void updateListView(); - void updateListViewConnectionOpened(int iapId); - void updateListViewConnectionClosed(int iapId); - -signals: - void exitTriggered(); - -private slots: - void completeService(); - -private: - // Methods to add views to the main window - void addListView(); - -private: - WlanSniffer *mAppRef; - WlanSnifferListView *mListView; - WlanSnifferService* mService; - }; - -#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/inc/wlansnifferservice.h --- a/wlanutilities/wlansniffer/inc/wlansnifferservice.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef WLANSNIFFERSERVICE_H -#define WLANSNIFFERSERVICE_H - -#include - -class WlanSnifferService: public XQServiceProvider -{ - Q_OBJECT - -public: - WlanSnifferService( QObject *parent = 0 ); - ~WlanSnifferService(); - void complete(); - -signals: - void toListView(); - void exitTriggered(); - -public slots: - void listView(); - -private: - int mAsyncRequestIndex; -}; - -#endif // WLANSNIFFERSERVICE_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/res/qgn_indi_wifi_protected_add.svg --- a/wlanutilities/wlansniffer/res/qgn_indi_wifi_protected_add.svg Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ - - - - - - - - - - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/res/qgn_indi_wlan_secure_network_add.svg --- a/wlanutilities/wlansniffer/res/qgn_indi_wlan_secure_network_add.svg Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/res/qgn_indi_wlan_signal_good_add.svg --- a/wlanutilities/wlansniffer/res/qgn_indi_wlan_signal_good_add.svg Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ - - - - - - - - - - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/res/qgn_indi_wlan_signal_low_add.svg --- a/wlanutilities/wlansniffer/res/qgn_indi_wlan_signal_low_add.svg Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/res/qgn_indi_wlan_signal_med_add.svg --- a/wlanutilities/wlansniffer/res/qgn_indi_wlan_signal_med_add.svg Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/res/qgn_prop_cmon_wlan_conn.svg --- a/wlanutilities/wlansniffer/res/qgn_prop_cmon_wlan_conn.svg Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/res/qgn_prop_wlan_bearer.svg --- a/wlanutilities/wlansniffer/res/qgn_prop_wlan_bearer.svg Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/res/service_conf.xml --- a/wlanutilities/wlansniffer/res/service_conf.xml Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ - - - WLAN Sniffer - - List View - - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/res/wlansniffer.qrc --- a/wlanutilities/wlansniffer/res/wlansniffer.qrc Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ - - - wlansnifferlistview.docml - - - - qgn_indi_wifi_protected_add.svg - qgn_indi_wlan_secure_network_add.svg - qgn_indi_wlan_signal_good_add.svg - qgn_indi_wlan_signal_low_add.svg - qgn_indi_wlan_signal_med_add.svg - qgn_prop_cmon_wlan_conn.svg - qgn_prop_wlan_bearer.svg - - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/res/wlansnifferlistview.docml --- a/wlanutilities/wlansniffer/res/wlansnifferlistview.docml Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
-
- - - -
- - - - - -
diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/rom/wlansniffer.iby --- a/wlanutilities/wlansniffer/rom/wlansniffer.iby Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef WLANSNIFFER_IBY -#define WLANSNIFFER_IBY - -#include - -#ifdef __PROTOCOL_WLAN - -file=ABI_DIR\BUILD_DIR\wlansniffer.exe PROGRAMS_DIR\wlansniffer.exe -data=\epoc32\data\z\private\10003a3f\import\Apps\wlansniffer_reg.rsc \private\10003a3f\import\apps\wlansniffer_reg.rsc -data=\epoc32\data\z\resource\apps\wlansniffer.rsc \resource\apps\wlansniffer.rsc - -#endif // __PROTOCOL_WLAN - -#endif // WLANSNIFFER_IBY diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/rom/wlansniffer_resources.iby --- a/wlanutilities/wlansniffer/rom/wlansniffer_resources.iby Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef WLANSNIFFER_RESOURCES_IBY -#define WLANSNIFFER_RESOURCES_IBY - -#include -#include - -#ifdef __PROTOCOL_WLAN - -data=DATAZ_/QT_TRANSLATIONS_DIR/wlansniffer.qm QT_TRANSLATIONS_DIR/wlansniffer.qm - -#endif // __PROTOCOL_WLAN - -#endif // WLANSNIFFER_RESOURCES_IBY diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/src/main.cpp --- a/wlanutilities/wlansniffer/src/main.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifdef WLANSNIFFER_SERVICETRACES -#include "xqservicelog.h" -#endif - -#include "qsysteminfo.h" - -#include "wlansniffer.h" - -using namespace QtMobility; - -int main(int argc, char *argv[]) -{ - // Check WLAN dynamic configuration & exit if WLAN is not enabled - QSystemInfo sysinfo; - if (!sysinfo.hasFeatureSupported(QSystemInfo::WlanFeature)) { - return -1; - } - -#ifdef WLANSNIFFER_SERVICETRACES - qInstallMsgHandler(XQSERVICEMESSAGEHANDLER); -#endif - - WlanSniffer app(argc, argv); - - return app.exec(); -} - -// End of File diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/src/wlansniffer.cpp --- a/wlanutilities/wlansniffer/src/wlansniffer.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include -#include - -#include "wlanqtutils.h" - -#include "wlansniffer.h" -#include "wlansniffermainwindow.h" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlansnifferTraces.h" -#endif - -// Scan interval is 10 seconds -const int scanTimerInterval = 10000; - -WlanSniffer::WlanSniffer(int argc, char* argv[]) : - HbApplication(argc, argv), - mWlanQtUtils(new WlanQtUtils()) -{ - OstTraceFunctionEntry0( WLANSNIFFER_WLANSNIFFER_ENTRY ); - - // Start the first scan immediately so that results are available as - // soon as possible. Start also the timer for periodic scanning. - mWlanQtUtils->scanWlans(); - mScanTimerId = startTimer(scanTimerInterval); - - // Install localization - mTranslator = new QTranslator(this); - QString lang = QLocale::system().name(); - QString path = "Z:/resource/qt/translations/"; - mTranslator->load("wlansniffer_" + lang, path); - qApp->installTranslator(mTranslator); - - mMainWindow = new WlanSnifferMainWindow(this); - - connect( - mWlanQtUtils, - SIGNAL(wlanScanReady()), - mMainWindow, - SLOT(updateListView())); - - connect( - mWlanQtUtils, - SIGNAL(wlanNetworkOpened(int)), - mMainWindow, - SLOT(updateListViewConnectionOpened(int))); - - connect( - mWlanQtUtils, - SIGNAL(wlanNetworkClosed(int)), - mMainWindow, - SLOT(updateListViewConnectionClosed(int))); - - connect( - mMainWindow, - SIGNAL(exitTriggered()), - this, - SLOT(exitApplication())); - - OstTraceFunctionExit0( WLANSNIFFER_WLANSNIFFER_EXIT ); -} - -WlanSniffer::~WlanSniffer() -{ - OstTraceFunctionEntry0( WLANSNIFFER_WLANSNIFFERDESTR_ENTRY ); - - killTimer(mScanTimerId); - - delete mMainWindow; - delete mWlanQtUtils; - - OstTraceFunctionExit0( WLANSNIFFER_WLANSNIFFERDESTR_EXIT ); -} - -void WlanSniffer::timerEvent(QTimerEvent *event) -{ - OstTraceFunctionEntry0( WLANSNIFFER_TIMEREVENT_ENTRY ); - - Q_UNUSED(event); - // Request a new scan. Timer events come periodically. - mWlanQtUtils->scanWlans(); - - OstTraceFunctionExit0( WLANSNIFFER_TIMEREVENT_EXIT ); -} - -WlanQtUtils *WlanSniffer::wlanQtUtils() const -{ - OstTraceFunctionEntry0( WLANSNIFFER_WLANQTUTILS_ENTRY ); - OstTraceFunctionExit0( WLANSNIFFER_WLANQTUTILS_EXIT ); - return mWlanQtUtils; -} - -void WlanSniffer::exitApplication() -{ - OstTraceFunctionEntry0( WLANSNIFFER_EXITAPPLICATION_ENTRY ); - - exit(); - - OstTraceFunctionExit0( WLANSNIFFER_EXITAPPLICATION_EXIT ); -} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/src/wlansnifferlistview.cpp --- a/wlanutilities/wlansniffer/src/wlansnifferlistview.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,330 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "wlanqtutils.h" -#include "wlanqtutilswlanap.h" -#include "wlanqtutilswlaniap.h" -#include "wlanqtutilscommon.h" - -#include "wlansniffer.h" -#include "wlansnifferlistview.h" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlansnifferlistviewTraces.h" -#endif - -WlanSnifferListView::WlanSnifferListView(WlanSniffer *appRef) : - mWlanList(NULL), - mStatusLabel(NULL), - mAppRef(appRef), - mConnectingIapId(0), - mContextMenu(NULL) -{ - OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_WLANSNIFFERLISTVIEW_ENTRY ); - - bool ok = false; - HbDocumentLoader loader; - loader.load(":/docml/wlansnifferlistview.docml", &ok); - Q_ASSERT_X(ok, "Wlan Sniffer", "Invalid docml file"); - - // Load the view by name from the xml file - QGraphicsWidget *widget = loader.findWidget("occ_list"); - Q_ASSERT_X(widget != 0, "Wlan Sniffer", "View not found"); - // Set the WlanListView view to be the widget that was loaded from the xml - setWidget(widget); - - HbMenu *viewMenu = qobject_cast(loader.findWidget("viewMenu")); - Q_ASSERT_X(viewMenu != 0, "Wlan Sniffer", "Menu not found"); - setMenu(viewMenu); - - mWlanList = qobject_cast(loader.findWidget("listWidget")); - Q_ASSERT_X(mWlanList != 0, "Wlan Sniffer", "List not found"); - - mStatusLabel = qobject_cast(loader.findWidget("statusLabel")); - Q_ASSERT_X(mStatusLabel != 0, "Wlan Sniffer", "Label not found"); - - connect( - mWlanList, - SIGNAL(activated(HbListWidgetItem *)), - this, - SLOT(handleListItemActivated(HbListWidgetItem *))); - connect( - mWlanList, - SIGNAL(longPressed(HbListWidgetItem *, const QPointF &)), - this, - SLOT(handleListItemLongPressed(HbListWidgetItem *, const QPointF &))); - - // Set correct orientation when drawing view first time. Orientation change - // on the fly is not yet implemented - if (HbInstance::instance()->allMainWindows().value(0)->orientation() == Qt::Horizontal) { - bool loaded = false; - loader.load( ":/docml/wlansnifferlistview.docml", "landscape", &loaded ); - } // else: portrait is ok by default - - // We need to create a custom navigation action in case the application was - // launched as embedded via QtHighway - if (XQServiceUtil::isEmbedded()) { - HbAction *completeAction = new HbAction(Hb::BackNaviAction, this); - setNavigationAction(completeAction); - connect( - completeAction, - SIGNAL(triggered(bool)), - this, - SIGNAL(completeServiceTriggered())); - // TODO: What to do when exit action is ran? Should we close whole control panel? - } - - OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_WLANSNIFFERLISTVIEW_EXIT ); -} - -WlanSnifferListView::~WlanSnifferListView() -{ - OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_WLANSNIFFERLISTVIEWDESTR_ENTRY ); - OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_WLANSNIFFERLISTVIEWDESTR_EXIT ); -} - -void WlanSnifferListView::update() -{ - OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_UPDATE_ENTRY ); - - // Do not update list while the context menu is open - if (mContextMenu == NULL) { - QList aps; - QList iaps; - - mAppRef->wlanQtUtils()->availableWlanAps(iaps, aps); - - mWlanList->clear(); - - // Loop the IAPs and APs and create the list items (lists are ordered already by Wlan Qt Utilities) - foreach (WlanQtUtilsWlanIap *iap, iaps) { - mWlanList->addItem(wlanListItemIapCreate(iap)); - } - // Loop the AP's and create the list items - foreach (WlanQtUtilsWlanAp *ap, aps) { - mWlanList->addItem(wlanListItemApCreate(ap)); - } - } - - OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_UPDATE_EXIT ); -} - -void WlanSnifferListView::updateConnectionOpened(int iapId) -{ - OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_UPDATECONNECTIONOPENED_ENTRY ); - - mStatusLabel->setPlainText( - hbTrId("txt_occ_grid_connected_to_1").arg(mAppRef->wlanQtUtils()->iap(iapId)->name())); - // Redraw the list so that the connected network moves on top - update(); - mConnectingIapId = 0; - - OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_UPDATECONNECTIONOPENED_EXIT ); -} - -void WlanSnifferListView::updateConnectionClosed(int iapId) -{ - OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_UPDATECONNECTIONCLOSED_ENTRY ); - - (void)iapId; - mStatusLabel->setPlainText(hbTrId("txt_occ_grid_not_connected")); - mConnectingIapId = 0; - - OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_UPDATECONNECTIONCLOSED_EXIT ); -} - -void WlanSnifferListView::handleContextMenuClosed() -{ - OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_HANDLECONTEXTMENUCLOSED_ENTRY ); - - // Menu deletes itself, but we need to cleanup the member variable - // in order to enable list updating again - mContextMenu = NULL; - - OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_HANDLECONTEXTMENUCLOSED_EXIT ); -} - -void WlanSnifferListView::handleListItemActivated(HbListWidgetItem *item) -{ - OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_HANDLELISTITEMACTIVATED_ENTRY ); - - QVariant data = item->data(); - if (data.canConvert()) { - // Item was an IAP. Connect the IAP or show details view depending on connection state - WlanQtUtilsIap *iap = mAppRef->wlanQtUtils()->iap(data.toInt()); - if (iap->connectionStatus() == WlanQtUtilsConnectionStatusConnected) { - // Switch to details view - emit detailsTriggered(data.toInt()); - } else { - // Connect the IAP - mConnectingIapId = iap->id(); - mStatusLabel->setPlainText(hbTrId("txt_occ_grid_connecting_to_1").arg(iap->name())); - mAppRef->wlanQtUtils()->connectIap(mConnectingIapId); - } - } else { - // Item has to be a WLAN AP, which can't already be connected. Create an IAP and connect it. - Q_ASSERT(data.canConvert()); - WlanQtUtilsWlanAp ap = data.value(); - mConnectingIapId = mAppRef->wlanQtUtils()->createWlanIap(&ap); - WlanQtUtilsIap *iap = mAppRef->wlanQtUtils()->iap(mConnectingIapId); - Q_ASSERT(iap); - mStatusLabel->setPlainText(hbTrId("txt_occ_grid_connecting_to_1").arg(iap->name())); - mAppRef->wlanQtUtils()->connectIap(mConnectingIapId); - } - - OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_HANDLELISTITEMACTIVATED_EXIT ); -} - -void WlanSnifferListView::handleListItemLongPressed(HbListWidgetItem *item, const QPointF &coords) -{ - OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_HANDLELISTITEMLONGPRESSED_ENTRY ); - - Q_ASSERT(mContextMenu == NULL); - - if (item->data().canConvert() && item->data().toInt() == - mAppRef->wlanQtUtils()->connectedWlanId()) { - // Connected IAP, add "Disconnect" action - mContextMenu = new HbMenu(); - // Remember the item that was long pressed - mContextMenuData = item->data(); - mContextMenu->addAction( - hbTrId("txt_common_menu_disconnect"), - this, - SLOT(handleListItemDisconnect())); - // Show the menu and connect closure signal (to re-enable list refreshing) - bool connectStatus = connect( - mContextMenu, - SIGNAL(aboutToClose()), - this, - SLOT(handleContextMenuClosed())); - Q_ASSERT(connectStatus); - mContextMenu->setAttribute(Qt::WA_DeleteOnClose); - mContextMenu->setTimeout(HbPopup::ContextMenuTimeout); - mContextMenu->setPreferredPos(coords); - mContextMenu->show(); - } - - OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_HANDLELISTITEMLONGPRESSED_EXIT ); -} - -/*! - Handles a "Disconnect" action selected from the context menu for a list item. - */ -void WlanSnifferListView::handleListItemDisconnect() -{ - OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_HANDLELISTITEMDISCONNECT_ENTRY ); - - // "Disconnect" was only added, if the item was an IAP and data was - // the IAP ID - Q_ASSERT(mContextMenuData.canConvert()); - mAppRef->wlanQtUtils()->disconnectIap(mContextMenuData.toInt()); - - OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_HANDLELISTITEMDISCONNECT_EXIT ); -} - -// Todo: This is a temporary solution - real WLAN status indication & listening -// is implemented later on. -void WlanSnifferListView::handleDisconnect() -{ - OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_HANDLEDISCONNECT_ENTRY ); - - mStatusLabel->setPlainText(hbTrId("txt_occ_grid_not_connected")); - // Redraw the list so that disconnected network is not shown anymore - update(); - - OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_HANDLEDISCONNECT_EXIT ); -} - -// Todo: no place for separate secure WLAN icon in the widget -> custom layout needed? -// Todo: check the signal strength values -QString WlanSnifferListView::signalStrengthIconChoose(int signalStrength, WlanQtUtilsWlanSecMode secMode) -{ - (void)secMode; - QString iconName; - if (signalStrength <= WlanQtUtilsWlanSignalStrengthGood) { - iconName = "qtg_small_signal_good"; - } else if (signalStrength <= WlanQtUtilsWlanSignalStrengthLow) { - iconName = "qtg_small_signal_medium"; - } else { - iconName = "qtg_small_signal_low"; - } - - return iconName; -} - -HbListWidgetItem *WlanSnifferListView::wlanListItemIapCreate(const WlanQtUtilsWlanIap *iap) -{ - OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_WLANLISTITEMIAPCREATE_ENTRY ); - - HbListWidgetItem* item = new HbListWidgetItem(); - item->setText(iap->name()); -#if 1 // TODO: How to show secure/open network info?? - if (iap->securityMode() == WlanQtUtilsWlanSecModeOpen) { - item->setSecondaryText("Open"); - } else { - item->setSecondaryText("Secure"); - } -#endif - - if (iap->connectionStatus() == WlanQtUtilsConnectionStatusConnected) { - item->setIcon(HbIcon("qtg_small_online")); - } else { - item->setIcon(HbIcon("qtg_small_wlan")); - } - item->setSecondaryIcon(HbIcon(signalStrengthIconChoose(iap->signalStrength(), iap->securityMode()))); - QVariant data(iap->id()); - item->setData(data); - - OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_WLANLISTITEMIAPCREATE_EXIT ); - return item; -} - -HbListWidgetItem *WlanSnifferListView::wlanListItemApCreate(const WlanQtUtilsWlanAp *ap) -{ - OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_WLANLISTITEMAPCREATE_ENTRY ); - - HbListWidgetItem* item = new HbListWidgetItem(); - item->setText(ap->ssid()); -#if 1 // TODO: How to show secure/open network info?? - if (ap->securityMode() == WlanQtUtilsWlanSecModeOpen) { - item->setSecondaryText("Open"); - } else { - item->setSecondaryText("Secure"); - } -#endif - item->setSecondaryIcon(HbIcon(signalStrengthIconChoose(ap->signalStrength(), ap->securityMode()))); - QVariant data; - data.setValue(*ap); - item->setData(data); - - OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_WLANLISTITEMAPCREATE_EXIT ); - return item; -} - -// End of File diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/src/wlansniffermainwindow.cpp --- a/wlanutilities/wlansniffer/src/wlansniffermainwindow.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include - -#include "wlansniffermainwindow.h" -#include "wlansnifferlistview.h" -#include "wlansnifferservice.h" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlansniffermainwindowTraces.h" -#endif - - -WlanSnifferMainWindow::WlanSnifferMainWindow(WlanSniffer *appRef) : - mAppRef(appRef), - mService(0) -{ - OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_WLANSNIFFERMAINWINDOW_ENTRY ); - - mService = new WlanSnifferService(this); - connect(mService,SIGNAL(toListView()),this,SLOT(toListView())); - connect(mService,SIGNAL(returnValueDelivered()),this,SIGNAL(exitTriggered())); - - // Add the views to the main window - addListView(); - - // Check if sniffer is used via a service - if (!XQServiceUtil::isEmbedded()) { - // Show the main window (which will display the first view that was added) - show(); - } - - OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_WLANSNIFFERMAINWINDOW_EXIT ); -} - -WlanSnifferMainWindow::~WlanSnifferMainWindow() -{ - OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_WLANSNIFFERMAINWINDOWDESTR_ENTRY ); - OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_WLANSNIFFERMAINWINDOWDESTR_EXIT ); -} - -void WlanSnifferMainWindow::toListView() -{ - OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_TOLISTVIEW_ENTRY ); - - setCurrentView(mListView); - show(); - - OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_TOLISTVIEW_EXIT ); -} - -void WlanSnifferMainWindow::toDetailsView(int iapId) -{ - OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_TODETAILSVIEW_ENTRY ); - - // TODO: Launch details view via QtHighway?? - (void)iapId; - - OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_TODETAILSVIEW_EXIT ); -} - -void WlanSnifferMainWindow::updateListView() -{ - OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_UPDATELISTVIEW_ENTRY ); - - mListView->update(); - - OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_UPDATELISTVIEW_EXIT ); -} - -void WlanSnifferMainWindow::updateListViewConnectionOpened(int iapId) -{ - OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_UPDATELISTVIEWCONNECTIONOPENED_ENTRY ); - - mListView->updateConnectionOpened(iapId); - - OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_UPDATELISTVIEWCONNECTIONOPENED_EXIT ); -} - -void WlanSnifferMainWindow::updateListViewConnectionClosed(int iapId) -{ - OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_UPDATELISTVIEWCONNECTIONCLOSED_ENTRY ); - - mListView->updateConnectionClosed(iapId); - - OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_UPDATELISTVIEWCONNECTIONCLOSED_EXIT ); -} - -void WlanSnifferMainWindow::completeService() -{ - OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_COMPLETESERVICE_ENTRY ); - - mService->complete(); - - OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_COMPLETESERVICE_EXIT ); -} - -void WlanSnifferMainWindow::addListView() -{ - OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_ADDLISTVIEW_ENTRY ); - - mListView = new WlanSnifferListView(mAppRef); - addView(mListView); - - bool connectStatus = connect( - mListView, - SIGNAL(detailsTriggered(int)), - this, - SLOT(toDetailsView(int))); - Q_ASSERT(connectStatus == true); - connectStatus = connect( - mListView, - SIGNAL(completeServiceTriggered()), - this, - SLOT(completeService())); - Q_ASSERT(connectStatus == true); - - OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_ADDLISTVIEW_EXIT ); -} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/src/wlansnifferservice.cpp --- a/wlanutilities/wlansniffer/src/wlansnifferservice.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "wlansnifferservice.h" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlansnifferserviceTraces.h" -#endif - - -WlanSnifferService::WlanSnifferService(QObject* parent) - : XQServiceProvider("com.nokia.services.wlansniffer.list", parent) -{ - OstTraceFunctionEntry0( WLANSNIFFERSERVICE_WLANSNIFFERSERVICE_ENTRY ); - - publishAll(); - - OstTraceFunctionExit0( WLANSNIFFERSERVICE_WLANSNIFFERSERVICE_EXIT ); -} - -WlanSnifferService::~WlanSnifferService() -{ - OstTraceFunctionEntry0( WLANSNIFFERSERVICE_WLANSNIFFERSERVICEDESTR_ENTRY ); - OstTraceFunctionExit0( WLANSNIFFERSERVICE_WLANSNIFFERSERVICEDESTR_EXIT ); -} - -void WlanSnifferService::complete() -{ - OstTraceFunctionEntry0( WLANSNIFFERSERVICE_COMPLETE_ENTRY ); - - QVariant returnValue(true); - bool status = completeRequest(mAsyncRequestIndex, returnValue); - Q_ASSERT(status); - - OstTraceFunctionExit0( WLANSNIFFERSERVICE_COMPLETE_EXIT ); -} - -void WlanSnifferService::listView() -{ - OstTraceFunctionEntry0( WLANSNIFFERSERVICE_LISTVIEW_ENTRY ); - - mAsyncRequestIndex = setCurrentRequestAsync(); - emit toListView(); - - OstTraceFunctionExit0( WLANSNIFFERSERVICE_LISTVIEW_EXIT ); -} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/traces/OstTraceDefinitions.h --- a/wlanutilities/wlansniffer/traces/OstTraceDefinitions.h Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ - -#ifndef __OSTTRACEDEFINITIONS_H__ -#define __OSTTRACEDEFINITIONS_H__ -#include -#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansniffer.pro --- a/wlanutilities/wlansniffer/wlansniffer.pro Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlansniffer/wlansniffer.pro Thu Jul 22 16:44:32 2010 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available # under the terms of "Eclipse Public License v1.0" @@ -12,52 +12,16 @@ # Contributors: # # Description: +# WLAN Sniffer project file. # -TEMPLATE = app -TARGET = wlansniffer -TARGET.CAPABILITY = ALL -TCB -DEPENDPATH += . -# Own headers -INCLUDEPATH += inc \ - traces -# wlanutilities Private API -INCLUDEPATH += ../inc -CONFIG += hb no_icon service - -#Store generated .moc files to their own directory -MOC_DIR = moc - -TRANSLATIONS = wlansniffer.ts - -# Input -SOURCES += src/main.cpp \ - src/wlansniffer.cpp \ - src/wlansnifferlistview.cpp \ - src/wlansniffermainwindow.cpp \ - src/wlansnifferservice.cpp +TEMPLATE = subdirs -HEADERS += inc/wlansniffer.h \ - inc/wlansnifferlistview.h \ - inc/wlansniffermainwindow.h \ - inc/wlansnifferservice.h \ - traces/OstTraceDefinitions.h - -RESOURCES = res/wlansniffer.qrc - -SERVICE.FILE = res/service_conf.xml -SERVICE.OPTIONS = embeddable +SUBDIRS += \ + wlansnifferapplication + +CONFIG += ordered -symbian*::LIBS += -lwlanqtutilities -lxqservice -lxqserviceutil -lqtsysteminfo - -symbian*: { - TARGET.UID3 = 0x10281CAA - SYMBIAN_PLATFORMS = WINSCW ARMV5 - BLD_INF_RULES.prj_exports += "rom/wlansniffer.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wlansniffer.iby)" - BLD_INF_RULES.prj_exports += "rom/wlansniffer_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(wlansniffer_resources.iby)" - addFiles.sources = /epoc32/release/$(PLATFORM)/$(CFG)/wlanqtutilities.dll xqservice.dll xqserviceutil.dll - addFiles.path = /sys/bin - DEPLOYMENT += addFiles - # Enable for QtHighway tracing - # DEFINES += WLANSNIFFER_SERVICETRACES -} +# This enables compiling also the Symbian component from this level +BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include \"./wlansnifferkeepalive/group/bld.inf\"" diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansniffer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansniffer.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Sniffer application main class. +*/ + +#ifndef WLANSNIFFER_H +#define WLANSNIFFER_H + +// System includes + +#include +#include + +// User includes + +// Forward declarations + +class WlanSnifferEngine; +class HbTranslator; +class WlanSnifferMainWindow; + +// External data types + +// Constants + +// Class declaration + +class WlanSniffer : public HbApplication +{ + Q_OBJECT + +public: + + // Data types + + WlanSniffer(int argc, char* argv[]); + + ~WlanSniffer(); + +signals: + +public slots: + +protected: + +protected slots: + +private: + + Q_DISABLE_COPY(WlanSniffer) + + bool findKeepaliveProcess(); + +private slots: + + void exitApplication(); + +private: // data + + // Not owned data + + // Owned data + WlanSnifferEngine *mEngine; //!< Sniffer engine + QSharedPointer mTranslator; //!< Translator for localisation + QSharedPointer mMainWindow; //!< Main window instance + + // Friend classes +}; + +#endif // WLANSNIFFER_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferengine.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,154 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Sniffer application engine. +*/ + +#ifndef WLANSNIFFERENGINE_H +#define WLANSNIFFERENGINE_H + +// System includes + +#include +#include +#include +#include + +// User includes + +#include "wlanqtutils.h" + +// Forward declarations + +class WlanSnifferService; +class XQSettingsManager; + +// External data types + +// Constants + +// Class declaration + +class WlanSnifferEngine : public QObject +{ + Q_OBJECT + +public: + + // Data types + + explicit WlanSnifferEngine(QObject *parent = 0); + + ~WlanSnifferEngine(); + + WlanQtUtils *wlanQtUtils() const; + + bool isEmbedded() const; + + void startWlanScanning(); + + void stopWlanScanning(); + + bool masterWlan() const; + + void setMasterWlan(bool enabled); + + bool forceDisableWlan() const; + + bool offlineMode() const; + +signals: + + /*! + Signal indicating that WLAN scan results are available. + */ + void wlanScanReady(); + + /*! + Signal to inform that List View is requested. + + @param [in] title Window title. + */ + void toListView(const QString &title); + + /*! + Signal to inform that application exit was requested. + */ + void exitTriggered(); + + /*! + Signal indicating that the WLAN master status has changed. + + @param [in] enabled Master WLAN status: true if enabled. + */ + void masterWlanStatus(bool enabled); + + /*! + Signal indicating that the force disable WLAN status has changed. + + @param [in] disabled Force disable WLAN status: true if disabled. + */ + void forceDisableWlanStatus(bool disabled); + +public slots: + + void completeService(); + +protected: + + void timerEvent(QTimerEvent *event); + +protected slots: + +private: + + Q_DISABLE_COPY(WlanSnifferEngine) + +private slots: + + void updateSetting(const XQSettingsKey &key, const QVariant &value); + + void handleWlanScanReady(int status); + +private: // data + + // Not owned data + + //! WLAN Sniffer service + WlanSnifferService *mService; + + //! Settings manager for platform settings reading, writing & status changes. + XQSettingsManager *mSettingsManager; + + // Owned data + + //! Scan interval is 10 seconds + static const int scanTimerInterval = 10000; + + //! WLAN scan timer ID + int mScanTimerId; + + //! TRUE if scanning has been enabled + bool mScanEnabled; + + //! TRUE if embedded + bool mEmbedded; + + //! WLAN Qt Utils instance + QSharedPointer mWlanQtUtils; + + // Friend classes +}; + +#endif // WLANSNIFFERENGINE_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferlistitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferlistitem.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Sniffer list view list widget item. +*/ + +#ifndef WLANSNIFFERLISTITEM_H +#define WLANSNIFFERLISTITEM_H + +// System includes + +#include +#include + +// User includes + +// Forward declarations + +// External data types + +// Constants + +// Class declaration + +class WlanSnifferListItem : public HbListWidgetItem +{ + +public: + + // Data types + + WlanSnifferListItem(); + + ~WlanSnifferListItem(); + + void setNetworkName(const QString &text); + + void setLeftIcon(const QString &icon); + + void setSignalIcon(const QString &icon); + + void setSecureIcon(const QString &icon); + +signals: + +public slots: + +protected: + +protected slots: + +private: + + Q_DISABLE_COPY(WlanSnifferListItem) + +private slots: + +private: // data + + // Friend classes +}; + +#endif // WLANSNIFFERLISTITEM_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferlistview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferlistview.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,157 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Sniffer List View. +*/ + +#ifndef WLANSNIFFERLISTVIEW_H +#define WLANSNIFFERLISTVIEW_H + +// System includes + +#include +#include +#include +#include +#include + +// User includes + +// Forward declarations + +class HbDocumentLoader; +class HbListWidget; +class HbListWidgetItem; +class HbLabel; +class HbPushButton; +class WlanSnifferMainWindow; +class WlanSnifferListWidget; +class WlanSnifferEngine; +class WlanQtUtilsAp; + +// External data types + +// Constants + +// Class declaration + +class WlanSnifferListView : public HbView +{ + Q_OBJECT + +public: + + // Data types + + WlanSnifferListView( + WlanSnifferEngine *engine, + WlanSnifferMainWindow *mainWindow); + + ~WlanSnifferListView(); + +signals: + + /*! + Signal for triggering WLAN Wizard start. + + @param [in] ap WLAN access point. + */ + + void wizardTriggered(const WlanQtUtilsAp *ap); + +public slots: + +protected: + +protected slots: + +private: + + Q_DISABLE_COPY(WlanSnifferListView) + + void loadDocml(bool isEmbedded); + + void updateWlanStatusLabel(bool enabled); + + void handleConnect(QVariant data); + +private slots: + + void updateListContent(); + + void updateWlanEnabled(); + + void updateConnectionOpened(int iapId); + + void updateConnectionClosed(int iapId); + + void handleContextMenuClosed(); + + void handleListItemActivated(HbListWidgetItem *item); + + void handleListItemLongPressed( + HbListWidgetItem *item, + const QPointF &coords); + + void handleListItemConnect(); + + void handleListItemDisconnect(); + + void handleWlanToggled(); + + void startWlanWizard(); + + void handleWlanEnableDialogClosed(HbAction *action); + +private: // data + + // Owned data + + //! Document loader for list view + QScopedPointer mDocLoader; + //! WLAN Sniffer list view custom widget + QSharedPointer mWlanListWidget; + //! Context menu reference, if one is open + QSharedPointer mContextMenu; + /*! + Data identifying the network for which the context menu has been + opened: WlanQtUtilsAp class, or int IAP ID. + */ + QVariant mContextMenuData; + //! WLAN enabling in airplane mode dialog + QSharedPointer mWlanEnableDialog; + //! Flag for handling WLAN scan result update ignoring + bool mIgnoreWlanScanResults; + //! ID of the IAP we are currently connecting + int mConnectingIapId; + + // Not owned data + + //! WLAN Sniffer engine + WlanSnifferEngine *mEngine; + //! WLAN ON/OFF switch action + HbAction *mSwitchWlanAction; + //! Add WLAN manually action + HbAction *mAddWlanAction; + //! WLAN Sniffer list view widget + HbListWidget *mWlanList; + //! WLAN Status label + HbLabel *mStatusLabel; + //! WLAN ON/OFF button + HbPushButton *mWlanButton; + + // Friend classes +}; + +#endif // WLANSNIFFERLISTVIEW_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferlistwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferlistwidget.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Sniffer list widget class. +*/ + +#ifndef WLANSNIFFERLISTWIDGET_H +#define WLANSNIFFERLISTWIDGET_H + +// System includes + +#include +#include +#include + +// User includes + +// Forward declarations + +class HbListWidget; +class HbListWidgetItem; +class WlanSnifferListItem; +class WlanQtUtilsIap; +class WlanQtUtilsAp; + +// External data types + +// Constants + +// Class declaration + +class WlanSnifferListWidget +{ + +public: + + // Data types + + /*! + Signal strength category boundaries in dB (absolute value). + Smaller value means better signal. + */ + enum + { + SignalStrengthHigh = 65, //!< High signal strength + SignalStrengthMedium = 79 //!< Medium signal strength + }; + + explicit WlanSnifferListWidget(HbListWidget *listWidget); + + virtual ~WlanSnifferListWidget(); + + void updateContent( + QList< QSharedPointer > &iaps, + QList< QSharedPointer > &aps, + int connectedIapId); + + void scrollTo(int row); + +signals: + +public slots: + +protected: + +protected slots: + +private: + + Q_DISABLE_COPY(WlanSnifferListWidget) + + void sortIaps( + QList< QSharedPointer > &iaps, + int connectedIapId); + + void sortAps( + QList< QSharedPointer > &aps); + + static bool iapLessThan( + const QSharedPointer iap1, + const QSharedPointer iap2); + + static bool apLessThan( + const QSharedPointer ap1, + const QSharedPointer ap2); + + WlanSnifferListItem *findFromOldList(QSharedPointer iap); + + WlanSnifferListItem *findFromOldList(QSharedPointer ap); + + HbListWidgetItem *listItemCreate( + QSharedPointer iap, + int connectedIapId); + + HbListWidgetItem *listItemCreate(QSharedPointer ap); + + QString signalStrengthIconChoose(int signalStrength); + + QString leftIconChoose(int iapId, int connectedIapId); + + void removeLostItems( + const QList< QSharedPointer > &iaps, + const QList< QSharedPointer > &aps); + + void addDiscoveredItemsAndUpdateRest( + const QList< QSharedPointer > &iaps, + const QList< QSharedPointer > &aps, + int connectedIapId); + + void traceListContent() const; + +private slots: + +private: // data + + // Not owned data + HbListWidget *mListWidget; //!< WLAN list view widget + + // Owned data + + // Friend classes +}; + +#endif // WLANSNIFFERLISTWIDGET_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansniffermainwindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansniffermainwindow.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Sniffer main window. +*/ + +#ifndef WLANSNIFFERMAINWINDOW_H +#define WLANSNIFFERMAINWINDOW_H + +// System includes + +#include +#include +#include +#include + +// User includes + +#include "wlansniffer.h" + +// Forward declarations + +class WlanWizard; +class WlanSnifferListView; +class WlanQtUtilsAp; +class WlanSnifferEngine; + +// External data types + +// Constants + +// Class declaration + +class WlanSnifferMainWindow : public HbMainWindow +{ + Q_OBJECT + +public: + + // Data types + + explicit WlanSnifferMainWindow(WlanSnifferEngine *engine); + + ~WlanSnifferMainWindow(); + +signals: + +public slots: + + void toListView(const QString &title); + +protected: + +protected slots: + +private: + + Q_DISABLE_COPY(WlanSnifferMainWindow) + + void addListView(); + +private slots: + + void startWlanWizard(const WlanQtUtilsAp *ap); + + void handleWlanWizardComplete(int iapId, bool connected); + + void handleWlanWizardCancelled(); + +private: // data + + // Owned data + + QSharedPointer mWizard; //!< WLAN Wizard object + WlanSnifferListView *mListView; //!< List view object + + // Not owned data + + WlanSnifferEngine *mEngine; //!< WLAN Sniffer engine + + // Friend classes +}; + +#endif // WLANSNIFFERMAINWINDOW_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferservice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferservice.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Sniffer QtHighway Service. +*/ + +#ifndef WLANSNIFFERSERVICE_H +#define WLANSNIFFERSERVICE_H + +// System includes + +#include +#include + +// User includes + +// Forward declarations + +// External data types + +// Constants + +// Class declaration +class WlanSnifferService: public XQServiceProvider +{ + Q_OBJECT + +public: + + // Data types + + explicit WlanSnifferService(QObject *parent = 0); + + ~WlanSnifferService(); + + void complete(); + +signals: + + /*! + Signal to inform WLAN Sniffer that List View is requested. + + @param [in] title Window title. + */ + void toListView(const QString &title); + + /*! + Signal to inform WLAN Sniffer that exit was requested. + */ + void exitTriggered(); + +public slots: + + void listView(); + +protected: + +protected slots: + +private: + + Q_DISABLE_COPY(WlanSnifferService) + + QString title() const; + +private slots: + +private: // data + + // Not owned data + + // Owned data + int mAsyncRequestIndex; //!< Service request ID + + // Friend classes +}; + +#endif // WLANSNIFFERSERVICE_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/res/hblistviewitem.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/res/hblistviewitem.css Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,26 @@ + +HbListViewItem[layoutName="wlanlistitem"]{ + layout:wlanlistitem; +} + +HbListViewItem::icon-1[layoutName="wlanlistitem"]{ + fixed-height: var(hb-param-graphic-size-primary-small); + fixed-width: var(hb-param-graphic-size-primary-small); +} + +HbListViewItem::text-1[layoutName="wlanlistitem"]{ + text-height: var(hb-param-text-height-primary); + font-variant: primary; + pref-width:-1; + text-align: left; +} + +HbListViewItem::icon-2[layoutName="wlanlistitem"]{ + fixed-height: var(hb-param-graphic-size-secondary); + fixed-width: var(hb-param-graphic-size-secondary); +} + +HbListViewItem::icon-3[layoutName="wlanlistitem"]{ + fixed-height: var(hb-param-graphic-size-secondary); + fixed-width: var(hb-param-graphic-size-secondary); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/res/hblistviewitem.widgetml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/res/hblistviewitem.widgetml Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/res/listview.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/res/listview.css Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,6 @@ +/* WLAN status label in list view. */ +HbLabel#statusLabel::text { + /* Status label should take no more than two rows. */ + text-line-count-min: 1; + text-line-count-max: 2; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/res/service_conf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/res/service_conf.xml Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,11 @@ + + + wlansniffer + No path + WLAN Sniffer + + com.nokia.symbian.IWlanSniffer + 1.0 + WLAN Sniffer List View + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/res/wlansniffer.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/res/wlansniffer.qrc Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,12 @@ + + + + wlansnifferlistview.docml + + + + listview.css + hblistviewitem.css + hblistviewitem.widgetml + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/res/wlansnifferlistview.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/res/wlansnifferlistview.docml Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+
+ + + + + + + + + + + + + +
+ + + + + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/rom/wlansniffer.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/rom/wlansniffer.iby Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Sniffer Application iby. +*/ + +#ifndef WLANSNIFFER_IBY +#define WLANSNIFFER_IBY + +#include + +#ifdef __PROTOCOL_WLAN + +#define UPGRADABLE_APP_REG_RSC(NAME) data=DATAZ_\PRIVATE\10003A3F\IMPORT\APPS\ ## NAME ## _reg.rsc Private\10003a3f\import\apps\ ## NAME ## _reg.rsc + +S60_APP_EXE(wlansniffer) +S60_APP_RESOURCE(wlansniffer) +UPGRADABLE_APP_REG_RSC(wlansniffer) + +#endif // __PROTOCOL_WLAN + +#endif // WLANSNIFFER_IBY diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/rom/wlansniffer_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/rom/wlansniffer_resources.iby Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Sniffer Application resource iby. +*/ + +#ifndef WLANSNIFFER_RESOURCES_IBY +#define WLANSNIFFER_RESOURCES_IBY + +#include +#include + +#ifdef __PROTOCOL_WLAN + +data=DATAZ_/QT_TRANSLATIONS_DIR/wlansniffer.qm QT_TRANSLATIONS_DIR/wlansniffer.qm + +#endif // __PROTOCOL_WLAN + +#endif // WLANSNIFFER_RESOURCES_IBY diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/src/main.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Sniffer application main function. +*/ + +// System includes + +#ifdef WLANSNIFFER_SERVICETRACES +#include +#endif +#include + +// User includes + +#include "wlansniffer.h" + +// External function prototypes + +// Local constants + +int main(int argc, char *argv[]) +{ + // Check WLAN dynamic configuration & exit if WLAN is not enabled + QtMobility::QSystemInfo sysinfo; + if (!sysinfo.hasFeatureSupported(QtMobility::QSystemInfo::WlanFeature)) { + return -1; + } + +#ifdef WLANSNIFFER_SERVICETRACES + qInstallMsgHandler(XQSERVICEMESSAGEHANDLER); +#endif + + WlanSniffer app(argc, argv); + + return app.exec(); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/src/wlansniffer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansniffer.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,159 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Sniffer application main class implementation. +*/ + +// System includes + +#include +#include +#include +#include + +// User includes + +#include "wlansnifferengine.h" +#include "wlansniffermainwindow.h" +#include "wlansniffer.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlansnifferTraces.h" +#endif + +/*! + \class WlanSniffer + \brief WLAN Sniffer main class implementation. +*/ + +// External function prototypes + +// Local constants + +//! Location of WLAN Sniffer custom layout definitions +static const QString WlanSnifferLayoutPath(":/wlansnifferlayout/"); + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. + + @param [in] argc Parameter count. + @param [in] argv Parameters. + */ + +WlanSniffer::WlanSniffer(int argc, char* argv[]) : + HbApplication(argc, argv), + mEngine(new WlanSnifferEngine(this)), + mTranslator(), + mMainWindow(0) +{ + OstTraceFunctionEntry0(WLANSNIFFER_WLANSNIFFER_ENTRY); + + // Start scanning immediately to get the first scan results as soon as + // possible, since the scanning takes time. + if (mEngine->masterWlan() && !mEngine->forceDisableWlan()) { + mEngine->startWlanScanning(); + } + + // Register custom layout location + HbStyleLoader::registerFilePath(WlanSnifferLayoutPath); + + // Install localization + mTranslator = QSharedPointer(new HbTranslator()); + mTranslator->loadCommon(); + + mMainWindow = QSharedPointer( + new WlanSnifferMainWindow(mEngine)); + + // Connect exit handling + bool connectStatus = connect( + mEngine, + SIGNAL(exitTriggered()), + this, + SLOT(exitApplication())); + Q_ASSERT(connectStatus); + + // Start the Wlan Sniffer Keepalive process, if not started yet + // The purpose of the process is to manage Wlan links opened + // by this application, and the process should be running always + // after the first launch of this application. + if (findKeepaliveProcess() == false) { + QProcess::startDetached("wlansnifferkeepalive"); + } + + OstTraceFunctionExit0(WLANSNIFFER_WLANSNIFFER_EXIT); +} + +/*! + Destructor. + */ + +WlanSniffer::~WlanSniffer() +{ + OstTraceFunctionEntry0(WLANSNIFFER_WLANSNIFFERDESTR_ENTRY); + + HbStyleLoader::unregisterFilePath(WlanSnifferLayoutPath); + + OstTraceFunctionExit0(WLANSNIFFER_WLANSNIFFERDESTR_EXIT); +} + +/*! + Function for finding possible running keepalive process. + + @return TRUE if a keepalive process was found running. + */ + +bool WlanSniffer::findKeepaliveProcess() +{ + OstTraceFunctionEntry0(WLANSNIFFER_FINDKEEPALIVEPROCESS_ENTRY); + + // Try to search the keepalive process + bool found = false; + TFileName executableName; + executableName.Copy(_L("wlansnifferkeepalive*")); + TFindProcess processSearch; + TFullName processFullName; + while (processSearch.Next(processFullName) == KErrNone) { + if (processFullName.Match(executableName) != KErrNotFound) { + found = true; + break; + } + } + + OstTraceExt1( + TRACE_NORMAL, + WLANSNIFFER_FINDKEEPALIVEPROCESS_RESULT, + "WlanSniffer::findKeepaliveProcess;found=%hhu", + found); + + OstTraceFunctionExit0(WLANSNIFFER_FINDKEEPALIVEPROCESS_EXIT); + return found; +} + +/*! + Slot for handling application exit. + */ + +void WlanSniffer::exitApplication() +{ + OstTraceFunctionEntry0(WLANSNIFFER_EXITAPPLICATION_ENTRY); + + exit(); + + OstTraceFunctionExit0(WLANSNIFFER_EXITAPPLICATION_EXIT); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferengine.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,448 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Sniffer application engine. +*/ + +// System includes + +#include + +#include +#include +#include +#include + +// User includes + +#include "wlanqtutils.h" +#include "wlansnifferservice.h" +#include "wlansnifferengine.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlansnifferengineTraces.h" +#endif + +/*! + \class WlanSnifferEngine + \brief WLAN Sniffer application engine. + + This class implements the WLAN Sniffer application engine. + The purpose of the engine implementation is to gather all non-UI + implementation base functionality into one place that can be utilized + from multiple places (i.e. multiple views and windows). +*/ + + +// External function prototypes + +// Local constants + +//! Master WLAN ON/OFF setting key +static const XQSettingsKey masterWlanKey( + XQSettingsKey::TargetCentralRepository, + KCRUidWlanDeviceSettingsRegistryId.iUid, + KWlanOnOff); + +//! WLAN forced OFF setting key +static const XQSettingsKey wlanForceKey( + XQSettingsKey::TargetCentralRepository, + KCRUidWlanDeviceSettingsRegistryId.iUid, + KWlanForceDisable); + +//! Offline mode setting key +static const XQSettingsKey offlineKey( + XQSettingsKey::TargetPublishAndSubscribe, + KPSUidStartup.iUid, + KPSGlobalSystemState); + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. + + @param [in] parent Parent object. + */ + +WlanSnifferEngine::WlanSnifferEngine(QObject *parent) : + QObject(parent), + mService(new WlanSnifferService(this)), + mSettingsManager(new XQSettingsManager(this)), + mScanTimerId(0), + mScanEnabled(false), + mEmbedded(false), + mWlanQtUtils(new WlanQtUtils()) +{ + OstTraceFunctionEntry0(WLANSNIFFERENGINE_WLANSNIFFERENGINE_ENTRY); + + // Subscribe for WLAN status change indications + bool connectStatus = connect( + mSettingsManager, + SIGNAL(valueChanged(XQSettingsKey, QVariant)), + this, + SLOT(updateSetting(XQSettingsKey, QVariant))); + Q_ASSERT(connectStatus); + mSettingsManager->startMonitoring(masterWlanKey); + mSettingsManager->startMonitoring(wlanForceKey); + + // Connect WLAN Sniffer service signals + connectStatus = connect( + mService, + SIGNAL(toListView(QString)), + this, + SIGNAL(toListView(QString))); + Q_ASSERT(connectStatus == true); + connectStatus = connect( + mService, + SIGNAL(returnValueDelivered()), + this, + SIGNAL(exitTriggered())); + Q_ASSERT(connectStatus == true); + + // Store WLAN Sniffer service embedded status + mEmbedded = XQServiceUtil::isEmbedded(); + + OstTraceFunctionExit0(WLANSNIFFERENGINE_WLANSNIFFERENGINE_EXIT); +} + +/*! + Destructor. + */ + +WlanSnifferEngine::~WlanSnifferEngine() +{ + OstTraceFunctionEntry0(DUP1_WLANSNIFFERENGINE_WLANSNIFFERENGINE_ENTRY); + OstTraceFunctionExit0(DUP1_WLANSNIFFERENGINE_WLANSNIFFERENGINE_EXIT); +} + +/*! + Getter function for WLAN Qt Utilities instance owned by + this class. The whole WLAN Sniffer application uses the same + instance, and thus the reference is needed also in other classes. + + @return WLAN Qt Utilities object. + */ + +WlanQtUtils *WlanSnifferEngine::wlanQtUtils() const +{ + OstTraceFunctionEntry0(WLANSNIFFERENGINE_WLANQTUTILS_ENTRY); + + // The reference must never be null. + Q_ASSERT(mWlanQtUtils.data()); + + OstTraceFunctionExit0(WLANSNIFFERENGINE_WLANQTUTILS_EXIT); + return mWlanQtUtils.data(); +} + +/*! + Getter for WLAN Sniffer service embedded property. + + @return TRUE if WLAN Sniffer is used as an embedded service. + */ + +bool WlanSnifferEngine::isEmbedded() const +{ + OstTraceFunctionEntry0(WLANSNIFFERENGINE_ISEMBEDDED_ENTRY); + OstTraceFunctionExit0(WLANSNIFFERENGINE_ISEMBEDDED_EXIT); + return mEmbedded; +} + +/*! + Starts periodic WLAN Scanning. + It is allowed to call this function also when the scanning is already ON. + If so, the timer is not restarted but the scan period stays untouched. + */ + +void WlanSnifferEngine::startWlanScanning() +{ + OstTraceFunctionEntry0(WLANSNIFFERENGINE_STARTWLANSCANNING_ENTRY); + + if (!mScanEnabled) { + OstTrace0( + TRACE_NORMAL, + WLANSNIFFERENGINE_STARTWLANSCANNING, + "WlanSnifferEngine::startWlanScanning Periodic WLAN scanning starting"); + + mScanEnabled = true; + // Connect response signal + bool connectStatus = connect( + mWlanQtUtils.data(), + SIGNAL(wlanScanReady(int)), + this, + SLOT(handleWlanScanReady(int))); + Q_ASSERT(connectStatus); + + // Start the first scan. Scan timer is started when scan result + // signal is received. + mWlanQtUtils->scanWlans(); + } + + OstTraceFunctionExit0(WLANSNIFFERENGINE_STARTWLANSCANNING_EXIT); +} + +/*! + Stops periodic WLAN Scanning. + It is allowed to call this function also when periodic scanning is OFF. + */ + +void WlanSnifferEngine::stopWlanScanning() +{ + OstTraceFunctionEntry0(WLANSNIFFERENGINE_STOPWLANSCANNING_ENTRY); + + if (mScanEnabled) { + OstTrace0( + TRACE_NORMAL, + WLANSNIFFERENGINE_STOPWLANSCANNING, + "WlanSnifferEngine::stopWlanScanning Periodic WLAN scanning stopped"); + + mScanEnabled = false; + // Disconnect response signal + disconnect( + mWlanQtUtils.data(), + SIGNAL(wlanScanReady(int)), + this, + SLOT(handleWlanScanReady(int))); + + if (mScanTimerId != 0) { + killTimer(mScanTimerId); + mScanTimerId = 0; + } + } + + OstTraceFunctionExit0(WLANSNIFFERENGINE_STOPWLANSCANNING_EXIT); +} + +/*! + Function for getting the master WLAN status. + + @return Master WLAN status: true if enabled, otherwise false. +*/ + +bool WlanSnifferEngine::masterWlan() const +{ + OstTraceFunctionEntry1(WLANSNIFFERENGINE_MASTERWLAN_ENTRY, this); + + // Read WLAN ON/OFF setting from Cenrep + int wlanEnabled = mSettingsManager->readItemValue(masterWlanKey).toInt(); + + OstTrace1( + TRACE_NORMAL, + WLANSNIFFERENGINE_MASTERWLAN, + "WlanSnifferEngine::masterWlan;enabled=%d", + wlanEnabled); + + OstTraceFunctionExit1(WLANSNIFFERENGINE_MASTERWLAN_EXIT, this); + return wlanEnabled ? true : false; +} + +/*! + Function for switching the master WLAN status ON or OFF. + + @param [in] enabled If set to true, WLAN is switched ON, and vice versa. +*/ + +void WlanSnifferEngine::setMasterWlan(bool enabled) +{ + OstTraceFunctionEntry1(WLANSNIFFERENGINE_SETMASTERWLAN_ENTRY, this); + + OstTraceExt1( + TRACE_NORMAL, + WLANSNIFFERENGINE_SETMASTERWLAN, + "WlanSnifferEngine::setMasterWlan;enabled=%hhu", + enabled); + + // Store WLAN ON/OFF setting to Cenrep + int wlanEnabled = enabled ? 1 : 0; + bool writeStatus = mSettingsManager->writeItemValue(masterWlanKey, wlanEnabled); + Q_ASSERT(writeStatus); + + OstTraceFunctionExit1(WLANSNIFFERENGINE_SETMASTERWLAN_EXIT, this); +} + +/*! + Function for getting the force disable WLAN status. + + @return forced WLAN status: true if disabled, otherwise false. +*/ + +bool WlanSnifferEngine::forceDisableWlan() const +{ + OstTraceFunctionEntry1(WLANSNIFFERENGINE_FORCEDISABLEWLAN_ENTRY, this); + + // Read force disable WLAN ON/OFF setting from Cenrep + int wlanDisabled = mSettingsManager->readItemValue(wlanForceKey).toInt(); + + OstTrace1( + TRACE_NORMAL, + WLANSNIFFERENGINE_FORCEDISABLEWLAN, + "WlanSnifferEngine::forceDisableWlan;wlanDisabled=%d", + wlanDisabled); + + OstTraceFunctionEntry1(WLANSNIFFERENGINE_FORCEDISABLEWLAN_EXIT, this); + return wlanDisabled ? true : false; +} + +/*! + Function for getting the offline mode status. + + @return Offline mode status: true if offline, otherwise false. +*/ + +bool WlanSnifferEngine::offlineMode() const +{ + OstTraceFunctionEntry1(WLANSNIFFERENGINE_OFFLINEMODE_ENTRY, this); + + // Read offline mode setting from Cenrep + int systemState = mSettingsManager->readItemValue(offlineKey).toInt(); + + bool offline = false; + if (ESwStateNormalRfOff == systemState) { + offline = true; + } + + OstTraceExt1( + TRACE_NORMAL, + WLANSNIFFERENGINE_OFFLINEMODE, + "WlanSnifferEngine::offlineMode;offline=%hhu", + offline); + + OstTraceFunctionExit1(WLANSNIFFERENGINE_OFFLINEMODE_EXIT, this); + return offline; +} + +/*! + Function for completing the running WLAN Sniffer service. + This function must only be ran if a WLAN Sniffer service is running. + */ + +void WlanSnifferEngine::completeService() +{ + OstTraceFunctionEntry0(WLANSNIFFERENGINE_COMPLETESERVICE_ENTRY); + + mService->complete(); + + OstTraceFunctionExit0(WLANSNIFFERENGINE_COMPLETESERVICE_EXIT); +} + +/*! + This function (from QObject) handles timers. Initiates a new WLAN scan. + + @param [in] event Timer event. + */ + +void WlanSnifferEngine::timerEvent(QTimerEvent *event) +{ + OstTraceFunctionEntry0(WLANSNIFFERENGINE_TIMEREVENT_ENTRY); + + int timerId = event->timerId(); + + OstTrace1( + TRACE_NORMAL, + WLANSNIFFERENGINE_TIMEREVENT, + "WlanSnifferEngine::timerEvent;timerId=%d", + timerId); + + // WLAN scan timer is the only used timer + Q_ASSERT(timerId == mScanTimerId); + + // Request a new scan. Timer events come periodically. + mWlanQtUtils->scanWlans(); + + OstTraceFunctionExit0(WLANSNIFFERENGINE_TIMEREVENT_EXIT); +} + +/*! + Slot for updating settings. + + @param [in] key The changed key setting. + @param [in] value The new value of the setting. +*/ + +void WlanSnifferEngine::updateSetting( + const XQSettingsKey &key, + const QVariant &value) +{ + OstTraceFunctionEntry1(WLANSNIFFERENGINE_UPDATESETTING_ENTRY, this); + + // Check that the key is WLAN ON/OFF, or wlanForceDisable since + // they are the only supported keys + Q_ASSERT( + key.target() == masterWlanKey.target() || + key.target() == wlanForceKey.target()); + Q_ASSERT( + key.uid() == masterWlanKey.uid() || + key.uid() == wlanForceKey.uid()); + Q_ASSERT( + key.key() == masterWlanKey.key() || + key.key() == wlanForceKey.key()); + + bool ok; + bool boolean = value.toInt(&ok) ? true : false; + Q_ASSERT(ok); + + // The updated key can be either the KWlanOnOff or the KWlanForceDisable + if (key.key() == wlanForceKey.key()) { + // Inform about WlanForceDisable status change + OstTraceExt1( + TRACE_NORMAL, + WLANSNIFFERENGINE_UPDATESETTING_WLANFORCEDISABLE, + "WlanSnifferEngine::emit forceWlanStatus;forcedWlanDisabled=%hhu", + boolean); + emit forceDisableWlanStatus(boolean); + } else { + // Inform about WLAN ON/OFF status change + OstTraceExt1( + TRACE_NORMAL, + WLANSNIFFERENGINE_UPDATESETTING_WLANONOFF, + "WlanSnifferEngine::emit masterWlanStatus;wlanEnabled=%hhu", + boolean); + emit masterWlanStatus(boolean); + } + + OstTraceFunctionExit1(WLANSNIFFERENGINE_UPDATESETTING_EXIT, this); +} + +/*! + Slot for handling Wlan scan result. + + @param [in] status Scan status code. +*/ + +void WlanSnifferEngine::handleWlanScanReady(int status) +{ + OstTraceFunctionEntry1(WLANSNIFFERENGINE_HANDLEWLANSCANREADY_ENTRY, this); + + OstTrace1( + TRACE_NORMAL, + WLANSNIFFERENGINE_HANDLEWLANSCANREADY, + "WlanSnifferEngine::handleWlanScanReady;status=%d", + status); + + // Forward result signal only, if there was no error + if (status == WlanQtUtils::ScanStatusOk) { + emit wlanScanReady(); + } + + // Start timer for the next scan, if not running already + if (mScanTimerId == 0) { + mScanTimerId = startTimer(scanTimerInterval); + // The timer start must succeed + Q_ASSERT(mScanTimerId != 0); + } + + OstTraceFunctionExit1(WLANSNIFFERENGINE_HANDLEWLANSCANREADY_EXIT, this); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferlistitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferlistitem.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Sniffer list view list widget item. +*/ + +// System includes + +#include + +// User includes + +#include "wlansnifferlistitem.h" + +/*! + \class WlanSnifferListItem + \brief This class implements the custom list widget item used in + WLAN Sniffer list view. +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. +*/ + +WlanSnifferListItem::WlanSnifferListItem() : HbListWidgetItem() +{ + // Fill data model with empty icons to work as a skeleton + QVariantList decoratorList; + decoratorList << HbIcon() << HbIcon() << HbIcon(); + setData(decoratorList, Qt::DecorationRole); + + // Fill data model with empty text to work as a skeleton + QVariantList displayList; + displayList << QString(); + setData(displayList, Qt::DisplayRole); +} + +/*! + Destructor. +*/ + +WlanSnifferListItem::~WlanSnifferListItem() +{ +} + +/*! + List item network name setting function. + + @param [in] name Network name to set. + */ + +void WlanSnifferListItem::setNetworkName(const QString &name) +{ + setText(name); +} + +/*! + List item left icon setting function. + + @param [in] icon Icon logical name. + */ + +void WlanSnifferListItem::setLeftIcon(const QString &icon) +{ + setIcon(HbIcon(icon)); +} + +/*! + List item signal strength icon setting function. + + @param [in] icon Icon logical name. + */ + +void WlanSnifferListItem::setSignalIcon(const QString &icon) +{ + setSecondaryIcon(HbIcon(icon)); +} + +/*! + List item secure icon setting function. + + @param [in] icon Icon logical name. + */ + +void WlanSnifferListItem::setSecureIcon(const QString &icon) +{ + // Fetch the current decorators (icons) + QVariant decorators = data(Qt::DecorationRole); + Q_ASSERT(decorators.canConvert()); + QVariantList decoratorList = decorators.toList(); + // There must always be three icons + Q_ASSERT(decoratorList.count() == 3); + + // Replace old icon + decoratorList[2] = HbIcon(icon); + setData(decoratorList, Qt::DecorationRole); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferlistview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferlistview.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,672 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Sniffer List View. +*/ + +// System includes + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +// User includes + +#include "wlanqtutils.h" +#include "wlanqtutilsap.h" +#include "wlanqtutilsiap.h" + +#include "wlansnifferengine.h" +#include "wlansniffermainwindow.h" +#include "wlansnifferlistview.h" +#include "wlansnifferlistitem.h" +#include "wlansnifferlistwidget.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlansnifferlistviewTraces.h" +#endif + +/*! + \class WlanSnifferListView + \brief WLAN Sniffer application's list view implementation. +*/ + +// External function prototypes + +// Local constants + +//! WLAN Sniffer list view docml file location +static const QString WlanSnifferListViewDocml(":/docml/wlansnifferlistview.docml"); + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. + + @param [in] engine WLAN Sniffer application engine. + @param [in] mainWindow WLAN Sniffer main window. +*/ + +WlanSnifferListView::WlanSnifferListView( + WlanSnifferEngine *engine, + WlanSnifferMainWindow *mainWindow) : + mDocLoader(new HbDocumentLoader(mainWindow)), + mWlanListWidget(), + mContextMenu(), + mContextMenuData(), + mWlanEnableDialog(), + mIgnoreWlanScanResults(false), + mConnectingIapId(WlanQtUtils::IapIdNone), + mEngine(engine), + mSwitchWlanAction(0), + mAddWlanAction(0), + mWlanList(0), + mStatusLabel(0), + mWlanButton(0) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTVIEW_WLANSNIFFERLISTVIEW_ENTRY); + + // Initialize UI from the docml based on standalone/embedded status + loadDocml(mEngine->isEmbedded()); + + if (mEngine->isEmbedded()) { + // We need to create a custom navigation action and handle exiting + // from the application differently in case the application was + // launched as embedded via QtHighway + HbAction *completeAction = new HbAction(Hb::BackNaviAction, this); + setNavigationAction(completeAction); + bool connectStatus = connect( + completeAction, + SIGNAL(triggered(bool)), + mEngine, + SLOT(completeService())); + Q_ASSERT(connectStatus); + } + + // Connect WLAN network open & close signals + bool connectStatus = connect( + mEngine->wlanQtUtils(), + SIGNAL(wlanNetworkOpened(int)), + this, + SLOT(updateConnectionOpened(int))); + Q_ASSERT(connectStatus); + connectStatus = connect( + mEngine->wlanQtUtils(), + SIGNAL(wlanNetworkClosed(int, int)), + this, + SLOT(updateConnectionClosed(int))); // "reason" parameter ignored + Q_ASSERT(connectStatus); + + // Connect WLAN ON/OFF setting change signal + connectStatus = connect( + mEngine, + SIGNAL(masterWlanStatus(bool)), + this, + SLOT(updateWlanEnabled())); + Q_ASSERT(connectStatus); + + // Connect Force Disable WLAN setting change signal + connectStatus = connect( + mEngine, + SIGNAL(forceDisableWlanStatus(bool)), + this, + SLOT(updateWlanEnabled())); + Q_ASSERT(connectStatus); + + // Connect signals to catch user interaction with the WLAN network list + connectStatus = connect( + mWlanList, + SIGNAL(activated(HbListWidgetItem *)), + this, + SLOT(handleListItemActivated(HbListWidgetItem *))); + Q_ASSERT(connectStatus); + connectStatus = connect( + mWlanList, + SIGNAL(longPressed(HbListWidgetItem *, QPointF)), + this, + SLOT(handleListItemLongPressed(HbListWidgetItem *, QPointF))); + Q_ASSERT(connectStatus); + + // Connect signals to catch user interaction with WLAN ON/OFF switching + connectStatus = connect( + mWlanButton, + SIGNAL(clicked(bool)), + this, + SLOT(handleWlanToggled())); + Q_ASSERT(connectStatus); + connectStatus = connect( + mSwitchWlanAction, + SIGNAL(triggered(bool)), + this, + SLOT(handleWlanToggled())); + Q_ASSERT(connectStatus); + + // Connect adding WLAN manually + connectStatus = connect( + mAddWlanAction, + SIGNAL(triggered(bool)), + this, + SLOT(startWlanWizard())); + Q_ASSERT(connectStatus); + + // Connect WLAN scan results signal + connectStatus = connect( + mEngine, + SIGNAL(wlanScanReady()), + this, + SLOT(updateListContent())); + Q_ASSERT(connectStatus); + + // Set the initial value of WLAN state + updateWlanEnabled(); + + OstTraceFunctionExit0(WLANSNIFFERLISTVIEW_WLANSNIFFERLISTVIEW_EXIT); +} + +/*! + Destructor. +*/ + +WlanSnifferListView::~WlanSnifferListView() +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTVIEW_WLANSNIFFERLISTVIEWDESTR_ENTRY); + OstTraceFunctionExit0(WLANSNIFFERLISTVIEW_WLANSNIFFERLISTVIEWDESTR_EXIT); +} + +/*! + Loading of WLAN Sniffer List View docml. + + @param [in] isEmbedded TRUE if WLAN Sniffer is launched as embedded. +*/ + +void WlanSnifferListView::loadDocml(bool isEmbedded) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTVIEW_LOADDOCML_ENTRY); + + bool ok = false; + // First load the common section + mDocLoader->load(WlanSnifferListViewDocml, &ok); + Q_ASSERT(ok); + + // Then load the mode specific section + if (isEmbedded) { + mDocLoader->load(WlanSnifferListViewDocml, "embedded", &ok); + } else { + mDocLoader->load(WlanSnifferListViewDocml, "standalone", &ok); + } + Q_ASSERT(ok); + + // Load the view by name from the xml file + QGraphicsWidget *widget = mDocLoader->findWidget("occ_list"); + Q_ASSERT(widget); + // Set the WlanListView view to be the widget that was loaded from the xml + setWidget(widget); + + // Set view menu + HbMenu *viewMenu = qobject_cast(mDocLoader->findWidget("viewMenu")); + Q_ASSERT(viewMenu); + setMenu(viewMenu); + + // WLAN Sniffer list widget takes responsibility of the list widget behaviour + mWlanList = qobject_cast(mDocLoader->findWidget("listWidget")); + Q_ASSERT(mWlanList); + mWlanListWidget = QSharedPointer(new WlanSnifferListWidget(mWlanList)); + + // Retrieve pointers to widgets we need to access from the code + mSwitchWlanAction = qobject_cast(mDocLoader->findObject("switchWlanAction")); + Q_ASSERT(mSwitchWlanAction); + + mAddWlanAction = qobject_cast(mDocLoader->findObject("addWlanAction")); + Q_ASSERT(mAddWlanAction); + + mWlanButton = qobject_cast(mDocLoader->findWidget("wlanButton")); + Q_ASSERT(mWlanButton); + + mStatusLabel = qobject_cast(mDocLoader->findWidget("statusLabel")); + Q_ASSERT(mStatusLabel); + + OstTraceFunctionExit0(WLANSNIFFERLISTVIEW_LOADDOCML_EXIT); +} + +/*! + Updates WLAN status label based on current WLAN status. + + @param [in] enabled True if WLAN is enabled. +*/ + +void WlanSnifferListView::updateWlanStatusLabel(bool enabled) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTVIEW_UPDATEWLANSTATUSLABEL_ENTRY); + + QString status; + if (!enabled) { + // WLAN is OFF + status = hbTrId("txt_occ_grid_wlan_is_switched_off"); + } else { + int iapId = mEngine->wlanQtUtils()->activeIap(); + + switch (mEngine->wlanQtUtils()->connectionStatus()) { + case WlanQtUtils::ConnStatusConnecting: + // WLAN is connecting + Q_ASSERT(iapId != WlanQtUtils::IapIdNone); + status = hbTrId("txt_occ_grid_connecting_to_1").arg( + mEngine->wlanQtUtils()->iapName(iapId)); + break; + + case WlanQtUtils::ConnStatusConnected: + // WLAN is connected + Q_ASSERT(iapId != WlanQtUtils::IapIdNone); + status = hbTrId("txt_occ_grid_connected_to_1").arg( + mEngine->wlanQtUtils()->iapName(iapId)); + break; + + default: + // WLAN is disconnected + status = hbTrId("txt_occ_grid_not_connected"); + break; + } + } + mStatusLabel->setPlainText(status); + + OstTraceFunctionExit0(WLANSNIFFERLISTVIEW_UPDATEWLANSTATUSLABEL_EXIT); +} + +/*! + Handles a "Connect" action for the selected IAP or AP item. + + @param data IAP ID (int), or AP class (WlanQtUtilsAp) to connect. +*/ + +void WlanSnifferListView::handleConnect(QVariant data) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTVIEW_HANDLECONNECT_ENTRY); + + // Check whether we need to disconnect a previous connection first + int activeWlanId = mEngine->wlanQtUtils()->activeIap(); + + // Get IAP ID if IAP is available + int iapId = WlanQtUtils::IapIdNone; + if (data.canConvert()) { + iapId = data.toInt(); + } + OstTraceExt2( + TRACE_NORMAL, + WLANSNIFFERLISTVIEW_HANDLECONNECT, + "WlanSnifferListView::handleConnect;activeWlanId=%d;iapId=%d", + activeWlanId, + iapId); + + // Skip connecting if the IAP is already connected + if (activeWlanId != WlanQtUtils::IapIdNone && iapId == activeWlanId) { + return; + } + + if (activeWlanId != WlanQtUtils::IapIdNone) { + mEngine->wlanQtUtils()->disconnectIap(activeWlanId); + + // Update list widget so that the IAP is no longer connected + updateListContent(); + } + + if (iapId != WlanQtUtils::IapIdNone) { + // Item was an IAP, connect it. + mConnectingIapId = iapId; + mStatusLabel->setPlainText( + hbTrId("txt_occ_grid_connecting_to_1").arg( + mEngine->wlanQtUtils()->iapName(iapId))); + mEngine->wlanQtUtils()->connectIap(iapId); + } else { + // Item is a WLAN AP. Summon the Wlan Wizard to handle creation + // of the IAP and connecting it. + Q_ASSERT(data.canConvert()); + WlanQtUtilsAp ap = data.value(); + emit wizardTriggered(&ap); + } + + OstTraceFunctionExit0(WLANSNIFFERLISTVIEW_HANDLECONNECT_EXIT); +} + +/*! + Updates WLAN list widget with new WLAN scan results. +*/ + +void WlanSnifferListView::updateListContent() +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTVIEW_UPDATELISTCONTENT_ENTRY); + + if (!mIgnoreWlanScanResults) { + // Get the latest scan results + QList< QSharedPointer > iaps; + QList< QSharedPointer > aps; + mEngine->wlanQtUtils()->availableWlans(iaps, aps); + + // Check for connected IAP + int iapId = WlanQtUtils::IapIdNone; + if (mEngine->wlanQtUtils()->connectionStatus() == + WlanQtUtils::ConnStatusConnected) { + iapId = mEngine->wlanQtUtils()->activeIap(); + } + + // Let the list widget class update the list content + mWlanListWidget->updateContent(iaps, aps, iapId); + } + + OstTraceFunctionExit0(WLANSNIFFERLISTVIEW_UPDATELISTCONTENT_EXIT); +} + +/*! + WLAN state settings change handler. This slot handles both the + WLAN ON/OFF setting and WLAN forced OFF setting. + Updates all WLAN ON/OFF related (UI) elements. +*/ + +void WlanSnifferListView::updateWlanEnabled() +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTVIEW_UPDATEWLANENABLED_ENTRY); + + // Check the updated setting status + bool forcedOff = mEngine->forceDisableWlan(); + bool enabled = mEngine->masterWlan() && !forcedOff; + + // Update the WLAN status label + updateWlanStatusLabel(enabled); + + // Set the WLAN ON/OFF button state + mWlanButton->setChecked(enabled); + + // Select the right WLAN button icon and menu action text + if (enabled) { + mWlanButton->setIcon(HbIcon("qtg_mono_wlan")); + mSwitchWlanAction->setText(hbTrId("txt_occ_opt_switch_wlan_off")); + } else { + mWlanButton->setIcon(HbIcon("qtg_mono_wlan_offline")); + mSwitchWlanAction->setText(hbTrId("txt_occ_opt_switch_wlan_on")); + } + + // Set triggable WLAN UI elements disabled if WLAN is forced OFF + mWlanButton->setEnabled(!forcedOff); + mSwitchWlanAction->setEnabled(!forcedOff); + + // Disable manual WLAN IAP creation when WLAN is switched OFF + mAddWlanAction->setEnabled(enabled); + + // Switch WLAN scanning ON/OFF + if (enabled) { + mEngine->startWlanScanning(); + } else { + mEngine->stopWlanScanning(); + // Clear the network list when going to offline + mWlanList->clear(); + } + + OstTraceFunctionExit0(WLANSNIFFERLISTVIEW_UPDATEWLANENABLED_EXIT); +} + +/*! + Connection opened slot. Updates connection status. + + @param [in] iapId IAP ID of the connected WLAN IAP. +*/ + +void WlanSnifferListView::updateConnectionOpened(int iapId) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTVIEW_UPDATECONNECTIONOPENED_ENTRY); + + mConnectingIapId = WlanQtUtils::IapIdNone; + mStatusLabel->setPlainText( + hbTrId("txt_occ_grid_connected_to_1").arg( + mEngine->wlanQtUtils()->iapName(iapId))); + + // Update the list widget content + updateListContent(); + + // Scroll to the top of the list + mWlanListWidget->scrollTo(0); + + OstTraceFunctionExit0(WLANSNIFFERLISTVIEW_UPDATECONNECTIONOPENED_EXIT); +} + +/*! + Connection closing handler. Updates connection status. + + @param [in] iapId Disconnected IAP ID. +*/ + +void WlanSnifferListView::updateConnectionClosed(int iapId) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTVIEW_UPDATECONNECTIONCLOSED_ENTRY); + + if (mEngine->masterWlan() && !mEngine->forceDisableWlan()) { + // Check whether we can update the status text to "Not connected" + if (mConnectingIapId == WlanQtUtils::IapIdNone || + mConnectingIapId == iapId) { + mStatusLabel->setPlainText(hbTrId("txt_occ_grid_not_connected")); + } + // else: we are already connecting to another network so don't touch + // the status label + + // Update the list widget content + updateListContent(); + } + + if (mConnectingIapId == iapId) { + // Not connecting to this network anymore + mConnectingIapId = WlanQtUtils::IapIdNone; + } + + OstTraceFunctionExit0(WLANSNIFFERLISTVIEW_UPDATECONNECTIONCLOSED_EXIT); +} + +/*! + Context menu closing handler. +*/ + +void WlanSnifferListView::handleContextMenuClosed() +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTVIEW_HANDLECONTEXTMENUCLOSED_ENTRY); + + // Let list updating start again + mIgnoreWlanScanResults = false; + + OstTraceFunctionExit0(WLANSNIFFERLISTVIEW_HANDLECONTEXTMENUCLOSED_EXIT); +} + +/*! + List item activation handler. Connects the WLAN network, and if there + is no IAP yet for it, starts WLAN Wizard. + + @param [in] item Selected WLAN network list item. +*/ + +void WlanSnifferListView::handleListItemActivated(HbListWidgetItem *item) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTVIEW_HANDLELISTITEMACTIVATED_ENTRY); + + handleConnect(item->data()); + + OstTraceFunctionExit0(WLANSNIFFERLISTVIEW_HANDLELISTITEMACTIVATED_EXIT); +} + +/*! + WLAN List item long press handler. + The long press of a list item (i.e. WLAN IAP) opens a context menu that + is populated depending on the state of the WLAN network in case. + + @param [in] item Selected list item. + @param [in] coords Coordinates of the long press. +*/ + +void WlanSnifferListView::handleListItemLongPressed( + HbListWidgetItem *item, + const QPointF &coords) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTVIEW_HANDLELISTITEMLONGPRESSED_ENTRY); + + mContextMenu = QSharedPointer(new HbMenu()); + + int activeIap = mEngine->wlanQtUtils()->activeIap(); + + // Remember the item that was long pressed + mContextMenuData = item->data(); + if (mContextMenuData.canConvert() + && mContextMenuData.toInt() == activeIap) { + // Connected IAP, add "Disconnect" action + mContextMenu->addAction( + hbTrId("txt_common_menu_disconnect"), + this, + SLOT(handleListItemDisconnect())); + } else { + // Not connected IAP or AP, add "Connect" action + mContextMenu->addAction( + hbTrId("txt_common_menu_connect"), + this, + SLOT(handleListItemConnect())); + } + + // Show the menu and connect closure signal (to re-enable list refreshing) + bool connectStatus = connect( + mContextMenu.data(), + SIGNAL(aboutToClose()), + this, + SLOT(handleContextMenuClosed())); + Q_ASSERT(connectStatus); + mContextMenu->setTimeout(HbPopup::ContextMenuTimeout); + mContextMenu->setPreferredPos(coords); + mContextMenu->show(); + + // Skip WLAN scan result updates during context menu handling + mIgnoreWlanScanResults = true; + + OstTraceFunctionExit0(WLANSNIFFERLISTVIEW_HANDLELISTITEMLONGPRESSED_EXIT); +} + +/*! + Handles the "Connect" action selected from the context menu for a list item. +*/ + +void WlanSnifferListView::handleListItemConnect() +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTVIEW_HANDLELISTITEMCONNECT_ENTRY); + + handleConnect(mContextMenuData); + + OstTraceFunctionExit0(WLANSNIFFERLISTVIEW_HANDLELISTITEMCONNECT_EXIT); +} + +/*! + Handles the "Disconnect" action selected from the context menu for a list item. +*/ + +void WlanSnifferListView::handleListItemDisconnect() +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTVIEW_HANDLELISTITEMDISCONNECT_ENTRY); + + // "Disconnect" was only added, if the item was an IAP and data was + // the IAP ID. + Q_ASSERT(mContextMenuData.canConvert()); + mEngine->wlanQtUtils()->disconnectIap(mContextMenuData.toInt()); + + OstTraceFunctionExit0(WLANSNIFFERLISTVIEW_HANDLELISTITEMDISCONNECT_EXIT); +} + +/*! + Function for handling WLAN ON/OFF switch initiation. +*/ + +void WlanSnifferListView::handleWlanToggled() +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTVIEW_HANDLEWLANTOGGLED_ENTRY); + + // Toggle the new WLAN ON/OFF value + bool wlanOn = mEngine->masterWlan(); + OstTraceExt1( + TRACE_NORMAL, + WLANSNIFFERLISTVIEW_HANDLEWLANTOGGLED, + "WlanSnifferListView::handleWlanToggled;wlan=%hhu", + wlanOn); + + // We have to check whether the offline mode is ON. If it is, then the + // user needs to be queried whether WLAN will be used in offline mode. + if (!wlanOn && mEngine->offlineMode()) { + // Show the dialog and wait for user input. + mWlanEnableDialog = QSharedPointer( + new HbMessageBox(HbMessageBox::MessageTypeQuestion)); + mWlanEnableDialog->setTimeout(HbPopup::StandardTimeout); + mWlanEnableDialog->setText(hbTrId("txt_occ_info_activate_wlan_in_airplane_mode")); + // Open the dialog and connect the result to the handleWlanEnableDialogClosed slot + mWlanEnableDialog->open(this, SLOT(handleWlanEnableDialogClosed(HbAction*))); + } else { + // Stop WLAN scanning immediately when switching WLAN OFF. + // WLAN might have sent scan results just before disabling WLAN. + if (wlanOn) { + mEngine->stopWlanScanning(); + } + mEngine->setMasterWlan(!wlanOn); + } + + OstTraceFunctionExit0(WLANSNIFFERLISTVIEW_HANDLEWLANTOGGLED_EXIT); +} + +/*! + Function for handling WLAN Wizard starting when adding WLAN manually. +*/ + +void WlanSnifferListView::startWlanWizard() +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTVIEW_STARTWLANWIZARD_ENTRY); + + // TODO: Stop connections & do other cleanup before wizard can start? + + emit wizardTriggered(NULL); + + OstTraceFunctionExit0(WLANSNIFFERLISTVIEW_STARTWLANWIZARD_EXIT); +} + +/*! + Function to handle the input received when the wlan enabling + query is closed. + + @param [in] action The user action received from the dialog. +*/ + +void WlanSnifferListView::handleWlanEnableDialogClosed(HbAction *action) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTVIEW_HANDLEWLANENABLEDIALOGCLOSED_ENTRY); + + // The dialog must exist + Q_ASSERT(mWlanEnableDialog); + + // If the user selected yes, then the wlan value is toggled, + // otherwise nothing needs to be done. + // TODO: Update actions().at(0) when a better solution is provided by orbit + if (action == mWlanEnableDialog->actions().at(0)) { + mEngine->setMasterWlan(true); + } + + OstTraceFunctionExit0(WLANSNIFFERLISTVIEW_HANDLEWLANENABLEDIALOGCLOSED_EXIT); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferlistwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferlistwidget.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,642 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Sniffer list widget class. +*/ + +// System includes + +#include +#include +#include +#include +#include +#include + +// User includes + +#include "wlanqtutils.h" +#include "wlanqtutilsap.h" +#include "wlanqtutilsiap.h" + +#include "wlansniffer.h" +#include "wlansnifferlistitem.h" +#include "wlansnifferlistwidget.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlansnifferlistwidgetTraces.h" +#endif + +/*! + \class WlanSnifferListWidget + \brief WLAN Sniffer Custom List Widget implementation. +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +/*! + String comparator for list view. Used for locale-aware SSID comparison + in list view. + + @param [in] string1 String #1 to compare. + @param [in] string2 String #2 to compare. + + @return Zero (0), if strings are considered to be same, + Positive (>0) if string1 is considered to be "greater than" string2. + Negative (<0) if string1 is considered to be "less than" string2. +*/ + +static int WlanSsidStringComparator( + const QString &string1, + const QString &string2) +{ + return HbStringUtil::compareC(string1, string2); +} + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. + + @param [in] listWidget List Widget created to customize. +*/ + +WlanSnifferListWidget::WlanSnifferListWidget(HbListWidget *listWidget) : + mListWidget(listWidget) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_WLANSNIFFERLISTWIDGET_ENTRY); + + // Set custom WLAN list item layout + mListWidget->setLayoutName("wlanlistitem"); + + OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_WLANSNIFFERLISTWIDGET_EXIT); +} + +/*! + Destructor. +*/ + +WlanSnifferListWidget::~WlanSnifferListWidget() +{ + OstTraceFunctionEntry0(DUP1_WLANSNIFFERLISTWIDGET_WLANSNIFFERLISTWIDGET_ENTRY); + OstTraceFunctionExit0(DUP1_WLANSNIFFERLISTWIDGET_WLANSNIFFERLISTWIDGET_EXIT); +} + +/*! + Updates the list widget content with the given IAPs and APs. + + @param [in] iaps New WLAN IAP list. + @param [in] aps New WLAN AP list. + @param [in] connectedIapId IAP ID of the connected WLAN or + IapIdNone if not connected. + */ + +void WlanSnifferListWidget::updateContent( + QList< QSharedPointer > &iaps, + QList< QSharedPointer > &aps, + int connectedIapId) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_UPDATESCANSTATUS_ENTRY); + + traceListContent(); + + // Sort the scan result lists + sortIaps(iaps, connectedIapId); + sortAps(aps); + + // Remove items, which are not present in new IAP or AP lists + removeLostItems(iaps, aps); + + // Add items, which are only found in the new IAP and AP lists. + // Also update the icons of existing items (connection mode and + // signal strength may have changed) + addDiscoveredItemsAndUpdateRest(iaps, aps, connectedIapId); + + traceListContent(); + + OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_UPDATESCANSTATUS_EXIT); +} + +/*! + Scroll the list widget to given row. + + @param [in] row Row to scroll to. Indexing starts from zero. + */ + +void WlanSnifferListWidget::scrollTo(int row) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_SCROLLTO_ENTRY); + + OstTrace1( + TRACE_NORMAL, + WLANSNIFFERLISTWIDGET_SCROLLTO, + "WlanSnifferListWidget::scrollTo;row=%d", + row); + + // Check that the row exists + if (row < mListWidget->count()) { + // Do the scrolling + QModelIndex index = mListWidget->model()->index(row, 0); + mListWidget->scrollTo(index); + } + + OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_SCROLLTO_EXIT); +} + +/*! + IAP list sorting. Sorts IAPs into alphabetical order taking localization + into account. + + @param [in,out] iaps WLAN IAP list. + @param [in] connectedIapId IAP ID of the connected WLAN or + IapIdNone if not connected. +*/ + +void WlanSnifferListWidget::sortIaps( + QList< QSharedPointer > &iaps, + int connectedIapId) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_SORTIAPS_ENTRY); + + // Order the list by IAP name + qSort( + iaps.begin(), + iaps.end(), + WlanSnifferListWidget::iapLessThan); + + // Find the possible connected IAP + int connectedIndex = 0; + for (int i = 0; i < iaps.size(); i++) { + if (iaps[i]->value(WlanQtUtilsIap::ConfIdIapId).toInt() == connectedIapId) { + connectedIndex = i; + break; + } + } + + // Move the possible connected IAP to the beginning + if (connectedIndex) { + OstTraceExt2( + TRACE_NORMAL, + WLANSNIFFERLISTWIDGET_SORTIAPS_MOVE_CONNECTED, + "WlanSnifferListWidget::sortIaps Moving connected IAP to top;connectedIapId=%d;connectedIndex=%d", + connectedIapId, + connectedIndex); + + iaps.move(connectedIndex, 0); + } + + OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_SORTIAPS_EXIT); +} + +/*! + AP list sorting. Sorts APs into alphabetical order taking localization + into account. + + @param [in,out] aps WLAN AP list. +*/ + +void WlanSnifferListWidget::sortAps( + QList< QSharedPointer > &aps) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_SORTAPS_ENTRY); + + // Order the list by AP SSID + qSort( + aps.begin(), + aps.end(), + WlanSnifferListWidget::apLessThan); + + OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_SORTAPS_EXIT); +} + +/*! + Compares two WLAN IAPs. Comparison is done with the IAP name. + + @param[in] iap1 IAP to compare with. + @param[in] iap2 IAP to compare. + + @return Returns true if the first iap is "less than" the second one. + */ + +bool WlanSnifferListWidget::iapLessThan( + const QSharedPointer iap1, + const QSharedPointer iap2) +{ + // Primary comparison is based on the name + int result = HbStringUtil::compareC( + iap1->value(WlanQtUtilsIap::ConfIdName).toString(), + iap2->value(WlanQtUtilsIap::ConfIdName).toString()); + + return (result < 0) ? true : false; +} + +/*! + Compares two WLAN APs. Comparison is done with the AP SSID. + + @param[in] ap1 AP to compare with. + @param[in] ap2 AP to compare. + + @return Returns true if the first ap is "less than" the second one. + */ + +bool WlanSnifferListWidget::apLessThan( + const QSharedPointer ap1, + const QSharedPointer ap2) +{ + // Use AP comparison function with localized SSID comparison + int result = WlanQtUtilsAp::compare( + ap1.data(), + ap2.data(), + WlanSsidStringComparator); + + return (result < 0) ? true : false; +} + +/*! + Function for finding the given IAP from the old Wlan list. + + @param [in] iap IAP to find. + + @return Found WLAN List Widget item, 0 if not found. +*/ + +WlanSnifferListItem *WlanSnifferListWidget::findFromOldList( + QSharedPointer iap) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_FINDFROMOLDLIST_IAP_ENTRY); + + WlanSnifferListItem *result = NULL; + QVariant iapData = iap->value(WlanQtUtilsIap::ConfIdIapId); + for (int row = 0; row < mListWidget->count(); row++) { + HbListWidgetItem *item = mListWidget->item(row); + if (item->data() == iapData) { + result = static_cast(item); + break; + } + } + + OstTraceExt2( + TRACE_DUMP, + WLANSNIFFERLISTWIDGET_FINDFROMOLDLIST_IAP, + "WlanSnifferListWidget::findFromOldList;iapId=%d;found=%hhu", + iapData.toInt(), + (result != NULL) ? true : false); + + OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_FINDFROMOLDLIST_IAP_EXIT); + return result; +} + +/*! + Function for finding the given AP from the old Wlan list. + + @param [in] ap AP to find. + + @return Found WLAN List Widget item, 0 if not found. +*/ + +WlanSnifferListItem *WlanSnifferListWidget::findFromOldList( + QSharedPointer ap) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_FINDFROMOLDLIST_AP_ENTRY); + + WlanSnifferListItem *result = NULL; + for (int row = 0; row < mListWidget->count(); row++) { + HbListWidgetItem *item = mListWidget->item(row); + if (item->data().canConvert()) { + WlanQtUtilsAp oldAp = item->data().value(); + if (WlanQtUtilsAp::compare(ap.data(), &oldAp) == 0) { + result = static_cast(item); + break; + } + } + } + +#ifdef OST_TRACE_COMPILER_IN_USE + QString tmp(ap.data()->value(WlanQtUtilsAp::ConfIdSsid).toString()); + TPtrC16 ssid(tmp.utf16(), tmp.length()); + OstTraceExt2( + TRACE_NORMAL, + WLANSNIFFERLISTWIDGET_FINDFROMOLDLIST_AP, + "WlanSnifferListWidget::findFromOldList;found=%hhu;ssid=%S", + (result != NULL) ? true : false, + ssid); +#endif + + OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_FINDFROMOLDLIST_AP_EXIT); + return result; +} + +/*! + Function for creating a new list item from the given IAP. + + @param [in] iap WLAN IAP to create. + @param [in] connectedIapId IAP ID of the connected WLAN or + IapIdNone if not connected. + + @return New WLAN List Widget item. +*/ + +HbListWidgetItem *WlanSnifferListWidget::listItemCreate( + QSharedPointer iap, + int connectedIapId) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_LISTITEMCREATE_IAP_ENTRY); + + WlanSnifferListItem *item = new WlanSnifferListItem(); + item->setNetworkName(iap->value(WlanQtUtilsIap::ConfIdName).toString()); + // Note: WPS icon is needed only in IAP setup, no longer here + if (iap->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt() != + CMManagerShim::WlanSecModeOpen) { + item->setSecureIcon("qtg_small_lock"); + } + + item->setLeftIcon( + leftIconChoose( + iap->value(WlanQtUtilsIap::ConfIdIapId).toInt(), + connectedIapId)); + item->setSignalIcon( + signalStrengthIconChoose( + iap->value(WlanQtUtilsAp::ConfIdSignalStrength).toInt())); + + item->setData(iap->value(WlanQtUtilsIap::ConfIdIapId)); + + OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_LISTITEMCREATE_IAP_EXIT); + return item; +} + +/*! + Function for creating a new list item from the given AP. + + @param [in] ap WLAN AP to create. + + @return New WLAN List Widget item. +*/ + +HbListWidgetItem *WlanSnifferListWidget::listItemCreate( + QSharedPointer ap) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_LISTITEMCREATE_AP_ENTRY); + + WlanSnifferListItem *item = new WlanSnifferListItem(); + item->setNetworkName(ap->value(WlanQtUtilsAp::ConfIdSsid).toString()); + if (ap->value(WlanQtUtilsAp::ConfIdWpsSupported).toBool()) { + // WPS is supported, use a dedicated security icon + item->setSecureIcon("qtg_small_wifi"); + } else if (ap->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt() + != CMManagerShim::WlanSecModeOpen) { + // Other secure networks + item->setSecureIcon("qtg_small_lock"); + } + item->setSignalIcon( + signalStrengthIconChoose( + ap->value(WlanQtUtilsAp::ConfIdSignalStrength).toInt())); + + QVariant data; + data.setValue(*ap); + item->setData(data); + + OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_LISTITEMCREATE_AP_EXIT); + return item; +} + +/*! + Function for selecting the correct signal strength icon. + + @param [in] signalStrength Signal strength. + + @return Signal strength icon logical name. +*/ + +QString WlanSnifferListWidget::signalStrengthIconChoose(int signalStrength) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_SIGNALSTRENGTHICONCHOOSE_ENTRY); + + QString iconName; + if (signalStrength <= SignalStrengthHigh) { + iconName = "qtg_small_signal_good"; + } else if (signalStrength <= SignalStrengthMedium) { + iconName = "qtg_small_signal_medium"; + } else { + iconName = "qtg_small_signal_low"; + } + + OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_SIGNALSTRENGTHICONCHOOSE_EXIT); + return iconName; +} + +/*! + Function for selecting the correct "left" icon, which is different for + connected and not connected IAPs. + + @param [in] iapId IAP ID of the WLAN IAP. + @param [in] connectedIapId IAP ID of the connected WLAN or + IapIdNone if not connected. + + @return Icon logical name of the "left" icon. +*/ + +QString WlanSnifferListWidget::leftIconChoose( + int iapId, + int connectedIapId) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_LEFTICONCHOOSE_ENTRY); + + QString iconName; + if (iapId == connectedIapId) { + iconName = "qtg_small_connection"; + } else { + iconName = "qtg_small_wlan"; + } + + OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_LEFTICONCHOOSE_EXIT); + return iconName; +} + +/*! + Function for removing from the old Wlan list those items, which are + not present in the given new lists. + + @param [in] iaps New WLAN IAP list. + @param [in] aps New WLAN AP list. +*/ + +void WlanSnifferListWidget::removeLostItems( + const QList< QSharedPointer > &iaps, + const QList< QSharedPointer > &aps) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_REMOVELOSTITEMS_ENTRY); + + int row = 0; + // Loop through all rows in the current list and try to find the items from + // the new lists + while (row < mListWidget->count()) { + bool found = false; + const HbListWidgetItem *item = mListWidget->item(row); + if (item->data().canConvert()) { + // Item was an IAP, try to find it from the new IAP list + foreach (QSharedPointer iap, iaps) { + if (iap->value(WlanQtUtilsIap::ConfIdIapId) == + item->data()) { + found = true; + break; + } + } + } else { + // Item has to be an AP, try to find it from the new AP list + Q_ASSERT(item->data().canConvert()); + WlanQtUtilsAp oldAp = item->data().value(); + foreach (QSharedPointer newAp, aps) { + if (WlanQtUtilsAp::compare(newAp.data(), &oldAp) == 0) { + found = true; + break; + } + } + } + if (found == false) { + // Item was lost. Remove this row and delete it. Don't increment + // row index, because the next item now has the same row index + // as this one had + delete mListWidget->takeItem(row); + + OstTrace1( + TRACE_NORMAL, + WLANSNIFFERLISTWIDGET_REMOVELOSTITEMS, + "WlanSnifferListWidget::removeLostItems Removed;row=%d", + row); + } else { + // Item still exists, move on to next row + row++; + } + } + + OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_REMOVELOSTITEMS_EXIT); +} + +/*! + Function for adding to the Wlan list those items, which are new + in the given new lists. Also, icons and order of the existing list + items are updated. + + @param [in] iaps New WLAN IAP list. + @param [in] aps New WLAN AP list. + @param [in] connectedIapId IAP ID of the connected WLAN or + IapIdNone if not connected. +*/ + +void WlanSnifferListWidget::addDiscoveredItemsAndUpdateRest( + const QList< QSharedPointer > &iaps, + const QList< QSharedPointer > &aps, + int connectedIapId) +{ + OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_ADDDISCOVEREDITEMSANDUPDATEREST_ENTRY); + + int row = 0; + // Loop through new IAPs and try to find them from the old list + foreach (QSharedPointer newIap, iaps) { + WlanSnifferListItem *oldItem = findFromOldList(newIap); + if (oldItem != NULL) { + // Match found, update icons + oldItem->setLeftIcon( + leftIconChoose( + newIap->value(WlanQtUtilsIap::ConfIdIapId).toInt(), + connectedIapId)); + oldItem->setSignalIcon( + signalStrengthIconChoose( + newIap->value(WlanQtUtilsAp::ConfIdSignalStrength).toInt())); + // Also move the IAP to new row, if necessary (IAP order changes + // when IAPs are connected/disconnected) + int oldRow = mListWidget->row(oldItem); + if (row != oldRow) { + OstTraceExt2( + TRACE_NORMAL, + WLANSNIFFERLISTWIDGET_ADDDISCOVEREDITEMSANDUPDATEREST_MOVE, + "WlanSnifferListWidget::addDiscoveredItemsAndUpdateRest Moved;oldRow=%d;row=%d", + oldRow, + row); + mListWidget->takeItem(oldRow); + mListWidget->insertItem(row, oldItem); + } + } else { + // New item discovered, add it to the list. Row is the same as the + // index of the item in the new scan list + OstTrace1( + TRACE_NORMAL, + WLANSNIFFERLISTWIDGET_ADDDISCOVEREDITEMSANDUPDATEREST_ADD_IAP, + "WlanSnifferListWidget::addDiscoveredItemsAndUpdateRest Added IAP;row=%d", + row); + mListWidget->insertItem(row, listItemCreate(newIap, connectedIapId)); + } + // Move to next row + row++; + } + // Repeat the same for new APs. Notice that row index continues from + // previous loop + foreach (QSharedPointer newAp, aps) { + WlanSnifferListItem *oldItem = findFromOldList(newAp); + if (oldItem != NULL) { + oldItem->setSignalIcon( + signalStrengthIconChoose( + newAp->value(WlanQtUtilsAp::ConfIdSignalStrength).toInt())); + // Notice that AP order may not change, they are always in + // alphabetical order + } else { + OstTrace1( + TRACE_NORMAL, + WLANSNIFFERLISTWIDGET_ADDDISCOVEREDITEMSANDUPDATEREST_ADD_AP, + "WlanSnifferListWidget::addDiscoveredItemsAndUpdateRest Added AP;row=%d", + row); + mListWidget->insertItem(row, listItemCreate(newAp)); + } + row++; + } + + OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_ADDDISCOVEREDITEMSANDUPDATEREST_EXIT); +} + +/*! + This function traces the contents of the list. +*/ + +void WlanSnifferListWidget::traceListContent() const +{ +#ifdef OST_TRACE_COMPILER_IN_USE + for (int row = 0; row < mListWidget->count(); row++) { + HbListWidgetItem *item = mListWidget->item(row); + if (item->data().canConvert()) { + OstTraceExt2( + TRACE_DUMP, + WLANSNIFFERLISTWIDGET_TRACELISTCONTENT_IAP, + "WlanSnifferListWidget::traceListContent IAP;row=%d;id=%d", + row, + item->data().toInt()); + } else { + Q_ASSERT(item->data().canConvert()); + WlanQtUtilsAp ap = item->data().value(); + QString tmp(ap.value(WlanQtUtilsAp::ConfIdSsid).toString()); + TPtrC16 ssid(tmp.utf16(), tmp.length()); + OstTraceExt2( + TRACE_DUMP, + WLANSNIFFERLISTWIDGET_TRACELISTCONTENT_AP, + "WlanSnifferListWidget::traceListContent AP;row=%d;ssid=%S", + row, + ssid); + } + } +#endif +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/src/wlansniffermainwindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansniffermainwindow.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,232 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Sniffer main window. +*/ + +// System includes + +// User includes + +#include "wlanqtutils.h" +#include "wlanqtutilsap.h" + +#include "wlanwizard.h" + +#include "wlansnifferengine.h" +#include "wlansnifferlistview.h" +#include "wlansniffermainwindow.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlansniffermainwindowTraces.h" +#endif + +/*! + \class WlanSnifferMainWindow + \brief WLAN Sniffer main window. +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. + + @param [in] engine WLAN Sniffer application engine. + */ + +WlanSnifferMainWindow::WlanSnifferMainWindow(WlanSnifferEngine *engine) : + mWizard(0), + mListView(0), + mEngine(engine) +{ + OstTraceFunctionEntry0(WLANSNIFFERMAINWINDOW_WLANSNIFFERMAINWINDOW_ENTRY); + + // Add the list view to the main window + addListView(); + bool connectStatus = connect( + mEngine, + SIGNAL(toListView(QString)), + this, + SLOT(toListView(QString))); + Q_ASSERT(connectStatus == true); + + // When using WLAN Sniffer service, the view show is called after the service + // request arrives. + if (!mEngine->isEmbedded()) { + // Show the list view + toListView(hbTrId("txt_occ_title_wireless_lan")); + } + + OstTraceFunctionExit0(WLANSNIFFERMAINWINDOW_WLANSNIFFERMAINWINDOW_EXIT); +} + +/*! + Destructor. + */ + +WlanSnifferMainWindow::~WlanSnifferMainWindow() +{ + OstTraceFunctionEntry0(WLANSNIFFERMAINWINDOW_WLANSNIFFERMAINWINDOWDESTR_ENTRY); + OstTraceFunctionExit0(WLANSNIFFERMAINWINDOW_WLANSNIFFERMAINWINDOWDESTR_EXIT); +} + +/*! + Shows the WLAN Sniffer list view. + + @param [in] title View title. + */ + +void WlanSnifferMainWindow::toListView(const QString &title) +{ + OstTraceFunctionEntry0(WLANSNIFFERMAINWINDOW_TOLISTVIEW_ENTRY); + + // Show the list view + mListView->setTitle(title); + setCurrentView(mListView); + show(); + + OstTraceFunctionExit0(WLANSNIFFERMAINWINDOW_TOLISTVIEW_EXIT); +} + +/*! + Creates and adds the WLAN List View to main window. + */ + +void WlanSnifferMainWindow::addListView() +{ + OstTraceFunctionEntry0(WLANSNIFFERMAINWINDOW_ADDLISTVIEW_ENTRY); + + mListView = new WlanSnifferListView(mEngine, this); + addView(mListView); + + bool connectStatus = connect( + mListView, + SIGNAL(wizardTriggered(const WlanQtUtilsAp *)), + this, + SLOT(startWlanWizard(const WlanQtUtilsAp *))); + + OstTraceFunctionExit0(WLANSNIFFERMAINWINDOW_ADDLISTVIEW_EXIT); +} + +/*! + Starts WLAN Wizard for new WLAN IAP creation. + + @param [in] ap WLAN Access Point to create, or NULL for adding WLAN manually. + */ + +void WlanSnifferMainWindow::startWlanWizard(const WlanQtUtilsAp *ap) +{ + OstTraceFunctionEntry0(WLANSNIFFERMAINWINDOW_STARTWLANWIZARD_ENTRY); + + Q_ASSERT(mWizard == NULL); + + // Stop WLAN scanning for the duration of WLAN Wizard + mEngine->stopWlanScanning(); + + mWizard = QSharedPointer(new WlanWizard(this)); + bool connectStatus = connect( + mWizard.data(), + SIGNAL(finished(int,bool)), + this, + SLOT(handleWlanWizardComplete(int,bool)), + Qt::QueuedConnection); + Q_ASSERT(connectStatus == true); + + connectStatus = connect( + mWizard.data(), + SIGNAL(cancelled()), + this, + SLOT(handleWlanWizardCancelled()), + Qt::QueuedConnection); + Q_ASSERT(connectStatus == true); + + // Create an IAP for a specific AP + if (ap) { + mWizard->setParameters( + ap->value(WlanQtUtilsAp::ConfIdSsid).toString(), + ap->value(WlanQtUtilsAp::ConfIdConnectionMode).toInt(), + ap->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(), + ap->value(WlanQtUtilsAp::ConfIdWpaPskUse).toInt(), + ap->value(WlanQtUtilsAp::ConfIdHidden).toBool(), + ap->value(WlanQtUtilsAp::ConfIdWpsSupported).toBool()); + } + // else: Add WLAN IAP manually + + mWizard->show(); + + OstTraceFunctionExit0(WLANSNIFFERMAINWINDOW_STARTWLANWIZARD_EXIT); +} + +/*! + WLAN Wizard successful completion handler. + + @param [in] iapId IAP ID of the new WLAN IAP. + @param [in] connected TRUE if connected. + */ + +void WlanSnifferMainWindow::handleWlanWizardComplete( + int iapId, + bool connected) +{ + OstTraceFunctionEntry0(WLANSNIFFERMAINWINDOW_HANDLEWLANWIZARDCOMPLETE_ENTRY); + + // The wizard must exist + Q_ASSERT(mWizard); + + // Enable scanning again + mEngine->startWlanScanning(); + + if (connected) { + // The IAP ID must be valid + Q_ASSERT(iapId != WlanQtUtils::IapIdNone); + + // Connect (share) the new IAP in order to keep the connection open when + // deleting Wizard. + mEngine->wlanQtUtils()->connectIap(iapId, false); + } + // else: created IAP not connected at all, or already dropped + // (probably due to being out of coverage) so don't try to share it + + // Delete the Wizard instance. This is OK since the connect is Qt::QueuedConnection. + mWizard.clear(); + + OstTraceFunctionExit0(WLANSNIFFERMAINWINDOW_HANDLEWLANWIZARDCOMPLETE_EXIT); +} + +/*! + WLAN Wizard cancellation handler. + */ + +void WlanSnifferMainWindow::handleWlanWizardCancelled() +{ + OstTraceFunctionEntry0(WLANSNIFFERMAINWINDOW_HANDLEWLANWIZARDCANCELLED_ENTRY); + + // The wizard must exist + Q_ASSERT(mWizard); + + // Enable scanning again + mEngine->startWlanScanning(); + + // Delete the Wizard instance. This is OK since the connect is Qt::QueuedConnection. + mWizard.clear(); + + OstTraceFunctionExit0(WLANSNIFFERMAINWINDOW_HANDLEWLANWIZARDCANCELLED_EXIT); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferservice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferservice.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Sniffer QtHighway Service. +*/ + +// System includes + +// User includes + +#include "wlansnifferservice.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlansnifferserviceTraces.h" +#endif + +/*! + \class WlanSnifferService + \brief WLAN Sniffer QtHighway service implementation. + + This class implements a QtHighway service that can be used to launch + a WLAN Sniffer application. +*/ + + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. + + @param[in] parent Object parent. + */ + +WlanSnifferService::WlanSnifferService(QObject* parent) : + XQServiceProvider( + QLatin1String("wlansniffer.com.nokia.symbian.IWlanSniffer"), + parent) +{ + OstTraceFunctionEntry0(WLANSNIFFERSERVICE_WLANSNIFFERSERVICE_ENTRY); + + publishAll(); + + OstTraceFunctionExit0(WLANSNIFFERSERVICE_WLANSNIFFERSERVICE_EXIT); +} + +/*! + Destructor. + */ + +WlanSnifferService::~WlanSnifferService() +{ + OstTraceFunctionEntry0(WLANSNIFFERSERVICE_WLANSNIFFERSERVICEDESTR_ENTRY); + OstTraceFunctionExit0(WLANSNIFFERSERVICE_WLANSNIFFERSERVICEDESTR_EXIT); +} + +/*! + Completes the current service. + */ + +void WlanSnifferService::complete() +{ + OstTraceFunctionEntry0(WLANSNIFFERSERVICE_COMPLETE_ENTRY); + + QVariant returnValue(true); + bool status = completeRequest(mAsyncRequestIndex, returnValue); + Q_ASSERT(status); + + OstTraceFunctionExit0(WLANSNIFFERSERVICE_COMPLETE_EXIT); +} + +/*! + List view service function. Launches the WLAN Sniffer List View. + */ + +void WlanSnifferService::listView() +{ + OstTraceFunctionEntry0(WLANSNIFFERSERVICE_LISTVIEW_ENTRY); + + mAsyncRequestIndex = setCurrentRequestAsync(); + emit toListView(title()); + + OstTraceFunctionExit0(WLANSNIFFERSERVICE_LISTVIEW_EXIT); +} + +/* + Extracts and returns the client application's title (if available). + + @return Client application's title string or empty if not available. + */ + +QString WlanSnifferService::title() const +{ + OstTraceFunctionEntry0(WLANSNIFFERSERVICE_TITLE_ENTRY); + + // Get service request info + XQRequestInfo info = requestInfo(); + + // There must be a valid request info object + Q_ASSERT(info.isValid()); + + // Extract the title + // TODO: Start using the official define when available + QVariant titleInfo = info.info("WindowTitle"); + QString title = titleInfo.toString(); + + OstTraceFunctionExit0(WLANSNIFFERSERVICE_TITLE_EXIT); + return title; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/traces/OstTraceDefinitions.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* OST trace definition header. +*/ + +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +#include +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/tsrc/ctcmakeandruncases.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/tsrc/ctcmakeandruncases.cmd Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,24 @@ +:: Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +:: All rights reserved. +:: This component and the accompanying materials are made available +:: under the terms of "Eclipse Public License v1.0" +:: which accompanies this distribution, and is available +:: at the URL "http://www.eclipse.org/legal/epl-v10.html". +:: +:: Initial Contributors: +:: Nokia Corporation - initial contribution. +:: +:: Contributors: +:: +:: Description: +:: Batch file to instrument and run test cases with CTC. + +@echo off +del MON.* +del profile.txt +rmdir /S /Q CTCHTML +call qmake "CONFIG -= debug" +call sbs clean +call sbs reallyclean +call ctcwrap -C EXCLUDE=* -C NO_EXCLUDE+..\src\wlansnifferlistwidget.cpp -i d -2comp sbs -c winscw_udeb +call \epoc32\release\winscw\udeb\t_wlansniffer.exe \ No newline at end of file diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/tsrc/ctcresults.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/tsrc/ctcresults.cmd Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,17 @@ +:: Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +:: All rights reserved. +:: This component and the accompanying materials are made available +:: under the terms of "Eclipse Public License v1.0" +:: which accompanies this distribution, and is available +:: at the URL "http://www.eclipse.org/legal/epl-v10.html". +:: +:: Initial Contributors: +:: Nokia Corporation - initial contribution. +:: +:: Contributors: +:: +:: Description: +:: Batch file to create coverage reports from CTC results. + +call ctcpost -p profile.txt +call ctc2html -i profile.txt \ No newline at end of file diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/tsrc/makeandruncases.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/tsrc/makeandruncases.cmd Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,21 @@ +:: Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +:: All rights reserved. +:: This component and the accompanying materials are made available +:: under the terms of "Eclipse Public License v1.0" +:: which accompanies this distribution, and is available +:: at the URL "http://www.eclipse.org/legal/epl-v10.html". +:: +:: Initial Contributors: +:: Nokia Corporation - initial contribution. +:: +:: Contributors: +:: +:: Description: +:: Batch file to compile and run test cases. + +@echo off +call qmake +call sbs clean +call sbs reallyclean +call sbs -c winscw_udeb +call \epoc32\release\winscw\udeb\t_wlansniffer.exe \ No newline at end of file diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/tsrc/t_wlansniffer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/tsrc/t_wlansniffer.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,563 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is the source file for testing Wlan Sniffer application. +*/ + +// System includes + +#include +#include +#include +#include +#include +#include + +// User includes + +#include "wlanqtutilsiap.h" +#include "wlanqtutilsap.h" + +#include "wlansnifferlistwidget.h" +#include "t_wlansniffer.h" + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +/*! + Test main function. Runs all test cases. + */ + +int main(int argc, char *argv[]) +{ + HbApplication app(argc, argv); + + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\TestWlanSniffer.txt"; + + TestWlanSniffer tc; + int res = QTest::qExec(&tc, 3, pass); + + return res; +} + +// ======== MEMBER FUNCTIONS ======== + +/*! + This function will be called before the first test function is executed. +*/ + +void TestWlanSniffer::initTestCase() +{ + mWidget = NULL; +} + +/*! + This function will be called after the last test function was executed. + */ + +void TestWlanSniffer::cleanupTestCase() +{ +} + +/*! + This function will be called before each test function is executed. + */ + +void TestWlanSniffer::init() +{ + mListWidget = new HbListWidget(); + mWidget = new WlanSnifferListWidget(mListWidget); + + mIaps.clear(); + mAps.clear(); +} + +/*! + This function will be called after each test function is executed. + */ + +void TestWlanSniffer::cleanup() +{ + delete mWidget; + mWidget = NULL; + + mListWidget->clear(); + delete mListWidget; + mListWidget = NULL; +} + +/*! + This function tests Wlan list widget content updating. + */ + +void TestWlanSniffer::testUpdateContentIapAdded() +{ + appendWlanAp("SSID 1", 20, 0, CMManagerShim::WlanSecModeOpen); + appendWlanAp("SSID 2", 90, 0, CMManagerShim::WlanSecModeWpa); + + mWidget->updateContent(mIaps, mAps, 0); + + QCOMPARE(mListWidget->count(), 2); + verifyAp(0, QString("SSID 1"), CMManagerShim::WlanSecModeOpen); + verifyAp(1, QString("SSID 2"), CMManagerShim::WlanSecModeWpa); + + appendWlanIap(1, 0, "SSID 3", "SSID 3", 20, CMManagerShim::WlanSecModeWpa); + + mWidget->updateContent(mIaps, mAps, 0); + + QCOMPARE(mListWidget->count(), 3); + verifyIap(0, 1); + verifyAp(1, QString("SSID 1"), CMManagerShim::WlanSecModeOpen); + verifyAp(2, QString("SSID 2"), CMManagerShim::WlanSecModeWpa); +} + +/*! + This function tests Wlan list widget content updating. + */ + +void TestWlanSniffer::testUpdateContentApAdded() +{ + appendWlanAp("SSID 1", 20, 0, CMManagerShim::WlanSecModeOpen); + + mWidget->updateContent(mIaps, mAps, 0); + + QCOMPARE(mListWidget->count(), 1); + verifyAp(0, QString("SSID 1"), CMManagerShim::WlanSecModeOpen); + + appendWlanAp("SSID 2", 90, 0, CMManagerShim::WlanSecModeWpa); + + mWidget->updateContent(mIaps, mAps, 0); + + QCOMPARE(mListWidget->count(), 2); + verifyAp(0, QString("SSID 1"), CMManagerShim::WlanSecModeOpen); + verifyAp(1, QString("SSID 2"), CMManagerShim::WlanSecModeWpa); +} + +/*! + This function tests Wlan list widget content updating. + */ + +void TestWlanSniffer::testUpdateContentIapRemoved() +{ + appendWlanIap(1, 0, "SSID 1", "SSID 1", 20, CMManagerShim::WlanSecModeWpa); + appendWlanIap(2, 0, "SSID 2", "SSID 2", 90, CMManagerShim::WlanSecModeWpa); + appendWlanAp("SSID 3", 90, 0, CMManagerShim::WlanSecModeWep); + + mWidget->updateContent(mIaps, mAps, 0); + + QCOMPARE(mListWidget->count(), 3); + verifyIap(0, 1); + verifyIap(1, 2); + verifyAp(2, QString("SSID 3"), CMManagerShim::WlanSecModeWep); + + mIaps.takeAt(0); + + mWidget->updateContent(mIaps, mAps, 0); + + QCOMPARE(mListWidget->count(), 2); + verifyIap(0, 2); + verifyAp(1, QString("SSID 3"), CMManagerShim::WlanSecModeWep); +} + +/*! + This function tests Wlan list widget content updating. + */ + +void TestWlanSniffer::testUpdateContentApRemoved() +{ + appendWlanAp("SSID 1", 20, 0, CMManagerShim::WlanSecModeOpen); + + mWidget->updateContent(mIaps, mAps, 0); + + QCOMPARE(mListWidget->count(), 1); + verifyAp(0, QString("SSID 1"), CMManagerShim::WlanSecModeOpen); + + mAps.takeAt(0); + + mWidget->updateContent(mIaps, mAps, 0); + + QCOMPARE(mListWidget->count(), 0); +} + +/*! + This function tests Wlan list widget content updating. + */ + +void TestWlanSniffer::testUpdateContentIapConnected() +{ + appendWlanIap(1, 0, "SSID 1", "SSID 1", 95, CMManagerShim::WlanSecModeWpa); + appendWlanIap(2, 0, "SSID 2", "SSID 2", 15, CMManagerShim::WlanSecModeWpa); + appendWlanAp("SSID 3", 20, 0, CMManagerShim::WlanSecModeOpen); + + mWidget->updateContent(mIaps, mAps, 0); + + QCOMPARE(mListWidget->count(), 3); + verifyIap(0, 1); + verifyIap(1, 2); + verifyAp(2, QString("SSID 3"), CMManagerShim::WlanSecModeOpen); + + // IAP order changed because one is connected + mIaps.clear(); + appendWlanIap(2, 0, "SSID 2", "SSID 2", 20, CMManagerShim::WlanSecModeWpa); + appendWlanIap(1, 0, "SSID 1", "SSID 1", 20, CMManagerShim::WlanSecModeWpa); + + mWidget->updateContent(mIaps, mAps, 2); + + QCOMPARE(mListWidget->count(), 3); + verifyIap(0, 2); + verifyIap(1, 1); + verifyAp(2, QString("SSID 3"), CMManagerShim::WlanSecModeOpen); +} + +/*! + This function tests Wlan list widget content updating. + */ + +void TestWlanSniffer::testUpdateContentIapDisconnected() +{ + appendWlanIap(2, 0, "SSID 2", "SSID 2", 20, CMManagerShim::WlanSecModeWpa); + appendWlanIap(1, 0, "SSID 1", "SSID 1", 20, CMManagerShim::WlanSecModeWpa); + appendWlanAp("SSID 3", 20, 0, CMManagerShim::WlanSecModeOpen); + + mWidget->updateContent(mIaps, mAps, 2); + + QCOMPARE(mListWidget->count(), 3); + verifyIap(0, 2); + verifyIap(1, 1); + verifyAp(2, QString("SSID 3"), CMManagerShim::WlanSecModeOpen); + + // IAP order changed because not connected anymore + mIaps.clear(); + appendWlanIap(1, 0, "SSID 1", "SSID 1", 20, CMManagerShim::WlanSecModeWpa); + appendWlanIap(2, 0, "SSID 2", "SSID 2", 60, CMManagerShim::WlanSecModeWpa); + + mWidget->updateContent(mIaps, mAps, 0); + + QCOMPARE(mListWidget->count(), 3); + verifyIap(0, 1); + verifyIap(1, 2); + verifyAp(2, QString("SSID 3"), CMManagerShim::WlanSecModeOpen); +} + +/*! + This function tests Wlan list widget content updating. + */ + +void TestWlanSniffer::testUpdateContentRobustness1() +{ + appendWlanIap(1, 0, "SSID 1", "SSID 1", 15, CMManagerShim::WlanSecModeWpa); + appendWlanIap(2, 0, "SSID 2", "SSID 2", 95, CMManagerShim::WlanSecModeWpa); + appendWlanAp("SSID 3", 20, 0, CMManagerShim::WlanSecModeOpen); + appendWlanAp("SSID 4", 30, 0, CMManagerShim::WlanSecModeWep); + appendWlanAp("SSID 5", 40, 0, CMManagerShim::WlanSecModeOpen); + + mWidget->updateContent(mIaps, mAps, 0); + + QCOMPARE(mListWidget->count(), 5); + verifyIap(0, 1); + verifyIap(1, 2); + verifyAp(2, QString("SSID 3"), CMManagerShim::WlanSecModeOpen); + verifyAp(3, QString("SSID 4"), CMManagerShim::WlanSecModeWep); + verifyAp(4, QString("SSID 5"), CMManagerShim::WlanSecModeOpen); + + mIaps.clear(); + appendWlanIap(3, 0, "SSID 3", "SSID 3", 10, CMManagerShim::WlanSecModeOpen); + appendWlanIap(1, 0, "SSID 1", "SSID 1", 20, CMManagerShim::WlanSecModeWpa); + appendWlanIap(2, 0, "SSID 2", "SSID 2", 30, CMManagerShim::WlanSecModeWpa); + mAps.clear(); + appendWlanAp("SSID 4", 30, 0, CMManagerShim::WlanSecModeWep); + appendWlanAp("SSID 5", 40, 0, CMManagerShim::WlanSecModeOpen); + appendWlanAp("SSID 6", 30, 0, CMManagerShim::WlanSecModeWep); + appendWlanAp("SSID 7", 40, 0, CMManagerShim::WlanSecModeOpen); + + mWidget->updateContent(mIaps, mAps, 3); + + QCOMPARE(mListWidget->count(), 7); + verifyIap(0, 3); + verifyIap(1, 1); + verifyIap(2, 2); + verifyAp(3, QString("SSID 4"), CMManagerShim::WlanSecModeWep); + verifyAp(4, QString("SSID 5"), CMManagerShim::WlanSecModeOpen); + verifyAp(5, QString("SSID 6"), CMManagerShim::WlanSecModeWep); + verifyAp(6, QString("SSID 7"), CMManagerShim::WlanSecModeOpen); + + mIaps.clear(); + appendWlanIap(4, 0, "SSID X", "SSID X", 10, CMManagerShim::WlanSecModeWpa); + appendWlanIap(2, 0, "SSID 2", "SSID 2", 20, CMManagerShim::WlanSecModeWpa); + appendWlanIap(3, 0, "SSID 3", "SSID 3", 10, CMManagerShim::WlanSecModeOpen); + appendWlanIap(5, 0, "SSID 3", "SSID 3", 50, CMManagerShim::WlanSecModeWapi); + mAps.clear(); + appendWlanAp("SSID 4", 30, 0, CMManagerShim::WlanSecModeOpen); + appendWlanAp("SSID 4a", 40, 0, CMManagerShim::WlanSecModeOpen); + appendWlanAp("SSID 7", 76, 0, CMManagerShim::WlanSecModeOpen); + appendWlanAp("SSID 7", 90, 0, CMManagerShim::WlanSecModeWep); + appendWlanAp("SSID 8", 30, 0, CMManagerShim::WlanSecModeWpa); + appendWlanAp("SSID 9", 30, 0, CMManagerShim::WlanSecModeWpa); + + mWidget->updateContent(mIaps, mAps, 4); + + QCOMPARE(mListWidget->count(), 10); + verifyIap(0, 4); + verifyIap(1, 2); + verifyIap(2, 3); + verifyIap(3, 5); + verifyAp(4, QString("SSID 4"), CMManagerShim::WlanSecModeOpen); + verifyAp(5, QString("SSID 4a"), CMManagerShim::WlanSecModeOpen); + verifyAp(6, QString("SSID 7"), CMManagerShim::WlanSecModeOpen); + verifyAp(7, QString("SSID 7"), CMManagerShim::WlanSecModeWep); + verifyAp(8, QString("SSID 8"), CMManagerShim::WlanSecModeWpa); + verifyAp(9, QString("SSID 9"), CMManagerShim::WlanSecModeWpa); + + mIaps.clear(); + appendWlanIap(3, 0, "SSID 3", "SSID 3", 50, CMManagerShim::WlanSecModeOpen); + mAps.clear(); + + mWidget->updateContent(mIaps, mAps, 0); + + QCOMPARE(mListWidget->count(), 1); + verifyIap(0, 3); + + mIaps.clear(); + mAps.clear(); + + mWidget->updateContent(mIaps, mAps, 0); + + QCOMPARE(mListWidget->count(), 0); +} + +/*! + This function tests Wlan list widget content updating. + */ + +void TestWlanSniffer::testUpdateContentRobustness2() +{ + QSharedPointer iap2(new WlanQtUtilsIap()); + iap2->setValue(WlanQtUtilsIap::ConfIdIapId, 2); + iap2->setValue(WlanQtUtilsIap::ConfIdNetworkId, 0); + iap2->setValue(WlanQtUtilsIap::ConfIdName, "SSID 2"); + iap2->setValue(WlanQtUtilsAp::ConfIdSsid, "SSID 2"); + iap2->setValue(WlanQtUtilsAp::ConfIdSignalStrength, 10); + iap2->setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Infra); + iap2->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa); + QSharedPointer iap4(new WlanQtUtilsIap()); + iap4->setValue(WlanQtUtilsIap::ConfIdIapId, 4); + iap4->setValue(WlanQtUtilsIap::ConfIdNetworkId, 0); + iap4->setValue(WlanQtUtilsIap::ConfIdName, "SSID 4"); + iap4->setValue(WlanQtUtilsAp::ConfIdSsid, "SSID 4"); + iap4->setValue(WlanQtUtilsAp::ConfIdSignalStrength, 20); + iap4->setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Infra); + iap4->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa); + + appendWlanAp("SSID 1", 20, 0, CMManagerShim::WlanSecModeOpen); + appendWlanAp("SSID 3", 20, 0, CMManagerShim::WlanSecModeWpa); + appendWlanAp("SSID 5", 20, 0, CMManagerShim::WlanSecModeWpa); + appendWlanAp("SSID 6", 20, 0, CMManagerShim::WlanSecModeWpa); + + mIaps.append(iap2); + mIaps.append(iap4); + + mWidget->updateContent(mIaps, mAps, 0); + + QCOMPARE(mListWidget->count(), 6); + verifyIap(0, 2); + verifyIap(1, 4); + verifyAp(2, QString("SSID 1"), CMManagerShim::WlanSecModeOpen); + verifyAp(3, QString("SSID 3"), CMManagerShim::WlanSecModeWpa); + verifyAp(4, QString("SSID 5"), CMManagerShim::WlanSecModeWpa); + verifyAp(5, QString("SSID 6"), CMManagerShim::WlanSecModeWpa); + + mIaps.clear(); + mAps.clear(); + mIaps.append(iap2); + appendWlanAp("SSID 1", 20, 0, CMManagerShim::WlanSecModeOpen); + + mWidget->updateContent(mIaps, mAps, 0); + + QCOMPARE(mListWidget->count(), 2); + verifyIap(0, 2); + verifyAp(1, QString("SSID 1"), CMManagerShim::WlanSecModeOpen); + + mIaps.clear(); + mAps.clear(); + mIaps.append(iap2); + mIaps.append(iap4); + appendWlanAp("SSID 1", 20, 0, CMManagerShim::WlanSecModeOpen); + appendWlanAp("SSID 3", 20, 0, CMManagerShim::WlanSecModeWpa); + appendWlanAp("SSID 5", 20, 0, CMManagerShim::WlanSecModeWpa); + appendWlanAp("SSID 6", 20, 0, CMManagerShim::WlanSecModeWpa); + + mWidget->updateContent(mIaps, mAps, 0); + + QCOMPARE(mListWidget->count(), 6); + verifyIap(0, 2); + verifyIap(1, 4); + verifyAp(2, QString("SSID 1"), CMManagerShim::WlanSecModeOpen); + verifyAp(3, QString("SSID 3"), CMManagerShim::WlanSecModeWpa); + verifyAp(4, QString("SSID 5"), CMManagerShim::WlanSecModeWpa); + verifyAp(5, QString("SSID 6"), CMManagerShim::WlanSecModeWpa); +} + +/*! + This function tests list sorting. The list content comes in "random" order, + and the list widget should sort the list alphabetically. + */ + +void TestWlanSniffer::testUpdateContentSort() +{ + appendWlanIap(1, 0, "Dada", "dada", 20, CMManagerShim::WlanSecModeOpen); + appendWlanIap(2, 0, "salakka", "salakka", 30, CMManagerShim::WlanSecModeWpa); + appendWlanIap(3, 0, "lahna", "lahna", 40, CMManagerShim::WlanSecModeOpen); + appendWlanIap(4, 0, "Labiili", "labiili", 50, CMManagerShim::WlanSecModeOpen); + appendWlanIap(5, 0, "ABCD", "ABCD", 60, CMManagerShim::WlanSecModeWpa); + appendWlanIap(6, 0, "connected", "connected", 60, CMManagerShim::WlanSecModeOpen); + appendWlanIap(7, 0, "IAP 1", "IAP 1", 10, CMManagerShim::WlanSecModeOpen); + appendWlanIap(8, 0, "IAP 10", "IAP 10", 10, CMManagerShim::WlanSecModeOpen); + appendWlanIap(9, 0, "IAP 2", "IAP 2", 10, CMManagerShim::WlanSecModeOpen); + appendWlanIap(10, 0, "IAP 11", "IAP 11", 10, CMManagerShim::WlanSecModeOpen); + + appendWlanAp("jokuap", 20, 0, CMManagerShim::WlanSecModeWpa); + appendWlanAp("Jippii", 30, 0, CMManagerShim::WlanSecModeOpen); + appendWlanAp("jalava", 40, 0, CMManagerShim::WlanSecModeWpa); + appendWlanAp("abba", 50, 0, CMManagerShim::WlanSecModeOpen); + appendWlanAp("hippokampus", 60, 0, CMManagerShim::WlanSecModeOpen); + + mWidget->updateContent(mIaps, mAps, 6); + + QCOMPARE(mListWidget->count(), 15); + verifyIap(0, 6); + verifyIap(1, 5); + verifyIap(2, 1); + verifyIap(3, 7); + verifyIap(4, 8); + verifyIap(5, 10); + verifyIap(6, 9); + verifyIap(7, 4); + verifyIap(8, 3); + verifyIap(9, 2); + verifyAp(10, QString("abba"), CMManagerShim::WlanSecModeOpen); + verifyAp(11, QString("hippokampus"), CMManagerShim::WlanSecModeOpen); + verifyAp(12, QString("jalava"), CMManagerShim::WlanSecModeWpa); + verifyAp(13, QString("Jippii"), CMManagerShim::WlanSecModeOpen); + verifyAp(14, QString("jokuap"), CMManagerShim::WlanSecModeWpa); +} + +/*! + This function tests list scrolling. There's no way to verify in this test + that the scrolling actually works, but let's execute the code at least. + */ + +void TestWlanSniffer::testScrollTo() +{ + appendWlanIap(1, 0, "SSID 1", "SSID 1", 15, CMManagerShim::WlanSecModeWpa); + appendWlanIap(2, 0, "SSID 2", "SSID 2", 95, CMManagerShim::WlanSecModeWpa); + appendWlanAp("SSID 3", 20, 0, CMManagerShim::WlanSecModeOpen); + appendWlanAp("SSID 4", 30, 0, CMManagerShim::WlanSecModeWep); + appendWlanAp("SSID 5", 40, 0, CMManagerShim::WlanSecModeOpen); + appendWlanAp("SSID 6", 20, 0, CMManagerShim::WlanSecModeOpen); + appendWlanAp("SSID 7", 30, 0, CMManagerShim::WlanSecModeWep); + appendWlanAp("SSID 8", 40, 0, CMManagerShim::WlanSecModeOpen); + appendWlanAp("SSID 9", 20, 0, CMManagerShim::WlanSecModeOpen); + appendWlanAp("SSID 10", 30, 0, CMManagerShim::WlanSecModeWep); + appendWlanAp("SSID 11", 40, 0, CMManagerShim::WlanSecModeOpen); + appendWlanAp("SSID 12", 20, 0, CMManagerShim::WlanSecModeOpen); + appendWlanAp("SSID 13", 30, 0, CMManagerShim::WlanSecModeWep); + appendWlanAp("SSID 14", 40, 0, CMManagerShim::WlanSecModeOpen); + + mWidget->updateContent(mIaps, mAps, 0); + + QCOMPARE(mListWidget->count(), 14); + + // Scroll to last row + mWidget->scrollTo(13); + // Scroll to non-existing row -> ignored + mWidget->scrollTo(20); + // Scroll to first row + mWidget->scrollTo(0); + + QCOMPARE(mListWidget->count(), 14); +} + +/*! + This function verifies that the item on "row" is an IAP matching the given parameters. + */ + +void TestWlanSniffer::verifyIap(int row, int iapId) +{ + QVERIFY(mListWidget->item(row)->data().canConvert()); + int id = mListWidget->item(row)->data().value(); + QCOMPARE(id, iapId); +} + +/*! + This function verifies that the item on "row" is an AP matching the given parameters. + */ + +void TestWlanSniffer::verifyAp(int row, QString ssid, int securityMode) +{ + QVERIFY(mListWidget->item(row)->data().canConvert()); + WlanQtUtilsAp ap = mListWidget->item(row)->data().value(); + QCOMPARE(ap.value(WlanQtUtilsAp::ConfIdSsid).toString(), ssid); + QCOMPARE(ap.value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(), securityMode); +} + +/*! + Sub test case for appending an AP to AP list. +*/ + +void TestWlanSniffer::appendWlanAp( + QString ssId, + int signalStrength, + int networkMode, + int securityMode) +{ + QSharedPointer ap(new WlanQtUtilsAp()); + ap->setValue(WlanQtUtilsAp::ConfIdSsid, ssId); + ap->setValue(WlanQtUtilsAp::ConfIdSignalStrength, signalStrength); + ap->setValue(WlanQtUtilsAp::ConfIdConnectionMode, networkMode); + ap->setValue(WlanQtUtilsAp::ConfIdSecurityMode, securityMode); + ap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, false); + ap->setValue(WlanQtUtilsAp::ConfIdWpsSupported, false); + mAps.append(ap); +} + +/*! + Sub test case for appending an IAP to IAP list. +*/ + +void TestWlanSniffer::appendWlanIap( + int iapId, + int netId, + QString name, + QString ssId, + int signalStrength, + int securityMode) +{ + WlanQtUtilsIap *iap = new WlanQtUtilsIap(); + iap->setValue(WlanQtUtilsIap::ConfIdIapId, iapId); + iap->setValue(WlanQtUtilsIap::ConfIdNetworkId, netId); + iap->setValue(WlanQtUtilsIap::ConfIdName, name); + iap->setValue(WlanQtUtilsAp::ConfIdSsid, ssId); + iap->setValue(WlanQtUtilsAp::ConfIdSignalStrength, signalStrength); + iap->setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Infra); + iap->setValue(WlanQtUtilsAp::ConfIdSecurityMode, securityMode); + iap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, false); + iap->setValue(WlanQtUtilsAp::ConfIdWpsSupported, false); + mIaps.append(QSharedPointer(iap)); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/tsrc/t_wlansniffer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/tsrc/t_wlansniffer.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is the header file for testing Wlan Sniffer application. +*/ + +#ifndef T_WLANSNIFFER_H +#define T_WLANSNIFFER_H + +// System includes + +#include +#include + +// User includes + +// Forward declarations + +class HbListWidget; +class WlanQtUtilsIap; +class WlanQtUtilsAp; +class WlanSnifferListWidget; + +// External data types + +// Constants + +// Class declaration + +class TestWlanSniffer: public QObject +{ + Q_OBJECT + +private slots: + + // Functions from QTest framework. + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + + // Test functions for WlanSnifferListWidget class + void testUpdateContentIapAdded(); + void testUpdateContentApAdded(); + void testUpdateContentIapRemoved(); + void testUpdateContentApRemoved(); + void testUpdateContentIapConnected(); + void testUpdateContentIapDisconnected(); + void testUpdateContentRobustness1(); + void testUpdateContentRobustness2(); + void testUpdateContentSort(); + void testScrollTo(); + +private: + + // Helper functions, that is, sub test cases. + void verifyIap(int row, int iapId); + void verifyAp(int row, QString ssid, int securityMode); + void appendWlanAp( + QString ssId, + int signalStrength, + int networkMode, + int securityMode); + void appendWlanIap( + int iapId, + int netId, + QString name, + QString ssId, + int signalStrength, + int securityMode); + +private: // data + + HbListWidget *mListWidget; + WlanSnifferListWidget *mWidget; + QList< QSharedPointer > mIaps; + QList< QSharedPointer > mAps; +}; + +#endif // T_WLANSNIFFER_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/tsrc/t_wlansniffer.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/tsrc/t_wlansniffer.pro Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,49 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# WLAN Sniffer UT project file. +# + +CONFIG += qtestlib hb + +TEMPLATE = app +TARGET = t_wlansniffer + +TARGET.CAPABILITY = ALL -TCB + +DEPENDPATH += . + +#Store generated files to their own directory +MOC_DIR = build +RCC_DIR = build + +INCLUDEPATH += \ + . \ + ../inc \ + ../traces \ + ../../../inc + +# Input +HEADERS += \ + t_wlansniffer.h \ + ../inc/wlansnifferlistitem.h \ + ../inc/wlansnifferlistwidget.h \ + ../traces/OstTraceDefinitions.h + +SOURCES += \ + t_wlansniffer.cpp \ + ../src/wlansnifferlistitem.cpp \ + ../src/wlansnifferlistwidget.cpp + +symbian*::LIBS += -lwlanqtutilities diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferapplication/wlansnifferapplication.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/wlansnifferapplication.pro Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,79 @@ +# +# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# Project file for WLAN Sniffer application. +# + +TEMPLATE = app +TARGET = wlansniffer +DEPENDPATH += . +# Own headers +INCLUDEPATH += \ + inc \ + traces +# wlanutilities Private API +INCLUDEPATH += ../../inc +CONFIG += hb no_icon service + +# Temporary solution to fix tracecompiler +# When tracecompiler is fixed, this can be removed +symbian: { + MMP_RULES += "USERINCLUDE traces" +} + +#Store generated files to their own directory +MOC_DIR = build +RCC_DIR = build + +TRANSLATIONS = wlansniffer.ts + +# Input +SOURCES += \ + src/main.cpp \ + src/wlansniffer.cpp \ + src/wlansnifferengine.cpp \ + src/wlansnifferlistitem.cpp \ + src/wlansnifferlistview.cpp \ + src/wlansnifferlistwidget.cpp \ + src/wlansniffermainwindow.cpp \ + src/wlansnifferservice.cpp + +HEADERS += \ + inc/wlansniffer.h \ + inc/wlansnifferengine.h \ + inc/wlansnifferlistitem.h \ + inc/wlansnifferlistview.h \ + inc/wlansnifferlistwidget.h \ + inc/wlansniffermainwindow.h \ + inc/wlansnifferservice.h \ + traces/OstTraceDefinitions.h + +RESOURCES = res/wlansniffer.qrc + +SERVICE.FILE = res/service_conf.xml +SERVICE.OPTIONS = embeddable + +# Common libraries +LIBS += -lwlanqtutilities -lxqservice -lxqserviceutil -lqtsysteminfo -lwlanwizard -lxqsettingsmanager + +symbian*: { + TARGET.CAPABILITY = CAP_APPLICATION NetworkControl + TARGET.UID3 = 0x10281CAA + + BLD_INF_RULES.prj_exports += "rom/wlansniffer.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wlansniffer.iby)" + BLD_INF_RULES.prj_exports += "rom/wlansniffer_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(wlansniffer_resources.iby)" + + # Enable for QtHighway tracing + # DEFINES += WLANSNIFFER_SERVICETRACES +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferkeepalive/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferkeepalive/group/bld.inf Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Build info file for Wlan Sniffer Keepalive process +*/ + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../rom/wsfkeepalive.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wsfkeepalive.iby) + +PRJ_MMPFILES +wsfkeepalive.mmp diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferkeepalive/group/wsfkeepalive.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferkeepalive/group/wsfkeepalive.mmp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Project definition file for Wlan Sniffer Keepalive process. +*/ + +TARGET wlansnifferkeepalive.exe +TARGETTYPE exe +UID 0x100039CE 0x2002FF5F + +USERINCLUDE ../inc +USERINCLUDE ../traces +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src +SOURCE main.cpp +SOURCE wsfkeepalive.cpp +SOURCE wsfkeepalivecmm.cpp +SOURCE wsfkeepaliveconnmon.cpp +SOURCE wsfkeepaliveconnmondisc.cpp +SOURCE wsfkeepaliveesock.cpp +SOURCE wsfkeepalivetimer.cpp + +LIBRARY euser.lib +LIBRARY connmon.lib +LIBRARY esock.lib +LIBRARY extendedconnpref.lib +LIBRARY netmeta.lib +LIBRARY cmmanager.lib + +CAPABILITY CAP_APPLICATION NetworkControl + +#ifdef ENABLE_ABIV2_MODE + DEBUGGABLE_UDEBONLY +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepalive.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepalive.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Main implementation of Wlan Sniffer Keepalive application. +*/ + +#ifndef WSFKEEPALIVE_H +#define WSFKEEPALIVE_H + +// System includes + +// User includes + +#include "wsfkeepalivetimer.h" + +// Forward declarations + +class CWsfKeepaliveCmm; +class CWsfKeepaliveConnMon; +class CWsfKeepaliveConnMonDisc; +class CWsfKeepaliveEsock; + +// External data types + +// Global function prototypes + +// Constants + +// Class declaration + +/** + * Main implementation of Wlan Sniffer Keepalive application. + * + * This class contains the actual application logic, which monitors + * Wlan connections and keeps them alive, if needed. + */ +class CWsfKeepalive : public CBase, public MWsfKeepaliveTimerNotify + { + // Friend classes: + friend class CWsfKeepaliveTestSuite; + +public: + + // Data types + + // Constants + + /** Invalid/not available connection ID */ + static const TUint KInvalidConnectionId = 0; + + /** Constructors */ + + /** + * Two-phased constructor. + * + * @return New object allocated from heap + */ + static CWsfKeepalive* NewL(); + + /**> Destructor */ + virtual ~CWsfKeepalive(); + +public: + + /** + * Timer expiration handler. Disconnects the monitored connection, + * if needed. Restarts timer, if needed. + * + * @param aError Status of the timer event + */ + void TimerExpired( TInt aError ); + + /** + * Wlan connection event handler. Shares and starts to monitor the + * opened connection, if necessary. + * + * @param aConnectionId ID of the opened connection + * @param aIapId IAP ID of the opened connection + */ + void WlanConnectionOpenedL( TUint aConnectionId, TUint aIapId ); + + /** + * Wlan connection event handler. Stops monitoring the connection. + */ + void WlanConnectionClosed(); + +protected: + +private: + + CWsfKeepalive(); + + void ConstructL(); + + TBool OpenedByWlanSniffer( TUint aConnectionId ); + + TBool NoRealClients( TUint aConnectionId ); + + void SetState( TUint aState ); + +private: // Data + + // Constants + + /** + * State values for the keepalive implementation + */ + enum + { + /** Not monitoring any connection */ + EInactive, + /** Monitoring connection, which has no real clients */ + EActiveNoClients, + /** Monitoring connection, which has one or more real clients */ + EActiveWithClients + }; + + /** + * Timer for polling users of a connection + */ + CWsfKeepaliveTimer* iTimer; + + /** + * Connection Method Manager class reference + */ + CWsfKeepaliveCmm* iCmMgr; + + /** + * Connection Monitor class reference + */ + CWsfKeepaliveConnMon* iConnMon; + + /** + * Connection Disconnector class reference + */ + CWsfKeepaliveConnMonDisc* iConnMonDisc; + + /** + * RConnection handler class reference + */ + CWsfKeepaliveEsock* iEsock; + + /** + * Time when keepalive started for monitored connection + */ + TTime iKeepaliveStart; + + /** + * ID of monitored connection, KInvalidConnectionId if not valid + */ + TUint iConnectionId; + + /** + * State of the keepalive implementation + */ + TUint iState; + + /** + * IapId of the connection + */ + TUint iIapId; + }; + +#endif // WSFKEEPALIVE_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepalivecmm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepalivecmm.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Connection Method Manager interface implementation. + */ + +#ifndef WSFKEEPALIVECMM_H +#define WSFKEEPALIVECMM_H + +// System includes + +#include +#include + +// User includes + +// Forward declarations + +class CWsfKeepalive; + +// External data types + +// Global function prototypes + +// Constants + +// Class declaration + +/** + * Connection Method Manager interface implementation. + * + * This class uses the Connection Method Manager interface to get and deleted + * Hotspot IAP. + */ +class CWsfKeepaliveCmm : public CBase + { + // Friend classes: + +public: + + // Data types + + /** Constructors */ + + /** + * Two-phased constructor. + * + */ + static CWsfKeepaliveCmm* NewL(); + + /**> Destructor */ + virtual ~CWsfKeepaliveCmm(); + +public: + + /** + * Cm Manager Hotspot info getter. + */ + TBool CWsfKeepaliveCmm::GetHotspotInfoL(TInt32 aIapId); + + /** + * Cm Manager Hotspot IAP deleter. + */ + TBool CWsfKeepaliveCmm::DeleteHotspotIapL(TInt32 aIapId); + +protected: + +private: + + CWsfKeepaliveCmm(); + + void ConstructL(); + + +private: // Data + + /** + * Handle to Connection Method Manger + */ + RCmManager iCmManager; + + }; + +#endif // WSFKEEPALIVECMM_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepaliveconnmon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepaliveconnmon.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Connection Monitor interface implementation. + */ + +#ifndef WSFKEEPALIVECONNMON_H +#define WSFKEEPALIVECONNMON_H + +// System includes + +#include +#include + +// User includes + +// Forward declarations + +class CWsfKeepalive; + +// External data types + +// Global function prototypes + +// Constants + +// Class declaration + +/** + * Connection Monitor interface implementation. + * + * This class uses the Connection Monitor interface to monitor status + * of Wlan connections we might be interested in. + */ +class CWsfKeepaliveConnMon : public CBase, public MConnectionMonitorObserver + { + // Friend classes: + +public: + + // Data types + + /** Constructors */ + + /** + * Two-phased constructor. + * + * @param aNotify Status of Wlan connections is notified to this class + * @return New object allocated from heap + */ + static CWsfKeepaliveConnMon* NewL( CWsfKeepalive& aNotify ); + + /**> Destructor */ + virtual ~CWsfKeepaliveConnMon(); + +public: + + /** + * Connection Monitor connection client info getter. + * + * @param aClientInfo Where to store information + * @param aConnectionId ID of the connection, whose info is requested + */ + void GetClientInfo( + TConnMonClientEnumBuf& aClientInfo, + TUint aConnectionId ); + +protected: + +private: + + CWsfKeepaliveConnMon( CWsfKeepalive& aNotify ); + + void ConstructL(); + + void EventL( const CConnMonEventBase& aConnMonEvent ); + +private: // Data + + /** + * Status of Wlan connections is notified to this class + */ + CWsfKeepalive& iNotify; + + /** + * Handle to Connection Monitor Server + */ + RConnectionMonitor iMonitor; + + /** + * Id of the connection we are currently monitoring + */ + TUint iMonitoringConnectionId; + }; + +#endif // WSFKEEPALIVECONNMON_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepaliveconnmondisc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepaliveconnmondisc.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Connection Monitor disconnect interface implementation. + */ + +#ifndef WSFKEEPALIVECONNMONDISC_H +#define WSFKEEPALIVECONNMONDISC_H + +// System includes + +#include + +// User includes + +// Forward declarations + +class RConnectionMonitor; + +// External data types + +// Global function prototypes + +// Constants + +// Class declaration + +/** + * Connection Monitor disconnect interface implementation. + * + * This class uses the Connection Monitor interface to disconnect + * connections regardless of the amount of users for the connection. + */ +class CWsfKeepaliveConnMonDisc : public CBase + { + // Friend classes: + +public: + + // Data types + + /** Constructors */ + + /** + * Two-phased constructor. + * + * @return New object allocated from heap + */ + static CWsfKeepaliveConnMonDisc* NewL(); + + /**> Destructor */ + virtual ~CWsfKeepaliveConnMonDisc(); + +public: + + /** + * Disconnects the given connection regardless of the amount of + * users for the connection. + * + * @param aConnectionId ID of the connection to disconnect + */ + void Disconnect( TUint aConnectionId ); + +protected: + +private: + + CWsfKeepaliveConnMonDisc(); + + void ConstructL(); + +private: // Data + + /** + * Handle to Connection Monitor Server + */ + RConnectionMonitor iMonitor; + }; + +#endif // WSFKEEPALIVECONNMONDISC_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepaliveesock.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepaliveesock.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Esock library (RConnection) interface implementation. +*/ + +#ifndef WSFKEEPALIVEESOCK_H +#define WSFKEEPALIVEESOCK_H + +// System includes + +#include + +// User includes + +// Forward declarations + +// External data types + +// Global function prototypes + +// Constants + +// Class declaration + +/** + * Esock library (RConnection) interface implementation. + * + * This class implements RConnection opening and closing using the Esock + * library. + */ +class CWsfKeepaliveEsock : public CActive +{ + // Friend classes: + +public: + + // Data types + + /** Constructors */ + + /** + * Two-phased constructor. + * + * @return New object allocated from heap + */ + static CWsfKeepaliveEsock* NewL(); + + /**> Destructor */ + virtual ~CWsfKeepaliveEsock(); + +public: + + /** + * Starts connection creation. + * + * @param aIapId ID of the IAP to connect + */ + void ConnectL( TUint aIapId ); + + /** + * Stops connection. + */ + void Disconnect(); + +private: + + CWsfKeepaliveEsock(); + + void ConstructL(); + + void RunL(); + + void DoCancel(); + +private: // Data + + /** + * Handle to Socket Server + */ + RSocketServ iSocketServer; + + /** + * Handle to RConnection object + */ + RConnection iConnection; +}; + +#endif // WSFKEEPALIVEESOCK_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepalivetimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepalivetimer.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Timer implementation. +*/ + +#ifndef WSFKEEPALIVETIMER_H +#define WSFKEEPALIVETIMER_H + +// System includes + +#include + +// User includes + +// Forward declarations + +// External data types + +// Global function prototypes + +// Constants + +// Class declaration + +/** + * Timer interface class. + * + * This is an interface class, which the Keepalive implementation needs + * to inherit in order to receive timer notifications. + */ +class MWsfKeepaliveTimerNotify + { +public: + + /** + * Pure virtual timer expiration function that needs to be + * implemented in the Keepalive implementation class. + * + * @param aError Status of the timer event + */ + virtual void TimerExpired( TInt aError ) = 0; + }; + +/** + * Timer implementation. + * + * This is the actual timer implementation class. + */ +class CWsfKeepaliveTimer: public CActive +{ + // Friend classes: + +public: + + // Data types + + /** Constructors */ + + /** + * Two-phased constructor. + * + * @param aNotify Timer expirations are notified to this class + * @return New object allocated from heap + */ + static CWsfKeepaliveTimer* NewL( MWsfKeepaliveTimerNotify& aNotify ); + + /**> Destructor */ + virtual ~CWsfKeepaliveTimer(); + +public: + + /** + * Sets the timer to expire after the given interval. + * + * @param aInterval Interval in microseconds + */ + void After( TTimeIntervalMicroSeconds32 aInterval ); + + /** + * Stops the timer. + */ + void Stop(); + +protected: + +private: + + CWsfKeepaliveTimer( MWsfKeepaliveTimerNotify& aNotify ); + + void ConstructL(); + + void RunL(); + + void DoCancel(); + +private: // Data + + /** + * Actual timer object + */ + RTimer iTimer; + + /** + * Timer expirations are notified to this class + */ + MWsfKeepaliveTimerNotify& iNotify; + }; + +#endif // WSFKEEPALIVETIMER_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferkeepalive/rom/wsfkeepalive.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferkeepalive/rom/wsfkeepalive.iby Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Wlan Sniffer Keepalive process iby. + */ + +#ifndef WSFKEEPALIVE_IBY +#define WSFKEEPALIVE_IBY + +#include + +#ifdef __PROTOCOL_WLAN + +file=ABI_DIR\BUILD_DIR\wlansnifferkeepalive.exe PROGRAMS_DIR\wlansnifferkeepalive.exe + +#endif // __PROTOCOL_WLAN + +#endif // WSFKEEPALIVE_IBY diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferkeepalive/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferkeepalive/src/main.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Wlan Sniffer Keepalive main function. +*/ + +// System include files + +#include +#include + +// User include files + +#include "wsfkeepalive.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "mainTraces.h" +#endif + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Main implementation run in the active scheduler. +// --------------------------------------------------------------------------- +// +LOCAL_C void MainL() + { + OstTraceFunctionEntry0( WSFKEEPALIVEMAINL_ENTRY ); + + // Create the main implementation class and start monitoring events + CWsfKeepalive* implementation = CWsfKeepalive::NewL(); + + // Start active scheduler + CActiveScheduler::Start(); + + // All finished, cleanup + delete implementation; + + OstTraceFunctionExit0( WSFKEEPALIVEMAINL_EXIT ); + } + +// --------------------------------------------------------------------------- +// Starts main implementation. +// --------------------------------------------------------------------------- +// +LOCAL_C void DoStartL() + { + OstTraceFunctionEntry0( WSFKEEPALIVEDOSTARTL_ENTRY ); + + // Create active scheduler (to run active objects) + CActiveScheduler* scheduler = new (ELeave) CActiveScheduler(); + CleanupStack::PushL( scheduler ); + CActiveScheduler::Install( scheduler ); + + MainL(); + + // Delete active scheduler + CleanupStack::PopAndDestroy( scheduler ); + + OstTraceFunctionExit0( WSFKEEPALIVEDOSTARTL_EXIT ); + } + +// ======== GLOBAL FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Main function of the application executable. +// --------------------------------------------------------------------------- +// +GLDEF_C TInt E32Main() + { + OstTraceFunctionEntry0( WSFKEEPALIVEE32MAIN_ENTRY ); + + // Create cleanup stack + __UHEAP_MARK; + CTrapCleanup* cleanup = CTrapCleanup::New(); + + // Run application code inside TRAP harness + TRAPD( mainError, DoStartL() ); + if ( mainError ) + { + OstTrace1( + TRACE_FATAL, + _E32MAIN_ERROR, + "::E32Main Error;mainError=%d", + mainError ); + } + + delete cleanup; + __UHEAP_MARKEND; + + OstTraceFunctionExit0( WSFKEEPALIVEE32MAIN_EXIT ); + return KErrNone; + } diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepalive.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepalive.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,365 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Main implementation of Wlan Sniffer Keepalive application. +*/ + +// System include files + +#include + +// User include files + +#include "wsfkeepalivetimer.h" +#include "wsfkeepalivecmm.h" +#include "wsfkeepaliveconnmon.h" +#include "wsfkeepaliveconnmondisc.h" +#include "wsfkeepaliveesock.h" +#include "wsfkeepalive.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wsfkeepaliveTraces.h" +#endif + +// External function prototypes + +// Local constants + +// We need to poll for client info every 5 seconds +static const int KKeepalivePollInterval = 5000000; + +// We can close a connection after 5 minutes of inactivity +static const int KKeepaliveInactivityInterval = 300; + +// UID of Wlan sniffer application +static const TUid KWlanSnifferUid = { 0x10281CAA }; + +// UID of Wlan login application +static const TUid KWlanloginUid = { 0x2002E6D0 }; + +// List of UIDs of clients not considered as "real" +static const TUid KDiscardedClientUids[] = + { + { 0x2002FF5F }, // Sniffer keepalive process, that is, us + KWlanSnifferUid, // Sniffer application (wlansniffer.exe) + KWlanloginUid, // Wlan Login application (wlanlogin.exe) + { 0x101fD9C5 } // DHCP server (dhcpserv.exe) + }; + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +CWsfKeepalive* CWsfKeepalive::NewL() + { + OstTraceFunctionEntry0( CWSFKEEPALIVE_NEWL_ENTRY ); + + CWsfKeepalive* me = new ( ELeave ) CWsfKeepalive(); + CleanupStack::PushL( me ); + me->ConstructL(); + CleanupStack::Pop( me ); + + OstTraceFunctionExit0( CWSFKEEPALIVE_NEWL_EXIT ); + return me; + } + +CWsfKeepalive::~CWsfKeepalive() + { + OstTraceFunctionEntry0( DUP1_CWSFKEEPALIVE_CWSFKEEPALIVE_ENTRY ); + + delete iEsock; + delete iConnMonDisc; + delete iCmMgr; + delete iConnMon; + delete iTimer; + + OstTraceFunctionExit0( DUP1_CWSFKEEPALIVE_CWSFKEEPALIVE_EXIT ); + } + +void CWsfKeepalive::TimerExpired( TInt aError ) + { + OstTraceFunctionEntry0( CWSFKEEPALIVE_TIMEREXPIRED_ENTRY ); + + TBool restartTimer = ETrue; // Should we restart timer or not? + if ( aError == KErrNone ) + { + // Timer successfully completed, handle it + if ( NoRealClients( iConnectionId ) ) + { + TTime now; + now.UniversalTime(); + + // Check whether we are moving from EActiveWithClients to + // EActiveNoClients + if ( iState == EActiveWithClients ) + { + OstTrace0( + TRACE_NORMAL, + CWSFKEEPALIVE_TIMEREXPIRED_RESET, + "CWsfKeepalive::TimerExpired Keepalive time reset" ); + + // Connection had clients, but doesn't anymore. Keepalive + // inactivity time starts now + iKeepaliveStart = now; + } + // Check whether keepalive time has been reached + else if ( iKeepaliveStart + + TTimeIntervalSeconds( KKeepaliveInactivityInterval ) <= now ) + { + OstTrace0( + TRACE_NORMAL, + CWSFKEEPALIVE_TIMEREXPIRED_DONE, + "CWsfKeepalive::TimerExpired Keepalive time expired" ); + + // Keepalive time limit expired, connection should be stopped + iEsock->Disconnect(); + iConnMonDisc->Disconnect( iConnectionId ); + restartTimer = EFalse; + } + + // There are now no real clients for the connection + SetState( EActiveNoClients ); + } + else + { + // One or more real clients are using the connection + SetState( EActiveWithClients ); + } + } + else + { + // Timer not successful, probably because we stopped it + restartTimer = EFalse; + } + + if ( restartTimer ) + { + TTimeIntervalMicroSeconds32 interval( KKeepalivePollInterval ); + iTimer->After( interval ); + } + + OstTraceFunctionExit0( CWSFKEEPALIVE_TIMEREXPIRED_EXIT ); + } + +void CWsfKeepalive::WlanConnectionOpenedL( TUint aConnectionId, TUint aIapId ) + { + OstTraceFunctionEntry0( CWSFKEEPALIVE_WLANCONNECTIONOPENEDL_ENTRY ); + + OstTraceExt2( + TRACE_NORMAL, + CWSFKEEPALIVE_WLANCONNECTIONOPENED, + "CWsfKeepalive::WlanConnectionOpened;aConnectionId=%u;aIapId=%u", + aConnectionId, + aIapId ); + + // We are only interested in connections opened by the Wlan Sniffer + if ( OpenedByWlanSniffer( aConnectionId ) ) + { + // Start to monitor this connection, and add us as a user to the + // connection + iConnectionId = aConnectionId; + iIapId = aIapId; + iEsock->ConnectL( aIapId ); + + // Assume there are no real clients yet. Setup timer for polling + // when real clients might be added to the connection + SetState( EActiveNoClients ); + iKeepaliveStart.UniversalTime(); + + OstTrace0( + TRACE_NORMAL, + CWSFKEEPALIVE_WLANCONNECTIONOPENED_RESET, + "CWsfKeepalive::WlanConnectionOpened Keepalive time reset" ); + + TTimeIntervalMicroSeconds32 interval( KKeepalivePollInterval ); + iTimer->After( interval ); + } + + OstTraceFunctionExit0( CWSFKEEPALIVE_WLANCONNECTIONOPENEDL_EXIT ); + } + +void CWsfKeepalive::WlanConnectionClosed() + { + OstTraceFunctionEntry0( CWSFKEEPALIVE_WLANCONNECTIONCLOSED_ENTRY ); + + // No need to monitor anything anymore + SetState( EInactive ); + iConnectionId = KInvalidConnectionId; + // Stop also the polling timer + iTimer->Stop(); + + OstTrace1( + TRACE_NORMAL, + CWSFKEEPALIVE_WLANCONNECTIONCLOSED_IAPID, + "CWsfKeepalive::WlanConnectionClosed iapId=%d", + iIapId ); + + // If connected to hotspot IAP, the IAP must be deleted + if ( iCmMgr->GetHotspotInfoL( iIapId ) ) + { + OstTrace0( + TRACE_NORMAL, + CWSFKEEPALIVE_WLANCONNECTIONCLOSED_HOTSPOTDETECTED, + "CWsfKeepalive::WlanConnectionClosed Hotspot IAP detected" ); + + if ( !iCmMgr->DeleteHotspotIapL( iIapId ) ) + { + OstTrace0( + TRACE_NORMAL, + CWSFKEEPALIVE_WLANCONNECTIONCLOSED_HOTSPOTDELETEFAILED, + "CWsfKeepalive::WlanConnectionClosed Hotspot delete failed" ); + } + iIapId = 0; + } + + OstTraceFunctionExit0( CWSFKEEPALIVE_WLANCONNECTIONCLOSED_EXIT ); + } + +// --------------------------------------------------------------------------- +// Default constructor +// --------------------------------------------------------------------------- +// +CWsfKeepalive::CWsfKeepalive() : + iConnectionId( KInvalidConnectionId ), + iState( EInactive ), + iIapId( 0 ) + { + OstTraceFunctionEntry0( CWSFKEEPALIVE_CWSFKEEPALIVE_ENTRY ); + OstTraceFunctionExit0( CWSFKEEPALIVE_CWSFKEEPALIVE_EXIT ); + } + +// --------------------------------------------------------------------------- +// Leaving constructor +// --------------------------------------------------------------------------- +// +void CWsfKeepalive::ConstructL() + { + OstTraceFunctionEntry0( CWSFKEEPALIVE_CONSTRUCTL_ENTRY ); + + iTimer = CWsfKeepaliveTimer::NewL( *this ); + iConnMon = CWsfKeepaliveConnMon::NewL( *this ); + iConnMonDisc = CWsfKeepaliveConnMonDisc::NewL(); + iEsock = CWsfKeepaliveEsock::NewL(); + iCmMgr = CWsfKeepaliveCmm::NewL(); + + OstTraceFunctionExit0( CWSFKEEPALIVE_CONSTRUCTL_EXIT ); + } + +// --------------------------------------------------------------------------- +// Checks whether the given connection was opened by the Wlan Sniffer +// application +// --------------------------------------------------------------------------- +// +TBool CWsfKeepalive::OpenedByWlanSniffer( TUint aConnectionId ) + { + OstTraceFunctionEntry0( CWSFKEEPALIVE_OPENEDBYWLANSNIFFER_ENTRY ); + + TBool retVal = EFalse; + + // Get all clients of this connection + TConnMonClientEnumBuf clientInfo; + iConnMon->GetClientInfo( clientInfo, aConnectionId ); + + // Check whether Wlan sniffer is one of the clients + for ( TInt i( 0 ); i < clientInfo().iCount; ++i ) + { + if ( clientInfo().iUid[i] == KWlanSnifferUid ) + { + // Match found, stop looking + retVal = ETrue; + break; + } + } + + OstTraceExt2( + TRACE_NORMAL, + CWSFKEEPALIVE_OPENEDBYWLANSNIFFER, + "CWsfKeepalive::OpenedByWlanSniffer;aConnectionId=%u;retVal=%u", + aConnectionId, + retVal ); + + OstTraceFunctionExit0( CWSFKEEPALIVE_OPENEDBYWLANSNIFFER_EXIT ); + return retVal; + } + +// --------------------------------------------------------------------------- +// Checks whether there are any real clients using the given connection +// --------------------------------------------------------------------------- +// +TBool CWsfKeepalive::NoRealClients( TUint aConnectionId ) + { + OstTraceFunctionEntry0( CWSFKEEPALIVE_NOREALCLIENTS_ENTRY ); + + // Get all clients of this connection + TConnMonClientEnumBuf clientInfo; + iConnMon->GetClientInfo( clientInfo, aConnectionId ); + + // Get the client count + TInt clientCount = clientInfo().iCount; + + TInt discardedClientCount = sizeof( KDiscardedClientUids ) / sizeof( TUid ); + + // Decrease count by each non-real client we must discard + for ( TInt i( 0 ); i < clientInfo().iCount; ++i ) + { + for ( TInt j( 0 ); j < discardedClientCount; ++j ) + { + if ( clientInfo().iUid[i] == KDiscardedClientUids[j] ) + { + OstTrace1( + TRACE_NORMAL, + CWSFKEEPALIVE_NOREALCLIENTS_DISCARD, + "CWsfKeepalive::NoRealClients Client discarded;clientInfo().iUid[i].iUid=%x", + clientInfo().iUid[i].iUid ); + --clientCount; + break; + } + } + } + + // If we reached zero, there were no real clients + TBool retVal = clientCount == 0 ? ETrue : EFalse; + OstTraceExt2( + TRACE_NORMAL, + CWSFKEEPALIVE_NOREALCLIENTS, + "CWsfKeepalive::NoRealClients;aConnectionId=%u;retVal=%u", + aConnectionId, + retVal ); + + OstTraceFunctionExit0( CWSFKEEPALIVE_NOREALCLIENTS_EXIT ); + return retVal; + } + +// --------------------------------------------------------------------------- +// Sets the given state and traces the transition, if state changed. +// --------------------------------------------------------------------------- +// +void CWsfKeepalive::SetState( TUint aState ) + { + OstTraceFunctionEntry0( CWSFKEEPALIVE_SETSTATE_ENTRY ); + +#ifdef OST_TRACE_COMPILER_IN_USE + if ( aState != iState ) + { + OstTrace1( + TRACE_NORMAL, + CWSFKEEPALIVE_SETSTATE, + "CWsfKeepalive::SetState;aState=%{State}", + aState ); + } +#endif + iState = aState; + + OstTraceFunctionExit0( CWSFKEEPALIVE_SETSTATE_EXIT ); + } diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepalivecmm.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepalivecmm.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Connection Method Manager interface implementation. + */ + +// System include files + +#include +#include +#include + +// User include files + +#include "wsfkeepalive.h" +#include "wsfkeepalivecmm.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wsfkeepalivecmmTraces.h" +#endif + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +CWsfKeepaliveCmm* CWsfKeepaliveCmm::NewL() + { + OstTraceFunctionEntry0( CWSFKEEPALIVECMM_NEWL_ENTRY ); + + CWsfKeepaliveCmm* me = new ( ELeave ) CWsfKeepaliveCmm(); + CleanupStack::PushL( me ); + me->ConstructL(); + CleanupStack::Pop( me ); + + OstTraceFunctionExit0( CWSFKEEPALIVECMM_NEWL_EXIT ); + return me; + } + +CWsfKeepaliveCmm::~CWsfKeepaliveCmm() + { + OstTraceFunctionEntry0( + DUP1_CWSFKEEPALIVECMM_CWSFKEEPALIVECMM_ENTRY ); + + iCmManager.Close(); + + OstTraceFunctionExit0( + DUP1_CWSFKEEPALIVECMM_CWSFKEEPALIVECMM_EXIT ); + } + +// --------------------------------------------------------------------------- +// Default constructor +// --------------------------------------------------------------------------- +// +CWsfKeepaliveCmm::CWsfKeepaliveCmm() + { + OstTraceFunctionEntry0( CWSFKEEPALIVECMM_CWSFKEEPALIVECMM_ENTRY ); + OstTraceFunctionExit0( CWSFKEEPALIVECMM_CWSFKEEPALIVECMM_EXIT ); + } + +// --------------------------------------------------------------------------- +// Leaving constructor +// --------------------------------------------------------------------------- +// +void CWsfKeepaliveCmm::ConstructL() + { + OstTraceFunctionEntry0( CWSFKEEPALIVECMM_CONSTRUCTL_ENTRY ); + + iCmManager.OpenL(); + + OstTraceFunctionExit0( CWSFKEEPALIVECMM_CONSTRUCTL_EXIT ); + } + +// --------------------------------------------------------- +// Gets Hotspot metadata information +// --------------------------------------------------------- +// +TBool CWsfKeepaliveCmm::GetHotspotInfoL(TInt32 aIapId) + { + OstTraceFunctionEntry0( CWSFKEEPALIVECMM_GETHOTSPOTINFO_ENTRY ); + TBool isHotspotIap = EFalse; + + RCmConnectionMethod connectionMethod = iCmManager.ConnectionMethodL(aIapId); + + TRAPD(err, isHotspotIap = connectionMethod.GetBoolAttributeL( CMManager::ECmMetaHotSpot )); + + if (err != KErrNone) + { + isHotspotIap = EFalse; + } + + OstTrace1( + TRACE_NORMAL, + CWSFKEEPALIVECMM_GETHOTSPOTINFO_HOTSPOT, + "CWsfKeepaliveCmm::GetHotspotInfoL isHotspotIap=%d", + isHotspotIap ); + + OstTraceFunctionExit0( CWSFKEEPALIVECMM_GETHOTSPOTINFO_EXIT ); + return isHotspotIap; + } + +// --------------------------------------------------------- +// Delete Hotspot IAP +// --------------------------------------------------------- +// +TBool CWsfKeepaliveCmm::DeleteHotspotIapL(TInt32 aIapId) + { + OstTraceFunctionEntry0( CWSFKEEPALIVECMM_DELETEHOTSPOTIAP_ENTRY ); + TBool ret = EFalse; + + RCmConnectionMethod connectionMethod = iCmManager.ConnectionMethodL(aIapId); + TRAPD(err, ret = connectionMethod.DeleteL()); + + if (err != KErrNone) + { + ret = EFalse; + } + + OstTraceFunctionExit0( CWSFKEEPALIVECMM_DELETEHOTSPOTIAP_EXIT ); + return ret; + } diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepaliveconnmon.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepaliveconnmon.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,213 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Connection Monitor interface implementation. + */ + +// System include files + +#include +#include + +// User include files + +#include "wsfkeepalive.h" +#include "wsfkeepaliveconnmon.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wsfkeepaliveconnmonTraces.h" +#endif + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +CWsfKeepaliveConnMon* CWsfKeepaliveConnMon::NewL( CWsfKeepalive& aNotify ) + { + OstTraceFunctionEntry0( CWSFKEEPALIVECONNMON_NEWL_ENTRY ); + + CWsfKeepaliveConnMon* me = new ( ELeave ) CWsfKeepaliveConnMon( aNotify ); + CleanupStack::PushL( me ); + me->ConstructL(); + CleanupStack::Pop( me ); + + OstTraceFunctionExit0( CWSFKEEPALIVECONNMON_NEWL_EXIT ); + return me; + } + +CWsfKeepaliveConnMon::~CWsfKeepaliveConnMon() + { + OstTraceFunctionEntry0( + DUP1_CWSFKEEPALIVECONNMON_CWSFKEEPALIVECONNMON_ENTRY ); + + // Stop monitoring observer events + iMonitor.CancelNotifications(); + iMonitor.Close(); + + OstTraceFunctionExit0( + DUP1_CWSFKEEPALIVECONNMON_CWSFKEEPALIVECONNMON_EXIT ); + } + +void CWsfKeepaliveConnMon::GetClientInfo( + TConnMonClientEnumBuf& aClientInfo, + TUint aConnectionId ) + { + OstTraceFunctionEntry0( CWSFKEEPALIVECONNMON_GETCLIENTINFO_ENTRY ); + + // Get all clients of this connection + TRequestStatus status; + iMonitor.GetPckgAttribute( + aConnectionId, + 0, + KClientInfo, + aClientInfo, + status ); + User::WaitForRequest( status ); + if ( status.Int() != KErrNone ) + { + // Make sure we don't try to use the result buffer since its + // contents are not ok + aClientInfo().iCount = 0; + } + +#ifdef OST_TRACE_COMPILER_IN_USE + for ( TInt i( 0 ); i < aClientInfo().iCount; ++i ) + { + OstTrace1( + TRACE_NORMAL, + CWSFKEEPALIVECONNMON_GETCLIENTINFO, + "CWsfKeepaliveConnMon::GetClientInfo Client ID;aClientInfo().iUid[i].iUid=%x", + aClientInfo().iUid[i].iUid ); + } +#endif + + OstTraceFunctionExit0( CWSFKEEPALIVECONNMON_GETCLIENTINFO_EXIT ); + } + +// --------------------------------------------------------------------------- +// Default constructor +// --------------------------------------------------------------------------- +// +CWsfKeepaliveConnMon::CWsfKeepaliveConnMon( CWsfKeepalive& aNotify ) : + iNotify( aNotify ), + iMonitoringConnectionId( CWsfKeepalive::KInvalidConnectionId ) + { + OstTraceFunctionEntry0( CWSFKEEPALIVECONNMON_CWSFKEEPALIVECONNMON_ENTRY ); + OstTraceFunctionExit0( CWSFKEEPALIVECONNMON_CWSFKEEPALIVECONNMON_EXIT ); + } + +// --------------------------------------------------------------------------- +// Leaving constructor +// --------------------------------------------------------------------------- +// +void CWsfKeepaliveConnMon::ConstructL() + { + OstTraceFunctionEntry0( CWSFKEEPALIVECONNMON_CONSTRUCTL_ENTRY ); + + iMonitor.ConnectL(); + // Start monitoring observer events + iMonitor.NotifyEventL( *this ); + + OstTraceFunctionExit0( CWSFKEEPALIVECONNMON_CONSTRUCTL_EXIT ); + } + +// --------------------------------------------------------------------------- +// Event method is called every time an observer event occures +// --------------------------------------------------------------------------- +// +void CWsfKeepaliveConnMon::EventL( const CConnMonEventBase& aConnMonEvent ) + { + OstTraceFunctionEntry0( CWSFKEEPALIVECONNMON_EVENTL_ENTRY ); + + TUint connectionId = aConnMonEvent.ConnectionId(); + TInt bearer; + TRequestStatus status; + + OstTraceExt2( + TRACE_NORMAL, + CWSFKEEPALIVECONNMON_EVENTL_EVENTTYPE, + "CWsfKeepaliveConnMon::EventL;connectionId=%u;aConnMonEvent.EventType()=%{ConnMonEvent}", + connectionId, + aConnMonEvent.EventType() ); + + const CConnMonConnectionStatusChange* connectionStatusChangeEvent; + switch ( aConnMonEvent.EventType() ) + { + case EConnMonDeleteConnection: + // We are only interested in one connection + if ( connectionId == iMonitoringConnectionId ) + { + iNotify.WlanConnectionClosed(); + iMonitoringConnectionId = CWsfKeepalive::KInvalidConnectionId; + } + break; + + case EConnMonConnectionStatusChange: + connectionStatusChangeEvent = + static_cast< + const CConnMonConnectionStatusChange* >( &aConnMonEvent ); + + OstTrace1( + TRACE_NORMAL, + CWSFKEEPALIVECONNMON_EVENTL_CONNSTATUS, + "CWsfKeepaliveConnMon::EventL;connectionStatusChangeEvent->ConnectionStatus()=%{ConnMonConnStatus}", + connectionStatusChangeEvent->ConnectionStatus() ); + + // We are only interested in connected event + if ( connectionStatusChangeEvent->ConnectionStatus() + == KLinkLayerOpen ) + { + // Get the connection bearer type. + iMonitor.GetIntAttribute( + connectionId, + 0, + KBearer, + bearer, + status ); + User::WaitForRequest( status ); + + // We are only interested in WLAN connections + if ( status.Int() == KErrNone && bearer == EBearerWLAN ) + { + // Get connection IAP ID. + TUint iapId = 0; + iMonitor.GetUintAttribute( + connectionId, + 0, + KIAPId, + iapId, + status ); + User::WaitForRequest( status ); + + if ( status == KErrNone ) + { + iNotify.WlanConnectionOpenedL( connectionId, iapId ); + // Remember this connection + iMonitoringConnectionId = connectionId; + } + } + } + break; + + default: + // Not interesting + break; + } + + OstTraceFunctionExit0( CWSFKEEPALIVECONNMON_EVENTL_EXIT ); + } diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepaliveconnmondisc.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepaliveconnmondisc.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Connection Monitor disconnect interface implementation. + */ + +// System include files + +#include + +// User include files + +#include "wsfkeepaliveconnmondisc.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wsfkeepaliveconnmondiscTraces.h" +#endif + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +CWsfKeepaliveConnMonDisc* CWsfKeepaliveConnMonDisc::NewL() + { + OstTraceFunctionEntry0( CWSFKEEPALIVECONNMONDISC_NEWL_ENTRY ); + + CWsfKeepaliveConnMonDisc* me = new ( ELeave ) CWsfKeepaliveConnMonDisc(); + CleanupStack::PushL( me ); + me->ConstructL(); + CleanupStack::Pop( me ); + + OstTraceFunctionExit0( CWSFKEEPALIVECONNMONDISC_NEWL_EXIT ); + return me; + } + +CWsfKeepaliveConnMonDisc::~CWsfKeepaliveConnMonDisc() + { + OstTraceFunctionEntry0( + DUP1_CWSFKEEPALIVECONNMONDISC_CWSFKEEPALIVECONNMONDISC_ENTRY ); + + iMonitor.Close(); + + OstTraceFunctionExit0( + DUP1_CWSFKEEPALIVECONNMONDISC_CWSFKEEPALIVECONNMONDISC_EXIT ); + } + +void CWsfKeepaliveConnMonDisc::Disconnect( TUint aConnectionId ) + { + OstTraceFunctionEntry0( CWSFKEEPALIVECONNMONDISC_DISCONNECT_ENTRY ); + + TInt KErr = iMonitor.SetBoolAttribute( + aConnectionId, + 0, + KConnectionStop, + ETrue ); + + OstTraceFunctionExit0( CWSFKEEPALIVECONNMONDISC_DISCONNECT_EXIT ); + } + +// --------------------------------------------------------------------------- +// Default constructor +// --------------------------------------------------------------------------- +// +CWsfKeepaliveConnMonDisc::CWsfKeepaliveConnMonDisc() + { + OstTraceFunctionEntry0( + CWSFKEEPALIVECONNMONDISC_CWSFKEEPALIVECONNMONDISC_ENTRY ); + OstTraceFunctionExit0( + CWSFKEEPALIVECONNMONDISC_CWSFKEEPALIVECONNMONDISC_EXIT ); + } + +// --------------------------------------------------------------------------- +// Leaving constructor +// --------------------------------------------------------------------------- +// +void CWsfKeepaliveConnMonDisc::ConstructL() + { + OstTraceFunctionEntry0( CWSFKEEPALIVECONNMONDISC_CONSTRUCTL_ENTRY ); + + iMonitor.ConnectL(); + + OstTraceFunctionExit0( CWSFKEEPALIVECONNMONDISC_CONSTRUCTL_EXIT ); + } diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepaliveesock.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepaliveesock.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,151 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Esock library (RConnection) interface implementation. +*/ + +// System include files + +#include +#include +#include +#include + +// User include files + +#include "wsfkeepaliveesock.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wsfkeepaliveesockTraces.h" +#endif + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +CWsfKeepaliveEsock* CWsfKeepaliveEsock::NewL() + { + OstTraceFunctionEntry0( CWSFKEEPALIVEESOCK_NEWL_ENTRY ); + + CWsfKeepaliveEsock* me = new ( ELeave ) CWsfKeepaliveEsock(); + CleanupStack::PushL( me ); + me->ConstructL(); + CleanupStack::Pop( me ); + + OstTraceFunctionExit0( CWSFKEEPALIVEESOCK_NEWL_EXIT ); + return me; + } + +CWsfKeepaliveEsock::~CWsfKeepaliveEsock() + { + OstTraceFunctionEntry0( + DUP1_CWSFKEEPALIVEESOCK_CWSFKEEPALIVEESOCK_ENTRY ); + + Cancel(); + iSocketServer.Close(); + + OstTraceFunctionExit0( DUP1_CWSFKEEPALIVEESOCK_CWSFKEEPALIVEESOCK_EXIT ); + } + +void CWsfKeepaliveEsock::ConnectL( TUint aIapId ) + { + OstTraceFunctionEntry0( CWSFKEEPALIVEESOCK_CONNECTL_ENTRY ); + + // Open an RConnection object. + User::LeaveIfError( iConnection.Open( iSocketServer ) ); + + // Create overrides for connection preferences to force opening of the + // given IAP without any user prompts. + TConnPrefList prefList; + TExtendedConnPref prefs; + prefs.SetIapId( aIapId ); + prefs.SetNoteBehaviour( TExtendedConnPref::ENoteBehaviourConnSilent ); + prefList.AppendL( &prefs ); + + // Start a connection with connection preferences + iConnection.Start( prefList, iStatus ); + + SetActive(); + + OstTraceFunctionExit0( CWSFKEEPALIVEESOCK_CONNECTL_EXIT ); + } + +void CWsfKeepaliveEsock::Disconnect() + { + OstTraceFunctionEntry0( CWSFKEEPALIVEESOCK_DISCONNECT_ENTRY ); + + iConnection.Close(); + + OstTraceFunctionExit0( CWSFKEEPALIVEESOCK_DISCONNECT_EXIT ); + } + +// --------------------------------------------------------------------------- +// Default constructor +// --------------------------------------------------------------------------- +// +CWsfKeepaliveEsock::CWsfKeepaliveEsock() : + CActive( EPriorityStandard ) + { + OstTraceFunctionEntry0( CWSFKEEPALIVEESOCK_CWSFKEEPALIVEESOCK_ENTRY ); + OstTraceFunctionExit0( CWSFKEEPALIVEESOCK_CWSFKEEPALIVEESOCK_EXIT ); + } + +// --------------------------------------------------------------------------- +// Leaving constructor +// --------------------------------------------------------------------------- +// +void CWsfKeepaliveEsock::ConstructL() + { + OstTraceFunctionEntry0( CWSFKEEPALIVEESOCK_CONSTRUCTL_ENTRY ); + + CActiveScheduler::Add( this ); + User::LeaveIfError( iSocketServer.Connect() ); + + OstTraceFunctionExit0( CWSFKEEPALIVEESOCK_CONSTRUCTL_EXIT ); + } + +// --------------------------------------------------------------------------- +// Handles an active object's request completion event +// --------------------------------------------------------------------------- +// +void CWsfKeepaliveEsock::RunL() + { + OstTraceFunctionEntry0( CWSFKEEPALIVEESOCK_RUNL_ENTRY ); + + OstTrace1( + TRACE_NORMAL, + CWSFKEEPALIVEESOCK_RUNL, + "CWsfKeepaliveEsock::RunL;iStatus.Int()=%d", + iStatus.Int() ); + + OstTraceFunctionExit0( CWSFKEEPALIVEESOCK_RUNL_EXIT ); + } + +// --------------------------------------------------------------------------- +// Implements cancellation of an outstanding request +// --------------------------------------------------------------------------- +// +void CWsfKeepaliveEsock::DoCancel() + { + OstTraceFunctionEntry0( CWSFKEEPALIVEESOCK_DOCANCEL_ENTRY ); + + // Disconnect a (possibly) ongoing request + Disconnect(); + + OstTraceFunctionExit0( CWSFKEEPALIVEESOCK_DOCANCEL_EXIT ); + } diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepalivetimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepalivetimer.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Timer implementation. +*/ + +// System include files + +// User include files + +#include "wsfkeepalivetimer.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wsfkeepalivetimerTraces.h" +#endif + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +CWsfKeepaliveTimer* CWsfKeepaliveTimer::NewL( + MWsfKeepaliveTimerNotify& aNotify ) + { + OstTraceFunctionEntry0( CWSFKEEPALIVETIMER_NEWL_ENTRY ); + + CWsfKeepaliveTimer* me = + new ( ELeave ) CWsfKeepaliveTimer( aNotify ); + CleanupStack::PushL( me ); + me->ConstructL(); + CleanupStack::Pop( me ); + + OstTraceFunctionExit0( CWSFKEEPALIVETIMER_NEWL_EXIT ); + return me; + } + +CWsfKeepaliveTimer::~CWsfKeepaliveTimer() + { + OstTraceFunctionEntry0( DUP1_CWSFKEEPALIVETIMER_CWSFKEEPALIVETIMER_ENTRY ); + + Cancel(); + iTimer.Close(); + + OstTraceFunctionExit0( DUP1_CWSFKEEPALIVETIMER_CWSFKEEPALIVETIMER_EXIT ); + } + +void CWsfKeepaliveTimer::After( TTimeIntervalMicroSeconds32 aInterval ) + { + OstTraceFunctionEntry0( CWSFKEEPALIVETIMER_AFTER_ENTRY ); + + // Cancel a (possibly) ongoing timer before starting new one + Cancel(); + iTimer.After( iStatus, aInterval ); + SetActive(); + + OstTraceFunctionExit0( CWSFKEEPALIVETIMER_AFTER_EXIT ); + } + +void CWsfKeepaliveTimer::Stop() + { + OstTraceFunctionEntry0( CWSFKEEPALIVETIMER_STOP_ENTRY ); + + iTimer.Cancel(); + + OstTraceFunctionExit0( CWSFKEEPALIVETIMER_STOP_EXIT ); + } + +// --------------------------------------------------------------------------- +// Default constructor +// --------------------------------------------------------------------------- +// +CWsfKeepaliveTimer::CWsfKeepaliveTimer( MWsfKeepaliveTimerNotify& aNotify ) : + CActive( EPriorityStandard ), + iNotify( aNotify ) + { + OstTraceFunctionEntry0( CWSFKEEPALIVETIMER_CWSFKEEPALIVETIMER_ENTRY ); + OstTraceFunctionExit0( CWSFKEEPALIVETIMER_CWSFKEEPALIVETIMER_EXIT ); + } + +// --------------------------------------------------------------------------- +// Leaving constructor +// --------------------------------------------------------------------------- +// +void CWsfKeepaliveTimer::ConstructL() + { + OstTraceFunctionEntry0( CWSFKEEPALIVETIMER_CONSTRUCTL_ENTRY ); + + CActiveScheduler::Add( this ); + User::LeaveIfError( iTimer.CreateLocal() ); + + OstTraceFunctionExit0( CWSFKEEPALIVETIMER_CONSTRUCTL_EXIT ); + } + +// --------------------------------------------------------------------------- +// Handles an active object's request completion event +// --------------------------------------------------------------------------- +// +void CWsfKeepaliveTimer::RunL() + { + OstTraceFunctionEntry0( CWSFKEEPALIVETIMER_RUNL_ENTRY ); + + iNotify.TimerExpired( iStatus.Int() ); + + OstTraceFunctionExit0( CWSFKEEPALIVETIMER_RUNL_EXIT ); + } + +// --------------------------------------------------------------------------- +// Implements cancellation of an outstanding request +// --------------------------------------------------------------------------- +// +void CWsfKeepaliveTimer::DoCancel() + { + OstTraceFunctionEntry0( CWSFKEEPALIVETIMER_DOCANCEL_ENTRY ); + + iTimer.Cancel(); + + OstTraceFunctionExit0( CWSFKEEPALIVETIMER_DOCANCEL_EXIT ); + } diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferkeepalive/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferkeepalive/traces/OstTraceDefinitions.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* OST trace definition header. +*/ + +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +#include +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlansniffer/wlansnifferkeepalive/traces/trace.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansnifferkeepalive/traces/trace.properties Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,51 @@ + + + + Inactive + ActiveNoClients + ActiveWithClients + + + + EConnMonCreateConnection + EConnMonDeleteConnection + EConnMonCreateSubConnection + EConnMonDeleteSubConnection + EConnMonDownlinkDataThreshold + EConnMonUplinkDataThreshold + EConnMonNetworkStatusChange + EConnMonConnectionStatusChange + EConnMonConnectionActivityChange + EConnMonNetworkRegistrationChange + EConnMonBearerChange + EConnMonSignalStrengthChange + EConnMonBearerAvailabilityChange + EConnMonIapAvailabilityChange + EConnMonTransmitPowerChange + EConnMonSNAPsAvailabilityChange + EConnMonNewWLANNetworkDetected + EConnMonOldWLANNetworkLost + EConnMonPacketDataAvailable + EConnMonPacketDataUnavailable + EConnMonBearerInfoChange + EConnMonBearerGroupChange + + + + KConnectionUninitialised + KStartingSelection + KFinishedSelection + KConnectionFailure + KDataTransferTemporarilyBlocked + KLinkLayerOpen + KLinkLayerClosed + KConfigDaemonLoading + KConfigDaemonLoaded + KConfigDaemonStartingRegistration + KConfigDaemonFinishedRegistration + KConfigDaemonStartingDeregistration + KConfigDaemonFinishedDeregistrationStop + KConfigDaemonUnloading + KConfigDaemonUnloaded + + \ No newline at end of file diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanutilities.pro --- a/wlanutilities/wlanutilities.pro Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wlanutilities.pro Thu Jul 22 16:44:32 2010 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available # under the terms of "Eclipse Public License v1.0" @@ -12,19 +12,20 @@ # Contributors: # # Description: +# Project file for wlanutilities directory in wirelessacc package. # TEMPLATE = subdirs SUBDIRS += \ wlanqtutilities \ + eapwizard \ + wpswizard \ + wlanwizard \ wlansniffer \ wlanentryplugin \ wlanindicatorplugin \ - cpwlansettingsplugin - -CONFIG += ordered + cpwlansettingsplugin \ + wlanlogin -symbian*: { - SYMBIAN_PLATFORMS = WINSCW ARMV5 -} +CONFIG += ordered diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/bwins/wlanwizardu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/bwins/wlanwizardu.def Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,18 @@ +EXPORTS + ?qt_metacall@WlanWizard@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1 NONAME ; int WlanWizard::qt_metacall(enum QMetaObject::Call, int, void * *) + ?setParameters@WlanWizard@@QAEXABVQString@@HH_N11@Z @ 2 NONAME ; void WlanWizard::setParameters(class QString const &, int, int, bool, bool, bool) + ?metaObject@WlanWizard@@UBEPBUQMetaObject@@XZ @ 3 NONAME ; struct QMetaObject const * WlanWizard::metaObject(void) const + ?trUtf8@WlanWizard@@SA?AVQString@@PBD0@Z @ 4 NONAME ; class QString WlanWizard::trUtf8(char const *, char const *) + ?tr@WlanWizard@@SA?AVQString@@PBD0H@Z @ 5 NONAME ; class QString WlanWizard::tr(char const *, char const *, int) + ?trUtf8@WlanWizard@@SA?AVQString@@PBD0H@Z @ 6 NONAME ; class QString WlanWizard::trUtf8(char const *, char const *, int) + ??_EWlanWizard@@UAE@I@Z @ 7 NONAME ; WlanWizard::~WlanWizard(unsigned int) + ?show@WlanWizard@@QAEXXZ @ 8 NONAME ; void WlanWizard::show(void) + ?cancelled@WlanWizard@@IAEXXZ @ 9 NONAME ; void WlanWizard::cancelled(void) + ?tr@WlanWizard@@SA?AVQString@@PBD0@Z @ 10 NONAME ; class QString WlanWizard::tr(char const *, char const *) + ?getStaticMetaObject@WlanWizard@@SAABUQMetaObject@@XZ @ 11 NONAME ; struct QMetaObject const & WlanWizard::getStaticMetaObject(void) + ??1WlanWizard@@UAE@XZ @ 12 NONAME ; WlanWizard::~WlanWizard(void) + ?finished@WlanWizard@@IAEXH_N@Z @ 13 NONAME ; void WlanWizard::finished(int, bool) + ?staticMetaObject@WlanWizard@@2UQMetaObject@@B @ 14 NONAME ; struct QMetaObject const WlanWizard::staticMetaObject + ??0WlanWizard@@QAE@PAVHbMainWindow@@@Z @ 15 NONAME ; WlanWizard::WlanWizard(class HbMainWindow *) + ?qt_metacast@WlanWizard@@UAEPAXPBD@Z @ 16 NONAME ; void * WlanWizard::qt_metacast(char const *) + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/eabi/wlanwizardu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/eabi/wlanwizardu.def Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,18 @@ +EXPORTS + _ZN10WlanWizard11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME + _ZN10WlanWizard11qt_metacastEPKc @ 2 NONAME + _ZN10WlanWizard13setParametersERK7QStringiibbb @ 3 NONAME + _ZN10WlanWizard16staticMetaObjectE @ 4 NONAME DATA 16 + _ZN10WlanWizard19getStaticMetaObjectEv @ 5 NONAME + _ZN10WlanWizard4showEv @ 6 NONAME + _ZN10WlanWizard8finishedEib @ 7 NONAME + _ZN10WlanWizard9cancelledEv @ 8 NONAME + _ZN10WlanWizardC1EP12HbMainWindow @ 9 NONAME + _ZN10WlanWizardC2EP12HbMainWindow @ 10 NONAME + _ZN10WlanWizardD0Ev @ 11 NONAME + _ZN10WlanWizardD1Ev @ 12 NONAME + _ZN10WlanWizardD2Ev @ 13 NONAME + _ZNK10WlanWizard10metaObjectEv @ 14 NONAME + _ZTI10WlanWizard @ 15 NONAME + _ZTV10WlanWizard @ 16 NONAME + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/inc/wlanwizard.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/inc/wlanwizard.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WLAN Wizard API + * + */ + +#ifndef WLANWIZARD_H +#define WLANWIZARD_H + +// System includes +#include + +// User includes + +// Forward declarations +class HbMainWindow; +class WlanWizardPrivate; +class TestWlanWizardContext; + +// External data types + +// Constants +#ifdef BUILD_WLAN_WIZARD_DLL +#define WLAN_WIZARD_EXPORT Q_DECL_EXPORT +#else +#define WLAN_WIZARD_EXPORT Q_DECL_IMPORT +#endif + +/*! + @addtogroup group_wlan_wizard_api + @{ + */ +class WLAN_WIZARD_EXPORT WlanWizard: public QObject +{ + Q_OBJECT + +public: + explicit WlanWizard(HbMainWindow *mainWindow ); + virtual ~WlanWizard(); + + void setParameters( + const QString &ssid, + int networkMode, + int securityMode, + bool usePsk, + bool hidden, + bool wps); + +signals: + void cancelled(); + void finished(int iapId, bool connected); + +public slots: + void show(); + +protected: + +protected slots: + +private: + Q_DISABLE_COPY(WlanWizard) + +private slots: + +private: + //! Pointer to private implementation + WlanWizardPrivate *d_ptr; + + // Friend classes + friend class WlanWizardPrivate; + friend class TestWlanWizardContext; +}; + +/*! @} */ + +#endif /* WLANWIZARD_H_ */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/inc/wlanwizard_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/inc/wlanwizard_p.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,193 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Wizard: Private implementation. +*/ + +#ifndef WLANWIZARD_P_H +#define WLANWIZARD_P_H + +// System includes +#include +#include + +// User includes +#include "wlanwizardhelper.h" + +// Forward declarations +class QTimer; +class HbTranslator; +class HbStackedWidget; +class HbWidget; +class HbLabel; +class HbDialog; +class HbAction; +class HbDocumentLoader; +class HbMainWindow; +class WlanQtUtils; +class WlanWizardPlugin; +class WlanWizardPage; +class WlanWizard; +class EapWizard; +class WpsWizard; + +class TestWlanWizardContext; + +// External data types + +// Constants + +/*! + @addtogroup group_wlan_wizard + @{ + */ +class WlanWizardPrivate: public QObject, public WlanWizardHelper +{ + Q_OBJECT + +public: + // API implementation + WlanWizardPrivate(WlanWizard* wizard, HbMainWindow *mainWindow); + virtual ~WlanWizardPrivate(); + + void setParameters( + const QString &ssid, + int networkMode, + int securityMode, + bool usePsk, + bool hidden, + bool wps); + + void show(); + +public: + // For WLAN Wizard pages + int getNextPageId( + const QString &ssid, + int networkMode, + int securityMode, + bool usePsk, + bool hidden, + bool wps); + + WlanQtUtils* wlanQtUtils() const; + WlanWizardPlugin* wlanWizardPlugin() const; + bool isEapEnabled() const; + bool handleIap(); + +public: + // from WlanWizardHelper, for all wizards + virtual QVariant configuration(ConfigurationId confId) const; + virtual void setConfiguration(ConfigurationId confId, const QVariant &value); + virtual void clearConfiguration(ConfigurationId confId); + virtual bool configurationExists(ConfigurationId confId); + virtual void enableNextButton(bool enable); + virtual void addPage(int pageId, WlanWizardPage *page); + virtual void nextPage(); + virtual HbMainWindow* mainWindow() const; + virtual bool isCurrentPage(const HbWidget *page) const; + virtual int nextPageId(bool useWps); + +signals: + +public slots: + + void cancelTriggered(); + +protected: + +protected slots: + +private: + Q_DISABLE_COPY(WlanWizardPrivate) + static const int PageTimeout = 1500; + +private slots: + void previousTriggered(); + void nextTriggered(); + void finishTriggered(); + void onTimeOut(); + void startPageOperation(); + +private: + void toNextPage(); + void showPage(int pageId, bool removeFromStack); + void createPages(); + void closeViews(); + void updateFrame(int pageId); + void loadDocml(); + void disconnectActions(); + +private: + // Not owned pointers + //! Pointer to Wizard API class, needed to send signals + WlanWizard *q_ptr; + //! Pointer to mainwindow from where the wizard was launched + HbMainWindow *mMainWindow; + //! used for timer protected pages (progressbar) + QTimer *mPageTimer; + //! Wizard heading aka HbDialog::heading + HbLabel *mTitle; + //! Toolbar action: Next + HbAction *mActionNext; + //! Toolbar action: Previous + HbAction *mActionPrevious; + //! Toolbar action: Finish + HbAction *mActionFinish; + //! Toolbar action: Cancel + HbAction *mActionCancel; + /*! acts as HbDialog::contentWidget. When next is clicked a wizard page + (HbWidget) is added to the stack. When prev is pressed the current + item is removed from the stack. The previous pages are always in the + stacked widget + */ + HbStackedWidget *mStackedWidget; + + // Owned pointers + + //! Dialog, from docml + QScopedPointer mDialog; + //! Translator + QScopedPointer mTranslator; + //! Provides services like: create/update iap, scan, connect, disconnect + QScopedPointer mWlanQtUtils; + //! Document loader for docml + QScopedPointer mDocLoader; + //! Extensible Authentication Protocol (EAP) Wizard plugin, instantiated + //! when required + QScopedPointer mEapWizard; + //! Wifi Protected Setup (WPS) Wizard plugin, instantiated when required + QScopedPointer mWpsWizard; + //! Maps UI object of page into a control object + QHash mPageMapper; + //! Maps page id to control object of page. + QHash mPages; + + //! Holds wlan wizard configurations. + QHash mConfigurations; + //! holds the page id which is displayed when WlanWizard::show() is called + int mFirstPageId; + //! Flag to keep track if movement to next page is allowed when timer is used + bool mPageFinished; + //! flag to indicate that wizard has been closed via either cancel or finish + bool mClosed; + + // Friend classes + friend class WlanWizard; + friend class TestWlanWizardContext; +}; + +/*! @} */ + +#endif // WLANWIZARD_P_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/inc/wlanwizardhelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/inc/wlanwizardhelper.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,210 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Wizard Plugin API: Interface for plugins to wizard services. +*/ + +#ifndef WLANWIZARDHELPER_H +#define WLANWIZARDHELPER_H + +// System includes +#include + +// User includes + +// Forward declarations +class HbMainWindow; +class HbWidget; +class WlanWizardPage; + +// External data types + +// Constants + +/*! + * @addtogroup group_wlan_wizard_api_internal + * @{ + */ + +/*! + This class specifies the interface class that wizard plugins (EAP and WPS) + can use to access wizard framework services. + */ +class WlanWizardHelper +{ +public: + /*! + WLAN Wizard configuration, which are accessible by wlan wizard and it's + plugins. WLAN wizard pages uses this information to store configurations + from ui and state events. + + Please remember to update trace.properties upon changes. + */ + enum ConfigurationId { + //! QString: WLAN Network name (aka SSID) + ConfSsid = 0, + //! int: CMManagerShim::WlanConnectionMode + ConfNetworkMode = 1, + //! int: CMManagerShim::WlanSecMode + ConfSecurityMode = 2, + //! QString: WPA PSK + ConfKeyWpa = 3, + //! QString: WEP Key 1 + ConfKeyWep1 = 4, + //! QString: WEP Key 2 + ConfKeyWep2 = 5, + //! QString: WEP Key 3 + ConfKeyWep3 = 6, + //! QString: WEP Key 4 + ConfKeyWep4 = 7, + //! int: CMManagerShim:::WlanWepKeyIndex, Default WEP Key index + ConfKeyWepDefault = 8, + //! bool: Internet Connectivity Test result, true passed. + ConfIctStatus = 9, + //! int, -1 (WlanQtUtils::IapIdNone): not defined: IAP ID + ConfIapId = 10, + //! bool: true if connection was established successfully + ConfConnected = 11, + //! bool: if true hidden WLAN + ConfHiddenWlan = 12, + //! bool: if true use psk, if false use EAP + ConfUsePsk = 13, + //! bool: if true processing connection page is required. + ConfProcessSettings = 14, + //! QString: Localized error string for WlanWizardPageGenericError + ConfGenericErrorString = 15, + //! WlanWizardScanList: Available network options + ConfAvailableNetworkOptions = 16, + //! bool: Wps supported + ConfWpsSupported = 17, + //! int: Identifies how many steps should be gone backwards from + // GenericErrorPage + ConfGenericErrorPageStepsBackwards = 18, + }; + +public: + + /*! + Reader method for wlan configurations. + + See ConfigurationId for further details about the data types in QVariant. + + @param [in] confId Defines what configuration is read. + + @return configuration value. + */ + virtual QVariant configuration(ConfigurationId confId) const = 0; + + /*! + Sets wlan configuration value for given configuration identifier. + See ConfigurationId for further details about the data types in QVariant. + + @param [in] confId Configuration Identifier do to be set + @param [in] value Value for configuration. + */ + virtual void setConfiguration( + ConfigurationId confId, + const QVariant &value) = 0; + + /*! + * Clears wlan configuration at the given configuration identifier and sets + * the configuration value to type Invalid. + * + * @param [in] confId Configuration Identifier do to be cleared + */ + virtual void clearConfiguration(ConfigurationId confId) = 0; + + /*! + * Tests whether a configuration has been set. + * + * @param [in] confId Configuration Identifier do to be tested + * @return true if configuration value != Invalid, else false. + */ + virtual bool configurationExists(ConfigurationId confId) = 0; + + /*! + Enables the next button in wizard. + + @param [in] enable to enable button set to true. + */ + virtual void enableNextButton(bool enable) = 0; + + /*! + Adds a new wizard page into the wizard framework. + + @param [in] pageId The identifier of Page. See WlanWizardPage::PageIds. + @param [in] page New wizard page. + */ + virtual void addPage(int pageId, WlanWizardPage *page) = 0; + + /*! + Triggers movement to the next page. + + @note This operation has been protected with 1.5 second timer to prevent + too short lasting pages. + + @note Must be used with WlanWizardPage::startOperation(). + */ + virtual void nextPage() = 0; + + /*! + @return the main window of wizard. + */ + virtual HbMainWindow *mainWindow() const = 0; + + /*! + Checks if provided page visualization is the current visible page. + + @param [in] page Wizard Page visualization to be checked + + @return true if the page is currently visible. + */ + virtual bool isCurrentPage(const HbWidget *page) const = 0; + + /*! + Can be used to get correct page id based on the existing configuration. + + This method can be used in so called entry points to wizards + - WLAN Wizard has been lauched and setParameters() has been called + - WLAN Wizard makes own internal scanning + - WPS Wizard uses manual configuration mode. + + @param [in] useWps true: if WPS Wizard needs to be opened, false: otherwise + + @return Page Id based on configurations: + - WEP/WPA(2) with PSK: WlanWizardPageInternal::PageKeyQuery + - Open: WlanWizardPage::PageProcessSettings + - 802.1x or WPA (2) with EAP: WlanWizardPage::PageEapStart + - UseWps: WlanWizardPage::PageWpsStart + */ + virtual int nextPageId(bool useWps) = 0; + +signals: + +public slots: + +protected: + +protected slots: + +private: + +private slots: + +private: // data +}; + +/*! @} */ + +#endif // WLANWIZARDHELPER_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/inc/wlanwizardpage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/inc/wlanwizardpage.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WLAN Wizard Plugin API: Interface for wizard pages. + * + */ + +#ifndef WLANWIZARDPAGE_H +#define WLANWIZARDPAGE_H + +// System includes + +// User includes + +// Forward declarations +class HbWidget; + +// External data types + +// Constants + +/*! + @addtogroup group_wlan_wizard_api_internal + @{ + */ + +/*! + Interface for wizard pages. + + Princibles of the interface, see description of the method for detailed + information. + - initializePage() is called at first to create the UI visualizatio + - showPage() is called to detect whether next button should be enabled. This + method is called every time before the current page is displayed. + - requiresStartOperation() is called to check if page needs timer protection. + This is mainly used for pages where are progress bar and some asyncronous + operation with network layer, which commands on success to progress to next + wizard page. + - startOperation() is called to start page operation, this is called if above + method returs true. + - nextId() is called when user presses next toolbar button or when page has + called WlanWizardHelper::nextPage() method, which is used with timer + protected pages. + - previousTriggered() is called when previous toolbar button is pressed. + - cancelTriggered() is called when cancel toolbar button is pressed. + + Wizard Page must implement all pure virtual methods + - initializePage() + - nextId() + + For other methods there is default implementation, which can be overwritten. + */ +class WlanWizardPage +{ +public: + //! default value for previousTriggered(), step one step. + static const int OneStepBackwards = 1; + static const int SingleResult = 1; + + /*! + Defines common page ids for wizard and page id pools for wizard plugins. + + Remember to update trace.properties file upon changes. + */ + enum PageIds { + //! No need to change the wizard page. + PageNone = 0, + //! Process settings. Start connection and runs ict + PageProcessSettings, + //! Generic Error note page + PageGenericError, + //! Starting value for WLAN wizard page ids. Defined by WLAN Wizard. + PageWlanStart = 0x1000, + //! Starting value for EAP wizard page ids. Defined by EAP Wizard. + PageEapStart = 0x2000, + //! Starting value for WPS wizard page ids. Defined by WPS Wizard. + PageWpsStart = 0x3000, + }; + +public: + + /*! + Creates a visualization of the wizard page and returns ownership of the + object to the caller. Wizard framework deletes the visualization at the + desctructor of WlanWizardPrivate implementation. WizardPage control + object can safely use the same pointer during the life time of the + control object. This method is called every time when moving to a new + page, not when user presses "previous" button. showPage() method is + called in both cases. + + @return pointer to a visualization of the page. + */ + virtual HbWidget* initializePage() = 0; + + /*! + This method is called, after a visualization is created with + initializePage() method, to detect whether next button should be enabled + or not. It is up to the policy of the page when next button should be + enabled. This method is called everytime before the current + active page is displayed. In other words this method is "aboutToShow()" + + Default implementation: wizard page is valid and next button is enabled. + + @return validity. + */ + virtual bool showPage() + { + return true; + }; + + /*! + If the wizard page requires timer protection and asyncronous time + lasting operation, return true. This is used in pages e.g. where + progressbar is shown. The whole point is to initialize the UI before + starting the operation, so that the progress bar is painted before the + operation takes place. + + In practise this means that if true is returned by this method. + - WlanWizardPage::startOperation() is called to start the page operation. + - 1.5sec timer is used to protect the page + - wizardPage MUST call WlanWizardHelper::nextPage() to trigger entry to + next wizard page. + + @return true if protection is needed. + */ + + virtual bool requiresStartOperation() + { + return false; + }; + + /*! + In case the wizard page needs timer protection to the page use this + method to start control operation of the page. This method will be called + after requiresStartOperation() if true is returned with different call + stack. + + See requiresStartOperation(), WlanWizardHelper::nextPage(). + */ + virtual void startOperation() {}; + + /*! + Returns id of next page. This method is called when end user has pressed + "next" toolbar button or WlanWizardHelper::nextPage() is called. + + In case the wizard page does not want to make any movement forwards + WlanWizardPage::PageNone MUST be returned. + + Default implementation: Page ID WlanWizardPage::PageNone is retuned and + removeFromStack is false. + + @param [out] removeFromStack return value to the caller, if this page + needs to be removed from the stack, which means that this page cannot be + accessible from the next page using "previous" toolbar button. + + @return page identifier of next wizard page + */ + virtual int nextId(bool &removeFromStack) const + { + removeFromStack = false; + return WlanWizardPage::PageNone; + } + + /*! + This method is called when "previous" button has been pressed. + + Default implementation: one page backwards + + @return how many steps should be gone backwards. + */ + virtual int previousTriggered() + { + return OneStepBackwards; + }; + + /*! + This method is called when "cancel" button has been pressed. + + Default implementation: No actions. + */ + virtual void cancelTriggered() {}; + +signals: + +public slots: + +protected: + +protected slots: + +private: + +private slots: + +private: // data +}; + +/*! @} */ + +#endif // WLANWIZARDPAGE_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/inc/wlanwizardpagegenericerror.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/inc/wlanwizardpagegenericerror.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WLAN Wizard Page: Generic error page + * + */ + +#ifndef WLANWIZARDPAGEGENERICERROR_H +#define WLANWIZARDPAGEGENERICERROR_H + +// System includes + +// User includes +#include "wlanwizardpageinternal.h" + +// Forward declarations +class HbLabel; +class WlanWizardPrivate; + +// External data types + +// Constants + +/*! + @addtogroup group_wlan_wizard + @{ + */ + +class WlanWizardPageGenericError : public WlanWizardPageInternal +{ +public: + explicit WlanWizardPageGenericError(WlanWizardPrivate* parent); + virtual ~WlanWizardPageGenericError(); + +public: // From WlanWizardPage + HbWidget* initializePage(); + bool showPage(); + int previousTriggered(); + +signals: + +public slots: + +protected: + +protected slots: + +private: + Q_DISABLE_COPY(WlanWizardPageGenericError) + +private slots: + +private: // data + //! Pointer to visialization of this page + HbWidget *mWidget; + //! Error label. Gets string from WlanWizardHelper::ConfGenericErrorString + HbLabel *mLabel; +}; + +/*! @} */ + +#endif // WLANWIZARDPAGEGENERICERROR_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/inc/wlanwizardpageinternal.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/inc/wlanwizardpageinternal.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WLAN Wizard: Interface for wizard pages (wlan internal). + * + */ + +#ifndef WLANWIZARDPAGEINTERNAL_H +#define WLANWIZARDPAGEINTERNAL_H + +// System includes +#include + +// User includes +#include "wlanwizardpage.h" + +// Forward declarations +class HbWidget; +class WlanWizardPrivate; +class HbDocumentLoader; + +// External data types + +// Constants + +/*! + @addtogroup group_wlan_wizard + @{ + */ + +class WlanWizardPageInternal : public QObject, public WlanWizardPage +{ +public: + /*! + WLAN Wizard internal pages. + + Remember to update trace.properties file upon changes. + */ + enum WlanPageIds { + //! SSID Query + PageSsid = WlanWizardPage::PageWlanStart, + //! Scanning page + PageScanning, + //! Manual network security selection page + PageNetworkSecurity, + //! WEP/WPA(2) key query page + PageKeyQuery, + //! WLAN Network mode page + PageNetworkMode, + //! Wizard summary page + PageSummary, + }; + +public: // from WlanWizardPage + explicit WlanWizardPageInternal(WlanWizardPrivate *wizard); + virtual ~WlanWizardPageInternal(); + +public: + //! Pointer to private object. Provides services to pages + WlanWizardPrivate* mWizard; + +signals: + +public slots: + +protected: + void loadDocmlSection( + HbDocumentLoader *loader, + Qt::Orientation orientation, + const QString &filename, + const QString &portraitSection, + const QString &landscapeSection) const; + +protected slots: + +private: + Q_DISABLE_COPY(WlanWizardPageInternal) + +private slots: + +private: // data +}; + +/*! @} */ + +#endif // WLANWIZARDPAGEINTERNAL_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/inc/wlanwizardpagekeyquery.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/inc/wlanwizardpagekeyquery.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WLAN Wizard Page: Key Query page for WEP and WPA (2). + * + */ + +#ifndef WLANWIZARDPAGEKEYQUERY_H +#define WLANWIZARDPAGEKEYQUERY_H + +// System includes + +// User includes +#include "wlanwizardpageinternal.h" +#include "wlanwizardutils.h" + +// Forward declarations +class QChar; +class HbLabel; +class HbLineEdit; +class HbDocumentLoader; +class WlanWizardPrivate; + +// External data types + +// Constants + +/*! + @addtogroup group_wlan_wizard + @{ + */ + +class WlanWizardPageKeyQuery: public WlanWizardPageInternal +{ + Q_OBJECT +public: + explicit WlanWizardPageKeyQuery(WlanWizardPrivate* parent); + virtual ~WlanWizardPageKeyQuery(); + +public: // From WlanWizardPageInternal + HbWidget* initializePage(); + int nextId(bool &removeFromStack) const; + bool showPage(); + +signals: + +public slots: + void loadDocmlSection(Qt::Orientation orientation); + +protected: + bool eventFilter(QObject *obj, QEvent *event); + +protected slots: + +private: + Q_DISABLE_COPY(WlanWizardPageKeyQuery) + QString keyStatusToErrorString(WlanWizardUtils::KeyStatus status) const; + +private slots: + +private: + // NOT OWNED + //! Visualization of the page + HbWidget *mWidget; + //! Title text for line editor + HbLabel *mLabelTitle; + //! Line editor for WLAN WEP / WPA PSK key + HbLineEdit *mLineEdit; + //! Label for key specific error texts + HbLabel *mLabelError; + + // OWNED + //! docml document loader + HbDocumentLoader *mDocLoader; +}; + +/*! @} */ + +#endif // WLANWIZARDPAGEKEYQUERY_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/inc/wlanwizardpagenetworkmode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/inc/wlanwizardpagenetworkmode.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WLAN Wizard Page: Manual Network mode query page. + * + */ + +#ifndef WLANWIZARDPAGENETWORKMODE_H +#define WLANWIZARDPAGENETWORKMODE_H + +// System includes + +// User includes +#include "wlanwizardpageinternal.h" + +// Forward declarations +class HbRadioButtonList; +class HbLabel; +class WlanWizardPrivate; +class HbDocumentLoader; +class WlanNetworkSetting; + +// External data types + +// Constants + +/*! + * @addtogroup group_wlan_wizard + * @{ + */ + +class WlanWizardPageNetworkMode : public WlanWizardPageInternal +{ + Q_OBJECT +public: + + explicit WlanWizardPageNetworkMode(WlanWizardPrivate* parent); + virtual ~WlanWizardPageNetworkMode(); + +public: // From WlanWizardPageInternal + HbWidget* initializePage(); + int nextId(bool &removeFromStack) const; + bool showPage(); + +signals: + +public slots: + void itemSelected(); + void loadDocmlSection(Qt::Orientation orientation); + +protected: + +protected slots: + +private: + Q_DISABLE_COPY(WlanWizardPageNetworkMode) + void addToList(QStringList &list, const QString &item, int mode, bool isHidden); + void populateRadioButtonList(QStringList &list); + int selectNextPage(const WlanNetworkSetting &setting) const; + +private slots: + +private: + /*! + * Pointer to the view. + */ + HbWidget *mWidget; + + /*! + * Pointer to the radio button list object. + */ + HbRadioButtonList *mList; + + /*! + * Pointer to the label object. + */ + HbLabel *mLabel; + + /*! + * Pointer to document loader object. + */ + HbDocumentLoader *mLoader; + + /*! + * True, if a mode has been selected. False otherwise. + */ + bool mValid; + + /*! + * List of network modes. This list is tied to the radio buttons during + * the initialization of the page. + */ + QList mNetworkModes; + + /*! + * List of publicity modes. This list is tied to the radio buttons during + * the initialization of the page. + */ + QList mIsHidden; +}; + +/*! @} */ + +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/inc/wlanwizardpageprocessingsettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/inc/wlanwizardpageprocessingsettings.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WLAN Wizard Page: Processing settings, connection and running ict. + * + */ + +#ifndef WLANWIZARDPAGEPROCESSINGSETTINGS_H +#define WLANWIZARDPAGEPROCESSINGSETTINGS_H + +// System includes + +// User includes +#include "wlanwizardpageinternal.h" +#include "wlanqtutils.h" + +// Forward declarations +class HbDocumentLoader; +class HbLabel; +class WlanWizardPrivate; + +// External data types + +// Constants + +/*! + @addtogroup group_wlan_wizard + @{ + */ + +class WlanWizardPageProcessingSettings: public WlanWizardPageInternal +{ + Q_OBJECT +public: + explicit WlanWizardPageProcessingSettings(WlanWizardPrivate* parent); + virtual ~WlanWizardPageProcessingSettings(); + +public: // From WlanWizardPage + HbWidget* initializePage(); + int nextId(bool &removeFromStack) const; + bool showPage(); + bool requiresStartOperation(); + void startOperation(); + +signals: + +public slots: + void loadDocmlSection(Qt::Orientation orientation); + void wlanNetworkClosed(int iapId, int reason); + void ictResult(int iapId, int result); + void wlanNetworkOpened(int iapId); + +protected: + +protected slots: + +private: + Q_DISABLE_COPY(WlanWizardPageProcessingSettings) + +private slots: + +private: // data + // OWNED + //! Docml document loader + HbDocumentLoader *mDocLoader; + + // NOT OWNED + //! Visualization of the page + HbWidget *mWidget; + //! Title for text in the page + HbLabel *mLabel; + //! PageId for next wizard page + int mNextPageId; +}; + +/*! @} */ + +#endif // WLANWIZARDPAGEPROCESSINGSETTINGS_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/inc/wlanwizardpagescanning.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/inc/wlanwizardpagescanning.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Wizard Page: Scan processing +*/ + +#ifndef WLANWIZARDPAGESCANNING_H +#define WLANWIZARDPAGESCANNING_H + +// System includes +#include +#include +#include + +// User includes +#include "wlanwizardpageinternal.h" +#include "wlanwizard.h" +#include "wlanwizardscanlist.h" + +// Forward declarations +class WlanWizardPrivate; +class HbLabel; +class HbProgressBar; +class HbDocumentLoader; +class WlanQtUtilsAp; + +// External data types + +// Constants + +/*! + * @addtogroup group_wlan_wizard + * @{ + */ + +class WlanWizardPageScanning: public WlanWizardPageInternal +{ + Q_OBJECT + +public: + explicit WlanWizardPageScanning(WlanWizardPrivate* parent); + virtual ~WlanWizardPageScanning(); + +public: + HbWidget* initializePage(); + int nextId(bool &removeFromStack) const; + int previousTriggered(); + bool showPage(); + bool requiresStartOperation(); + void startOperation(); + +signals: + +public slots: + void loadDocmlSection(Qt::Orientation orientation); + void wlanScanResultPreCheck(int scanStatus); + void wlanScanDirectReady(int scanStatus); + +protected: + +protected slots: + +private: + Q_DISABLE_COPY(WlanWizardPageScanning) + void wlanScanApReady(); + void getSsidMatchList( + QString ssid, + const QList > &matchList); + void getFinalScanResults( + const QList > &directScanResults, + const QList > &openScanResults, + QList &finalResults); + int processMultipleScanResults(const QList &finalResults); + void selectNextPageActions(const QList &finalResults); + +private slots: + +private: + /*! + * Pointer to the view. + */ + HbWidget *mWidget; + + /*! + * Pointer to the label widget. + */ + HbLabel *mLabel; + + /*! + * Pointer to document loader object. + */ + HbDocumentLoader *mLoader; + + /*! + * The next page identifier. + */ + int mNextPageId; + + /*! + * Indicator, whether AP scan results are available or not. + */ + bool mScanResultsAvailable; + + /*! + * Indicator of the current scan status. + */ + int mScanStatus; + + /*! + * list containing the results of a normal scan of open networks. + */ + QList > mWlanApList; +}; + +/*! @} */ + +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/inc/wlanwizardpagesecuritymode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/inc/wlanwizardpagesecuritymode.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WLAN Wizard Page: Security mode selection + * + */ + +#ifndef WLANWIZARDPAGESECURITYMODE_H +#define WLANWIZARDPAGESECURITYMODE_H + +// System includes + +// User includes +#include "wlanwizardpageinternal.h" + +// Forward declarations +class HbRadioButtonList; +class HbLabel; +class WlanWizardPrivate; +class HbDocumentLoader; + +// External data types + +// Constants + +/*! + * @addtogroup group_wlan_wizard + * @{ + */ + +class WlanWizardPageSecurityMode: public WlanWizardPageInternal +{ + Q_OBJECT +public: + explicit WlanWizardPageSecurityMode(WlanWizardPrivate* parent); + virtual ~WlanWizardPageSecurityMode(); + +public: + HbWidget* initializePage(); + int nextId(bool &removeFromStack) const; + bool showPage(); + +signals: + +public slots: + +protected: + +protected slots: + +private: + Q_DISABLE_COPY(WlanWizardPageSecurityMode) + void populateSecModeList(); + void addToList( + QStringList &list, + const QString &item, + int mode, + int page, + bool psk); + +private slots: + void itemSelected(); + void loadDocmlSection(Qt::Orientation orientation); + +private: + /*! + * Pointer to the view. + */ + HbWidget *mWidget; + + /*! + * Pointer to the radio button list object. + */ + HbRadioButtonList *mList; + + /*! + * Pointer to the label object. + */ + HbLabel *mLabel; + + /*! + * Pointer to document loader object. + */ + HbDocumentLoader *mLoader; + + /*! + * True, if a mode has been selected. False otherwise. + */ + bool mValid; + + /*! + * List of sequrity modes. This list is tied to the radio buttons during + * the initialization of the page. + */ + QList mSecModes; + + /*! + * List of page identifiers. This list is tied to the radio buttons during + * the initialization of the page. + */ + QList mPageIds; + + /*! + * List of password usage. This list is tied to the radio buttons during + * the initialization of the page. True, if password is to be queried, + * false otherwise + */ + QList mUsePsk; +}; + +/*! @} */ + +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/inc/wlanwizardpagessid.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/inc/wlanwizardpagessid.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WLAN Wizard Page: Ssid query + * + */ + +#ifndef WLANWIZARDPAGESSID_H +#define WLANWIZARDPAGESSID_H + +// System includes + +// User includes +#include "wlanwizardpageinternal.h" +#include "wlanwizardutils.h" + +// Forward declarations +class WlanWizardPrivate; +class HbLabel; +class HbLineEdit; +class HbDocumentLoader; +class TestWlanWizardUi; + +// External data types + +// Constants + +/*! + * @addtogroup group_wlan_wizard + * @{ + */ + +class WlanWizardPageSsid: public WlanWizardPageInternal +{ + Q_OBJECT +public: + explicit WlanWizardPageSsid(WlanWizardPrivate* parent); + virtual ~WlanWizardPageSsid(); + +public: + HbWidget* initializePage(); + virtual bool showPage(); + int nextId(bool &removeFromStack) const; + +signals: + +public slots: + void loadDocmlSection(Qt::Orientation orientation); + void textChanged(const QString &text); + +protected: + +protected slots: + +private: + Q_DISABLE_COPY(WlanWizardPageSsid) + +private slots: + +private: + /*! + * Pointer to the view. + */ + HbWidget *mWidget; + + /*! + * Pointer to the header label object. + */ + HbLabel *mLabel; + + /*! + * Pointer to the line edit object. + */ + HbLineEdit *mSsid; + + /*! + * Pointer to the document loader object. + */ + HbDocumentLoader *mLoader; + + // Friend classes + friend class TestWlanWizardUi; +}; + +/*! @} */ + +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/inc/wlanwizardpagesummary.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/inc/wlanwizardpagesummary.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WLAN Wizard Page: Summary + * + */ + +#ifndef WLANWIZARDPAGESUMMARY_H +#define WLANWIZARDPAGESUMMARY_H + +// System includes + +// User includes +#include "wlanwizardpageinternal.h" + +// Forward declarations +class HbLabel; +class WlanWizardPrivate; +class HbListWidget; + +// External data types + +// Constants + +/*! + @addtogroup group_wlan_wizard + @{ + */ + +class WlanWizardPageSummary : public WlanWizardPageInternal +{ +public: + explicit WlanWizardPageSummary(WlanWizardPrivate* parent); + virtual ~WlanWizardPageSummary(); + +public: // From WlanWizardPage + HbWidget* initializePage(); + +signals: + +public slots: + +protected: + +protected slots: + +private: + Q_DISABLE_COPY(WlanWizardPageSummary) + void loadDocml(); + QString networkModeText() const; + QString securityModeText() const; + void addDynamicItems(int &row); + void appendToList(int &row, const QString title, const QString value); + void appendToListPluginInfo(WlanWizardPlugin::Summary id, int &row); + +private slots: + +private: // data + //! Visualization of the page + HbListWidget *mListWidget; +}; + +/*! @} */ + +#endif // WLANWIZARDPAGESUMMARY_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/inc/wlanwizardplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/inc/wlanwizardplugin.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WLAN Wizard Plugin API: Service required from the wizard plugin. + * + */ + +#ifndef WLANWIZARDPLUGIN_H +#define WLANWIZARDPLUGIN_H + +// System includes + +// User includes + +// Forward declarations + +// External data types + +// Constants + +/*! + @addtogroup group_wlan_wizard_api_internal + @{ + */ + +/*! + Interface that wizard plugin must implement or at least the plugin MUST + inherit this interface and use the default implementations. + */ +class WlanWizardPlugin +{ +public: + /*! + Enumerators for WLAN Wizard summary page. + */ + enum Summary { + //! EAP Outer Type + SummaryEapOuterType = 0, + //! EAP Inner Type + SummaryEapInnerType, + //! EAP Fast: Provisioning mode + SummaryEapFastProvisioningMode, + }; + +public: + /*! + This method is used to query summary items from the wizard plugins + that are eap and wps wizard. + + Both item and value are localized strings. + + @param [in] sum Summary id to be queried + @param [out] item The item string is returned here + @param [out] value the value of item is returned here. + + @return true if summary item is found, false otherwise. + */ + virtual bool summary( + WlanWizardPlugin::Summary sum, + QString &item, + QString &value) + { + Q_UNUSED(sum); + Q_UNUSED(item); + Q_UNUSED(value); + return false; + }; + + /*! + Stores wizard specific settings if any. + */ + virtual bool storeSettings() + { + return true; + }; + + /*! + Maps plugin specific error codes into a localized string. + + @param [in] errorCode Symbian error code. + + @return If mapping can be done a localized error string is returned + otherwise an empty string is returned. In case of empty string wlanwizard + will use default error code. + */ + virtual QString errorString(int errorCode) + { + Q_UNUSED(errorCode); + return QString(); + } +signals: + +public slots: + +protected: + +protected slots: + +private: + +private slots: + +private: // data +}; +/*! @} */ + +#endif /* WLANWIZARDPLUGIN_H */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/inc/wlanwizardscanlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/inc/wlanwizardscanlist.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WLAN Wizard Plugin API: Service required from the wizard plugin. + * + */ + +#ifndef WLANWIZARDSCANLIST_H_ +#define WLANWIZARDSCANLIST_H_ + +// System includes +#include +#include +#include +#include +#include + +/*! + @addtogroup group_wlan_wizard + @{ + */ + +// User includes + +// Forward declarations +class WlanQtUtilsAp; + +// External data types +/*! + * Data structure with scan results and access point visibility information. + */ +class WlanScanResult +{ +public: + QSharedPointer scanResult; + bool networkHidden; +}; + +/*! + * Data structure containing security setting information and wizard page + * navigation information. + */ +class WlanSecuritySetting +{ +public: + int mode; + bool usePsk; + int nextPageId; + + bool operator==(const WlanSecuritySetting& setting) const { + return (mode == setting.mode && + usePsk == setting.usePsk && + nextPageId == setting.nextPageId); + } +}; + +/*! + * Data structure containing network mode, visibility and wireless protection + * setup suppport information. + */ +class WlanNetworkSetting +{ +public: + int mode; + bool hidden; + bool wpsSupported; + + bool operator==(const WlanNetworkSetting& setting) const { + return (mode == setting.mode && + hidden == setting.hidden && + wpsSupported == setting.wpsSupported); + } +}; + +/*! + * Necessary public function for an argument of type WlanNetworkSetting to + * function as a QHash key. + */ +inline uint qHash(const WlanNetworkSetting &key) + { + uint hash = key.mode; + hash <<= 1; + hash |= key.hidden ? 1 : 0; + hash <<= 1; + hash |= key.wpsSupported ? 1 : 0; + return qHash(hash); + } + +// Constants + +class WlanWizardScanList +{ +public: + WlanWizardScanList(); + WlanWizardScanList(const WlanWizardScanList &scanList); + ~WlanWizardScanList(); + void build(const QList &results); + const WlanSecuritySetting &getSecMode(WlanNetworkSetting netMode, int index = 0) const; + int netModes() const; + int secModes(WlanNetworkSetting netMode) const; + QList getNetModes() const; + +private: + // Disabling implicit assignment operator + WlanWizardScanList &operator=(const WlanWizardScanList &); + +private: + QHash > mOpenOptions; +}; + +/*! + * This macro makes WlanWizardScanList QVariant-compatible. + */ +Q_DECLARE_METATYPE(WlanWizardScanList) + +/*! @} */ + +#endif /* WLANWIZARDSCANLIST_H_ */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/inc/wlanwizardsummaryviewitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/inc/wlanwizardsummaryviewitem.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Wlan Wizard Page: Summary: Custom list view item + */ + +#ifndef WLANWIZARDSUMMARYLISTVIEWITEM_H +#define WLANWIZARDSUMMARYLISTVIEWITEM_H + +// System includes +#include + +// User includes + +// Forward declarations + +// External data types + +// Constants + +/*! + @addtogroup group_wlan_wizard + @{ + */ + +class WlanWizardSummaryListViewItem : public HbListViewItem +{ +public: + explicit WlanWizardSummaryListViewItem(QGraphicsItem* parent = 0); + virtual ~WlanWizardSummaryListViewItem(); + + virtual HbAbstractViewItem* createItem(); + virtual void updateChildItems(); + +signals: + +public slots: + +protected: + +protected slots: + +private: + +private slots: + +private: // data +}; + +/*! @} */ + +#endif // WLANWIZARDSUMMARYLISTVIEWITEM_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/inc/wlanwizardutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/inc/wlanwizardutils.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WLAN Wizard Utilities + * + */ + +#ifndef WLANWIZARDUTILS_H +#define WLANWIZARDUTILS_H + +// System includes + +// User includes + +// Forward declarations + +// External data types + +// Constants + +/*! + @addtogroup group_wlan_wizard + @{ + */ + +class WlanWizardUtils +{ +public: + enum KeyStatus { + KeyStatusOk = 0, + KeyStatusIllegalCharacters, + KeyStatusWpaTooShort, + KeyStatusWpaTooLong, + KeyStatusWepInvalidLength, + }; + + enum SsidStatus { + SsidStatusOk = 0, + SsidStatusIllegalCharacters, + SsidStatusInvalidLength + }; + + static const int SsidMinLength = 1; + static const int SsidMaxLength = 32; + static const int WpaMinLength = 8; + static const int WpaMaxLength = 64; + static const int WepHex64BitMaxLength = 10; + static const int WepHex128BitMaxLength = 26; + static const int WepAscii64BitMaxLength = 5; + static const int WepAscii128BitMaxLength = 13; + +public: + static KeyStatus validateWepKey(const QString &key); + static KeyStatus validateWpaKey(const QString &key); + static KeyStatus isAscii(const QString &key); + static KeyStatus isHex(const QString &key); + static SsidStatus validateSsid(const QString &ssid); + +signals: + +public slots: + +protected: + +protected slots: + +private: + Q_DISABLE_COPY(WlanWizardUtils) + +private slots: + +private: // data +}; + +/*! @} */ + +#endif /* WLANWIZARDUTILS_H */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/resources/custom.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/resources/custom.css Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,11 @@ +HbDialog#dialog:portrait +{ +pref-width: var(hb-param-screen-width); +pref-height: var(hb-param-screen-height); +} + +HbDialog#dialog:landscape +{ +pref-width: var(hb-param-screen-width); +pref-height: var(hb-param-screen-height); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/resources/hblistviewitem.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/resources/hblistviewitem.css Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,31 @@ + +HbListViewItem[layoutName="wlanwizardsummaryitem"]{ + layout:wlanwizardsummaryitem-portrait; +} + +HbListViewItem[layoutName="wlanwizardsummaryitem"]:landscape{ + layout:wlanwizardsummaryitem-landscape; +} + +HbListViewItem::text-1[layoutName="wlanwizardsummaryitem"]{ + text-height: var(hb-param-text-height-secondary); + font-variant: primary; + text-align: left; + size-policy-horizontal: preferred; + pref-width:-1; +} + +HbListViewItem::text-1[layoutName="wlanwizardsummaryitem"]:landscape{ + text-height: var(hb-param-text-height-secondary); + font-variant: primary; + text-align: left; + size-policy-horizontal: fixed; + fixed-width: expr((var(hb-param-screen-width) - var(hb-param-margin-gene-middle-horizontal)) / 2 - var(hb-param-margin-gene-screen) - var(hb-param-margin-gene-popup)); +} + +HbListViewItem::text-2[layoutName="wlanwizardsummaryitem"]{ + text-height: var(hb-param-text-height-tiny); + font-variant: secondary; + pref-width:-1; + text-align: left; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/resources/hblistviewitem.widgetml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/resources/hblistviewitem.widgetml Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/resources/occ_add_wlan_01_04.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/resources/occ_add_wlan_01_04.docml Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
+ + + + + +
diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/resources/occ_add_wlan_02_03.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/resources/occ_add_wlan_02_03.docml Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,50 @@ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + +
+ + + + + +
diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/resources/occ_add_wlan_05.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/resources/occ_add_wlan_05.docml Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,7 @@ + + + + + + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/resources/occ_add_wlan_06.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/resources/occ_add_wlan_06.docml Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + +
+ + + + + +
diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/resources/occ_add_wlan_error.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/resources/occ_add_wlan_error.docml Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/resources/occ_wlan_wizard_main.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/resources/occ_wlan_wizard_main.docml Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/resources/resource.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/resources/resource.qrc Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,17 @@ + + + occ_wlan_wizard_main.docml + occ_add_wlan_05.docml + occ_add_wlan_06.docml + occ_add_wlan_02_03.docml + occ_add_wlan_01_04.docml + occ_add_wlan_error.docml + + + custom.css + + + hblistviewitem.css + hblistviewitem.widgetml + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/rom/wlanwizard.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/rom/wlanwizard.iby Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* IBY file for WLAN Wizard +*/ + +#ifndef WLANWIZARD_IBY +#define WLANWIZARD_IBY + +#include +#include + +#ifdef __PROTOCOL_WLAN + +file=ABI_DIR\BUILD_DIR\wlanwizard.dll SHARED_LIB_DIR\wlanwizard.dll + +#endif // __PROTOCOL_WLAN + +#endif // WLANWIZARD_IBY diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/rom/wlanwizard_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/rom/wlanwizard_resources.iby Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Wizard resource iby. +*/ + +#ifndef WLANWIZARD_RESOURCES_IBY +#define WLANWIZARD_RESOURCES_IBY + +#include +#include + +#ifdef __PROTOCOL_WLAN + +data=DATAZ_/QT_TRANSLATIONS_DIR/wlanwizard.qm QT_TRANSLATIONS_DIR/wlanwizard.qm + +#endif // __PROTOCOL_WLAN + +#endif // WLANWIZARD_RESOURCES_IBY diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/src/wlanwizard.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/src/wlanwizard.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WLAN Wizard: API. + * + */ + +// System includes + +// User includes +#include "wlanwizard.h" +#include "wlanwizard_p.h" + +/*! + \class WlanWizard + \brief Interface of WLAN Wizard. + + Example usage: + \code + MyClass::createWizard() { + mWizard = new WlanWizard(mainWindow()); + connect( + mWizard, SIGNAL(finished(int, bool)), + this, SLOT(finished(int, bool))); + connect(mWizard, SIGNAL(cancelled()), this, SLOT(cancelled())); + + // If client know the parameters for WLAN Access Point call following + mWizard->setParameters( + "MySSid", + CmManagerShim::Infra, + CmManagerShim::WlanSecModeWpa, + true, // WPA-PSK + false, // Non-Hidden + false ); // Non-Wifi Protected Setup + + // and execute wizard + mWizard->show(); + } + + void MyClass::finished(int iapId, bool connected) { + // User has successfully created WLAN IAP with the wizard. + + // if connected equals to true, wizard has established connection to it + // now the client needs to connect also to given IAP Id to keep the + // connection open. + // see WlanQtUtils or RConnection. + + // Delete wizard. Do not delete in this call stack since this call has + // been done from the context of the wizards call stack. + mWizard->deleteLater(); + mWizard = NULL; + } + + void MyClass::cancelled() { + // wizard operation was cancelled by user, iap has not been created + // and WLAN connection is not established + + // Delete wizard. Do not delete in this call stack since this call has + // been done from the context of the wizards call stack. + mWizard->deleteLater(); + mWizard = NULL; + } + \endcode + + Implements wizard based on wizard pattern. + */ + +/*! + \fn void WlanWizard::cancelled() + This signal is emitted when the execution of wizard has been cancelled. + */ + +/*! + \fn void WlanWizard::finished(int iapId, bool connected) + This signal is emitted when the execution of wizard has been finished + succesfully. + + @param iapId IAP ID that has been created. + @param connected true if the connection to wlan has been established. + */ + +// External function prototypes + +// Local constants + + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor of WLAN Wizard. + + @param [in] mainWindow HbMainWindow to where the wizard is going to be executed. + */ +WlanWizard::WlanWizard(HbMainWindow *mainWindow) : + d_ptr(new WlanWizardPrivate(this, mainWindow)) +{ +} + +/*! + Destructor. + */ +WlanWizard::~WlanWizard() +{ + delete d_ptr; +} + +/*! + Client can set the known WLAN Access Point configurations to speed up wizard + processing and make it easier for end user. + + Values for network mode (CmManagerShim::WlanConnectionMode) and security mode + (CmManagerShim::WlanSecMode). + + Supported configuration sets: + - Open: \a ssid \a networkMode \a securityMode + - WEP: \a ssid \a networkMode \a securityMode + - WPA (2) with EAP: \a ssid \a networkMode \a securityMode \a usePsk (false) + - WPA (2) with PSK: \a ssid \a networkMode \a securityMode \a usePsk (true) + - 802.1x: \a ssid \a networkMode \a securityMode + + Hidden WLAN: + \a hidden can be used with \a networkMode CmManagerShim::Infra + + Wifi Protected Setup + \a wps can be used with Open, WEP and WPA (2) with PSK. + + @param [in] ssid The name of WLAN network (ssid), max length 32 characters. + @param [in] networkMode Network mode of known access point + @param [in] securityMode Security mode of known access point + @param [in] usePsk used only with WPA or WPA2 \a securityMode + @param [in] hidden if true WLAN is hidden. + @param [in] wps is Wifi Protected Setup supported? + */ +void WlanWizard::setParameters( + const QString &ssid, + int networkMode, + int securityMode, + bool usePsk, + bool hidden, + bool wps) +{ + d_ptr->setParameters(ssid, networkMode, securityMode, usePsk, hidden, wps); +} + +/*! + Executes the wizard and shows the first page. + + @note it is not allowed to call this method twice with same instance. + + Possible signals: + - finished(int, bool): called after wizard has successfully completed + - cancelled(): user has cancelled the wizard operations. + + First page for the wizard is SSID (WLAN network name) query or if + setParameters() has been called the first page is determined based on the + given configuration combination. + */ +void WlanWizard::show() +{ + d_ptr->show(); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/src/wlanwizard_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/src/wlanwizard_p.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,1055 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Wizard: Private implementation. +*/ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "eapwizard.h" +#include "wpswizard.h" +#include "wlanqtutils.h" +#include "wlanqtutilsap.h" +#include "wlanwizardplugin.h" +#include "wlanwizard.h" +#include "wlanwizard_p.h" +#include "wlanwizardutils.h" +#include "wlanwizardpagekeyquery.h" +#include "wlanwizardpagesummary.h" +#include "wlanwizardpageprocessingsettings.h" +#include "wlanwizardpagegenericerror.h" +#include "wlanwizardpagessid.h" +#include "wlanwizardpagenetworkmode.h" +#include "wlanwizardpagescanning.h" +#include "wlanwizardpagesecuritymode.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanwizard_pTraces.h" +#endif + +/*! + \class WlanWizardPrivate + \brief Private implementation of WlanWizard. Implements the interface + WlanWizardHelper to the wizard plugins. + */ + +// External function prototypes + +// Local constants + +/*! + \var PageTimeout Timeout for timer protected pages. 1.5sec + */ + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor of private implementation. + + @param [in] wizard Pointer to the API class. + @param [in] mainWindow pointer to mainwindow. + */ +WlanWizardPrivate::WlanWizardPrivate( + WlanWizard* wizard, + HbMainWindow *mainWindow) : + QObject(wizard), + q_ptr(wizard), + mMainWindow(mainWindow), + mPageTimer(new QTimer(this)), + mTitle(NULL), + mActionNext(NULL), + mActionPrevious(NULL), + mActionFinish(NULL), + mActionCancel(NULL), + mStackedWidget(NULL), + mDialog(NULL), + mTranslator(new HbTranslator("wlanwizard")), + mWlanQtUtils(new WlanQtUtils()), + mDocLoader(new HbDocumentLoader(mainWindow)), + mEapWizard(NULL), + mWpsWizard(NULL), + mFirstPageId(WlanWizardPageInternal::PageNone), + mPageFinished(false), + mClosed(false) +{ + OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_WLANWIZARDPRIVATE, + "WlanWizardPrivate::WlanWizardPrivate;this=%x", + this ); + + // Set initial values for configurations + setConfiguration(ConfIapId, WlanQtUtils::IapIdNone); + setConfiguration(ConfConnected, false); + setConfiguration(ConfHiddenWlan, false); + setConfiguration(ConfProcessSettings, false); + setConfiguration(ConfIctStatus, false); + + // Initialize timer for timer protected pages + mPageTimer->setSingleShot(true); + + // Load the wizard frame (title, content, actions) from docml + loadDocml(); + + // Creates the control object of the wlan wizard pages. + createPages(); + + // EAP Wizard will add wizard pages at construction phase using + // WlanWizardHelper::addPage() + mEapWizard.reset(new EapWizard(this) ); + + // WPS Wizard will add wizard pages at construction phase using + // WlanWizardHelper::addPage() + mWpsWizard.reset(new WpsWizard(this)); + + // First page is SSID query, unless client sets configurations via + // setParameters(), which decides the first page.. + mFirstPageId = WlanWizardPageInternal::PageSsid; + + OstTraceExt2( TRACE_BORDER, WLANWIZARDPRIVATE_WLANWIZARDPRIVATE_DONE, + "WlanWizardPrivate::WlanWizardPrivate - done;" + "this=%x;mFirstPageId=%{PageIds}", + ( unsigned )this, mFirstPageId ); +} + +/*! + Destructor. + */ +WlanWizardPrivate::~WlanWizardPrivate() +{ + OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_DWLANWIZARDPRIVATE, + "WlanWizardPrivate::~WlanWizardPrivate;this=%x", + this ); + + // Remove wizard pages from stackedwidgets, since stackedwidget owns the + // objects and all pages are deleted below. + while (mStackedWidget->count()) { + mStackedWidget->removeAt(0); + } + + // Delete UI instances (HbWidget) of pages + QHashIterator i(mPageMapper); + while (i.hasNext()) { + i.next(); + delete i.key(); + } + mPageMapper.clear(); + + // WlanWizardPage objects are automatically deleted since this is the + // parent of the objects. + mPages.clear(); + + // timer is cancelled/deleted automatically when the parent (this) is deleted + + // TODO: See TSW Error: MTAA-854DK8 and loadDocml() + HbStyleLoader::unregisterFilePath(":/css/custom.css"); + + mDialog->setAttribute( Qt::WA_DeleteOnClose, true ); + mDialog->close(); + // Remove the pointer from QScopedPointer to prevent double deallocation + mDialog.take(); + + OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_DWLANWIZARDPRIVATE_DONE, + "WlanWizardPrivate::~WlanWizardPrivate-Done;this=%x", + this ); +} + +/*! + See WlanWizard::setParameters(). + */ +void WlanWizardPrivate::setParameters( + const QString &ssid, + int networkMode, + int securityMode, + bool usePsk, + bool hidden, + bool wps) +{ + OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_SETPARAMETERS, + "WlanWizardPrivate::setParameters;this=%x", + this ); + + mFirstPageId = getNextPageId( + ssid, networkMode, securityMode, usePsk, hidden, wps); + + OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_SETPARAMETERS_DONE, + "WlanWizardPrivate::setParameters - Done;this=%x", + this ); +} + +/*! + See WlanWizard::show(). + */ +void WlanWizardPrivate::show() +{ + OstTraceExt2( TRACE_BORDER, WLANWIZARDPRIVATE_SHOW, + "WlanWizardPrivate::show;this=%x;mFirstPageId=%{PageIds}", + ( unsigned )this, mFirstPageId ); + + Q_ASSERT(mClosed == false); + showPage(mFirstPageId, false); + mDialog->show(); + + OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_SHOW_DONE, + "WlanWizardPrivate::show - Done;this=%x;", + (unsigned)this ); +} + +/*! + See WlanWizard::setParameters() for descriptions of parameters. + + Based on the provided parameters next page id is returned. + + @return next page id based on provided configurations. + */ +int WlanWizardPrivate::getNextPageId( + const QString &ssid, + int networkMode, + int securityMode, + bool usePsk, + bool hidden, + bool wps) +{ + setConfiguration(ConfProcessSettings, true); + setConfiguration(ConfSsid, ssid); + setConfiguration(ConfNetworkMode, networkMode); + setConfiguration(ConfSecurityMode, securityMode); + setConfiguration(ConfUsePsk, usePsk); + setConfiguration(ConfHiddenWlan, hidden); + + OstTrace1( TRACE_NORMAL, WLANWIZARDPRIVATE_GETNEXTPAGEID, + "WlanWizardPrivate::getNextPageId;wps=%u", + wps ); + + return nextPageId(wps); +} + +/*! + Utility method for WLAN Wizard pages to query the wlanqtutils class. + + @return a valid pointer to WlanQtUtils class. + */ +WlanQtUtils* WlanWizardPrivate::wlanQtUtils() const +{ + Q_ASSERT(mWlanQtUtils); + return mWlanQtUtils.data(); +} + +/*! + Utility method for WLAN Wizard pages to query active wizard plugin object + + @return NULL in case plugin is not active. + */ +WlanWizardPlugin* WlanWizardPrivate::wlanWizardPlugin() const +{ + WlanWizardPlugin* plugin = NULL; + + if (isEapEnabled()) { + plugin = mEapWizard.data(); + Q_ASSERT(plugin); + } + + OstTrace1( TRACE_NORMAL, WLANWIZARDPRIVATE_WLANWIZARDPLUGIN, + "WlanWizardPrivate::wlanWizardPlugin;plugin=%x", + plugin ); + + return plugin; +} + +/*! + Utility method for WLAN Wizard pages to query if EAP mode is active at the + moment + + @return true in case EAP is currently activated. + */ +bool WlanWizardPrivate::isEapEnabled() const +{ + bool ret = false; + int secMode = configuration(ConfSecurityMode).toInt(); + + if (((secMode == CMManagerShim::WlanSecModeWpa || + secMode == CMManagerShim::WlanSecModeWpa2) && + !configuration(ConfUsePsk).toBool()) || + secMode == CMManagerShim::WlanSecMode802_1x) { + ret = true; + } + + OstTrace1( TRACE_NORMAL, WLANWIZARDPRIVATE_ISEAPENABLED, + "WlanWizardPrivate::isEapEnabled;ret=%u", + ret ); + + return ret; +} + +/*! + Creates new iap or updates existing iap. + + @return false in case IAP creation/update failed. + */ +bool WlanWizardPrivate::handleIap() +{ + OstTrace0( TRACE_FLOW, WLANWIZARDPRIVATE_HANDLEIAP, + "WlanWizardPrivate::handleIap" ); + + bool ret = true; + bool usePsk = true; + int securityMode = configuration(ConfSecurityMode).toInt(); + WlanQtUtilsAp wlanAp; + + // Set default values + wlanAp.setValue(WlanQtUtilsAp::ConfIdWpaPsk, QString()); + wlanAp.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true ); + wlanAp.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1 ); + wlanAp.setValue(WlanQtUtilsAp::ConfIdWepKey1, QString()); + wlanAp.setValue(WlanQtUtilsAp::ConfIdWepKey2, QString()); + wlanAp.setValue(WlanQtUtilsAp::ConfIdWepKey3, QString()); + wlanAp.setValue(WlanQtUtilsAp::ConfIdWepKey4, QString()); + + // Set configuration + wlanAp.setValue(WlanQtUtilsAp::ConfIdSsid, configuration(ConfSsid)); + wlanAp.setValue(WlanQtUtilsAp::ConfIdConnectionMode, + configuration(ConfNetworkMode)); + wlanAp.setValue(WlanQtUtilsAp::ConfIdSecurityMode, securityMode ); + wlanAp.setValue(WlanQtUtilsAp::ConfIdHidden, configuration(ConfHiddenWlan)); + + switch (securityMode) { + case CMManagerShim::WlanSecModeWep: + wlanAp.setValue(WlanQtUtilsAp::ConfIdWepKey1, configuration(ConfKeyWep1)); + wlanAp.setValue(WlanQtUtilsAp::ConfIdWepKey2, configuration(ConfKeyWep2)); + wlanAp.setValue(WlanQtUtilsAp::ConfIdWepKey3, configuration(ConfKeyWep3)); + wlanAp.setValue(WlanQtUtilsAp::ConfIdWepKey4, configuration(ConfKeyWep4)); + wlanAp.setValue( + WlanQtUtilsAp::ConfIdWepDefaultIndex, + configuration(ConfKeyWepDefault)); + break; + + case CMManagerShim::WlanSecModeWpa: + case CMManagerShim::WlanSecModeWpa2: + usePsk = configuration(ConfUsePsk).toBool(); + wlanAp.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, usePsk); + if (usePsk){ + wlanAp.setValue(WlanQtUtilsAp::ConfIdWpaPsk, configuration(ConfKeyWpa)); + } + break; + + default: + Q_ASSERT(securityMode == CMManagerShim::WlanSecModeOpen || + securityMode == CMManagerShim::WlanSecMode802_1x); + // No WLAN Specific configuration + break; + } + + // Create IAP if does not exists or update the existing IAP + int referenceId = configuration(ConfIapId).toInt(); + if (referenceId == WlanQtUtils::IapIdNone) { + OstTrace0( TRACE_FLOW, WLANWIZARDPRIVATE_HANDLEIAP_CREATE, + "WlanWizardPrivate::handleIap: Create IAP" ); + + referenceId = mWlanQtUtils->createIap(&wlanAp); + setConfiguration(ConfIapId, referenceId); + + if (referenceId == WlanQtUtils::IapIdNone) { + ret = false; + } + } else { + OstTrace0( TRACE_FLOW, WLANWIZARDPRIVATE_HANDLEIAP_UPDATE, + "WlanWizardPrivate::handleIap: Update IAP" ); + + ret = mWlanQtUtils->updateIap(referenceId, &wlanAp); + } + + if (ret) { + // Store Wizard plugin specific settings here. + WlanWizardPlugin* plugin = wlanWizardPlugin(); + if (plugin) { + OstTrace0( TRACE_FLOW, WLANWIZARDPRIVATE_HANDLEIAP_PLUGIN, + "WlanWizardPrivate::handleIap: Plugin" ); + // Plugin gets the IAP ID from configuration + ret = plugin->storeSettings(); + } + } + + OstTrace1( TRACE_FLOW, WLANWIZARDPRIVATE_HANDLEIAP_DONE, + "WlanWizardPrivate::handleIap: Done;ret=%d", + ret ); + + return ret; +} + +/*! + See WlanWizardHelper::configuration(). + */ +QVariant WlanWizardPrivate::configuration(ConfigurationId confId) const +{ + Q_ASSERT(mConfigurations.contains(confId)); + +#ifdef OST_TRACE_COMPILER_IN_USE + QString tmp; + QDebug tmpStream(&tmp); + tmpStream << mConfigurations[confId]; + TPtrC16 string( tmp.utf16(), tmp.length() ); + + OstTraceExt2( TRACE_NORMAL, WLANWIZARDPRIVATE_CONFIGURATIONS, + "WlanWizardPrivate::configuration;confId=%{ConfigurationId};string=%S", + (uint)confId, string ); +#endif + + return mConfigurations[confId]; +} + +/*! + See WlanWizardHelper::setConfiguration(). + */ +void WlanWizardPrivate::setConfiguration( + ConfigurationId confId, + const QVariant &value) +{ +#ifdef OST_TRACE_COMPILER_IN_USE + QString tmp; + QDebug tmpStream(&tmp); + tmpStream << value; + TPtrC16 string( tmp.utf16(), tmp.length() ); + + OstTraceExt2( TRACE_NORMAL, WLANWIZARDPRIVATE_SETCONFIGURATION, + "WlanWizardPrivate::setConfiguration;" + "confId=%{ConfigurationId};string=%S", + (uint)confId, string ); +#endif + + mConfigurations[confId] = value; +} + +/*! + * See WlanWizardHelper::clearConfiguration(). + */ +void WlanWizardPrivate::clearConfiguration(ConfigurationId confId) +{ + OstTrace1( TRACE_FLOW, WLANWIZARDPRIVATE_CLEARCONFIGURATION, + "WlanWizardPrivate::clearConfiguration;confId=%{ConfigurationId}", + (uint)confId ); + + mConfigurations.remove(confId); +} + +/*! + * See WlanWizardHelper::configurationExists(). + */ +bool WlanWizardPrivate::configurationExists(ConfigurationId confId) +{ + OstTrace1( TRACE_DUMP, WLANWIZARDPRIVATE_CONFIGURATIONEXISTS, + "WlanWizardPrivate::configurationExists;confId=%{ConfigurationId}", + (uint)confId ); + + return mConfigurations[confId].isValid(); +} + +/*! + See WlanWizardHelper::enableNextButton(). + */ +void WlanWizardPrivate::enableNextButton(bool enable) +{ + OstTraceExt2( TRACE_FLOW, WLANWIZARDPRIVATE_ENABLENEXTBUTTON, + "WlanWizardPrivate::enableNextButton;this=%x;enable=%x", + (unsigned)this, (uint)enable ); + mActionNext->setEnabled(enable); +} + +/*! + See WlanWizardHelper::addPage(). + */ +void WlanWizardPrivate::addPage(int pageId, WlanWizardPage *page) +{ + OstTraceExt3( TRACE_FLOW, WLANWIZARDPRIVATE_ADDPAGE, + "WlanWizardPrivate::addPage;this=%x;pageId=%{PageIds};page=%x", + (unsigned)this, pageId, (uint)(page) ); + + Q_ASSERT(!mPages.contains(pageId)); + mPages[pageId] = page; +} + +/*! + See WlanWizardHelper::nextPage(). + */ +void WlanWizardPrivate::nextPage() +{ + OstTrace1( TRACE_FLOW, WLANWIZARDPRIVATE_NEXTPAGE, + "WlanWizardPrivate::nextPage;this=%x", + this ); + + mPageFinished = true; + toNextPage(); +} + +/*! + See WlanWizardHelper::mainWindow(). + */ +HbMainWindow* WlanWizardPrivate::mainWindow() const +{ + return mMainWindow; +} + +/*! + See WlanWizardHelper::isCurrentPage(). + */ +bool WlanWizardPrivate::isCurrentPage(const HbWidget *page) const +{ + bool ret = false; + if (mStackedWidget->currentWidget() == page) { + ret = true; + } + + OstTraceExt2( TRACE_FLOW, WLANWIZARDPRIVATE_ISCURRENTPAGE, + "WlanWizardPrivate::isCurrentPage;page=%x;ret=%d", + (uint)page, ret); + + return ret; +} + +/*! + See WlanWizardHelper::nextPageId() + */ +int WlanWizardPrivate::nextPageId(bool useWps) +{ + int ret; + if (useWps) { + ret = WlanWizardPage::PageWpsStart; + } else { + int secMode = configuration(WlanWizardHelper::ConfSecurityMode).toInt(); + switch (secMode) { + case CMManagerShim::WlanSecModeWep: + ret = WlanWizardPageInternal::PageKeyQuery; + break; + + case CMManagerShim::WlanSecModeWpa: + case CMManagerShim::WlanSecModeWpa2: + if (configuration(WlanWizardHelper::ConfUsePsk).toBool()) { + ret = WlanWizardPageInternal::PageKeyQuery; + } else { + ret = WlanWizardPage::PageEapStart; + } + break; + + case CMManagerShim::WlanSecMode802_1x: + ret = WlanWizardPage::PageEapStart; + break; + + default: + Q_ASSERT( + secMode == CMManagerShim::WlanSecModeOpen || + secMode == CMManagerShim::WlanSecModeWapi); + + setConfiguration(ConfSecurityMode, CMManagerShim::WlanSecModeOpen); + ret = WlanWizardPageInternal::PageProcessSettings; + break; + } + } + + OstTraceExt3( TRACE_NORMAL, WLANWIZARDPRIVATE_NEXTPAGEID, + "WlanWizardPrivate::nextPageId;this=%x;useWps=%x;ret=%{PageIds}", + ( unsigned )this, ( TUint )( useWps ), ret ); + + return ret; +} + +/*! + Called when Cancel toolbar button is pressed. In case IAP has been created + it will be disconnected and the IAP settings are deleted and finally the + wizard is closed. + + Indicates also to the current wizard page that cancel has been pressed. + */ +void WlanWizardPrivate::cancelTriggered() +{ + OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_CANCELTRIGGERED, + "WlanWizardPrivate::cancelTriggered;this=%x", + this ); + + // Disconnect receiving more signals from any actions + disconnectActions(); + + mPageTimer->stop(); + + HbWidget *widget = qobject_cast(mStackedWidget->currentWidget()); + Q_ASSERT(widget); + mPageMapper[widget]->cancelTriggered(); + + int referenceId = configuration(ConfIapId).toInt(); + if (referenceId != WlanQtUtils::IapIdNone) { + // call disconnect even if + // - connection is not open + // - connection establishment is ongoing + mWlanQtUtils->disconnectIap(referenceId); + + // if IAP deletion fails, there is nothing we can do with it + mWlanQtUtils->deleteIap(referenceId); + setConfiguration(ConfIapId, WlanQtUtils::IapIdNone); + } + closeViews(); + Q_ASSERT(q_ptr); + + OstTrace0( TRACE_BORDER, WLANWIZARDPRIVATE_CANCELTRIGGERED_EMIT, + "WlanWizardPrivate::cancelTriggered - emit cancelled()" ); + + emit q_ptr->cancelled(); + + OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_CANCELTRIGGERED_DONE, + "WlanWizardPrivate::cancelTriggered - Done;this=%x", this ); +} + +/*! + Called when Previous toolbar button is pressed. Shows the previous wizard + page in stacked widget and indicates wizard page that previous has been + pressed. + */ +void WlanWizardPrivate::previousTriggered() +{ + OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_PREVIOUSTRIGGERED, + "WlanWizardPrivate::previousTriggered;this=%x", + this ); + + mPageTimer->stop(); + + int index = mStackedWidget->currentIndex(); + HbWidget *widget = qobject_cast(mStackedWidget->currentWidget()); + Q_ASSERT(widget); + int back = mPageMapper[widget]->previousTriggered(); + + // check that at least one page is left in the stack + Q_ASSERT( back < mStackedWidget->count()); + + // When a widget which is last in the stack is removed the currentindex + // is automatically updated. + for (int i = 0; i < back; ++i) { + mStackedWidget->removeAt(index - i); + } + + widget = qobject_cast (mStackedWidget->currentWidget()); + Q_ASSERT(widget); + WlanWizardPage* page = mPageMapper[widget]; + Q_ASSERT(page); + // In error case if page (value) is not found default contructed key is + // returned, in this case default value for int is 0 which means PageNone. + updateFrame(mPages.key(page)); + enableNextButton(page->showPage()); + + OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_PREVIOUSTRIGGERED_DONE, + "WlanWizardPrivate::previousTriggered - Done;this=%x", + this ); +} + +/*! + Next toolbar button has been pressed. Wizard framework asks from the current + page what should be the next page id and shows it. + */ +void WlanWizardPrivate::nextTriggered() +{ + OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_NEXTTRIGGERED, + "WlanWizardPrivate::nextTriggered;this=%x", + this ); + + mPageTimer->stop(); + + HbWidget *widget = qobject_cast(mStackedWidget->currentWidget()); + Q_ASSERT(widget); + + bool removeFromStack; + int pageId = mPageMapper[widget]->nextId(removeFromStack); + showPage(pageId, removeFromStack); + + OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_NEXTTRIGGERED_DONE, + "WlanWizardPrivate::nextTriggered - Done;this=%x", + this ); +} + +/*! + Finish button has been pressed. Closes the wizard and sends finished() + signal to the client. + */ +void WlanWizardPrivate::finishTriggered() +{ + OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_FINISHTRIGGERED, + "WlanWizardPrivate::finishTriggered;this=%x", + this ); + + // Disconnect receiving more signals from any actions + disconnectActions(); + + mPageTimer->stop(); + closeViews(); + + Q_ASSERT(q_ptr); + emit q_ptr->finished( + configuration(ConfIapId).toInt(), + configuration(ConfConnected).toBool()); + + OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_FINISHTRIGGERED_DONE, + "WlanWizardPrivate::finishTriggered - Done;this=%x", + this ); +} + +/*! + In case wizard page is using timer protection for the page, this is the + slot to handle the callback from the timer. + */ +void WlanWizardPrivate::onTimeOut() +{ + OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_ONTIMEOUT, + "WlanWizardPrivate::onTimeOut;this=%x", + this ); + + toNextPage(); + + OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_ONTIMEOUT_DONE, + "WlanWizardPrivate::onTimeOut - Done;this=%x", + this ); +} + +/*! + Slot to start wizard page operation asynchronous. Starts also the timer + to protect the wizard page. + */ +void WlanWizardPrivate::startPageOperation() +{ + // Process this if wizard has not been closed + if (mClosed == false) { + OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_STARTPAGEOPERATION, + "WlanWizardPrivate::startPageOperation;this=%x", + this ); + + HbWidget *widget = + qobject_cast(mStackedWidget->currentWidget()); + Q_ASSERT(widget); + mPageFinished = false; + mPageTimer->start(PageTimeout); + mPageMapper[widget]->startOperation(); + + OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_STARTPAGEOPERATION_DONE, + "WlanWizardPrivate::startPageOperation - DONE;this=%x", + this ); + } +} + +/*! + In case the wizard page uses timer protection this method determines when + the next page is shown. + */ +void WlanWizardPrivate::toNextPage() +{ + if (mPageFinished && !(mPageTimer->isActive())) { + OstTrace1( TRACE_FLOW, WLANWIZARDPRIVATE_TONEXTPAGE, + "WlanWizardPrivate::toNextPage;this=%x", + this ); + + // process this asynchronous. Main purpose is to release the current + // call stack and process the page change using new call stack + QMetaObject::invokeMethod(this, "nextTriggered", Qt::QueuedConnection); + } +} + +/*! + Show requested page and removes the current wizard page from the stack if + required. This method updates the title and toolbar accordingly. + + See WlanWizardPage::nextId() + + @param [in] pageId Wizard Page ID to be shown + @param [in] removeFromStack if true the current wizard page is removed from + the stackedwidget. + */ +void WlanWizardPrivate::showPage(int pageId, bool removeFromStack) +{ + OstTraceExt3( TRACE_FLOW, WLANWIZARDPRIVATE_SHOWPAGE, + "WlanWizardPrivate::showPage;this=%x;" + "pageId=%{PageIds};removeFromStack=%x", + ( unsigned )this, pageId, ( TUint )( removeFromStack ) ); + + // PageNone is returned by wizard pages when some validation of page content + // has not passed and the page does not want to process wizard to next page + if (pageId == WlanWizardPage::PageNone) { + return; + } + + // PageProcessSettings is shown only when WLAN AP is found in scanning + // 1/ when client calls setParameters() + // 2/ scanning page has found match with given SSID + if (pageId == WlanWizardPage::PageProcessSettings) { + if (configuration(ConfProcessSettings).toBool() == false) { + if (handleIap()){ + pageId = WlanWizardPageInternal::PageSummary; + } else { + pageId = WlanWizardPage::PageGenericError; + setConfiguration( + ConfGenericErrorString, + hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret")); + + setConfiguration( + ConfGenericErrorPageStepsBackwards, + WlanWizardPage::OneStepBackwards); + } + OstTraceExt2( TRACE_FLOW, WLANWIZARDPRIVATE_SHOWPAGE_UPDATE, + "WlanWizardPrivate::showPage - change page;this=%x;" + "pageId=%{PageIds}", + ( unsigned )this, pageId); + } + } + + // Create visualization of next page and store it to mappers + WlanWizardPage* page = mPages[pageId]; + Q_ASSERT(page); + HbWidget* widget = page->initializePage(); + Q_ASSERT(widget); + mPageMapper[widget] = page; + + // index calculation has to be happened before adding new widget into + // the stacked widget. Since the internal implementation of stackedwidget + // sets the first widget in the stack to current widget.. + // and when there are not any widgets in the stack the current index is + // -1. Valid index starts from 0. + int index = mStackedWidget->currentIndex(); + + if (removeFromStack) { + // widget is removed from the stacked widget, not deleted + mStackedWidget->removeAt(index); + } else { + index++; + } + mStackedWidget->addWidget(widget); + mStackedWidget->setCurrentIndex(index); + updateFrame(pageId); + enableNextButton(page->showPage()); + + // If wizard page needs to start some control operation trigger it + // asyncronously so that the UI gets more priority to get painted correctly + // before any operation takes place in wizard page. This is important for + // timer protected pages. Makes wizard to work smother from UI perspective + if (page->requiresStartOperation()) { + OstTrace0( TRACE_FLOW, WLANWIZARDPRIVATE_SHOWPAGE_INVOKE, + "WlanWizardPrivate::showPage - Invoke startOperation" ); + + QMetaObject::invokeMethod(this, "startPageOperation", Qt::QueuedConnection); + } +} + +/*! + Creates all control objects of WLAN wizard pages which are inherited from + WlanWizardPage and adds those into a internal database. + */ +void WlanWizardPrivate::createPages() +{ + OstTrace0( + TRACE_NORMAL, + WLANWIZARDPRIVATE_CREATEPAGES, + "WlanWizardPrivate::createPages"); + + addPage( + WlanWizardPageInternal::PageKeyQuery, + new WlanWizardPageKeyQuery(this)); + + addPage( + WlanWizardPageInternal::PageProcessSettings, + new WlanWizardPageProcessingSettings(this)); + + addPage( + WlanWizardPageInternal::PageSummary, + new WlanWizardPageSummary(this)); + + addPage( + WlanWizardPageInternal::PageGenericError, + new WlanWizardPageGenericError(this)); + + addPage( + WlanWizardPageInternal::PageSsid, + new WlanWizardPageSsid(this)); + + addPage( + WlanWizardPageInternal::PageScanning, + new WlanWizardPageScanning(this)); + + addPage( + WlanWizardPageInternal::PageNetworkMode, + new WlanWizardPageNetworkMode(this)); + + addPage( + WlanWizardPageInternal::PageNetworkSecurity, + new WlanWizardPageSecurityMode(this)); +} + +/*! + Called when wizard is closed + - cancelled by the user + - finished by the user + */ +void WlanWizardPrivate::closeViews() +{ + mDialog->hide(); + mClosed = true; +} + +/*! + This method takes care of the title of wizard and toolbutton. Correct items + are selected based on the \a pageId and the amount of objects in the stacked + widget. + + @param [in] pageId Wizard Page Id + */ +void WlanWizardPrivate::updateFrame(int pageId) +{ + int currentIndex = mStackedWidget->currentIndex(); + + OstTraceExt3( TRACE_FLOW, WLANWIZARDPRIVATE_UPDATEFRAME, + "WlanWizardPrivate::updateFrame;this=%x;pageId=%{PageIds};currentIndex=%d", + (unsigned)this, pageId, (uint)(currentIndex) ); + + // For last page (summary) show Finish instead of Next button + if (pageId == WlanWizardPageInternal::PageSummary) { + mTitle->setPlainText(hbTrId("txt_occ_title_wlan_setup_wizard_summary")); + mActionFinish->setVisible(true); + mActionNext->setVisible(false); + mActionPrevious->setVisible(false); + } else { + // Index starts from zero, wizard page numbering starts from one. + mTitle->setPlainText( + hbTrId("txt_occ_title_wlan_setup_wizard_step_l1").arg( + currentIndex + 1)); + mActionFinish->setVisible(false); + mActionNext->setVisible(true); + + // If first page is shown then Previous button is disabled + if (currentIndex < 1) { + mActionPrevious->setVisible(false); + } else { + mActionPrevious->setVisible(true); + if (pageId == WlanWizardPage::PageProcessSettings) { + mActionPrevious->setEnabled(false); + } else { + mActionPrevious->setEnabled(true); + } + } + } +} + +/*! + Loads widgets and objects from the docml file. + */ +void WlanWizardPrivate::loadDocml() +{ + bool ok = true; + + mDocLoader->load(":/docml/occ_wlan_wizard_main.docml", &ok); + Q_ASSERT(ok); + + mDialog.reset( qobject_cast (mDocLoader->findWidget("dialog")) ); + Q_ASSERT(mDialog != NULL); + + mTitle = qobject_cast (mDocLoader->findWidget("title")); + Q_ASSERT(mTitle != NULL); + + mStackedWidget = + qobject_cast (mDocLoader->findWidget("stackedWidget")); + Q_ASSERT(mStackedWidget != NULL); + + mActionNext = qobject_cast (mDocLoader->findObject("actionNext")); + Q_ASSERT(mActionNext != NULL); + + mActionPrevious = + qobject_cast (mDocLoader->findObject("actionPrevious")); + Q_ASSERT(mActionPrevious != NULL); + + mActionFinish = + qobject_cast (mDocLoader->findObject("actionFinish")); + Q_ASSERT(mActionFinish != NULL); + + mActionCancel = + qobject_cast (mDocLoader->findObject("actionCancel")); + Q_ASSERT(mActionCancel != NULL); + + // Actions are added from left to right to the toolbar of dialog + mDialog->addAction(mActionPrevious); + mDialog->addAction(mActionCancel); + mDialog->addAction(mActionNext); + mDialog->addAction(mActionFinish); + + // TODO: workaround to prevent action to close the dialog + disconnect(mActionPrevious, SIGNAL(triggered()), mDialog.data(), SLOT(close())); + disconnect(mActionCancel, SIGNAL(triggered()), mDialog.data(), SLOT(close())); + disconnect(mActionNext, SIGNAL(triggered()), mDialog.data(), SLOT(close())); + disconnect(mActionFinish, SIGNAL(triggered()), mDialog.data(), SLOT(close())); + + ok = true; + ok = connect(mPageTimer, SIGNAL(timeout()), this, SLOT(onTimeOut())); + Q_ASSERT(ok); + + ok = connect( + mActionNext, SIGNAL(triggered()), + this, SLOT(nextTriggered())); + Q_ASSERT(ok); + + ok = connect( + mActionPrevious, SIGNAL(triggered()), + this, SLOT(previousTriggered())); + Q_ASSERT(ok); + + ok = connect( + mActionFinish, SIGNAL(triggered()), + this, SLOT(finishTriggered())); + Q_ASSERT(ok); + + ok = connect( + mActionCancel, SIGNAL(triggered()), + this, SLOT(cancelTriggered())); + Q_ASSERT(ok); + + // TODO: workaround for full screen dialog, with docml it is possible to + // define fullscreen dialog, mut resize is not done correctly when orientation + // is changed. See TSW Error: MTAA-854DK8 + ok = HbStyleLoader::registerFilePath(":/css/custom.css"); + Q_ASSERT(ok); +} + +/*! + Disconnect receiving triggered() signal from any toolbar action. + */ +void WlanWizardPrivate::disconnectActions() +{ + disconnect( + mActionNext, SIGNAL(triggered()), + this, SLOT(nextTriggered())); + + disconnect( + mActionPrevious, SIGNAL(triggered()), + this, SLOT(previousTriggered())); + + disconnect( + mActionFinish, SIGNAL(triggered()), + this, SLOT(finishTriggered())); + + disconnect( + mActionCancel, SIGNAL(triggered()), + this, SLOT(cancelTriggered())); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/src/wlanwizardpagegenericerror.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/src/wlanwizardpagegenericerror.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WLAN Wizard Page: Generic error page. + * + */ + +// System includes +#include +#include +#include +#include + +// User includes +#include "wlanwizard_p.h" +#include "wlanwizardpagegenericerror.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanwizardpageprocessingsettingsTraces.h" +#endif + +/*! + \class WlanWizardPageGenericError + \brief Implements generic error page for wizard. + + Error text is read from the configurations + (WlanWizardHelper::ConfGenericErrorString) of the wizard. + */ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +/*! + Constructor. + + @param [in] parent pointer to private implementation of wizard. + */ +WlanWizardPageGenericError::WlanWizardPageGenericError( + WlanWizardPrivate* parent) : + WlanWizardPageInternal(parent), + mWidget(NULL), + mLabel(NULL) +{ +} + +/*! + Destructor. + */ +WlanWizardPageGenericError::~WlanWizardPageGenericError() +{ + // signals are automatically disconnected +} + +/*! + See WlanWizardPage::initializePage() + */ +HbWidget* WlanWizardPageGenericError::initializePage() +{ + // Create the visualization at the first time + if (!mWidget) { + HbDocumentLoader docLoader(mWizard->mainWindow()); + + bool ok; + docLoader.load(":/docml/occ_add_wlan_error.docml", &ok); + Q_ASSERT(ok); + + mWidget = qobject_cast (docLoader.findWidget("occ_add_wlan_error")); + Q_ASSERT(mWidget != NULL); + + mLabel = qobject_cast (docLoader.findWidget("dialog")); + Q_ASSERT(mLabel != NULL); + } + + // Get the error string from the wizards configurations + mLabel->setPlainText( + mWizard->configuration( + WlanWizardHelper::ConfGenericErrorString).toString()); + + return mWidget; +} + +/*! + See WlanWizardPage::showPage() + + @return false. Next button is dimmed when the page is displayed. + */ +bool WlanWizardPageGenericError::showPage() +{ + return false; +} + +/*! + See WlanWizardPage::previousTriggered() + + @return steps backwards + */ +int WlanWizardPageGenericError::previousTriggered() +{ + return mWizard->configuration( + WlanWizardHelper::ConfGenericErrorPageStepsBackwards).toInt(); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/src/wlanwizardpageinternal.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/src/wlanwizardpageinternal.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WLAN Wizard: Interface for wizard pages (wlan internal). + * + */ + +// System includes +#include +#include +#include + +// User includes +#include "wlanwizard_p.h" +#include "wlanwizardpageinternal.h" + +/*! + \class WlanWizardPageInternal + \brief Interface for internal wlan wizard pages. Contains pointer to private + implementation of wlan wizard. + */ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor + + @param [in] wizard pointer to private implementation of wizard + */ +WlanWizardPageInternal::WlanWizardPageInternal(WlanWizardPrivate *wizard) : + QObject(wizard), + mWizard(wizard) +{ +} + +/*! + Destructor. + */ +WlanWizardPageInternal::~WlanWizardPageInternal() +{ +} + + +/*! + Loads requested section from given docml file. + + @param [in] loader Document loader for docml + @param [in] orientation Orientation to be loaded + @param [in] filename the name of docml filename + @param [in] portraitSection the name of section to be loaded in portrait mode + @param [in] landscapeSection the name of section to be loaded in landscape mode + */ +void WlanWizardPageInternal::loadDocmlSection( + HbDocumentLoader *loader, + Qt::Orientation orientation, + const QString &filename, + const QString &portraitSection, + const QString &landscapeSection) const +{ + bool ok; + + // Then load the orientation specific section + if (orientation == Qt::Horizontal) { + loader->load(filename, landscapeSection, &ok); + Q_ASSERT(ok); + } else { + Q_ASSERT(orientation == Qt::Vertical); + loader->load(filename, portraitSection, &ok); + Q_ASSERT(ok); + } +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/src/wlanwizardpagekeyquery.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/src/wlanwizardpagekeyquery.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,263 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WLAN Wizard Page: Key query page for WEP and WPA (2). + * + */ + +// System includes +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "wlanwizard.h" +#include "wlanwizard_p.h" +#include "wlanwizardpagekeyquery.h" +#include "wlanwizardutils.h" + +/*! + \class WlanWizardPageKeyQuery + \brief Implements Key Query page for WEP and WPA. + */ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +/*! + Constructor. + + @param [in] parent pointer to private implementation of wizard. + */ +WlanWizardPageKeyQuery::WlanWizardPageKeyQuery(WlanWizardPrivate* parent) : + WlanWizardPageInternal(parent), + mWidget(NULL), + mLabelTitle(NULL), + mLineEdit(NULL), + mLabelError(NULL), + mDocLoader(NULL) +{ +} + +/*! + Destructor. + */ +WlanWizardPageKeyQuery::~WlanWizardPageKeyQuery() +{ + delete mDocLoader; + + // Wizard framework deletes the visualization (owns mWidget). +} + +/*! + See WlanWizardPage::initializePage() + + Initializes the key query page and initializes objects based on the security + mode. + */ +HbWidget* WlanWizardPageKeyQuery::initializePage() +{ + if (!mWidget) { + bool ok; + + mDocLoader = new HbDocumentLoader(mWizard->mainWindow()); + + // Load document common part + mDocLoader->load(":/docml/occ_add_wlan_01_04.docml", &ok); + Q_ASSERT(ok); + + // Initialize orientation + loadDocmlSection(mWizard->mainWindow()->orientation()); + + // Load widgets + mWidget = + qobject_cast (mDocLoader->findWidget("occ_add_wlan_01")); + Q_ASSERT(mWidget != NULL); + + mLabelTitle = qobject_cast (mDocLoader->findWidget("dialog")); + Q_ASSERT(mLabelTitle != NULL); + + mLineEdit = qobject_cast (mDocLoader->findWidget("lineEditKey")); + Q_ASSERT(mLineEdit != NULL); + + mLabelError = + qobject_cast (mDocLoader->findWidget("labelErrorNote")); + Q_ASSERT(mLabelError != NULL); + + ok = connect( + mWizard->mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)), + this, SLOT(loadDocmlSection(Qt::Orientation))); + Q_ASSERT(ok); + + HbEditorInterface editInterface(mLineEdit); + editInterface.setInputConstraints(HbEditorConstraintLatinAlphabetOnly); + editInterface.setSmileyTheme(HbSmileyTheme()); + mLineEdit->setInputMethodHints( + Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase); + mLineEdit->installEventFilter(this); + } + + if (mWizard->configuration(WlanWizardHelper::ConfSecurityMode) == + CMManagerShim::WlanSecModeWep) { + mLineEdit->setMaxLength(WlanWizardUtils::WepHex128BitMaxLength); + } else { + mLineEdit->setMaxLength(WlanWizardUtils::WpaMaxLength); + } + + mLabelTitle->setPlainText( + HbParameterLengthLimiter( + hbTrId("txt_occ_dialog_enter_key_for_1")).arg( + mWizard->configuration(WlanWizardPrivate::ConfSsid).toString())); + + return mWidget; +} + +/*! + Loads docml at initialization phase and when HbMainWindow sends orientation() + signal. + + @param [in] orientation to be loaded. + */ +void WlanWizardPageKeyQuery::loadDocmlSection(Qt::Orientation orientation) +{ + WlanWizardPageInternal::loadDocmlSection( + mDocLoader, + orientation, + ":/docml/occ_add_wlan_01_04.docml", + "portrait_section", + "landscape_section"); +} + +/*! + See WlanWizardPage::nextId() + + @param [in,out] removeFromStack return value is always false + + @return In case user has entered incorrect key an appropriate error text is + displayed and WlanWizardPage::PageNone is returned. + + In case user has entered a valid WEP or WPA key, the key is stored into + internal configuration and WlanWizardPage::PageProcessSettings is returned. + + */ +int WlanWizardPageKeyQuery::nextId(bool &removeFromStack) const +{ + WlanWizardUtils::KeyStatus status(WlanWizardUtils::KeyStatusOk); + int pageId = WlanWizardPage::nextId(removeFromStack); + int secMode = mWizard->configuration( + WlanWizardPrivate::ConfSecurityMode).toInt(); + + if (secMode == CMManagerShim::WlanSecModeWep) { + status = WlanWizardUtils::validateWepKey(mLineEdit->text()); + } + else { + Q_ASSERT( + secMode == CMManagerShim::WlanSecModeWpa || + secMode == CMManagerShim::WlanSecModeWpa2); + + status = WlanWizardUtils::validateWpaKey(mLineEdit->text()); + } + QString errorString = keyStatusToErrorString(status); + + if (errorString.length() == 0 ) { + if (secMode == CMManagerShim::WlanSecModeWep) { + mWizard->setConfiguration(WlanWizardPrivate::ConfKeyWep1, mLineEdit->text()); + mWizard->setConfiguration(WlanWizardPrivate::ConfKeyWep2, mLineEdit->text()); + mWizard->setConfiguration(WlanWizardPrivate::ConfKeyWep3, mLineEdit->text()); + mWizard->setConfiguration(WlanWizardPrivate::ConfKeyWep4, mLineEdit->text()); + mWizard->setConfiguration(WlanWizardPrivate::ConfKeyWepDefault, + CMManagerShim::WepKeyIndex1); + } else { + mWizard->setConfiguration(WlanWizardPrivate::ConfKeyWpa, mLineEdit->text()); + } + pageId = WlanWizardPage::PageProcessSettings; + } + else { + mLabelError->setPlainText(errorString); + } + + removeFromStack = false; + return pageId; +} + +/*! + See WlanWizardPage::showPage() + */ +bool WlanWizardPageKeyQuery::showPage() +{ + // Open virtual keyboard by setting focus to line edit + mLineEdit->setFocus(); + + return true; +} + +/*! + When focus moves into the Key editor and there is visible error text, it + is cleared. + + @param [in] obj Pointer to the object the event was sent to + @param [in] event Pointer to the sent event. + + @return false. do not eat the event. + */ +bool WlanWizardPageKeyQuery::eventFilter(QObject *obj, QEvent *event) +{ + if (obj == mLineEdit && event->type() == QEvent::FocusIn) { + mLabelError->setPlainText(""); + } + return false; +} + +/*! + Maps provided error code to error text. + + @param [in] status status of key validation + + @return An error text in case of error, empty string is returned on + successful case. + */ +QString WlanWizardPageKeyQuery::keyStatusToErrorString( + WlanWizardUtils::KeyStatus status) const +{ + QString errorString; + switch (status) { + case WlanWizardUtils::KeyStatusIllegalCharacters: + errorString = hbTrId("txt_occ_dialog_illegal_characters_in_key_please_c"); + break; + + case WlanWizardUtils::KeyStatusWpaTooShort: + errorString = hbTrId("txt_occ_dialog_preshared_key_too_short_at_least"); + break; + + case WlanWizardUtils::KeyStatusWepInvalidLength: + errorString = hbTrId("txt_occ_dialog_key_is_of_incorrect_length_please"); + break; + + default: + Q_ASSERT(WlanWizardUtils::KeyStatusOk == status); + // nothing to do here. + break; + } + return errorString; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/src/wlanwizardpagenetworkmode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/src/wlanwizardpagenetworkmode.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,270 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WLAN Wizard Page: Network mode Selection. + * + */ + +// System includes +#include +#include +#include +#include +#include +#include + +// User includes +#include "wlanwizard_p.h" +#include "wlanwizard.h" +#include "wlanwizardpagenetworkmode.h" +#include "wlanwizardscanlist.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanwizardpagenetworkmodeTraces.h" +#endif + +// Local constants + +/*! + * Constructor method for the network mode view object + * @param parent [in] pointer to parent object. + */ +WlanWizardPageNetworkMode::WlanWizardPageNetworkMode( + WlanWizardPrivate* parent) : + WlanWizardPageInternal(parent), + mWidget(NULL), + mList(NULL), + mLabel(NULL), + mLoader(NULL), + mValid(false) +{ +} + +/*! + * Destructor. Loader widget is deleted. + * All document widgets are deleted by wlanwizard_p destructor. + */ +WlanWizardPageNetworkMode::~WlanWizardPageNetworkMode() +{ + delete mLoader; +} + +/*! + * Page initialization. If view is already loaded, does nothing. + * Inherited from WlanWizardPage. + */ +HbWidget* WlanWizardPageNetworkMode::initializePage() +{ + OstTrace0( TRACE_NORMAL, WLANWIZARDPAGENETWORKMODE_INITIALIZEPAGE, + "WlanWizardPageNetworkMode::initializePage" ); + + if (mWidget == NULL) { + mLoader = new HbDocumentLoader(mWizard->mainWindow()); + + bool ok; + + mLoader->load(":/docml/occ_add_wlan_02_03.docml", &ok); + Q_ASSERT(ok); + + loadDocmlSection(mWizard->mainWindow()->orientation()); + + mWidget = qobject_cast (mLoader->findWidget( + "occ_add_wlan_02")); + Q_ASSERT(mWidget != NULL); + + mList = qobject_cast (mLoader->findWidget("list")); + Q_ASSERT(mList != NULL); + + mLabel = qobject_cast (mLoader->findWidget("dialog_6")); + Q_ASSERT(mLabel != NULL); + + // Connect document loading to main window orientation changes. + ok = connect(mWizard->mainWindow(), + SIGNAL(orientationChanged(Qt::Orientation)), this, + SLOT(loadDocmlSection(Qt::Orientation))); + Q_ASSERT(ok); + + // Connect a function to a radio button selection. + ok = connect(mList, SIGNAL(itemSelected(int)), this, + SLOT(itemSelected())); + Q_ASSERT(ok); + + mLabel->setPlainText(hbTrId( + "txt_occ_dialog_select_network_mode_and_status")); + } + + QStringList items; + + populateRadioButtonList(items); + + mList->setItems(items); + + return mWidget; +} + +/*! + * Evaluates the network mode selection and sets the configuration in + * the wlanwizard. + * @param [out] removeFromStack always returns false. + * @return WlanWizardPageSecurityMode page id. + */ +int WlanWizardPageNetworkMode::nextId(bool &removeFromStack) const +{ + removeFromStack = false; + WlanNetworkSetting setting; + setting.mode = mNetworkModes.at(mList->selected()); + setting.hidden = mIsHidden.at(mList->selected()); + + // TODO: Still no wps handling. + setting.wpsSupported = false; + + mWizard->setConfiguration(WlanWizardPrivate::ConfNetworkMode, + setting.mode); + + mWizard->setConfiguration(WlanWizardPrivate::ConfHiddenWlan, + setting.hidden); + + if (mWizard->configurationExists(WlanWizardPrivate::ConfAvailableNetworkOptions)) { + return selectNextPage(setting); + } + + return WlanWizardPageInternal::PageNetworkSecurity; +} + +/*! + * This method is overrides the default implementation from WlanWizardPage. + * It indicates whether the Next-button should be enabled or not. + * @return mValid, which is true if a radio button has been selected. + */ +bool WlanWizardPageNetworkMode::showPage() +{ + return mValid; +} + +/*! + * This function is invoked when user selects a mode from the radio button list. + * (HbRadioButtonList's itemSelected-signal) + */ +void WlanWizardPageNetworkMode::itemSelected() +{ + OstTrace0( TRACE_BORDER, WLANWIZARDPAGENETWORKMODE_ITEMSELECTED, + "WlanWizardPageNetworkMode::itemSelected" ); + + mValid = true; + mWizard->enableNextButton(mValid); +} + +/*! + * Loads the document orientation information from occ_add_wlan_02_03.docml. + * This is called each time phone orientation changes. + * @param [in] orientation indicates whether the phone is in portrait or + * landscape mode. + */ +void WlanWizardPageNetworkMode::loadDocmlSection(Qt::Orientation orientation) +{ + OstTrace1( TRACE_NORMAL, WLANWIZARDPAGENETWORKMODE_LOADDOCML, + "WlanWizardPageNetworkMode::loadDocml - Orientation;orientation=%x", + ( TUint )( orientation ) ); + + WlanWizardPageInternal::loadDocmlSection( + mLoader, + orientation, + ":/docml/occ_add_wlan_02_03.docml", + "portrait_section", + "landscape_section"); +} + +/*! + * A support function to map the radio button list to a generic network + * mode list. This enables the changing of button order without it + * affecting the entire class. + * In case previous scan has revealed multiple results with the same ssid, only + * available network mode options are shown in the radio button list. + * @param [out] list is the list of captions used for the radio buttons. + * @param [in] item is the caption to be added. + * @param [in] mode is the network mode to be added. + * @param [in] isHidden is the visibility status of the network. + */ +void WlanWizardPageNetworkMode::addToList(QStringList &list, + const QString &item, int mode, bool isHidden) +{ + + if (mWizard->configurationExists(WlanWizardHelper::ConfAvailableNetworkOptions)) { + WlanWizardScanList networkOptions = mWizard->configuration( + WlanWizardHelper::ConfAvailableNetworkOptions).value (); + + QList modes = networkOptions.getNetModes(); + + for (int i = 0; i < modes.size(); i++) { + if (modes[i].mode == mode && modes[i].hidden == isHidden) { + list << item; + mNetworkModes.append(mode); + mIsHidden.append(isHidden); + } + } + } + else { + list << item; + mNetworkModes.append(mode); + mIsHidden.append(isHidden); + } +} + +/*! + * This function checks the sets up the radio button list for user input. + * @param [out] list is the list of captions used for the radio buttons. + */ +void WlanWizardPageNetworkMode::populateRadioButtonList(QStringList &list) +{ + list.clear(); + mNetworkModes.clear(); + mIsHidden.clear(); + + // A list is created. Since there is no practical way of knowing whether + // the new contents are different from the previous contents (if there + // even were any in the first place) the validity is always reset. + mValid = false; + + addToList(list, hbTrId("txt_occ_dblist_val_infrastructure_public"), + CMManagerShim::Infra, false); + + addToList(list, hbTrId("txt_occ_list_infrastructure_hidden"), + CMManagerShim::Infra, true); + + addToList(list, hbTrId("txt_occ_list_adhoc_1"), CMManagerShim::Adhoc, + false); +} + +/*! + * This function selects the next page. Security mode may be skipped in case + * scan results exist and only single option remains. + * @param [in] setting indicates the selected network mode. + * @return Security mode query page identifier unless it can be skipped. + */ +int WlanWizardPageNetworkMode::selectNextPage(const WlanNetworkSetting &setting) const +{ + WlanWizardScanList networkOptions = mWizard->configuration( + WlanWizardHelper::ConfAvailableNetworkOptions).value(); + + if (networkOptions.secModes(setting) == SingleResult) { + WlanSecuritySetting secMode = networkOptions.getSecMode(setting); + + mWizard->setConfiguration(WlanWizardHelper::ConfSecurityMode, secMode.mode); + mWizard->setConfiguration(WlanWizardHelper::ConfUsePsk, secMode.usePsk); + return secMode.nextPageId; + } + + return WlanWizardPageInternal::PageNetworkSecurity; +} + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/src/wlanwizardpageprocessingsettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/src/wlanwizardpageprocessingsettings.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,350 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Wizard Page: Processing settings, connection and running ict. +*/ + +// System includes +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "wlanwizardplugin.h" +#include "wlanqtutils.h" +#include "wlanwizard_p.h" +#include "wlanwizardpageprocessingsettings.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanwizardpageprocessingsettingsTraces.h" +#endif + +/*! + \class WlanWizardPageProcessingSettings + \brief Implements Processing settings wizard page. + + In this page + - possible wizard plugin settings are stored + - connection to the wlan ap is established + - ICT (Internet connectivity test) is run + */ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +/*! + Constructor. + + @param [in] parent pointer to private implementation of wizard. + */ +WlanWizardPageProcessingSettings::WlanWizardPageProcessingSettings( + WlanWizardPrivate* parent) : + WlanWizardPageInternal(parent), + mDocLoader(NULL), + mWidget(NULL), + mLabel(NULL), + mNextPageId(WlanWizardPageInternal::PageSummary) +{ + WlanQtUtils* utils = mWizard->wlanQtUtils(); + + bool ok; + ok = connect( + utils, + SIGNAL(wlanNetworkOpened(int)), + this, + SLOT(wlanNetworkOpened(int))); + Q_ASSERT(ok); + + ok = connect( + utils, + SIGNAL(wlanNetworkClosed(int,int)), + this, + SLOT(wlanNetworkClosed(int,int))); + Q_ASSERT(ok); + + ok = connect( + utils, + SIGNAL(ictResult(int,int)), + this, + SLOT(ictResult(int,int))); + Q_ASSERT(ok); + + Q_UNUSED(ok); + Q_ASSERT(ok); +} + +/*! + Destructor. + */ +WlanWizardPageProcessingSettings::~WlanWizardPageProcessingSettings() +{ + // signals are automatically disconnected + delete mDocLoader; + + // Wizard framework deletes the visualization (owns mWidget). +} + +/*! + See WlanWizardPage::initializePage() + */ +HbWidget* WlanWizardPageProcessingSettings::initializePage() +{ + if (!mWidget) { + mDocLoader = new HbDocumentLoader(mWizard->mainWindow()); + + bool ok; + mDocLoader->load(":/docml/occ_add_wlan_06.docml", &ok); + Q_ASSERT(ok); + loadDocmlSection(mWizard->mainWindow()->orientation()); + + mWidget = qobject_cast (mDocLoader->findWidget("occ_add_wlan_06")); + Q_ASSERT(mWidget != NULL); + + mLabel = qobject_cast (mDocLoader->findWidget("dialog")); + Q_ASSERT(mLabel != NULL); + + ok = connect( + mWizard->mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)), + this, SLOT(loadDocmlSection(Qt::Orientation))); + Q_ASSERT(ok); + } + + mLabel->setPlainText( + HbParameterLengthLimiter( + hbTrId("txt_occ_dialog_checking_connection_to_1")).arg( + mWizard->configuration(WlanWizardPrivate::ConfSsid).toString())); + + return mWidget; +} + +/*! + See WlanWizardPage::nextId() + + @param [out] removeFromStack return value is always true + + @return WlanWizardPageInternal::PageSummary + */ +int WlanWizardPageProcessingSettings::nextId(bool &removeFromStack) const +{ + removeFromStack = true; + return mNextPageId; +} + + +/*! + See WlanWizardPage::showPage() + + @return false. Next button is dimmed when the page is displayed. + */ +bool WlanWizardPageProcessingSettings::showPage() +{ + return false; +} + +/*! + Loads docml at initialization phase and when HbMainWindow sends orientation() + signal. + + @param [in] orientation to be loaded. + */ +void WlanWizardPageProcessingSettings::loadDocmlSection(Qt::Orientation orientation) +{ + WlanWizardPageInternal::loadDocmlSection( + mDocLoader, + orientation, + ":/docml/occ_add_wlan_06.docml", + "portrait_section", + "landscape_section"); +} + +/*! + This method is connected to WlanQtUtils::wlanNetworkClosed(int, int) signal. + to get disconnected status events of currently established connection. + + In case of failure, movement to generic error page is triggered. + + @param [in] iapId IAP ID + @param [in] reason Symbian Error code. + */ +void WlanWizardPageProcessingSettings::wlanNetworkClosed(int iapId, int reason) +{ + OstTraceExt2( TRACE_BORDER, + WLANWIZARDPAGEPROCESSINGSETTINGS_WLANNETWORKCLOSED, + "WlanWizardPageProcessingSettings::wlanNetworkClosed;iapId=%d;reason=%d", + iapId, reason ); + + if (iapId != mWizard->configuration(WlanWizardHelper::ConfIapId).toInt()) { + return; + } + + mWizard->setConfiguration(WlanWizardPrivate::ConfIctStatus, false); + mWizard->setConfiguration(WlanWizardPrivate::ConfConnected, false); + + if (mWizard->isCurrentPage(mWidget)) { + QString errorText; + switch (reason) { + case KErrWlanOpenAuthFailed: + case KErrWlanSharedKeyAuthRequired: + case KErrWlanWpaAuthRequired: + case KErrWlanWpaAuthFailed: + case KErrWlan802dot1xAuthFailed: + case KErrWlanIllegalEncryptionKeys: + case KErrWlanPskModeRequired: + case KErrWlanEapModeRequired: + errorText = hbTrId("txt_occ_dialog_authentication_unsuccessful"); + break; + + case KErrWlanIllegalWpaPskKey: + errorText = hbTrId("txt_occ_dialog_incorrect_wpa_preshared_key_pleas"); + break; + + case KErrWlanSharedKeyAuthFailed: + errorText = hbTrId("txt_occ_dialog_incorrect_wep_key_please_check_the"); + break; + + default: + // Handles also KErrNone + // Get plugin specific localized error text if any + WlanWizardPlugin *plugin = mWizard->wlanWizardPlugin(); + + if (plugin){ + errorText = plugin->errorString(reason); + } + if (errorText.length() == 0) { + errorText = hbTrId("txt_occ_dialog_connection_failed"); + } + break; + } + mNextPageId = WlanWizardPageInternal::PageGenericError; + mWizard->setConfiguration( + WlanWizardHelper::ConfGenericErrorString, errorText); + + mWizard->setConfiguration( + WlanWizardHelper::ConfGenericErrorPageStepsBackwards, + WlanWizardPage::OneStepBackwards); + + mWizard->nextPage(); + } + + OstTrace0( + TRACE_BORDER, WLANWIZARDPAGEPROCESSINGSETTINGS_WLANNETWORKCLOSED_DONE, + "WlanWizardPageProcessingSettings::wlanNetworkClosed - Done" ); +} + +/*! + Handles ictResult(int, bool) signal from WlanQtUtils and calls + WlanWizardHelper::nextPage() to trigger movement to next page. + + @param [in] iapId IAP ID + @param [in] reason ICT result, Symbian error code + */ +void WlanWizardPageProcessingSettings::ictResult(int iapId, int reason) +{ + OstTraceExt2( + TRACE_BORDER, + WLANWIZARDPAGEPROCESSINGSETTINGS_ICTRESULT, + "WlanWizardPageProcessingSettings::ictResult;iapId=%d;result=%d", + iapId, reason ); + + if (iapId != mWizard->configuration(WlanWizardHelper::ConfIapId).toInt()) { + return; + } + + // Cast of result . + WlanQtUtils::IctStatus status = + static_cast(reason); + + if(status == WlanQtUtils::IctCancelled) { + + mNextPageId = WlanWizardPageInternal::PageNone; + mWizard->cancelTriggered(); + } + else { + mWizard->setConfiguration(WlanWizardPrivate::ConfConnected, true); + } + mWizard->setConfiguration(WlanWizardPrivate::ConfIctStatus, status); + + mWizard->nextPage(); + + OstTrace0( TRACE_BORDER, WLANWIZARDPAGEPROCESSINGSETTINGS_ICTRESULT_DONE, + "WlanWizardPageProcessingSettings::ictResult - Done" ); +} + +/*! + Handles wlanNetworkOpened(int) signal from WlanQtUtils. + + @param [in] iapId IAP ID + */ +void WlanWizardPageProcessingSettings::wlanNetworkOpened(int iapId) +{ + Q_UNUSED(iapId); + OstTrace1( + TRACE_BORDER, + WLANWIZARDPAGEPROCESSINGSETTINGS_WLANNETWORKOPENED, + "WlanWizardPageProcessingSettings::wlanNetworkOpened;iapId=%d", + iapId); +} + +/*! + See WlanWizardPage::requiresStartOperation(). + + Indicates to framework that startOperation() needs to called. + */ +bool WlanWizardPageProcessingSettings::requiresStartOperation() +{ + return true; +} + +/*! + See WlanWizardPage::startOperation(). + + Starts the page operation. + */ +void WlanWizardPageProcessingSettings::startOperation() +{ + if (mWizard->handleIap()) { + mNextPageId = WlanWizardPageInternal::PageSummary; + + // in case wlan connection is already established disconnect it + // note that connectIap() disconnects implicitly connection when + // same IAP is already connected. + WlanQtUtils* utils = mWizard->wlanQtUtils(); + int connectedIapId = utils->activeIap(); + int iapId = mWizard->configuration(WlanWizardHelper::ConfIapId).toInt(); + if (connectedIapId != iapId){ + utils->disconnectIap(connectedIapId); + } + mWizard->wlanQtUtils()->connectIap( iapId, true); + } else { + mNextPageId = WlanWizardPageInternal::PageGenericError; + mWizard->setConfiguration( + WlanWizardHelper::ConfGenericErrorString, + hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret")); + + mWizard->setConfiguration( + WlanWizardHelper::ConfGenericErrorPageStepsBackwards, + WlanWizardPage::OneStepBackwards); + mWizard->nextPage(); + } +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/src/wlanwizardpagescanning.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/src/wlanwizardpagescanning.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,475 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Wizard Page: Scan processing. +*/ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "wlanwizard_p.h" +#include "wlanwizardpagescanning.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanwizardpagescanningTraces.h" +#endif + +// Local constants + +/*! + * Constructor method for the scanning view object. + * @param [in] parent pointer to parent object. + */ +WlanWizardPageScanning::WlanWizardPageScanning(WlanWizardPrivate* parent) : + WlanWizardPageInternal(parent), + mWidget(NULL), + mLabel(NULL), + mLoader(NULL), + mNextPageId(WlanWizardPage::PageNone), + mScanResultsAvailable(false), + mScanStatus(WlanQtUtils::ScanStatusOk) +{ + WlanQtUtils* utils = mWizard->wlanQtUtils(); + + // Connect normal scan completion signal from wlanQtUtils to result + // handler. Connect here instead of initializePage, since this signal may + // need to be caught event if the window is not active. + bool ok = connect( + utils, + SIGNAL(wlanScanApReady(int)), + this, + SLOT(wlanScanResultPreCheck(int))); + + Q_ASSERT(ok); +} + +/*! + * Destructor. Loader widget is deleted. + * All document widgets are deleted by wlanwizard_p destructor. + */ +WlanWizardPageScanning::~WlanWizardPageScanning() +{ + delete mLoader; +} + +/*! + * Page initialization. If view is already loaded, does nothing. Inherited from + * WlanWizardPage. + * @return pointer to widget "occ_add_wlan_06". + */ +HbWidget* WlanWizardPageScanning::initializePage() +{ + OstTrace0( + TRACE_NORMAL, + WLANWIZARDPAGESCANNING_INITIALIZEPAGE, + "WlanWizardPageScanning::initializePage"); + + // Next page id is reset with each initialization. + mNextPageId = WlanWizardPage::PageNone; + + if (mWidget == NULL) { + mLoader = new HbDocumentLoader(mWizard->mainWindow()); + + bool ok; + + mLoader->load(":/docml/occ_add_wlan_06.docml", &ok); + Q_ASSERT(ok); + + // Initialize orientation + loadDocmlSection(mWizard->mainWindow()->orientation()); + + // Load widgets + mWidget = qobject_cast (mLoader->findWidget( + "occ_add_wlan_06")); + Q_ASSERT(mWidget != NULL); + + mLabel = qobject_cast (mLoader->findWidget("dialog")); + Q_ASSERT(mLabel != NULL); + + WlanQtUtils* utils = mWizard->wlanQtUtils(); + + // Connect orientation signal from the main window to orientation + // loader. + ok = connect( + mWizard->mainWindow(), + SIGNAL(orientationChanged(Qt::Orientation)), + this, + SLOT(loadDocmlSection(Qt::Orientation))); + Q_ASSERT(ok); + + // Connect direct scan completion signal from wlanQtUtils to result + // handler. + ok = connect( + utils, + SIGNAL(wlanScanDirectReady(int)), + this, + SLOT(wlanScanDirectReady(int))); + Q_ASSERT(ok); + } + + mLabel->setPlainText(HbParameterLengthLimiter( + hbTrId("txt_occ_dialog_searching")).arg(mWizard->configuration( + WlanWizardPrivate::ConfSsid).toString())); + + + return mWidget; +} + +/*! + * Sends the user to the next page. + * @param [out] removeFromStack is always true: this page is removed from the + * stacked widget after "Next" button is pressed. + * @return the id value of the next page. + */ +int WlanWizardPageScanning::nextId(bool &removeFromStack) const +{ + removeFromStack = true; + + return mNextPageId; +} + +/*! + * This function reimplements WlanWizardPage::previousTriggered. When going + * back from scanning view, the ongoing scan operation is also stopped. Since + * there is no need to react to following the acknowledgement signal from + * wlanQtUtils, the corresponding handler slots are disconnected before the + * opration and immediately connected again. + * @return one step backwards value. + */ +int WlanWizardPageScanning::previousTriggered() +{ + disconnect(this, SLOT(wlanScanDirectReady(int))); + disconnect(this, SLOT(wlanScanResultPreCheck(int))); + + WlanQtUtils* utils = mWizard->wlanQtUtils(); + + utils->stopWlanScan(); + + bool ok = connect( + utils, + SIGNAL(wlanScanApReady(int)), + this, + SLOT(wlanScanResultPreCheck(int))); + Q_ASSERT(ok); + + ok = connect( + utils, + SIGNAL(wlanScanDirectReady(int)), + this, + SLOT(wlanScanDirectReady(int))); + Q_ASSERT(ok); + + return OneStepBackwards; + +} + +/*! + * This method is overrides the default implementation from WlanWizardPage. + * It indicates whether the Next-button should be enabled or not. It also resets + * the ConfProcessSettings-configuration to false - meaning that if no scan + * results are available, no iap is created. + * @return always false - the scanning proceeds to next window + * automatically or not at all. + */ +bool WlanWizardPageScanning::showPage() +{ + mWizard->setConfiguration(WlanWizardHelper::ConfProcessSettings, false); + return false; +} + +/*! + * Reimplements the default function in WlanWizardPage. Indicates to the + * framework that startOperation() function must be executed. + * @return true + * @see WlanWizardPage + */ +bool WlanWizardPageScanning::requiresStartOperation() +{ + return true; +} + +/*! + * Wlan scan is performed as a "post-initialization" which is executed in a + * separate scheduler loop. If scan results are available, starts reading them. + */ +void WlanWizardPageScanning::startOperation() +{ + OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_STARTOPERATION, + "WlanWizardPageScanning::startOperation - start AP scan if results" + " are available." ); + + if (mScanResultsAvailable) { + mScanResultsAvailable = false; + wlanScanApReady(); + } +} + +/*! + * Loads the document orientation information from occ_add_wlan_06.docml + * This is called each time phone orientation changes. + * @param [in] orientation indicates whether the phone is in portrait or + * landscape mode. + */ +void WlanWizardPageScanning::loadDocmlSection(Qt::Orientation orientation) +{ + OstTrace1( TRACE_NORMAL, WLANWIZARDPAGESCANNING_LOADDOCML, + "WlanWizardPageScanning::loadDocml - orientation ;orientation=%x", + ( TUint )( orientation ) ); + + WlanWizardPageInternal::loadDocmlSection( + mLoader, + orientation, + ":/docml/occ_add_wlan_06.docml", + "portrait_section", + "landscape_section"); +} + +/*! + * Checks whether the view is active. If it is, execute wlanScanApReady. If + * not, set mScanResultsAvailable to true. + * @param [in] scanStatus indicates whether the scan was succesful, cancelled of + * failed. The argument is saved to a member variable. + */ +void WlanWizardPageScanning::wlanScanResultPreCheck(int scanStatus) +{ + mScanStatus = scanStatus; + + if (!mWidget) { + OstTrace1( TRACE_BORDER, WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK, + "WlanWizardPageScanning::wlanScanResultPreCheck no widget;this=%x", + this ); + + mScanResultsAvailable = true; + } else { + if (mWizard->isCurrentPage(mWidget)) { + OstTrace0( TRACE_BORDER, + DUP1_WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK, + "WlanWizardPageScanning::wlanScanResultPreCheck go to results"); + + wlanScanApReady(); + } else { + OstTrace0( TRACE_BORDER, + DUP2_WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK, + "WlanWizardPageScanning::wlanScanResultPreCheck" + " not current widget" ); + + mScanResultsAvailable = true; + } + } +} + +/*! + * Processes the direct scan results. + * @param [in] scanStatus indicates whether the scan was succesful, canceled or + * failed. In case the scan was not succesful, always proceed to manual wizard. + */ +void WlanWizardPageScanning::wlanScanDirectReady(int scanStatus) +{ + OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY, + "WlanWizardPageScanning::wlanScanDirectReady" ); + + WlanQtUtils* utils = mWizard->wlanQtUtils(); + + Q_ASSERT(utils); + + QList filteredResults; + + if (scanStatus == WlanQtUtils::ScanStatusOk) { + QList > directScanResults; + // Read the directed scan results from Qt Utils + utils->availableWlanAps(directScanResults); + + // Identify open and hidden networks. + getFinalScanResults(directScanResults, mWlanApList, filteredResults); + } + + // Process the scan results. If scan status is not ok, feed an empty + // result table to the selection function. + selectNextPageActions(filteredResults); +} + +/*! + * All wlan channels have been scanned for public networks. After processing the + * results a direct scan is initiated. This function also checks whether the + * scan was succesful, canceled or failed. In case the scan was not succesful, + * always proceed to manual wizard. + */ +void WlanWizardPageScanning::wlanScanApReady() +{ + OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_WLANSCANAPREADY, + "WlanWizardPageScanning::wlanScanApReady" ); + + if (mScanStatus == WlanQtUtils::ScanStatusOk) { + WlanQtUtils* utils = mWizard->wlanQtUtils(); + Q_ASSERT(utils); + + QList > openScanResults; + + // Fetch the list of scan results. + utils->availableWlanAps(openScanResults); + + // The name of the network that we are looking for. + QString ssid = + mWizard->configuration(WlanWizardPrivate::ConfSsid).toString(); + + // Store matching scan results. + getSsidMatchList(ssid, openScanResults); + + // Next directed scan. + utils->scanWlanDirect(ssid); + } + else { + mWizard->clearConfiguration(WlanWizardHelper::ConfAvailableNetworkOptions); + mNextPageId = WlanWizardPageInternal::PageNetworkMode; + mWizard->nextPage(); + } +} + +/*! + * This function stores all the APs that match ssid parameter to mWlanApList + * member list. + * @param [in] ssid is the name of the network we are interested in. + * @param [in] matchList is the list of all APs that were revealed in the scan. + */ +void WlanWizardPageScanning::getSsidMatchList( + QString ssid, + const QList > &matchList) +{ + mWlanApList.clear(); + QSharedPointer item; + + for (int i = 0; i < matchList.size(); i++) { + item = matchList.at(i); + if (item->value(WlanQtUtilsAp::ConfIdSsid).toString() == ssid) { + mWlanApList.append(item); + } + } +} + +/* + * Find out which of the direct scan results are open networks by comparing + * result to open scan results. Return finalResults. + * @param [in] directScanResults are the results of a directed scan. + * @param [in] openScanResults are the results of a scan inquiring any APs. + * @param [out] finalResults is a list of APs with visibility flag included. + */ +void WlanWizardPageScanning::getFinalScanResults( + const QList > &directScanResults, + const QList > &openScanResults, + QList &finalResults) +{ + finalResults.clear(); + + // The key assumption of this algorithm is that both direct and public scan + // reveal the same set of AP:s with the exception of hidden AP:s. + // In other words: Direct scan result set is the whole set with each AP + // marked as hidden by default. If an AP has been revealed also by public + // scan, it is changed to visible. + for (int i = 0; i < directScanResults.size(); i++) { + WlanScanResult resultItem; + + resultItem.scanResult = directScanResults.at(i); + + // Initialize as hidden. + resultItem.networkHidden = true; + + for (int j = 0; j < openScanResults.size(); j++) { + if (WlanQtUtilsAp::compare( + openScanResults.at(j).data(), + directScanResults.at(i).data()) == 0) { + // Mark open, if a public scan revealed the same AP + resultItem.networkHidden = false; + } + } + + finalResults.append(resultItem); + } +} + +/*! + * This function processes the scan results in case multiple results were + * acquired with matching SSIDs. + * @param [in] finalResults is the list of APs revealed by the last scans. + * @return the identifier of the next page. + */ +int WlanWizardPageScanning::processMultipleScanResults( + const QList &finalResults) +{ + WlanWizardScanList networkOptions; + int nextPage; + + // Build the list of results to be placed in the configuration. + networkOptions.build(finalResults); + + QVariant tmp; + tmp.setValue(networkOptions); + + mWizard->setConfiguration( + WlanWizardHelper::ConfAvailableNetworkOptions, tmp); + + // If there are more than one network mode choices, go to manual selection + // of network mode. + if (networkOptions.netModes() > SingleResult) { + nextPage = WlanWizardPageInternal::PageNetworkMode; + } else { + // if only a single network mode option is available, the mode query + // may be skipped and the next page is set to security mode query. + WlanNetworkSetting setting = networkOptions.getNetModes().at(0); + mWizard->setConfiguration(WlanWizardHelper::ConfNetworkMode, setting.mode); + mWizard->setConfiguration(WlanWizardHelper::ConfHiddenWlan, setting.hidden); + nextPage = WlanWizardPageInternal::PageNetworkSecurity; + } + + return nextPage; +} + +/*! + * This function decides what to do with the scan results. + * @param [in] finalResults is the list of APs revealed by the last scans. + */ +void WlanWizardPageScanning::selectNextPageActions( + const QList &finalResults) +{ + mWizard->clearConfiguration(WlanWizardHelper::ConfAvailableNetworkOptions); + + if (finalResults.isEmpty()) { + // In case of no results at all were found. + mNextPageId = WlanWizardPageInternal::PageNetworkMode; + } else if (finalResults.size() == SingleResult) { + // In case there is only a single result. + WlanScanResult item = finalResults.first(); + mNextPageId = mWizard->getNextPageId( + item.scanResult->value(WlanQtUtilsAp::ConfIdSsid).toString(), + item.scanResult->value(WlanQtUtilsAp::ConfIdConnectionMode).toInt(), + item.scanResult->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(), + item.scanResult->value(WlanQtUtilsAp::ConfIdWpaPskUse).toBool(), + item.networkHidden, + item.scanResult->value(WlanQtUtilsAp::ConfIdWpsSupported).toBool()); + } else { + // In case more than one result is available. + mWizard->setConfiguration(WlanWizardHelper::ConfProcessSettings, true); + mNextPageId = processMultipleScanResults(finalResults); + } + + mWizard->nextPage(); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/src/wlanwizardpagesecuritymode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/src/wlanwizardpagesecuritymode.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,276 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WLAN Wizard Page: Security mode Selection. + * + */ + +// System includes +#include +#include +#include +#include +#include +#include + +// User includes +#include "wlanwizard_p.h" +#include "wlanwizard.h" +#include "wlanwizardpagesecuritymode.h" +#include "wlanwizardscanlist.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanwizardpagesecuritymodeTraces.h" +#endif + +/*! + * Constructor method for the Sequrity mode query view object. + * @param [in] parent pointer to parent object. + */ +WlanWizardPageSecurityMode::WlanWizardPageSecurityMode( + WlanWizardPrivate* parent) : + WlanWizardPageInternal(parent), + mWidget(NULL), + mList(NULL), + mLabel(NULL), + mLoader(NULL), + mValid(false) +{ +} + +/*! + * Destructor. Loader widget is deleted. + * All document widgets are deleted by wlanwizard_p destructor. + */ +WlanWizardPageSecurityMode::~WlanWizardPageSecurityMode() +{ + delete mLoader; +} + +/*! + * Page initialization. If view widget is already loaded, does nothing. + * @return pointer to widget "occ_add_wlan_02". + */ +HbWidget* WlanWizardPageSecurityMode::initializePage() +{ + OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESECURITYMODE_INITIALIZEPAGE, + "WlanWizardPageSecurityMode::initializePage" ); + + if (mWidget==NULL) { + + mLoader = new HbDocumentLoader(mWizard->mainWindow()); + + bool ok; + + mLoader->load( ":/docml/occ_add_wlan_02_03.docml", &ok ); + Q_ASSERT(ok); + + // Initialize orientation + loadDocmlSection( mWizard->mainWindow()->orientation() ); + + // Load widgets + mWidget = qobject_cast (mLoader->findWidget("occ_add_wlan_02")); + Q_ASSERT(mWidget != NULL); + + mList = qobject_cast (mLoader->findWidget("list")); + Q_ASSERT(mList != NULL); + + mLabel = qobject_cast (mLoader->findWidget("dialog_6")); + Q_ASSERT(mLabel != NULL); + + mLabel->setPlainText(hbTrId("txt_occ_dialog_select_network_security_mode")); + + // Connect orientation signal from the main window to orientation + // loader. + ok &= connect( mWizard->mainWindow(), + SIGNAL(orientationChanged(Qt::Orientation)), + this, SLOT(loadDocmlSection(Qt::Orientation))); + Q_ASSERT(ok); + + // Connect signal from the radio button list indicating that an item + // has been selected to validation handler. + ok &= connect( mList, SIGNAL(itemSelected(int)), + this, SLOT(itemSelected())); + Q_ASSERT(ok); + } + + // Create contents to the security mode radio button list. + populateSecModeList(); + + return mWidget; +} + +/*! + * Validates the Sequrity more selection and sets the configuration in + * the wlanwizard. + * @param [out] removeFromStack returns false. + * @return depending on the sequrity mode, returns the appropriate view + * identifier. + */ +int WlanWizardPageSecurityMode::nextId(bool &removeFromStack) const +{ + removeFromStack = false; + + // The configuration is selected from the mSecModes list, which is ordered + // during the page initialization. + mWizard->setConfiguration( WlanWizardPrivate::ConfSecurityMode, + mSecModes.at( mList->selected() ) ); + + // The configuration is selected from the mUsePsk list, which is ordered + // during the page initialization. + mWizard->setConfiguration( WlanWizardPrivate::ConfUsePsk, + mUsePsk.at( mList->selected() ) ); + + return mPageIds.at( mList->selected() ); +} + +/*! + * This method is overrides the default implementation from WlanWizardPage. + * It indicates whether the Next-button should be enabled or not. + * @return true, if a mode has been selected. + */ +bool WlanWizardPageSecurityMode::showPage() +{ + return mValid; +} + +/*! + * Is invoked when user selects a mode from the radio button list. + * (HbRadioButtonList's itemSelected-signal) + */ +void WlanWizardPageSecurityMode::itemSelected() +{ + OstTrace0( TRACE_BORDER, WLANWIZARDPAGESECURITYMODE_ITEMSELECTED, + "WlanWizardPageSecurityMode::itemSelected" ); + + mValid = true; + mWizard->enableNextButton(mValid); +} + +/*! + * Loads the document orientation information from occ_add_wlan_02_03.docml + * This is called each time phone orientation changes. + * @param [in] orientation indicates whether the phone is in portrait or + * landscape mode. + */ +void WlanWizardPageSecurityMode::loadDocmlSection(Qt::Orientation orientation) +{ + OstTrace1( TRACE_NORMAL, WLANWIZARDPAGESECURITYMODE_LOADDOCML, + "WlanWizardPageSecurityMode::loadDocml - orientation;orientation=%x", + ( TUint )( orientation ) ); + + WlanWizardPageInternal::loadDocmlSection( + mLoader, + orientation, + ":/docml/occ_add_wlan_02_03.docml", + "portrait_section", + "landscape_section"); +} + +/*! + * Support function that creates the contents of the security mode list. + */ +void WlanWizardPageSecurityMode::populateSecModeList() +{ + QStringList items; + + mSecModes.clear(); + mPageIds.clear(); + mUsePsk.clear(); + + // A list is created. Since there is no practical way of knowing whether + // the new contents are different from the previous contents (if there + // even were any in the first place) the validity is always reset. + mValid = false; + + // Create the radio button list to correspond to correct security mode + // identifiers and page identifiers. + // Populate the list according to network mode selection. + addToList(items, hbTrId("txt_occ_list_open"), + CMManagerShim::WlanSecModeOpen, + WlanWizardPage::PageProcessSettings, + false); + + addToList(items, hbTrId("txt_occ_list_wep_1"), + CMManagerShim::WlanSecModeWep, + WlanWizardPageInternal::PageKeyQuery, + true); + + // In case of Ad-hoc network, exclude wpa, eap and 802.1X modes. + if (mWizard->configuration(WlanWizardPrivate::ConfNetworkMode).toInt() + != CMManagerShim::Adhoc) { + + addToList(items, hbTrId("txt_occ_list_wpa_with_password"), + CMManagerShim::WlanSecModeWpa, + WlanWizardPageInternal::PageKeyQuery, + true); + + addToList(items, hbTrId("txt_occ_list_wpa_with_eap"), + CMManagerShim::WlanSecModeWpa, + WlanWizardPage::PageEapStart, + false); + + addToList(items, hbTrId("txt_occ_list_8021x_1"), + CMManagerShim::WlanSecMode802_1x, + WlanWizardPage::PageEapStart, + false); + } + + mList->setItems(items); +} + +/*! + * A support function to map the radio button list to a generic network + * mode list. This enables the changing of button order without it + * affecting the entire class. + * @param [out] list is a reference to a local list that will be placed as an + * argument to the radio button list. + * @param [in] item is a reference to the text value that is appended to the + * list + * @param [in] mode is the security mode associated with the item + * @param [in] page is the id of the next wizard page when this item is selected. + * @param [in] psk indicates whether password needs to be queried. + */ +void WlanWizardPageSecurityMode::addToList(QStringList &list, + const QString &item, int mode, int page, bool psk) +{ + if (mWizard->configurationExists(WlanWizardHelper::ConfAvailableNetworkOptions)) { + WlanNetworkSetting netMode; + netMode.mode = mWizard->configuration(WlanWizardPrivate::ConfNetworkMode).toInt(); + netMode.hidden = mWizard->configuration(WlanWizardPrivate::ConfHiddenWlan).toBool(); + + // wps always set to false at this point of the wizard. + netMode.wpsSupported = false; + + WlanWizardScanList networkOptions = mWizard->configuration( + WlanWizardHelper::ConfAvailableNetworkOptions).value(); + + for (int i = 0; i < networkOptions.secModes(netMode); i++) { + WlanSecuritySetting secMode = networkOptions.getSecMode(netMode, i); + + if (secMode.mode == mode && secMode.usePsk == psk) { + list << item; + mSecModes.append(mode); + mPageIds.append(page); + mUsePsk.append(psk); + } + } + } + else { + list << item; + mSecModes.append(mode); + mPageIds.append(page); + mUsePsk.append(psk); + } +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/src/wlanwizardpagessid.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/src/wlanwizardpagessid.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,188 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Wizard Page: SSID Selection. +*/ + +// System includes +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "wlanwizardpagessid.h" +#include "wlanwizard_p.h" +#include "wlanwizardutils.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanwizardpagessidTraces.h" +#endif + +/*! + * Constructor method for the SSID query view object. + * @param [in] parent pointer to parent object. + */ +WlanWizardPageSsid::WlanWizardPageSsid(WlanWizardPrivate* parent) : + WlanWizardPageInternal(parent), + mWidget(NULL), + mLabel(NULL), + mSsid(NULL), + mLoader(NULL) +{ + +} + +/*! + * Destructor. Loader widget is deleted. + * All document widgets are deleted by wlanwizard_p destructor. + */ +WlanWizardPageSsid::~WlanWizardPageSsid() +{ + delete mLoader; +} + +/*! + * Page initialization. If view is already loaded, does nothing. + * @return pointer to widget "occ_add_wlan_01". + */ +HbWidget* WlanWizardPageSsid::initializePage() +{ + OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESSID_INITIALIZEPAGE, + "WlanWizardPageSsid::initializePage" ); + + // It is not possible for this method to be called more than once during + // wizard lifetime. + Q_ASSERT(mWidget == NULL); + + bool ok; + + mLoader = new HbDocumentLoader(mWizard->mainWindow()); + + mLoader->load(":/docml/occ_add_wlan_01_04.docml", &ok); + Q_ASSERT(ok); + + // Load orientation + loadDocmlSection(mWizard->mainWindow()->orientation()); + + // Load widgets + mWidget = qobject_cast (mLoader->findWidget( + "occ_add_wlan_01")); + Q_ASSERT(mWidget != NULL); + + mLabel = qobject_cast (mLoader->findWidget("dialog")); + Q_ASSERT(mLabel != NULL); + + mSsid = qobject_cast (mLoader->findWidget("lineEditKey")); + Q_ASSERT(mSsid != NULL); + + mLabel->setPlainText(hbTrId( + "txt_occ_dialog_insert_the_name_of_the_new_wlan_net")); + + // Connect orientation signal from the main window to orientation + // loader. + ok = connect(mWizard->mainWindow(), + SIGNAL(orientationChanged(Qt::Orientation)), this, + SLOT(loadDocmlSection(Qt::Orientation))); + Q_ASSERT(ok); + + // Connect text change-signal from input dialog to handler function + ok = connect(mSsid, SIGNAL(textChanged(const QString &)), this, + SLOT(textChanged(const QString &))); + Q_ASSERT(ok); + + HbEditorInterface editInterface(mSsid); + + // TODO: remove (HbEditorConstraints) type cast when + // Q_DECLARE_OPERATORS_FOR_FLAGS(HbEditorConstraints) is defined (SDK xxx) + editInterface.setInputConstraints( + (HbEditorConstraints)(HbEditorConstraintAutoCompletingField | + HbEditorConstraintLatinAlphabetOnly)); + + editInterface.setSmileyTheme(HbSmileyTheme()); + editInterface.setEditorClass(HbInputEditorClassNetworkName); + mSsid->setInputMethodHints( + Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase); + mSsid->setMaxLength(WlanWizardUtils::SsidMaxLength); + + return mWidget; +} + +/*! + * This method is overrides the default implementation from WlanWizardPage. + * It indicates whether the Next-button should be enabled or not. + * @return true, if mSsid edit field is not empty. + */ +bool WlanWizardPageSsid::showPage() +{ + // Initiate the scanning of public APs here. + mWizard->wlanQtUtils()->scanWlanAps(); + + // Open virtual keyboard by setting focus to line edit + mSsid->setFocus(); + + return !(mSsid->text().isEmpty()); +} + +/*! + * Stores the SSID selection in the configuration. + * @param [out] removeFromStack returns false. + * @return WlanWizardPageScanning page id. + */ +int WlanWizardPageSsid::nextId(bool &removeFromStack) const +{ + removeFromStack = false; + + // SSID is stored into configuration + mWizard->setConfiguration(WlanWizardPrivate::ConfSsid, mSsid->text()); + + return WlanWizardPageInternal::PageScanning; +} + +/*! + * Loads the document orientation information from occ_add_wlan_01_04.docml + * This is called each time phone orientation changes. + * @param [in] orientation indicates whether the phone is in portrait or + * landscape mode. + */ +void WlanWizardPageSsid::loadDocmlSection(Qt::Orientation orientation) +{ + OstTrace1( TRACE_FLOW, WLANWIZARDPAGESSID_LOADDOCML, + "WlanWizardPageSsid::loadDocml - orientation ;orientation=%x", + ( TUint )( orientation ) ); + + WlanWizardPageInternal::loadDocmlSection( + mLoader, + orientation, + ":/docml/occ_add_wlan_01_04.docml", + "portrait_section", + "landscape_section"); +} + +/*! + * Executed when changes have been made to the mSsid field (and the field is + * not empty). + * @param [in] text is not used at this point. + */ +void WlanWizardPageSsid::textChanged(const QString &text) +{ + Q_UNUSED(text); + OstTrace0( TRACE_FLOW, WLANWIZARDPAGESSID_TEXTCHANGED, + "WlanWizardPageSsid::textChanged in text edit widget" ); + + mWizard->enableNextButton(!(mSsid->text().isEmpty())); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/src/wlanwizardpagesummary.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/src/wlanwizardpagesummary.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,265 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Wlan Wizard Page: Summary + * + */ + +// System includes +#include +#include +#include +#include +#include +#include + +// User includes +#include "wlanqtutils.h" +#include "wlanwizard_p.h" +#include "wlanwizardplugin.h" +#include "wlanwizardsummaryviewitem.h" +#include "wlanwizardpagesummary.h" + +/*! + \class WlanWizardPageSummary + \brief Implements Wizard summary page. + */ + +// External function prototypes + +// Local constants + +//! Path for layout of custom list widget +static const char WlanWizardPageSummaryLayout[] = ":/wizardsummarylayout/"; + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. + + @param [in] parent pointer to private implementation of wizard. + */ +WlanWizardPageSummary::WlanWizardPageSummary(WlanWizardPrivate* parent) : + WlanWizardPageInternal(parent), + mListWidget(NULL) +{ +} + +/*! + Destructor. + */ +WlanWizardPageSummary::~WlanWizardPageSummary() +{ + HbStyleLoader::unregisterFilePath(WlanWizardPageSummaryLayout); + + // Wizard framework deletes the visualization (owns mListWidget). +} + +/*! + See WlanWizardPage::initializePage() + */ +HbWidget* WlanWizardPageSummary::initializePage() +{ + // Note that from summary page it is not possible to step back + // this means that it is not possible that this method is called twice. + Q_ASSERT(!mListWidget); + + loadDocml(); + int row = 0; + + appendToList( + row, + hbTrId("txt_occ_dblist_network_name"), + mWizard->configuration(WlanWizardPrivate::ConfSsid).toString()); + + appendToList( + row, hbTrId("txt_occ_dblist_network_mode"), networkModeText()); + + appendToList( + row, hbTrId("txt_occ_dblist_security_mode"), securityModeText()); + + addDynamicItems(row); + + return qobject_cast(mListWidget); +} + +/*! + Loads docml. + */ +void WlanWizardPageSummary::loadDocml() +{ + bool ok; + HbDocumentLoader docLoader(mWizard->mainWindow()); + + docLoader.load(":/docml/occ_add_wlan_05.docml", &ok); + Q_ASSERT(ok); + + mListWidget = qobject_cast(docLoader.findWidget("occ_add_wlan_05")); + Q_ASSERT(mListWidget != NULL); + + // Set own list prototype handler to disable TAP gestures and selections + mListWidget->setItemPrototype( + new WlanWizardSummaryListViewItem(mListWidget)); + + // set the layout name to match the layout name in hblistviewitem.css file + mListWidget->setLayoutName("wlanwizardsummaryitem"); + + // Register the location of hblistviewitem.css and hblistviewitem.widgetml + ok = HbStyleLoader::registerFilePath(WlanWizardPageSummaryLayout); + Q_ASSERT(ok); +} + +/*! + Gets localized network mode from the WlanWizardPrivate::ConfNetworkMode + configuration. + + @return localized network mode text. + */ +QString WlanWizardPageSummary::networkModeText() const +{ + QString ret; + int mode = mWizard->configuration( + WlanWizardPrivate::ConfNetworkMode).toInt(); + + switch (mode) { + case CMManagerShim::Adhoc: + ret = hbTrId("txt_occ_dblist_network_mode_val_adhoc"); + break; + + default: + Q_ASSERT(mode == CMManagerShim::Infra); + if (mWizard->configuration(WlanWizardPrivate::ConfHiddenWlan).toBool()) { + ret = hbTrId("txt_occ_dblist_network_mode_val_infrastructure_hi"); + } else { + ret = hbTrId("txt_occ_dblist_network_mode_val_infrastructure_pu"); + } + break; + } + return ret; +} + +/*! + Gets localized security mode from the WlanWizardPrivate::ConfSecurityMode + configuration. + + @return localized security mode text. + */ +QString WlanWizardPageSummary::securityModeText() const +{ + QString ret; + int mode = mWizard->configuration(WlanWizardPrivate::ConfSecurityMode).toInt(); + switch (mode) { + case CMManagerShim::WlanSecMode802_1x: + ret = hbTrId("txt_occ_dblist_security_mode_val_8021x"); + break; + + case CMManagerShim::WlanSecModeWep: + ret = hbTrId("txt_occ_dblist_security_mode_val_wep"); + break; + + case CMManagerShim::WlanSecModeWpa: + if (mWizard->configuration(WlanWizardPrivate::ConfUsePsk).toBool()) { + ret = hbTrId("txt_occ_dblist_security_mode_val_wpawpa2psk"); + } else { + ret = hbTrId("txt_occ_dblist_security_mode_val_wpawpa2_with_eap"); + } + break; + + case CMManagerShim::WlanSecModeWpa2: + if (mWizard->configuration(WlanWizardPrivate::ConfUsePsk).toBool()) { + ret = hbTrId("txt_occ_dblist_security_mode_val_wpa2_with_passwor"); + } else { + ret = hbTrId("txt_occ_dblist_security_mode_val_wpa2_with_eap"); + } + break; + + default: + Q_ASSERT(mode == CMManagerShim::WlanSecModeOpen); + ret = hbTrId("txt_occ_dblist_security_mode_val_open"); + break; + } + return ret; +} + +/*! + Adds dynamic content to the view. + + @param [in,out] row row to where insert happens. + */ +void WlanWizardPageSummary::addDynamicItems(int &row) +{ + if (mWizard->isEapEnabled()) { + appendToListPluginInfo(WlanWizardPlugin::SummaryEapOuterType, row); + appendToListPluginInfo(WlanWizardPlugin::SummaryEapInnerType, row); + appendToListPluginInfo(WlanWizardPlugin::SummaryEapFastProvisioningMode, row); + } + + // TODO: Hotspot: no need to show destination.. + QString value; + + switch (mWizard->configuration(WlanWizardPrivate::ConfIctStatus).toInt()) { + case WlanQtUtils::IctPassed: + value = hbTrId("txt_occ_dblist_destination_val_internet"); + appendToList(row, hbTrId("txt_occ_dblist_destination"), value); + break; + + case WlanQtUtils::IctFailed: + value = hbTrId("txt_occ_dblist_destination_val_uncategorized"); + appendToList(row, hbTrId("txt_occ_dblist_destination"), value); + break; + + default: + Q_ASSERT(WlanQtUtils::IctHotspotPassed == mWizard->configuration(WlanWizardPrivate::ConfIctStatus).toInt()); + // Add nothing to list. + break; + } +} + +/*! + Appends new item to the end of the summary list + + @param [in,out] row number to where the item is inserted + @param [in] title title of the item + @param [in] value value of the item + */ +void WlanWizardPageSummary::appendToList( + int &row, + const QString title, + const QString value) +{ + HbListWidgetItem *item = new HbListWidgetItem(); + item->setText(title); + item->setSecondaryText(value); + mListWidget->insertItem(row++, item); +} + +/*! + Appends new item to the end of the summary list + + @param [in] id Plugin summary id + @param [in,out] row number to where the item is inserted + */ +void WlanWizardPageSummary::appendToListPluginInfo( + WlanWizardPlugin::Summary id, int &row ) +{ + QString title; + QString value; + WlanWizardPlugin *plugin = mWizard->wlanWizardPlugin(); + Q_ASSERT(plugin); + if (plugin->summary(id, title, value)) { + appendToList(row, title, value ); + } +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/src/wlanwizardscanlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/src/wlanwizardscanlist.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Wlan Wizard Scan List: Hierarchical list of scan results that can be + * utilized to limit available selection options in manual wlan wizard. + * + */ + +// System includes +#include +#include +#include +#include + +// User includes +#include "wlanwizardscanlist.h" +#include "wlanwizardpageinternal.h" + +/*! + * Constructor for WlanWizardScanList object. + */ +WlanWizardScanList::WlanWizardScanList() +{ + +} + +/*! + * Copy Constructor for WlanWizardScanList object. + * @param [in] scanList is the object to be copied. + */ +WlanWizardScanList::WlanWizardScanList(const WlanWizardScanList &scanList): + mOpenOptions(scanList.mOpenOptions) +{ + +} + +/*! + * Destructor for WlanWizardScanList object. + */ +WlanWizardScanList::~WlanWizardScanList() +{ + +} + +/*! + * This function builds a hash list of scan results. Key value in a hash item + * is the network mode and the associated value is a list of security modes. + * In other words, it is a list of network modes where each network mode points + * to one or more security modes. + * @param [in] results contains a list of scan results. + */ +void WlanWizardScanList::build(const QList &results) +{ + for (int i = 0; i < results.size(); i++) { + WlanNetworkSetting netMode; + WlanSecuritySetting secMode; + WlanScanResult item = results.at(i); + + netMode.wpsSupported = item.scanResult->value(WlanQtUtilsAp::ConfIdWpsSupported).toBool(); + netMode.mode = item.scanResult->value(WlanQtUtilsAp::ConfIdConnectionMode).toInt(); + netMode.hidden = (netMode.mode == CMManagerShim::Adhoc) ? false : item.networkHidden; + + secMode.mode = item.scanResult->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(); + secMode.usePsk = (secMode.mode == CMManagerShim::WlanSecModeWep) ? true + : item.scanResult->value(WlanQtUtilsAp::ConfIdWpaPskUse).toBool(); + + switch (secMode.mode) { + case CMManagerShim::WlanSecMode802_1x: + secMode.nextPageId = WlanWizardPage::PageEapStart; + break; + + case CMManagerShim::WlanSecModeWep: + secMode.nextPageId = WlanWizardPageInternal::PageKeyQuery; + break; + + case CMManagerShim::WlanSecModeWpa: + case CMManagerShim::WlanSecModeWpa2: + if (secMode.usePsk) { + secMode.nextPageId = WlanWizardPageInternal::PageKeyQuery; + } + else { + secMode.nextPageId = WlanWizardPage::PageEapStart; + } + break; + + default: + Q_ASSERT(CMManagerShim::WlanSecModeOpen == secMode.mode || + CMManagerShim::WlanSecModeWapi == secMode.mode); + secMode.nextPageId = WlanWizardPage::PageProcessSettings; + break; + + } + + // prevent duplicate settings. + if (!mOpenOptions.contains(netMode)) { + QList secList; + secList.append(secMode); + mOpenOptions.insert(netMode, secList); + } + else if (!(mOpenOptions.find(netMode)->contains(secMode))) { + mOpenOptions.find(netMode)->append(secMode); + } + // else an identical key-value pair is already in the list -> not added. + } +} + +/*! + * This function returns a security mode setting at the requested location. + * This function does not do any validity checks for the lists, so the user + * needs to use netModes and secModes functions to prevent over-indexing. + * @param [in] netMode key value for the hash list. + * @param [in] index list index pointing to the security mode item. + * @return security setting item reference. + */ +const WlanSecuritySetting &WlanWizardScanList::getSecMode( + WlanNetworkSetting netMode, + int index) const +{ + return mOpenOptions.value(netMode).at(index); +} + +/*! + * The number of key values available in the hash list. + * @return the number of keys. + */ +int WlanWizardScanList::netModes() const +{ + return mOpenOptions.size(); +} + +/*! + * The size of the security mode list associated to a network mode. + * @param [in] netMode key value for the hash list. + * @return the size of the list associated with the key. + */ +int WlanWizardScanList::secModes(WlanNetworkSetting netMode) const +{ + return mOpenOptions.find(netMode)->size(); +} + +/*! + * This function returns the list of keys in the hash. + * @return a list of keys. + */ +QList WlanWizardScanList::getNetModes() const +{ + return mOpenOptions.keys(); +} + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/src/wlanwizardsummaryviewitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/src/wlanwizardsummaryviewitem.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Wlan Wizard Page: Summary: List view item + * + */ + +// System includes + +// User includes + +#include "wlanwizardsummaryviewitem.h" + +/*! + \class WlanWizardSummaryListViewItem + \brief Implements custom List view for Summary page. + + HbListWidget does not support directly views where selection is disabled. + + This implementation removes required operations to disable list selection. + */ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// + +/*! + Constructor. + + @param [in] parent parent class + */ +WlanWizardSummaryListViewItem::WlanWizardSummaryListViewItem( + QGraphicsItem* parent) : + HbListViewItem(parent) +{ +} + +/*! + Destructor. + */ +WlanWizardSummaryListViewItem::~WlanWizardSummaryListViewItem() +{ +} + +/*! + See HbListViewItem::updateChildItems(). + + Disables selection. + */ +void WlanWizardSummaryListViewItem::updateChildItems() +{ + HbListViewItem::updateChildItems(); + + ungrabGesture(Qt::TapGesture); + + GraphicsItemFlags itemFlags = flags(); + itemFlags &= ~QGraphicsItem::ItemIsFocusable; + setFlags(itemFlags); +} + +/*! + See HbListViewItem::createItem(). + */ +HbAbstractViewItem* WlanWizardSummaryListViewItem::createItem() +{ + return new WlanWizardSummaryListViewItem(*this); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/src/wlanwizardutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/src/wlanwizardutils.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,262 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WLAN Wizard Utilities + * + */ + +// System includes +#include +#include +#include + +// User includes +#include "wlanwizardutils.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanwizardutilsTraces.h" +#endif + +/*! + \class WlanWizardUtils wlanwizardutils.cpp + \brief Utilities for WLAN key validations. + +*/ +/*! + \enum WlanWizardUtils::KeyStatus + This enum defines the validation results. + + \var WlanWizardUtils::KeyStatusOk + Key is valid. + + \var WlanWizardUtils::KeyStatusIllegalCharacters + Key contains illegal characters. + + \var WlanWizardUtils::KeyStatusWpaTooShort + WPA key is too short. Minimum allowed length is 8. See + WlanWizardUtils::validateWpaKey(). + + \var WlanWizardUtils::KeyStatusWpaTooLong + WPA key is too long. Minimum allowed length is 64 for hex key and 63 for + ascii key. See WlanWizardUtils::validateWpaKey(). + + \var WlanWizardUtils::KeyStatusWepInvalidLength + WEP key length is not valid. Valid keys are + - hex: 10 or 26 characters + - ascii: 5 or 13 characters. See WlanWizardUtils::validateWpaKey(). + + \var WlanWizardUtils::SsidMinLength + Minumum acceptable length for SSID. + + \var WlanWizardUtils::SsidMaxLength + Maximum acceptable length for SSID. + + \var WlanWizardUtils::WpaMinLength + Minumum acceptable length for WPA key. + + \var WlanWizardUtils::WpaMaxLength + Maximum acceptable length for WPA key. + + \var WlanWizardUtils::WepHex64BitMaxLength + Length of WEP key: format hex 64-bits. + + \var WlanWizardUtils::WepHex128BitMaxLength + Length of WEP key: format hex 128-bits. + + \var WlanWizardUtils::WepAscii64BitMaxLength + Length of WEP key: format ascii 64-bits. + + \var WlanWizardUtils::WepAscii128BitMaxLength + Length of WEP key: format ascii 128-bits. + +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +/*! + Process WPA key validation. A passphrase can contain from 8 to 63 ASCII + characters where each character MUST have a decimal encoding in the range of + 32 to 126, inclusive. + + A preshared key is stored as 64 character hex string. + + @param [in] key PSK to be validated + + @return Following values are possible + - KeyStatusOk + - KeyStatusIllegalCharacters + - KeyStatusWpaTooShort + - KeyStatusWpaTooLong + */ +WlanWizardUtils::KeyStatus WlanWizardUtils::validateWpaKey(const QString &key) +{ +#ifdef OST_TRACE_COMPILER_IN_USE + TPtrC tmp(key.utf16(),key.length() ); + OstTraceExt1( TRACE_NORMAL, WLANWIZARDUTILS_VALIDATEWPAKEY, + "WlanWizardUtils::validateWpaKey;key=%S", tmp ); +#endif + + int length = key.length(); + KeyStatus ret = KeyStatusOk; + + if (length < WpaMinLength) { + ret = KeyStatusWpaTooShort; + } else if (length > WpaMaxLength) { + ret = KeyStatusWpaTooLong; + } else if (length == WpaMaxLength) { + ret = isHex(key); + } else { + ret = isAscii(key); + } + + OstTrace1( + TRACE_NORMAL, WLANWIZARDUTILS_VALIDATEWPAKEY_RETURN, + "WlanWizardUtils::validateWpaKey - Return;ret=%{KeyStatus}", ret ); + + return ret; +} + +/*! + Process WEP key validation. Following keys are allowed: + + HEX: + - 64 bit: allowed key length = 10 + - 128 bit: allowed key length = 26 + + ASCII: + - 64 bit: allowed key length = 5 + - 128 bit: allowed key length = 13 + + @param [in] key WEP Key to be validated + + @return Following values are possible + - KeyStatusOk + - KeyStatusIllegalCharacters + - KeyStatusWepInvalidLength + */ +WlanWizardUtils::KeyStatus WlanWizardUtils::validateWepKey(const QString &key) +{ +#ifdef OST_TRACE_COMPILER_IN_USE + TPtrC tmp(key.utf16(),key.length() ); + OstTraceExt1( TRACE_NORMAL, WLANWIZARDUTILS_VALIDATEWEPKEY, + "WlanWizardUtils::validateWepKey;key=%S", tmp ); +#endif + + int length = key.length(); + KeyStatus ret = KeyStatusOk; + + if (length == WepHex64BitMaxLength || length == WepHex128BitMaxLength) { + ret = isHex(key); + } else if (length == WepAscii64BitMaxLength || length == WepAscii128BitMaxLength) { + ret = isAscii(key); + } else { + ret = KeyStatusWepInvalidLength; + } + + OstTrace1( + TRACE_NORMAL, WLANWIZARDUTILS_VALIDATEWEPKEY_RETURN, + "WlanWizardUtils::validateWepKey - Return;ret=%{KeyStatus}", ret ); + + return ret; +} + +/*! + Process Ascii validation. Allowed characters are from 32 to 126. + + @param [in] key to be validated. + + @return Following values are possible + - KeyStatusOk + - KeyStatusIllegalCharacters + */ +WlanWizardUtils::KeyStatus WlanWizardUtils::isAscii(const QString &key) +{ + static const QChar ch32(32); // First visible ascii character + static const QChar ch126(126); // Last visible ascii character + + const QChar *data = key.data(); + while (!data->isNull()) { + if ((*data) < ch32 || (*data) > ch126) { + return KeyStatusIllegalCharacters; + } + ++data; + } + return KeyStatusOk; +} + +/*! + Process Hex validation. Allowed characters are + - from 0 to 9 + - from a to f + - from A to F + + @param [in] key to be validated. + + @return Following values are possible + - KeyStatusOk + - KeyStatusIllegalCharacters + */ +WlanWizardUtils::KeyStatus WlanWizardUtils::isHex(const QString &key) +{ + static const QChar ch_A(65); // Character: A + static const QChar ch_F(70); // Character: F + static const QChar ch_a(97); // Character: a + static const QChar ch_f(102);// Character: f + + const QChar *data = key.data(); + while (!data->isNull()) { + if (data->isDigit() || + (*data) >= ch_a && (*data) <= ch_f || + (*data) >= ch_A && (*data) <= ch_F) { + ++data; + } else { + return KeyStatusIllegalCharacters; + } + } + return KeyStatusOk; +} + +/*! + Process SSID validation. + + @param [in] ssid to be validated. + + @return Following values are possible + - SsidStatusOk + - SsidStatusInvalidLength + */ +WlanWizardUtils::SsidStatus WlanWizardUtils::validateSsid(const QString &ssid) +{ + TPtrC tmp(ssid.utf16(), ssid.length() ); + OstTraceExt1( TRACE_NORMAL, WLANWIZARDUTILS_VALIDATESSID, + "WlanWizardUtils::validateSsid;ssid=%S", tmp ); + + SsidStatus ret = SsidStatusOk; + + int len = ssid.length(); + if (len < SsidMinLength || len > SsidMaxLength) { + ret = SsidStatusInvalidLength; + } + OstTrace1( + TRACE_NORMAL, WLANWIZARDUTILS_VALIDATESSID_RETURN, + "WlanWizardUtils::validateSsid - Return;ret=%{SsidStatus}", ret ); + return ret; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/make_ctc.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/make_ctc.bat Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,17 @@ +:: Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +:: All rights reserved. +:: This component and the accompanying materials are made available +:: under the terms of "Eclipse Public License v1.0" +:: which accompanies this distribution, and is available +:: at the URL "http://www.eclipse.org/legal/epl-v10.html". +:: +:: Initial Contributors: +:: Nokia Corporation - initial contribution. +:: +:: Contributors: +:: +:: Description: +:: Batch file to instrument and run test cases with CTC. + +@echo off +call ctcwrap -C EXCLUDE=* -C NO_EXCLUDE+..\src\*.cpp -C NO_EXCLUDE+..\..\eapwizard\src\*.cpp -C NO_EXCLUDE+..\..\wpswizard\src\*.cpp -i fd -v -2comp sbs -c winscw_udeb diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/make_ctc_post.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/make_ctc_post.bat Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,17 @@ +:: Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +:: All rights reserved. +:: This component and the accompanying materials are made available +:: under the terms of "Eclipse Public License v1.0" +:: which accompanies this distribution, and is available +:: at the URL "http://www.eclipse.org/legal/epl-v10.html". +:: +:: Initial Contributors: +:: Nokia Corporation - initial contribution. +:: +:: Contributors: +:: +:: Description: +:: Batch file to create coverage reports from CTC results. + +call ctcpost -p profile.txt +call ctc2html -i profile.txt diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/make_ctc_with_clean.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/make_ctc_with_clean.bat Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,24 @@ +:: Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +:: All rights reserved. +:: This component and the accompanying materials are made available +:: under the terms of "Eclipse Public License v1.0" +:: which accompanies this distribution, and is available +:: at the URL "http://www.eclipse.org/legal/epl-v10.html". +:: +:: Initial Contributors: +:: Nokia Corporation - initial contribution. +:: +:: Contributors: +:: +:: Description: +:: Batch file to instrument and run test cases with CTC. + +@echo off +del MON.* +del profile.txt +rmdir /S /Q CTCHTML +call sbs clean +call sbs reallyclean +call make distclean +call qmake "CONFIG-=debug" +call ctcwrap -C EXCLUDE=* -C NO_EXCLUDE+..\src\*.cpp -C NO_EXCLUDE+..\..\eapwizard\src\*.cpp -C NO_EXCLUDE+..\..\wpswizard\src\*.cpp -i fd -v -2comp sbs -c winscw_udeb diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtcertificateinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtcertificateinfo.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Stub file for eapwizard!! + * + */ + +#ifndef EAPQTCERTIFICATEINFO_H +#define EAPQTCERTIFICATEINFO_H + +#include +#include +#include + +class EapQtCertificateInfoPrivate; + +class EapQtCertificateInfo +{ +public: + + enum ItemId + { + /*! QString */ + SubjectName, + /*! QString */ + IssuerName, + /*! QString */ + SerialNumber, + /*! QByteArray */ + SubjectKeyId, + /*! QString */ + ThumbPrint, + /*! QString */ + CertificateLabel, + /*! marker for the last item */ + ItemIdLast + }; + +public: + + EapQtCertificateInfo(); + ~EapQtCertificateInfo(); + + EapQtCertificateInfo(const EapQtCertificateInfo &certInfo); + EapQtCertificateInfo &operator=(const EapQtCertificateInfo &certInfo); + + QVariant value(ItemId id) const; + void setValue(ItemId id, QVariant newValue); + +public: // FOR TESTING PURPOSE + bool operator==(const EapQtCertificateInfo & rhs ) const; + +private: + QScopedPointer d_ptr; +}; + +// Make the class known to QMetaType to support using QVariant +Q_DECLARE_METATYPE(EapQtCertificateInfo) + +#endif /* EAPQTCERTIFICATEINFO_H */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtcertificateinfo_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtcertificateinfo_stub.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Certificate information data structure for EAP QT configuration interface + * + */ + +/* + * %version: 2 % + */ + +#include "eapqtcertificateinfo.h" +#include +class EapQtCertificateInfoPrivate +{ + friend class EapQtCertificateInfo; +public: + + EapQtCertificateInfoPrivate() {}; + ~EapQtCertificateInfoPrivate() {}; + + // copy constructor + EapQtCertificateInfoPrivate(const EapQtCertificateInfoPrivate &certInfo) + { + mCerts = certInfo.mCerts; + } + + QVariant value(int id); + void setValue(int id, QVariant newValue); + +private: + // disable assignment + EapQtCertificateInfoPrivate &operator=(const EapQtCertificateInfoPrivate&); + QHash mCerts; + +}; + + +//---------------------------------------------------------------------------- +// EapQtCertificateInfo +//---------------------------------------------------------------------------- + + +EapQtCertificateInfo::EapQtCertificateInfo() : + d_ptr(new EapQtCertificateInfoPrivate) +{ +} + +EapQtCertificateInfo::~EapQtCertificateInfo() +{ + // scoped pointer deleted automatically +} + +EapQtCertificateInfo::EapQtCertificateInfo(const EapQtCertificateInfo &certInfo) : + d_ptr(new EapQtCertificateInfoPrivate(*(certInfo.d_ptr))) +{ +} + +EapQtCertificateInfo& EapQtCertificateInfo::operator=(const EapQtCertificateInfo &certInfo) +{ + // check if assigning to myself + if (this != &certInfo) { + d_ptr.reset(new EapQtCertificateInfoPrivate(*(certInfo.d_ptr))); + } + return *this; +} + +QVariant EapQtCertificateInfo::value(ItemId id) const +{ + // check for valid range, otherwise memory is consumed for no reason + if(id >= ItemIdLast) { + qDebug("ERROR: EapQtCertificateInfo::value - invalid id!"); + return QVariant::Invalid; + } + return d_ptr->mCerts[id]; +} + +void EapQtCertificateInfo::setValue(ItemId id, QVariant newValue) +{ + // check for valid range, otherwise memory is consumed for no reason + if(id < ItemIdLast) { + d_ptr->mCerts[id] = newValue; + } else { + qDebug("ERROR: EapQtCertificateInfo::setValue - invalid id!"); + } + return; +} + +bool EapQtCertificateInfo::operator==(const EapQtCertificateInfo & rhs ) const +{ + bool ret = true; + if (d_ptr->mCerts.size() != rhs.d_ptr->mCerts.size()) { + qWarning("EapQtCertificateInfo::operator==(): size: expect %d, actual %d ", + d_ptr->mCerts.size(), + rhs.d_ptr->mCerts.size() ); + ret = false; + } + QHashIterator i(d_ptr->mCerts); + + while (i.hasNext()) { + i.next(); + if (!rhs.d_ptr->mCerts.contains(i.key())){ + qWarning("EapQtCertificateInfo::operator==(): key not found: %d", i.key()); + ret = false; + + } + if (i.value() != rhs.d_ptr->mCerts[i.key()]){ + qWarning("EapQtCertificateInfo::operator==(): values not match"); + qDebug() << "Expect: " << i.value(); + qDebug() << "Actual: " << i.value(); + ret = false; + } + } + return ret; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfig.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * DUMMY: Stub for eapwizard testing + * + */ + +#ifndef EAPQTCONFIG_H +#define EAPQTCONFIG_H + +#include +#include +#include + +class EapQtConfigPrivate; + +class EapQtConfig +{ +public: + enum SettingsId + { + // see also EapSettings.h + + /*! bool */ + UsernameAutomatic, + /*! QString */ + Username, + /*! bool */ + PasswordPrompt, + /*! write-only: QString */ + Password, + /*! bool + * in read: defines if password already exists in settings database + * in write: when true, defines that password is not included in the provided + * configuration since it already exists in settings database, i.e. earlier + * set password remains unchanged */ + PasswordStored, + /*! write-only: bool + * true: clears the password from database + * false: does nothing + */ + PasswordClear, + /*! bool */ + RealmAutomatic, + /*! QString */ + Realm, + /*! bool */ + UsePseudonyms, + /*! bool */ + VerifyServerRealm, + /*! bool */ + ClientAuthenticationRequired, + /*! uint */ + SessionValidityTime, + /*! + * QList contains RFC numbers for activated ciphersuites + * + * Refer to RFC2246 chapter A.5 for the values. + * + * Supported CipherSuites by EAP Server default implementation: + * TLS_NULL_WITH_NULL_NULL = (0x0000), + * - No key exchange, no encryption and no authentication. + * TLS_RSA_WITH_RC4_128_MD5 = (0x0004), + * - RSA key exchange, RC4_128 encryption and MD5 authentication. + * NOTE this is included only because PEAP requires this cipher + * suite as a mandatory. Think carefully whether this meets your + * security requirements. + * TLS_RSA_WITH_RC4_128_SHA = (0x0005), + * - RSA key exchange, RC4_128 encryption and SHA1 authentication. + * NOTE this is included only because PEAP requires this cipher + * suite as a mandatory. Think carefully whether this meets your + * security + * requirements. + * TLS_RSA_WITH_3DES_EDE_CBC_SHA = (0x000a) + * - RSA key exchange, 3DES-EDE-CBC encryption and SHA1 + * authentication. + * TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA = (0x0016) + * - Diffie-Helmann RSA key exchange, 3DES-EDE-CBC encryption and SHA1 + * authentication. + * TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA = (0x0013) + * - Diffie-Helmann DSS key exchange, 3DES-EDE-CBC encryption and SHA1 + * authentication. + * TLS_RSA_WITH_AES_128_CBC_SHA = 0x002F + * - RSA key exchange, AES-128 encryption and SHA1 authentication. + * TLS_DHE_DSS_WITH_AES_128_CBC_SHA = 0x0032 + * - Diffie-Helmann DSS key exchange, AES-128-CBC encryption and SHA1 + * authentication. + * TLS_DHE_RSA_WITH_AES_128_CBC_SHA = 0x0033 + * - Diffie-Helmann RSA key exchange, AES-128-CBC encryption and SHA1 + * authentication. + * TLS_DH_anon_WITH_AES_128_CBC_SHA = 0x0034, + * - Supported when EAP-FAST is supported + * - Diffie-Helmann anonymous key exchange, AES-128-CBC encryption and + * SHA1 authentication. + */ + CipherSuites, + /*! bool */ + PeapVersion0Allowed, + /*! bool */ + PeapVersion1Allowed, + /*! bool */ + PeapVersion2Allowed, + /*! QList< QVariant(EapQtCertificateInfo) > */ + AuthorityCertificate, + /*! QList< QVariant(EapQtCertificateInfo) > */ + UserCertificate, + /*! QList< QVariant(EapQtPluginHandle) > */ + InnerType, + /*! EapQtPluginHandle */ + OuterType, + /*! bool */ + ProvisioningModeAuthenticated, + /*! bool */ + ProvisioningModeUnauthenticated, + /*! QString */ + PACGroupReference, + /*! bool */ + WarnADHPNoPAC, + /*! bool */ + WarnADHPNoMatchingPAC, + /*! bool */ + WarnNotDefaultServer, + /*! bool */ + UseIdentityPrivacy, + /*! bool */ + AuthorityCertificateAutomatic, + /*! marker for the last entry */ + SettingsIdLast + }; + +public: + EapQtConfig(); + EapQtConfig(const EapQtConfig& other); + ~EapQtConfig(); + + QVariant value(SettingsId id); + void setValue(SettingsId id, QVariant newValue); + QList validate( + QList ids); + void clear(); + +public: // FOR TESTING PURPOSE + bool operator==(const EapQtConfig & rhs ) const; + +private: + QHash mSettings; +}; + +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfig_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfig_stub.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * STUB: EAPWIZARD: EAP method QT configuration + * + */ + +/* + * %version: 3 % + */ + +#include "eapqtconfig.h" +#include +#include "eapqtcertificateinfo.h" +#include + +//---------------------------------------------------------------------------- +// EapQtConfig +//---------------------------------------------------------------------------- + +EapQtConfig::EapQtConfig() +{ +} + +EapQtConfig::EapQtConfig(const EapQtConfig &other) +{ + mSettings = other.mSettings; +} + +EapQtConfig::~EapQtConfig() +{ + // scoped pointer deleted automatically +} + +QVariant EapQtConfig::value(SettingsId id) +{ + // check for valid range, otherwise memory is consumed for no reason + if(id >= SettingsIdLast) { + qDebug("ERROR: EapQtConfig::value - invalid id!"); + return QVariant::Invalid; + } + return mSettings[id]; +} + +void EapQtConfig::setValue(SettingsId id, QVariant newValue) +{ + // check for valid range, otherwise memory is consumed for no reason + if(id < SettingsIdLast) { + mSettings[id] = newValue; + } else { + qDebug("ERROR: EapQtConfig::setValue - invalid id!"); + } + return; +} + +void EapQtConfig::clear() { + mSettings.clear(); + return; +} + +QList EapQtConfig::validate( + QList ids) +{ + Q_UNUSED(ids); + return QList(); +} + +bool EapQtConfig::operator==(const EapQtConfig & rhs ) const +{ + bool ret = true; + if (mSettings.size() != rhs.mSettings.size()) { + qWarning("EapQtConfig::operator==(): size: expect %d, actual %d ", + mSettings.size(), + rhs.mSettings.size() ); + ret = false; + } + QHashIterator i(mSettings); + + while (i.hasNext()) { + i.next(); + if (!rhs.mSettings.contains(i.key())){ + qWarning("EapQtConfig::operator==(): key not found: %d", i.key()); + ret = false; + + } + if (i.key() == EapQtConfig::InnerType) { + QList list1(mSettings[i.key()].toList()); + QList list2(rhs.mSettings[i.key()].toList()); + + if (list1.length() != 1 || list1.length() != list2.length()){ + qWarning("Invalid length in EapQtConfig::InnerType"); + ret = false; + } else { + EapQtPluginHandle handle1 = list1.at(0).value (); + EapQtPluginHandle handle2 = list2.at(0).value (); + if (handle1.pluginId() != handle2.pluginId()){ + qWarning("Outer: %d", handle1.pluginId()); + qWarning("Outer: %d", handle2.pluginId()); + ret = false; + } + } + } + else if (i.key() == EapQtConfig::OuterType) { + EapQtPluginHandle handle = mSettings[i.key()].value (); + EapQtPluginHandle handle2 = rhs.mSettings[i.key()].value (); + if (handle.pluginId() != handle2.pluginId()){ + qWarning("Outer: %d", handle.pluginId()); + qWarning("Outer: %d", handle2.pluginId()); + ret = false; + } + } + else if (i.key() == EapQtConfig::AuthorityCertificate || + i.key() == EapQtConfig::UserCertificate) { + QList list1(mSettings[i.key()].toList()); + QList list2(rhs.mSettings[i.key()].toList()); + + if (list1.length() != 1 || list1.length() != list2.length()) { + qWarning("Invalid length Certs %d", i.key()); + ret = false; + } else { + EapQtCertificateInfo cert1 = list1.at(0).value(); + EapQtCertificateInfo cert2 = list2.at(0).value(); + + if (!(cert1 == cert2)) { + ret = false; + qWarning("Invalid certs %d", i.key()); + } + } + } + else { + if (i.value() != rhs.mSettings[i.key()]){ + qWarning("EapQtConfig::operator==(): values does not match %d", i.key()); + qDebug() << "Expect: " << i.value(); + qDebug() << "Actual: " << rhs.mSettings[i.key()]; + ret = false; + } + } + } + return ret; +} + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfiginterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfiginterface.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP method configuration QT interface + * + */ + +/* + * %version: 5 % + */ + +#ifndef EAPQTCONFIGINTERFACE_H +#define EAPQTCONFIGINTERFACE_H + +#include +#include +#include +#include +#include +#include "eapqtconfig.h" +#include "eapqtpacstoreconfig.h" +#include "eapqtcertificateinfo.h" +#include "eapqtvalidator.h" + +class EapQtConfigInterfaceContext; +/*! + * @addtogroup group_eap_config_api + * @{ + */ + +/*! + */ +class EapQtConfigInterface +{ +public: + + enum EapBearerType + { + // EAP configuration interface for WLAN + EapBearerTypeWlan, + // EAP configuration interface for VPN + EapBearerTypeVpn, + }; + + static const int IapIdUndefined = -1; + +public: + EapQtConfigInterface(const EapBearerType bearerType, const int iapId); + ~EapQtConfigInterface(); + bool setConfigurationReference(const int iapId); + QList certificateAuthorityCertificates(); + QList userCertificates(); + + bool updateCertificates(); + + bool isSupportedOuterType(const EapQtPluginHandle& handle); + bool isSupportedInnerType(const EapQtPluginHandle& outerHandle, + const EapQtPluginHandle& innerHandle); + + bool setSelectedOuterTypes(const QList& outerHandles); + bool saveConfiguration(const EapQtPluginHandle& pluginHandle, EapQtConfig &config); + bool deleteConfiguration(); + EapQtValidator *validatorEap(EapQtExpandedEapType type, EapQtConfig::SettingsId id); + + bool readPacStoreConfiguration(EapQtPacStoreConfig &config); + bool savePacStoreConfiguration(EapQtPacStoreConfig &config); + EapQtValidator *validatorPacStore(EapQtPacStoreConfig::PacStoreSettings id); + +private: + Q_DISABLE_COPY(EapQtConfigInterface) + QStringList mCalledMethods; + + // setConfigurationReference + int mIapId; + bool mReturnSetConfigurationReference; + + // certificateAuthorityCertificates + QList mCertsCa; + + // userCertificates + QList mCertsUser; + + // isSupportedOuterType + QList mSupportedOuterTypes; + + // isSupportedInnerType + QList mSupportedInnerTypes; + int mSupportedInnerTypesOuterHandle; + + // setSelectedOuterTypes + QList mSetSelectectedOuterTypes; + bool mReturnSetSelectedOuterTypes; + + // saveConfiguration + EapQtPluginHandle::Plugin mOuterPlugin; + EapQtConfig mSaveConfigurationsOuter; + bool mReturnSaveConfigurationOuter; + EapQtPluginHandle::Plugin mInnerPlugin; + EapQtConfig mSaveConfigurationsInner; + bool mReturnSaveConfigurationInner; + + // validatorEap + QHash > mValidator; + + // readPacStoreConfiguration + EapQtPacStoreConfig mReadPacStoreConfiguration; + bool mReadPacStoreConfigurationReturn; + + // savePacStoreConfiguration + EapQtPacStoreConfig mSavePacStoreConfiguration; + bool mSavePacStoreConfigurationReturn; + + // validatorPacStore, key: EapQtPacStoreConfig::PacStoreSettings + QHash mValidatorPacStore; + + friend class EapQtConfigInterfaceContext; +}; + +/*! @} */ + +#endif + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfiginterface_context.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfiginterface_context.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,422 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ +#include + +#include "eapqtconfiginterface_context.h" +#include "eapqtvalidator_stub.h" +#include "eapqtexpandedeaptype.h" + +EapQtConfigInterfaceContext::EapQtConfigInterfaceContext() : + mEapQtConfig(NULL) +{ +} + +EapQtConfigInterfaceContext::~EapQtConfigInterfaceContext() +{ + mEapQtConfig->mValidator.clear(); +} + +void EapQtConfigInterfaceContext::setObject(EapQtConfigInterface *eapQtConfig) +{ + mEapQtConfig = eapQtConfig; +} + +void EapQtConfigInterfaceContext::createEapAkaSim(int type) +{ + QList types; + types.append((EapQtPluginHandle::Plugin)type); + setSupportedOuterTypes(types); + + setSelectectedOuterTypes(types, true); + + EapQtConfig config; + config.setValue(EapQtConfig::UsernameAutomatic, true); + config.setValue(EapQtConfig::RealmAutomatic, true); + setOuterConfig((EapQtPluginHandle::Plugin)type, config, true); +} + +void EapQtConfigInterfaceContext::createLeap( + const QString& username, + const QString& passwd) +{ + QList types; + types.append(EapQtPluginHandle::PluginLeap); + setSupportedOuterTypes(types); + + setSelectectedOuterTypes(types, true); + + EapQtConfig config; + config.setValue(EapQtConfig::UsernameAutomatic, false); + config.setValue(EapQtConfig::Username, username); + config.setValue(EapQtConfig::PasswordPrompt, false); + config.setValue(EapQtConfig::Password, passwd); + setOuterConfig(EapQtPluginHandle::PluginLeap, config, true); + + // validators + createInnerTypeValidators(EapQtPluginHandle::PluginLeap); +} + +void EapQtConfigInterfaceContext::createEapIdentifyValidators(EapQtPluginHandle::Plugin outerType) +{ + EapQtPluginHandle typeHandle(outerType); + + EapQtValidatorStub *valStub = new EapQtValidatorStub(EapQtValidator::StatusOk); + setValidator(typeHandle.type().type(), EapQtConfig::Username, valStub); + + valStub = new EapQtValidatorStub(EapQtValidator::StatusOk); + setValidator(typeHandle.type().type(), EapQtConfig::Realm, valStub); +} + +void EapQtConfigInterfaceContext::createEapTtlsPeap( + EapQtPluginHandle::Plugin type, + bool automaticCert, + bool usernameAutomatic, + const QString &username, + bool realmAutomatic, + const QString &realm, + EapQtPluginHandle::Plugin innerType) +{ + EapQtPluginHandle typeHandle(type); + + QList types; + types.append(typeHandle); + setSupportedOuterTypes(types); + setSelectectedOuterTypes(types, true); + + // Certs + QList certs; + EapQtCertificateInfo caCert; + caCert.setValue(EapQtCertificateInfo::CertificateLabel, "My Super Cert"); + certs.append(caCert); + setCertsCa(certs); + + // CREATE VALIDATOR + createEapIdentifyValidators(type); + + // CREATE CONFIGURATION FOR TTLS/PEAP + + EapQtConfig config; + config.setValue(EapQtConfig::UseIdentityPrivacy, false); + config.setValue(EapQtConfig::VerifyServerRealm, false); + config.setValue(EapQtConfig::ClientAuthenticationRequired, false); + + config.setValue(EapQtConfig::UsernameAutomatic, usernameAutomatic); + config.setValue(EapQtConfig::Username, username); + config.setValue(EapQtConfig::RealmAutomatic, realmAutomatic); + config.setValue(EapQtConfig::Realm, realm); + if (automaticCert){ + config.setValue(EapQtConfig::AuthorityCertificateAutomatic, true); + } + else { + QList caCerts; + caCerts.append(qVariantFromValue(caCert)); + config.setValue(EapQtConfig::AuthorityCertificate, caCerts); + config.setValue(EapQtConfig::AuthorityCertificateAutomatic, false); + } + if (type == EapQtPluginHandle::PluginPeap){ + if (innerType == EapQtPluginHandle::PluginEapMschapv2){ + config.setValue(EapQtConfig::PeapVersion0Allowed, true); + config.setValue(EapQtConfig::PeapVersion1Allowed, false); + } + else { + config.setValue(EapQtConfig::PeapVersion0Allowed, false); + config.setValue(EapQtConfig::PeapVersion1Allowed, true); + } + config.setValue(EapQtConfig::PeapVersion2Allowed, false); + } + QList innerTypeList; + EapQtPluginHandle inner(innerType); + innerTypeList.append(qVariantFromValue(inner)); + config.setValue(EapQtConfig::InnerType, innerTypeList); + + setOuterConfig(type, config, true); +} + +void EapQtConfigInterfaceContext::createEapTls( + QList &caCerts, + int indexForCaCert, + QList &userCerts, + int indexForUserCert) +{ + QList types; + types.append(EapQtPluginHandle::PluginEapTls); + setSupportedOuterTypes(types); + setSelectectedOuterTypes(types, true); + + // Certs + setCertsCa(caCerts); + setCertsUser(userCerts); + + // CREATE VALIDATOR + createEapIdentifyValidators(EapQtPluginHandle::PluginEapTls); + + // CREATE CONFIGURATION FOR TTLS/PEAP + + EapQtConfig config; + config.setValue(EapQtConfig::UseIdentityPrivacy, false); + config.setValue(EapQtConfig::VerifyServerRealm, false); + config.setValue(EapQtConfig::ClientAuthenticationRequired, true); + + config.setValue(EapQtConfig::UsernameAutomatic, true); + config.setValue(EapQtConfig::Username, QString()); + config.setValue(EapQtConfig::RealmAutomatic, true); + config.setValue(EapQtConfig::Realm, QString()); + + if (caCerts.length() == 0){ + config.setValue(EapQtConfig::AuthorityCertificateAutomatic, true); + } else { + QList caCertsVariant; + caCertsVariant.append(qVariantFromValue(caCerts[indexForCaCert])); + config.setValue(EapQtConfig::AuthorityCertificate, caCertsVariant); + config.setValue(EapQtConfig::AuthorityCertificateAutomatic, false); + } + + if (indexForUserCert != -1) { + QList certs; + certs.append(qVariantFromValue(userCerts[indexForUserCert])); + config.setValue(EapQtConfig::UserCertificate, certs); + } + + setOuterConfig(EapQtPluginHandle::PluginEapTls, config, true); +} + +void EapQtConfigInterfaceContext::createInner( + EapQtPluginHandle::Plugin outerType, + EapQtPluginHandle::Plugin innerType, + const QString &username, + const QString &password) +{ + EapQtPluginHandle innerHandle(innerType); + + QList types; + types.append(innerHandle); + setSupportedInnerTypes(outerType, types); + + EapQtConfig config; + EapQtPluginHandle outerTypeHandle(outerType); + config.setValue(EapQtConfig::OuterType, qVariantFromValue(outerTypeHandle)); + config.setValue(EapQtConfig::UsernameAutomatic, false); + config.setValue(EapQtConfig::Username, username); + config.setValue(EapQtConfig::PasswordPrompt, false); + config.setValue(EapQtConfig::Password, password); + setInnerConfig(innerType, config, true); + + createInnerTypeValidators(innerType); +} + +void EapQtConfigInterfaceContext::createInnerTypeValidators(EapQtPluginHandle::Plugin innerType) +{ + EapQtPluginHandle innerHandle(innerType); + + // validators + EapQtValidatorStub *valStub = new EapQtValidatorStub(EapQtValidator::StatusOk); + setValidator(innerHandle.type().type(), EapQtConfig::Username, valStub); + + valStub = new EapQtValidatorStub(EapQtValidator::StatusOk); + setValidator(innerHandle.type().type(), EapQtConfig::Password, valStub); +} + +void EapQtConfigInterfaceContext::createEapFast( + int pacState, const QString &password) +{ + QList types; + types.append(EapQtPluginHandle::PluginEapFast); + setSupportedOuterTypes(types); + setSelectectedOuterTypes(types, true); + + EapQtPacStoreConfig pacStoreConfig; + pacStoreConfig.setValue(EapQtPacStoreConfig::PacStoreState, pacState); + setPacStoreConfigRead(pacStoreConfig, true); + + if (pacState == EapQtPacStoreConfig::PacStoreStateStoreNotExists || + pacState == EapQtPacStoreConfig::PacStoreStatePasswordRequired) { + pacStoreConfig.clear(); + pacStoreConfig.setValue( + EapQtPacStoreConfig::PacStorePassword, + password); + + pacStoreConfig.setValue( + EapQtPacStoreConfig::PacStoreSavePassword, + true); + + setPacStoreConfigSave(pacStoreConfig, true); + } + + if (pacState == EapQtPacStoreConfig::PacStoreStateStoreNotExists) { + EapQtValidatorStub *validator = new EapQtValidatorStub(EapQtValidator::StatusOk); + setValidatorPacStore(EapQtPacStoreConfig::PacStorePassword, validator); + } + + if (pacState == EapQtPacStoreConfig::PacStoreStatePasswordRequired) { + EapQtValidatorStub *validator = new EapQtValidatorStub(EapQtValidator::StatusOk); + setValidatorPacStore(EapQtPacStoreConfig::PacStorePasswordConfirmation, validator); + } + + EapQtConfig config; + config.setValue(EapQtConfig::ProvisioningModeAuthenticated, false); + config.setValue(EapQtConfig::ProvisioningModeUnauthenticated, true); + config.setValue(EapQtConfig::VerifyServerRealm, false); + config.setValue(EapQtConfig::UseIdentityPrivacy, false); + + QList innerTypeList; + EapQtPluginHandle inner(EapQtPluginHandle::PluginEapMschapv2); + innerTypeList.append(qVariantFromValue(inner)); + config.setValue(EapQtConfig::InnerType, innerTypeList); + + setOuterConfig(EapQtPluginHandle::PluginEapFast, config, true); +} + +QStringList EapQtConfigInterfaceContext::calledMethods() +{ + QStringList methods = mEapQtConfig->mCalledMethods; + mEapQtConfig->mCalledMethods.clear(); + return methods; +} + +void EapQtConfigInterfaceContext::setConfigurationReference( + int iapId, + bool retValue) +{ + mEapQtConfig->mIapId = iapId; + setConfigurationReferenceReturn(retValue); +} + +void EapQtConfigInterfaceContext::setConfigurationReferenceReturn(bool retValue) +{ + mEapQtConfig->mReturnSetConfigurationReference = retValue; +} + +void EapQtConfigInterfaceContext::setCertsCa( + QList &certs) +{ + mEapQtConfig->mCertsCa = certs; +} + +void EapQtConfigInterfaceContext::setCertsUser( + QList &certs) +{ + mEapQtConfig->mCertsUser = certs; +} + +void EapQtConfigInterfaceContext::setSupportedOuterTypes( + QList &outerTypes) +{ + mEapQtConfig->mSupportedOuterTypes = outerTypes; +} + +void EapQtConfigInterfaceContext::setSupportedInnerTypes( + EapQtPluginHandle outerHandle, + QList &innerTypes) +{ + mEapQtConfig->mSupportedInnerTypes = innerTypes; + mEapQtConfig->mSupportedInnerTypesOuterHandle = outerHandle.pluginId(); +} + +void EapQtConfigInterfaceContext::setSelectectedOuterTypes( + QList &types, + bool retValue) +{ + mEapQtConfig->mSetSelectectedOuterTypes = types; + setSelectectedOuterTypesReturn(retValue); +} + +void EapQtConfigInterfaceContext::setSelectectedOuterTypesReturn(bool retValue) +{ + mEapQtConfig->mReturnSetSelectedOuterTypes = retValue; +} + +void EapQtConfigInterfaceContext::setOuterConfig( + EapQtPluginHandle::Plugin handle, + EapQtConfig &config, + bool retValue) +{ + mEapQtConfig->mOuterPlugin = handle; + mEapQtConfig->mSaveConfigurationsOuter = config; + setOuterConfigReturn(retValue); +} + +void EapQtConfigInterfaceContext::setOuterConfigReturn(bool retValue) +{ + mEapQtConfig->mReturnSaveConfigurationOuter = retValue; +} + +void EapQtConfigInterfaceContext::setInnerConfig( + EapQtPluginHandle::Plugin handle, + EapQtConfig &config, + bool retValue) +{ + mEapQtConfig->mInnerPlugin = handle; + mEapQtConfig->mSaveConfigurationsInner = config; + setInnerConfigReturn(retValue); +} + +void EapQtConfigInterfaceContext::setInnerConfigReturn(bool retValue) +{ + mEapQtConfig->mReturnSaveConfigurationInner = retValue; +} + +void EapQtConfigInterfaceContext::setValidator( + EapQtExpandedEapType::Type eapType, + EapQtConfig::SettingsId id, + EapQtValidator *validator) +{ + QCOMPARE(mEapQtConfig->mValidator[eapType][id] == NULL, true); + mEapQtConfig->mValidator[eapType][id] = validator; +} + + +EapQtValidator *EapQtConfigInterfaceContext::validator( + EapQtExpandedEapType::Type eapType, + EapQtConfig::SettingsId id) +{ + return mEapQtConfig->mValidator[eapType][id]; +} + +void EapQtConfigInterfaceContext::setPacStoreConfigRead( + EapQtPacStoreConfig &config, + bool retValue) +{ + mEapQtConfig->mReadPacStoreConfiguration = config; + setPacStoreConfigReadReturn(retValue); +} + +void EapQtConfigInterfaceContext::setPacStoreConfigReadReturn(bool retValue) +{ + mEapQtConfig->mReadPacStoreConfigurationReturn = retValue; +} + +void EapQtConfigInterfaceContext::setPacStoreConfigSave( + EapQtPacStoreConfig &config, + bool retValue) +{ + mEapQtConfig->mSavePacStoreConfiguration = config; + setPacStoreConfigSaveReturn(retValue); +} + +void EapQtConfigInterfaceContext::setPacStoreConfigSaveReturn(bool retValue) +{ + mEapQtConfig->mSavePacStoreConfigurationReturn = retValue; +} + +void EapQtConfigInterfaceContext::setValidatorPacStore(int id, EapQtValidator * validator) +{ + mEapQtConfig->mValidatorPacStore[id] = validator; +} + +EapQtValidator *EapQtConfigInterfaceContext::validatorPacStore(int id) +{ + return mEapQtConfig->mValidatorPacStore[id]; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfiginterface_context.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfiginterface_context.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +*/ + +#ifndef EAPQTCONFIGINTERFACE_CONTEXT_H +#define EAPQTCONFIGINTERFACE_CONTEXT_H + +#include "eapqtconfiginterface.h" +#include "eapqtpacstoreconfig.h" + +class EapQtConfigInterfaceContext +{ +public: + EapQtConfigInterfaceContext(); + ~EapQtConfigInterfaceContext(); + + void setObject(EapQtConfigInterface *eapQtConfig); + +public: // Helpper methods to create simple valid configurations + void createEapAkaSim(int pluginHandleEnum); + + void createLeap(const QString& username, const QString& passwd); + + void createEapIdentifyValidators(EapQtPluginHandle::Plugin outerType); + + void createEapTtlsPeap( + EapQtPluginHandle::Plugin type, + bool automaticCert, + bool usernameAutomatic, + const QString &username, + bool realmAutomatic, + const QString &realm, + EapQtPluginHandle::Plugin innerType); + + void createEapTls( + QList &caCerts, + int indexForCaCert, + QList &userCerts, + int indexForUserCert); + + void createInner( + EapQtPluginHandle::Plugin outerType, + EapQtPluginHandle::Plugin innerType, + const QString &username, + const QString &password); + + void createInnerTypeValidators(EapQtPluginHandle::Plugin innerType); + + void createEapFast(int pacState, const QString &password = QString()); + +public: // Methods to set the exact behavior of the interface + QStringList calledMethods(); + void setConfigurationReference(int iapId, bool retValue); + void setConfigurationReferenceReturn(bool retValue); + void setCertsCa(QList &certs); + void setCertsUser(QList &certs); + void setSupportedOuterTypes(QList &outerTypes); + void setSupportedInnerTypes(EapQtPluginHandle outerHandle, QList &innerTypes); + void setSelectectedOuterTypes(QList &types, bool retValue); + void setSelectectedOuterTypesReturn(bool retValue); + void setOuterConfig(EapQtPluginHandle::Plugin handle, EapQtConfig &config, bool retValue); + void setOuterConfigReturn(bool retValue); + void setInnerConfig(EapQtPluginHandle::Plugin handle, EapQtConfig &config, bool retValue); + void setInnerConfigReturn(bool retValue); + // Moved ownership to context + void setValidator( + EapQtExpandedEapType::Type eapType, + EapQtConfig::SettingsId, + EapQtValidator *validator); + + EapQtValidator *validator( + EapQtExpandedEapType::Type eapType, + EapQtConfig::SettingsId id); + + void setPacStoreConfigRead(EapQtPacStoreConfig &config, bool retValue); + void setPacStoreConfigReadReturn(bool retValue); + void setPacStoreConfigSave(EapQtPacStoreConfig &config, bool retValue); + void setPacStoreConfigSaveReturn(bool retValue); + void setValidatorPacStore(int id, EapQtValidator * validator); + + EapQtValidator *validatorPacStore(int id); + + +private: + EapQtConfigInterface* mEapQtConfig; +}; + +#endif /* EAPQTCONFIGINTERFACE_CONTEXT_H */ + +// End of File diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfiginterface_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfiginterface_stub.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Stub for EAP method configuration QT interface + * + */ + +/* + * %version: 5 % + */ + +#include +#include +#include +#include "eapqtconfiginterface.h" + +//---------------------------------------------------------------------------- +// EapQtConfigInterface +//---------------------------------------------------------------------------- + +EapQtConfigInterface::EapQtConfigInterface( + const EapBearerType bearerType, + const int iapId) +{ + mCalledMethods.append("EapQtConfigInterface"); + QCOMPARE(bearerType, EapQtConfigInterface::EapBearerTypeWlan); + QCOMPARE(iapId, EapQtConfigInterface::IapIdUndefined); +} + +EapQtConfigInterface::~EapQtConfigInterface() +{ + mCalledMethods.append("~EapQtConfigInterface"); +} + +bool EapQtConfigInterface::setConfigurationReference(const int iapId) +{ + mCalledMethods.append("setConfigurationReference"); + QCOMPARE(iapId, mIapId); + + return mReturnSetConfigurationReference; +} + +QList EapQtConfigInterface::certificateAuthorityCertificates() +{ + mCalledMethods.append("certificateAuthorityCertificates"); + return mCertsCa; +} + +QList EapQtConfigInterface::userCertificates() +{ + mCalledMethods.append("userCertificates"); + return mCertsUser; +} + + +bool EapQtConfigInterface::updateCertificates() +{ + mCalledMethods.append("updateCertificates"); + return true; +} + +bool EapQtConfigInterface::isSupportedOuterType(const EapQtPluginHandle& handle) +{ + mCalledMethods.append("isSupportedOuterType"); + return mSupportedOuterTypes.contains(handle); +} + +bool EapQtConfigInterface::isSupportedInnerType( + const EapQtPluginHandle& outerHandle, + const EapQtPluginHandle& innerHandle) +{ + mCalledMethods.append("isSupportedOuterType"); + QCOMPARE(mSupportedInnerTypesOuterHandle, (int)outerHandle.pluginId()); + return mSupportedInnerTypes.contains(innerHandle); +} + +bool EapQtConfigInterface::setSelectedOuterTypes( + const QList& outerHandles) +{ + mCalledMethods.append("setSelectedOuterTypes"); + QCOMPARE(mSetSelectectedOuterTypes, outerHandles); + return mReturnSetSelectedOuterTypes; +} + +bool EapQtConfigInterface::saveConfiguration( + const EapQtPluginHandle& pluginInfo, + EapQtConfig &config) +{ + mCalledMethods.append("saveConfiguration"); + + if (pluginInfo == mOuterPlugin) { + QCOMPARE(config == mSaveConfigurationsOuter, true); + return mReturnSaveConfigurationOuter; + } else { + QCOMPARE(pluginInfo == mInnerPlugin, true); + QCOMPARE(config == mSaveConfigurationsInner, true); + return mReturnSaveConfigurationInner; + } +} + +bool EapQtConfigInterface::deleteConfiguration() +{ + mCalledMethods.append("deleteConfiguration"); + return true; +} + +EapQtValidator *EapQtConfigInterface::validatorEap( + EapQtExpandedEapType type, + EapQtConfig::SettingsId id) +{ + mCalledMethods.append("validatorEap"); + + QCOMPARE(mValidator[type.type()][id] != NULL, true); + EapQtValidator *validator = mValidator[type.type()][id]; + mValidator[type.type()].remove(id); + return validator; +} + + +bool EapQtConfigInterface::readPacStoreConfiguration(EapQtPacStoreConfig &config) +{ + config = mReadPacStoreConfiguration; + return mReadPacStoreConfigurationReturn; +} + +bool EapQtConfigInterface::savePacStoreConfiguration(EapQtPacStoreConfig &config) +{ + QCOMPARE(config == mSavePacStoreConfiguration, true); + return mSavePacStoreConfigurationReturn; +} + +EapQtValidator *EapQtConfigInterface::validatorPacStore( + EapQtPacStoreConfig::PacStoreSettings id) +{ + mCalledMethods.append("validatorPacStore"); + + QCOMPARE(mValidatorPacStore.contains(id), true); + EapQtValidator *validator = mValidatorPacStore[id]; + mValidatorPacStore.remove(id); + return validator; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtpacstoreconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtpacstoreconfig.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP-FAST PAC store configuration data + * + */ + +/* + * %version: 2 % + */ + +#ifndef EAPQTPACSTORECONFIG_H +#define EAPQTPACSTORECONFIG_H + +#include + +class EapQtPacStoreConfig +{ +public: + + // PAC store is global, i.e. only a single PAC store exists in a device + + enum PacStoreState + { + // PAC store does not exist and needs to be created + PacStoreStateStoreNotExists = 0, + // PAC store exists but the password has not been stored and + // is needed to access the PAC store + PacStoreStatePasswordRequired, + // PAC store password has been stored to settings database + // and is not needed to use the PAC store + PacStoreStatePasswordStored, + // TODO: remove? delete automatically if corrupted + // Existing PAC store is corrupted and should be reset + PacStoreStateCorrupted, + // marker for the last item + PacStoreStateLast + }; + + enum PacStoreSettings + { + /*! write-only: QString + * password to be used for accessing the PAC store + * - must be new password if the read PacStoreState is PacStoreStateStoreNotExists + * - must be password of the existing PAC store if the PacStoreState state is + * PacStoreStatePasswordRequired */ + PacStorePassword = 0, + /*! write-only: bool + * true: saves the password given in settings + * false: clears the earlier stored password from database, i.e. password + * will be prompted when needed, PAC store itself remains valid + * QVariant::Invalid: no actions */ + PacStoreSavePassword, + /*! write-only: bool + * true: deletes PAC store, i.e. clears everything related to the + * existing PAC store inlcuding saved password + * false/QVariant::Invalid: no actions */ + PacStoreReset, + /*! read-only: int (PacStoreState) */ + PacStoreState, + /*! no write nor read operation, for validator usage only + * - uses the validator to check if the given password + * can open the existing PAC store */ + PacStorePasswordConfirmation, + // marker for the last item + PacStoreLast + }; + +public: + EapQtPacStoreConfig(); + ~EapQtPacStoreConfig(); + + QVariant value(PacStoreSettings id); + void setValue(PacStoreSettings id, QVariant newValue); + void clear(); + +public: // FOR TESTING PURPOSE + bool operator==(const EapQtPacStoreConfig & rhs ) const; + bool operator=(const EapQtPacStoreConfig & rhs ); + +private: + QHash mPacStoreSettings; +}; + +#endif /* EAPQTPACSTORECONFIG_H */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtpacstoreconfig_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtpacstoreconfig_stub.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP-FAST PAC store configuration data + * + */ + +/* + * %version: 2 % + */ +#include +#include + +EapQtPacStoreConfig::EapQtPacStoreConfig() +{ +} + +EapQtPacStoreConfig::~EapQtPacStoreConfig() +{ + // scoped pointer deleted automatically +} + +QVariant EapQtPacStoreConfig::value(PacStoreSettings id) +{ + // check for valid range, otherwise memory is consumed for no reason + if(id >= PacStoreLast) { + qDebug("ERROR: EapQtPacStoreConfig::value - invalid id!"); + return QVariant::Invalid; + } + return mPacStoreSettings[id]; +} + +void EapQtPacStoreConfig::setValue(PacStoreSettings id, QVariant newValue) +{ + // check for valid range, otherwise memory is consumed for no reason + if(id < PacStoreLast) { + mPacStoreSettings[id] = newValue; + } else { + qDebug("ERROR: EapQtPacStoreConfig::setValue - invalid id!"); + } +} + +void EapQtPacStoreConfig::clear() { + mPacStoreSettings.clear(); +} + +bool EapQtPacStoreConfig::operator==(const EapQtPacStoreConfig & rhs ) const +{ + bool ret = true; + if (mPacStoreSettings.size() != rhs.mPacStoreSettings.size()) { + qWarning("EapQtPacStoreConfig::operator==(): size: expect %d, actual %d ", + mPacStoreSettings.size(), + rhs.mPacStoreSettings.size() ); + ret = false; + } + QHashIterator i(mPacStoreSettings); + + while (i.hasNext()) { + i.next(); + if (!rhs.mPacStoreSettings.contains(i.key())){ + qWarning("EapQtPacStoreConfig::operator==(): key not found: %d", i.key()); + ret = false; + + } + if (i.value() != rhs.mPacStoreSettings[i.key()]){ + qWarning("EapQtPacStoreConfig::operator==(): values not match"); + qDebug() << "Expect: " << i.value(); + qDebug() << "Actual: " << rhs.mPacStoreSettings[i.key()]; + ret = false; + } + } + return ret; +} + + +bool EapQtPacStoreConfig::operator=(const EapQtPacStoreConfig & rhs ) +{ + mPacStoreSettings = rhs.mPacStoreSettings; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtvalidator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtvalidator.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Stub for EAP WIZARD testing: EAP QT configuration validator interface + * + */ + +/* + * %version: 2 % + */ + +#ifndef EAPQTVALIDATOR_H +#define EAPQTVALIDATOR_H + +#include +#include + +/*! + * @addtogroup group_eap_config_api + * @{ + */ + +class HbLineEdit; + +/*! + * Eap Qt Validator interface. This interface provides a method to configure + * the editor to use required constraints, hints, editor classes and so one + * depending on the EAP type and the configuration identifier. + * See updateEditor() method for further details. + * + * Another important method of this class is the validate() method. With + * that method you can check that the content and format is valid for + * given configuration compination. + * + * An instance of validator can be created with + * EapQtConfigInterface::validatorEap() method. + */ + +class EapQtValidator +{ +public: + + /*! + * Validation status. + */ + enum Status { + /// Ok + StatusOk, + /// Content is invalid + StatusInvalid, + /// The length is not valid + StatusInvalidLength, + /// Invalid characters detected + StatusInvalidCharacters, + /// Input is too short + StatusTooShort, + /// Input is too long + StatusTooLong, + }; + +public: + + EapQtValidator() {}; + virtual ~EapQtValidator() {}; + virtual Status validate(QVariant value) = 0; + virtual void updateEditor(HbLineEdit* edit) = 0; + +private: + + Q_DISABLE_COPY(EapQtValidator) +}; + +/*! @} */ + +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtvalidator_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtvalidator_stub.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP method validator: Stub or EapWizard testing + * + */ + +#include "eapqtvalidator_stub.h" + +EapQtValidatorStub::EapQtValidatorStub( + EapQtValidator::Status status) : + mStatus(status) +{ +} + +EapQtValidatorStub::~EapQtValidatorStub() +{ +} + +EapQtValidator::Status EapQtValidatorStub::validate(QVariant value) +{ + Q_UNUSED(value); + return mStatus; +} + +void EapQtValidatorStub::updateEditor(HbLineEdit *edit) +{ + Q_UNUSED(edit); +} + +void EapQtValidatorStub::setReturnValue(EapQtValidator::Status status) +{ + mStatus = status; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtvalidator_stub.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtvalidator_stub.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Stub for EAP WIZARD testing: EAP QT configuration validator interface + * + */ + +/* + * %version: 2 % + */ + +#ifndef EAPQTVALIDATOR_STUB_H +#define EAPQTVALIDATOR_STUB_H + +#include + +/*! + * @addtogroup group_eap_config_api + * @{ + */ + +class HbLineEdit; + +class EapQtValidatorStub : public EapQtValidator +{ + +public: + + EapQtValidatorStub(EapQtValidator::Status status); + ~EapQtValidatorStub(); + virtual EapQtValidator::Status validate(QVariant value); + void updateEditor(HbLineEdit* edit ); + void setReturnValue(EapQtValidator::Status status); + +private: + EapQtValidator::Status mStatus; + Q_DISABLE_COPY(EapQtValidatorStub) +}; + +/*! @} */ + +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/stubs.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/stubs.pri Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,47 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# +# Description: +# Stubs for Wlan wizard testing +# + +DEFINES += BUILD_WLANQTUTILITIES_DLL + +HEADERS += \ + stubs/eapqtcertificateinfo.h \ + stubs/eapqtconfig.h \ + stubs/eapqtconfiginterface.h \ + stubs/eapqtconfiginterface_context.h \ + stubs/eapqtpacstoreconfig.h \ + stubs/eapqtvalidator.h \ + stubs/eapqtvalidator_stub.h \ + stubs/wlanmgmtclient.h \ + stubs/wlanmgmtclient_context.h \ + stubs/wlanqtutils.h \ + stubs/wlanqtutils_context.h \ + stubs/wlanqtutilsap.h \ + stubs/wlanqtutilscommon.h + +SOURCES += \ + stubs/eapqtcertificateinfo_stub.cpp \ + stubs/eapqtconfig_stub.cpp \ + stubs/eapqtconfiginterface_stub.cpp \ + stubs/eapqtconfiginterface_context.cpp \ + stubs/eapqtpacstoreconfig_stub.cpp \ + stubs/eapqtvalidator_stub.cpp \ + stubs/wlanmgmtclient_stub.cpp \ + stubs/wlanmgmtclient_context.cpp \ + stubs/wlanqtutils_context.cpp \ + stubs/wlanqtutils_stub.cpp \ + stubs/wlanqtutilsap_stub.cpp diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanmgmtclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanmgmtclient.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Management API stubbing for WLAN Qt Utilities. +*/ + +#ifndef WLANMGMTCLIENT_H +#define WLANMGMTCLIENT_H + +#include "wlanmgmtcommon.h" +#include "wlanscaninfo.h" + +class WlanMgmtClientContext; + +// CLASS DECLARATION + +class CWlanMgmtClient : public CBase + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + * @return Pointer to the constructed object. + */ + static CWlanMgmtClient* NewL(); + + /** + * Destructor. + */ + ~CWlanMgmtClient(); + + /** + * Start Protected Setup. + * + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aSsid SSID of the network to configure. + * @param aWpsPin PIN value to be used. "00000000" (string of eight zeros) + * if push button method is used. + * @param aCredentials Results of a successful Protected Setup operation. + * @sa \link psetup Protected Setup-specific error codes \endlink. + */ + virtual void RunProtectedSetup( + TRequestStatus& aStatus, + const TWlanSsid& aSsid, + const TWlanWpsPin& aWpsPin, + CArrayFixSeg& aCredentials ); + + /** + * Cancel an outstanding Protected Setup operation. + */ + virtual void CancelProtectedSetup(); + + private: // Data + + CWlanMgmtClient(); + CArrayFixSeg *iResults; + TWlanSsid iSsid; + TInt iCompletionCode; + + friend class WlanMgmtClientContext; + }; + +#endif // WLANMGMTCLIENT_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanmgmtclient_context.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanmgmtclient_context.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ +#include + +#include "wlanmgmtclient_context.h" + +WlanMgmtClientContext::WlanMgmtClientContext() : + mWlanMgmtClient(NULL) +{ +} + +WlanMgmtClientContext::~WlanMgmtClientContext() +{ +} + +void WlanMgmtClientContext::setObject(CWlanMgmtClient *wlanMgmtClient) +{ + mWlanMgmtClient = wlanMgmtClient; +} + + +void WlanMgmtClientContext::setRunProtectedSetup(const QString &ssid, int completionCode) +{ + mWlanMgmtClient->iSsid.Copy((unsigned char*)ssid.toAscii().constData()); + mWlanMgmtClient->iCompletionCode = completionCode; +} + +void WlanMgmtClientContext::appendResult( + const QString &ssid, + int securityMode, + int operatingMode, + int defaultWepKeyIndex, + const QString &wepKey1, + const QString &wepKey2, + const QString &wepKey3, + const QString &wepKey4, + const QString &wpaKey) +{ + TWlanProtectedSetupCredentialAttribute attr; + + attr.iOperatingMode =(TWlanOperatingMode)operatingMode; + attr.iSecurityMode = (TWlanIapSecurityMode)securityMode; + + attr.iSsid.Copy( + (unsigned char*)ssid.toLatin1().constData(), + ssid.length()); + + attr.iWepKey1.Copy( + (unsigned char*)wepKey1.toLatin1().constData(), + wepKey1.length()); + + attr.iWepKey2.Copy( + (unsigned char*)wepKey2.toLatin1().constData(), + wepKey2.length()); + + attr.iWepKey3.Copy( + (unsigned char*)wepKey3.toLatin1().constData(), + wepKey3.length()); + + attr.iWepKey4.Copy( + (unsigned char*)wepKey4.toLatin1().constData(), + wepKey4.length()); + + attr.iWepDefaultKey = (TWlanDefaultWepKey)defaultWepKeyIndex; + + attr.iWpaPreSharedKey.Copy( + (unsigned char*)wpaKey.toLatin1().constData(), + wpaKey.length()); + + mWlanMgmtClient->iResults->AppendL(attr); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanmgmtclient_context.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanmgmtclient_context.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +*/ + +#ifndef WLANMGMTCLIENT_CONTEXT_H +#define WLANMGMTCLIENT_CONTEXT_H + +#include "wlanmgmtclient.h" + +class WlanMgmtClientContext +{ +public: + WlanMgmtClientContext(); + ~WlanMgmtClientContext(); + + void setObject(CWlanMgmtClient *eapQtConfig); +public: + + void setRunProtectedSetup(const QString &ssid, int completionCode); + void appendResult( + const QString &ssid, + int securityMode, + int operatingMode, + int defaultWepKeyIndex, + const QString &wepKey1 = QString(), + const QString &wepKey2 = QString(), + const QString &wepKey3 = QString(), + const QString &wepKey4 = QString(), + const QString &wpaKey = QString()); + +private: + CWlanMgmtClient* mWlanMgmtClient; + +}; + +#endif /* WLANMGMTCLIENT_CONTEXT_H */ + +// End of File diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanmgmtclient_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanmgmtclient_stub.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Management API stubbing for WLAN Qt Utilities. +*/ + +#include + +#include +#include +#include +#include "wlanmgmtclient.h" +#include "testwlanwizardcontext.h" + +// --------------------------------------------------------- +// CWlanScanRequest::NewL +// --------------------------------------------------------- +// +CWlanMgmtClient* CWlanMgmtClient::NewL() + { + CWlanMgmtClient* self = new CWlanMgmtClient; + + TestWlanWizardContext::setWlanMgmtClientObject(self); + return self; + } + +// --------------------------------------------------------- +// CWlanScanRequest::~CWlanMgmtClient +// --------------------------------------------------------- +// +CWlanMgmtClient::~CWlanMgmtClient() + { + delete iResults; + } + +// --------------------------------------------------------- +// CWlanScanRequest::CWlanMgmtClient +// --------------------------------------------------------- +// +CWlanMgmtClient::CWlanMgmtClient() + { + iResults = new (ELeave) CArrayFixSeg (4); + } + +// --------------------------------------------------------- +// CWlanScanRequest::RunProtectedSetup +// --------------------------------------------------------- +// +void CWlanMgmtClient::RunProtectedSetup( + TRequestStatus& aStatus, + const TWlanSsid& aSsid, + const TWlanWpsPin& aWpsPin, + CArrayFixSeg& aCredentials ) +{ + Q_UNUSED(aWpsPin); + QCOMPARE(aSsid, iSsid); + for (int i = 0 ; i < iResults->Count() ; ++i){ + aCredentials.AppendL(iResults->At(i)); + } + User::RequestComplete(&aStatus, iCompletionCode); +} + +// --------------------------------------------------------- +// CWlanScanRequest::CancelProtectedSetup +// --------------------------------------------------------- +// +void CWlanMgmtClient::CancelProtectedSetup() + { + // TODO + //User::RequestComplete(iStubRequestStatus, KErrCancel); + //iStubRequestStatus = 0; + } diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutils.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,145 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +*/ + +#ifndef STUB_WLANQTUTILS_H +#define STUB_WLANQTUTILS_H + +#include +#include +#include +#include + +#include "wlanqtutilscommon.h" +#include "wlanqtutilsap.h" + +class WlanQtUtilsIap; +class WlanQtUtilsWlanIap; + +class WLANQTUTILITIESDLL_EXPORT WlanQtUtils : public QObject +{ + Q_OBJECT + friend class WlanQtUtilsContext; +public: + //! "None" IAP ID value (e.g. for "not found" cases) + static const int IapIdNone = -1; + + /*! + WLAN connection status. + Remember to update traces/trace.properties when modifying this enum. + */ + enum ConnStatus { + ConnStatusNone = 0, //!< Reserved. + ConnStatusConnecting, //!< Connecting. + ConnStatusConnected, //!< Connected. + ConnStatusDisconnected //!< Disconnected. + }; + + /*! + WLAN scan status + Remember to update traces/trace.properties when modifying this enum. + */ + enum ScanStatus { + ScanStatusOk = 0, //!< Scan succeeded. + ScanStatusCancelled, //!< Scan was cancelled. + ScanStatusError //!< Scan failed. + }; + + /*! + Internet Connectivity Test status. + Remember to update traces/trace.properties when modifying this enum. + */ + enum IctStatus { + IctPassed = 0, //!< Normal ICT passed. + IctHotspotPassed, //!< Hotspot ICT passed. + IctCancelled, //!< ICT was cancelled. + IctFailed //!< ICT failed. + }; + +public: + WlanQtUtils(); + + ~WlanQtUtils(); + + void availableWlanAps( QList > &wlanApList); + + int createIap(const WlanQtUtilsAp *wlanAp); + + bool updateIap(int iapId, const WlanQtUtilsAp *wlanAp); + + void deleteIap(int iapId); + + void connectIap(int iapId, bool runIct = false); + + int connectedWlanId(); + + void disconnectIap(int iapId); + + int activeIap(); + + void scanWlanAps(); + + void scanWlanDirect(const QString &ssid); + + void stopWlanScan(); + +signals: + + void wlanScanApReady(int scanStatus); + + void wlanScanDirectReady(int scanStatus); + + void wlanNetworkOpened(int iapId); + + void wlanNetworkClosed(int iapId, int reason); + + void ictResult(int iapId, int result); + +private: // Return values for all methods. + + void emitScanApsReady(); + + QList > mScanWlanAps; + QList > mScanWlanDirect; + QList > *mScanResult; + QString mScanWlanDirectSsid; + int mCreateWlanIapReturn; + bool mUpdateWlanIapReturn; + + int mWlanNetworkOpenedIapId; + int mWlanNetworkActiveIapId; + int mWlanNetworkClosedIapId; + int mWlanNetworkClosedReason; + + int mActiveWlanIapReturn; + + int mIctResultIapId; + WlanQtUtils::IctStatus mIctResultResults; + + bool mConnectionSuccess; + + QStringList mCalledMethods; + + WlanQtUtilsAp *mWlanAp; + + bool mEmitScanApReady; + + int mScanApStatus; + int mScanDirectStatus; +}; + +#endif /* WLANQTUTILS_H */ + +// End of File diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutils_context.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutils_context.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +*/ + + +#include "wlanqtutils_context.h" +#include "wlanqtutils.h" +#include "wlanqtutilsap.h" + +WlanQtUtilsContext::WlanQtUtilsContext(WlanQtUtils *utils ) +: mUtils(utils) +{ + + +} + +WlanQtUtilsContext::~WlanQtUtilsContext() +{ + +} + +void WlanQtUtilsContext::setScanWlanApsResult( + QList > result ) +{ + mUtils->mScanWlanAps = result; +} + +void WlanQtUtilsContext::setScanWlanDirectResult( QString ssid, + QList > result ) +{ + mUtils->mScanWlanDirectSsid = ssid; + mUtils->mScanWlanDirect = result; +} + +void WlanQtUtilsContext::setCreateWlanIapResult(int iapId) +{ + mUtils->mCreateWlanIapReturn = iapId; + mUtils->mActiveWlanIapReturn = iapId; +} + +void WlanQtUtilsContext::setActiveWlanIapResult(int iapId) +{ + mUtils->mActiveWlanIapReturn = iapId; +} + +void WlanQtUtilsContext::setUpdateWlanIapResult(bool returnValue) +{ + mUtils->mUpdateWlanIapReturn = returnValue; +} + +void WlanQtUtilsContext::setConnectionSuccessed(bool value) +{ + mUtils->mConnectionSuccess = value; +} + +void WlanQtUtilsContext::setSignalWlanNetworkOpened(int iapId) +{ + mUtils->mWlanNetworkOpenedIapId = iapId; +} + +void WlanQtUtilsContext::setSignalWlanNetworkClosed(int iapId, int reason) +{ + mUtils->mWlanNetworkClosedIapId = iapId; + mUtils->mWlanNetworkClosedReason = reason; +} + +void WlanQtUtilsContext::setSignalIctResult(int iapId, WlanQtUtils::IctStatus result) +{ + mUtils->mIctResultIapId = iapId; + mUtils->mIctResultResults = result; +} + +void WlanQtUtilsContext::setScanApStatus(int status) +{ + mUtils->mScanApStatus = status; +} + +void WlanQtUtilsContext::setScanDirectStatus(int status) +{ + mUtils->mScanDirectStatus = status; +} + +void WlanQtUtilsContext::setImmediateApScanResult(bool immediate) +{ + mUtils->mEmitScanApReady = immediate; +} + +void WlanQtUtilsContext::emitScanApReady() +{ + mUtils->emitScanApsReady(); +} + +QStringList WlanQtUtilsContext::calledMethods() +{ + QStringList methods = mUtils->mCalledMethods; + mUtils->mCalledMethods.clear(); + return methods; +} + +bool WlanQtUtilsContext::verifyWlanIapSettings(WlanQtUtilsAp &ref) +{ + bool ret = true; + if (!mUtils->mWlanAp){ + qWarning("WlanQtUtilsContext::verifyWlanIapSettings: iap not created"); + ret = false; + } + + if (!(*(mUtils->mWlanAp) == ref)){ + qWarning("WlanQtUtilsContext::verifyWlanIapSettings: settings does not match"); + ret = false; + } + return ret; +} + +void WlanQtUtilsContext::emitWlanNetworkOpened(int iapId) +{ + emit mUtils->wlanNetworkOpened(iapId); +} + +void WlanQtUtilsContext::emitWlanNetworkClosed(int iapId, int reason) +{ + emit mUtils->wlanNetworkClosed(iapId, reason); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutils_context.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutils_context.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +*/ + +#ifndef WLANQTUTILS_CONTEXT_H +#define WLANQTUTILS_CONTEXT_H + +#include +#include + +#include "wlanqtutilscommon.h" +#include "wlanqtutils.h" + +class WlanQtUtilsWlanIap; +class WlanQtUtilsAp; + +class Q_DECL_EXPORT WlanQtUtilsContext: public QObject +{ + Q_OBJECT + +public: + WlanQtUtilsContext(WlanQtUtils *utils ); + ~WlanQtUtilsContext(); + +public: + void setScanWlanApsResult( QList > result ); + + void setScanWlanDirectResult( QString ssid, + QList > result ); + + void setCreateWlanIapResult(int iapId); + + void setActiveWlanIapResult(int iapId); + + void setUpdateWlanIapResult(bool returnValue); + + void setConnectionSuccessed(bool value); + + void setSignalWlanNetworkOpened(int iapId); + + void setSignalWlanNetworkClosed(int iapId, int reason); + + void setSignalIctResult(int iapId, WlanQtUtils::IctStatus result); + + void setImmediateApScanResult(bool immediate); + + void setScanApStatus(int status); + + void setScanDirectStatus(int status); + + void emitScanApReady(); + + QStringList calledMethods(); + + bool verifyWlanIapSettings(WlanQtUtilsAp &ref); + + void emitWlanNetworkOpened(int iapId); + void emitWlanNetworkClosed(int iapId, int reason); + +private: + WlanQtUtils* mUtils; +}; + +#endif /* WLANQTUTILS_CONTEXT_H */ + +// End of File diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutils_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutils_stub.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#include "wlanqtutilsap.h" +#include "wlanqtutils.h" +#include + +WlanQtUtils::WlanQtUtils() : mWlanAp(NULL), mEmitScanApReady(true), +mScanApStatus(ScanStatusOk), mScanDirectStatus(ScanStatusOk) +{ + mWlanNetworkActiveIapId = -1; + mCalledMethods.append("WlanQtUtils"); +} + +WlanQtUtils::~WlanQtUtils() +{ + mCalledMethods.append("~WlanQtUtils"); + delete mWlanAp; +} + +void WlanQtUtils::availableWlanAps(QList > &wlanApList) +{ + wlanApList = *mScanResult; + mCalledMethods.append("availableWlanAps"); +} + +int WlanQtUtils::createIap(const WlanQtUtilsAp * wlanAp) +{ + mCalledMethods.append("createIap"); + delete mWlanAp; + mWlanAp = new WlanQtUtilsAp(*wlanAp); + return mCreateWlanIapReturn; +} + +bool WlanQtUtils::updateIap(int iapId, const WlanQtUtilsAp * wlanAp) +{ + mCalledMethods.append("updateIap"); + qDebug("updateWlanIap iapId = %d", iapId); + qDebug("mCreateWlanIapReturn = %d", mCreateWlanIapReturn); + delete mWlanAp; + mWlanAp = new WlanQtUtilsAp(*wlanAp); + QCOMPARE(iapId, mCreateWlanIapReturn); + return mUpdateWlanIapReturn; +} + +void WlanQtUtils::deleteIap(int iapId) +{ + mCalledMethods.append("deleteIap"); + QCOMPARE(iapId, mCreateWlanIapReturn); +} + +int WlanQtUtils::connectedWlanId() +{ + mCalledMethods.append("connectedWlanId"); + return mCreateWlanIapReturn; +} + +void WlanQtUtils::connectIap(int iapId, bool runIct) +{ + qDebug("connectIap iapId = %d", iapId); + qDebug("mCreateWlanIapReturn = %d", mCreateWlanIapReturn); + mCalledMethods.append("connectIap"); + QCOMPARE(iapId, mCreateWlanIapReturn); + QCOMPARE(runIct, true); + + if (mConnectionSuccess) { + mWlanNetworkActiveIapId = iapId; + emit wlanNetworkOpened(mWlanNetworkOpenedIapId); + emit ictResult(mIctResultIapId - 1, false); + emit ictResult(mIctResultIapId, mIctResultResults); + } else { + emit wlanNetworkClosed( + mWlanNetworkClosedIapId -1, + mWlanNetworkClosedReason ); + + emit wlanNetworkClosed( + mWlanNetworkClosedIapId, + mWlanNetworkClosedReason ); + } +} + +void WlanQtUtils::disconnectIap(int iapId) +{ + qDebug("disconnectIap iapId = %d", iapId); + qDebug("mActiveWlanIapReturn = %d", mActiveWlanIapReturn); + mCalledMethods.append("disconnectIap"); + QCOMPARE(iapId, mActiveWlanIapReturn); +} + +int WlanQtUtils::activeIap() +{ + mCalledMethods.append("activeIap"); + return mActiveWlanIapReturn; +} + +void WlanQtUtils::scanWlanAps() +{ + mCalledMethods.append("scanWlanAps"); + mScanResult = &mScanWlanAps; + + if(mEmitScanApReady) { + emit wlanScanApReady(mScanApStatus); + } +} + +void WlanQtUtils::scanWlanDirect(const QString &ssid) +{ + mCalledMethods.append("scanWlanDirect"); + QCOMPARE(ssid, mScanWlanDirectSsid); + mScanResult = &mScanWlanDirect; + + emit wlanScanDirectReady(mScanDirectStatus); +} + +void WlanQtUtils::stopWlanScan() +{ + mCalledMethods.append("stopWlanScan"); +} + +void WlanQtUtils::emitScanApsReady() +{ + emit wlanScanApReady(mScanApStatus); +} + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutilsap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutilsap.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is the header file for WlanQtUtilsWlanAp class. +*/ + +#ifndef STUB_WLANQTUTILSWLANAP_H +#define STUB_WLANQTUTILSWLANAP_H + +#include +#include +#include +#include "cmmanagerdefines_shim.h" + +class QString; +class WlanQtUtilsApPrivate; + +/** + * This class represents WLAN access point (AP). + */ +class WlanQtUtilsAp : public QObject +{ +public: + /*! + * Scan Results: + * - ConfIdSsid + * - ConfIdBssid + * - ConfIdSignalStrength + * - ConfIdConnectionMode + * - ConfIdSecurityMode + * - ConfIdWpaPskUse + * - ConfIdWpsSupported + * + * IAP creation and updates: + * Mandatory for all security modes: + * - ConfIdSsid + * - ConfIdConnectionMode + * - ConfIdSecurityMode + * - ConfIdHidden + * + * Open: No extra configurations. + * 802.1x: No extra configurations. + * + * WEP: + * - ConfIdWepKey1 + * - ConfIdWepKey2 + * - ConfIdWepKey3 + * - ConfIdWepKey4 + * - ConfIdWepDefaultIndex + * + * WPA/WPA2: + * - ConfIdWpaPskUse + * - ConfIdWpaPsk + * + */ + enum ConfId{ + /// int: IAP ID, -1 for invalid IAP (WlanQtUtilsInvalidIapId) + ConfIdIapId, + /// QString: WLAN Network Name (SSID) + ConfIdSsid, + /// QString: Basic Service Set Identifier + ConfIdBssid, + /// int: signal strength in RSSI (dBm) + ConfIdSignalStrength, + /// int: (CMManagerShim::WlanNetMode) + ConfIdConnectionMode, + /// int: (CMManagerShim::WlanSecMode) + ConfIdSecurityMode, + /// bool: true - WPA PSK, false - WPA EAP + ConfIdWpaPskUse, + /// QString: Pre-Shared Key for WPA + /// Length: 8-63 - Ascii key + /// Length: 64 - Hex key + ConfIdWpaPsk, + /// QString: WEP Key for index 1: + /// HEX: + /// - 64 bit: allowed key length = 10 + /// - 128 bit: allowed key length = 26 + /// + /// ASCII: + /// - 64 bit: allowed key length = 5 + /// - 128 bit: allowed key length = 13 + ConfIdWepKey1, + /// QString: WEP Key for index 2 + ConfIdWepKey2, + /// QString: WEP Key for index 3 + ConfIdWepKey3, + /// QString: WEP Key for index 4 + ConfIdWepKey4, + /// int: (CMManagerShim::WlanWepKeyIndex): Default WEP Key index + ConfIdWepDefaultIndex, + /// bool: Is WLAN Hidden: true - hidden, false - not hidden. + ConfIdHidden, + /// bool: true - Wifi Protected setup is supported, false - not + ConfIdWpsSupported, + }; + +public: + WlanQtUtilsAp(); + WlanQtUtilsAp(const WlanQtUtilsAp &ref); + ~WlanQtUtilsAp(); + QVariant value(int identifier) const; + void setValue(int identifier, QVariant value ); + bool operator==(const WlanQtUtilsAp & rhs ) const; + + static bool compare( + const WlanQtUtilsAp *ap1, + const WlanQtUtilsAp *ap2); + +private: + WlanQtUtilsApPrivate *d_ptr; + +}; + +Q_DECLARE_METATYPE(WlanQtUtilsAp) + +#endif /* WLANQTUTILSWLANIAP_H */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutilsap_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutilsap_stub.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * This is the source file for WlanQtUtilsAp class. + */ + +#include +#include +#include +#include +#include "wlanqtutilscommon.h" +#include "wlanqtutilsap.h" + +class WlanQtUtilsApPrivate +{ + friend class WlanQtUtilsAp; + +private: + QHash mConfigurations; +}; + +WlanQtUtilsAp::WlanQtUtilsAp() : + d_ptr(new WlanQtUtilsApPrivate()) +{ +} + +WlanQtUtilsAp::WlanQtUtilsAp(const WlanQtUtilsAp &ref) : + d_ptr(new WlanQtUtilsApPrivate()) +{ + d_ptr->mConfigurations = ref.d_ptr->mConfigurations; +} + +WlanQtUtilsAp::~WlanQtUtilsAp() +{ + d_ptr->mConfigurations.clear(); + delete d_ptr; +} + +QVariant WlanQtUtilsAp::value(int identifier) const +{ + return d_ptr->mConfigurations[identifier]; +} + +void WlanQtUtilsAp::setValue(int identifier, QVariant value) +{ + d_ptr->mConfigurations[identifier] = value; +} + +bool WlanQtUtilsAp::operator==(const WlanQtUtilsAp & rhs ) const +{ + bool ret = true; + if (d_ptr->mConfigurations.size() != rhs.d_ptr->mConfigurations.size()) { + qWarning("WlanQtUtilsAp::operator==(): size: expect %d, actual %d ", + d_ptr->mConfigurations.size(), + rhs.d_ptr->mConfigurations.size() ); + ret = false; + } + QHashIterator i(d_ptr->mConfigurations); + + while (i.hasNext()) { + i.next(); + if (!rhs.d_ptr->mConfigurations.contains(i.key())){ + qWarning("WlanQtUtilsAp::operator==(): key not found: %d", i.key()); + ret = false; + + } + if (i.value() != rhs.d_ptr->mConfigurations[i.key()]){ + qWarning("WlanQtUtilsAp::operator==(): values not match %d", i.key()); + qDebug() << "Expect: " << i.value(); + qDebug() << "Actual: " << rhs.d_ptr->mConfigurations[i.key()]; + ret = false; + } + } + return ret; +} + +/*! + AP comparison function. + + @param [in] ap1 First AP to compare. + @param [in] ap2 Second AP to compare. + + @return TRUE, if APs are considered to be same. +*/ + +bool WlanQtUtilsAp::compare( + const WlanQtUtilsAp *ap1, + const WlanQtUtilsAp *ap2) +{ + bool equal = false; + + // SSID (case sensitive) and security mode (with or without PSK) + // are the values, which identify a unique access point. + if (ap1->value(WlanQtUtilsAp::ConfIdSsid) == + ap2->value(WlanQtUtilsAp::ConfIdSsid) + && ap1->value(WlanQtUtilsAp::ConfIdSecurityMode) == + ap2->value(WlanQtUtilsAp::ConfIdSecurityMode) + && ap1->value(WlanQtUtilsAp::ConfIdWpaPskUse) == + ap2->value(WlanQtUtilsAp::ConfIdWpaPskUse)) { + equal = true; + } + + return equal; +} + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutilscommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutilscommon.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef STUB_WLANQTUTILSCOMMON_H +#define STUB_WLANQTUTILSCOMMON_H +/* +#ifdef BUILD_WLAN_QT_UTILS_STUBS +#define WLANQTUTILITIESDLL_EXPORT Q_DECL_EXPORT +#else +#define WLANQTUTILITIESDLL_EXPORT Q_DECL_IMPORT +#endif +*/ +#ifdef BUILD_WLANQTUTILITIES_DLL +#define WLANQTUTILITIESDLL_EXPORT Q_DECL_EXPORT +#else +#define WLANQTUTILITIESDLL_EXPORT Q_DECL_IMPORT +#endif +// Maximum length of WLAN SSID (limit also for number of characters for user input) +static const int KMaxSsidLen = 32; +// Maximum length of WEP key +static const int KMaxWEPKeyLen = 64; +// Maximum length of WPA key +static const int KMaxWPAKeyLen = 256; + +/** + * Bearer type. + */ +enum WlanQtUtilsBearerType { + WlanQtUtilsBearerTypeNone = 0, ///< None of the bearer types. + WlanQtUtilsBearerTypeCellular , ///< Cellular (2G, 3G, 3.5G) bearer type. + WlanQtUtilsBearerTypeWlan ///< WLAN bearer type. +}; + +/** + * Connection status. + */ +enum WlanQtUtilsConnectionStatus { + WlanQtUtilsConnectionStatusNone = 0, ///< None of the connection statuses. + WlanQtUtilsConnectionStatusConnecting, ///< Connecting. + WlanQtUtilsConnectionStatusConnected, ///< Connected. + WlanQtUtilsConnectionStatusDisconnected ///< Disconnected. +}; + +/** + * Signal strength category boundaries in dB (absolute value). + * Smaller value means better signal. + */ +// TODO: WLAN signal level values valid are copied from 08wk41 Sniffer. OK? +// (WINS emulator gives just 0 which is equal to "Absolute max"...) +enum +{ + WlanQtUtilsWlanSignalStrengthAbsoluteMax = 0, ///< Absolute maximum signal strength. + WlanQtUtilsWlanSignalStrengthMax = 60, ///< Maximum signal strength. + WlanQtUtilsWlanSignalStrengthGood = 74, ///< Good signal strength. + WlanQtUtilsWlanSignalStrengthLow = 87, ///< signal strength. + WlanQtUtilsWlanSignalStrengthMin = 100, ///< Minimum signal strength. + WlanQtUtilsWlanSignalUnavailable = 9999, ///< Signal is unavailable. +}; + +/** WLAN signal is unknown. */ +const int WlanQtUtilsWlanSignalUnknown = 1000000; + +/** WLAN transmit power is unknown. */ +const unsigned WlanQtUtilsWlanTransmitPowerUnknown = 0xFFFFFFFF; + +#endif // WLANQTUTILSCOMMON_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/t_wlanwizard.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/t_wlanwizard.pro Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,141 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +include(stubs/stubs.pri) +include(ut/ut.pri) + +QT += testlib +CONFIG += hb qtestlib + +TEMPLATE = app +TARGET = t_wlanwizard + +DEPENDPATH += . +MOC_DIR = build +RCC_DIR = build + +VERSION = 0.0.1 + +DEFINES += BUILD_WLAN_WIZARD_DLL +DEFINES += BUILD_EAP_WIZARD_DLL +DEFINES += BUILD_WPS_WIZARD_DLL + +RESOURCES += ../resources/resource.qrc +RESOURCES += ../../eapwizard/resources/eapwizard_resource.qrc +RESOURCES += ../../wpswizard/resources/wpswizard_resource.qrc + +INCLUDEPATH += \ + stubs + +# OST trace system requires traces directory to be in USERINCLUDES +MMP_RULES += "USERINCLUDE ../traces" + +# WLAN WIZARD HEADERS +HEADERS += \ + ../inc/wlanwizard.h \ + ../inc/wlanwizard_p.h \ + ../inc/wlanwizardscanlist.h \ + ../inc/wlanwizardpage.h \ + ../inc/wlanwizardhelper.h \ + ../inc/wlanwizardutils.h \ + ../inc/wlanwizardpageinternal.h \ + ../inc/wlanwizardpagekeyquery.h \ + ../inc/wlanwizardpageprocessingsettings.h \ + ../inc/wlanwizardpagesummary.h \ + ../inc/wlanwizardsummaryviewitem.h \ + ../inc/wlanwizardpagegenericerror.h \ + ../inc/wlanwizardpagenetworkmode.h \ + ../inc/wlanwizardpagescanning.h \ + ../inc/wlanwizardpagesecuritymode.h \ + ../inc/wlanwizardpagessid.h + +# WLAN WIZARD SOURCES +SOURCES += \ + ../src/wlanwizard.cpp \ + ../src/wlanwizard_p.cpp \ + ../src/wlanwizardscanlist.cpp \ + ../src/wlanwizardutils.cpp \ + ../src/wlanwizardpageinternal.cpp \ + ../src/wlanwizardpagekeyquery.cpp \ + ../src/wlanwizardpageprocessingsettings.cpp \ + ../src/wlanwizardpagesummary.cpp \ + ../src/wlanwizardsummaryviewitem.cpp \ + ../src/wlanwizardpagegenericerror.cpp \ + ../src/wlanwizardpagenetworkmode.cpp \ + ../src/wlanwizardpagescanning.cpp \ + ../src/wlanwizardpagesecuritymode.cpp \ + ../src/wlanwizardpagessid.cpp + +# EAP Wizard headers +HEADERS += \ + ../../eapwizard/inc/eapwizard.h \ + ../../eapwizard/inc/eapwizard_p.h \ + ../../eapwizard/inc/eapwizardpage.h \ + ../../eapwizard/inc/eapwizardpageoutertype.h \ + ../../eapwizard/inc/eapwizardpagecertca.h \ + ../../eapwizard/inc/eapwizardpagecertuser.h \ + ../../eapwizard/inc/eapwizardpageidentity.h \ + ../../eapwizard/inc/eapwizardpageinnertype.h \ + ../../eapwizard/inc/eapwizardpageusernamepassword.h \ + ../../eapwizard/inc/eapwizardpagenewpacstore.h \ + ../../eapwizard/inc/eapwizardpagepacstorepasswordconfirm.h + +# EAP Wizard sources +SOURCES += \ + ../../eapwizard/src/eapwizard.cpp \ + ../../eapwizard/src/eapwizard_p.cpp \ + ../../eapwizard/src/eapwizardpage.cpp \ + ../../eapwizard/src/eapwizardpageoutertype.cpp \ + ../../eapwizard/src/eapwizardpagecertca.cpp \ + ../../eapwizard/src/eapwizardpagecertuser.cpp \ + ../../eapwizard/src/eapwizardpageidentity.cpp \ + ../../eapwizard/src/eapwizardpageinnertype.cpp \ + ../../eapwizard/src/eapwizardpageusernamepassword.cpp \ + ../../eapwizard/src/eapwizardpagenewpacstore.cpp \ + ../../eapwizard/src/eapwizardpagepacstorepasswordconfirm.cpp + +# WPS Wizard sources +HEADERS += \ + ../../wpswizard/inc/wpswizard.h \ + ../../wpswizard/inc/wpswizard_p.h \ + ../../wpswizard/inc/wpswizardpage.h \ + ../../wpswizard/inc/wpswizardsteptwo.h \ + ../../wpswizard/inc/wpswizardstepthreebutton.h \ + ../../wpswizard/inc/wpswizardstepthreenumber.h \ + ../../wpswizard/inc/wpswizardstepfour.h \ + ../../wpswizard/inc/wpswizardstepfour_p.h \ + ../../wpswizard/inc/wpswizardstepfive.h \ + ../../wpswizard/inc/cwpsactiverunner.h \ + ../../wpswizard/inc/mwpsactiverunnercallback.h \ + +SOURCES += \ + ../../wpswizard/src/wpswizard.cpp \ + ../../wpswizard/src/wpswizard_p.cpp \ + ../../wpswizard/src/wpswizardpage.cpp \ + ../../wpswizard/src/wpswizardsteptwo.cpp \ + ../../wpswizard/src/wpswizardstepthreebutton.cpp \ + ../../wpswizard/src/wpswizardstepthreenumber.cpp \ + ../../wpswizard/src/wpswizardstepfour.cpp \ + ../../wpswizard/src/wpswizardstepfour_p.cpp \ + ../../wpswizard/src/wpswizardstepfive.cpp \ + ../../wpswizard/src/cwpsactiverunner.cpp + +LIBS += -leapqtplugininfo + +symbian: { + TARGET.CAPABILITY = ALL -TCB + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/ut/hbautotest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/ut/hbautotest.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,835 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "hbautotest.h" +#include +#include + + +const qreal STEP = 4; //How many pixels to drag before sending an event + +//Init static members +bool HbAutoTest::pointerPressed = false; +QPointF HbAutoTest::pressPoint = QPointF(); + +void HbAutoTest::mouseMove (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos, int delay) +{ + if (delay!=-1) { + QTest::qWait(delay); + } + QPointF targetPoint=QPointF(); + if (pos==QPointF()) { + targetPoint = middlePointOfWidget(widget); + } else { + targetPoint = widget->mapToScene(pos); + } + if (pointerPressed) { + //Now we should drag an item + drag(window, targetPoint); + HbAutoTestMouseEvent me ( + QEvent::MouseMove, + targetPoint.toPoint(), + window->viewport()->mapToGlobal(targetPoint.toPoint()), + Qt::NoButton, + Qt::NoButton, + Qt::NoModifier); + QSpontaneKeyEvent::setSpontaneous(&me); + qApp->notify((window->viewport()), &me); + QCoreApplication::sendPostedEvents(); + QTest::qWait(1); + } else { + HbAutoTestMouseEvent me ( + QEvent::MouseMove, + targetPoint.toPoint(), + window->viewport()->mapToGlobal(targetPoint.toPoint()), + Qt::NoButton, + Qt::NoButton, + Qt::NoModifier); + QSpontaneKeyEvent::setSpontaneous(&me); + qApp->notify((window->viewport()), &me); + QCoreApplication::sendPostedEvents(); + QTest::qWait(1); + + } + QTest::qWait(1); + QTest::qWait(1); +} + +void HbAutoTest::mousePress (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos, int delay) +{ + if (delay!=-1) { + QTest::qWait(delay); + } + pointerPressed=true; + QPointF targetPoint=QPointF(); + if (pos==QPointF()) { + targetPoint = middlePointOfWidget(widget); + } else { + targetPoint = widget->mapToScene(pos); + } + QCursor::setPos(window->mapToGlobal(targetPoint.toPoint())); + + pressPoint=targetPoint; + + HbAutoTestMouseEvent me ( + QEvent::MouseButtonPress, + targetPoint.toPoint(), + window->viewport()->mapToGlobal(targetPoint.toPoint()), + Qt::LeftButton, + Qt::LeftButton, + Qt::NoModifier); + + QSpontaneKeyEvent::setSpontaneous(&me); + qApp->notify((window->viewport()), &me); + QCoreApplication::sendPostedEvents(); + QCoreApplication::sendPostedEvents(); + QTest::qWait(1); +} + +void HbAutoTest::mouseRelease (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos, int delay) +{ + if (delay!=-1) { + QTest::qWait(delay); + } + pointerPressed=false; + QPointF targetPoint=QPointF(); + if (pos==QPointF()) { + targetPoint = middlePointOfWidget(widget); + } else { + targetPoint = widget->mapToScene(pos); + } + QCursor::setPos(window->mapToGlobal(targetPoint.toPoint())); + pressPoint=QPointF(); + HbAutoTestMouseEvent me ( + QEvent::MouseButtonRelease, + targetPoint.toPoint(), + window->viewport()->mapToGlobal(targetPoint.toPoint()), + Qt::LeftButton, + Qt::NoButton, + Qt::NoModifier); + + QSpontaneKeyEvent::setSpontaneous(&me); + qApp->notify((window->viewport()), &me); + QCoreApplication::sendPostedEvents(); + + QTest::qWait(1); + QTest::qWait(1); +} + +void HbAutoTest::mouseClick (HbAutoTestMainWindow *window, const HbWidget *widget, QPointF pos, int delay) +{ + if (delay!=-1) { + QTest::qWait(delay); + } + QPointF targetPoint=QPointF(); + if (pos==QPointF()) { + targetPoint = middlePointOfWidget(widget); + } else { + targetPoint = widget->mapToScene(pos); + } + + QCursor::setPos(window->mapToGlobal(targetPoint.toPoint())); + + HbAutoTestMouseEvent me ( + QEvent::MouseButtonPress, + targetPoint.toPoint(), + window->viewport()->mapToGlobal(targetPoint.toPoint()), + Qt::LeftButton, + Qt::LeftButton, + Qt::NoModifier); + QSpontaneKeyEvent::setSpontaneous(&me); + qApp->notify((window->viewport()), &me); + QCoreApplication::sendPostedEvents(); + //QTime currentTime = QTime::currentTime(); + //qDebug() << currentTime.toString("hh:mm:ss.zzz") << ": Left button down"; + QTest::qWait(1); + + if (delay!=-1) { + QTest::qWait(delay); + } + HbAutoTestMouseEvent me2 ( + QEvent::MouseButtonRelease, + targetPoint.toPoint(), + window->viewport()->mapToGlobal(targetPoint.toPoint()), + Qt::LeftButton, + Qt::NoButton, + Qt::NoModifier); + + QSpontaneKeyEvent::setSpontaneous(&me2); + qApp->notify((window->viewport()), &me2); + QCoreApplication::sendPostedEvents(); + //currentTime = QTime::currentTime(); + //qDebug() << currentTime.toString("hh:mm:ss.zzz") << ": Left button up"; + + QTest::qWait(1); + QTest::qWait(1); +} + +QPointF HbAutoTest::middlePointOfWidget( const HbWidget* widget) +{ + QRectF widgetRect = widget->rect(); + QRectF widgetSceneRect = widget->mapRectToScene(widgetRect); + qreal middleX = ((widgetSceneRect.right() - widgetSceneRect.left())/2)+widgetSceneRect.left(); + qreal middleY = ((widgetSceneRect.bottom() - widgetSceneRect.top())/2)+widgetSceneRect.top(); + return QPointF(middleX,middleY); +} + + + +void HbAutoTest::drag(HbAutoTestMainWindow *window, QPointF targetPoint) +{ + qreal tempX = targetPoint.x() - pressPoint.x(); + qreal tempY = targetPoint.y() - pressPoint.y(); + qreal totalTrip = sqrt ((tempX * tempX) + (tempY * tempY)); + + int numberOfSteps = qRound(totalTrip / STEP); + HbAutoTestMouseEvent me ( + QEvent::MouseMove, + targetPoint.toPoint(), + window->viewport()->mapToGlobal(targetPoint.toPoint()), + Qt::NoButton , + Qt::LeftButton, + Qt::NoModifier); + + QPointF nextPanPoint=pressPoint; + for (int i=1; imapToGlobal(nextPanPoint.toPoint())); + + me = HbAutoTestMouseEvent (QEvent::MouseMove, + nextPanPoint.toPoint(), + window->viewport()->mapToGlobal(nextPanPoint.toPoint()), + Qt::NoButton, + Qt::LeftButton, + Qt::NoModifier); + + QSpontaneKeyEvent::setSpontaneous(&me); + qApp->notify((window->viewport()), &me); + QCoreApplication::sendPostedEvents(); + } + + QCursor::setPos(window->mapToGlobal(targetPoint.toPoint())); + + //One more (or the only one) step to the target + me = HbAutoTestMouseEvent (QEvent::MouseMove, + targetPoint.toPoint(), + window->viewport()->mapToGlobal(targetPoint.toPoint()), + Qt::NoButton, + Qt::LeftButton, + Qt::NoModifier); + QSpontaneKeyEvent::setSpontaneous(&me); + qApp->notify((window->viewport()), &me); + QCoreApplication::sendPostedEvents(); +} + + +void HbAutoTest::simulateEvent(QWidget *widget, bool press, int code, + Qt::KeyboardModifiers modifier, QString text, bool repeat, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + extern int Q_TESTLIB_EXPORT defaultKeyDelay(); + + if (delay == -1 || delay < 10) // defaultKeyDelay()) + delay = 10; //defaultKeyDelay(); + if(delay > 0) + QTest::qWait(delay); +// Q_UNUSED(delay); +// QTest::qWait(10); //TODO: Remove this and reveal above out-commented code + + HbAutoTestKeyEvent a(press ? QEvent::KeyPress : QEvent::KeyRelease, code, modifier, text, repeat); + QSpontaneKeyEvent::setSpontaneous(&a); + if (!qApp->notify(widget, &a)) + QTest::qWarn("Keyboard event not accepted by receiving widget"); + } + +void HbAutoTest::sendKeyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key code, + QString text, Qt::KeyboardModifiers modifier, int delay) + { + QTEST_ASSERT(qApp); + + if (!widget) + widget = QWidget::keyboardGrabber(); + if (!widget) { + if (QWidget *apw = QApplication::activePopupWidget()) + widget = apw->focusWidget() ? apw->focusWidget() : apw; + else + widget = QApplication::focusWidget(); + } + if (!widget) + widget = QApplication::activeWindow(); + + QTEST_ASSERT(widget); + + if (action == QTest::Click) { + QPointer ptr(widget); + sendKeyEvent(QTest::Press, widget, code, text, modifier, delay); + if (!ptr) { + // if we send key-events to embedded widgets, they might be destroyed + // when the user presses Return + return; + } + sendKeyEvent(QTest::Release, widget, code, text, modifier, delay); + return; + } + + bool repeat = false; + + if (action == QTest::Press) { + if (modifier & Qt::ShiftModifier) + simulateEvent(widget, true, Qt::Key_Shift, 0, QString(), false, delay); + + if (modifier & Qt::ControlModifier) + simulateEvent(widget, true, Qt::Key_Control, modifier & Qt::ShiftModifier, QString(), false, delay); + + if (modifier & Qt::AltModifier) + simulateEvent(widget, true, Qt::Key_Alt, + modifier & (Qt::ShiftModifier | Qt::ControlModifier), QString(), false, delay); + if (modifier & Qt::MetaModifier) + simulateEvent(widget, true, Qt::Key_Meta, modifier & (Qt::ShiftModifier + | Qt::ControlModifier | Qt::AltModifier), QString(), false, delay); + simulateEvent(widget, true, code, modifier, text, repeat, delay); + } else if (action == QTest::Release) { + simulateEvent(widget, false, code, modifier, text, repeat, delay); + + if (modifier & Qt::MetaModifier) + simulateEvent(widget, false, Qt::Key_Meta, modifier, QString(), false, delay); + if (modifier & Qt::AltModifier) + simulateEvent(widget, false, Qt::Key_Alt, modifier & + (Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier), QString(), false, delay); + + if (modifier & Qt::ControlModifier) + simulateEvent(widget, false, Qt::Key_Control, + modifier & (Qt::ShiftModifier | Qt::ControlModifier), QString(), false, delay); + + if (modifier & Qt::ShiftModifier) + simulateEvent(widget, false, Qt::Key_Shift, modifier & Qt::ShiftModifier, QString(), false, delay); + } + } + +void HbAutoTest::sendKeyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key code, + char ascii, Qt::KeyboardModifiers modifier, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + QString text; + if (ascii) + text = QString(QChar::fromLatin1(ascii)); + sendKeyEvent(action, widget, code, text, modifier, delay); + } + +void HbAutoTest::keyEvent(QTest::KeyAction action, QWidget *widget, char ascii, + Qt::KeyboardModifiers modifier, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + sendKeyEvent(action, widget, asciiToKey(ascii), ascii, modifier, delay); + } + +void HbAutoTest::keyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key key, + Qt::KeyboardModifiers modifier, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + sendKeyEvent(action, widget, key, keyToAscii(key), modifier, delay); + } + +void HbAutoTest::keyClicks(QWidget *widget, const QString &sequence, + Qt::KeyboardModifiers modifier, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + for (int i=0; i < sequence.length(); i++) + keyEvent(QTest::Click, widget, sequence.at(i).toLatin1(), modifier, delay); + } + +void HbAutoTest::keyPress(QWidget *widget, char key, Qt::KeyboardModifiers modifier, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + keyEvent(QTest::Press, widget, key, modifier, delay); + } + +void HbAutoTest::keyRelease(QWidget *widget, char key, Qt::KeyboardModifiers modifier, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + keyEvent(QTest::Release, widget, key, modifier, delay); + } + +void HbAutoTest::keyClick(QWidget *widget, char key, Qt::KeyboardModifiers modifier, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + keyEvent(QTest::Click, widget, key, modifier, delay); + } + +void HbAutoTest::keyPress(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + keyEvent(QTest::Press, widget, key, modifier, delay); + } + +void HbAutoTest::keyRelease(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + keyEvent(QTest::Release, widget, key, modifier, delay); } + +void HbAutoTest::keyClick(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + keyEvent(QTest::Click, widget, key, modifier, delay); + } + +Qt::Key HbAutoTest::asciiToKey(char ascii) +{ + switch ((unsigned char)ascii) { + case 0x08: return Qt::Key_Backspace; + case 0x09: return Qt::Key_Tab; + case 0x0b: return Qt::Key_Backtab; + case 0x0d: return Qt::Key_Return; + case 0x1b: return Qt::Key_Escape; + case 0x20: return Qt::Key_Space; + case 0x21: return Qt::Key_Exclam; + case 0x22: return Qt::Key_QuoteDbl; + case 0x23: return Qt::Key_NumberSign; + case 0x24: return Qt::Key_Dollar; + case 0x25: return Qt::Key_Percent; + case 0x26: return Qt::Key_Ampersand; + case 0x27: return Qt::Key_Apostrophe; + case 0x28: return Qt::Key_ParenLeft; + case 0x29: return Qt::Key_ParenRight; + case 0x2a: return Qt::Key_Asterisk; + case 0x2b: return Qt::Key_Plus; + case 0x2c: return Qt::Key_Comma; + case 0x2d: return Qt::Key_Minus; + case 0x2e: return Qt::Key_Period; + case 0x2f: return Qt::Key_Slash; + case 0x30: return Qt::Key_0; + case 0x31: return Qt::Key_1; + case 0x32: return Qt::Key_2; + case 0x33: return Qt::Key_3; + case 0x34: return Qt::Key_4; + case 0x35: return Qt::Key_5; + case 0x36: return Qt::Key_6; + case 0x37: return Qt::Key_7; + case 0x38: return Qt::Key_8; + case 0x39: return Qt::Key_9; + case 0x3a: return Qt::Key_Colon; + case 0x3b: return Qt::Key_Semicolon; + case 0x3c: return Qt::Key_Less; + case 0x3d: return Qt::Key_Equal; + case 0x3e: return Qt::Key_Greater; + case 0x3f: return Qt::Key_Question; + case 0x40: return Qt::Key_At; + case 0x41: return Qt::Key_A; + case 0x42: return Qt::Key_B; + case 0x43: return Qt::Key_C; + case 0x44: return Qt::Key_D; + case 0x45: return Qt::Key_E; + case 0x46: return Qt::Key_F; + case 0x47: return Qt::Key_G; + case 0x48: return Qt::Key_H; + case 0x49: return Qt::Key_I; + case 0x4a: return Qt::Key_J; + case 0x4b: return Qt::Key_K; + case 0x4c: return Qt::Key_L; + case 0x4d: return Qt::Key_M; + case 0x4e: return Qt::Key_N; + case 0x4f: return Qt::Key_O; + case 0x50: return Qt::Key_P; + case 0x51: return Qt::Key_Q; + case 0x52: return Qt::Key_R; + case 0x53: return Qt::Key_S; + case 0x54: return Qt::Key_T; + case 0x55: return Qt::Key_U; + case 0x56: return Qt::Key_V; + case 0x57: return Qt::Key_W; + case 0x58: return Qt::Key_X; + case 0x59: return Qt::Key_Y; + case 0x5a: return Qt::Key_Z; + case 0x5b: return Qt::Key_BracketLeft; + case 0x5c: return Qt::Key_Backslash; + case 0x5d: return Qt::Key_BracketRight; + case 0x5e: return Qt::Key_AsciiCircum; + case 0x5f: return Qt::Key_Underscore; + case 0x60: return Qt::Key_QuoteLeft; + case 0x61: return Qt::Key_A; + case 0x62: return Qt::Key_B; + case 0x63: return Qt::Key_C; + case 0x64: return Qt::Key_D; + case 0x65: return Qt::Key_E; + case 0x66: return Qt::Key_F; + case 0x67: return Qt::Key_G; + case 0x68: return Qt::Key_H; + case 0x69: return Qt::Key_I; + case 0x6a: return Qt::Key_J; + case 0x6b: return Qt::Key_K; + case 0x6c: return Qt::Key_L; + case 0x6d: return Qt::Key_M; + case 0x6e: return Qt::Key_N; + case 0x6f: return Qt::Key_O; + case 0x70: return Qt::Key_P; + case 0x71: return Qt::Key_Q; + case 0x72: return Qt::Key_R; + case 0x73: return Qt::Key_S; + case 0x74: return Qt::Key_T; + case 0x75: return Qt::Key_U; + case 0x76: return Qt::Key_V; + case 0x77: return Qt::Key_W; + case 0x78: return Qt::Key_X; + case 0x79: return Qt::Key_Y; + case 0x7a: return Qt::Key_Z; + case 0x7b: return Qt::Key_BraceLeft; + case 0x7c: return Qt::Key_Bar; + case 0x7d: return Qt::Key_BraceRight; + case 0x7e: return Qt::Key_AsciiTilde; + + // Latin 1 codes adapted from X: keysymdef.h,v 1.21 94/08/28 16:17:06 + case 0xa0: return Qt::Key_nobreakspace; + case 0xa1: return Qt::Key_exclamdown; + case 0xa2: return Qt::Key_cent; + case 0xa3: return Qt::Key_sterling; + case 0xa4: return Qt::Key_currency; + case 0xa5: return Qt::Key_yen; + case 0xa6: return Qt::Key_brokenbar; + case 0xa7: return Qt::Key_section; + case 0xa8: return Qt::Key_diaeresis; + case 0xa9: return Qt::Key_copyright; + case 0xaa: return Qt::Key_ordfeminine; + case 0xab: return Qt::Key_guillemotleft; + case 0xac: return Qt::Key_notsign; + case 0xad: return Qt::Key_hyphen; + case 0xae: return Qt::Key_registered; + case 0xaf: return Qt::Key_macron; + case 0xb0: return Qt::Key_degree; + case 0xb1: return Qt::Key_plusminus; + case 0xb2: return Qt::Key_twosuperior; + case 0xb3: return Qt::Key_threesuperior; + case 0xb4: return Qt::Key_acute; + case 0xb5: return Qt::Key_mu; + case 0xb6: return Qt::Key_paragraph; + case 0xb7: return Qt::Key_periodcentered; + case 0xb8: return Qt::Key_cedilla; + case 0xb9: return Qt::Key_onesuperior; + case 0xba: return Qt::Key_masculine; + case 0xbb: return Qt::Key_guillemotright; + case 0xbc: return Qt::Key_onequarter; + case 0xbd: return Qt::Key_onehalf; + case 0xbe: return Qt::Key_threequarters; + case 0xbf: return Qt::Key_questiondown; + case 0xc0: return Qt::Key_Agrave; + case 0xc1: return Qt::Key_Aacute; + case 0xc2: return Qt::Key_Acircumflex; + case 0xc3: return Qt::Key_Atilde; + case 0xc4: return Qt::Key_Adiaeresis; + case 0xc5: return Qt::Key_Aring; + case 0xc6: return Qt::Key_AE; + case 0xc7: return Qt::Key_Ccedilla; + case 0xc8: return Qt::Key_Egrave; + case 0xc9: return Qt::Key_Eacute; + case 0xca: return Qt::Key_Ecircumflex; + case 0xcb: return Qt::Key_Ediaeresis; + case 0xcc: return Qt::Key_Igrave; + case 0xcd: return Qt::Key_Iacute; + case 0xce: return Qt::Key_Icircumflex; + case 0xcf: return Qt::Key_Idiaeresis; + case 0xd0: return Qt::Key_ETH; + case 0xd1: return Qt::Key_Ntilde; + case 0xd2: return Qt::Key_Ograve; + case 0xd3: return Qt::Key_Oacute; + case 0xd4: return Qt::Key_Ocircumflex; + case 0xd5: return Qt::Key_Otilde; + case 0xd6: return Qt::Key_Odiaeresis; + case 0xd7: return Qt::Key_multiply; + case 0xd8: return Qt::Key_Ooblique; + case 0xd9: return Qt::Key_Ugrave; + case 0xda: return Qt::Key_Uacute; + case 0xdb: return Qt::Key_Ucircumflex; + case 0xdc: return Qt::Key_Udiaeresis; + case 0xdd: return Qt::Key_Yacute; + case 0xde: return Qt::Key_THORN; + case 0xdf: return Qt::Key_ssharp; + case 0xe5: return Qt::Key_Aring; + case 0xe6: return Qt::Key_AE; + case 0xf7: return Qt::Key_division; + case 0xf8: return Qt::Key_Ooblique; + case 0xff: return Qt::Key_ydiaeresis; + default: QTEST_ASSERT(false); return Qt::Key(0); + } +} + +char HbAutoTest::keyToAscii(Qt::Key key) +{ + switch (key) { + case Qt::Key_Backspace: return 0x8; //BS + case Qt::Key_Tab: return 0x09; // HT + case Qt::Key_Backtab: return 0x0b; // VT + case Qt::Key_Enter: + case Qt::Key_Return: return 0x0d; // CR + case Qt::Key_Escape: return 0x1b; // ESC + case Qt::Key_Space: return 0x20; // 7 bit printable ASCII + case Qt::Key_Exclam: return 0x21; + case Qt::Key_QuoteDbl: return 0x22; + case Qt::Key_NumberSign: return 0x23; + case Qt::Key_Dollar: return 0x24; + case Qt::Key_Percent: return 0x25; + case Qt::Key_Ampersand: return 0x26; + case Qt::Key_Apostrophe: return 0x27; + case Qt::Key_ParenLeft: return 0x28; + case Qt::Key_ParenRight: return 0x29; + case Qt::Key_Asterisk: return 0x2a; + case Qt::Key_Plus: return 0x2b; + case Qt::Key_Comma: return 0x2c; + case Qt::Key_Minus: return 0x2d; + case Qt::Key_Period: return 0x2e; + case Qt::Key_Slash: return 0x2f; + case Qt::Key_0: return 0x30; + case Qt::Key_1: return 0x31; + case Qt::Key_2: return 0x32; + case Qt::Key_3: return 0x33; + case Qt::Key_4: return 0x34; + case Qt::Key_5: return 0x35; + case Qt::Key_6: return 0x36; + case Qt::Key_7: return 0x37; + case Qt::Key_8: return 0x38; + case Qt::Key_9: return 0x39; + case Qt::Key_Colon: return 0x3a; + case Qt::Key_Semicolon: return 0x3b; + case Qt::Key_Less: return 0x3c; + case Qt::Key_Equal: return 0x3d; + case Qt::Key_Greater: return 0x3e; + case Qt::Key_Question: return 0x3f; + case Qt::Key_At: return 0x40; + case Qt::Key_A: return 0x61; // 0x41 == 'A', 0x61 == 'a' + case Qt::Key_B: return 0x62; + case Qt::Key_C: return 0x63; + case Qt::Key_D: return 0x64; + case Qt::Key_E: return 0x65; + case Qt::Key_F: return 0x66; + case Qt::Key_G: return 0x67; + case Qt::Key_H: return 0x68; + case Qt::Key_I: return 0x69; + case Qt::Key_J: return 0x6a; + case Qt::Key_K: return 0x6b; + case Qt::Key_L: return 0x6c; + case Qt::Key_M: return 0x6d; + case Qt::Key_N: return 0x6e; + case Qt::Key_O: return 0x6f; + case Qt::Key_P: return 0x70; + case Qt::Key_Q: return 0x71; + case Qt::Key_R: return 0x72; + case Qt::Key_S: return 0x73; + case Qt::Key_T: return 0x74; + case Qt::Key_U: return 0x75; + case Qt::Key_V: return 0x76; + case Qt::Key_W: return 0x77; + case Qt::Key_X: return 0x78; + case Qt::Key_Y: return 0x79; + case Qt::Key_Z: return 0x7a; + case Qt::Key_BracketLeft: return 0x5b; + case Qt::Key_Backslash: return 0x5c; + case Qt::Key_BracketRight: return 0x5d; + case Qt::Key_AsciiCircum: return 0x5e; + case Qt::Key_Underscore: return 0x5f; + case Qt::Key_QuoteLeft: return 0x60; + + case Qt::Key_BraceLeft: return 0x7b; + case Qt::Key_Bar: return 0x7c; + case Qt::Key_BraceRight: return 0x7d; + case Qt::Key_AsciiTilde: return 0x7e; + + case Qt::Key_Delete: return 0; + case Qt::Key_Insert: return 0; // = 0x1006, + case Qt::Key_Pause: return 0; // = 0x1008, + case Qt::Key_Print: return 0; // = 0x1009, + case Qt::Key_SysReq: return 0; // = 0x100a, + + case Qt::Key_Clear: return 0; // = 0x100b, + + case Qt::Key_Home: return 0; // = 0x1010, // cursor movement + case Qt::Key_End: return 0; // = 0x1011, + case Qt::Key_Left: return 0; // = 0x1012, + case Qt::Key_Up: return 0; // = 0x1013, + case Qt::Key_Right: return 0; // = 0x1014, + case Qt::Key_Down: return 0; // = 0x1015, + case Qt::Key_PageUp: return 0; // = 0x1016, + case Qt::Key_PageDown: return 0; // = 0x1017, + case Qt::Key_Shift: return 0; // = 0x1020, // modifiers + case Qt::Key_Control: return 0; // = 0x1021, + case Qt::Key_Meta: return 0; // = 0x1022, + case Qt::Key_Alt: return 0; // = 0x1023, + case Qt::Key_CapsLock: return 0; // = 0x1024, + case Qt::Key_NumLock: return 0; // = 0x1025, + case Qt::Key_ScrollLock: return 0; // = 0x1026, + case Qt::Key_F1: return 0; // = 0x1030, // function keys + case Qt::Key_F2: return 0; // = 0x1031, + case Qt::Key_F3: return 0; // = 0x1032, + case Qt::Key_F4: return 0; // = 0x1033, + case Qt::Key_F5: return 0; // = 0x1034, + case Qt::Key_F6: return 0; // = 0x1035, + case Qt::Key_F7: return 0; // = 0x1036, + case Qt::Key_F8: return 0; // = 0x1037, + case Qt::Key_F9: return 0; // = 0x1038, + case Qt::Key_F10: return 0; // = 0x1039, + case Qt::Key_F11: return 0; // = 0x103a, + case Qt::Key_F12: return 0; // = 0x103b, + case Qt::Key_F13: return 0; // = 0x103c, + case Qt::Key_F14: return 0; // = 0x103d, + case Qt::Key_F15: return 0; // = 0x103e, + case Qt::Key_F16: return 0; // = 0x103f, + case Qt::Key_F17: return 0; // = 0x1040, + case Qt::Key_F18: return 0; // = 0x1041, + case Qt::Key_F19: return 0; // = 0x1042, + case Qt::Key_F20: return 0; // = 0x1043, + case Qt::Key_F21: return 0; // = 0x1044, + case Qt::Key_F22: return 0; // = 0x1045, + case Qt::Key_F23: return 0; // = 0x1046, + case Qt::Key_F24: return 0; // = 0x1047, + case Qt::Key_F25: return 0; // = 0x1048, // F25 .. F35 only on X11 + case Qt::Key_F26: return 0; // = 0x1049, + case Qt::Key_F27: return 0; // = 0x104a, + case Qt::Key_F28: return 0; // = 0x104b, + case Qt::Key_F29: return 0; // = 0x104c, + case Qt::Key_F30: return 0; // = 0x104d, + case Qt::Key_F31: return 0; // = 0x104e, + case Qt::Key_F32: return 0; // = 0x104f, + case Qt::Key_F33: return 0; // = 0x1050, + case Qt::Key_F34: return 0; // = 0x1051, + case Qt::Key_F35: return 0; // = 0x1052, + case Qt::Key_Super_L: return 0; // = 0x1053, // extra keys + case Qt::Key_Super_R: return 0; // = 0x1054, + case Qt::Key_Menu: return 0; // = 0x1055, + case Qt::Key_Hyper_L: return 0; // = 0x1056, + case Qt::Key_Hyper_R: return 0; // = 0x1057, + case Qt::Key_Help: return 0; // = 0x1058, + case Qt::Key_Direction_L: return 0; // = 0x1059, + case Qt::Key_Direction_R: return 0; // = 0x1060, + + // Latin 1 codes adapted from X: keysymdef.h,v 1.21 94/08/28 16:17:06 + case Qt::Key_nobreakspace: return char(0xa0); + case Qt::Key_exclamdown: return char(0xa1); + case Qt::Key_cent: return char(0xa2); + case Qt::Key_sterling: return char(0xa3); + case Qt::Key_currency: return char(0xa4); + case Qt::Key_yen: return char(0xa5); + case Qt::Key_brokenbar: return char(0xa6); + case Qt::Key_section: return char(0xa7); + case Qt::Key_diaeresis: return char(0xa8); + case Qt::Key_copyright: return char(0xa9); + case Qt::Key_ordfeminine: return char(0xaa); + case Qt::Key_guillemotleft: return char(0xab); // left angle quotation mar + case Qt::Key_notsign: return char(0xac); + case Qt::Key_hyphen: return char(0xad); + case Qt::Key_registered: return char(0xae); + case Qt::Key_macron: return char(0xaf); + case Qt::Key_degree: return char(0xb0); + case Qt::Key_plusminus: return char(0xb1); + case Qt::Key_twosuperior: return char(0xb2); + case Qt::Key_threesuperior: return char(0xb3); + case Qt::Key_acute: return char(0xb4); + case Qt::Key_mu: return char(0xb5); + case Qt::Key_paragraph: return char(0xb6); + case Qt::Key_periodcentered: return char(0xb7); + case Qt::Key_cedilla: return char(0xb8); + case Qt::Key_onesuperior: return char(0xb9); + case Qt::Key_masculine: return char(0xba); + case Qt::Key_guillemotright: return char(0xbb); // right angle quotation mar + case Qt::Key_onequarter: return char(0xbc); + case Qt::Key_onehalf: return char(0xbd); + case Qt::Key_threequarters: return char(0xbe); + case Qt::Key_questiondown: return char(0xbf); + case Qt::Key_Agrave: return char(0xc0); + case Qt::Key_Aacute: return char(0xc1); + case Qt::Key_Acircumflex: return char(0xc2); + case Qt::Key_Atilde: return char(0xc3); + case Qt::Key_Adiaeresis: return char(0xc4); + case Qt::Key_Aring: return char(0xe5); + case Qt::Key_AE: return char(0xe6); + case Qt::Key_Ccedilla: return char(0xc7); + case Qt::Key_Egrave: return char(0xc8); + case Qt::Key_Eacute: return char(0xc9); + case Qt::Key_Ecircumflex: return char(0xca); + case Qt::Key_Ediaeresis: return char(0xcb); + case Qt::Key_Igrave: return char(0xcc); + case Qt::Key_Iacute: return char(0xcd); + case Qt::Key_Icircumflex: return char(0xce); + case Qt::Key_Idiaeresis: return char(0xcf); + case Qt::Key_ETH: return char(0xd0); + case Qt::Key_Ntilde: return char(0xd1); + case Qt::Key_Ograve: return char(0xd2); + case Qt::Key_Oacute: return char(0xd3); + case Qt::Key_Ocircumflex: return char(0xd4); + case Qt::Key_Otilde: return char(0xd5); + case Qt::Key_Odiaeresis: return char(0xd6); + case Qt::Key_multiply: return char(0xd7); + case Qt::Key_Ooblique: return char(0xf8); + case Qt::Key_Ugrave: return char(0xd9); + case Qt::Key_Uacute: return char(0xda); + case Qt::Key_Ucircumflex: return char(0xdb); + case Qt::Key_Udiaeresis: return char(0xdc); + case Qt::Key_Yacute: return char(0xdd); + case Qt::Key_THORN: return char(0xde); + case Qt::Key_ssharp: return char(0xdf); + case Qt::Key_division: return char(0xf7); + case Qt::Key_ydiaeresis: return char(0xff); + + // multimedia/internet keys - ignored by default - see QKeyEvent c'tor + + case Qt::Key_Back : return 0; // = 0x1061, + case Qt::Key_Forward : return 0; // = 0x1062, + case Qt::Key_Stop : return 0; // = 0x1063, + case Qt::Key_Refresh : return 0; // = 0x1064, + + case Qt::Key_VolumeDown: return 0; // = 0x1070, + case Qt::Key_VolumeMute : return 0; // = 0x1071, + case Qt::Key_VolumeUp: return 0; // = 0x1072, + case Qt::Key_BassBoost: return 0; // = 0x1073, + case Qt::Key_BassUp: return 0; // = 0x1074, + case Qt::Key_BassDown: return 0; // = 0x1075, + case Qt::Key_TrebleUp: return 0; // = 0x1076, + case Qt::Key_TrebleDown: return 0; // = 0x1077, + + case Qt::Key_MediaPlay : return 0; // = 0x1080, + case Qt::Key_MediaStop : return 0; // = 0x1081, + case Qt::Key_MediaPrevious : return 0; // = 0x1082, + case Qt::Key_MediaNext : return 0; // = 0x1083, + case Qt::Key_MediaRecord: return 0; // = 0x1084, + + case Qt::Key_HomePage : return 0; // = 0x1090, + case Qt::Key_Favorites : return 0; // = 0x1091, + case Qt::Key_Search : return 0; // = 0x1092, + case Qt::Key_Standby: return 0; // = 0x1093, + case Qt::Key_OpenUrl: return 0; // = 0x1094, + + case Qt::Key_LaunchMail : return 0; // = 0x10a0, + case Qt::Key_LaunchMedia: return 0; // = 0x10a1, + case Qt::Key_Launch0 : return 0; // = 0x10a2, + case Qt::Key_Launch1 : return 0; // = 0x10a3, + case Qt::Key_Launch2 : return 0; // = 0x10a4, + case Qt::Key_Launch3 : return 0; // = 0x10a5, + case Qt::Key_Launch4 : return 0; // = 0x10a6, + case Qt::Key_Launch5 : return 0; // = 0x10a7, + case Qt::Key_Launch6 : return 0; // = 0x10a8, + case Qt::Key_Launch7 : return 0; // = 0x10a9, + case Qt::Key_Launch8 : return 0; // = 0x10aa, + case Qt::Key_Launch9 : return 0; // = 0x10ab, + case Qt::Key_LaunchA : return 0; // = 0x10ac, + case Qt::Key_LaunchB : return 0; // = 0x10ad, + case Qt::Key_LaunchC : return 0; // = 0x10ae, + case Qt::Key_LaunchD : return 0; // = 0x10af, + case Qt::Key_LaunchE : return 0; // = 0x10b0, + case Qt::Key_LaunchF : return 0; // = 0x10b1, + + default: QTEST_ASSERT(false); return 0; + } +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/ut/hbautotest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/ut/hbautotest.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,279 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef HBAUTOTEST_H +#define HBAUTOTEST_H + +#include +#include +#include + +class HbMainWindow; +class HbWidget; +class HbAutoTestMainWindow; +class HbAutoTest; +class HbAutoTestMouseEvent; +/* +INSTRUCTIONS: +The class HbAutoTest is meant to be used with Orbit applications auto testing instead of GUI testing APIs of QTestLib. + +The functions of this class is to used similarily to the related QTestLib functions. + +Use HbAutoTestMainWindow (defined below) instead of HbMainWindow to enble filtering. +Filterin filters out UI events that are not sent by function defined in HbAutoTest class. + +*/ + +class HbAutoTestMouseEvent : public QMouseEvent +{ +public: + HbAutoTestMouseEvent(Type type, const QPoint & pos, const QPoint & globalPos, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers ) + : QMouseEvent(type,pos,globalPos,button,buttons,modifiers){} +}; + +class HbAutoTestKeyEvent : public QKeyEvent +{ +public: + HbAutoTestKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text = QString(), + bool autorep = false, ushort count = 1 ) + : QKeyEvent(type, key, modifiers, text, autorep, count){} +}; + +class HbAutoTest +{ +public: + + static void mouseMove (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos = QPointF(), int delay = -1 ); + static void mousePress (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos = QPointF(), int delay = -1); + static void mouseRelease (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos = QPointF(), int delay = -1); + static void mouseClick (HbAutoTestMainWindow *window, const HbWidget *widget, QPointF pos = QPointF(), int delay = -1); + +private: + static void drag(HbAutoTestMainWindow *window, QPointF targetPoint); + static QPointF middlePointOfWidget( const HbWidget* widget); + + static bool pointerPressed; + static QPointF pressPoint; + +//Key event Part: copy-pasted from QTestLib and modified to support HbAutoTestKeyEvent to enable filtering. +//see HbAutoTestMainWindow below. +public: + + static Qt::Key asciiToKey(char ascii); + static char keyToAscii(Qt::Key key); + + static void simulateEvent(QWidget *widget, bool press, int code, + Qt::KeyboardModifiers modifier, QString text, bool repeat, int delay=-1); + + static void sendKeyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key code, + QString text, Qt::KeyboardModifiers modifier, int delay=-1); + + static void sendKeyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key code, + char ascii, Qt::KeyboardModifiers modifier, int delay=-1); + + static void keyEvent(QTest::KeyAction action, QWidget *widget, char ascii, + Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); + + static void keyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key key, + Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); + + static void keyClicks(QWidget *widget, const QString &sequence, + Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); + + static void keyPress(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); + + static void keyRelease(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); + + static void keyClick(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); + + static void keyPress(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); + + static void keyRelease(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); + + static void keyClick(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); +}; + +class HbTestEvent +{ +public: + virtual void simulate(QWidget *w) = 0; + virtual HbTestEvent *clone() const = 0; + + virtual ~HbTestEvent() {} +}; + +class HbTestKeyEvent: public HbTestEvent +{ +public: + inline HbTestKeyEvent(QTest::KeyAction action, Qt::Key key, Qt::KeyboardModifiers modifiers, int delay) + : _action(action), _delay(delay), _modifiers(modifiers), _ascii(0), _key(key) {} + inline HbTestKeyEvent(QTest::KeyAction action, char ascii, Qt::KeyboardModifiers modifiers, int delay) + : _action(action), _delay(delay), _modifiers(modifiers), + _ascii(ascii), _key(Qt::Key_unknown) {} + inline HbTestEvent *clone() const { return new HbTestKeyEvent(*this); } + + inline void simulate(QWidget *w) + { + if (_ascii == 0) + HbAutoTest::keyEvent(_action, w, _key, _modifiers, _delay); + else + HbAutoTest::keyEvent(_action, w, _ascii, _modifiers, _delay); + } + +protected: + QTest::KeyAction _action; + int _delay; + Qt::KeyboardModifiers _modifiers; + char _ascii; + Qt::Key _key; +}; + +class HbTestKeyClicksEvent: public HbTestEvent +{ +public: + inline HbTestKeyClicksEvent(const QString &keys, Qt::KeyboardModifiers modifiers, int delay) + : _keys(keys), _modifiers(modifiers), _delay(delay) {} + inline HbTestEvent *clone() const { return new HbTestKeyClicksEvent(*this); } + + inline void simulate(QWidget *w) + { + HbAutoTest::keyClicks(w, _keys, _modifiers, _delay); + } + +private: + QString _keys; + Qt::KeyboardModifiers _modifiers; + int _delay; +}; + +class HbTestDelayEvent: public HbTestEvent +{ +public: + inline HbTestDelayEvent(int msecs): _delay(msecs) {} + inline HbTestEvent *clone() const { return new HbTestDelayEvent(*this); } + + inline void simulate(QWidget * /*w*/) { QTest::qWait(_delay); } + +private: + int _delay; +}; + +class HbTestEventList: public QList +{ +public: + inline HbTestEventList() {} + inline HbTestEventList(const HbTestEventList &other): QList() + { for (int i = 0; i < other.count(); ++i) append(other.at(i)->clone()); } + inline ~HbTestEventList() + { clear(); } + inline void clear() + { qDeleteAll(*this); QList::clear(); } + + inline void addKeyClick(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { addKeyEvent(QTest::Click, qtKey, modifiers, msecs); } + inline void addKeyPress(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { addKeyEvent(QTest::Press, qtKey, modifiers, msecs); } + inline void addKeyRelease(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { addKeyEvent(QTest::Release, qtKey, modifiers, msecs); } + inline void addKeyEvent(QTest::KeyAction action, Qt::Key qtKey, + Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { append(new HbTestKeyEvent(action, qtKey, modifiers, msecs)); } + + inline void addKeyClick(char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { addKeyEvent(QTest::Click, ascii, modifiers, msecs); } + inline void addKeyPress(char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { addKeyEvent(QTest::Press, ascii, modifiers, msecs); } + inline void addKeyRelease(char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { addKeyEvent(QTest::Release, ascii, modifiers, msecs); } + inline void addKeyClicks(const QString &keys, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { append(new HbTestKeyClicksEvent(keys, modifiers, msecs)); } + inline void addKeyEvent(QTest::KeyAction action, char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { append(new HbTestKeyEvent(action, ascii, modifiers, msecs)); } + + inline void addDelay(int msecs) + { append(new HbTestDelayEvent(msecs)); } + + inline void simulate(QWidget *w) + { + for (int i = 0; i < count(); ++i) + at(i)->simulate(w); + } +}; + +class HbAutoTestMainWindow : public HbMainWindow +{ +public: + HbAutoTestMainWindow() : HbMainWindow() {} + + void mousePressEvent(QMouseEvent *event) + { + qDebug( + "HbAutoTestMainWindow::mousePressEvent: x(%d) y(%d)", + event->x(), + event->y()); + if ( dynamic_cast(event) ) { + HbMainWindow::mousePressEvent(event); + } else { + ;//Do nothing + } + } + + void mouseMoveEvent(QMouseEvent *event) + { + if ( dynamic_cast(event) ) { + HbMainWindow::mouseMoveEvent(event); + } else { + ;//Do nothing + } + } + + void mouseReleaseEvent(QMouseEvent *event) + { + if ( dynamic_cast(event) ) { + HbMainWindow::mouseReleaseEvent(event); + } else { + ;//Do nothing + } + } + + void keyPressEvent(QKeyEvent *event) + { + if ( dynamic_cast(event) ) { + HbMainWindow::keyPressEvent(event); + } else { + ;//Do nothing + } + } + void keyReleaseEvent(QKeyEvent *event) + { + if ( dynamic_cast(event) ) { + HbMainWindow::keyReleaseEvent(event); + } else { + ;//Do nothing + } + } + + void mouseDoubleClickEvent(QMouseEvent *event) + { + Q_UNUSED(event); + //Just ignore, not supported in Orbit + } +}; + + +Q_DECLARE_METATYPE(HbTestEventList) +#endif //HBAUTOTEST_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/ut/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/ut/main.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +// System includes +#include +#include +#include +#include +#include + +// User includes +#include "testwlanwizard.h" +#include "testwlanwizardeap.h" +#include "testwlanwizardconnect.h" +#include "testwlanwizardmanual.h" +#include "testwlanwizardwps.h" + +// ======== LOCAL FUNCTIONS ======== +int main(int argc, char *argv[]) +{ + qDebug("TestWlanWizard main start"); + HbApplication app(argc, argv); + int res = 0; + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + + // log folder: \epoc32\winscw\c\data + + app.setApplicationName("TestWlanWizardUtilities"); + pass[2] = "c:\\data\\TestWlanWizardUtilities.txt"; + TestWlanWizard *tcUtilities = new TestWlanWizard(); + res |= QTest::qExec(tcUtilities, 3, pass); + delete tcUtilities; + tcUtilities = NULL; + + app.setApplicationName("TestWlanWizardConnect"); + pass[2] = "c:\\data\\TestWlanWizardConnect.txt"; + TestWlanWizardConnect *tcConnect = new TestWlanWizardConnect(); + res |= QTest::qExec(tcConnect, 3, pass); + delete tcConnect; + tcConnect = NULL; + + app.setApplicationName("TestWlanWizardManual"); + pass[2] = "c:\\data\\TestWlanWizardManual.txt"; + TestWlanWizardManual *tcManual = new TestWlanWizardManual(); + res |= QTest::qExec(tcManual, 3, pass); + delete tcManual; + tcManual = NULL; + + app.setApplicationName("TestWlanWizardEap"); + pass[2] = "c:\\data\\TestWlanWizardEap.txt"; + TestWlanWizardEap *tcEap = new TestWlanWizardEap(); + res |= QTest::qExec(tcEap, 3, pass); + delete tcEap; + tcEap = NULL; + + app.setApplicationName("TestWlanWizardWps"); + pass[2] = "c:\\data\\TestWlanWizardWps.txt"; + TestWlanWizardWps *tcWps = new TestWlanWizardWps(); + res |= QTest::qExec(tcWps, 3, pass); + delete tcWps; + tcWps = NULL; + + qDebug("TestWlanWizard main exit"); + return res; +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizard.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizard.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,347 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * This is the source file for testing Wlan Wizard library. + */ + +// System includes +#include +#include + +// User includes +#include "testwlanwizard.h" +#include "wlanwizardutils.h" + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------- +// FRAMEWORK FUNCTIONS +// --------------------------------------------------------- + +/** + * This function will be called before the first test function is executed. + */ +void TestWlanWizard::initTestCase() +{ + +} + +/** + * This function will be called after the last test function was executed. + */ +void TestWlanWizard::cleanupTestCase() +{ +} + +/** + * This function will be called before each test function is executed. + */ +void TestWlanWizard::init() +{ + +} + +/** + * This function will be called after each test function is executed. + */ +void TestWlanWizard::cleanup() +{ + +} + +// --------------------------------------------------------- +// TEST CASES +// --------------------------------------------------------- + + +void TestWlanWizard::testWepHex64Valid() +{ + QString key("a0cd9fACDF"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusOk); +} + +void TestWlanWizard::testWepHex128Valid() +{ + QString key("ABCDEFabcdef0123456789AAAA"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusOk); +} + +void TestWlanWizard::testWepHexInvalidCharacters() +{ + QString key("wlanwizard"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testWepAscii64Valid() +{ + QString key("testi"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusOk); +} + +void TestWlanWizard::testWepAscii128Valid() +{ + QString key("wlanwizardjee"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusOk); +} + +void TestWlanWizard::testWepAsciiInvalidCharacters() +{ + QString key("wlanwizardje"); + key.append(QChar(31)); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testWepLength9Invalid() +{ + QString key("123456789"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); +} + +void TestWlanWizard::testWepLength11Invalid() +{ + QString key("12345678901"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); +} + +void TestWlanWizard::testWepLength25Invalid() +{ + QString key("1234567890123456789012345"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); +} + +void TestWlanWizard::testWepLength27Invalid() +{ + QString key("123456789012345678901234567"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); +} + +void TestWlanWizard::testWepLength4Invalid() +{ + QString key("1234"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); +} + +void TestWlanWizard::testWepLength6Invalid() +{ + QString key("123456"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); +} + +void TestWlanWizard::testWepLength12Invalid() +{ + QString key("123456789012"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); +} + +void TestWlanWizard::testWepLength14Invalid() +{ + QString key("12345678901234"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); +} + +// ---------------------------------------------------------------------------- +// WPA test cases +// ---------------------------------------------------------------------------- +void TestWlanWizard::testWpaHexValid() +{ + QString key("1234567890123456789012345678abcdefabcdefabcdefABCDEFABCDEFABCDEF"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusOk); +} + +void TestWlanWizard::testWpaHexInvalidCharacters() +{ + QString key("abcdefabcdefabcdefABCDEFABCDEFABCDEF123456789012345678901234567G"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} +void TestWlanWizard::testWpaAsciiLength8Valid() +{ + QString key("ictsucks"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusOk); +} + +void TestWlanWizard::testWpaAsciiLength63Valid() +{ + QString key("zxcvbnm,.-asdfghjkl'qwertyuiop1234567890qwertyuiopzxcvbnm,.-123"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusOk); +} + +void TestWlanWizard::testWpaAsciiLength64Invalid() +{ + QString key("zxcvbnm,.-asdfghjkl'qwertyuiop1234567890qwertyuiopzxcvbnm,.-1234"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testWpaAsciiInvalidCharacters() +{ + QString key("wizardrules"); + key.append(QChar(127)); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testWpaLength7Invalid() +{ + QString key("wizards"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusWpaTooShort); +} + +void TestWlanWizard::testWpaLength65Invalid() +{ + QString key("zxcvbnm,.-asdfghjkl'qwertyuiop1234567890qwertyuiopzxcvbnm,.-12345"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusWpaTooLong); +} + + +// ---------------------------------------------------------------------------- +// ASCII test cases +// ---------------------------------------------------------------------------- +void TestWlanWizard::testAsciiValidCharacters() +{ + QString key; + for (int i = 32 ; i <= 126 ; i++){ + key.append(QChar(i)); + } + WlanWizardUtils::KeyStatus status = WlanWizardUtils::isAscii(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusOk); +} + +void TestWlanWizard::testAsciiInvalidCharactersLower() +{ + QString key("wizardrules"); + key.append(QChar(31)); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::isAscii(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testAsciiInvalidCharactersUpper() +{ + QString key("wizardrules"); + key.append(QChar(127)); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::isAscii(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + + +// ---------------------------------------------------------------------------- +// HEX test cases +// ---------------------------------------------------------------------------- +void TestWlanWizard::testHexValidCharacters() +{ + QString key("abcdefABCDEF1234567890"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusOk); +} + +void TestWlanWizard::testHexInvalidCharactersDigitLower() +{ + QString key("afAF09"); + key.append(QChar(47)); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testHexInvalidCharactersDigitUpper() +{ + QString key("abc"); + key.append(QChar(58)); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testHexInvalidCharacters_a_Lower() +{ + QString key("abc"); + key.append(QChar(96)); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testHexInvalidCharacters_f_Upper() +{ + QString key("abc"); + key.append(QChar(103)); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testHexInvalidCharacters_A_Lower() +{ + QString key("abc"); + key.append(QChar(64)); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testHexInvalidCharacters_F_Upper() +{ + QString key("abc"); + key.append(QChar(71)); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testSsidValidCharacters() +{ + QString key("12345678901234567890123456789012"); + WlanWizardUtils::SsidStatus status = WlanWizardUtils::validateSsid(key); + QCOMPARE(status, WlanWizardUtils::SsidStatusOk); +} + +void TestWlanWizard::testSsidValidCharacters2() +{ + QString key("1"); + WlanWizardUtils::SsidStatus status = WlanWizardUtils::validateSsid(key); + QCOMPARE(status, WlanWizardUtils::SsidStatusOk); +} + +void TestWlanWizard::testSsidInvalidTooShort() +{ + QString key(""); + WlanWizardUtils::SsidStatus status = WlanWizardUtils::validateSsid(key); + QCOMPARE(status, WlanWizardUtils::SsidStatusInvalidLength); +} + +void TestWlanWizard::testSsidInvalidTooLong() +{ + QString key("123456789012345678901234567890123"); + WlanWizardUtils::SsidStatus status = WlanWizardUtils::validateSsid(key); + QCOMPARE(status, WlanWizardUtils::SsidStatusInvalidLength); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizard.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizard.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is the header file for testing Wlan Qt Utilities library. +*/ + +#ifndef TESTWLANWIZARD_H_ +#define TESTWLANWIZARD_H_ + +// System includes +#include + +// User includes + +// Forward declarations +class QSignalSpy; +class WlanQtUtils; + +// External data types + +// Constants + +class TestWlanWizard: public QObject +{ + Q_OBJECT + +private slots: + + // Functions from QTest framework. + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + + // WEP test cases + void testWepHex64Valid(); + void testWepHex128Valid(); + void testWepHexInvalidCharacters(); + + void testWepAscii64Valid(); + void testWepAscii128Valid(); + void testWepAsciiInvalidCharacters(); + void testWepLength9Invalid(); + void testWepLength11Invalid(); + void testWepLength25Invalid(); + void testWepLength27Invalid(); + void testWepLength4Invalid(); + void testWepLength6Invalid(); + void testWepLength12Invalid(); + void testWepLength14Invalid(); + + // WPA test cases + void testWpaHexValid(); + void testWpaHexInvalidCharacters(); + void testWpaAsciiLength8Valid(); + void testWpaAsciiLength63Valid(); + void testWpaAsciiLength64Invalid(); + void testWpaAsciiInvalidCharacters(); + void testWpaLength7Invalid(); + void testWpaLength65Invalid(); + + // ASCII test cases + void testAsciiValidCharacters(); + void testAsciiInvalidCharactersLower(); + void testAsciiInvalidCharactersUpper(); + + // HEX test cases + void testHexValidCharacters(); + void testHexInvalidCharactersDigitLower(); + void testHexInvalidCharactersDigitUpper(); + void testHexInvalidCharacters_a_Lower(); + void testHexInvalidCharacters_f_Upper(); + void testHexInvalidCharacters_A_Lower(); + void testHexInvalidCharacters_F_Upper(); + + // SSID test cases + void testSsidValidCharacters(); + void testSsidValidCharacters2(); + void testSsidInvalidTooShort(); + void testSsidInvalidTooLong(); + +private: + +}; + +#endif /* TESTWLANWIZARD_H_ */ + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardconnect.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardconnect.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,608 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "testwlanwizardconnect.h" +#include "testwlanwizardconnect_conf.h" +#include "hbautotest.h" +#include "wlanwizard.h" +#include "wlanwizard_p.h" +#include "wlanwizardpagessid.h" +#include "wlanqtutils_context.h" +#include "wlanqtutils.h" +#include "wlanqtutilsap.h" + +// External function prototypes + +// Local constants + + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------- +// TEST CASES +// --------------------------------------------------------- + +/*! + * Connect to open: + * - verifies IAP settings + * - ICT success + * - Finish button pressed + */ +void TestWlanWizardConnect::tc_connect_to_open_success() +{ +#ifdef tc_connect_to_open_success_enabled + tc_connect_success("tc_connect_to_open_success", CMManagerShim::Infra, + CMManagerShim::WlanSecModeOpen, false, ""); +#endif +} + +/*! + * Connect to open + */ +void TestWlanWizardConnect::tc_connect_to_open_success_hidden() +{ +#ifdef tc_connect_to_open_success_hidden_enabled + tc_connect_success("tc_connect_to_open_success_hidden", CMManagerShim::Infra, + CMManagerShim::WlanSecModeOpen, true, ""); +#endif +} + +/*! + * Connect to open + */ +void TestWlanWizardConnect::tc_connect_to_open_success_adhoc() +{ +#ifdef tc_connect_to_open_success_adhoc_enabled + tc_connect_success("tc_connect_to_open_success_adhoc", CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, true, ""); +#endif +} + +/*! + * Connect to open + */ +void TestWlanWizardConnect::tc_connect_to_wep_success() +{ +#ifdef tc_connect_to_wep_success_enabled + tc_connect_success("tc_connect_to_wep_success", CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeWep, true, "abcde"); +#endif +} + +/*! + * Connect to open + */ +void TestWlanWizardConnect::tc_connect_to_wpa_psk_success() +{ +#ifdef tc_connect_to_wpa_psk_success_enabled + tc_connect_success("tc_connect_to_wpa_psk_success", CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa, false, "password"); +#endif +} +/*! + * Connect to open + */ +void TestWlanWizardConnect::tc_connect_to_wpa2_psk_success() +{ +#ifdef tc_connect_to_wpa2_psk_success_enabled + tc_connect_success("tc_connect_to_wpa2_psk_success", CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeWpa2, false, "password"); +#endif +} + +/*! + * Connect to open: + * - Opens + * - ICT success + * - Cancel pressed in summary page + */ +void TestWlanWizardConnect::tc_connect_to_open_success_cancel() +{ +#ifdef tc_connect_to_open_success_cancel_enabled + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + mView->mWizard->setParameters("tc_connect_to_open_success_cancel", + CMManagerShim::Infra, + CMManagerShim::WlanSecModeOpen, false, false, false); + + mView->showWizard(); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "tc_connect_to_open_success_cancel"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QTest::qWait(WaitTimeForUi); + + // Ignore previous calls + mWlanQtUtilsContext->calledMethods(); + + QCOMPARE( mouseClickCancel(), true ); + + QStringList calledMethods; + calledMethods << "disconnectIap" << "deleteIap"; + + QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods); + QCOMPARE(verifyStatus(WizardStatusSignalCancelled), true); +#endif +} + +void TestWlanWizardConnect::tc_network_failure_OpenAuthFailed() +{ +#ifdef tc_network_failure_OpenAuthFailed_enabled + tc_network_error_codes( + "tc_network_failure_OpenAuthFailed", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, + false, + "", + hbTrId("txt_occ_dialog_authentication_unsuccessful"), + KErrWlanOpenAuthFailed ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_SharedKeyAuthRequired() +{ +#ifdef tc_network_failure_SharedKeyAuthRequired_enabled + tc_network_error_codes( + "tc_network_failure_SharedKeyAuthRequired", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, + false, + "", + hbTrId("txt_occ_dialog_authentication_unsuccessful"), + KErrWlanSharedKeyAuthRequired ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_WpaAuthRequired() +{ +#ifdef tc_network_failure_WpaAuthRequired_enabled + tc_network_error_codes( + "tc_network_failure_WpaAuthRequired", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, + false, + "", + hbTrId("txt_occ_dialog_authentication_unsuccessful"), + KErrWlanWpaAuthRequired ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_WpaAuthFailed() +{ +#ifdef tc_network_failure_WpaAuthFailed_enabled + tc_network_error_codes( + "tc_network_failure_WpaAuthFailed", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeWpa, + true, + "password", + hbTrId("txt_occ_dialog_authentication_unsuccessful"), + KErrWlanWpaAuthFailed ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_802dot1xAuthFailed() +{ +#ifdef tc_network_failure_802dot1xAuthFailed_enabled + tc_network_error_codes( + "tc_network_failure_802dot1xAuthFailed", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, + false, + "", + hbTrId("txt_occ_dialog_authentication_unsuccessful"), + KErrWlan802dot1xAuthFailed ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_IllegalEncryptionKeys() +{ +#ifdef tc_network_failure_IllegalEncryptionKeys_enabled + tc_network_error_codes( + "tc_network_failure_IllegalEncryptionKeys", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, + false, + "", + hbTrId("txt_occ_dialog_authentication_unsuccessful"), + KErrWlanIllegalEncryptionKeys ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_PskModeRequired() +{ +#ifdef tc_network_failure_PskModeRequired_enabled + tc_network_error_codes( + "tc_network_failure_PskModeRequired", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, + false, + "", + hbTrId("txt_occ_dialog_authentication_unsuccessful"), + KErrWlanPskModeRequired ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_EapModeRequired() +{ +#ifdef tc_network_failure_EapModeRequired_enabled + tc_network_error_codes( + "tc_network_failure_EapModeRequired", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, + false, + "", + hbTrId("txt_occ_dialog_authentication_unsuccessful"), + KErrWlanEapModeRequired ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_IllefalWpaPskKey() +{ +#ifdef tc_network_failure_IllefalWpaPskKey_enabled + tc_network_error_codes( + "tc_network_failure_IllefalWpaPskKey", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, + false, + "", + hbTrId("txt_occ_dialog_incorrect_wpa_preshared_key_pleas"), + KErrWlanIllegalWpaPskKey ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_SharedKeyAuthFailed() +{ +#ifdef tc_network_failure_SharedKeyAuthFailed_enabled + tc_network_error_codes( + "tc_network_failure_SharedKeyAuthFailed", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, + false, + "", + hbTrId("txt_occ_dialog_incorrect_wep_key_please_check_the"), + KErrWlanSharedKeyAuthFailed ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_ErrNone() +{ +#ifdef tc_network_failure_ErrNone_enabled + tc_network_error_codes( + "tc_network_failure_ErrNone", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, + false, + "", + hbTrId("txt_occ_dialog_incorrect_wep_key_please_check_the"), + KErrWlanSharedKeyAuthFailed ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_30180() +{ +#ifdef tc_network_failure_30180_enabled + const QString ssid("tc_network_failure_30180"); + tc_network_error_codes( + ssid, + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeWep, + false, + "abcde", + hbTrId("txt_occ_dialog_connection_failed"), + 30180 ); + + QCOMPARE( mouseClickPrevious(), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, hbTrId("txt_occ_dialog_connection_failed")), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QStringList calledMethods; + calledMethods + << "updateIap" + << "activeIap" + << "disconnectIap" + << "connectIap"; + + QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods); + +#endif +} + +void TestWlanWizardConnect::tc_iap_creation_fails() +{ +#ifdef tc_iap_creation_fails_enabled + + const QString ssid("tc_iap_creation_fails"); + + mWlanQtUtilsContext->setCreateWlanIapResult(-1); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeOpen, + false, false, false); + + mView->showWizard(); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyCurrentPageWithInfo( + WlanWizardPageInternal::PageGenericError, + hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret") ), true ); + + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QStringList calledMethods; + calledMethods << "WlanQtUtils" << "createIap"; + QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods); + + QCOMPARE( mouseClickCancel(), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyStatus(WizardStatusSignalCancelled, 2), true); + QTest::qWait(WaitTimeForUi); +#endif +} + +void TestWlanWizardConnect::tc_cancel_key_query() +{ +#ifdef tc_cancel_key_query_enabled + + const QString ssid("tc_cancel_key_query"); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeWep, + true, false, false); + mView->showWizard(); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mouseClickCancel(), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyStatus(WizardStatusSignalCancelled), true); + + mWlanQtUtilsContext->emitWlanNetworkClosed(-1, KErrCancel); + callWlanWizard_startPageOperation(); + + QStringList calledMethods; + calledMethods << "WlanQtUtils"; + QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods); +#endif +} + +/*! + * Helpper test case for testing success case with compinations of provided + * parameters. + */ +void TestWlanWizardConnect::tc_connect_success(const QString &ssid, int networkMode, + int securityMode, bool hidden, QString key) +{ + + mWlanQtUtilsContext->setCreateWlanIapResult(2); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(2); + mWlanQtUtilsContext->setSignalIctResult(2, WlanQtUtils::IctPassed); + + mView->mWizard->setParameters(ssid, networkMode, securityMode, true, hidden, false); + + WlanQtUtilsAp ap; + ap.setValue(WlanQtUtilsAp::ConfIdConnectionMode, networkMode); + ap.setValue(WlanQtUtilsAp::ConfIdSecurityMode, securityMode); + ap.setValue(WlanQtUtilsAp::ConfIdSsid, ssid); + ap.setValue(WlanQtUtilsAp::ConfIdHidden, hidden); + + // Default values + ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true ); + ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1 ); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, QString()); + + QStringList calledMethods; + calledMethods << "WlanQtUtils"; + QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods); + + mView->showWizard(); + if (securityMode == CMManagerShim::WlanSecModeWep || securityMode + == CMManagerShim::WlanSecModeWpa || securityMode == CMManagerShim::WlanSecModeWpa2) { + // Key query short pwd + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + + if (securityMode == CMManagerShim::WlanSecModeWep) { + ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, key); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, key); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, key); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, key); + ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1); + QCOMPARE( insertTextToObject("lineEditKey", "abcde"), true ); + } + else { + QCOMPARE( insertTextToObject("lineEditKey", "password"), true ); + ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, key); + ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); + } + QCOMPARE( mouseClickObject("dialog"), true ); + + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + QTest::qWait(WaitTimeForUi); + } + else { + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + QTest::qWait(WaitTimeForUi); + } + + QCOMPARE(verifySummaryPage( + ssid, + networkMode, + hidden, + securityMode, + true, + hbTrId("txt_occ_dblist_destination_val_internet")),true); + + calledMethods.clear(); + calledMethods << "createIap" << "activeIap" << "connectIap"; + QCOMPARE( mWlanQtUtilsContext->calledMethods(), calledMethods); + QCOMPARE( mWlanQtUtilsContext->verifyWlanIapSettings(ap), true); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mouseClickFinish(), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyStatus(WizardStatusSignalFinished, 2), true); +} + +/*! + * Helpper test case for testing success case with compinations of provided + * parameters. + */ +void TestWlanWizardConnect::tc_network_error_codes( + const QString &ssid, + int networkMode, + int securityMode, + bool hidden, + QString key, + const QString &errorString, + int errorCode) +{ + mWlanQtUtilsContext->setCreateWlanIapResult(2); + mWlanQtUtilsContext->setConnectionSuccessed(false); + mWlanQtUtilsContext->setSignalWlanNetworkClosed(2, errorCode); + mWlanQtUtilsContext->setActiveWlanIapResult(1); + mView->mWizard->setParameters(ssid, networkMode, securityMode, true, hidden, false); + + WlanQtUtilsAp ap; + ap.setValue(WlanQtUtilsAp::ConfIdConnectionMode, networkMode); + ap.setValue(WlanQtUtilsAp::ConfIdSecurityMode, securityMode); + ap.setValue(WlanQtUtilsAp::ConfIdSsid, ssid); + ap.setValue(WlanQtUtilsAp::ConfIdHidden, hidden); + + // Default values + ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true ); + ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1 ); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, QString()); + + QStringList calledMethods; + calledMethods << "WlanQtUtils"; + QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods); + + mView->showWizard(); + if (securityMode == CMManagerShim::WlanSecModeWep || securityMode + == CMManagerShim::WlanSecModeWpa || securityMode == CMManagerShim::WlanSecModeWpa2) { + // Key query short pwd + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + + if (securityMode == CMManagerShim::WlanSecModeWep) { + ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, key); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, key); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, key); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, key); + ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1); + QCOMPARE( insertTextToObject("lineEditKey", "abcde"), true ); + } + else { + QCOMPARE( insertTextToObject("lineEditKey", "password"), true ); + ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, key); + ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); + } + QCOMPARE( mouseClickObject("dialog"), true ); + + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, errorString), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + } + else { + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, errorString), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + } + + calledMethods.clear(); + calledMethods + << "createIap" + << "activeIap" + << "disconnectIap" + << "connectIap"; + QCOMPARE( mWlanQtUtilsContext->calledMethods(), calledMethods); + QCOMPARE( mWlanQtUtilsContext->verifyWlanIapSettings(ap), true); + QTest::qWait(WaitTimeForUi); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardconnect.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardconnect.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#ifndef TESTWLANWIZARDRNDCONNECT_H_ +#define TESTWLANWIZARDRNDCONNECT_H_ + +#include "testwlanwizardcontext.h" + +class TestWlanWizardConnect : public TestWlanWizardContext +{ +Q_OBJECT + +private slots: + void tc_connect_to_open_success(); + void tc_connect_to_open_success_hidden(); + void tc_connect_to_open_success_adhoc(); + void tc_connect_to_wep_success(); + void tc_connect_to_wpa_psk_success(); + void tc_connect_to_wpa2_psk_success(); + void tc_connect_to_open_success_cancel(); + void tc_network_failure_OpenAuthFailed(); + void tc_network_failure_SharedKeyAuthRequired(); + void tc_network_failure_WpaAuthRequired(); + void tc_network_failure_WpaAuthFailed(); + void tc_network_failure_802dot1xAuthFailed(); + void tc_network_failure_IllegalEncryptionKeys(); + void tc_network_failure_PskModeRequired(); + void tc_network_failure_EapModeRequired(); + void tc_network_failure_IllefalWpaPskKey(); + void tc_network_failure_SharedKeyAuthFailed(); + void tc_network_failure_ErrNone(); + void tc_network_failure_30180(); + void tc_iap_creation_fails(); + void tc_cancel_key_query(); + +private: + void tc_connect_success( + const QString &ssid, + int networkMode, + int securityMode, + bool hidden, + QString key); + + void tc_network_error_codes( + const QString &ssid, + int networkMode, + int securityMode, + bool hidden, + QString key, + const QString &errorString, + int errorCode); +}; + +#endif /* TESTWLANWIZARDRNDCONNECT_H_ */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardconnect_conf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardconnect_conf.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +// System includes + +// User includes + +// External function prototypes + +// Local constants + + +#define tc_connect_to_open_success_enabled +#define tc_connect_to_open_success_hidden_enabled; +#define tc_connect_to_open_success_adhoc_enabled; +#define tc_connect_to_wep_success_enabled; +#define tc_connect_to_wpa_psk_success_enabled; +#define tc_connect_to_wpa2_psk_success_enabled; +#define tc_connect_to_open_success_cancel_enabled +#define tc_network_failure_OpenAuthFailed_enabled +#define tc_network_failure_SharedKeyAuthRequired_enabled +#define tc_network_failure_WpaAuthRequired_enabled +#define tc_network_failure_WpaAuthFailed_enabled +#define tc_network_failure_802dot1xAuthFailed_enabled +#define tc_network_failure_IllegalEncryptionKeys_enabled +#define tc_network_failure_PskModeRequired_enabled +#define tc_network_failure_EapModeRequired_enabled +#define tc_network_failure_IllefalWpaPskKey_enabled +#define tc_network_failure_SharedKeyAuthFailed_enabled +#define tc_network_failure_ErrNone_enabled +#define tc_network_failure_30180_enabled +#define tc_iap_creation_fails_enabled +#define tc_cancel_key_query_enabled diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardcontext.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardcontext.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,962 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "testwlanwizardcontext.h" +#include "hbautotest.h" +#include "wlanwizard.h" +#include "wlanwizard_p.h" +#include "wlanwizardpageinternal.h" +#include "wlanwizardhelper.h" +#include "wlanqtutils_context.h" +#include "wlanqtutils.h" +#include "wlanqtutilsap.h" +#include "eapqtconfiginterface_context.h" +#include "eapwizard.h" +#include "eapwizard_p.h" +#include "eapwizardpage.h" +#include "wpswizardpage.h" +#include "wlanmgmtclient_context.h" +#include "wpswizardstepfour.h" +#include "wpswizardstepfour_p.h" +#include "cwpsactiverunner.h" + +// External function prototypes + +// Local constants +class TestRadioButtonList: public HbRadioButtonList +{ +public: + void emitActivated(const QModelIndex &modelIndex) + { HbRadioButtonList::emitActivated(modelIndex); } +}; + + +// --------------------------------------------------------- +// FRAMEWORK FUNCTIONS +// --------------------------------------------------------- + +ContextWlanApList::ContextWlanApList() +{ + +} + +ContextWlanApList::~ContextWlanApList() +{ + clear(); +} + +void ContextWlanApList::Add(QString name, int netMode, int secMode, bool wpaPskInUse, + bool wpsSupported, int signalStrength) +{ + QSharedPointer temp = QSharedPointer(new WlanQtUtilsAp()); + temp->setValue(WlanQtUtilsAp::ConfIdSsid, name); + temp->setValue(WlanQtUtilsAp::ConfIdConnectionMode, netMode); + temp->setValue(WlanQtUtilsAp::ConfIdSecurityMode, secMode); + temp->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, wpaPskInUse); + temp->setValue(WlanQtUtilsAp::ConfIdWpsSupported, wpsSupported); + temp->setValue(WlanQtUtilsAp::ConfIdSignalStrength, signalStrength); + + mList.append(temp); +} + +void ContextWlanApList::clear() +{ + mList.clear(); +} + + +TestWlanWizardContext::TestWlanWizardContext() : + mView(NULL), + mMainWindow(NULL), + mWlanQtUtilsContext(NULL), + mEapQtUtilsContext(NULL), + mWlanMgmtClientContext(NULL), + mApList(NULL), + mApOpenList(NULL) +{ + +} +TestWlanWizardContext::~TestWlanWizardContext() +{ + +} + +/** + * This function will be called before the first test function is executed. + */ +void TestWlanWizardContext::initTestCase() +{ + qDebug("TestWlanWizardContext::initTestCase"); + + mMainWindow = new HbAutoTestMainWindow; + + mView = new TestView(); + + mMainWindow->addView(mView); + mMainWindow->setCurrentView(mView); + mMainWindow->installEventFilter(this); + mMainWindow->show(); + + QTest::qWait(1); + while (!mEvent) { + QTest::qWait(WaitTimeForUi); + } + mEvent = false; + mApList = new ContextWlanApList(); + mApOpenList = new ContextWlanApList(); + +} + +/** + * This function will be called after the last test function was executed. + */ +void TestWlanWizardContext::cleanupTestCase() +{ + qDebug("TestWlanWizardContext::cleanupTestCase"); + + qDebug("delete mApList"); + delete mApList; + mApList = NULL; + delete mApOpenList; + mApOpenList = NULL; + + qDebug("delete mMainWindow"); + mMainWindow->setAttribute( Qt::WA_DeleteOnClose, true ); + mMainWindow->close(); + mMainWindow = NULL; + QTest::qWait(WaitTimeForUi); + qDebug("TestWlanWizardContext::cleanupTestCase exit"); +} + +/** + * This function will be called before each test function is executed. + */ +void TestWlanWizardContext::init() +{ + qDebug("TestWlanWizardContext::init()"); + + mView->createWizard(); + mWlanQtUtilsContext = new WlanQtUtilsContext(mView->mWizard->d_ptr->mWlanQtUtils.data()); + + mEapQtUtilsContext = new EapQtConfigInterfaceContext(); + mEapQtUtilsContext->setObject(getEapQtConfig()); + + mWlanMgmtClientContext = new WlanMgmtClientContext(); + //mWlanMgmtClientContext->setObject(mWlanMgmtClient); + + WpsPageStepFour* wps = (WpsPageStepFour*)(mView->mWizard->d_ptr->mPages[WpsWizardPage::PageWpsWizardStep4]); + Q_ASSERT(wps); + mWlanMgmtClientContext->setObject(wps->d_ptr->mWpsActiveRunner->iWLANMgmtClient); +} + +/** + * This function will be called after each test function is executed. + */ +void TestWlanWizardContext::cleanup() +{ + qDebug("TestWlanWizardContext::cleanup()"); + + delete mWlanQtUtilsContext; + delete mEapQtUtilsContext; + delete mWlanMgmtClientContext; + + mView->deleteWizard(); + mApList->clear(); + mApOpenList->clear(); + QTest::qWait(1); +} + + +/*! + * Filter to catch focus event to the text editor widget. + */ +bool TestWlanWizardContext::eventFilter(QObject *obj, QEvent *event) +{ + if (obj == mMainWindow && event->type() == QEvent::Show) { + mMainWindow->removeEventFilter(this); + mEvent = true; + } + return false; +} + +QGraphicsWidget* TestWlanWizardContext::findChildItem(const QString &itemName, QGraphicsWidget *widget) +{ + QList list = widget->childItems(); + for (int i = 0; i < list.size(); i++) { + QGraphicsWidget* item = (QGraphicsWidget*) list[i]; + if (item->objectName() == itemName) { + return item; + } + else if ((item = findChildItem(itemName, item))) { + return item; + } + } + return 0; +} + +bool TestWlanWizardContext::verifyStatus(WizardStatusSignal status, int iapId) +{ + return mView->verifyStatus(status, iapId); +} + +bool TestWlanWizardContext::verifyCurrentPage(int pageId, int retries, int wait_ms) +{ + bool ret = true; + + for (int i = 0; i < retries; i++) { + QTest::qWait(wait_ms); + + WlanWizardPrivate *pPrivate = mView->mWizard->d_ptr; + HbWidget* current = qobject_cast (pPrivate->mStackedWidget->currentWidget()); + WlanWizardPage *page = pPrivate->mPageMapper[current]; + + // TODO: verify title in this method + + if (page == pPrivate->mPages[pageId]) { + switch(pageId) { + case WlanWizardPageInternal::PageNetworkMode: + return verifyDialogText("dialog_6", hbTrId("txt_occ_dialog_select_network_mode_and_status")); + + case WlanWizardPageInternal::PageNetworkSecurity: + return verifyDialogText("dialog_6", hbTrId("txt_occ_dialog_select_network_security_mode")); + + case WlanWizardPageInternal::PageSsid: + return verifyDialogText("dialog", hbTrId("txt_occ_dialog_insert_the_name_of_the_new_wlan_net")); + + case WlanWizardPageInternal::PageSummary: + if (pPrivate->mTitle->plainText() != hbTrId("txt_occ_title_wlan_setup_wizard_summary")){ + qWarning("TestWlanWizardContext::verifyCurrentPage: Invalid title"); + return false; + } + return true; + + case EapWizardPage::PageOuterType: + return verifyDialogText("title", hbTrId("txt_occ_title_select_eap_type")); + + case EapWizardPage::PageCertificateCa: + return verifyDialogText("title", hbTrId("txt_occ_title_select_authority_certificate")); + + case EapWizardPage::PageCertificateUser: + return verifyDialogText("title", hbTrId("txt_occ_title_select_user_certificate")); + + case EapWizardPage::PageNewPacStorePassword: + ret &= verifyDialogText("setlabel_55", hbTrId("txt_occ_setlabel_new_pac_store_password")); + ret &= verifyDialogText("setlabel_56", hbTrId("txt_occ_setlabel_confirm_password")); + return ret; + + case EapWizardPage::PagePromptPacStorePassword: + return verifyDialogText("setlabel_59", hbTrId("txt_occ_setlabel_eap_pac_store_password")); + + case WpsWizardPage::PageWpsWizardStep2: + return verifyDialogText("label", hbTrId("txt_occ_dialog_selected_network_supports_wifi_pro")); + break; + + case WpsWizardPage::PageWpsWizardStep3_Button: + return verifyDialogText("label_heading", hbTrId("txt_occ_dialog_first_press_button_on_the_wireless")); + break; + + case WpsWizardPage::PageWpsWizardStep3_Number: + // TODO: something better here?? + return true; + + case WpsWizardPage::PageWpsWizardStep4: + return verifyDialogText("label_heading", hbTrId("txt_occ_dialog_negotiating")); + + case WpsWizardPage::PageWpsWizardStep5: + return verifyDialogText("label", hbTrId("txt_occ_dialog_settings_received_for_multiple_wlan")); + + default: + return false; + } + } + } + qWarning("verifyCurrentPage: expected: %d", pageId); + return false; +} + +bool TestWlanWizardContext::verifyCurrentPageWithInfo( + int pageId, const QString &info, int retries, int wait_ms) +{ + bool ret = true; + for (int i = 0; i < retries; i++) { + QTest::qWait(wait_ms); + + WlanWizardPrivate *pPrivate = mView->mWizard->d_ptr; + HbWidget* current = qobject_cast (pPrivate->mStackedWidget->currentWidget()); + WlanWizardPage *page = pPrivate->mPageMapper[current]; + + // TODO: verify title in this method + + if (page == pPrivate->mPages[pageId]) { + switch(pageId) { + case WlanWizardPageInternal::PageGenericError: + return verifyDialogText("dialog", info); + + case WlanWizardPageInternal::PageKeyQuery: + return verifyDialogText("dialog", HbParameterLengthLimiter(hbTrId("txt_occ_dialog_enter_key_for_1")).arg(info)); + + case WlanWizardPageInternal::PageProcessSettings: + return verifyDialogText("dialog", HbParameterLengthLimiter(hbTrId("txt_occ_dialog_checking_connection_to_1")).arg(info)); + + case WlanWizardPageInternal::PageScanning: + return verifyDialogText("dialog", HbParameterLengthLimiter(hbTrId("txt_occ_dialog_searching")).arg(info)); + + case EapWizardPage::PageUsernamePassword: + ret &= verifyDialogText( + "setlabel_55", + HbParameterLengthLimiter(hbTrId("txt_occ_setlabel_user_name_for_1")).arg(info)); + ret &= verifyDialogText("setlabel_56", hbTrId("txt_occ_setlabel_eap_password")); + return ret; + + case EapWizardPage::PageIdentity: + ret &= verifyDialogText("setlabel_53", HbParameterLengthLimiter(hbTrId("txt_occ_setlabel_user_name_for_1")).arg(info)); + ret &= verifyDialogText("setlabel_53_val", hbTrId("txt_occ_setlabel_user_name_val_generate_automatic")); + ret &= verifyDialogText("setlabel_54", hbTrId("txt_occ_setlabel_eap_realm")); + ret &= verifyDialogText("setlabel_54_val", hbTrId("txt_occ_setlabel_eap_realm_val_generate_automatically")); + return ret; + + case EapWizardPage::PageInnerTypePeap: + case EapWizardPage::PageInnerTypeEapTtls: + return verifyDialogText("title", HbParameterLengthLimiter(hbTrId("txt_occ_title_select_innear_eap_type_for_1")).arg(info)); + + default: + return verifyCurrentPage(pageId, retries, wait_ms); + } + } + } + qWarning("verifyCurrentPage: expected: %d", pageId); + return false; +} + + +bool TestWlanWizardContext::verifyDialogText(const QString objName, const QString text) +{ + HbWidget* current = qobject_cast ( + mView->mWizard->d_ptr->mStackedWidget->currentWidget()); + HbWidget* widget = qobject_cast ( + findChildItem(objName, current)); + + if (widget) { + HbLabel *label = qobject_cast(widget); + if (label) { + if(label->plainText() == text) { + if (!label->isVisible()){ + qWarning("verifyDialogText: not visible"); + return false; + } + return true; + + } else { + qWarning("verifyDialogText: not match"); + qDebug() << "expect: " << text; + qDebug() << "actual: " << label->plainText(); + return false; + } + } + HbCheckBox *checkBox = qobject_cast(widget); + if (checkBox) { + if(checkBox->text() == text) { + if (!checkBox->isVisible()){ + qWarning("verifyDialogText: not visible"); + return false; + } + return true; + + } else { + qWarning("verifyDialogText: not match"); + qDebug() << "expect: " << text; + qDebug() << "actual: " << checkBox->text(); + return false; + } + } + } + + qWarning("verifyDialogText: object not found"); + + return false; +} + +bool TestWlanWizardContext::verifyActionButtons(ButtonStatus prevStatus, + ButtonStatus cancelStatus, + ButtonStatus nextStatus, + ButtonStatus finishStatus) +{ + WlanWizardPrivate *pPrivate = mView->mWizard->d_ptr; + ButtonStatus prevReally = ButtonHidden; + ButtonStatus cancelReally = ButtonHidden; + ButtonStatus nextReally = ButtonHidden; + ButtonStatus finishReally = ButtonHidden; + + if(pPrivate->mActionPrevious->isVisible()) { + if(pPrivate->mActionPrevious->isEnabled()) { + prevReally = ButtonEnabled; + } else { + prevReally = ButtonDisabled; + } + } + + if(pPrivate->mActionCancel->isVisible()) { + if(pPrivate->mActionCancel->isEnabled()) { + cancelReally = ButtonEnabled; + } else { + cancelReally = ButtonDisabled; + } + } + + if(pPrivate->mActionNext->isVisible()) { + if(pPrivate->mActionNext->isEnabled()) { + nextReally = ButtonEnabled; + } else { + nextReally = ButtonDisabled; + } + } + + if(pPrivate->mActionFinish->isVisible()) { + if(pPrivate->mActionFinish->isEnabled()) { + finishReally = ButtonEnabled; + } else { + finishReally = ButtonDisabled; + } + } + bool ret = true; + if (prevReally != prevStatus){ + qWarning("Previous Button: really: %d, status: %d", prevReally, prevStatus); + ret = false; + } + if (cancelReally != cancelStatus){ + qWarning("Cancel Button: really: %d, status: %d", cancelReally, cancelStatus); + ret = false; + } + if (nextReally != nextStatus){ + qWarning("Next Button: really: %d, status: %d", nextReally, nextStatus); + ret = false; + } + if (finishReally != finishStatus){ + qWarning("Finish Button: really: %d, status: %d", finishReally, finishStatus); + ret = false; + } + + return ret; +} + +bool TestWlanWizardContext::verifySummaryPage( + const QString &ssid, + int netMode, + bool hidden, + int secMode, + bool useWpaPsk, + const QString &destination, + int outerType, + int innerType, + bool eapFastProvMode) +{ + bool ret = true; + int i = 0; + HbListWidget* listWidget = qobject_cast ( + mView->mWizard->d_ptr->mStackedWidget->currentWidget()); + + if (!listWidget){ + qWarning("verifySummaryPage: ListWidget not found"); + return false; + } + + // VERIFY: NETWORK NAME + HbListWidgetItem *item = listWidget->item(i++); + if (item->text() != hbTrId("txt_occ_dblist_network_name")) { + qWarning("verifySummaryPage: no match network name"); + ret = false; + } + + if (item->secondaryText() != ssid){ + qWarning("verifySummaryPage: no match ssid"); + ret = false; + } + + // VERIFY: NETWORK MODE + item = listWidget->item(i++); + if (item->text() != hbTrId("txt_occ_dblist_network_mode")) { + qWarning("verifySummaryPage: no match network mode"); + ret = false; + } + + if (item->secondaryText() != toNetworkModeString(netMode, hidden)){ + qWarning("verifySummaryPage: no match network mode value"); + ret = false; + } + + // VERIFY: SECURITY MODE + item = listWidget->item(i++); + if (item->text() != hbTrId("txt_occ_dblist_security_mode")) { + qWarning("verifySummaryPage: no match security mode"); + ret = false; + } + + if (item->secondaryText() != toSecurityModeString(secMode, useWpaPsk)){ + qWarning("verifySummaryPage: no match security mode value"); + ret = false; + } + + // VERIFY: EAP OUTER TYPE + if (outerType != -1) { + item = listWidget->item(i++); + if (item->text() != hbTrId("txt_occ_dblist_outer_eap")) { + qWarning("verifySummaryPage: no match eap outer type"); + ret = false; + } + if (item->secondaryText() != eapTypeToString(outerType)){ + qWarning("verifySummaryPage: no match eap outer type value"); + ret = false; + } + } + + // VERIFY: EAP INNER TYPE + if (innerType != -1) { + item = listWidget->item(i++); + if (item->text() != hbTrId("txt_occ_dblist_inner_eap")) { + qWarning("verifySummaryPage: no match eap inner type"); + ret = false; + } + if (item->secondaryText() != eapTypeToString(innerType)){ + qWarning("verifySummaryPage: no match eap inner type value"); + ret = false; + } + } + + // VERIFY: EAP FAST PROVISIONING MODE + if (eapFastProvMode) { + item = listWidget->item(i++); + if (item->text() != hbTrId("txt_occ_dblist_provisioning_mode_for_eapfast")) { + qWarning("verifySummaryPage: no match eap prov mode"); + ret = false; + } + if (item->secondaryText() != hbTrId("txt_occ_dblist_provisioning_mode_for_val_unauthent")){ + qWarning("verifySummaryPage: no match eap prov mode value"); + ret = false; + } + } + + // VERIFY: DESTINATION + if (destination.length() > 0) { + item = listWidget->item(i++); + if (item->text() != hbTrId("txt_occ_dblist_destination")) { + qWarning("verifySummaryPage: no match destination"); + ret = false; + } + if (item->secondaryText() != destination){ + qWarning("verifySummaryPage: no match destination value"); + ret = false; + } + } + + + return ret; +} + +bool TestWlanWizardContext::mouseClickObject(const QString objName) +{ + HbWidget* current = qobject_cast ( + mView->mWizard->d_ptr->mStackedWidget->currentWidget()); + HbWidget* widget = (HbWidget*) findChildItem(objName, current); + + if (widget) { + HbAutoTest::mouseClick(mMainWindow, widget); + widget->clearFocus(); + widget->setFocus(); + return true; + } + qWarning("mouseClickObject: object not found"); + + return false; +} + +bool TestWlanWizardContext::insertTextToObject(const QString objName, const QString text) +{ + HbWidget* current = qobject_cast ( + mView->mWizard->d_ptr->mStackedWidget->currentWidget()); + HbWidget* widget = (HbWidget*) findChildItem(objName, current); + + if (widget) { + for (int i = 0; i < text.size(); i++) { + HbAutoTest::keyPress(mMainWindow, text.at(i).toAscii(), 0, 10); + QTest::qWait(20); + } + return true; + } + qWarning("insertTextToObject: object not found"); + return false; +} + +bool TestWlanWizardContext::selectRadioButton(const QString objName, int index) +{ + HbWidget* current = qobject_cast ( + mView->mWizard->d_ptr->mStackedWidget->currentWidget()); + TestRadioButtonList* widget = (TestRadioButtonList*) findChildItem(objName, current); + + if (widget) { + if (widget->items().length() <= index) { + qWarning("selectRadioButton: index out of range"); + return false; + } + widget->setSelected(index); + widget->emitActivated(widget->currentIndex()); + return true; + } + qWarning("selectRadioButton: object not found"); + + return false; +} + +bool TestWlanWizardContext::verifyRadioButtonState( + const QString objName, + int index, + const QString &text) +{ + HbWidget* current = qobject_cast ( + mView->mWizard->d_ptr->mStackedWidget->currentWidget()); + + HbRadioButtonList* widget = qobject_cast( + findChildItem(objName, current)); + + if (widget) { + if (widget->selected() != index) { + qWarning("verifyRadioButtonState: invalid index"); + return false; + } + + if (widget->items().at(index) != text) { + qWarning("verifyRadioButtonState: text does not match"); + return false; + } + + return true; + } + qWarning("verifyRadioButtonState: object not found"); + + return false; +} + +QStringList TestWlanWizardContext::verifyRadioButtons(const QString objName) +{ + HbWidget* current = qobject_cast ( + mView->mWizard->d_ptr->mStackedWidget->currentWidget()); + + HbRadioButtonList* widget = qobject_cast( + findChildItem(objName, current)); + + QStringList ret; + + if (widget) { + ret = widget->items(); + } + else { + qWarning("verifyRadioButtons: object not found"); + } + + return ret; +} + +int TestWlanWizardContext::verifySelectedRadioButton(const QString objName) +{ + HbWidget* current = qobject_cast ( + mView->mWizard->d_ptr->mStackedWidget->currentWidget()); + + HbRadioButtonList* widget = qobject_cast( + findChildItem(objName, current)); + + int ret = ListNotFound; + + if (widget) { + ret = widget->selected(); + } + else { + qWarning("verifySelectedRadioButton: object not found"); + } + + return ret; +} + +bool TestWlanWizardContext::verifyCheckBoxState(const QString &objName, bool checked) +{ + HbWidget* current = qobject_cast ( + mView->mWizard->d_ptr->mStackedWidget->currentWidget()); + HbCheckBox* widget = qobject_cast( + findChildItem(objName, current)); + + if (widget) { + if (widget->isChecked() != checked) { + qWarning("Checkbox in wrong state"); + return false; + } + return true; + } + qWarning("verifyCheckBoxState: object not found"); + return false; +} + +bool TestWlanWizardContext::selectCheckBoxState(const QString &objName, bool check) +{ + HbWidget* current = qobject_cast ( + mView->mWizard->d_ptr->mStackedWidget->currentWidget()); + HbCheckBox* widget = qobject_cast( + findChildItem(objName, current)); + + if (widget) { + if (check) { + widget->setCheckState(Qt::Checked); + } else { + widget->setCheckState(Qt::Unchecked); + } + return true; + + } + qWarning("selectCheckBoxState: object not found"); + return false; +} + +bool TestWlanWizardContext::mouseClickNext() +{ + if (mView->mWizard->d_ptr->mActionNext->isEnabled()) { + mView->mWizard->d_ptr->mActionNext->activate(QAction::Trigger); + return true; + } + qWarning("Next button not enabled"); + return false; +} + +bool TestWlanWizardContext::mouseClickPrevious() +{ + if (mView->mWizard->d_ptr->mActionPrevious->isEnabled()) { + mView->mWizard->d_ptr->mActionPrevious->activate(QAction::Trigger); + return true; + } + qWarning("mouseClickPrevious: Previous button not enabled"); + + return false; +} + +bool TestWlanWizardContext::mouseClickCancel() +{ + if (mView->mWizard->d_ptr->mActionCancel->isEnabled()) { + mView->mWizard->d_ptr->mActionCancel->activate(QAction::Trigger); + return true; + } + qWarning("mouseClickCancel: Cancel button not enabled"); + + return false; +} + +bool TestWlanWizardContext::mouseClickFinish() +{ + if (mView->mWizard->d_ptr->mActionFinish->isEnabled()) { + mView->mWizard->d_ptr->mActionFinish->activate(QAction::Trigger); + return true; + } + qWarning("mouseClickFinish: Finish button not enabled"); + + return false; +} + +QString TestWlanWizardContext::toNetworkModeString(int netMode, bool isHidden) +{ + QString ret; + switch (netMode) { + case CMManagerShim::Adhoc: + ret = hbTrId("txt_occ_dblist_network_mode_val_adhoc"); + break; + + default: + if (isHidden) { + ret = hbTrId("txt_occ_dblist_network_mode_val_infrastructure_hi"); + } else { + ret = hbTrId("txt_occ_dblist_network_mode_val_infrastructure_pu"); + } + break; + } + return ret; +} + +QString TestWlanWizardContext::toSecurityModeString(int secMode, int useWpaPsk) +{ + QString ret; + switch (secMode) { + case CMManagerShim::WlanSecMode802_1x: + ret = hbTrId("txt_occ_dblist_security_mode_val_8021x"); + break; + + case CMManagerShim::WlanSecModeWep: + ret = hbTrId("txt_occ_dblist_security_mode_val_wep"); + break; + + case CMManagerShim::WlanSecModeWpa: + if (useWpaPsk) { + ret = hbTrId("txt_occ_dblist_security_mode_val_wpawpa2psk"); + } else { + ret = hbTrId("txt_occ_dblist_security_mode_val_wpawpa2_with_eap"); + } + break; + + case CMManagerShim::WlanSecModeWpa2: + if (useWpaPsk) { + ret = hbTrId("txt_occ_dblist_security_mode_val_wpa2_with_passwor"); + } else { + ret = hbTrId("txt_occ_dblist_security_mode_val_wpa2_with_eap"); + } + break; + + default: + Q_ASSERT(secMode == CMManagerShim::WlanSecModeOpen); + ret = hbTrId("txt_occ_dblist_security_mode_val_open"); + break; + } + return ret; +} + + +EapQtConfigInterface *TestWlanWizardContext::getEapQtConfig() +{ + return mView->mWizard->d_ptr->mEapWizard->d_ptr->mEapConfIf.data(); +} + +QString TestWlanWizardContext::eapTypeToString(int type) +{ + QCOMPARE(mView->mWizard->d_ptr->mEapWizard != NULL, true); + return mView->mWizard->d_ptr->mEapWizard->d_ptr->eapTypeToString(type); +} + +void TestWlanWizardContext::callWlanWizard_startPageOperation() +{ + mView->mWizard->d_ptr->startPageOperation(); +} + + +void TestWlanWizardContext::setWlanMgmtClientObject(CWlanMgmtClient* object) +{ + // TODO: mWlanMgmtClient = object; +} + +TestView::TestView() : mWizard(NULL) +{ + qDebug("TestView::TestView()"); +} + +TestView::~TestView() +{ + qDebug("TestView::~TestView()"); +} + +void TestView::createWizard() +{ + qDebug("TestView::createWizard"); + Q_ASSERT(mWizard == NULL); + mWizard = new WlanWizard(mainWindow()); + bool ok; + ok = connect( + mWizard, SIGNAL(finished(int, bool)), + this, SLOT(finished(int, bool)), + Qt::QueuedConnection); + Q_ASSERT(ok); + + ok = connect( + mWizard, SIGNAL(cancelled()), + this, SLOT(cancelled()), + Qt::QueuedConnection); + Q_ASSERT(ok); + + mWizardStatus = WizardStatusSignalNone; + mConnectedIapId = -100; +} + +void TestView::showWizard() +{ + qDebug("TestView::showWizard()"); + Q_ASSERT(mWizard); + mWizard->show(); +} + +void TestView::deleteWizard() +{ + qDebug("TestView::deleteWizard"); + + Q_ASSERT(mWizard != NULL); + QMetaObject::invokeMethod(mWizard, "deleteLater", Qt::QueuedConnection); + QTest::qWait(100); + mWizard = NULL; +} + +void TestView::finished(int iapId, bool connected) +{ + qDebug("TestView::complete(), iap id: %d, connected: %d", iapId, connected); + + if (mWizardStatus != WizardStatusSignalNone) { + qWarning("TestView::finished: multiple signals received"); + mWizardStatus = WizardStatusSignalUndefined; + } else { + mWizardStatus = WizardStatusSignalFinished; + mConnectedIapId = iapId; + } +} + +void TestView::cancelled() +{ + qDebug("TestView::cancelled()"); + if (mWizardStatus != WizardStatusSignalNone) { + qWarning("TestView::cancelled: multiple signals received"); + mWizardStatus = WizardStatusSignalUndefined; + } else { + mWizardStatus = WizardStatusSignalCancelled; + } +} + +bool TestView::verifyStatus(WizardStatusSignal status, int iapId ) +{ + // Since connections to cancelled and finished signals are queued + // we need to use qWait() here. + QTest::qWait(100); + bool ret = true; + if (status != mWizardStatus){ + qWarning("TestView::verifyStatus, status: expected: %d, actual: %d", status, mWizardStatus); + ret = false; + } + if (status == WizardStatusSignalFinished) { + if (iapId != mConnectedIapId) { + qWarning("TestView::verifyStatus, iapid: expected: %d, actual: %d", iapId, mConnectedIapId); + ret = false; + } + } + return ret; +} + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardcontext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardcontext.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,191 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#ifndef TESTWLANWIZARDRNDUICONTEXT_H_ +#define TESTWLANWIZARDRNDUICONTEXT_H_ + +#include +#include +#include + +class QGraphicsItem; +class HbAutoTestMainWindow; +class WlanWizard; +class WlanQtUtilsContext; +class WlanQtUtils; +class WlanQtUtilsAp; +class QString; +class EapWizard; +class EapQtConfigInterfaceContext; +class EapQtConfigInterface; +class WlanMgmtClientContext; +class CWlanMgmtClient; + +//! 1sec +#define WaitTimeForUi 500 + +enum WizardStatusSignal{ + WizardStatusSignalNone, + WizardStatusSignalFinished, + WizardStatusSignalCancelled, + WizardStatusSignalUndefined, +}; + +class ContextWlanApList +{ +public: + ContextWlanApList(); + ~ContextWlanApList(); + + void Add(QString name, + int netMode, + int secMode, + bool wpaPskInUse, + bool wpsSupported, + int signalStrength = 0); + + void clear(); + + const QList > &List() { return mList; } +private: + QList > mList; +}; + +class TestView: public HbView +{ +Q_OBJECT + +public: + + +public: + TestView(); + virtual ~TestView(); + + void createWizard(); + void showWizard(); + bool verifyStatus(WizardStatusSignal status, int iapId = -100); + +private slots: + void finished(int iapId, bool connected); + void cancelled(); + +public: + void deleteWizard(); + +public: + WlanWizard *mWizard; + +private: + WizardStatusSignal mWizardStatus; + int mConnectedIapId; +}; + + +class TestWlanWizardContext : public QObject +{ +Q_OBJECT +public: + TestWlanWizardContext(); + virtual ~TestWlanWizardContext(); + +public slots: + // Test framework functions + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + +protected: + static const int ListNotFound = -2; + static const int ListNoneSelected = -1; + + enum ButtonStatus { + ButtonHidden, + ButtonDisabled, + ButtonEnabled + }; + /*! + * Reimplements QObject function that is invoked on any event. This + * function handles only a focus event to mSsid edit field. + * @param obj contains the object, where the event originates from. + * @param event contains the event id. + */ + bool eventFilter(QObject *obj, QEvent *event); + + QGraphicsWidget* findChildItem(const QString &itemName, QGraphicsWidget *widget); + bool verifyStatus(WizardStatusSignal status, int iapId = -100); + bool verifyCurrentPage(int pageId, int retries = 10, int wait_ms = 200); + bool verifyCurrentPageWithInfo(int pageId, const QString &info, int retries = 10, int wait_ms = 200); + bool verifyDialogText(const QString objName, const QString text); + bool verifyActionButtonVisibility(bool prevVisible, bool cancelVisible, + bool nextVisible, bool finishVisible); + bool verifyActionButtons(ButtonStatus prevStatus, ButtonStatus cancelStatus, + ButtonStatus nextStatus, ButtonStatus finishStatus); + bool verifySummaryPage( + const QString &ssid, + int netMode, + bool hidden, + int secMode, + bool useWpaPsk, + const QString &destination = QString(), + int outerType = -1, + int innerType = -1, + bool eapFastProvMode = false); + + bool mouseClickObject(const QString objName); + bool insertTextToObject(const QString objName, const QString text); + bool selectRadioButton(const QString objName, int index); + bool verifyRadioButtonState(const QString objName, int index, const QString &text); + bool verifyCheckBoxState(const QString &objName, bool checked); + QStringList verifyRadioButtons(const QString objName); + int verifySelectedRadioButton(const QString objName); + bool selectCheckBoxState(const QString &objName, bool check); + + bool mouseClickNext(); + bool mouseClickPrevious(); + bool mouseClickCancel(); + bool mouseClickFinish(); + + QString toNetworkModeString(int netMode, bool isHidden); + QString toSecurityModeString(int secMode, int useWpaPsk); + + EapQtConfigInterface *getEapQtConfig(); + QString eapTypeToString(int type); + + void callWlanWizard_startPageOperation(); + +public: + static void setWlanMgmtClientObject(CWlanMgmtClient* object); + +public: + + static CWlanMgmtClient *mWlanMgmtClient; + +protected: + bool mEvent; + + // Test data + TestView *mView; + HbAutoTestMainWindow *mMainWindow; + WlanQtUtilsContext *mWlanQtUtilsContext; + EapQtConfigInterfaceContext *mEapQtUtilsContext; + WlanMgmtClientContext *mWlanMgmtClientContext; + ContextWlanApList *mApList; + ContextWlanApList *mApOpenList; +}; + +#endif /* TESTWLANWIZARDRNDUICONTEXT_H_ */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardeap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardeap.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,1837 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +// System includes +#include +#include +#include +#include +#include + +// User includes +#include "testwlanwizardeap.h" +#include "testwlanwizardeap_conf.h" +#include "hbautotest.h" +#include "wlanwizard.h" +#include "wlanwizard_p.h" +#include "wlanqtutils_context.h" +#include "wlanqtutils.h" +#include "wlanqtutilsap.h" +#include "wlanwizardpageinternal.h" +#include "eapwizardpage.h" +#include "eapqtvalidator_stub.h" + +#include "eapqtconfiginterface_context.h" + +// External function prototypes + +// Local constants + + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------- +// TEST CASES +// --------------------------------------------------------- +void TestWlanWizardEap::tc_eap_outer_page_orientation_change() +{ +#ifdef tc_eap_outer_page_orientation_change_enabled + + const QString ssid("tc_eap_outer_page_orientation_change"); + + mEapQtUtilsContext->createEapAkaSim(EapQtPluginHandle::PluginEapAka); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa2, + false, false, false); + + mView->showWizard(); + + verify_outertype(ButtonDisabled); + + mMainWindow->setOrientation(Qt::Horizontal, false); + QTest::qWait(WaitTimeForUi); + + verify_outertype(ButtonDisabled); + + mMainWindow->setOrientation(Qt::Vertical, false); + QTest::qWait(WaitTimeForUi); + + verify_outertype(ButtonDisabled); +#endif +} + +void TestWlanWizardEap::tc_eap_aka() +{ +#ifdef tc_eap_aka_enabled + tc_eap_aka_sim(EapQtPluginHandle::PluginEapAka); +#endif +} + +void TestWlanWizardEap::tc_eap_sim() +{ +#ifdef tc_eap_sim_enabled + tc_eap_aka_sim(EapQtPluginHandle::PluginEapSim); +#endif +} + +void TestWlanWizardEap::tc_eap_leap() +{ +#ifdef tc_eap_leap_enabled + const QString username("user"); + const QString password("passwd"); + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(3, true); + mEapQtUtilsContext->createLeap(username,password); + + const QString ssid("tc_eap_leap"); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa, + false, false, false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + verify_username_password_click_next(EapQtPluginHandle::PluginLeap, username, password); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifySummaryPage( + ssid, + CMManagerShim::Infra, + false, + CMManagerShim::WlanSecModeWpa, + false, + hbTrId("txt_occ_dblist_destination_val_internet"), + EapQtPluginHandle::PluginLeap),true); + + QTest::qWait(WaitTimeForUi); +#endif +} + +void TestWlanWizardEap::tc_eap_peap_gtc() +{ +#ifdef tc_eap_peap_gtc_enabled + tc_eap_peap_ttls( + EapQtPluginHandle::PluginPeap, + EapQtPluginHandle::PluginEapGtc); +#endif +} + +void TestWlanWizardEap::tc_eap_peap_mschapv2() +{ +#ifdef tc_eap_peap_mschapv2_enabled + tc_eap_peap_ttls( + EapQtPluginHandle::PluginPeap, + EapQtPluginHandle::PluginEapMschapv2); +#endif +} + +void TestWlanWizardEap::tc_eap_ttls_mschapv2() +{ +#ifdef tc_eap_ttls_mschapv2_enabled + tc_eap_peap_ttls( + EapQtPluginHandle::PluginEapTtls, + EapQtPluginHandle::PluginPlainMschapv2); +#endif +} + +void TestWlanWizardEap::tc_eap_ttls_pap() +{ +#ifdef tc_eap_ttls_pap_enabled + tc_eap_peap_ttls( + EapQtPluginHandle::PluginEapTtls, + EapQtPluginHandle::PluginPap); +#endif +} + +void TestWlanWizardEap::tc_eap_ttls_gtc() +{ +#ifdef tc_eap_ttls_gtc_enabled + tc_eap_peap_ttls( + EapQtPluginHandle::PluginEapTtls, + EapQtPluginHandle::PluginEapGtc); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanUserRejected() +{ +#ifdef tc_eap_aka_connect_KErrWlanUserRejected_enabled + tc_eap_aka_connect_error( + KErrWlanUserRejected, + hbTrId("txt_occ_dialog_1_auth_failed_user_cert_rej").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanUserCertificateExpired() +{ +#ifdef tc_eap_aka_connect_KErrWlanUserCertificateExpired_enabled + tc_eap_aka_connect_error( + KErrWlanUserCertificateExpired, + hbTrId("txt_occ_dialog_1_auth_failed_user_cert_exp").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanServerCertificateExpired() +{ +#ifdef tc_eap_aka_connect_KErrWlanServerCertificateExpired_enabled + tc_eap_aka_connect_error( + KErrWlanServerCertificateExpired, + hbTrId("txt_occ_dialog_1_authentication_failed_server_ce").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanCerficateVerifyFailed() +{ +#ifdef tc_eap_aka_connect_KErrWlanCerficateVerifyFailed_enabled + tc_eap_aka_connect_error( + KErrWlanCerficateVerifyFailed, + hbTrId("txt_occ_dialog_1_authentication_failed_could_not").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanNoCipherSuite() +{ +#ifdef tc_eap_aka_connect_KErrWlanNoCipherSuite_enabled + tc_eap_aka_connect_error( + KErrWlanNoCipherSuite, + hbTrId("txt_occ_dialog_1_authentication_failed_cipher_su").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanSimNotInstalled() +{ +#ifdef tc_eap_aka_connect_KErrWlanSimNotInstalled_enabled + tc_eap_aka_connect_error( + KErrWlanSimNotInstalled, + hbTrId("txt_occ_dialog_1_authentication_failed_check_sim").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastPacStoreCorrupted() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapFastPacStoreCorrupted_enabled + tc_eap_aka_connect_error( + KErrWlanEapFastPacStoreCorrupted, + hbTrId("txt_occ_dialog_1_authentication_failed_reset_pac").arg( + eapTypeToString(EapQtPluginHandle::PluginEapFast))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapSimFailed() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapSimFailed_enabled + tc_eap_aka_connect_error( + KErrWlanEapSimFailed, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanNotSubscribed() +{ +#ifdef tc_eap_aka_connect_KErrWlanNotSubscribed_enabled + tc_eap_aka_connect_error( + KErrWlanNotSubscribed, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrCancel() +{ +#ifdef tc_eap_aka_connect_KErrCancel_enabled + tc_eap_aka_connect_error( + KErrCancel, + hbTrId("txt_occ_dialog_connection_failed")); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapTlsFailed() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapTlsFailed_enabled + tc_eap_aka_connect_error( + KErrWlanEapTlsFailed, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapPeapFailed() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapPeapFailed_enabled + tc_eap_aka_connect_error( + KErrWlanEapPeapFailed, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapAkaFailed() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapAkaFailed_enabled + tc_eap_aka_connect_error( + KErrWlanEapAkaFailed, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapTtlsFailed() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapTtlsFailed_enabled + tc_eap_aka_connect_error( + KErrWlanEapTtlsFailed, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanLeapFailed() +{ +#ifdef tc_eap_aka_connect_KErrWlanLeapFailed_enabled + tc_eap_aka_connect_error( + KErrWlanLeapFailed, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanNoUserCertificate() +{ +#ifdef tc_eap_aka_connect_KErrWlanNoUserCertificate_enabled + tc_eap_aka_connect_error( + KErrWlanNoUserCertificate, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastTunnelCompromiseError() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapFastTunnelCompromiseError_enabled + tc_eap_aka_connect_error( + KErrWlanEapFastTunnelCompromiseError, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastUnexpextedTlvExhanged() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapFastUnexpextedTlvExhanged_enabled + tc_eap_aka_connect_error( + KErrWlanEapFastUnexpextedTlvExhanged, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled_enabled + tc_eap_aka_connect_error( + KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastNoMatchingPacForAid() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapFastNoMatchingPacForAid_enabled + tc_eap_aka_connect_error( + KErrWlanEapFastNoMatchingPacForAid, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastAuthFailed() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapFastAuthFailed_enabled + tc_eap_aka_connect_error( + KErrWlanEapFastAuthFailed, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanAccessBarred() +{ +#ifdef tc_eap_aka_connect_KErrWlanAccessBarred_enabled + tc_eap_aka_connect_error( + KErrWlanAccessBarred, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanPasswordExpired() +{ +#ifdef tc_eap_aka_connect_KErrWlanPasswordExpired_enabled + tc_eap_aka_connect_error( + KErrWlanPasswordExpired, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanNoDialinPermissions() +{ +#ifdef tc_eap_aka_connect_KErrWlanNoDialinPermissions_enabled + tc_eap_aka_connect_error( + KErrWlanNoDialinPermissions, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanAccountDisabled() +{ +#ifdef tc_eap_aka_connect_KErrWlanAccountDisabled_enabled + tc_eap_aka_connect_error( + KErrWlanAccountDisabled, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanRestrictedLogonHours() +{ +#ifdef tc_eap_aka_connect_KErrWlanRestrictedLogonHours_enabled + tc_eap_aka_connect_error( + KErrWlanRestrictedLogonHours, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_ttls_mschapv2_connect_KErrWlanEapGtcFailed() +{ +#ifdef tc_eap_ttls_mschapv2_connect_KErrWlanEapGtcFailed_enabled + tc_eap_peap_ttls( + EapQtPluginHandle::PluginEapTtls, + EapQtPluginHandle::PluginPlainMschapv2, + KErrWlanEapGtcFailed, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginPlainMschapv2))); +#endif +} + +void TestWlanWizardEap::tc_eap_ttls_mschapv2_connect_KErrWlanEapMsChapv2() +{ +#ifdef tc_eap_ttls_mschapv2_connect_KErrWlanEapMsChapv2_enabled + tc_eap_peap_ttls( + EapQtPluginHandle::PluginEapTtls, + EapQtPluginHandle::PluginPlainMschapv2, + KErrWlanEapMsChapv2, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginPlainMschapv2))); +#endif +} + +void TestWlanWizardEap::tc_eap_ttls_mschapv2_connect_KErrWlanNotSubscribed() +{ +#ifdef tc_eap_ttls_mschapv2_connect_KErrWlanNotSubscribed_enabled + tc_eap_peap_ttls( + EapQtPluginHandle::PluginEapTtls, + EapQtPluginHandle::PluginPlainMschapv2, + KErrWlanNotSubscribed, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginPlainMschapv2))); +#endif +} + +void TestWlanWizardEap::tc_eap_ttls_gtc_back_and_forward() +{ +#ifdef tc_eap_ttls_gtc_back_and_forward_enabled + tc_eap_peap_ttls( + EapQtPluginHandle::PluginEapTtls, + EapQtPluginHandle::PluginEapGtc, + KErrWlanNotSubscribed, + hbTrId("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapGtc))); + + // Go back to outertype selection page + QCOMPARE(mouseClickPrevious(), true); + QTest::qWait(WaitTimeForUi); + verify_username_password(EapQtPluginHandle::PluginEapGtc); + + QCOMPARE(mouseClickPrevious(), true); + QTest::qWait(WaitTimeForUi); + verify_innertype( + EapQtPluginHandle::PluginEapTtls, + ButtonEnabled); + + QCOMPARE(mouseClickPrevious(), true); + QTest::qWait(WaitTimeForUi); + verify_identity_page(eapTypeToString(EapQtPluginHandle::PluginEapTtls)); + + QCOMPARE(mouseClickPrevious(), true); + QTest::qWait(WaitTimeForUi); + verify_ca_cert_page(); + + QCOMPARE(mouseClickPrevious(), true); + QTest::qWait(WaitTimeForUi); + verify_outertype(ButtonEnabled); + + // Go forward to username & password page + QCOMPARE(mouseClickNext(), true); + QTest::qWait(WaitTimeForUi); + verify_ca_cert_page(); + + // Create new validators + mEapQtUtilsContext->createEapIdentifyValidators(EapQtPluginHandle::PluginEapTtls); + mEapQtUtilsContext->createInnerTypeValidators(EapQtPluginHandle::PluginEapGtc); + + QCOMPARE(mouseClickNext(), true); + QTest::qWait(WaitTimeForUi); + verify_identity_page(eapTypeToString(EapQtPluginHandle::PluginEapTtls)); + + QCOMPARE(mouseClickNext(), true); + QTest::qWait(WaitTimeForUi); + verify_innertype( + EapQtPluginHandle::PluginEapTtls, + ButtonEnabled); + + QCOMPARE(mouseClickNext(), true); + QTest::qWait(WaitTimeForUi); + verify_username_password(EapQtPluginHandle::PluginEapGtc); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_set_outer_type_fails() +{ +#ifdef tc_eap_aka_set_outer_type_fails_enabled + const QString ssid("tc_eap_aka_set_outer_type_fails"); + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(false); + mWlanQtUtilsContext->setSignalWlanNetworkClosed(3, KErrCancel); + + mEapQtUtilsContext->setConfigurationReference(3, true); + mEapQtUtilsContext->createEapAkaSim(EapQtPluginHandle::PluginEapAka); + mEapQtUtilsContext->setSelectectedOuterTypesReturn(false); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa2, + false, false, false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( + verifyCurrentPageWithInfo( + WlanWizardPageInternal::PageGenericError, + hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret")), true ); + + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_save_outer_configuration_fails() +{ +#ifdef tc_eap_aka_save_outer_configuration_fails_enabled + const QString ssid("tc_eap_aka_save_outer_configuration_fails"); + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(false); + mWlanQtUtilsContext->setSignalWlanNetworkClosed(3, KErrCancel); + + mEapQtUtilsContext->setConfigurationReference(3, true); + mEapQtUtilsContext->createEapAkaSim(EapQtPluginHandle::PluginEapAka); + mEapQtUtilsContext->setOuterConfigReturn(false); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa2, + false, false, false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( + verifyCurrentPageWithInfo( + WlanWizardPageInternal::PageGenericError, + hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret")), true ); + + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_set_configuration_reference_fails() +{ +#ifdef tc_eap_aka_set_configuration_reference_fails_enabled + const QString ssid("tc_eap_aka_set_configuration_reference_fails"); + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(false); + mWlanQtUtilsContext->setSignalWlanNetworkClosed(3, KErrCancel); + + mEapQtUtilsContext->setConfigurationReference(3, false); + mEapQtUtilsContext->createEapAkaSim(EapQtPluginHandle::PluginEapAka); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa2, + false, false, false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( + verifyCurrentPageWithInfo( + WlanWizardPageInternal::PageGenericError, + hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret")), true ); + + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); +#endif +} + +void TestWlanWizardEap::tc_eap_peap_gtc_save_inner_configuration_fails() +{ +#ifdef tc_eap_peap_gtc_save_inner_configuration_fails_enabled + tc_eap_peap_ttls( + EapQtPluginHandle::PluginEapTtls, + EapQtPluginHandle::PluginEapGtc, + KErrGeneral, // Not used directly in sub test case + hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret"), + false ); +#endif +} + + +void TestWlanWizardEap::tc_eap_peap_identity_validators() +{ +#ifdef tc_eap_peap_identity_validators_enabled + const QString ssid("tc_eap_peap_identity_validators"); + const QString username("u"); + const QString password("p"); + const QString usernameIdentity("identity"); + const QString realm("realm.com"); + EapQtPluginHandle::Plugin outerType(EapQtPluginHandle::PluginPeap); + EapQtPluginHandle::Plugin innerType(EapQtPluginHandle::PluginEapGtc); + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(3, true); + mEapQtUtilsContext->createEapTtlsPeap( + outerType, + true, + true, + usernameIdentity, + true, + realm, + innerType ); + + EapQtValidatorStub* validatorUser = (EapQtValidatorStub*)mEapQtUtilsContext->validator( + EapQtExpandedEapType::TypePeap, EapQtConfig::Username); + EapQtValidatorStub* validatorRealm = (EapQtValidatorStub*)mEapQtUtilsContext->validator( + EapQtExpandedEapType::TypePeap,EapQtConfig::Realm); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa, + false, false, false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + verify_ca_cert_page_select_and_click_next(true); + + QCOMPARE( verifyCurrentPageWithInfo(EapWizardPage::PageIdentity, eapTypeToString(outerType)), true ); + // Check box checked next enabled + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE(verifyCheckBoxState("setlabel_53_val", true), true); + QCOMPARE(verifyCheckBoxState("setlabel_54_val", true), true); + + // 1. Username validator returns false, checkbox not checked + validatorUser->setReturnValue(EapQtValidator::StatusInvalid); + validatorRealm->setReturnValue(EapQtValidator::StatusOk); + + QCOMPARE(selectCheckBoxState("setlabel_53_val", false), true); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + // 2. Username validator returns true, checkbox not checked + validatorUser->setReturnValue(EapQtValidator::StatusOk); + validatorRealm->setReturnValue(EapQtValidator::StatusOk); + QCOMPARE( mouseClickObject("lineEditUsername"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditUsername", username), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + + // 3. back to valid state, checkboc checked + QCOMPARE(selectCheckBoxState("setlabel_53_val", true), true); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + + // 4. Realm validator returns false, checkbox not checked + validatorUser->setReturnValue(EapQtValidator::StatusOk); + validatorRealm->setReturnValue(EapQtValidator::StatusInvalid); + + QCOMPARE(selectCheckBoxState("setlabel_54_val", false), true); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + // 5. Realm validator returns true, checkbox not checked + validatorUser->setReturnValue(EapQtValidator::StatusOk); + validatorRealm->setReturnValue(EapQtValidator::StatusOk); + QCOMPARE( mouseClickObject("lineEditRealm"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditRealm", username), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + + // 6. back to valid state, checkboc checked + QCOMPARE(selectCheckBoxState("setlabel_54_val", true), true); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); +#endif +} + +void TestWlanWizardEap::tc_eap_leap_user_password_validators() +{ +#ifdef tc_eap_leap_user_password_validators_enabled + const QString ssid("tc_eap_leap_user_password_validators"); + const QString username("u"); + const QString password("p"); + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(3, true); + mEapQtUtilsContext->createLeap(username,password); + + EapQtValidatorStub* validatorUser = (EapQtValidatorStub*)mEapQtUtilsContext->validator( + EapQtExpandedEapType::TypeLeap, EapQtConfig::Username); + EapQtValidatorStub* validatorPassword = (EapQtValidatorStub*)mEapQtUtilsContext->validator( + EapQtExpandedEapType::TypeLeap, EapQtConfig::Password); + validatorUser->setReturnValue(EapQtValidator::StatusInvalid); + validatorPassword->setReturnValue(EapQtValidator::StatusInvalid); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa, + false, false, false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + + // 1. By default both validator return invalid + QCOMPARE( + verifyCurrentPageWithInfo( + EapWizardPage::PageUsernamePassword, + eapTypeToString(EapQtPluginHandle::PluginLeap)), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + // 2. User return ok, password invalid + validatorUser->setReturnValue(EapQtValidator::StatusOk); + QCOMPARE( mouseClickObject("lineEditUsername"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditUsername", username), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + // 3. User return ok, password ok + validatorPassword->setReturnValue(EapQtValidator::StatusOk); + QCOMPARE( mouseClickObject("lineEditPassword"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditPassword", password), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); +#endif +} + +void TestWlanWizardEap::tc_eap_tls_no_user_certificate() +{ +#ifdef tc_eap_tls_no_user_certificate_enabled + + const QString ssid("tc_eap_tls_no_user_certificate"); + + QList caCerts; + QList userCerts; + + EapQtCertificateInfo caCert; + caCert.setValue(EapQtCertificateInfo::CertificateLabel, "My Super Cert 1"); + caCerts.append(caCert); + + mEapQtUtilsContext->createEapTls( + caCerts, + 0, + userCerts, + -1); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa2, + false, false, false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + verify_ca_cert_page_select_and_click_next(false); + verify_user_cert_page_select_and_click_next(ButtonDisabled, -1); + +#endif +} + +void TestWlanWizardEap::tc_eap_tls_one_user_certificate_with_ca_selection() +{ +#ifdef tc_eap_tls_one_user_certificate_with_ca_selection_enabled + const QString ssid("tc_eap_tls_one_user_certificate_with_ca_selection"); + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(3, true); + + QList caCerts; + QList userCerts; + + EapQtCertificateInfo cert; + cert.setValue(EapQtCertificateInfo::CertificateLabel, "My CA Cert"); + caCerts.append(cert); + + cert.setValue(EapQtCertificateInfo::CertificateLabel, "My User Cert"); + userCerts.append(cert); + + mEapQtUtilsContext->createEapTls( + caCerts, + 0, + userCerts, + 0); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa2, + false, false, false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + verify_ca_cert_page_select_and_click_next(false); + verify_user_cert_page_select_and_click_next(ButtonEnabled, 0); + verify_identity_and_click_next(eapTypeToString(EapQtPluginHandle::PluginEapTls)); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + + QCOMPARE( verifySummaryPage( + ssid, + CMManagerShim::Infra, + false, + CMManagerShim::WlanSecModeWpa2, + false, + hbTrId("txt_occ_dblist_destination_val_internet"), + EapQtPluginHandle::PluginEapTls),true); + +#endif +} + +void TestWlanWizardEap::tc_eap_tls_two_user_certificates() +{ +#ifdef tc_eap_tls_two_user_certificates_enabled + const QString ssid("tc_eap_tls_two_user_certificates"); + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(3, true); + + QList caCerts; + QList userCerts; + + EapQtCertificateInfo cert; + cert.setValue(EapQtCertificateInfo::CertificateLabel, "My CA Cert"); + caCerts.append(cert); + cert.setValue(EapQtCertificateInfo::CertificateLabel, "My Super CA Cert"); + caCerts.append(cert); + + cert.setValue(EapQtCertificateInfo::CertificateLabel, "My User Cert"); + userCerts.append(cert); + cert.setValue(EapQtCertificateInfo::CertificateLabel, "My User Cert Second"); + userCerts.append(cert); + + mEapQtUtilsContext->createEapTls( + caCerts, + 0, + userCerts, + 1); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa2, + false, false, false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + verify_ca_cert_page_select_and_click_next(false); + verify_user_cert_page_select_and_click_next(ButtonDisabled, 1); + verify_identity_and_click_next(eapTypeToString(EapQtPluginHandle::PluginEapTls)); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + + QCOMPARE( verifySummaryPage( + ssid, + CMManagerShim::Infra, + false, + CMManagerShim::WlanSecModeWpa2, + false, + hbTrId("txt_occ_dblist_destination_val_internet"), + EapQtPluginHandle::PluginEapTls),true); + +#endif +} + +void TestWlanWizardEap::tc_eap_tls_back_and_forward_certs_with_cert_update() +{ +#ifdef tc_eap_tls_back_and_forward_certs_with_cert_update_enabled + const QString ssid("tc_eap_tls_two_user_certificates"); + + const QString caCert1("My CA Cert"); + const QString caCert2("My CA Cert Second"); + + const QString userCert1("My User Cert"); + const QString userCert2("My User Cert Second"); + + QList caCerts; + QList userCerts; + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(3, true); + + EapQtCertificateInfo cert; + cert.setValue(EapQtCertificateInfo::CertificateLabel, caCert1); + caCerts.append(cert); + + cert.setValue(EapQtCertificateInfo::CertificateLabel, userCert1); + userCerts.append(cert); + + mEapQtUtilsContext->createEapTls( + caCerts, + 0, + userCerts, + 0); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa2, + false, false, false); + + mView->showWizard(); + verify_outertype_select_first(ButtonDisabled); + verify_ca_cert_page_select_and_click_next(true); + verify_user_cert_page_select_and_click_next(ButtonEnabled, 0); + verify_identity_page(eapTypeToString(EapQtPluginHandle::PluginEapTls)); + + // backwards + QCOMPARE(mouseClickPrevious(), true); + QTest::qWait(WaitTimeForUi); + verify_user_cert_page(ButtonEnabled, userCert1, 0 ); + + QCOMPARE(mouseClickPrevious(), true); + QTest::qWait(WaitTimeForUi); + verify_ca_cert_page(); + + QCOMPARE(mouseClickPrevious(), true); + QTest::qWait(WaitTimeForUi); + verify_outertype(ButtonEnabled); + + cert.setValue(EapQtCertificateInfo::CertificateLabel, caCert2); + caCerts.append(cert); + mEapQtUtilsContext->setCertsCa(caCerts); + + cert.setValue(EapQtCertificateInfo::CertificateLabel, userCert2); + userCerts.append(cert); + mEapQtUtilsContext->setCertsUser(userCerts); + + mEapQtUtilsContext->createEapIdentifyValidators(EapQtPluginHandle::PluginEapTls); + + // Forward + QCOMPARE(mouseClickNext(), true); + verify_ca_cert_page_select_and_click_next(false); + verify_user_cert_page(ButtonDisabled); + + // backwards + QCOMPARE(mouseClickPrevious(), true); + QTest::qWait(WaitTimeForUi); + verify_ca_cert_page(caCert1, 1); + + QCOMPARE(mouseClickPrevious(), true); + QTest::qWait(WaitTimeForUi); + verify_outertype(ButtonEnabled); + + QCOMPARE(mouseClickNext(), true); + verify_ca_cert_page(caCert1, 1); + + QCOMPARE(mouseClickNext(), true); + verify_user_cert_page_select_and_click_next(ButtonDisabled, 0); + + verify_identity_and_click_next(eapTypeToString(EapQtPluginHandle::PluginEapTls)); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + + QCOMPARE( verifySummaryPage( + ssid, + CMManagerShim::Infra, + false, + CMManagerShim::WlanSecModeWpa2, + false, + hbTrId("txt_occ_dblist_destination_val_internet"), + EapQtPluginHandle::PluginEapTls),true); + +#endif +} + +void TestWlanWizardEap::tc_eap_sim_finish() +{ +#ifdef tc_eap_sim_finish_enabled + tc_eap_aka_sim(EapQtPluginHandle::PluginEapAka); + + QCOMPARE( mouseClickFinish(), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyStatus(WizardStatusSignalFinished, 3), true); +#endif +} + +void TestWlanWizardEap::tc_eap_sim_cancel() +{ +#ifdef tc_eap_sim_cancel_enabled + tc_eap_aka_sim(EapQtPluginHandle::PluginEapAka); + + QCOMPARE( mouseClickCancel(), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE(verifyStatus(WizardStatusSignalCancelled), true); +#endif +} + +void TestWlanWizardEap::tc_eap_fast_confirmed() +{ +#ifdef tc_eap_fast_confirmed_enabled + tc_eap_fast( + EapQtPacStoreConfig::PacStoreStatePasswordStored, + true); +#endif +} + +void TestWlanWizardEap::tc_eap_fast_new_store() +{ +#ifdef tc_eap_fast_new_store_enabled + tc_eap_fast( + EapQtPacStoreConfig::PacStoreStateStoreNotExists, + true); +#endif +} + +void TestWlanWizardEap::tc_eap_fast_new_store_save_fails() +{ +#ifdef tc_eap_fast_new_store_save_fails_enabled + tc_eap_fast( + EapQtPacStoreConfig::PacStoreStateStoreNotExists, + false); +#endif +} + +void TestWlanWizardEap::tc_eap_fast_new_store_and_validators() +{ +#ifdef tc_eap_fast_new_store_and_validators_enabled + const QString ssid("tc_eap_fast_new_store_and_validators"); + const QString username("user"); + + mWlanQtUtilsContext->setCreateWlanIapResult(4); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(4); + mWlanQtUtilsContext->setSignalIctResult(4, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(4, true); + mEapQtUtilsContext->createEapFast(EapQtPacStoreConfig::PacStoreStateStoreNotExists); + mEapQtUtilsContext->createInner( + EapQtPluginHandle::PluginEapFast, + EapQtPluginHandle::PluginEapMschapv2, + "u", + "p"); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa, + false, false, false); + + mView->showWizard(); + EapQtValidatorStub *validator = (EapQtValidatorStub*)mEapQtUtilsContext->validatorPacStore( + EapQtPacStoreConfig::PacStorePassword); + validator->setReturnValue(EapQtValidator::StatusInvalid); + + verify_outertype_select_first(ButtonDisabled); + verify_new_pac_store_password_page(ButtonDisabled); + + QCOMPARE( mouseClickObject("lineEditUsername"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditUsername", username), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + validator->setReturnValue(EapQtValidator::StatusOk); + + QCOMPARE( mouseClickObject("lineEditPassword"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditPassword", username), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + + QCOMPARE( mouseClickNext(), true ); + verify_username_password(EapQtPluginHandle::PluginEapMschapv2); + +#endif +} + + +void TestWlanWizardEap::tc_eap_fast_new_store_back_and_forwards() +{ +#ifdef tc_eap_fast_new_store_back_and_forwards_enabled + const QString ssid("tc_eap_fast_new_store_back_and_forwards"); + const QString username("u"); + const QString password("p"); + + mWlanQtUtilsContext->setCreateWlanIapResult(4); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(4); + mWlanQtUtilsContext->setSignalIctResult(4, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(4, true); + mEapQtUtilsContext->createEapFast(EapQtPacStoreConfig::PacStoreStateStoreNotExists); + mEapQtUtilsContext->createInner( + EapQtPluginHandle::PluginEapFast, + EapQtPluginHandle::PluginEapMschapv2, + username, + password); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa, + false, false, false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + verify_new_pac_store_password_page(ButtonEnabled); + QCOMPARE( mouseClickNext(), true ); + verify_username_password(EapQtPluginHandle::PluginEapMschapv2); + + // backwards + QCOMPARE( mouseClickPrevious(), true ); + verify_new_pac_store_password_page(ButtonEnabled); + QCOMPARE( mouseClickPrevious(), true ); + + mEapQtUtilsContext->createInnerTypeValidators(EapQtPluginHandle::PluginEapMschapv2); + + // forwards + verify_outertype_select_first(ButtonEnabled); + verify_new_pac_store_password_page(ButtonEnabled); + QCOMPARE( mouseClickNext(), true ); + verify_username_password(EapQtPluginHandle::PluginEapMschapv2); +#endif +} + +void TestWlanWizardEap::tc_eap_fast_new_store_read_config_fail() +{ +#ifdef tc_eap_fast_new_store_read_config_fail_enabled + tc_eap_fast( + EapQtPacStoreConfig::PacStoreStateStoreNotExists, + true, + false); +#endif +} + +void TestWlanWizardEap::tc_eap_fast_confirm_store() +{ +#ifdef tc_eap_fast_confirm_store_enabled + tc_eap_fast( + EapQtPacStoreConfig::PacStoreStatePasswordRequired, + true); +#endif +} + +void TestWlanWizardEap::tc_eap_fast_confirm_store_and_validators() +{ +#ifdef tc_eap_fast_confirm_store_and_validators_enabled + const QString ssid("tc_eap_fast_confirm_store_and_validators"); + const QString username_invalid("invalid"); + const QString username_valid("valid"); + + mWlanQtUtilsContext->setCreateWlanIapResult(4); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(4); + mWlanQtUtilsContext->setSignalIctResult(4, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(4, true); + mEapQtUtilsContext->createEapFast(EapQtPacStoreConfig::PacStoreStatePasswordRequired); + mEapQtUtilsContext->createInner( + EapQtPluginHandle::PluginEapFast, + EapQtPluginHandle::PluginEapMschapv2, + "u", + "p"); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa, + false, false, false); + + mView->showWizard(); + EapQtValidatorStub *validator = (EapQtValidatorStub*)mEapQtUtilsContext->validatorPacStore( + EapQtPacStoreConfig::PacStorePasswordConfirmation); + validator->setReturnValue(EapQtValidator::StatusInvalid); + + verify_outertype_select_first(ButtonDisabled); + verify_confirm_pac_store_password_page(ButtonEnabled); + + QCOMPARE( mouseClickObject("lineEditPasswordConfirm"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditPasswordConfirm", username_invalid), true ); + QCOMPARE( mouseClickObject("labelError"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + + QCOMPARE( mouseClickNext(), true ); + verify_confirm_pac_store_password_page(ButtonEnabled); + QCOMPARE( verifyDialogText("labelError", hbTrId("txt_occ_info_incorrect_password")), true); + + + validator->setReturnValue(EapQtValidator::StatusOk); + + QCOMPARE( mouseClickObject("lineEditPasswordConfirm"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditPasswordConfirm", username_valid), true ); + QCOMPARE( mouseClickObject("labelError"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyDialogText("labelError", hbTrId("txt_occ_info_incorrect_password")), false); + + QCOMPARE( mouseClickNext(), true ); + verify_username_password(EapQtPluginHandle::PluginEapMschapv2); + +#endif +} + +void TestWlanWizardEap::tc_eap_fast_confirm_store_back_and_forwards() +{ +#ifdef tc_eap_fast_confirm_store_back_and_forwards_enabled + const QString ssid("tc_eap_fast_confirm_store_back_and_forwards"); + const QString username("u"); + const QString password("p"); + + mWlanQtUtilsContext->setCreateWlanIapResult(4); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(4); + mWlanQtUtilsContext->setSignalIctResult(4, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(4, true); + mEapQtUtilsContext->createEapFast(EapQtPacStoreConfig::PacStoreStatePasswordRequired); + mEapQtUtilsContext->createInner( + EapQtPluginHandle::PluginEapFast, + EapQtPluginHandle::PluginEapMschapv2, + username, + password); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa, + false, false, false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + verify_confirm_pac_store_password_page(ButtonEnabled); + QCOMPARE( mouseClickNext(), true ); + verify_username_password(EapQtPluginHandle::PluginEapMschapv2); + + // backwards + QCOMPARE( mouseClickPrevious(), true ); + verify_confirm_pac_store_password_page(ButtonEnabled); + QCOMPARE( mouseClickPrevious(), true ); + + mEapQtUtilsContext->createInnerTypeValidators(EapQtPluginHandle::PluginEapMschapv2); + + // forwards + verify_outertype_select_first(ButtonEnabled); + verify_confirm_pac_store_password_page(ButtonEnabled); + QCOMPARE( mouseClickNext(), true ); + verify_username_password(EapQtPluginHandle::PluginEapMschapv2); +#endif +} + + +// --------------------------------------------------------- +// HELPPER VERIFICATORS & NAVIGATORS +// --------------------------------------------------------- + +void TestWlanWizardEap::verify_outertype_select_first( + TestWlanWizardContext::ButtonStatus nextButtonStatus) +{ + verify_outertype(nextButtonStatus); + + QCOMPARE( selectRadioButton( "list", 0 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE( mouseClickNext(), true ); +} + +void TestWlanWizardEap::verify_outertype( + TestWlanWizardContext::ButtonStatus nextButtonStatus) +{ + QCOMPARE( verifyCurrentPage(EapWizardPage::PageOuterType), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, nextButtonStatus, ButtonHidden), true ); +} + +void TestWlanWizardEap::verify_innertype_select_first( + int outerType, + TestWlanWizardContext::ButtonStatus nextButtonStatus) +{ + verify_innertype(outerType, nextButtonStatus); + + QCOMPARE( selectRadioButton( "list", 0 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE( mouseClickNext(), true ); +} + +void TestWlanWizardEap::verify_innertype( + int outerType, + TestWlanWizardContext::ButtonStatus nextButtonStatus) +{ + int pageId; + if (outerType == EapQtPluginHandle::PluginPeap){ + pageId = EapWizardPage::PageInnerTypePeap; + + } else { + Q_ASSERT(outerType == EapQtPluginHandle::PluginEapTtls); + pageId = EapWizardPage::PageInnerTypeEapTtls; + } + QCOMPARE( verifyCurrentPageWithInfo(pageId, eapTypeToString(outerType)), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, nextButtonStatus, ButtonHidden), true ); +} + +void TestWlanWizardEap::verify_username_password_click_next( + int type, + const QString &username, + const QString &password) +{ + verify_username_password(type); + + QCOMPARE( mouseClickObject("lineEditUsername"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditUsername", username), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mouseClickObject("lineEditPassword"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditPassword", password), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mouseClickObject("setlabel_56"), true ); + QCOMPARE( mouseClickNext(), true ); +} + +void TestWlanWizardEap::verify_username_password(int type) +{ + QCOMPARE( verifyCurrentPageWithInfo(EapWizardPage::PageUsernamePassword, eapTypeToString(type)), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); +} + +void TestWlanWizardEap::verify_ca_cert_page_select_and_click_next(bool automatic) +{ + verify_ca_cert_page(); + + int index = 0; + if (automatic == false) { + index = 1; + } + QCOMPARE( selectRadioButton( "list", index ), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE( mouseClickNext(), true ); +} + + +void TestWlanWizardEap::verify_ca_cert_page() +{ + QCOMPARE( verifyCurrentPage(EapWizardPage::PageCertificateCa), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + + QCOMPARE( verifyRadioButtonState( + "list", + 0, + hbTrId("txt_occ_setlabel_val_select_automatically")), true); +} + +void TestWlanWizardEap::verify_ca_cert_page(const QString &text, int index) +{ + QCOMPARE( verifyCurrentPage(EapWizardPage::PageCertificateCa), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + + QCOMPARE( verifyRadioButtonState("list", index, text), true); +} + +void TestWlanWizardEap::verify_user_cert_page_select_and_click_next( + ButtonStatus nextButtonStatus, + int index) +{ + verify_user_cert_page(nextButtonStatus); + + if (index != -1){ + QCOMPARE( selectRadioButton( "list", index ), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE( mouseClickNext(), true ); + } else { + QCOMPARE( + verifyDialogText( + "errorLabel", + hbTrId("txt_occ_dialog_no_certificates_installed_wizard_c")), true); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + } +} + +void TestWlanWizardEap::verify_user_cert_page(ButtonStatus nextButtonStatus) +{ + QCOMPARE( verifyCurrentPage(EapWizardPage::PageCertificateUser), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, nextButtonStatus, ButtonHidden), true ); +} + + +void TestWlanWizardEap::verify_user_cert_page( + ButtonStatus nextButtonStatus, + const QString &text, + int index) +{ + QCOMPARE( verifyCurrentPage(EapWizardPage::PageCertificateUser), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, nextButtonStatus, ButtonHidden), true ); + + QCOMPARE( verifyRadioButtonState("list", index, text), true); +} + +void TestWlanWizardEap::verify_identity_modify_and_click_next( + const QString &outerType, + bool usernameAutomatic, + const QString &username, + bool realmAutomatic, + const QString &realm) +{ + QCOMPARE( verifyCurrentPageWithInfo(EapWizardPage::PageIdentity, outerType), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE(verifyCheckBoxState("setlabel_53_val", true), true); + QCOMPARE(verifyCheckBoxState("setlabel_54_val", true), true); + + QCOMPARE(selectCheckBoxState("setlabel_53_val", usernameAutomatic), true); + QCOMPARE(selectCheckBoxState("setlabel_54_val", realmAutomatic), true); + + QTest::qWait(WaitTimeForUi); + + QCOMPARE(verifyCheckBoxState("setlabel_53_val", usernameAutomatic), true); + QCOMPARE(verifyCheckBoxState("setlabel_54_val", realmAutomatic), true); + + QCOMPARE( mouseClickObject("lineEditUsername"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditUsername", username), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mouseClickObject("lineEditRealm"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditRealm", realm), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mouseClickObject("setlabel_53"), true ); + QCOMPARE( mouseClickNext(), true ); +} + +void TestWlanWizardEap::verify_identity_and_click_next(const QString &outerType) +{ + verify_identity_page(outerType); + + QCOMPARE(verifyCheckBoxState("setlabel_53_val", true), true); + QCOMPARE(verifyCheckBoxState("setlabel_54_val", true), true); + + QCOMPARE( mouseClickObject("setlabel_53"), true ); + QCOMPARE( mouseClickNext(), true ); +} + +void TestWlanWizardEap::verify_identity_page(const QString &outerType) +{ + QCOMPARE( verifyCurrentPageWithInfo(EapWizardPage::PageIdentity, outerType), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); +} + + +void TestWlanWizardEap::verify_new_pac_store_password_page( + ButtonStatus nextButtonStatus ) +{ + QCOMPARE( verifyCurrentPage(EapWizardPage::PageNewPacStorePassword), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, nextButtonStatus, ButtonHidden), true ); +} + + +void TestWlanWizardEap::verify_confirm_pac_store_password_page( + ButtonStatus nextButtonStatus) +{ + QCOMPARE( verifyCurrentPage(EapWizardPage::PagePromptPacStorePassword), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, nextButtonStatus, ButtonHidden), true ); +} + +// --------------------------------------------------------- +// SUBTEST CASES +// --------------------------------------------------------- + + +void TestWlanWizardEap::tc_eap_aka_sim(int type) +{ + // TODO: verify IAP settings + // TODO: verify call stack + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(3, true); + mEapQtUtilsContext->createEapAkaSim(type); + + const QString ssid("tc_eap_aka_sim"); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecMode802_1x, + false, false, false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + + QCOMPARE( verifySummaryPage( + ssid, + CMManagerShim::Infra, + false, + CMManagerShim::WlanSecMode802_1x, + true, + hbTrId("txt_occ_dblist_destination_val_internet"), + type),true); +} + +void TestWlanWizardEap::tc_eap_peap_ttls( + int outerType, + int innerType, + int errorCode, + const QString &errorString, + bool saveInnerConfReturn ) +{ + // TODO: verify IAP settings + // TODO: verify call stack + const QString ssid("tc_eap_peap_ttls"); + const QString username("u"); + const QString password("p"); + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + + if (errorCode == KErrNone) { + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + } else { + mWlanQtUtilsContext->setConnectionSuccessed(false); + mWlanQtUtilsContext->setSignalWlanNetworkClosed(3, errorCode); + } + mEapQtUtilsContext->setConfigurationReference(3, true); + mEapQtUtilsContext->createEapTtlsPeap( + (EapQtPluginHandle::Plugin)outerType, + true, + true, + QString(), //usernameIdentity, + true, + QString(), //realm, + (EapQtPluginHandle::Plugin)innerType ); + + mEapQtUtilsContext->createInner( + (EapQtPluginHandle::Plugin)outerType, + (EapQtPluginHandle::Plugin)innerType, + username, + password); + + mEapQtUtilsContext->setInnerConfigReturn(saveInnerConfReturn); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa, + false, false, false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + verify_ca_cert_page_select_and_click_next(true); + verify_identity_and_click_next(eapTypeToString((EapQtPluginHandle::Plugin)outerType)); + verify_innertype_select_first( + (EapQtPluginHandle::Plugin)outerType, + ButtonDisabled); + + verify_username_password_click_next(innerType, username, password); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + if (errorCode == KErrNone){ + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + + QCOMPARE( verifySummaryPage( + ssid, + CMManagerShim::Infra, + false, + CMManagerShim::WlanSecModeWpa, + false, + hbTrId("txt_occ_dblist_destination_val_internet"), + (EapQtPluginHandle::Plugin)outerType, + (EapQtPluginHandle::Plugin)innerType),true); + + } else { + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, errorString), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + } +} + +void TestWlanWizardEap::tc_eap_aka_connect_error( + int errorCode, + const QString &errorString) +{ + // TODO: verify IAP settings + // TODO: verify call stack + + const QString ssid(errorString); + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(false); + mWlanQtUtilsContext->setSignalWlanNetworkClosed(3, errorCode); + + mEapQtUtilsContext->setConfigurationReference(3, true); + mEapQtUtilsContext->createEapAkaSim(EapQtPluginHandle::PluginEapAka); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa2, + false, false, false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, errorString), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); +} + + +void TestWlanWizardEap::tc_eap_fast( + int pacStoreState, + bool savePacStoreReturn, + bool readPacStoreReturn) +{ + // TODO: verify IAP settings + // TODO: verify call stack + + const QString ssid("tc_eap_fast"); + const QString username("u"); + const QString password("p"); + + mWlanQtUtilsContext->setCreateWlanIapResult(4); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(4); + mWlanQtUtilsContext->setSignalIctResult(4, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(4, true); + mEapQtUtilsContext->createEapFast(pacStoreState); + mEapQtUtilsContext->setPacStoreConfigSaveReturn(savePacStoreReturn); + mEapQtUtilsContext->setPacStoreConfigReadReturn(readPacStoreReturn); + + if (!readPacStoreReturn) { + EapQtPacStoreConfig pacStoreConfig; + pacStoreConfig.setValue( + EapQtPacStoreConfig::PacStoreReset, + true); + + mEapQtUtilsContext->setPacStoreConfigSave(pacStoreConfig, true); + } + + mEapQtUtilsContext->createInner( + EapQtPluginHandle::PluginEapFast, + EapQtPluginHandle::PluginEapMschapv2, + username, + password); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa, + false, false, false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + + if (!readPacStoreReturn) { + EapQtPacStoreConfig pacStoreConfig; + + pacStoreConfig.setValue( + EapQtPacStoreConfig::PacStorePassword, + ""); + + pacStoreConfig.setValue( + EapQtPacStoreConfig::PacStoreSavePassword, + true); + + + mEapQtUtilsContext->setPacStoreConfigSave(pacStoreConfig, true); + } + + switch (pacStoreState){ + case EapQtPacStoreConfig::PacStoreStateStoreNotExists: + verify_new_pac_store_password_page(ButtonEnabled); + QCOMPARE( mouseClickNext(), true ); + break; + + case EapQtPacStoreConfig::PacStoreStatePasswordRequired: + verify_confirm_pac_store_password_page(ButtonEnabled); + QCOMPARE( mouseClickNext(), true ); + break; + } + + verify_username_password_click_next(EapQtPluginHandle::PluginEapMschapv2,username,password); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + if (savePacStoreReturn) { + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + + QCOMPARE( verifySummaryPage( + ssid, + CMManagerShim::Infra, + false, + CMManagerShim::WlanSecModeWpa, + false, + hbTrId("txt_occ_dblist_destination_val_internet"), + EapQtPluginHandle::PluginEapFast, + EapQtPluginHandle::PluginEapMschapv2, + true) ,true); + } else { + QCOMPARE( + verifyCurrentPageWithInfo( + WlanWizardPageInternal::PageGenericError, + hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret")), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + } +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardeap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardeap.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#ifndef TESTWLANWIZARDRNDEAP_H +#define TESTWLANWIZARDRNDEAP_H + +#include "testwlanwizardcontext.h" + +class TestWlanWizardEap : public TestWlanWizardContext +{ +Q_OBJECT + +private slots: + void tc_eap_outer_page_orientation_change(); + void tc_eap_aka(); + void tc_eap_sim(); + void tc_eap_leap(); + void tc_eap_peap_gtc(); + void tc_eap_peap_mschapv2(); + void tc_eap_ttls_mschapv2(); + void tc_eap_ttls_pap(); + void tc_eap_ttls_gtc(); + void tc_eap_aka_connect_KErrWlanUserRejected(); + void tc_eap_aka_connect_KErrWlanUserCertificateExpired(); + void tc_eap_aka_connect_KErrWlanServerCertificateExpired(); + void tc_eap_aka_connect_KErrWlanCerficateVerifyFailed(); + void tc_eap_aka_connect_KErrWlanNoCipherSuite(); + void tc_eap_aka_connect_KErrWlanSimNotInstalled(); + void tc_eap_aka_connect_KErrWlanEapFastPacStoreCorrupted(); + void tc_eap_aka_connect_KErrWlanEapSimFailed(); + void tc_eap_aka_connect_KErrWlanNotSubscribed(); + void tc_eap_aka_connect_KErrCancel(); + void tc_eap_aka_connect_KErrWlanEapTlsFailed(); + void tc_eap_aka_connect_KErrWlanEapPeapFailed(); + void tc_eap_aka_connect_KErrWlanEapAkaFailed(); + void tc_eap_aka_connect_KErrWlanEapTtlsFailed(); + void tc_eap_aka_connect_KErrWlanLeapFailed(); + void tc_eap_aka_connect_KErrWlanNoUserCertificate(); + void tc_eap_aka_connect_KErrWlanEapFastTunnelCompromiseError(); + void tc_eap_aka_connect_KErrWlanEapFastUnexpextedTlvExhanged(); + void tc_eap_aka_connect_KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled(); + void tc_eap_aka_connect_KErrWlanEapFastNoMatchingPacForAid(); + void tc_eap_aka_connect_KErrWlanEapFastAuthFailed(); + void tc_eap_aka_connect_KErrWlanAccessBarred(); + void tc_eap_aka_connect_KErrWlanPasswordExpired(); + void tc_eap_aka_connect_KErrWlanNoDialinPermissions(); + void tc_eap_aka_connect_KErrWlanAccountDisabled(); + void tc_eap_aka_connect_KErrWlanRestrictedLogonHours(); + void tc_eap_ttls_mschapv2_connect_KErrWlanEapGtcFailed(); + void tc_eap_ttls_mschapv2_connect_KErrWlanEapMsChapv2(); + void tc_eap_ttls_mschapv2_connect_KErrWlanNotSubscribed(); + void tc_eap_ttls_gtc_back_and_forward(); + void tc_eap_aka_set_outer_type_fails(); + void tc_eap_aka_save_outer_configuration_fails(); + void tc_eap_aka_set_configuration_reference_fails(); + void tc_eap_peap_gtc_save_inner_configuration_fails(); + void tc_eap_peap_identity_validators(); + void tc_eap_leap_user_password_validators(); + void tc_eap_tls_no_user_certificate(); + void tc_eap_tls_one_user_certificate_with_ca_selection(); + void tc_eap_tls_two_user_certificates(); + void tc_eap_tls_back_and_forward_certs_with_cert_update(); + void tc_eap_sim_finish(); + void tc_eap_sim_cancel(); + void tc_eap_fast_confirmed(); + void tc_eap_fast_new_store(); + void tc_eap_fast_new_store_save_fails(); + void tc_eap_fast_new_store_and_validators(); + void tc_eap_fast_new_store_back_and_forwards(); + void tc_eap_fast_new_store_read_config_fail(); + void tc_eap_fast_confirm_store(); + void tc_eap_fast_confirm_store_and_validators(); + void tc_eap_fast_confirm_store_back_and_forwards(); + +private: // Helpper methods + void verify_outertype_select_first( + TestWlanWizardContext::ButtonStatus nextButtonStatus); + void verify_outertype( + TestWlanWizardContext::ButtonStatus nextButtonStatus); + + void verify_innertype_select_first( + int outerType, + TestWlanWizardContext::ButtonStatus nextButtonStatus); + + void verify_innertype( + int outerType, + TestWlanWizardContext::ButtonStatus nextButtonStatus); + + void verify_username_password_click_next( + int type, + const QString &username, + const QString &password); + + void verify_username_password(int type); + + void verify_ca_cert_page_select_and_click_next(bool automatic); + void verify_ca_cert_page(); + void verify_ca_cert_page( const QString &text, int index); + + void verify_user_cert_page_select_and_click_next( + ButtonStatus nextButtonStatus, + int index); + + void verify_user_cert_page(ButtonStatus nextButtonStatus); + void verify_user_cert_page( + ButtonStatus nextButtonStatus, + const QString &text, + int index); + + void verify_identity_modify_and_click_next( + const QString &outerType, + bool usernameAutomatic, + const QString &username, + bool realmAutomatic, + const QString &realm); + void verify_identity_and_click_next(const QString &outerType); + void verify_identity_page(const QString &outerType); + + void verify_new_pac_store_password_page(ButtonStatus nextButtonStatus); + void verify_confirm_pac_store_password_page(ButtonStatus nextButtonStatus); + +private: // Helpper test cases + void tc_eap_aka_sim(int type); + + void tc_eap_peap_ttls( + int outerType, + int innerType, + int errorCode = 0, + const QString &errorString = QString(), + bool saveInnerConfReturn = true); + + void tc_eap_aka_connect_error( + int errorCode, + const QString &errorString); + + void tc_eap_fast( + int pacStoreState, + bool savePacStoreReturn, + bool readPacStoreReturn = true); + + +}; + +#endif /* TESTWLANWIZARDRNDEAP_H */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardeap_conf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardeap_conf.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +// System includes + +// User includes + +// External function prototypes + +// Local constants + +#define tc_eap_outer_page_orientation_change_enabled +#define tc_eap_aka_enabled +#define tc_eap_sim_enabled +#define tc_eap_leap_enabled +#define tc_eap_peap_gtc_enabled +#define tc_eap_peap_mschapv2_enabled +#define tc_eap_ttls_mschapv2_enabled +#define tc_eap_ttls_pap_enabled +#define tc_eap_ttls_gtc_enabled +#define tc_eap_aka_connect_KErrWlanUserRejected_enabled +#define tc_eap_aka_connect_KErrWlanUserCertificateExpired_enabled +#define tc_eap_aka_connect_KErrWlanServerCertificateExpired_enabled +#define tc_eap_aka_connect_KErrWlanCerficateVerifyFailed_enabled +#define tc_eap_aka_connect_KErrWlanNoCipherSuite_enabled +#define tc_eap_aka_connect_KErrWlanSimNotInstalled_enabled +#define tc_eap_aka_connect_KErrWlanEapFastPacStoreCorrupted_enabled +#define tc_eap_aka_connect_KErrWlanEapSimFailed_enabled +#define tc_eap_aka_connect_KErrWlanNotSubscribed_enabled +#define tc_eap_aka_connect_KErrCancel_enabled +#define tc_eap_aka_connect_KErrWlanEapTlsFailed_enabled +#define tc_eap_aka_connect_KErrWlanEapPeapFailed_enabled +#define tc_eap_aka_connect_KErrWlanEapAkaFailed_enabled +#define tc_eap_aka_connect_KErrWlanEapTtlsFailed_enabled +#define tc_eap_aka_connect_KErrWlanLeapFailed_enabled +#define tc_eap_aka_connect_KErrWlanNoUserCertificate_enabled +#define tc_eap_aka_connect_KErrWlanEapFastTunnelCompromiseError_enabled +#define tc_eap_aka_connect_KErrWlanEapFastUnexpextedTlvExhanged_enabled +#define tc_eap_aka_connect_KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled_enabled +#define tc_eap_aka_connect_KErrWlanEapFastNoMatchingPacForAid_enabled +#define tc_eap_aka_connect_KErrWlanEapFastAuthFailed_enabled +#define tc_eap_aka_connect_KErrWlanAccessBarred_enabled +#define tc_eap_aka_connect_KErrWlanPasswordExpired_enabled +#define tc_eap_aka_connect_KErrWlanNoDialinPermissions_enabled +#define tc_eap_aka_connect_KErrWlanAccountDisabled_enabled +#define tc_eap_aka_connect_KErrWlanRestrictedLogonHours_enabled +#define tc_eap_ttls_mschapv2_connect_KErrWlanEapGtcFailed_enabled +#define tc_eap_ttls_mschapv2_connect_KErrWlanEapMsChapv2_enabled +#define tc_eap_ttls_mschapv2_connect_KErrWlanNotSubscribed_enabled +#define tc_eap_ttls_gtc_back_and_forward_enabled +#define tc_eap_aka_set_outer_type_fails_enabled +#define tc_eap_aka_save_outer_configuration_fails_enabled +#define tc_eap_aka_set_configuration_reference_fails_enabled +#define tc_eap_peap_gtc_save_inner_configuration_fails_enabled +#define tc_eap_peap_identity_validators_enabled +#define tc_eap_leap_user_password_validators_enabled +#define tc_eap_tls_no_user_certificate_enabled +#define tc_eap_tls_one_user_certificate_with_ca_selection_enabled +#define tc_eap_tls_two_user_certificates_enabled +#define tc_eap_tls_back_and_forward_certs_with_cert_update_enabled +#define tc_eap_sim_finish_enabled +#define tc_eap_sim_cancel_enabled +#define tc_eap_fast_confirmed_enabled +#define tc_eap_fast_new_store_enabled +#define tc_eap_fast_new_store_save_fails_enabled +#define tc_eap_fast_new_store_and_validators_enabled +#define tc_eap_fast_new_store_back_and_forwards_enabled +#define tc_eap_fast_new_store_read_config_fail_enabled +#define tc_eap_fast_confirm_store_enabled +#define tc_eap_fast_confirm_store_and_validators_enabled +#define tc_eap_fast_confirm_store_back_and_forwards_enabled + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardmanual.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardmanual.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,1170 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "testwlanwizardmanual.h" +#include "testwlanwizardmanual_conf.h" +#include "hbautotest.h" +#include "wlanwizard.h" +#include "wlanwizard_p.h" +#include "wlanwizardpagessid.h" +#include "wlanqtutils_context.h" +#include "wlanqtutils.h" +#include "wlanqtutilsap.h" + +// External function prototypes + +// Local constants + + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------- +// TEST CASES +// --------------------------------------------------------- + + +void TestWlanWizardManual::tcStartWizard() +{ + qDebug("Start TestWlanWizardManual"); +} + +/*! + * + */ +void TestWlanWizardManual::tc_open_scan_results_received_at_scan_page() +{ +#ifdef tc_open_scan_results_received_at_scan_page_enabled + + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mWlanQtUtilsContext->setImmediateApScanResult(false); + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + mWlanQtUtilsContext->emitScanApReady(); + mWlanQtUtilsContext->setImmediateApScanResult(true); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_attempt_to_input_too_long_ssid() +{ +#ifdef tc_attempt_to_input_too_long_ssid_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); + + mWlanQtUtilsContext->setScanWlanDirectResult("12345678901234567890123456789012", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "1234567890123456789012345678901234567890"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "12345678901234567890123456789012"), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_scan_succesful_press_cancel_at_summary() +{ +#ifdef tc_scan_succesful_press_cancel_at_summary_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + // Currently against the spec in http://wikis.in.nokia.com/pub/UXD/101ConnectionManager/occ_logical_flows_and_wireframes.pdf + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + + QCOMPARE( mouseClickCancel(), true ); + + QTest::qWait(WaitTimeForUi); + +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_press_previous_at_scanning_page() +{ +#ifdef tc_press_previous_at_scanning_page_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + // Click previous button and next again + QCOMPARE( mouseClickPrevious(), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + // Currently against the spec in http://wikis.in.nokia.com/pub/UXD/101ConnectionManager/occ_logical_flows_and_wireframes.pdf + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_scan_succesful_go_to_summary_and_finish() +{ +#ifdef tc_scan_succesful_go_to_summary_and_finish_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); + + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + // Currently against the spec in http://wikis.in.nokia.com/pub/UXD/101ConnectionManager/occ_logical_flows_and_wireframes.pdf + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + QCOMPARE( mouseClickFinish(), true ); +#endif +} + +/*! + * Stop verifying buttons for views that have been already verified. + */ +void TestWlanWizardManual::tc_wep_pwd_too_short_error_label() +{ +#ifdef tc_wep_pwd_too_short_error_label_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + + // Key query short pwd + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "password"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyDialogText("labelErrorNote", hbTrId("txt_occ_dialog_key_is_of_incorrect_length_please")), true ); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + + // Key query success + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyDialogText("labelErrorNote", ""), true ); + QCOMPARE( insertTextToObject("lineEditKey", "12345"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_press_previous_at_key_query() +{ +#ifdef tc_press_previous_at_key_query_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); + QCOMPARE( mouseClickPrevious(), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_manual_selection_with_press_previous() +{ +#ifdef tc_manual_selection_with_press_previous_enabled + + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickPrevious(), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageNetworkMode, "huuhaa3421"), true ); + QCOMPARE( selectRadioButton( "list", 0 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageNetworkSecurity, "huuhaa3421"), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickPrevious(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageNetworkMode, "huuhaa3421"), true ); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageNetworkSecurity, "huuhaa3421"), true ); + QCOMPARE( selectRadioButton( "list", 0 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_illegal_characters_in_wep_key() +{ +#ifdef tc_illegal_characters_in_wep_key_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); + + QCOMPARE( insertTextToObject("lineEditKey", "passworddd"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyDialogText("labelErrorNote", hbTrId("txt_occ_dialog_illegal_characters_in_key_please_c")), true ); + QTest::qWait(WaitTimeForUi); + +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_too_short_wpa_key() +{ +#ifdef tc_too_short_wpa_key_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, true, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QTest::qWait(2000); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); + + QCOMPARE( insertTextToObject("lineEditKey", "1234"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyDialogText("labelErrorNote", hbTrId("txt_occ_dialog_preshared_key_too_short_at_least")), true ); + QTest::qWait(WaitTimeForUi); +#endif +} + +/*! + * wpa psk + */ +void TestWlanWizardManual::tc_wpa_psk_success() +{ +#ifdef tc_wpa_psk_success_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, true, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QTest::qWait(2000); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); + + QCOMPARE( insertTextToObject("lineEditKey", "1234567890"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); +#endif +} + +/*! + * no wpa psk + */ +void TestWlanWizardManual::tc_wpa_no_psk_go_to_eap_start() +{ +#ifdef tc_wpa_no_psk_go_to_eap_start_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageEapStart), true ); + QCOMPARE( mouseClickPrevious(), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageEapStart), true ); +#endif +} + +/*! + * wpa2 psk + */ +void TestWlanWizardManual::tc_wpa2_psk_success() +{ +#ifdef tc_wpa2_psk_success_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa2, true, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QTest::qWait(2000); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); + + QCOMPARE( insertTextToObject("lineEditKey", "1234567890"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); +#endif +} + +/*! + * wpa2 no psk + */ +void TestWlanWizardManual::tc_wpa2_no_psk_go_to_eap_start() +{ +#ifdef tc_wpa2_no_psk_go_to_eap_start_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa2, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageEapStart), true ); +#endif +} + +/*! + * Wlan network closed -> generic error + */ +void TestWlanWizardManual::tc_network_closed_generic_error() +{ +#ifdef tc_network_closed_generic_error_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkClosed(100, 1); + mWlanQtUtilsContext->setConnectionSuccessed(false); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, hbTrId("txt_occ_dialog_connection_failed")), true ); + +#endif +} + +/*! + * adhoc no psk + */ +void TestWlanWizardManual::tc_adhoc_network_no_psk() +{ +#ifdef tc_adhoc_network_no_psk_enabled + mApList->Add("huuhaa3421", CMManagerShim::Adhoc, CMManagerShim::WlanSecModeOpen, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + +#endif +} + +/*! + * 802_1x + */ +void TestWlanWizardManual::tc_secmode_802_1x_go_to_eap_start() +{ +#ifdef tc_secmode_802_1x_go_to_eap_start_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecMode802_1x, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageEapStart), true ); +#endif +} + +/*! + * Wapi + */ +void TestWlanWizardManual::tc_sec_mode_wapi() +{ +#ifdef tc_sec_mode_wapi_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWapi, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); +#endif +} + +/*! + * Multiple AP scan match results + */ +void TestWlanWizardManual::tc_multiple_open_scan_results_single_match() +{ +#ifdef tc_multiple_open_scan_results_single_match_enabled + mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false, 400); + mApOpenList->Add("foobar", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false, 300); + mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false, 200); + + mApList->Add("foobar", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false, 300); + + mWlanQtUtilsContext->setScanWlanApsResult(mApOpenList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("foobar", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "foobar"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "foobar"), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "foobar"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_iap_creation_fail() +{ +#ifdef tc_iap_creation_fail_enabled + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(-1); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); + + QStringList buttons; + buttons << hbTrId("txt_occ_dblist_val_infrastructure_public") + << hbTrId("txt_occ_list_infrastructure_hidden") + << hbTrId("txt_occ_list_adhoc_1"); + QCOMPARE( verifyRadioButtons("list"), buttons ); + + QCOMPARE( selectRadioButton( "list", 2 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickPrevious(), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); + QCOMPARE( verifySelectedRadioButton("list"), ListNoneSelected ); + QCOMPARE( selectRadioButton( "list", 2 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageNetworkSecurity, "huuhaa3421"), true ); + + buttons.clear(); + buttons << hbTrId("txt_occ_list_open") + << hbTrId("txt_occ_list_wep_1"); + QCOMPARE( verifyRadioButtons("list"), buttons ); + + QCOMPARE( selectRadioButton( "list", 0 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret")), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_scan_ap_status_not_ok() +{ +#ifdef tc_scan_ap_status_not_ok_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mWlanQtUtilsContext->setScanApStatus(WlanQtUtils::ScanStatusError); + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_scan_direct_status_not_ok() +{ +#ifdef tc_scan_direct_status_not_ok_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + //mWlanQtUtilsContext->setImmediateApScanResult(false); + mWlanQtUtilsContext->setScanDirectStatus(WlanQtUtils::ScanStatusError); + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); +#endif +} + +/*! + * Ict Result enumerator used. Hotspot. + */ +void TestWlanWizardManual::tc_ictresult_enumerated_hotspot() +{ +#ifdef tc_ictresult_enumerated_hotspot_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false, 400); + + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctHotspotPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(1000); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(1000); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(1000); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QTest::qWait(5000); +#endif +} + +/*! + * Ict Result enumerator used. Ict canceled. + */ +void TestWlanWizardManual::tc_ictresult_enumerated_cancel() +{ +#ifdef tc_ictresult_enumerated_cancel_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false, 400); + + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctCancelled); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(1000); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(1000); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(1000); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); +#endif +} + +/*! + * Ict fails in this case + */ +void TestWlanWizardManual::tc_multiple_ssids_with_same_name_2_netmode_options() +{ +#ifdef tc_multiple_ssids_with_same_name_2_netmode_options_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + // Add duplicates + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + + // Add all five kinds of security modes. + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, true, false, 500); + mApList->Add("huuhaa3421", CMManagerShim::Adhoc, CMManagerShim::WlanSecModeOpen, false, false, 400); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, false, false, 300); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecMode802_1x, false, false, 200); + + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctFailed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( selectRadioButton( "list", 1 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_multiple_ssids_with_same_name_press_previous() +{ +#ifdef tc_multiple_ssids_with_same_name_press_previous_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + // Add duplicates + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + + // Add all five kinds of security modes. + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, true, false, 500); + mApList->Add("huuhaa3421", CMManagerShim::Adhoc, CMManagerShim::WlanSecModeOpen, false, false, 400); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, true, false, 300); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecMode802_1x, false, false, 200); + + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( selectRadioButton( "list", 0 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkSecurity), true ); + QCOMPARE( mouseClickPrevious(), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkSecurity), true ); + QCOMPARE( selectRadioButton( "list", 1 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_multiple_ssids_with_same_name_all_sec_modes() +{ +#ifdef tc_multiple_ssids_with_same_name_all_sec_modes_enabled + mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + // Add duplicates + mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + + // Add all five kinds of security modes. + mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, true, false, 500); + mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa2, true, false, 500); + mApOpenList->Add("huuhaa3421", CMManagerShim::Adhoc, CMManagerShim::WlanSecModeOpen, false, false, 400); + mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecMode802_1x, false, false, 200); + mApOpenList->Add("dippadappa", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false, 200); + + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + // Add duplicates + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + + // Add all five kinds of security modes. + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, true, false, 500); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa2, true, false, 500); + mApList->Add("huuhaa3421", CMManagerShim::Adhoc, CMManagerShim::WlanSecModeOpen, false, false, 400); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, true, false, 300); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecMode802_1x, false, false, 200); + + mWlanQtUtilsContext->setScanWlanApsResult(mApOpenList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( selectRadioButton( "list", 0 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkSecurity), true ); + QCOMPARE( mouseClickPrevious(), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkSecurity), true ); + QCOMPARE( selectRadioButton( "list", 0 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_multiple_ssids_with_same_name_orientation_switch() +{ +#ifdef tc_multiple_ssids_with_same_name_orientation_switch_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + // Add duplicates + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + + // Add all five kinds of security modes. + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, true, false, 500); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, true, false, 300); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecMode802_1x, false, false, 200); + + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + + mMainWindow->setOrientation(Qt::Horizontal, false); + QTest::qWait(WaitTimeForUi); + mMainWindow->setOrientation(Qt::Vertical, false); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkSecurity), true ); + QCOMPARE( selectRadioButton( "list", 0 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); +#endif +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardmanual.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardmanual.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#ifndef TESTWLANWIZARDRNMANUAL_H_ +#define TESTWLANWIZARDRNMANUAL_H_ + +#include "testwlanwizardcontext.h" + +class TestWlanWizardManual : public TestWlanWizardContext +{ +Q_OBJECT + +private slots: + // Test cases + void tcStartWizard(); + void tc_open_scan_results_received_at_scan_page(); + void tc_attempt_to_input_too_long_ssid(); + void tc_scan_succesful_press_cancel_at_summary(); + void tc_press_previous_at_scanning_page(); + void tc_scan_succesful_go_to_summary_and_finish(); + void tc_wep_pwd_too_short_error_label(); + void tc_press_previous_at_key_query(); + void tc_manual_selection_with_press_previous(); + void tc_illegal_characters_in_wep_key(); + void tc_too_short_wpa_key(); + void tc_wpa_psk_success(); + void tc_wpa_no_psk_go_to_eap_start(); + void tc_wpa2_psk_success(); + void tc_wpa2_no_psk_go_to_eap_start(); + void tc_network_closed_generic_error(); + void tc_adhoc_network_no_psk(); + void tc_secmode_802_1x_go_to_eap_start(); + void tc_sec_mode_wapi(); + void tc_multiple_open_scan_results_single_match(); + void tc_iap_creation_fail(); + void tc_scan_ap_status_not_ok(); + void tc_scan_direct_status_not_ok(); + void tc_ictresult_enumerated_hotspot(); + void tc_ictresult_enumerated_cancel(); + void tc_multiple_ssids_with_same_name_2_netmode_options(); + void tc_multiple_ssids_with_same_name_press_previous(); + void tc_multiple_ssids_with_same_name_all_sec_modes(); + void tc_multiple_ssids_with_same_name_orientation_switch(); + +}; + +#endif /* TESTWLANWIZARDRNMANUAL_H_ */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardmanual_conf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardmanual_conf.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +// System includes + +// User includes + +// External function prototypes + +// Local constants +#define tc_open_scan_results_received_at_scan_page_enabled +#define tc_attempt_to_input_too_long_ssid_enabled +#define tc_scan_succesful_press_cancel_at_summary_enabled +#define tc_press_previous_at_scanning_page_enabled +#define tc_scan_succesful_go_to_summary_and_finish_enabled +#define tc_wep_pwd_too_short_error_label_enabled +#define tc_press_previous_at_key_query_enabled +#define tc_manual_selection_with_press_previous_enabled +#define tc_illegal_characters_in_wep_key_enabled +#define tc_too_short_wpa_key_enabled +#define tc_wpa_psk_success_enabled +#define tc_wpa_no_psk_go_to_eap_start_enabled +#define tc_wpa2_psk_success_enabled +#define tc_wpa2_no_psk_go_to_eap_start_enabled +#define tc_network_closed_generic_error_enabled +#define tc_adhoc_network_no_psk_enabled +#define tc_secmode_802_1x_go_to_eap_start_enabled +#define tc_sec_mode_wapi_enabled +#define tc_multiple_open_scan_results_single_match_enabled +#define tc_iap_creation_fail_enabled +#define tc_scan_ap_status_not_ok_enabled +#define tc_scan_direct_status_not_ok_enabled +#define tc_ictresult_enumerated_hotspot_enabled +#define tc_ictresult_enumerated_cancel_enabled +#define tc_multiple_ssids_with_same_name_2_netmode_options_enabled +#define tc_multiple_ssids_with_same_name_press_previous_enabled +#define tc_multiple_ssids_with_same_name_all_sec_modes_enabled +#define tc_multiple_ssids_with_same_name_orientation_switch_enabled diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardwps.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardwps.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,490 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +// System includes +#include +#include +#include +#include +#include + +// User includes +#include "testwlanwizardwps.h" +#include "testwlanwizardwps_conf.h" +#include "wlanwizard.h" +#include "wlanwizard_p.h" +#include "wlanqtutils_context.h" +#include "wlanqtutils.h" +#include "wlanqtutilsap.h" +#include "wlanwizardpageinternal.h" +#include "wpswizardpage.h" + +#include "wlanmgmtclient_context.h" + +// External function prototypes + +// Local constants + + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------- +// TEST CASES +// --------------------------------------------------------- + +void TestWlanWizardWps::tcConfigureManualOpen() +{ +#ifdef tcConfigureManualOpen_enabled + const QString ssid("tcConfigureManualOpen"); + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + WlanQtUtilsAp ap; + ap.setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Infra); + ap.setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); + ap.setValue(WlanQtUtilsAp::ConfIdSsid, ssid); + ap.setValue(WlanQtUtilsAp::ConfIdHidden, false); + + // Default values + ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true ); + ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1 ); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, QString()); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeOpen, + false, false, true); + + mView->showWizard(); + verifyModeSelection(); + QCOMPARE(selectRadioButton("radioButtonList", 2), true); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE(mouseClickNext(), true); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( mWlanQtUtilsContext->verifyWlanIapSettings(ap), true); +#endif +} + +void TestWlanWizardWps::tcPushButtonOpen() +{ +#ifdef tcPushButtonOpen_enabled + tcPushButton( + "tcPushButtonOpen", + EWlanIapSecurityModeAllowUnsecure, + CMManagerShim::WlanSecModeOpen, + EWlanOperatingModeInfrastructure, + CMManagerShim::Infra, + EWlanDefaultWepKey1, + CMManagerShim::WepKeyIndex1); +#endif +} + +void TestWlanWizardWps::tcPushButtonWep1() +{ +#ifdef tcPushButtonWep1_enabled + tcPushButton( + "tcPushButtonWep1", + EWlanIapSecurityModeWep, + CMManagerShim::WlanSecModeWep, + EWlanOperatingModeAdhoc, + CMManagerShim::Adhoc, + EWlanDefaultWepKey1, + CMManagerShim::WepKeyIndex1); +#endif +} + +void TestWlanWizardWps::tcPushButtonWep2() +{ +#ifdef tcPushButtonWep2_enabled + tcPushButton( + "tcPushButtonWep2", + EWlanIapSecurityModeWep, + CMManagerShim::WlanSecModeWep, + EWlanOperatingModeAdhoc, + CMManagerShim::Adhoc, + EWlanDefaultWepKey2, + CMManagerShim::WepKeyIndex2); +#endif +} + +void TestWlanWizardWps::tcPushButtonWep3() +{ +#ifdef tcPushButtonWep3_enabled + tcPushButton( + "tcPushButtonWep3", + EWlanIapSecurityModeWep, + CMManagerShim::WlanSecModeWep, + EWlanOperatingModeAdhoc, + CMManagerShim::Adhoc, + EWlanDefaultWepKey3, + CMManagerShim::WepKeyIndex3); +#endif +} + +void TestWlanWizardWps::tcPushButtonWep4() +{ +#ifdef tcPushButtonWep4_enabled + tcPushButton( + "tcPushButtonWep4", + EWlanIapSecurityModeWep, + CMManagerShim::WlanSecModeWep, + EWlanOperatingModeAdhoc, + CMManagerShim::Adhoc, + EWlanDefaultWepKey4, + CMManagerShim::WepKeyIndex4); +#endif +} + +void TestWlanWizardWps::tcPushButtonWpa() +{ +#ifdef tcPushButtonWpa_enabled + tcPushButton( + "tcPushButtonWpa", + EWlanIapSecurityModeWpa, + CMManagerShim::WlanSecModeWpa, + EWlanOperatingModeAdhoc, + CMManagerShim::Adhoc, + EWlanDefaultWepKey1, + CMManagerShim::WepKeyIndex1); +#endif +} + +void TestWlanWizardWps::tcPushButtonWpa2() +{ +#ifdef tcPushButtonWpa2_enabled + tcPushButton( + "tcPushButtonWpa2", + EWlanIapSecurityModeWpa2Only, + CMManagerShim::WlanSecModeWpa2, + EWlanOperatingModeAdhoc, + CMManagerShim::Adhoc, + EWlanDefaultWepKey1, + CMManagerShim::WepKeyIndex1); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupOOBInterfaceReadError() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupOOBInterfaceReadError_enabled + tcPinCode_failure( + KErrWlanProtectedSetupOOBInterfaceReadError, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupDecryptionCRCFailure() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupDecryptionCRCFailure_enabled + tcPinCode_failure( + KErrWlanProtectedSetupDecryptionCRCFailure, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetup2_4ChannelNotSupported() +{ +#ifdef tcPinCode_KErrWlanProtectedSetup2_4ChannelNotSupported_enabled + tcPinCode_failure( + KErrWlanProtectedSetup2_4ChannelNotSupported, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetup5_0ChannelNotSupported() +{ +#ifdef tcPinCode_KErrWlanProtectedSetup5_0ChannelNotSupported_enabled + tcPinCode_failure( + KErrWlanProtectedSetup5_0ChannelNotSupported, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupNetworkAuthFailure() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupNetworkAuthFailure_enabled + tcPinCode_failure( + KErrWlanProtectedSetupNetworkAuthFailure, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupNoDHCPResponse() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupNoDHCPResponse_enabled + tcPinCode_failure( + KErrWlanProtectedSetupNoDHCPResponse, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupFailedDHCPConfig() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupFailedDHCPConfig_enabled + tcPinCode_failure( + KErrWlanProtectedSetupFailedDHCPConfig, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupIPAddressConflict() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupIPAddressConflict_enabled + tcPinCode_failure( + KErrWlanProtectedSetupIPAddressConflict, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupCouldNotConnectToRegistrar() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupCouldNotConnectToRegistrar_enabled + tcPinCode_failure( + KErrWlanProtectedSetupCouldNotConnectToRegistrar, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupMultiplePBCSessionsDetected() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupMultiplePBCSessionsDetected_enabled + tcPinCode_failure( + KErrWlanProtectedSetupMultiplePBCSessionsDetected, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupRogueActivitySuspected() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupRogueActivitySuspected_enabled + tcPinCode_failure( + KErrWlanProtectedSetupRogueActivitySuspected, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupDeviceBusy() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupDeviceBusy_enabled + tcPinCode_failure( + KErrWlanProtectedSetupDeviceBusy, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupSetupLocked() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupSetupLocked_enabled + tcPinCode_failure( + KErrWlanProtectedSetupSetupLocked, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupMessageTimeout() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupMessageTimeout_enabled + tcPinCode_failure( + KErrWlanProtectedSetupMessageTimeout, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupRegistrationSessionTimeout() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupRegistrationSessionTimeout_enabled + tcPinCode_failure( + KErrWlanProtectedSetupRegistrationSessionTimeout, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupDevicePasswordAuthFailure() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupDevicePasswordAuthFailure_enabled + tcPinCode_failure( + KErrWlanProtectedSetupDevicePasswordAuthFailure, + hbTrId("txt_occ_dialog_configuration_failed_authenticatio")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupPINMethodNotSupported() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupPINMethodNotSupported_enabled + tcPinCode_failure( + KErrWlanProtectedSetupPINMethodNotSupported, + hbTrId("txt_occ_dialog_configuration_failed_authenticatio")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupPBMethodNotSupported() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupPBMethodNotSupported_enabled + tcPinCode_failure( + KErrWlanProtectedSetupPBMethodNotSupported, + hbTrId("txt_occ_dialog_configuration_failed_authenticatio")); +#endif +} + +void TestWlanWizardWps::verifyModeSelection() +{ + QCOMPARE( verifyCurrentPage(WpsWizardPage::PageWpsWizardStep2 ), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + QStringList list; + list << hbTrId("txt_occ_list_use_pushbutton") + << hbTrId("txt_occ_list_use_pin_code") + << hbTrId("txt_occ_list_configure_manually"); + + QCOMPARE(verifyRadioButtons("radioButtonList"), list); +} + + +void TestWlanWizardWps::tcPushButton( + const QString &ssid, + int secModeWlan, + int secModeCmm, + int operModeWlan, + int operModeCmm, + int defaultWepKeyIndexWlan, + int defaultWepKeyIndexCmm) +{ + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + WlanQtUtilsAp ap; + ap.setValue(WlanQtUtilsAp::ConfIdConnectionMode, operModeCmm); + ap.setValue(WlanQtUtilsAp::ConfIdSecurityMode, secModeCmm); + ap.setValue(WlanQtUtilsAp::ConfIdSsid, ssid); + ap.setValue(WlanQtUtilsAp::ConfIdHidden, false); + + // Default values + ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true ); + ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1 ); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, QString()); + + if (secModeCmm == CMManagerShim::WlanSecModeWep){ + ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, "wepkey1"); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, "wepkey2"); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, "wepkey3"); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, "wepkey4"); + ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, defaultWepKeyIndexCmm ); + } else if (secModeCmm == CMManagerShim::WlanSecModeWpa || + secModeCmm == CMManagerShim::WlanSecModeWpa2) { + ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, "wpapsk"); + } + + mWlanMgmtClientContext->setRunProtectedSetup(ssid, KErrNone); + mWlanMgmtClientContext->appendResult( + ssid, + secModeWlan, + operModeWlan, + defaultWepKeyIndexWlan, + "wepkey1", + "wepkey2", + "wepkey3", + "wepkey4", + "wpapsk"); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeWep, + false, false, true); + + mView->showWizard(); + verifyModeSelection(); + + QCOMPARE(selectRadioButton("radioButtonList", 0), true); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE(mouseClickNext(), true); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyCurrentPage(WpsWizardPage::PageWpsWizardStep3_Button), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE( mouseClickNext(), true); + QCOMPARE( verifyCurrentPage(WpsWizardPage::PageWpsWizardStep4), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mWlanQtUtilsContext->verifyWlanIapSettings(ap), true); +} + + +void TestWlanWizardWps::tcPinCode_failure( + int errorCode, + const QString &errorText) +{ + const QString ssid("tcPinCode_failure"); + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + mWlanMgmtClientContext->setRunProtectedSetup(ssid, errorCode); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeWep, + false, false, true); + + mView->showWizard(); + verifyModeSelection(); + + QCOMPARE(selectRadioButton("radioButtonList", 1), true); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE(mouseClickNext(), true); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyCurrentPage(WpsWizardPage::PageWpsWizardStep3_Number), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + + QCOMPARE(mouseClickNext(), true); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyCurrentPage(WpsWizardPage::PageWpsWizardStep4), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, errorText), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardwps.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardwps.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#ifndef TESTWLANWIZARDRNDWPS_H +#define TESTWLANWIZARDRNDWPS_H + +#include "testwlanwizardcontext.h" + +class TestWlanWizardWps : public TestWlanWizardContext +{ +Q_OBJECT + +private slots: + void tcConfigureManualOpen(); + void tcPushButtonOpen(); + void tcPushButtonWep1(); + void tcPushButtonWep2(); + void tcPushButtonWep3(); + void tcPushButtonWep4(); + void tcPushButtonWpa(); + void tcPushButtonWpa2(); + void tcPinCode_KErrWlanProtectedSetupOOBInterfaceReadError(); + void tcPinCode_KErrWlanProtectedSetupDecryptionCRCFailure(); + void tcPinCode_KErrWlanProtectedSetup2_4ChannelNotSupported(); + void tcPinCode_KErrWlanProtectedSetup5_0ChannelNotSupported(); + void tcPinCode_KErrWlanProtectedSetupNetworkAuthFailure(); + void tcPinCode_KErrWlanProtectedSetupNoDHCPResponse(); + void tcPinCode_KErrWlanProtectedSetupFailedDHCPConfig(); + void tcPinCode_KErrWlanProtectedSetupIPAddressConflict(); + void tcPinCode_KErrWlanProtectedSetupCouldNotConnectToRegistrar(); + void tcPinCode_KErrWlanProtectedSetupMultiplePBCSessionsDetected(); + void tcPinCode_KErrWlanProtectedSetupRogueActivitySuspected(); + void tcPinCode_KErrWlanProtectedSetupDeviceBusy(); + void tcPinCode_KErrWlanProtectedSetupSetupLocked(); + void tcPinCode_KErrWlanProtectedSetupMessageTimeout(); + void tcPinCode_KErrWlanProtectedSetupRegistrationSessionTimeout(); + void tcPinCode_KErrWlanProtectedSetupDevicePasswordAuthFailure(); + void tcPinCode_KErrWlanProtectedSetupPINMethodNotSupported(); + void tcPinCode_KErrWlanProtectedSetupPBMethodNotSupported(); + /* + void tcPushButton_KErrNone_back_forward_KErrNone(); + void tcPinCodeMultipleResults(); + void tcPinCodeMultipleResults_back_and_forward(); + */ + +private: // Helper methods + void verifyModeSelection(); + +private: // Helper test cases + void tcPushButton( + const QString &ssid, + int secModeWlan, + int secModeCmm, + int operModeWlan, + int operModeCmm, + int defaultWepKeyIndexWlan, + int defaultWepKeyIndexCmm); + + void tcPinCode_failure( + int errorCode, + const QString &errorText); + + + +}; + +#endif /* TESTWLANWIZARDRNDWPS_H */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardwps_conf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardwps_conf.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +// System includes + +// User includes + +// External function prototypes + +// Local constants + +#define tcConfigureManualOpen_enabled +#define tcPushButtonOpen_enabled +#define tcPushButtonWep1_enabled +#define tcPushButtonWep2_enabled +#define tcPushButtonWep3_enabled +#define tcPushButtonWep4_enabled +#define tcPushButtonWpa_enabled +#define tcPushButtonWpa2_enabled +#define tcPinCode_KErrWlanProtectedSetupOOBInterfaceReadError_enabled +#define tcPinCode_KErrWlanProtectedSetupDecryptionCRCFailure_enabled +#define tcPinCode_KErrWlanProtectedSetup2_4ChannelNotSupported_enabled +#define tcPinCode_KErrWlanProtectedSetup5_0ChannelNotSupported_enabled +#define tcPinCode_KErrWlanProtectedSetupNetworkAuthFailure_enabled +#define tcPinCode_KErrWlanProtectedSetupNoDHCPResponse_enabled +#define tcPinCode_KErrWlanProtectedSetupFailedDHCPConfig_enabled +#define tcPinCode_KErrWlanProtectedSetupIPAddressConflict_enabled +#define tcPinCode_KErrWlanProtectedSetupCouldNotConnectToRegistrar_enabled +#define tcPinCode_KErrWlanProtectedSetupMultiplePBCSessionsDetected_enabled +#define tcPinCode_KErrWlanProtectedSetupRogueActivitySuspected_enabled +#define tcPinCode_KErrWlanProtectedSetupDeviceBusy_enabled +#define tcPinCode_KErrWlanProtectedSetupSetupLocked_enabled +#define tcPinCode_KErrWlanProtectedSetupMessageTimeout_enabled +#define tcPinCode_KErrWlanProtectedSetupRegistrationSessionTimeout_enabled +#define tcPinCode_KErrWlanProtectedSetupDevicePasswordAuthFailure_enabled +#define tcPinCode_KErrWlanProtectedSetupPINMethodNotSupported_enabled +#define tcPinCode_KErrWlanProtectedSetupPBMethodNotSupported_enabled + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/t_wlanwizard/ut/ut.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/t_wlanwizard/ut/ut.pri Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,40 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# +# Description: +# UT for Wlan wizard testing +# + +HEADERS += \ + ut/hbautotest.h \ + ut/testwlanwizard.h \ + ut/testwlanwizardeap.h \ + ut/testwlanwizardeap_conf.h \ + ut/testwlanwizardcontext.h \ + ut/testwlanwizardmanual.h \ + ut/testwlanwizardmanual_conf.h \ + ut/testwlanwizardconnect.h \ + ut/testwlanwizardconnect_conf.h \ + ut/testwlanwizardwps.h \ + ut/testwlanwizardwps_conf.h + +SOURCES += \ + ut/main.cpp \ + ut/hbautotest.cpp \ + ut/testwlanwizardeap.cpp \ + ut/testwlanwizardcontext.cpp \ + ut/testwlanwizardconnect.cpp \ + ut/testwlanwizardmanual.cpp \ + ut/testwlanwizard.cpp \ + ut/testwlanwizardwps.cpp diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/traces/OstTraceDefinitions.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * OST Trace definition file for WLAN Wizard + */ + +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +#include +#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/traces/trace.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/traces/trace.properties Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,63 @@ + + + + ConfSsid + ConfNetworkMode + ConfSecurityMode + ConfKeyWpa + ConfKeyWep1 + ConfKeyWep2 + ConfKeyWep3 + ConfKeyWep4 + ConfKeyWepDefault + ConfIctStatus + ConfIapId + ConfConnected + ConfHiddenWlan + ConfUsePsk + ConfProcessSessings + ConfGenericErrorString + ConfAvailableNetworkOptions + ConfWpsSupported + ConfGenericErrorPageStepsBackwards + + + PageNone + PageProcessSettings + PageGenericError + PageSsid + PageScanning + PageNetworkSecurity + PageKeyQuery + PageNetworkMode + PageSummary + EapPageOuterType + EapPageCertificateCa + EapPageCertificateUser + EapPageIdentity + EapPageInnerTypePeap + EapPageInnerTypeEapTtls + EapPageNewPacStorePassword + EapPagePromptPacStorePassword + EapPageUsernamePassword + PageWpsWizardStep2 + PageWpsWizardStep3_Button + PageWpsWizardStep3_Number + PageWpsWizardStep4 + PageWpsWizardStep5 + PageWpsWizardStep6 + + + KeyStatusOk + KeyStatusIllegalCharacters + KeyStatusWpaTooShort + KeyStatusWpaTooLong + KeyStatusWepInvalidLength + + + SsidStatusOk + SsidStatusIllegalCharacters + SsidStatusInvalidLength + + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wlanwizard/wlanwizard.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/wlanwizard.pro Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,100 @@ +# +# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# WLAN Settings Wizard +# + +TEMPLATE = lib +TARGET = wlanwizard + +DEFINES += BUILD_WLAN_WIZARD_DLL + +VERSION = 0.0.1 + +CONFIG += hb + +MOC_DIR = build +RCC_DIR = build + +RESOURCES += resources/resource.qrc + +TRANSLATIONS = wlanwizard.ts + +HEADERS += \ + inc/wlanwizard.h \ + inc/wlanwizard_p.h \ + inc/wlanwizardscanlist.h \ + inc/wlanwizardhelper.h \ + inc/wlanwizardpage.h \ + inc/wlanwizardpagegenericerror.h \ + inc/wlanwizardpageinternal.h \ + inc/wlanwizardpagekeyquery.h \ + inc/wlanwizardpagenetworkmode.h \ + inc/wlanwizardpageprocessingsettings.h \ + inc/wlanwizardpagescanning.h \ + inc/wlanwizardpagesecuritymode.h \ + inc/wlanwizardpagessid.h \ + inc/wlanwizardpagesummary.h \ + inc/wlanwizardsummaryviewitem.h \ + inc/wlanwizardutils.h + +SOURCES += \ + src/wlanwizard.cpp \ + src/wlanwizard_p.cpp \ + src/wlanwizardscanlist.cpp \ + src/wlanwizardpagegenericerror.cpp \ + src/wlanwizardpageinternal.cpp \ + src/wlanwizardpagekeyquery.cpp \ + src/wlanwizardpagenetworkmode.cpp \ + src/wlanwizardpageprocessingsettings.cpp \ + src/wlanwizardpagescanning.cpp \ + src/wlanwizardpagesecuritymode.cpp \ + src/wlanwizardpagessid.cpp \ + src/wlanwizardpagesummary.cpp \ + src/wlanwizardsummaryviewitem.cpp \ + src/wlanwizardutils.cpp + +LIBS += \ + -lwlanqtutilities \ + -leapwizard \ + -lwpswizard + +symbian { + INCLUDEPATH += \ + inc \ + ..\inc + + TARGET.UID3 = 0x2002C39A + TARGET.CAPABILITY = CAP_GENERAL_DLL + TARGET.EPOCALLOWDLLDATA = 1 + + # Localition of directories for def files + defFilePath = . + + # OST trace system requires traces directory to be in USERINCLUDES + MMP_RULES += "USERINCLUDE traces" + + BLD_INF_RULES.prj_exports += \ + "rom/wlanwizard.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wlanwizard.iby)" + + BLD_INF_RULES.prj_exports += \ + "rom/wlanwizard_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(wlanwizard_resources.iby)" + + # Export wlanwizard and wlanwizard plugin apis + BLD_INF_RULES.prj_exports += \ + "inc/wlanwizard.h |../inc/wlanwizard.h" \ + "inc/wlanwizardhelper.h |../inc/wlanwizardhelper.h" \ + "inc/wlanwizardpage.h |../inc/wlanwizardpage.h" \ + "inc/wlanwizardplugin.h |../inc/wlanwizardplugin.h" +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/bwins/wpswizardu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/bwins/wpswizardu.def Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,14 @@ +EXPORTS + ?qt_metacall@WpsWizard@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1 NONAME ; int WpsWizard::qt_metacall(enum QMetaObject::Call, int, void * *) + ??_EWpsWizard@@UAE@I@Z @ 2 NONAME ; WpsWizard::~WpsWizard(unsigned int) + ?metaObject@WpsWizard@@UBEPBUQMetaObject@@XZ @ 3 NONAME ; struct QMetaObject const * WpsWizard::metaObject(void) const + ?qt_metacast@WpsWizard@@UAEPAXPBD@Z @ 4 NONAME ; void * WpsWizard::qt_metacast(char const *) + ?trUtf8@WpsWizard@@SA?AVQString@@PBD0H@Z @ 5 NONAME ; class QString WpsWizard::trUtf8(char const *, char const *, int) + ??1WpsWizard@@UAE@XZ @ 6 NONAME ; WpsWizard::~WpsWizard(void) + ??0WpsWizard@@QAE@PAVWlanWizardHelper@@@Z @ 7 NONAME ; WpsWizard::WpsWizard(class WlanWizardHelper *) + ?staticMetaObject@WpsWizard@@2UQMetaObject@@B @ 8 NONAME ; struct QMetaObject const WpsWizard::staticMetaObject + ?tr@WpsWizard@@SA?AVQString@@PBD0@Z @ 9 NONAME ; class QString WpsWizard::tr(char const *, char const *) + ?getStaticMetaObject@WpsWizard@@SAABUQMetaObject@@XZ @ 10 NONAME ; struct QMetaObject const & WpsWizard::getStaticMetaObject(void) + ?tr@WpsWizard@@SA?AVQString@@PBD0H@Z @ 11 NONAME ; class QString WpsWizard::tr(char const *, char const *, int) + ?trUtf8@WpsWizard@@SA?AVQString@@PBD0@Z @ 12 NONAME ; class QString WpsWizard::trUtf8(char const *, char const *) + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/eabi/wpswizardu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/eabi/wpswizardu.def Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,14 @@ +EXPORTS + _ZN9WpsWizard11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME + _ZN9WpsWizard11qt_metacastEPKc @ 2 NONAME + _ZN9WpsWizard16staticMetaObjectE @ 3 NONAME DATA 16 + _ZN9WpsWizard19getStaticMetaObjectEv @ 4 NONAME + _ZN9WpsWizardC1EP16WlanWizardHelper @ 5 NONAME + _ZN9WpsWizardC2EP16WlanWizardHelper @ 6 NONAME + _ZN9WpsWizardD0Ev @ 7 NONAME + _ZN9WpsWizardD1Ev @ 8 NONAME + _ZN9WpsWizardD2Ev @ 9 NONAME + _ZNK9WpsWizard10metaObjectEv @ 10 NONAME + _ZTI9WpsWizard @ 11 NONAME + _ZTV9WpsWizard @ 12 NONAME + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/inc/cwpsactiverunner.h --- a/wlanutilities/wpswizard/inc/cwpsactiverunner.h Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/inc/cwpsactiverunner.h Thu Jul 22 16:44:32 2010 +0100 @@ -19,8 +19,6 @@ #define CWPSACTIVERUNNER_H_ // System includes -#include -#include #include #include @@ -31,39 +29,41 @@ // External data types // Constants - -/*! - * The wrapper class for wlan management engine calls +/*! + * @addtogroup group_wps_wizard_plugin + * @{ */ // Class declaration class CWpsActiveRunner : public CActive - { - +{ public: static CWpsActiveRunner* NewL(MWpsActiveRunnerCallback& aObserver); virtual ~CWpsActiveRunner(); public: - - void InitL(); + void RunL(); void DoCancel(); TInt RunError(TInt aError); void StartSetup(RBuf8& aSsid, int aPin); + +protected: private: - CWpsActiveRunner(MWpsActiveRunnerCallback& aObserver); + explicit CWpsActiveRunner(MWpsActiveRunnerCallback& aObserver); void ConstructL(); void InitializeL(); private: + + //! observer for notification of WPS setup completion MWpsActiveRunnerCallback& iObserver; -#ifdef __arm + //! To know if cancel was called before the completion + TBool isCancelTriggered; + //! WLAN management client object CWlanMgmtClient* iWLANMgmtClient; + //! Array to hold the results of the WPS setup CArrayFixSeg* iIapParametersArray; -#else - //Temporary for testing in WINSCW. - RTimer iTimer; - void RunProtectedSetup_Stub(); -#endif - }; + + friend class TestWlanWizardContext; +}; #endif /* CWPSACTIVERUNNER_H_ */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/inc/mwpsactiverunnercallback.h --- a/wlanutilities/wpswizard/inc/mwpsactiverunnercallback.h Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/inc/mwpsactiverunnercallback.h Thu Jul 22 16:44:32 2010 +0100 @@ -18,14 +18,19 @@ #define MWPSACTIVERUNNERCALLBACK_H_ // System includes -#include -#include +#include +#include // User includes // Forward declarations // External data types // Constants +/*! + * @addtogroup group_wps_wizard_plugin + * @{ + */ + // Class declaration class MWpsActiveRunnerCallback { @@ -33,9 +38,9 @@ /*! * Callback to notify the completion of middleware API call */ - IMPORT_C virtual void WpsActiveRunnerStopped(QList< - TWlanProtectedSetupCredentialAttribute>& aCredentials, - TInt aError) = 0; + virtual void WpsActiveRunnerStopped( + QList& aCredentials, + TInt aError) = 0; }; #endif /* MWPSACTIVERUNNERCALLBACK_H_ */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/inc/wpswizard.h --- a/wlanutilities/wpswizard/inc/wpswizard.h Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/inc/wpswizard.h Thu Jul 22 16:44:32 2010 +0100 @@ -2,7 +2,7 @@ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" + * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * @@ -16,65 +16,69 @@ * */ -/* - * %version: 1 % - */ - - #ifndef WPSWIZARD_H_ #define WPSWIZARD_H_ +// System includes +#include -#include +// User includes #include "wlanwizardplugin.h" +// Forward declarations +class WlanWizardHelper; +class WpsWizardPrivate; + +// External data types +// Constants + + +//Export Declaration #ifdef BUILD_WPS_WIZARD_DLL #define WPS_WIZARD_EXPORT Q_DECL_EXPORT #else #define WPS_WIZARD_EXPORT Q_DECL_IMPORT #endif -class WlanWizardHelpper; -class WpsWizardPrivate; - - /*! - * @addtogroup group_ + * @addtogroup group_wps_wizard_plugin * @{ */ +// Class declaration class WPS_WIZARD_EXPORT WpsWizard: public QObject, public WlanWizardPlugin { -private: Q_OBJECT - friend class WpsWizardPrivate; + public: - enum BearerType - { - BearerTypeWlan, - }; -public: - WpsWizard( - WlanWizardHelpper *wizardHelpper, - BearerType bearerType, int referenceId); + + explicit WpsWizard( WlanWizardHelper *wizardHelper); ~WpsWizard(); - void storeSettings(); - -public: // From WlanWizardPlugin - bool summary(WlanWizardPlugin::Summary sum, QString &item, QString &value); +signals: + +public slots: - +protected: + +protected slots: private: + Q_DISABLE_COPY(WpsWizard) - WpsWizardPrivate *d_ptr; + +private slots: + +private: + + //data + + //! pointer to the private implementation class. + QScopedPointer d_ptr; + + friend class WpsWizardPrivate; + friend class TestWlanWizardContext; }; -/*! @} */ - - - - #endif /* WPSWIZARD_H_ */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/inc/wpswizard_p.h --- a/wlanutilities/wpswizard/inc/wpswizard_p.h Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/inc/wpswizard_p.h Thu Jul 22 16:44:32 2010 +0100 @@ -1,104 +1,125 @@ /* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: WPS wizard private implementation -* -*/ + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: WPS wizard private implementation + * + */ #ifndef WPSWIZARD_P_H_ #define WPSWIZARD_P_H_ // System includes -#include -#include -#include +#include #include -#include + // User includes -#include "wlanwizardhelpper.h" +#include "wlanwizardhelper.h" #include "wpswizard.h" // Forward declarations class HbStackedWidget; +class HbTranslator; class HbWidget; class HbLabel; class HbView; class HbAction; class HbDocumentLoader; -class WlanWizardHelpper; - +class WlanWizardHelper; // External data types // Constants +/*! + * @addtogroup group_wps_wizard_plugin + * @{ + */ + // Class declaration class WpsWizardPrivate : public QObject { - - friend class WpsWizard; - + Q_OBJECT + public: - WpsWizardPrivate(WpsWizard* wizard, WlanWizardHelpper *wizardHelpper, int bearerType, int referenceId); + WpsWizardPrivate(WpsWizard* wizard, WlanWizardHelper *wizardHelper); ~WpsWizardPrivate(); public: - /*! - * Based on the input either disables or enables next button - */ + void enableNextButton(bool enable); - /*! - * Moves automatically to the next page - */ + void nextPage(); - /*! - * Returns the SSID of the network - */ + QString getSsid(); - /*! - * Stores the settings received from the AP - */ - void storeSettings(int aIndex); - /*! - * Stores multiple settings received from the AP - */ + + void storeSettings(int index); + + HbMainWindow* mainWindow(); + void storeSettingsArray( - QList& aCredentials); + QList& credentials); QList getSettingsArray(); - /*! - * Stores the generated PIN - */ + void setPin(int random); - /*! - * Returns the generated PIN - */ + int getPin(); -private: - Q_DISABLE_COPY(WpsWizardPrivate) - /*! - * Returns id of next page. updates settings EapWizard. - */ - void createPages(); + int nextPageId(bool useWps); + + void setConfiguration(WlanWizardHelper::ConfigurationId confId, + const QVariant &value); + + +signals: + +public slots: + +protected: + +protected slots: private: + + void createPages(); + + int convertSecurityModes(TWlanIapSecurityMode securityMode); + + int convertNetworkModes(TWlanOperatingMode networkMode); + + int convertDefaultWepKey(TWlanDefaultWepKey defaultWepKey); + + Q_DISABLE_COPY(WpsWizardPrivate) + +private slots: + +private: + + //data + + //! Pointer to the WPS wizard WpsWizard *q_ptr; - WlanWizardHelpper *mWizardHelpper; - QTranslator *mTranslator; + //! pointer to the wizard helper object + WlanWizardHelper *mWizardHelper; + //! Translation object + QScopedPointer mTranslator; + //! Object containing WLAN credentials TWlanProtectedSetupCredentialAttribute mWpsAttr; + //! Array of objects containing WLAN credentials. QList mIapList; - int mBearerType; - int mReferenceId; + //! Random number generated for Number entry mode int mRandomNumber; + + friend class WpsWizard; + friend class TestWlanWizardContext; }; #endif /* WPSWIZARD_P_H_ */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/inc/wpswizardpage.h --- a/wlanutilities/wpswizard/inc/wpswizardpage.h Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/inc/wpswizardpage.h Thu Jul 22 16:44:32 2010 +0100 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: API for wizard pages +* Description: API for wps wizard pages * */ @@ -20,6 +20,7 @@ // System includes +#include // User includes #include "wlanwizardpage.h" @@ -32,21 +33,34 @@ // External data types // Constants +/*! + * @addtogroup group_wps_wizard_plugin + * @{ + */ + // Class declaration class WpsWizardPage : public QObject, public WlanWizardPage - { +{ + Q_OBJECT + public: - enum WpsPageIds - { + enum WpsPageIds { PageWpsWizardStep2 = WlanWizardPage::PageWpsStart, PageWpsWizardStep3_Button, PageWpsWizardStep3_Number, PageWpsWizardStep4, PageWpsWizardStep5, PageWpsWizardStep6 - }; + }; + + enum WpsMode { + WpsPushButtonMode = 0, + WpsPinCodeMode, + WpsManualMode + }; + public: - WpsWizardPage(WpsWizardPrivate* parent); + explicit WpsWizardPage(WpsWizardPrivate* parent); virtual ~WpsWizardPage(); /*! @@ -58,27 +72,33 @@ */ virtual int nextId(bool &removeFromStack) const = 0; /*! - * Returns how many steps should be gone backwars. + * This method is called when "previous" button has been pressed. */ - virtual int stepsBackwards(); - /*! - * This method is called when a visualization is displayed to detect - * whether next button should be enabled or not. - */ - virtual bool validate() const; - /*! - * This method is called when Previous button has been pressed. - */ - virtual void previousTriggered() = 0; + virtual int previousTriggered() { return OneStepBackwards;}; /*! * This method is called when Cancel button has been pressed. */ - virtual void cancelTriggered() = 0; + virtual void cancelTriggered() {}; + +signals: + +public slots: + +protected: + + //data + //! Pointer to private implementation WpsWizardPrivate* mWizard; + +protected slots: + private: Q_DISABLE_COPY(WpsWizardPage) - }; - -/*! @} */ + +private slots: + +private: + +}; #endif /* WPSWIZARDPAGE_H_ */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/inc/wpswizardstepfive.h --- a/wlanutilities/wpswizard/inc/wpswizardstepfive.h Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/inc/wpswizardstepfive.h Thu Jul 22 16:44:32 2010 +0100 @@ -14,12 +14,14 @@ * Description: WPS wizard page step 5 * */ + #ifndef WPSWIZARDSTEPFIVE_H_ #define WPSWIZARDSTEPFIVE_H_ // System includes #include +#include // User includes #include "wpswizardpage.h" @@ -35,53 +37,65 @@ // External data types // Constants +/*! + * @addtogroup group_wps_wizard_plugin + * @{ + */ + // Class declaration class WpsPageStepFive : public WpsWizardPage { Q_OBJECT + public: - WpsPageStepFive(WpsWizardPrivate* parent); + + explicit WpsPageStepFive(WpsWizardPrivate* parent); ~WpsPageStepFive(); public: - /*! - * Creates a visualization of the page. - */ + HbWidget* initializePage(); - /*! - * Returns id of next page. updates settings EapWizard. - */ + int nextId(bool &removeFromStack) const; - /*! - * Returns how many steps should be gone backwards. - */ - int stepsBackwards(); - /*! - * This method is called when Previous button has been pressed. - */ - void previousTriggered(); - /*! - * This method is called when Cancel button has been pressed. - */ + + int previousTriggered(); + void cancelTriggered(); - /*! - * This method is called when a visualization is displayed to detect - * whether next button should be enabled or not. - */ - bool validate() const; + + bool showPage(); + +signals: public slots: + void itemSelected(int index); + + void loadDocmlSection(Qt::Orientation orientation); + +protected: + +protected slots: private: + Q_DISABLE_COPY(WpsPageStepFive) + +private slots: + +private: + + //data + + //! Pointer to the HbWidget object HbWidget *mWidget; + //! Radio button list object HbRadioButtonList *mRadio; - HbLabel *mTitle; + //! Heading label object HbLabel *mHeading; + //! variable used to determine if next button has to be enabled. bool mValid; + //! Documentloader object + HbDocumentLoader *mLoader; }; -/*! @} */ - #endif /* WPSWIZARDSTEPFIVE_H_ */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/inc/wpswizardstepfour.h --- a/wlanutilities/wpswizard/inc/wpswizardstepfour.h Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/inc/wpswizardstepfour.h Thu Jul 22 16:44:32 2010 +0100 @@ -14,13 +14,14 @@ * Description: WPS wizard page step 4 * */ + #ifndef WPSWIZARDSTEPFOUR_H_ #define WPSWIZARDSTEPFOUR_H_ // System includes #include -#include +#include // User includes #include "wpswizardpage.h" @@ -28,76 +29,86 @@ #include "cwpsactiverunner.h" // Forward declarations -class HbRadioButtonList; class HbWidget; -class HbLabel; -class HbProgressBar; class WpsWizardPrivate; +class WpsPageStepFourPrivate; // External data types // Constants +/*! + * @addtogroup group_wps_wizard_plugin + * @{ + */ + // Class declaration -class WpsPageStepFour : public WpsWizardPage, public MWpsActiveRunnerCallback +class WpsPageStepFour : public WpsWizardPage { Q_OBJECT + public: - WpsPageStepFour(WpsWizardPrivate* parent); + + explicit WpsPageStepFour(WpsWizardPrivate* parent); ~WpsPageStepFour(); public: - /*! - * Creates a visualization of the page. - */ + HbWidget* initializePage(); - /*! - * Returns id of next page. updates settings EapWizard. - */ + int nextId(bool &removeFromStack) const; - /*! - * Returns how many steps should be gone backwards. - */ - int stepsBackwards(); - /*! - * This method is called when Previous button has been pressed. - */ - void previousTriggered(); - /*! - * This method is called when Cancel button has been pressed. - */ + + int previousTriggered(); + void cancelTriggered(); - /*! - * This method is called when a visualization is displayed to detect - * whether next button should be enabled or not. - */ - bool validate() const; - /*! - * From mwpsactiverunnercallback.h - * This method is called from the active runner class to notify the end - * of operation - */ - void WpsActiveRunnerStopped( - QList& aCredentials, - TInt aError); + + void startOperation(); + + bool requiresStartOperation(); + + void setCredentials( + QList& credentials, + int credentialscount); + + void handleError( int aErrorCode ); + + bool showPage(); + +signals: public slots: + void loadDocmlSection(Qt::Orientation orientation); + +protected: + +protected slots: + private: + + void startWpsRunner(); + Q_DISABLE_COPY(WpsPageStepFour) - void StartWpsRunner(); + +private slots: +private: + + //data + + //! HbWidget object displayed on the page HbWidget *mWidget; - HbRadioButtonList *mRadio; - HbLabel *mTitle; - HbLabel *mHeading; - HbProgressBar *mProgressBar; - CWpsActiveRunner *mWpsActiveRunner; + //! Member variable to hold the result of of the WPS operation int mWpsErrorCode; - int countCredentials; + //! Member variable containing the count of received settings. + int mCountCredentials; + //! variable to determine whether to enable the next button or not. bool mValid; + //! Document loader object. + HbDocumentLoader *mLoader; + //! Pointer to Private Implementation + QScopedPointer d_ptr; + friend class TestWlanWizardContext; }; -/*! @} */ - #endif /* WPSWIZARDSTEPFOUR_H_ */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/inc/wpswizardstepfour_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/inc/wpswizardstepfour_p.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: WPS Wizard: Wrapper for middleware calls + * + */ + +#ifndef WPSWIZARDSTEPFOUR__P_H_ +#define WPSWIZARDSTEPFOUR__P_H_ + +// System includes + +// User includes +#include "wpswizardstepfour.h" + +// Forward declarations +class MWpsActiveRunnerCallback; +class CWpsActiveRunner; + + +// External data types +// Constants + +/*! + * @addtogroup group_wps_wizard_plugin + * @{ + */ + +// Class declaration +class WpsPageStepFourPrivate : public MWpsActiveRunnerCallback + { +public: + + explicit WpsPageStepFourPrivate(WpsPageStepFour* pageStepFour); + ~WpsPageStepFourPrivate(); + + /*! + * From mwpsactiverunnercallback.h + * This method is called from the active runner class to notify the end + * of operation + */ + void WpsActiveRunnerStopped( + QList& aCredentials, + TInt aError); + + void StartSetup(QString ssid,int pin); + + void Cancel(); + + +protected: + +private: // data + + //! C-Class implementation of the WPS setup functionality. + QScopedPointer mWpsActiveRunner; + //! Pointer to the WpsPageStepFour object + WpsPageStepFour* q_ptr; + + friend class TestWlanWizardContext; + }; + +#endif /* WPSWIZARDSTEPFOUR__P_H_ */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/inc/wpswizardstepthreebutton.h --- a/wlanutilities/wpswizard/inc/wpswizardstepthreebutton.h Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/inc/wpswizardstepthreebutton.h Thu Jul 22 16:44:32 2010 +0100 @@ -20,6 +20,7 @@ // System includes #include +#include // User includes #include "wpswizardpage.h" @@ -34,52 +35,50 @@ // Constants +/*! + * @addtogroup group_wps_wizard_plugin + * @{ + */ + // Class declaration class WpsPageStepThreeButton : public WpsWizardPage { Q_OBJECT + public: - WpsPageStepThreeButton(WpsWizardPrivate* parent); + explicit WpsPageStepThreeButton(WpsWizardPrivate* parent); ~WpsPageStepThreeButton(); public: - /*! - * Creates a visualization of the page. - */ + HbWidget* initializePage(); - /*! - * Returns id of next page. updates settings EapWizard. - */ + int nextId(bool &removeFromStack) const; - /*! - * Returns how many steps should be gone backwards. - */ - int stepsBackwards(); - /*! - * This method is called when Previous button has been pressed. - */ - void previousTriggered(); - /*! - * This method is called when Cancel button has been pressed. - */ - void cancelTriggered(); - /*! - * This method is called when a visualization is displayed to detect - * whether next button should be enabled or not. - */ - bool validate() const; + + int previousTriggered(); +signals: + public slots: + void loadDocmlSection(Qt::Orientation orientation); + +protected: + +protected slots: + private: Q_DISABLE_COPY(WpsPageStepThreeButton) + +private slots: + +private: //data + //! Pointer to the widget object HbWidget *mWidget; - HbRadioButtonList *mRadio; - HbLabel *mTitle; + //! Pointer to the label displaying the heading HbLabel *mHeading; - bool mValid; + //! Document loader object. + HbDocumentLoader *mLoader; }; -/*! @} */ - #endif /* WPSWIZARDSTEPTHREEBUTTON_H_ */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/inc/wpswizardstepthreenumber.h --- a/wlanutilities/wpswizard/inc/wpswizardstepthreenumber.h Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/inc/wpswizardstepthreenumber.h Thu Jul 22 16:44:32 2010 +0100 @@ -1,26 +1,26 @@ /* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Step 3 Number mode -* -*/ + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Step 3 Number mode + * + */ #ifndef WPSWIZARDSTEPTHREENUMBER_H_ #define WPSWIZARDSTEPTHREENUMBER_H_ - // System includes #include +#include // User includes #include "wpswizardpage.h" @@ -34,61 +34,57 @@ // External data types // Constants +/*! + * @addtogroup group_wps_wizard_plugin + * @{ + */ + // Class declaration class WpsPageStepThreeNumber : public WpsWizardPage - { - Q_OBJECT - public: - WpsPageStepThreeNumber(WpsWizardPrivate* parent); +{ +Q_OBJECT + +public: + explicit WpsPageStepThreeNumber(WpsWizardPrivate* parent); ~WpsPageStepThreeNumber(); - public: - /*! - * Creates a visualization of the page. - */ + +public: HbWidget* initializePage(); - /*! - * Returns id of next page. updates settings EapWizard. - */ + int nextId(bool &removeFromStack) const; - /*! - * Returns how many steps should be gone backwards. - */ - int stepsBackwards(); - /*! - * This method is called when Previous button has been pressed. - */ - void previousTriggered(); - /*! - * This method is called when Cancel button has been pressed. - */ + + int previousTriggered(); + void cancelTriggered(); - /*! - * This method is called when a visualization is displayed to detect - * whether next button should be enabled or not. - */ - bool validate() const; - private: - /*! - * This method computes a random number based on current syste time - */ + bool showPage(); + +private: int computeRandNumber(); - /*! - * This method computes the check sum on the input number - */ + int computeCheckSum(int aPin); - - private slots: - - private: // data + +signals: + +public slots: + void loadDocmlSection(Qt::Orientation orientation); + +protected: + +protected slots: + +private: Q_DISABLE_COPY(WpsPageStepThreeNumber) - HbWidget *mWidget; - HbRadioButtonList *mRadio; - HbLabel *mTitle; - HbLabel *mHeading; - bool mValid; - }; + +private slots: -/*! @} */ +private: //data + //! Pointer to the widget object. + HbWidget *mWidget; + //! Label object used for displaying the heading. + HbLabel *mHeading; + //! Document loader object + HbDocumentLoader *mLoader; +}; #endif /* WPSWIZARDSTEPTHREENUMBER_H_ */ diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/inc/wpswizardsteptwo.h --- a/wlanutilities/wpswizard/inc/wpswizardsteptwo.h Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/inc/wpswizardsteptwo.h Thu Jul 22 16:44:32 2010 +0100 @@ -19,6 +19,7 @@ // System includes #include +#include // User includes #include "wpswizardpage.h" @@ -29,61 +30,63 @@ class HbLabel; class WpsWizardPrivate; - // External data types // Constants +/*! + * @addtogroup group_wps_wizard_plugin + * @{ + */ // Class declaration class WpsPageStepTwo : public WpsWizardPage { Q_OBJECT + public: - WpsPageStepTwo(WpsWizardPrivate* parent); + explicit WpsPageStepTwo(WpsWizardPrivate* parent); ~WpsPageStepTwo(); public: - /*! - * Creates a visualization of the page. - */ HbWidget* initializePage(); - /*! - * Returns id of next page. updates settings EapWizard. - */ + int nextId(bool &removeFromStack) const; - /*! - * Returns how many steps should be gone backwards. - */ - int stepsBackwards(); - /*! - * This method is called when Previous button has been pressed. - */ - void previousTriggered(); - /*! - * This method is called when Cancel button has been pressed. - */ + + int previousTriggered(); + void cancelTriggered(); - /*! - * This method is called when a visualization is displayed to detect - * whether next button should be enabled or not. - */ - bool validate() const; + + bool showPage(); + +signals: public slots: - /*! - * To receive the signal when an item is selected in the list view - */ void itemSelected(int index); + + void loadDocmlSection(Qt::Orientation orientation); + +protected: + +protected slots: private: Q_DISABLE_COPY(WpsPageStepTwo) - + +private slots: + +private: //data + //! Pointer to the widget object HbWidget *mWidget; + //! Radio button list object HbRadioButtonList *mRadio; - HbLabel *mTitle; + //! Label object used to display the heading HbLabel *mHeading; + //! Variable used to determine whether to enable next button or not bool mValid; + //! Variable used to store the item selected. int mItemSelected; + //! Document loader object. + HbDocumentLoader* mLoader; }; diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/resources/occ_wps_01_05.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/resources/occ_wps_01_05.docml Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,51 @@ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + +
+ + + + + +
+ \ No newline at end of file diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/resources/occ_wps_02_03.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/resources/occ_wps_02_03.docml Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/resources/occ_wps_P1.docml --- a/wlanutilities/wpswizard/resources/occ_wps_P1.docml Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/resources/occ_wps_P2.docml --- a/wlanutilities/wpswizard/resources/occ_wps_P2.docml Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/resources/occ_wps_P3.docml --- a/wlanutilities/wpswizard/resources/occ_wps_P3.docml Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/resources/occ_wps_P4.docml --- a/wlanutilities/wpswizard/resources/occ_wps_P4.docml Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/resources/occ_wps_P4.docml Thu Jul 22 16:44:32 2010 +0100 @@ -1,26 +1,55 @@ - - - - + + + + + + + - - + + - + - - - - - - - - - - - + + + +
+ + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + +
+ + +
+ \ No newline at end of file diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/resources/occ_wps_P5.docml --- a/wlanutilities/wpswizard/resources/occ_wps_P5.docml Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/resources/occ_wps_P6.docml --- a/wlanutilities/wpswizard/resources/occ_wps_P6.docml Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/resources/resource.qrc --- a/wlanutilities/wpswizard/resources/resource.qrc Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - - occ_wps_P1.docml - occ_wps_P2.docml - occ_wps_P3.docml - occ_wps_P4.docml - occ_wps_P5.docml - occ_wps_P6.docml - - - - wpswizardplugin.qm - - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/resources/wpswizard_resource.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/resources/wpswizard_resource.qrc Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,8 @@ + + + + occ_wps_01_05.docml + occ_wps_02_03.docml + occ_wps_P4.docml + + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/resources/wpswizardplugin.qm Binary file wlanutilities/wpswizard/resources/wpswizardplugin.qm has changed diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/resources/wpswizardplugin.ts --- a/wlanutilities/wpswizard/resources/wpswizardplugin.ts Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ - - - - - - - Configure manually - Configure manually - qtl_list_popup_sec_add - occ_wps_01 - list - oc - False - - - - Use PIN code - Use PIN code - qtl_list_popup_sec_add - occ_wps_01 - list - oc - False - - - - First, press button on the wireless station to initiate the setup process, then select ‘Next’. - First, press button on the wireless station to initiate the setup process, then select ‘Next’. - qtl_dialog_pri5 - occ_wps_02 - dialog - oc - False - - - - Settings received for multiple WLAN networks. Select the network to use: - Settings received for multiple WLAN networks. Select the network to use: - qtl_dialog_pri5 - occ_wps_05 - dialog - oc - False - - - - Enter ‘%1 on the wireless station then select ‘Next’. - Enter ‘%1 on the wireless station then select ‘Next’. - qtl_dialog_pri5 - occ_wps_03 - dialog - oc - False - - - - Selected network supports Wi-Fi Protected Setupâ„¢ for receiving settings automatically. - Selected network supports Wi-Fi Protected Setupâ„¢ for receiving settings automatically. - qtl_dialog_pri5 - occ_wps_01 - dialog - oc - False - - - - Negotiating - Negotiating - qtl_dialog_pri3 - occ_wps_04 - dialog - oc - False - - - - Use push-button - Use push-button - qtl_list_popup_sec_add - occ_wps_01 - list - oc - False - - - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/rom/wpswizard.iby --- a/wlanutilities/wpswizard/rom/wpswizard.iby Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/rom/wpswizard.iby Thu Jul 22 16:44:32 2010 +0100 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description:IBY file for WPS Wizard * */ @@ -20,10 +20,10 @@ #include -//#ifdef __PROTOCOL_WLAN +#ifdef __PROTOCOL_WLAN -file=ABI_DIR\BUILD_DIR\wpswizard.dll SHARED_LIB_DIR\wpswizard.dll +file=ABI_DIR/BUILD_DIR/wpswizard.dll SHARED_LIB_DIR/wpswizard.dll -//#endif // __PROTOCOL_WLAN +#endif // __PROTOCOL_WLAN #endif // WPSWIZARD_IBY diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/rom/wpswizard_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/rom/wpswizard_resources.iby Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WPS Wizard resource iby. +*/ + +#ifndef WPSWIZARD_RESOURCES_IBY +#define WPSWIZARD_RESOURCES_IBY + +#include +#include + +#ifdef __PROTOCOL_WLAN + +data=DATAZ_/QT_TRANSLATIONS_DIR/wpswizardplugin.qm QT_TRANSLATIONS_DIR/wpswizardplugin.qm + +#endif // __PROTOCOL_WLAN + +#endif // WPSWIZARD_RESOURCES_IBY diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/src/cwpsactiverunner.cpp --- a/wlanutilities/wpswizard/src/cwpsactiverunner.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/src/cwpsactiverunner.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -2,7 +2,7 @@ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" + * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * @@ -12,129 +12,147 @@ * Contributors: * * Description: Implementation of middleware wrapper class - * + * * */ - +// System includes +#include +#include // User includes #include "cwpsactiverunner.h" -#include "wlanmgmtcommon.h" + +// External function prototypes -//Need to check this. -const TInt KArrayGranularity = 4; +//Constants +static const TInt KArrayGranularity = 4; +static const TInt KDefaultPinLength = 10; + +// Trace includes +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cwpsactiverunnerTraces.h" +#endif /*! \class CWpsActiveRunner - \brief CWpsActiveRunner is a wrapper class wlan Mgmt engine interface + \brief CWpsActiveRunner is a wrapper class wlan Mgmt engine interface. + The wrapper class for wlan management engine calls */ +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + * Creates the instance of active runner which encapsulates the wlan mgmt + * interface middleware calls + * + * + * \param MWpsActiveRunnerCallback[in] call back interface to notify the + * completion of the middleware calls + */ +CWpsActiveRunner* CWpsActiveRunner::NewL(MWpsActiveRunnerCallback& aObserver) +{ + OstTraceFunctionEntry0( CWPSACTIVERUNNER_NEWL_ENTRY ); + CWpsActiveRunner* self = new (ELeave) CWpsActiveRunner(aObserver); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + OstTraceFunctionExit0( CWPSACTIVERUNNER_NEWL_EXIT ); + return self; +} /*! * Creates the instance of active runner which encapsulates the wlan mgmt * interface middleware calls - * - * - * \param MWpsActiveRunnerCallback call back interface to notify the completion of the middleware calls - */ -CWpsActiveRunner* CWpsActiveRunner::NewL(MWpsActiveRunnerCallback& aObserver) -{ - CWpsActiveRunner* self = new (ELeave) CWpsActiveRunner( aObserver ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; -} -/*! - * Creates the instance of active runner which encapsulates the wlan mgmt - * interface middleware calls - * - * - * \param MWpsActiveRunnerCallback call back interface to notify the completion of the middleware calls + * + * + * \param MWpsActiveRunnerCallback[in] call back interface to notify the + * completion of the middleware calls */ CWpsActiveRunner::CWpsActiveRunner(MWpsActiveRunnerCallback& aObserver) : - CActive(EPriorityStandard), iObserver(aObserver) + CActive(EPriorityStandard), + iObserver(aObserver), + isCancelTriggered(false), + iWLANMgmtClient(NULL), + iIapParametersArray(NULL) { -#ifdef __arm - iIapParametersArray = NULL; - iWLANMgmtClient = NULL; -#endif + OstTraceFunctionEntry1( CWPSACTIVERUNNER_CWPSACTIVERUNNER_ENTRY, this ); + OstTraceFunctionExit1( CWPSACTIVERUNNER_CWPSACTIVERUNNER_EXIT, this ); } /*! - * Initializes the member variables - * - * - * \return integer error code indicating the result of the operation + * ConstructL, Two phased constructor. + * */ -void CWpsActiveRunner::InitL() -{ - CActiveScheduler::Add(this); -#ifdef __arm - InitializeL(); -#else - iTimer.CreateLocal(); -#endif - -} - void CWpsActiveRunner::ConstructL() { - InitL(); + OstTraceFunctionEntry1( CWPSACTIVERUNNER_CONSTRUCTL_ENTRY, this ); + + CActiveScheduler::Add(this); + InitializeL(); + OstTraceFunctionExit1( CWPSACTIVERUNNER_CONSTRUCTL_EXIT, this ); } /*! * Initializes the member variables for making the middleware calls - * + * */ void CWpsActiveRunner::InitializeL() { -#ifdef __arm - if (!iWLANMgmtClient) - iWLANMgmtClient = CWlanMgmtClient::NewL(); - if (!iIapParametersArray) - iIapParametersArray = new (ELeave) CArrayFixSeg< - TWlanProtectedSetupCredentialAttribute> (KArrayGranularity); -#endif + OstTraceFunctionEntry1( CWPSACTIVERUNNER_INITIALIZEL_ENTRY, this ); + iWLANMgmtClient = CWlanMgmtClient::NewL(); + iIapParametersArray = new (ELeave) CArrayFixSeg< + TWlanProtectedSetupCredentialAttribute> (KArrayGranularity); + + OstTraceFunctionExit1( CWPSACTIVERUNNER_INITIALIZEL_EXIT, this ); } /*! * Destructor - * + * */ - CWpsActiveRunner::~CWpsActiveRunner() { + OstTraceFunctionEntry0( DUP1_CWPSACTIVERUNNER_CWPSACTIVERUNNER_ENTRY ); Cancel(); -#ifdef __arm delete iWLANMgmtClient; delete iIapParametersArray; -#else - iTimer.Cancel(); - iTimer.Close(); -#endif + OstTraceFunctionExit0( DUP1_CWPSACTIVERUNNER_CWPSACTIVERUNNER_EXIT ); } /*! * Initiates the call to the middleware + * + * \param aSsid[in] The network ssid to which we have to connect + * \param aPin[in] The pin to be used for WPS negotiating */ void CWpsActiveRunner::StartSetup(RBuf8& aSsid, int aPin) { -#ifdef __arm + OstTraceFunctionEntry1( CWPSACTIVERUNNER_STARTSETUP_ENTRY, this ); TWlanSsid ssid; TWlanWpsPin pin; + isCancelTriggered = false; ssid.Copy(aSsid); - TBuf8<32> pinCode; - pinCode.AppendNum(aPin); + TBuf8 pinCode; + + if (aPin == 0) { + pinCode.AppendFill('0', 8); + } + else { + pinCode.AppendNum(aPin); + } + pin.Copy(pinCode); - iWLANMgmtClient->RunProtectedSetup(iStatus,ssid,pin,*iIapParametersArray); -#else - iTimer.After(iStatus, 4 * 1000000); -#endif + + iWLANMgmtClient->RunProtectedSetup(iStatus, ssid, pin, *iIapParametersArray); + SetActive(); + OstTraceFunctionExit1( CWPSACTIVERUNNER_STARTSETUP_EXIT, this ); } /*! @@ -142,29 +160,31 @@ */ void CWpsActiveRunner::RunL() { + OstTraceFunctionEntry1( CWPSACTIVERUNNER_RUNL_ENTRY, this ); + TInt completionCode = iStatus.Int(); QList credentials; - if (completionCode < KErrNone) { - //Raise Error - iObserver.WpsActiveRunnerStopped(credentials, completionCode); - } - else { -#ifdef __arm - TInt len = iIapParametersArray->Length(); - TInt count; - for(count=0;countCount();count++) - { - TWlanProtectedSetupCredentialAttribute attr =(*iIapParametersArray)[count]; - credentials.append(attr); + if(!isCancelTriggered) { + + if (completionCode < KErrNone) { + //Raise Error + QT_TRYCATCH_LEAVING(iObserver.WpsActiveRunnerStopped(credentials, completionCode)); } - iObserver.WpsActiveRunnerStopped(credentials,completionCode); -#else + else { + TInt len = iIapParametersArray->Length(); + TInt count; + for(count=0;countCount();count++) + { + TWlanProtectedSetupCredentialAttribute attr =(*iIapParametersArray)[count]; + credentials.append(attr); + } + QT_TRYCATCH_LEAVING(iObserver.WpsActiveRunnerStopped(credentials,completionCode)); - RunProtectedSetup_Stub(); -#endif + } } + OstTraceFunctionExit1( CWPSACTIVERUNNER_RUNL_EXIT, this ); } /*! @@ -172,12 +192,13 @@ */ void CWpsActiveRunner::DoCancel() { -#ifdef __arm + OstTraceFunctionEntry1( CWPSACTIVERUNNER_DOCANCEL_ENTRY, this ); + isCancelTriggered = true; if(iWLANMgmtClient) - iWLANMgmtClient->CancelProtectedSetup(); -#else - iTimer.Cancel(); -#endif + { + iWLANMgmtClient->CancelProtectedSetup(); + } + OstTraceFunctionExit1( CWPSACTIVERUNNER_DOCANCEL_EXIT, this ); } /*! @@ -185,41 +206,18 @@ */ TInt CWpsActiveRunner::RunError(TInt aError) { + OstTraceFunctionEntry1( CWPSACTIVERUNNER_RUNERROR_ENTRY, this ); + + OstTrace1( TRACE_ERROR, CWPSACTIVERUNNER_RUNERROR, "CWpsActiveRunner::RunError;aError=%d", aError ); + QList credentials; -#ifdef __arm if(iWLANMgmtClient) - iWLANMgmtClient->CancelProtectedSetup(); -#else - iTimer.Cancel(); -#endif + { + iWLANMgmtClient->CancelProtectedSetup(); + } - iObserver.WpsActiveRunnerStopped(credentials, aError); + QT_TRYCATCH_LEAVING(iObserver.WpsActiveRunnerStopped(credentials, aError)); + + return 0; } -#ifndef __arm -void CWpsActiveRunner::RunProtectedSetup_Stub() -{ - QList credentials; - TWlanProtectedSetupCredentialAttribute attr1 = { EWlanOperatingModeInfrastructure, // iOperatingMode - EWlanAuthenticationModeOpen, // iAuthenticationMode - EWlanIapSecurityModeWpa, // iSecurityMode, - _L8( "STUB01" ), // iSsid - _L8( "" ), // iWepKey1 - _L8( "" ), // iWepKey2 - _L8( "" ), // iWepKey3 - _L8( "" ), // iWepKey4 - EWlanDefaultWepKey1, // iWepDefaultKey - _L8( "testtest" ) - // iWpaPreSharedKey - }; - - TWlanProtectedSetupCredentialAttribute attr2 = { EWlanOperatingModeAdhoc, - EWlanAuthenticationModeOpen, EWlanIapSecurityModeWep, _L8( "STUB02" ), _L8( "12345" ), - _L8( "" ), _L8( "" ), _L8( "" ), EWlanDefaultWepKey1, _L8( "" ) }; - - credentials.append(attr1); - credentials.append(attr2); - - iObserver.WpsActiveRunnerStopped(credentials, KErrNone); -} -#endif diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/src/wpswizard.cpp --- a/wlanutilities/wpswizard/src/wpswizard.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/src/wpswizard.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -2,7 +2,7 @@ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" + * under the terms of the "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * @@ -16,28 +16,14 @@ * */ - // System includes -#include -#include -#include -#include -#include -#include -#include -#include - -// Trace includes -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wpswizardTraces.h" -#endif +#include // User includes // WLAN Wizard -#include "wlanwizardhelpper.h" +#include "wlanwizardhelper.h" -// Wizard +// WPS Wizard #include "wpswizard.h" #include "wpswizard_p.h" @@ -48,62 +34,49 @@ #include "wpswizardstepfour.h" #include "wpswizardstepfive.h" +// Trace includes +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wpswizardTraces.h" +#endif -class WlanWizardHelpper; +//Forward Declarations +class WlanWizardHelper; + +// External function prototypes + +//Local Constants /*! -* Creates the WpsWizard object -* -* \param WlanWizardHelpper* Helper class to from the framework -* \param BearerType Indicates the bearer type Eg. Wlan -* -*/ + \class WpsWizard + \brief Provides the WPS wizard implementation + */ -WpsWizard::WpsWizard(WlanWizardHelpper *wizardHelpper, BearerType bearerType, - int referenceId) : - d_ptr(new WpsWizardPrivate(this, wizardHelpper, bearerType, referenceId)) - { - OstTraceFunctionEntry1(WPSWIZARD_WPSWIZARD_ENTRY, this) - OstTraceFunctionExit1(WPSWIZARD_WPSWIZARD_EXIT, this) - } +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== /*! -* Destructor -* -*/ + Creates the WpsWizard object + + @param [in] wizardHelper WlanWizardHelper* Helper class to from the framework + */ -WpsWizard::~WpsWizard() - { - OstTraceFunctionEntry1(WPSWIZARD_WPSWIZARD_ENTRY, this); - delete d_ptr; +WpsWizard::WpsWizard(WlanWizardHelper *wizardHelper) : + d_ptr(NULL) +{ + OstTraceFunctionEntry1(WPSWIZARD_WPSWIZARD_ENTRY, this); + d_ptr.reset(new WpsWizardPrivate(this, wizardHelper)); OstTraceFunctionExit1(WPSWIZARD_WPSWIZARD_EXIT, this); - } +} /*! -* StoreSettings: Stores the settings in the commsdat database -* -*/ - -void WpsWizard::storeSettings() - { - OstTraceFunctionEntry1(WPSWIZARD_STORESETTINGS_ENTRY, this); - OstTraceFunctionExit1(WPSWIZARD_STORESETTINGS_EXIT, this); - } + Destructor + + */ +WpsWizard::~WpsWizard() +{ + OstTraceFunctionEntry1(WPSWIZARD_WPSWIZARD_DESTRUCTOR_ENTRY, this); + OstTraceFunctionExit1(WPSWIZARD_WPSWIZARD_DESTRUCTOR_EXIT, this); +} -/*! -* Creates the summary page, valid only for EAP usecase -* -* \param WlanWizardPlugin::Summary indicates the type of summary item -* \param QString &item item name -* \param QString &value item value -* -* \return the status of the summary operation -*/ - -bool WpsWizard::summary(WlanWizardPlugin::Summary sum, QString &item, - QString &value) - { - OstTraceFunctionEntry1(WPSWIZARD_SUMMARY_ENTRY, this); - OstTraceFunctionExit1(WPSWIZARD_SUMMARY_EXIT, this); - return true; - } diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/src/wpswizard_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/src/wpswizard_p.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,391 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WPS Wizard: Private implementation. + * + */ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Trace includes +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wpswizard_pTraces.h" +#endif + +// User includes +#include "wlanwizardhelper.h" +// WPS Wizard +#include "wpswizard.h" +#include "wpswizard_p.h" +// Wizard Pages +#include "wpswizardsteptwo.h" +#include "wpswizardstepthreebutton.h" +#include "wpswizardstepthreenumber.h" +#include "wpswizardstepfour.h" +#include "wpswizardstepfive.h" + +//Forward Decalrations + +// External function prototypes + +// Local constants + + +/*! + \class WpsWizardPrivate + \brief This class providesthe private class implementation for WPS wizard + */ + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor for the private implementation of wps wizard + + @param [in] wizard WpsWizard* pointer to the framework object + @param [in] wizardHelper WlanWizardHelper * pointer to the wizard helpper class + + @return WpsWizardPrivate + */ +WpsWizardPrivate::WpsWizardPrivate(WpsWizard* wizard, + WlanWizardHelper *wizardHelper) : + q_ptr(wizard), + mWizardHelper(wizardHelper), + mTranslator(new HbTranslator("wpswizardplugin")), + mRandomNumber(0) +{ + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_WPSWIZARDPRIVATE_ENTRY, this); + createPages(); + OstTraceFunctionExit1(WPSWIZARDPRIVATE_WPSWIZARDPRIVATE_EXIT, this); +} + +/*! + Destructor + */ +WpsWizardPrivate::~WpsWizardPrivate() +{ + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_WPSWIZARDPRIVATE_DESTRUCTOR_ENTRY, this); + // have to delete the memory that was allocated in this object + mIapList.clear(); + OstTraceFunctionExit1(WPSWIZARDPRIVATE_WPSWIZARDPRIVATE_DESTRUCTOR_EXIT, this); +} + +/*! + Provides the caller with the functionality to enable/disable the 'Next' button + + @param [in] enable bool to indicate whether to enable or disable the 'next button' + */ +void WpsWizardPrivate::enableNextButton(bool enable) +{ + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_ENABLENEXTBUTTON_ENTRY, this); + mWizardHelper->enableNextButton(enable); + OstTraceFunctionExit1(WPSWIZARDPRIVATE_ENABLENEXTBUTTON_EXIT, this); +} + +/*! + Provides the functionality to automatically move to the next page. + */ +void WpsWizardPrivate::nextPage() +{ + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_NEXTPAGE_ENTRY, this); + mWizardHelper->nextPage(); + OstTraceFunctionExit1(WPSWIZARDPRIVATE_NEXTPAGE_EXIT, this); +} + +/*! + Provides access to the main window + + @return HbMainWindow* An instance of HbMainWindow. + */ +HbMainWindow* WpsWizardPrivate::mainWindow() +{ + return mWizardHelper->mainWindow(); +} + +/*! + Provides the functionality to store the received settings + + @param [in] index int indicates the index in the array of received + settings to be stored + */ +void WpsWizardPrivate::storeSettings(int index) +{ + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_STORESETTINGS_ENTRY, this); + + if (mIapList.count() > index) + { + mWpsAttr = mIapList[index]; + + // SSID + QString ssid = QString::fromUtf8(reinterpret_cast (mWpsAttr.iSsid.Ptr()), + mWpsAttr.iSsid.Length()); + mWizardHelper->setConfiguration(WlanWizardHelper::ConfSsid, ssid); + // WEP Key1 + QString str = QString::fromUtf8(reinterpret_cast(mWpsAttr.iWepKey1.Ptr()), + mWpsAttr.iWepKey1.Length()); + mWizardHelper->setConfiguration(WlanWizardHelper::ConfKeyWep1, str); + // WEP Key2 + str = QString::fromUtf8(reinterpret_cast (mWpsAttr.iWepKey2.Ptr()), + mWpsAttr.iWepKey2.Length()); + mWizardHelper->setConfiguration(WlanWizardHelper::ConfKeyWep2, str); + // WEP Key3 + str = QString::fromUtf8(reinterpret_cast (mWpsAttr.iWepKey3.Ptr()), + mWpsAttr.iWepKey3.Length()); + mWizardHelper->setConfiguration(WlanWizardHelper::ConfKeyWep3, str); + // WEP Key4 + str = QString::fromUtf8(reinterpret_cast (mWpsAttr.iWepKey4.Ptr()), + mWpsAttr.iWepKey4.Length()); + mWizardHelper->setConfiguration(WlanWizardHelper::ConfKeyWep4, str); + //Default WEP key in use + mWizardHelper->setConfiguration(WlanWizardHelper::ConfKeyWepDefault, + convertDefaultWepKey(mWpsAttr.iWepDefaultKey)); + //Key WPA + str = QString::fromUtf8(reinterpret_cast (mWpsAttr.iWpaPreSharedKey.Ptr()), + mWpsAttr.iWpaPreSharedKey.Length()); + mWizardHelper->setConfiguration(WlanWizardHelper::ConfKeyWpa, str); + // security mode + mWizardHelper->setConfiguration(WlanWizardHelper::ConfSecurityMode, + convertSecurityModes(mWpsAttr.iSecurityMode)); + // Network Mode + mWizardHelper->setConfiguration(WlanWizardHelper::ConfNetworkMode, + convertNetworkModes(mWpsAttr.iOperatingMode)); + + mWizardHelper->setConfiguration(WlanWizardHelper::ConfUsePsk, true); + } + + OstTraceFunctionExit1(WPSWIZARDPRIVATE_STORESETTINGS_EXIT, this); +} + +/*! + Provides the functionality to retrieve the ssid of the network to connect + + @return returns the SSID as a QString + */ +QString WpsWizardPrivate::getSsid() +{ + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_GETSSID_ENTRY, this); + QString ssid; + ssid = mWizardHelper->configuration(WlanWizardHelper::ConfSsid).toString(); + OstTraceFunctionExit1(WPSWIZARDPRIVATE_GETSSID_EXIT, this); + return ssid; +} + +/*! + Provides functionality for the caller to store the array of + recieved settings from AP + + @param [in] credentials QList& + received settings from wps enabled AP + */ +void WpsWizardPrivate::storeSettingsArray(QList< + TWlanProtectedSetupCredentialAttribute>& credentials) +{ + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_STORESETTINGSARRAY_ENTRY, this); + mIapList = credentials; + OstTraceFunctionExit1(WPSWIZARDPRIVATE_STORESETTINGSARRAY_EXIT, this); +} + +/*! + Returns the array of settings received from the AP + + @return Array containing the settings + */ +QList WpsWizardPrivate::getSettingsArray() +{ + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_GETSETTINGSARRAY_ENTRY, this); + OstTraceFunctionExit1(WPSWIZARDPRIVATE_GETSETTINGSARRAY_EXIT, this); + return mIapList; +} + +/*! + Creates the required pages for WPS setup + */ +void WpsWizardPrivate::createPages() +{ + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_CREATEPAGES_ENTRY, this); + + mWizardHelper->addPage(WpsWizardPage::PageWpsWizardStep2, + new WpsPageStepTwo(this)); + + mWizardHelper->addPage(WpsWizardPage::PageWpsWizardStep3_Button, + new WpsPageStepThreeButton(this)); + + mWizardHelper->addPage(WpsWizardPage::PageWpsWizardStep3_Number, + new WpsPageStepThreeNumber(this)); + + mWizardHelper->addPage(WpsWizardPage::PageWpsWizardStep4, + new WpsPageStepFour(this)); + + mWizardHelper->addPage(WpsWizardPage::PageWpsWizardStep5, + new WpsPageStepFive(this)); + + OstTraceFunctionExit1(WPSWIZARDPRIVATE_CREATEPAGES_EXIT, this); +} + +/*! + Converts enums between wlan security mode to cm manager enums. + + @param [in] securityMode Security operating mode from wlanmgmt api + + @return int converted CMManagerShim::WlanSecMode codes + */ +int WpsWizardPrivate::convertSecurityModes(TWlanIapSecurityMode securityMode) +{ + CMManagerShim::WlanSecMode cmManagerSecurityMode; + switch(securityMode) { + case EWlanIapSecurityModeWep: + cmManagerSecurityMode = CMManagerShim::WlanSecModeWep; + break; + + case EWlanIapSecurityModeWpa: + cmManagerSecurityMode = CMManagerShim::WlanSecModeWpa; + break; + + case EWlanIapSecurityModeWpa2Only: + cmManagerSecurityMode = CMManagerShim::WlanSecModeWpa2; + break; + + default: + // invalid securityMode. + // Not possible to get EWlanIapSecurityMode802d1x here. Since not + // supported with wps + Q_ASSERT(EWlanIapSecurityModeAllowUnsecure == securityMode); + cmManagerSecurityMode = CMManagerShim::WlanSecModeOpen; + break; + } + + return cmManagerSecurityMode; +} + +/*! + Converts enums between wlan wep key index to cm manager enums. + + @param [in] defaultWepKey Default wep key used in wlanmgmt api + + @return int converted CMManagerShim::WlanWepKeyIndex codes + */ +int WpsWizardPrivate::convertDefaultWepKey(TWlanDefaultWepKey defaultWepKey) +{ + int cmManagerWepKeyIndex; + + switch (defaultWepKey) { + case EWlanDefaultWepKey2: + cmManagerWepKeyIndex = CMManagerShim::WepKeyIndex2; + break; + + case EWlanDefaultWepKey3: + cmManagerWepKeyIndex = CMManagerShim::WepKeyIndex3; + break; + + case EWlanDefaultWepKey4: + cmManagerWepKeyIndex = CMManagerShim::WepKeyIndex4; + break; + + case EWlanDefaultWepKey1: + default: + // It is possible that the value of defaultWepKey is not initialized + // when security mode is Open. That's why we cannot assert here. + cmManagerWepKeyIndex = CMManagerShim::WepKeyIndex1; + break; + } + return cmManagerWepKeyIndex; +} + +/*! + Converts enums between wlan network mode to cm manager enums. + + @param [in] networkMode Networking operating mode from wlanmgmt api + + @return int converted CMManagerShim::WlanConnMode codes + */ +int WpsWizardPrivate::convertNetworkModes(TWlanOperatingMode networkMode) +{ + CMManagerShim::WlanConnMode wlanConnMode; + switch (networkMode) { + case EWlanOperatingModeAdhoc: + wlanConnMode = CMManagerShim::Adhoc; + break; + + default: + Q_ASSERT(EWlanOperatingModeInfrastructure == networkMode); + wlanConnMode = CMManagerShim::Infra; + break; + } + return wlanConnMode; +} + +/*! + Provides with the functionality to store the PIN generated + + @param [in] random The generated PIN code to be used in succesive steps + + */ +void WpsWizardPrivate::setPin(int random) +{ + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_SETPIN_ENTRY, this); + mRandomNumber = random; + OstTraceFunctionExit1(WPSWIZARDPRIVATE_SETPIN_EXIT, this); +} + +/*! + Returns the PIN code stored in one of the WPS Pages + + @return PIN code to be used in the WPS operation. + */ +int WpsWizardPrivate::getPin() +{ + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_GETPIN_ENTRY, this); + OstTraceFunctionExit1(WPSWIZARDPRIVATE_GETPIN_EXIT, this); + return mRandomNumber; +} + +/*! + Returns page id when manual configuration is chosen + + @param [in] useWps is WPS used or not? + + @return new page id + */ +int WpsWizardPrivate::nextPageId(bool useWps) +{ + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_NEXTPAGEID_ENTRY, this); + OstTraceFunctionExit1(WPSWIZARDPRIVATE_NEXTPAGEID_EXIT, this); + return mWizardHelper->nextPageId(useWps); +} + +/*! + Sets wlan configuration value for given configuration identifier. + See ConfigurationId for further details about the data types in QVariant. + + @param [in] confId Configuration Identifier do to be set + @param [in] value Value for configuration. + */ +void WpsWizardPrivate::setConfiguration( + WlanWizardHelper::ConfigurationId confId, + const QVariant &value) +{ + mWizardHelper->setConfiguration(confId, value); +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/src/wpswizardpage.cpp --- a/wlanutilities/wpswizard/src/wpswizardpage.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/src/wpswizardpage.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -2,7 +2,7 @@ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" + * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * @@ -17,9 +17,10 @@ */ // System includes -#include +#include // User includes +#include "wpswizard_p.h" #include "wpswizardpage.h" // Trace includes @@ -28,48 +29,41 @@ #include "wpswizardpageTraces.h" #endif -#define WPS_DEFAULT_STEPBACK 1 +// External function prototypes + +// Local constants + +/*! + \class WpsWizardPage + \brief Implementation of the basic wps wizard page functionality + */ + +// ======== LOCAL FUNCTIONS ======== - /*! - * Constructor for the WPS page baseclass - * - * \param WpsWizardPrivate* pointer to the implementation class + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor for the WPS page baseclass + + @param [in] parent WpsWizardPrivate* pointer to the implementation class */ - + WpsWizardPage::WpsWizardPage(WpsWizardPrivate* parent) : + QObject(parent), mWizard(parent) { -OstTraceFunctionEntry1(WPSWIZARDPAGE_WPSWIZARDPAGE_ENTRY, this) -OstTraceFunctionExit1(WPSWIZARDPAGE_WPSWIZARDPAGE_EXIT, this) + OstTraceFunctionEntry1(WPSWIZARDPAGE_WPSWIZARDPAGE_ENTRY, this); + OstTraceFunctionExit1(WPSWIZARDPAGE_WPSWIZARDPAGE_EXIT, this); } /*! -* Destructor -*/ + Destructor + */ WpsWizardPage::~WpsWizardPage() { - OstTraceFunctionEntry1(WPSWIZARDPAGE_WPSWIZARDPAGE_ENTRY, this) + OstTraceFunctionEntry1(WPSWIZARDPAGE_WPSWIZARDPAGE_DESTRUCTOR_ENTRY, this); mWizard = NULL; -OstTraceFunctionExit1(WPSWIZARDPAGE_WPSWIZARDPAGE_EXIT, this) + OstTraceFunctionExit1(WPSWIZARDPAGE_WPSWIZARDPAGE_DESTRUCTOR_EXIT, this); } -/*! -* Determines how many pages to step back. -* \return number of pages to step backwards -*/ -int WpsWizardPage::stepsBackwards() -{ - OstTraceFunctionEntry1(WPSWIZARDPAGE_STEPBACKWARDS_ENTRY, this) - OstTraceFunctionExit1(WPSWIZARDPAGE_STEPBACKWARDS_EXIT, this) - return WPS_DEFAULT_STEPBACK; -} - -/*! -* Validates the contents of the page -*/ -bool WpsWizardPage::validate() const -{ - OstTraceFunctionEntry1(WPSWIZARDPAGE_VALIDATE_ENTRY, this) - OstTraceFunctionExit1(WPSWIZARDPAGE_VALIDATE_EXIT, this) - return true; -} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/src/wpswizardprivate.cpp --- a/wlanutilities/wpswizard/src/wpswizardprivate.cpp Fri Jun 11 16:27:29 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,229 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * WPS Wizard: Private implementation. - * - */ - -/* - * %version: 1 % - */ - -// System includes -#include -#include -#include -#include -#include -#include -#include -#include - -// Trace includes -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wpswizardprivateTraces.h" -#endif - -// User includes -#include "wlanwizardhelpper.h" -// Wizard -#include "wpswizard.h" -#include "wpswizard_p.h" -// Wizard Pages -#include "wpswizardsteptwo.h" -#include "wpswizardstepthreebutton.h" -#include "wpswizardstepthreenumber.h" -#include "wpswizardstepfour.h" -#include "wpswizardstepfive.h" - - -class WlanWizardHelpper; - -/*! - * Constructor for the private implementation of wps wiazard - * - * \param WpsWizard* pointer to the framework object - * \param WlanWizardHelpper * pointer to the wizard helpper class - * - */ -WpsWizardPrivate::WpsWizardPrivate(WpsWizard* wizard, - WlanWizardHelpper *wizardHelpper, int bearerType, int referenceId) : - q_ptr(wizard), mBearerType(bearerType), mReferenceId(referenceId), - mWizardHelpper(wizardHelpper), mRandomNumber(0) - - { - OstTraceFunctionEntry1(WPSWIZARDPRIVATE_WPSWIZARDPRIVATE_ENTRY, this); - - // TODO: load localization file - mTranslator = new QTranslator(this); - mTranslator->load(":/loc/wpswizardplugin.qm"); - qApp->installTranslator(mTranslator); - - createPages(); - - OstTraceFunctionExit1(WPSWIZARDPRIVATE_WPSWIZARDPRIVATE_EXIT, this); - } - -/*! - * Destructor - */ -WpsWizardPrivate::~WpsWizardPrivate() - { - OstTraceFunctionEntry1(WPSWIZARDPRIVATE_WPSWIZARDPRIVATE_ENTRY, this); - // have to delete the memory that was allocated in this object - mIapList.clear(); - delete mTranslator; - OstTraceFunctionExit1(WPSWIZARDPRIVATE_WPSWIZARDPRIVATE_EXIT, this); - } - -/*! - * Provides the caller with the functionality to enable/disable the 'Next' button - * - * \param bool to indicate whether to enable or disable the 'next button' - */ -void WpsWizardPrivate::enableNextButton(bool enable) - { - OstTraceFunctionEntry1(WPSWIZARDPRIVATE_ENABLENEXTBUTTON_ENTRY, this); - mWizardHelpper->enableNextButton(enable); - OstTraceFunctionExit1(WPSWIZARDPRIVATE_ENABLENEXTBUTTON_EXIT, this); - } - -/*! - * Provides the functionality to automatically move to the next page. - */ -void WpsWizardPrivate::nextPage() - { - OstTraceFunctionEntry1(WPSWIZARDPRIVATE_NEXTPAGE_ENTRY, this); - mWizardHelpper->nextPage(); - OstTraceFunctionExit1(WPSWIZARDPRIVATE_NEXTPAGE_EXIT, this); - } - -/*! - * Provides the functionality to store the recieved settings - * - * \param int indicates the index in the array of received settings to be stored - */ -void WpsWizardPrivate::storeSettings(int aIndex) - { - OstTraceFunctionEntry1(WPSWIZARDPRIVATE_STORESETTINGS_ENTRY, this); - mWpsAttr = mIapList[aIndex]; - - QString ssid = QString::fromUtf8((const char*) mWpsAttr.iSsid.Ptr(), - mWpsAttr.iSsid.Length()); - - mWizardHelpper->setConfigurations(WlanWizardHelpper::ConfSsid, ssid); - mWizardHelpper->setConfigurations(WlanWizardHelpper::ConfNetworkMode, - mWpsAttr.iOperatingMode); - mWizardHelpper->setConfigurations(WlanWizardHelpper::ConfSecurityMode, - mWpsAttr.iSecurityMode); - mWizardHelpper->setConfigurations(WlanWizardHelpper::ConfKeyWepDefault, - mWpsAttr.iWepDefaultKey); - QString str = QString::fromUtf8((const char*) mWpsAttr.iWepKey1.Ptr(), - mWpsAttr.iWepKey1.Length()); - mWizardHelpper->setConfigurations(WlanWizardHelpper::ConfKeyWep1, str); - str = QString::fromUtf8((const char*) mWpsAttr.iWepKey2.Ptr(), mWpsAttr.iWepKey2.Length()); - mWizardHelpper->setConfigurations(WlanWizardHelpper::ConfKeyWep2, str); - str = QString::fromUtf8((const char*) mWpsAttr.iWepKey3.Ptr(), mWpsAttr.iWepKey3.Length()); - mWizardHelpper->setConfigurations(WlanWizardHelpper::ConfKeyWep3, str); - str = QString::fromUtf8((const char*) mWpsAttr.iWepKey4.Ptr(), mWpsAttr.iWepKey4.Length()); - mWizardHelpper->setConfigurations(WlanWizardHelpper::ConfKeyWep4, str); - - OstTraceFunctionExit1(WPSWIZARDPRIVATE_STORESETTINGS_EXIT, this); - } - -/*! - * Provides the functionality to retrieve the ssid of the network to connect - * \return returns the SSID as a QString - */ -QString WpsWizardPrivate::getSsid() - { - OstTraceFunctionEntry1(WPSWIZARDPRIVATE_GETSSID_ENTRY, this); - QString ssid; - ssid = mWizardHelpper->configurations(WlanWizardHelpper::ConfSsid).toString(); - OstTraceFunctionExit1(WPSWIZARDPRIVATE_GETSSID_EXIT, this); - return ssid; - } - -/*! - * Provides functionality for the caller to store the array of recieved settings from AP - * \param QList& received settings - * - */ -void WpsWizardPrivate::storeSettingsArray(QList< - TWlanProtectedSetupCredentialAttribute>& aIapList) - { - OstTraceFunctionEntry1(WPSWIZARDPRIVATE_STORESETTINGSARRAY_ENTRY, this); - mIapList = aIapList; - OstTraceFunctionExit1(WPSWIZARDPRIVATE_STORESETTINGSARRAY_EXIT, this); - } - -/*! - * Returns the array of settings received from the AP - * - * \return Array containing the settings - */ -QList WpsWizardPrivate::getSettingsArray() - { - OstTraceFunctionEntry1(WPSWIZARDPRIVATE_GETSETTINGSARRAY_ENTRY, this); - OstTraceFunctionExit1(WPSWIZARDPRIVATE_GETSETTINGSARRAY_EXIT, this); - return mIapList; - } - - - -/*! - * Creates the required pages for WPS setup - */ -void WpsWizardPrivate::createPages() - { - OstTraceFunctionEntry1(WPSWIZARDPRIVATE_CREATEPAGES_ENTRY, this); - mWizardHelpper->addPage(WpsWizardPage::PageWpsWizardStep2, - new WpsPageStepTwo(this)); - mWizardHelpper->addPage(WpsWizardPage::PageWpsWizardStep3_Button, - new WpsPageStepThreeButton(this)); - mWizardHelpper->addPage(WpsWizardPage::PageWpsWizardStep3_Number, - new WpsPageStepThreeNumber(this)); - mWizardHelpper->addPage(WpsWizardPage::PageWpsWizardStep4, - new WpsPageStepFour(this)); - mWizardHelpper->addPage(WpsWizardPage::PageWpsWizardStep5, - new WpsPageStepFive(this)); - OstTraceFunctionExit1(WPSWIZARDPRIVATE_CREATEPAGES_EXIT, this); - } - -/*! - * Provides with the functionality to store the PIN generated - * - * \param int The generated PIN code to be used in succesive steps - * - */ -void WpsWizardPrivate::setPin(int random) - { - OstTraceFunctionEntry1(WPSWIZARDPRIVATE_SETPIN_ENTRY, this); - mRandomNumber = random; - OstTraceFunctionExit1(WPSWIZARDPRIVATE_SETPIN_EXIT, this); - } - -/*! - * Returns the PIN code stored in one of the WPS Pages - * - * \return PIN code to be used in the WPS operation. - */ -int WpsWizardPrivate::getPin() - { - OstTraceFunctionEntry1(WPSWIZARDPRIVATE_GETPIN_ENTRY, this); - OstTraceFunctionExit1(WPSWIZARDPRIVATE_GETPIN_EXIT, this); - return mRandomNumber; - - } diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/src/wpswizardstepfive.cpp --- a/wlanutilities/wpswizard/src/wpswizardstepfive.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/src/wpswizardstepfive.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -2,7 +2,7 @@ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" + * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * @@ -17,11 +17,12 @@ */ // System includes -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include // User includes #include "wpswizardstepfive.h" @@ -30,155 +31,199 @@ // Trace Includes #include "OstTraceDefinitions.h" #ifdef OST_TRACE_COMPILER_IN_USE -#include "wpspagestepfiveTraces.h" +#include "wpswizardstepfiveTraces.h" #endif +// External function prototypes + +// Local constants + + /*! - * Constructor for WPS page five - * - * \param WpsWizardPrivate* Pointer to the WPS wizard private implementation + \class WpsPageStepFive + \brief Implementation of wps wizard page for step five. + */ + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +/*! + Constructor for WPS page five + + @param [in] parent WpsWizardPrivate* Pointer to the WPS wizard private + implementation */ WpsPageStepFive::WpsPageStepFive(WpsWizardPrivate* parent) : - WpsWizardPage(parent), mWidget(NULL), mRadio(NULL), mValid(false) + WpsWizardPage(parent), + mWidget(NULL), + mRadio(NULL), + mHeading(NULL), + mValid(false), + mLoader(NULL) { -OstTraceFunctionEntry1(WPSPAGESTEPFIVE_WPSPAGESTEPFIVE_ENTRY, this) -OstTraceFunctionExit1(WPSPAGESTEPFIVE_WPSPAGESTEPFIVE_EXIT, this) - + OstTraceFunctionEntry1(WPSPAGESTEPFIVE_WPSPAGESTEPFIVE_ENTRY, this); + OstTraceFunctionExit1(WPSPAGESTEPFIVE_WPSPAGESTEPFIVE_EXIT, this); } /*! - * Destructor + Destructor */ WpsPageStepFive::~WpsPageStepFive() { - OstTraceFunctionEntry1(WPSPAGESTEPFIVE_WPSPAGESTEPFIVE_ENTRY, this) - OstTraceFunctionExit1(WPSPAGESTEPFIVE_WPSPAGESTEPFIVE_EXIT, this) - - delete mWidget; + OstTraceFunctionEntry1(WPSPAGESTEPFIVE_WPSPAGESTEPFIVE_DESTRUCTOR_ENTRY, this); + delete mLoader; + OstTraceFunctionExit1(WPSPAGESTEPFIVE_WPSPAGESTEPFIVE_DESTRUCTOR_EXIT, this); } /*! - * Loads the page with all the widgets - * - * \return HbWidget* Returns the view widget + Loads the page with all the widgets + + @return HbWidget* Returns the view widget */ HbWidget* WpsPageStepFive::initializePage() { - OstTraceFunctionEntry1(WPSPAGESTEPFIVE_INITIALIZEPAGE_ENTRY, this) + OstTraceFunctionEntry1(WPSPAGESTEPFIVE_INITIALIZEPAGE_ENTRY, this); if (!mWidget) { bool ok; - HbDocumentLoader loader; - loader.load(":/docml/occ_wps_P5.docml", &ok); - Q_ASSERT_X(ok, "WPS Wizard", "Invalid docml file"); - - mWidget = qobject_cast (loader.findWidget("occ_wps_P5")); - Q_ASSERT_X(mWidget != 0, "WPS Wizard", "View not found"); + + mLoader = new HbDocumentLoader(mWizard->mainWindow()); + + mLoader->load(":/docml/occ_wps_01_05.docml", &ok); + Q_ASSERT(ok); + + // Initialize orientation + loadDocmlSection(mWizard->mainWindow()->orientation()); - //mTitle = qobject_cast (loader.findWidget("label_title")); - //Q_ASSERT_X(mTitle != 0, "WPS wizard", "title not found"); + mWidget = qobject_cast (mLoader->findWidget("occ_wps_P1")); + Q_ASSERT(mWidget); - mHeading = qobject_cast (loader.findWidget("label_heading")); - Q_ASSERT_X(mTitle != 0, "WPS wizard", "Header not found"); + mHeading = qobject_cast (mLoader->findWidget("label")); + Q_ASSERT(mHeading); + + mHeading->setPlainText(hbTrId("txt_occ_dialog_settings_received_for_multiple_wlan")); - mRadio = qobject_cast (loader.findWidget("radioButtonList")); - Q_ASSERT_X(mRadio != 0, "WPS Wizard", "List not found"); + mRadio = qobject_cast (mLoader->findWidget( + "radioButtonList")); + Q_ASSERT(mRadio); QList arr = mWizard->getSettingsArray(); QStringList ssidList; - for (int count = 0; count < arr.count(); count++) { + for (int count = 0; count < arr.count(); count++) + { TWlanProtectedSetupCredentialAttribute attr = arr[count]; - //file.Write(attr.iSsid); - //Append (attr.iSsid) to a list and send to UI Engine. - QString ssid = QString::fromUtf8((const char*) attr.iSsid.Ptr(), attr.iSsid.Length()); + QString ssid = QString::fromUtf8((const char*) attr.iSsid.Ptr(), + attr.iSsid.Length()); ssidList.append(ssid); - } - + } mRadio->setItems(ssidList); - connect(mRadio, SIGNAL(itemSelected(int)), this, SLOT(itemSelected(int))); + bool connectOk = connect( + mRadio, + SIGNAL(itemSelected(int)), + this, + SLOT(itemSelected(int))); + Q_ASSERT(connectOk); + + connectOk = connect( + mWizard->mainWindow(), + SIGNAL(orientationChanged(Qt::Orientation)), + this, + SLOT(loadDocmlSection(Qt::Orientation))); + + Q_ASSERT(connectOk); } - OstTraceFunctionExit1(WPSPAGESTEPFIVE_INITIALIZEPAGE_EXIT, this) + + OstTraceFunctionExit1(WPSPAGESTEPFIVE_INITIALIZEPAGE_EXIT, this); return mWidget; } /*! - * Callback when the previous button is clicked + Determines the Number of steps to move backwards when 'Prev' Button + is clicked + + @return int Number of pages to move backwards */ -void WpsPageStepFive::previousTriggered() +int WpsPageStepFive::previousTriggered() { -OstTraceFunctionEntry1(WPSPAGESTEPFIVE_PREVIOUSTRIGGERED_ENTRY, this) -OstTraceFunctionExit1(WPSPAGESTEPFIVE_PREVIOUSTRIGGERED_EXIT, this) - + OstTraceFunctionEntry1(WPSPAGESTEPFIVE_PREVIOUSTRIGGERED_ENTRY, this); + OstTraceFunctionExit1(WPSPAGESTEPFIVE_PREVIOUSTRIGGERED_EXIT, this); + + return (PageWpsWizardStep5 - PageWpsWizardStep2) - 1; } /*! - * CallBack when the cancel button is clicked + CallBack when the cancel button is clicked */ void WpsPageStepFive::cancelTriggered() { -OstTraceFunctionEntry1(WPSPAGESTEPFIVE_CANCELTRIGGERED_ENTRY, this) -OstTraceFunctionExit1(WPSPAGESTEPFIVE_CANCELTRIGGERED_EXIT, this) + OstTraceFunctionEntry1(WPSPAGESTEPFIVE_CANCELTRIGGERED_ENTRY, this); + OstTraceFunctionExit1(WPSPAGESTEPFIVE_CANCELTRIGGERED_EXIT, this); +} -} /*! - * Funtion to determine the next page to be displayed in the wizard process - * - * \param bool& RemoveFromStack indicating whether the current page should be - * removed from the stack - * - * \return int Page Id of the next page to be displayed. + Funtion to determine the next page to be displayed in the wizard process + + @param [out] removeFromStack bool RemoveFromStack indicating whether the current + page should be removed from the stack + + @return int Page Id of the next page to be displayed. */ int WpsPageStepFive::nextId(bool &removeFromStack) const { - OstTraceFunctionEntry1(WPSPAGESTEPFIVE_NEXTID_ENTRY, this) - - int id = WlanWizardPage::PageProcessSettings; + OstTraceFunctionEntry1(WPSPAGESTEPFIVE_NEXTID_ENTRY, this); removeFromStack = false; - OstTraceFunctionExit1(WPSPAGESTEPFIVE_NEXTID_EXIT, this) - return id; + OstTraceFunctionExit1(WPSPAGESTEPFIVE_NEXTID_EXIT, this); + return WlanWizardPage::PageProcessSettings; } /*! - * Determines the Number of steps to move backwards when 'Prev' Button - * is clicked - * - * \return int Number of pages to move backwards + Determines whether the Next action button should be enabled or not + + @return bool Indicating whether next button is enabled or not. */ -int WpsPageStepFive::stepsBackwards() +bool WpsPageStepFive::showPage() { - OstTraceFunctionEntry1(WPSPAGESTEPFIVE_STEPSBACKWARDS_ENTRY, this) - OstTraceFunctionExit1(WPSPAGESTEPFIVE_STEPBACKWARDS_EXIT, this) - - return (PageWpsWizardStep5 - PageWpsWizardStep2) - 1; -} - -/*! - * Validates the content of the pages - * - * \return bool Indicating the result of the operation - */ -bool WpsPageStepFive::validate() const -{ - OstTraceFunctionEntry1(WPSPAGESTEPFIVE_VALIDATE_ENTRY, this) - OstTraceFunctionExit1(WPSPAGESTEPFIVE_VALIDATE_EXIT, this) - return mValid; } + /*! - * Call back when an item is selected from the list on the UI - * - * \param int index Indcating the relative position in the list + Call back when an item is selected from the list on the UI + + @param [in] index Indicating the relative position in the list */ void WpsPageStepFive::itemSelected(int index) { - OstTraceFunctionEntry1(WPSPAGESTEPFIVE_ITEMSELECTED_ENTRY, this) - + OstTraceFunctionEntry1(WPSPAGESTEPFIVE_ITEMSELECTED_ENTRY, this); mValid = true; mWizard->storeSettings(index); mWizard->enableNextButton(mValid); - - OstTraceFunctionExit1(WPSPAGESTEPFIVE_ITEMSELECTED_EXIT, this) + OstTraceFunctionExit1(WPSPAGESTEPFIVE_ITEMSELECTED_EXIT, this); } + +/*! + Loads docml at initialization phase and when HbMainWindow sends orientation() + signal. + + @param [in] orientation orientation to be loaded. + */ +void WpsPageStepFive::loadDocmlSection(Qt::Orientation orientation) +{ + bool ok = false; + + // Load the orientation specific section + if (orientation == Qt::Horizontal) { + mLoader->load(":/docml/occ_wps_01_05.docml", "landscape", &ok); + Q_ASSERT(ok); + } + else { + Q_ASSERT(orientation == Qt::Vertical); + mLoader->load(":/docml/occ_wps_01_05.docml", "portrait", &ok); + Q_ASSERT(ok); + } +} + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/src/wpswizardstepfour.cpp --- a/wlanutilities/wpswizard/src/wpswizardstepfour.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/src/wpswizardstepfour.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -2,7 +2,7 @@ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" + * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * @@ -16,229 +16,315 @@ * */ -/* - * %version: 1 % - */ - // System includes -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // User includes #include "wpswizardstepfour.h" +#include "wpswizardstepfour_p.h" #include "wpswizard_p.h" // Trace includes + + #include "OstTraceDefinitions.h" #ifdef OST_TRACE_COMPILER_IN_USE -#include "wpspagestepfourTraces.h" +#include "wpswizardstepfourTraces.h" #endif +// External function prototypes + +// Local constants + + /*! - * Constructor for WPS page four - * - * \param WpsWizardPrivate* Pointer to the WPS wizard private implementation + \class WpsPageStepFour + \brief Implementation of wps wizard page for step four. + */ + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +/*! + Constructor for WPS page four + + @param [in] parent Pointer to the WPS wizard private implementation */ WpsPageStepFour::WpsPageStepFour(WpsWizardPrivate* parent) : - WpsWizardPage(parent), mWidget(NULL), mRadio(NULL), mValid(false) + WpsWizardPage(parent), + mWidget(NULL), + mWpsErrorCode(0), + mCountCredentials(0), + mLoader(NULL), + d_ptr(NULL) { -OstTraceFunctionEntry1(WPSPAGESTEPFOUR_WPSPAGESTEPFOUR_ENTRY, this) -OstTraceFunctionExit1(WPSPAGESTEPFOUR_WPSPAGESTEPFOUR_EXIT, this) - + OstTraceFunctionEntry1(WPSPAGESTEPFOUR_WPSPAGESTEPFOUR_ENTRY, this); + d_ptr.reset(new WpsPageStepFourPrivate(this)); + OstTraceFunctionExit1(WPSPAGESTEPFOUR_WPSPAGESTEPFOUR_EXIT, this); } /*! - * Destructor + Destructor */ WpsPageStepFour::~WpsPageStepFour() { - OstTraceFunctionEntry1(WPSPAGESTEPFOUR_WPSPAGESTEPFOUR_ENTRY, this) - - delete mWidget; - delete mWpsActiveRunner; - -OstTraceFunctionExit1(WPSPAGESTEPFOUR_WPSPAGESTEPFOUR_EXIT, this) + OstTraceFunctionEntry1(WPSPAGESTEPFOUR_WPSPAGESTEPFOUR_DESTRUCTOR_ENTRY, this); + delete mLoader; + OstTraceFunctionExit1(WPSPAGESTEPFOUR_WPSPAGESTEPFOUR_DESTRUCTOR_EXIT, this); } /*! - * Loads the page with all the widgets - * - * \return HbWidget* Returns the view widget + Loads the page with all the widgets + + @return HbWidget* Returns the view widget */ HbWidget* WpsPageStepFour::initializePage() { - OstTraceFunctionEntry1(WPSPAGESTEPFOUR_INITIALIZEPAGE_ENTRY, this) + OstTraceFunctionEntry1(WPSPAGESTEPFOUR_INITIALIZEPAGE_ENTRY, this); - if (!mWidget) { + if (!mWidget) { bool ok; - HbDocumentLoader loader; - loader.load(":/docml/occ_wps_P4.docml", &ok); - Q_ASSERT_X(ok, "WPS Wizard", "Invalid docml file"); - - mWidget = qobject_cast (loader.findWidget("occ_wps_P4")); - Q_ASSERT_X(mWidget != 0, "WPS Wizard", "View not found"); - //mTitle = qobject_cast (loader.findWidget("label_title")); - //Q_ASSERT_X(mTitle != 0, "WPS wizard", "title not found"); - - mHeading = qobject_cast (loader.findWidget("label_heading")); - Q_ASSERT_X(mTitle != 0, "WPS wizard", "Header not found"); + mLoader = new HbDocumentLoader(mWizard->mainWindow()); + + mLoader->load(":/docml/occ_wps_P4.docml", &ok); + Q_ASSERT(ok); + + // Initialize orientation + loadDocmlSection(mWizard->mainWindow()->orientation()); - mProgressBar = qobject_cast (loader.findWidget("horizontalProgressBar")); - Q_ASSERT_X(mRadio != 0, "WPS Wizard", "List not found"); + mWidget = qobject_cast (mLoader->findWidget("occ_wps_P4")); + Q_ASSERT(mWidget); - // start the framework. - mWpsActiveRunner = CWpsActiveRunner::NewL(*this); - Q_ASSERT(error == NULL); + bool connectOk = connect( + mWizard->mainWindow(), + SIGNAL(orientationChanged(Qt::Orientation)), + this, + SLOT(loadDocmlSection(Qt::Orientation))); + Q_ASSERT(connectOk); } - mProgressBar->setRange(0, 0); - - StartWpsRunner(); - OstTraceFunctionExit1(WPSPAGESTEPFOUR_INITIALIZEPAGE_EXIT, this) + OstTraceFunctionExit1(WPSPAGESTEPFOUR_INITIALIZEPAGE_EXIT, this); return mWidget; } /*! - * Funtion to determine the next page to be displayed in the wizard process - * - * \param bool& RemoveFromStack indicating whether the current page should be - * removed from the stack - * - * \return int Page Id of the next page to be displayed. + In case the wizard page needs timer protection to the page use this + method to start control operation of the page. This method will be called + after requiresStartOperation() if true is returned with different call + stack. + + See requiresStartOperation(), WlanWizardHelper::nextPage(). + */ + +void WpsPageStepFour::startOperation() +{ + startWpsRunner(); +} + +/*! + Funtion to determine the next page to be displayed in the wizard process + + @param [out] removeFromStack bool variable indicating whether the current + page should be removed from the stack + + @return int Page Id of the next page to be displayed. */ int WpsPageStepFour::nextId(bool &removeFromStack) const { - OstTraceFunctionEntry1(WPSPAGESTEPFOUR_NEXTID_ENTRY, this) + OstTraceFunctionEntry1(WPSPAGESTEPFOUR_NEXTID_ENTRY, this); int id = WpsWizardPage::PageNone; removeFromStack = false; - if (countCredentials >= 2) { + + // Error has occured go to error page + if(mWpsErrorCode != 0) { + return WlanWizardPage::PageGenericError; + } + + if(mCountCredentials == 0) { + id = WlanWizardPage::PageProcessSettings; + } else if (mCountCredentials >= 2) { id = WpsWizardPage::PageWpsWizardStep5; - } - else { + } else { // only one response received. So go to the summary page mWizard->storeSettings(0); id = WlanWizardPage::PageProcessSettings; - } - OstTraceFunctionExit1(WPSPAGESTEPFOUR_NEXTID_EXIT, this) - + } + + OstTraceFunctionExit1(WPSPAGESTEPFOUR_NEXTID_EXIT, this); return id; } +/*! + If the wizard page requires timer protection and asyncronous time + lasting operation, protect parameters should return true. This is used + in pages e.g. where progressbar is shown. The whole point is to + initialize the UI before starting the operation, so that the progress bar + is painted before the operation takes place. + + In practise this means that if true is returned in protect. + - WlanWizardPage::startOperation() is called to start the page operation. + - 1.5sec timer is used to protect the page + - wizardPage MUST call WlanWizardHelper::nextPage() to trigger entry to + next wizard page. + + @return true if protection is need. see description of the method. + */ + +bool WpsPageStepFour::requiresStartOperation() +{ + return true; +} /*! - * Determines the Number of steps to move backwards when 'Prev' Button - * is clicked - * - * \return int Number of pages to move backwards + Determines the Number of steps to move backwards when 'Prev' Button + is clicked + + @return int Number of pages to move backwards */ -int WpsPageStepFour::stepsBackwards() +int WpsPageStepFour::previousTriggered() { - OstTraceFunctionEntry1(WPSPAGESTEPFOUR_STEPSBACKWARDS_ENTRY, this) - OstTraceFunctionExit1(WPSPAGESTEPFOUR_STEPBACKWARDS_EXIT, this) - + OstTraceFunctionEntry1(WPSPAGESTEPFOUR_PREVIOUSTRIGGERED_ENTRY, this); + d_ptr->Cancel(); + OstTraceFunctionExit1(WPSPAGESTEPFOUR_PREVIOUSTRIGGERED_EXIT, this); return (PageWpsWizardStep4 - PageWpsWizardStep2) - 1; } /*! - * Callback when the previous button is clicked + Determines whether the Next action button should be enabled or not + + @return bool Indicating whether next button is enabled or not. */ -void WpsPageStepFour::previousTriggered() +bool WpsPageStepFour::showPage() { - OstTraceFunctionEntry1(WPSPAGESTEPFOUR_PREVIOUSTRIGGERED_ENTRY, this) - - mWpsActiveRunner->DoCancel(); -OstTraceFunctionExit1(WPSPAGESTEPFOUR_PREVIOUSTRIGGERED_EXIT, this) - + mWpsErrorCode = 0; + + return false; } /*! - * CallBack when the cancel button is clicked -*/ -void WpsPageStepFour::cancelTriggered() + Handles the error case. Based on the error code decides + whether to retry or stop the wizard + + @param [in] aErrorCode integer variable indicating the error codes + */ +void WpsPageStepFour::handleError(int aErrorCode) { - OstTraceFunctionEntry1(WPSPAGESTEPFOUR_CANCELTRIGGERED_ENTRY, this) + OstTraceFunctionEntry1(WPSPAGESTEPFOUR_HANDLEERROR_ENTRY, this); + QString str; + OstTrace1( TRACE_ERROR, WPSPAGESTEPFOUR_HANDLEERROR, "WpsPageStepFour::handleError;aErrorCode=%d", aErrorCode ); + mWpsErrorCode = aErrorCode; + switch (aErrorCode) { + case KErrWlanProtectedSetupOOBInterfaceReadError: + case KErrWlanProtectedSetupDecryptionCRCFailure: + case KErrWlanProtectedSetup2_4ChannelNotSupported: + case KErrWlanProtectedSetup5_0ChannelNotSupported: + case KErrWlanProtectedSetupNetworkAuthFailure: + case KErrWlanProtectedSetupNoDHCPResponse: + case KErrWlanProtectedSetupFailedDHCPConfig: + case KErrWlanProtectedSetupIPAddressConflict: + case KErrWlanProtectedSetupCouldNotConnectToRegistrar: + case KErrWlanProtectedSetupMultiplePBCSessionsDetected: + case KErrWlanProtectedSetupRogueActivitySuspected: + case KErrWlanProtectedSetupDeviceBusy: + case KErrWlanProtectedSetupSetupLocked: + case KErrWlanProtectedSetupMessageTimeout: + case KErrWlanProtectedSetupRegistrationSessionTimeout: + str = QString(hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); + break; - mWpsActiveRunner->DoCancel(); -OstTraceFunctionExit1(WPSPAGESTEPFOUR_CANCELTRIGGERED_EXIT, this) + case KErrWlanProtectedSetupDevicePasswordAuthFailure: + case KErrWlanProtectedSetupPINMethodNotSupported: + case KErrWlanProtectedSetupPBMethodNotSupported: + default: + str = QString(hbTrId("txt_occ_dialog_configuration_failed_authenticatio")); + break; + } + + mValid = false; + mWizard->setConfiguration(WlanWizardHelper::ConfGenericErrorString, str); + mWizard->setConfiguration( + WlanWizardHelper::ConfGenericErrorPageStepsBackwards, + (PageWpsWizardStep4 - PageWpsWizardStep2)); + mWizard->nextPage(); + + OstTraceFunctionExit1(WPSPAGESTEPFOUR_HANDLEERROR_EXIT, this) ; } /*! - * Validates the content of the pages - * - * \return bool Indicating the result of the operation + Provides the functionality to initiate the WPS functionality */ -bool WpsPageStepFour::validate() const +void WpsPageStepFour::startWpsRunner() { - OstTraceFunctionEntry1(WPSPAGESTEPFOUR_VALIDATE_ENTRY, this) - OstTraceFunctionExit1(WPSPAGESTEPFOUR_VALIDATE_EXIT, this) - - return mValid; + OstTraceFunctionEntry1(WPSPAGESTEPFOUR_STARTWPSRUNNER_ENTRY, this); + mValid = false; + d_ptr->StartSetup(mWizard->getSsid(), mWizard->getPin()); + OstTraceFunctionExit1(WPSPAGESTEPFOUR_STARTWPSRUNNER_EXIT, this); } +/*! + Stores the credentials set by the user, through the WPs Wizard + + @param [in] credentials List of Credentials entered by user. + + @param credentialscount Number Of Credentials in the list + */ +void WpsPageStepFour::setCredentials( + QList& credentials, + int credentialscount) +{ + OstTraceFunctionEntry1( WPSPAGESTEPFOUR_SETCREDENTIALS_ENTRY, this ); + + mCountCredentials = credentialscount; + mWizard->storeSettingsArray(credentials); + mWizard->nextPage(); + // enable the next button + + OstTraceFunctionExit1( WPSPAGESTEPFOUR_SETCREDENTIALS_EXIT, this ); +} /*! - * CallBack function when the middleware WPS call returns back - * - * \param QList An array of received settngs - * \param int Error indicating the result of the operation - * + CallBack when the cancel button is clicked */ -void WpsPageStepFour::WpsActiveRunnerStopped( - QList& aCredentials, TInt aError) +void WpsPageStepFour::cancelTriggered() { - OstTraceFunctionEntry1(WPSPAGESTEPFOUR_WPSACTIVERUNNERSTOPPED_ENTRY, this) - - mWpsErrorCode = aError; - if (aError == KErrNone) { - countCredentials = aCredentials.count(); - mWizard->storeSettingsArray(aCredentials); - mWizard->nextPage(); - } - else if (aError == KErrCancel) { - // operation was cancelled - - } - else { - QString str; - str = QString("Error: %1").arg(aError); - mProgressBar->setVisible(false); - //mHeading->setPlainText("General Error"); - mHeading->setPlainText(str); - mWizard->enableNextButton(false); - - } -OstTraceFunctionExit1(WPSPAGESTEPFOUR_WPSACTIVERUNNERSTOPPED_EXIT, this) + OstTraceFunctionEntry1( WPSPAGESTEPFOUR_CANCELTRIGGERED_ENTRY, this ); + d_ptr->Cancel(); + OstTraceFunctionExit1( WPSPAGESTEPFOUR_CANCELTRIGGERED_EXIT, this ); } - /*! - * Provides the functionality to initiate the WPS functionality + Loads docml at initialization phase and when HbMainWindow sends + orientation() signal. + + @param orientation[in] orientation to be loaded. */ -void WpsPageStepFour::StartWpsRunner() +void WpsPageStepFour::loadDocmlSection(Qt::Orientation orientation) { - - OstTraceFunctionEntry1(WPSPAGESTEPFOUR_STARTWPSRUNNER_ENTRY, this) - - // convert QString to symbian RBuf8 + bool ok = false; + + // Load the orientation specific section + if (orientation == Qt::Horizontal) { + mLoader->load(":/docml/occ_wps_P4.docml", "landscape", &ok); + Q_ASSERT(ok); + } + else { + Q_ASSERT(orientation == Qt::Vertical); + mLoader->load(":/docml/occ_wps_P4.docml", "portrait", &ok); + Q_ASSERT(ok); + } +} - QString ssid = mWizard->getSsid(); - - TPtrC ptrName(reinterpret_cast (ssid.constData())); - - RBuf8 ssidName; - ssidName.Create(ptrName.Length()); - ssidName.Copy(ptrName); - - mWpsActiveRunner->StartSetup(ssidName, mWizard->getPin()); - ssidName.Close(); -OstTraceFunctionExit1(WPSPAGESTEPFOUR_STARTWPSRUNNER_EXIT, this) -} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/src/wpswizardstepfour_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/src/wpswizardstepfour_p.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WPS Wizard Page: Step 4 progress bar display + * + */ + +//System Includes + +//User Includes +#include "wpswizard.h" +#include "wpswizardstepfour_p.h" +#include "cwpsactiverunner.h" + +// Trace includes + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wpswizardstepfour_pTraces.h" +#endif + +// External function prototypes + +// Local constants + + +/*! + \class WpsPageStepFourPrivate + \brief Private implementation of wps wizard page for step four. + */ +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor for WPS page four + + @param [in] WpsPageStepFour* Pointer to the public/Ui class + */ + +WpsPageStepFourPrivate::WpsPageStepFourPrivate(WpsPageStepFour* pageStepFour) : + mWpsActiveRunner(NULL), + q_ptr(pageStepFour) +{ + OstTraceFunctionEntry1( WPSPAGESTEPFOURPRIVATE_WPSPAGESTEPFOURPRIVATE_ENTRY, this ); + // start the framework. + CWpsActiveRunner* runner = NULL; + QT_TRAP_THROWING(runner = CWpsActiveRunner::NewL(*this)); + mWpsActiveRunner.reset(runner); + + OstTraceFunctionExit1( WPSPAGESTEPFOURPRIVATE_WPSPAGESTEPFOURPRIVATE_EXIT, this ); +} + +/*! + Destructor + */ +WpsPageStepFourPrivate::~WpsPageStepFourPrivate() +{ + OstTraceFunctionEntry1( DUP1_WPSPAGESTEPFOURPRIVATE_WPSPAGESTEPFOURPRIVATE_ENTRY, this ); + OstTraceFunctionExit1( DUP1_WPSPAGESTEPFOURPRIVATE_WPSPAGESTEPFOURPRIVATE_EXIT, this ); +} + +/*! + This method will initiate the WPS setup functionality. + + @param [in] ssid name of the network which supports wps + @param [in] pin pin number to be used for WPS negotiating. + */ +void WpsPageStepFourPrivate::StartSetup(QString ssid, int pin) +{ + OstTraceFunctionEntry1( WPSPAGESTEPFOURPRIVATE_STARTSETUP_ENTRY, this ); + TPtrC ptrName(reinterpret_cast (ssid.constData())); + + RBuf8 ssidName; + ssidName.Create(ptrName.Length()); + ssidName.Copy(ptrName); + + mWpsActiveRunner->StartSetup(ssidName, pin); + ssidName.Close(); + OstTraceFunctionExit1( WPSPAGESTEPFOURPRIVATE_STARTSETUP_EXIT, this ); +} + +/*! + CallBack informing the completion of the WPS setup. + + @param [in] aCredentials An array of credentials from the remote AP + @param [in] aError integer variable indicating result of the operation + */ +void WpsPageStepFourPrivate::WpsActiveRunnerStopped( + QList& aCredentials, + TInt aError) +{ + OstTraceFunctionEntry1( WPSPAGESTEPFOURPRIVATE_WPSACTIVERUNNERSTOPPED_ENTRY, this ); + + // mWpsErrorCode = aError; + if (aError == KErrNone) { + q_ptr->setCredentials(aCredentials, aCredentials.count()); + } + else if (aError == KErrCancel) { + // operation was cancelled + + } + else { + OstTrace1( + TRACE_ERROR, + WPSPAGESTEPFOURPRIVATE_WPSACTIVERUNNERSTOPPED_ERROR, + "WpsPageStepFourPrivate::WpsActiveRunnerStopped;Error=%d", + aError ); + + q_ptr->handleError(aError); + } + OstTraceFunctionExit1( WPSPAGESTEPFOURPRIVATE_WPSACTIVERUNNERSTOPPED_EXIT, this ); +} + +/*! + To cancel the ongoing WPS setup implementation. + */ +void WpsPageStepFourPrivate::Cancel() +{ + OstTraceFunctionEntry1( WPSPAGESTEPFOURPRIVATE_CANCEL_ENTRY, this ); + mWpsActiveRunner->DoCancel(); + OstTraceFunctionExit1( WPSPAGESTEPFOURPRIVATE_CANCEL_EXIT, this ); +} + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/src/wpswizardstepthreebutton.cpp --- a/wlanutilities/wpswizard/src/wpswizardstepthreebutton.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/src/wpswizardstepthreebutton.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -2,7 +2,7 @@ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" + * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * @@ -17,11 +17,12 @@ */ // System includes -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include // User includes #include "wpswizardstepthreebutton.h" @@ -30,129 +31,135 @@ // Trace includes #include "OstTraceDefinitions.h" #ifdef OST_TRACE_COMPILER_IN_USE -#include "wpspagestepthreebuttonTraces.h" +#include "wpswizardstepthreebuttonTraces.h" #endif +// External function prototypes + +// Local constants /*! - * Constructor for WPS page three button - * - * \param WpsWizardPrivate* Pointer to the WPS wizard private implementation + \class WpsPageStepThreeButton + \brief Implementation of wps wizard page for step three button press mode. + */ + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor for WPS page three button + + @param [in] parent Pointer to the WPS wizard private implementation */ WpsPageStepThreeButton::WpsPageStepThreeButton(WpsWizardPrivate* parent) : - WpsWizardPage(parent), mWidget(NULL), mRadio(NULL), mValid(true) + WpsWizardPage(parent), + mWidget(NULL), + mHeading(NULL), + mLoader(NULL) { -OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_WPSPAGESTEPTHREEBUTTON_ENTRY, this) -OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_WPSPAGESTEPTHREEBUTTON_EXIT, this) + OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_WPSPAGESTEPTHREEBUTTON_ENTRY, this); + OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_WPSPAGESTEPTHREEBUTTON_EXIT, this); } /*! - * Destructor + Destructor */ WpsPageStepThreeButton::~WpsPageStepThreeButton() { - OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_WPSPAGESTEPTHREEBUTTON_ENTRY, this) - - delete mWidget; - -OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_WPSPAGESTEPTHREEBUTTON_EXIT, this) + OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_WPSPAGESTEPTHREEBUTTON_DESTRUCTOR_ENTRY, this); + delete mLoader; + OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_WPSPAGESTEPTHREEBUTTON_DESTRUCTOR_EXIT, this); } /*! - * Loads the page with all the widgets - * - * \return HbWidget* Returns the view widget + Loads the page with all the widgets + + @return HbWidget* Returns the view widget */ HbWidget* WpsPageStepThreeButton::initializePage() { - OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_INITIALIZEPAGE_ENTRY, this) + OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_INITIALIZEPAGE_ENTRY, this); if (!mWidget) { bool ok; - HbDocumentLoader loader; - loader.load(":/docml/occ_wps_P2.docml", &ok); - Q_ASSERT_X(ok, "WPS Wizard", "Invalid docml file"); + mLoader = new HbDocumentLoader(mWizard->mainWindow()); + + mLoader->load(":/docml/occ_wps_02_03.docml", &ok); + Q_ASSERT(ok); + + // Initialize orientation + loadDocmlSection(mWizard->mainWindow()->orientation()); - mWidget = qobject_cast (loader.findWidget("occ_wps_P2")); - Q_ASSERT_X(mWidget != 0, "WPS Wizard", "View not found"); + mWidget = qobject_cast (mLoader->findWidget("occ_wps_P2")); + Q_ASSERT(mWidget); - //mTitle = qobject_cast (loader.findWidget("label_title")); - //Q_ASSERT_X(mTitle != 0, "WPS wizard", "title not found"); - - mHeading = qobject_cast (loader.findWidget("label_heading")); - Q_ASSERT_X(mHeading != 0, "WPS wizard", "Header not found"); - - mWizard->enableNextButton(true); - } - OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_INITIALIZEPAGE_EXIT, this) - + mHeading = qobject_cast (mLoader->findWidget("label_heading")); + Q_ASSERT(mHeading); + + mHeading->setPlainText(hbTrId("txt_occ_dialog_first_press_button_on_the_wireless")); + + bool connectOk = connect( + mWizard->mainWindow(), + SIGNAL(orientationChanged(Qt::Orientation)), + this, + SLOT(loadDocmlSection(Qt::Orientation))); + Q_ASSERT(connectOk); + } + + OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_INITIALIZEPAGE_EXIT, this); return mWidget; } /*! - * Funtion to determine the next page to be displayed in the wizard process - * - * \param bool& RemoveFromStack indicating whether the current page should be - * removed from the stack - * - * \return int Page Id of the next page to be displayed. + Funtion to determine the next page to be displayed in the wizard process + + @param [out] removeFromStack bool indicating whether the current page should be + removed from the stack + + @return int Page Id of the next page to be displayed. */ int WpsPageStepThreeButton::nextId(bool &removeFromStack) const { - OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_NEXTID_ENTRY, this) - int id = WlanWizardPage::PageNone; + OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_NEXTID_ENTRY, this); removeFromStack = false; - id = WpsWizardPage::PageWpsWizardStep4; - OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_NEXTID_EXIT, this) + OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_NEXTID_EXIT, this); - return id; + return WpsWizardPage::PageWpsWizardStep4; } /*! - * Determines the Number of steps to move backwards when 'Prev' Button - * is clicked - * - * \return int Number of pages to move backwards -*/ -int WpsPageStepThreeButton::stepsBackwards() + Determines the Number of steps to move backwards when 'Prev' Button + is clicked + + @return int Number of pages to move backwards + */ +int WpsPageStepThreeButton::previousTriggered() { - OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_STEPSBACKWARDS_ENTRY, this) - OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_STEPBACKWARDS_EXIT, this) - + OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_PREVIOUSTRIGGERED_ENTRY, this); + OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_PREVIOUSTRIGGERED_EXIT, this); return (PageWpsWizardStep3_Button - PageWpsWizardStep2); } /*! - * Callback when the previous button is clicked + Loads docml at initialization phase and when HbMainWindow sends + orientation() signal. + + @param [in] orientation orientation to be loaded. */ -void WpsPageStepThreeButton::previousTriggered() +void WpsPageStepThreeButton::loadDocmlSection(Qt::Orientation orientation) { -OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_PREVIOUSTRIGGERED_ENTRY, this) -OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_PREVIOUSTRIGGERED_EXIT, this) - + bool ok = false; + + // Load the orientation specific section + if (orientation == Qt::Horizontal) { + mLoader->load(":/docml/occ_wps_02_03.docml", "landscape", &ok); + Q_ASSERT(ok); + } else { + Q_ASSERT(orientation == Qt::Vertical); + mLoader->load(":/docml/occ_wps_02_03.docml", "portrait", &ok); + Q_ASSERT(ok); + } } -/*! - * CallBack when the cancel button is clicked - */ -void WpsPageStepThreeButton::cancelTriggered() -{ -OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_CANCELTRIGGERED_ENTRY, this) -OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_CANCELTRIGGERED_EXIT, this) - -} - -/*! - * Validates the content of the pages - * - * \return bool Indicating the result of the operation -*/ -bool WpsPageStepThreeButton::validate() const -{ - OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_VALIDATE_ENTRY, this) - OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_VALIDATE_EXIT, this) - - return mValid; -} - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/src/wpswizardstepthreenumber.cpp --- a/wlanutilities/wpswizard/src/wpswizardstepthreenumber.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/src/wpswizardstepthreenumber.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -2,7 +2,7 @@ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" + * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * @@ -17,13 +17,14 @@ */ // System includes -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include +#include // User includes #include "wpswizardstepthreenumber.h" @@ -32,182 +33,183 @@ // Trace includes #include "OstTraceDefinitions.h" #ifdef OST_TRACE_COMPILER_IN_USE -#include "wpspagestepthreenumberTraces.h" +#include "wpswizardstepthreenumberTraces.h" #endif +// External function prototypes + // Local constants -#define KMaxPINLength 8 - +const static int KMaxPINLength = 8; /*! - * Constructor for WPS page three number entry mode - * - * \param WpsWizardPrivate* Pointer to the WPS wizard private implementation + \class WpsPageStepThreeNumber + \brief Implementation of wps wizard page for step three PIN Entry mode. + */ + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor for WPS page three number entry mode + + @param [in] parent Pointer to the WPS wizard private implementation */ WpsPageStepThreeNumber::WpsPageStepThreeNumber(WpsWizardPrivate* parent) : - WpsWizardPage(parent), mWidget(NULL), mRadio(NULL), mValid(true) + WpsWizardPage(parent), + mWidget(NULL), + mHeading(NULL), + mLoader(NULL) { -OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_WPSPAGESTEPTHREENUMBER_ENTRY, this) -OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_WPSPAGESTEPTHREENUMBER_EXIT, this) + OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_WPSPAGESTEPTHREENUMBER_ENTRY, this); + OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_WPSPAGESTEPTHREENUMBER_EXIT, this); } - /*! - * Destructor + Destructor */ WpsPageStepThreeNumber::~WpsPageStepThreeNumber() { - OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_WPSPAGESTEPTHREENUMBER_ENTRY, this) - - delete mWidget; - -OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_WPSPAGESTEPTHREENUMBER_EXIT, this) - + OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_WPSPAGESTEPTHREENUMBER_DESTRUCTOR_ENTRY, this); + delete mLoader; + OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_WPSPAGESTEPTHREENUMBER_DESTRUCTOR_EXIT, this); } - /*! - * Loads the page with all the widgets - * - * \return HbWidget* Returns the view widget + Loads the page with all the widgets + + @return HbWidget* Returns the view widget */ HbWidget* WpsPageStepThreeNumber::initializePage() { - OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_INITIALIZEPAGE_ENTRY, this) + OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_INITIALIZEPAGE_ENTRY, this); if (!mWidget) { bool ok; - HbDocumentLoader loader; - loader.load(":/docml/occ_wps_P3.docml", &ok); - Q_ASSERT_X(ok, "WPS Wizard", "Invalid docml file"); + mLoader = new HbDocumentLoader(mWizard->mainWindow()); + + mLoader->load(":/docml/occ_wps_02_03.docml", &ok); + Q_ASSERT(ok); + + // Initialize orientation + loadDocmlSection(mWizard->mainWindow()->orientation()); - mWidget = qobject_cast (loader.findWidget("occ_wps_P3")); - Q_ASSERT_X(mWidget != 0, "WPS Wizard", "View not found"); + mWidget = qobject_cast (mLoader->findWidget("occ_wps_P2")); + Q_ASSERT(mWidget); - mHeading = qobject_cast (loader.findWidget("label_heading")); - Q_ASSERT_X(mHeading != 0, "WPS wizard", "Header not found"); - - int randomNumber = computeRandNumber(); - mHeading->setPlainText(hbTrId("txt_occ_dialog_enter_1_on_the_wireless_station_t").arg( - randomNumber)); - mWizard->setPin(randomNumber); - mWizard->enableNextButton(true); - } - OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_INITIALIZEPAGE_EXIT, this) + mHeading= qobject_cast (mLoader->findWidget("label_heading")); + Q_ASSERT(mHeading); + + bool connectOk = connect( + mWizard->mainWindow(), + SIGNAL(orientationChanged(Qt::Orientation)), + this, + SLOT(loadDocmlSection(Qt::Orientation))); + Q_ASSERT(connectOk); + } + + OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_INITIALIZEPAGE_EXIT, this); return mWidget; } +/*! + Funtion to determine the next page to be displayed in the wizard process + + @param [out] removeFromStack bool indicating whether the current page should be + removed from the stack + + @return int Page Id of the next page to be displayed. + */ +int WpsPageStepThreeNumber::nextId(bool &removeFromStack) const +{ + OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_NEXTID_ENTRY, this); + removeFromStack = false; + OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_NEXTID_EXIT, this); + + return WpsWizardPage::PageWpsWizardStep4; +} + +/*! + Determines the Number of steps to move backwards when 'Prev' Button + is clicked + + @return int Number of pages to move backwards + */ +int WpsPageStepThreeNumber::previousTriggered() +{ + OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_PREVIOUSTRIGGERED_ENTRY, this); + + mWizard->setPin(0); + + OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_PREVIOUSTRIGGERED_EXIT, this); + return (PageWpsWizardStep3_Number - PageWpsWizardStep2) - 1; +} + +/*! + CallBack when the cancel button is clicked + */ +void WpsPageStepThreeNumber::cancelTriggered() +{ + OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_CANCELTRIGGERED_ENTRY, this); + mWizard->setPin(0); + OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_CANCELTRIGGERED_EXIT, this); +} + /*! - * Funtion to determine the next page to be displayed in the wizard process - * - * \param bool& RemoveFromStack indicating whether the current page should be - * removed from the stack - * - * \return int Page Id of the next page to be displayed. + Determines whether the Next action button should be enabled or not + + @return bool Indicating whether next button is enabled or not. */ -int WpsPageStepThreeNumber::nextId(bool &removeFromStack) const +bool WpsPageStepThreeNumber::showPage() { - OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_NEXTID_ENTRY, this) - - int id = WlanWizardPage::PageNone; - removeFromStack = false; - id = WpsWizardPage::PageWpsWizardStep4; - OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_NEXTID_EXIT, this) - - return id; -} - -/*! - * Determines the Number of steps to move backwards when 'Prev' Button - * is clicked - * - * \return int Number of pages to move backwards -*/ -int WpsPageStepThreeNumber::stepsBackwards() -{ - OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_STEPSBACKWARDS_ENTRY, this) - OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_STEPBACKWARDS_EXIT, this) - - return (PageWpsWizardStep3_Number - PageWpsWizardStep2) - 1; + int randomNumber = computeRandNumber(); + mHeading->setPlainText(hbTrId( + "txt_occ_dialog_enter_1_on_the_wireless_station_t").arg( + randomNumber)); + mWizard->setPin(randomNumber); + return true; } /*! - * Callback when the previous button is clicked - */ -void WpsPageStepThreeNumber::previousTriggered() -{ - OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_PREVIOUSTRIGGERED_ENTRY, this) - - mWizard->setPin(0); -OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_PREVIOUSTRIGGERED_EXIT, this) - -} - -/*! - * CallBack when the cancel button is clicked -*/ -void WpsPageStepThreeNumber::cancelTriggered() -{ - OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_CANCELTRIGGERED_ENTRY, this) - - mWizard->setPin(0); -OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_CANCELTRIGGERED_EXIT, this) - -} - -/*! - * Validates the content of the pages - * - * \return bool Indicating the result of the operation -*/ -bool WpsPageStepThreeNumber::validate() const -{ - - OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_VALIDATE_ENTRY, this) - OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_VALIDATE_EXIT, this) - - return mValid; -} - -/*! - * Computes the Random number based on current system time - * - * \return int Returns the generated random number + Computes the Random number based on current system time + + @return int Returns the generated random number */ int WpsPageStepThreeNumber::computeRandNumber() { - - OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_COMPUTERANDNUMBER_ENTRY, this) + OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_COMPUTERANDNUMBER_ENTRY, this); int pin = 0; QTime time(0, 0); int seed = time.secsTo(QTime::currentTime()); + do { qsrand(seed); pin = qrand(); } while (pin < (10 ^ (KMaxPINLength - 2)) || (((pin / 1000000) % 10)) == 0); + //last digit is checksum, so we need 7 digits //and the first shouldn't be 0 pin = pin % 10000000; - TInt checkSum = computeCheckSum(pin); + int checkSum = computeCheckSum(pin); pin *= 10; pin += checkSum; - OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_COMPUTERANDNUMBER_EXIT, this) + + OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_COMPUTERANDNUMBER_EXIT, this); return pin; } /*! - * Computes the checksum for a given pin - * - * \return Returns the generated checksum + Computes the checksum for a given pin + + @return Returns the generated checksum */ int WpsPageStepThreeNumber::computeCheckSum(int aPin) { - - OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_COMPUTECHECKSUM_ENTRY, this) + OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_COMPUTECHECKSUM_ENTRY, this); int accum = 0; aPin *= 10; @@ -219,7 +221,28 @@ accum += 1 * ((aPin / 100) % 10); accum += 3 * ((aPin / 10) % 10); int digit = (accum % 10); - OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_COMPUTECHECKSUM_EXIT, this) + OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_COMPUTECHECKSUM_EXIT, this); return (10 - digit) % 10; } +/*! + Loads docml at initialization phase and when HbMainWindow sends + orientation() signal. + + @param [in] orientation orientation to be loaded. + */ +void WpsPageStepThreeNumber::loadDocmlSection(Qt::Orientation orientation) +{ + bool ok = false; + + // Load the orientation specific section + if (orientation == Qt::Horizontal) { + mLoader->load(":/docml/occ_wps_02_03.docml", "landscape", &ok); + Q_ASSERT(ok); + } else { + Q_ASSERT(orientation == Qt::Vertical); + mLoader->load(":/docml/occ_wps_02_03.docml", "portrait", &ok); + Q_ASSERT(ok); + } +} + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/src/wpswizardsteptwo.cpp --- a/wlanutilities/wpswizard/src/wpswizardsteptwo.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/src/wpswizardsteptwo.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -2,7 +2,7 @@ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" + * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * @@ -17,11 +17,11 @@ */ // System includes -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // User includes #include "wpswizardsteptwo.h" @@ -30,155 +30,198 @@ // Trace includes #include "OstTraceDefinitions.h" #ifdef OST_TRACE_COMPILER_IN_USE -#include "wpspagesteptwoTraces.h" +#include "wpswizardsteptwoTraces.h" #endif +// External function prototypes + +// Local constants /*! - * Constructor for WPS page two - * - * \param WpsWizardPrivate* Pointer to the WPS wizard private implementation + \class WpsPageStepTwo + \brief Implementation of wps wizard page for step two. + */ + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor for WPS page two + + @param [in] parent Pointer to the WPS wizard private implementation */ WpsPageStepTwo::WpsPageStepTwo(WpsWizardPrivate* parent) : - WpsWizardPage(parent), mWidget(NULL), mRadio(NULL), mValid(false) - { - OstTraceFunctionEntry1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_ENTRY, this) - OstTraceFunctionExit1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_EXIT, this) + WpsWizardPage(parent), + mWidget(NULL), + mRadio(NULL), + mHeading(NULL), + mValid(false), + mItemSelected(0), + mLoader(NULL) +{ + OstTraceFunctionEntry1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_ENTRY, this); + OstTraceFunctionExit1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_EXIT, this); - } +} /*! - * Destructor + Destructor */ WpsPageStepTwo::~WpsPageStepTwo() - { - OstTraceFunctionEntry1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_ENTRY, this) - - delete mWidget; - OstTraceFunctionExit1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_EXIT, this) - - } +{ + OstTraceFunctionEntry1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_DESTRUCTOR_ENTRY, this); + delete mLoader; + OstTraceFunctionExit1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_DESTRUCTOR_EXIT, this); +} /*! - * Loads the page with all the widgets - * - * \return HbWidget* Returns the view widget + Loads the page with all the widgets + + @return HbWidget* Returns the view widget */ HbWidget* WpsPageStepTwo::initializePage() - { - OstTraceFunctionEntry1(WPSPAGESTEPTWO_INITIALIZEPAGE_ENTRY, this) +{ + OstTraceFunctionEntry1(WPSPAGESTEPTWO_INITIALIZEPAGE_ENTRY, this); - if (!mWidget) - { + if (!mWidget) { bool ok; - HbDocumentLoader loader; - loader.load(":/docml/occ_wps_P1.docml", &ok); - Q_ASSERT_X(ok, "WPS Wizard", "Invalid docml file"); + mLoader = new HbDocumentLoader(mWizard->mainWindow()); + + mLoader->load(":/docml/occ_wps_01_05.docml", &ok); + Q_ASSERT(ok); + + // Initialize orientation + loadDocmlSection(mWizard->mainWindow()->orientation()); - mWidget = qobject_cast (loader.findWidget("occ_wps_P1")); - Q_ASSERT_X(mWidget != 0, "WPS Wizard", "View not found"); + mWidget = qobject_cast (mLoader->findWidget("occ_wps_P1")); + Q_ASSERT(mWidget); + + mHeading = qobject_cast (mLoader->findWidget("label")); + Q_ASSERT(mHeading); + mHeading->setPlainText(hbTrId("txt_occ_dialog_selected_network_supports_wifi_pro")); - mHeading - = qobject_cast (loader.findWidget("label_heading")); - Q_ASSERT_X(mTitle != 0, "WPS wizard", "Header not found"); - - mRadio = qobject_cast (loader.findWidget( - "radioButtonList")); - Q_ASSERT_X(mRadio != 0, "WPS Wizard", "List not found"); + mRadio = qobject_cast (mLoader->findWidget("radioButtonList")); + Q_ASSERT(mRadio); + + //Set Options + QStringList list; + list << hbTrId("txt_occ_list_use_pushbutton") + << hbTrId("txt_occ_list_use_pin_code") + << hbTrId("txt_occ_list_configure_manually"); + mRadio->setItems(list); - connect(mRadio, SIGNAL(itemSelected(int)), this, - SLOT(itemSelected(int))); + bool connectOk = connect( + mRadio, + SIGNAL(itemSelected(int)), + this, + SLOT(itemSelected(int))); + Q_ASSERT(connectOk); - } - OstTraceFunctionExit1(WPSPAGESTEPTWO_INITIALIZEPAGE_EXIT, this) - + connectOk = connect( + mWizard->mainWindow(), + SIGNAL(orientationChanged(Qt::Orientation)), + this, + SLOT(loadDocmlSection(Qt::Orientation))); + Q_ASSERT(connectOk); + } + + OstTraceFunctionExit1(WPSPAGESTEPTWO_INITIALIZEPAGE_EXIT, this); return mWidget; - } - +} /*! - * Funtion to determine the next page to be displayed in the wizard process - * - * \param bool& RemoveFromStack indicating whether the current page should be - * removed from the stack - * - * \return int Page Id of the next page to be displayed. + Funtion to determine the next page to be displayed in the wizard process + + @param [out] removeFromStack bool indicating whether the current page should be + removed from the stack + + @return int Page Id of the next page to be displayed. */ int WpsPageStepTwo::nextId(bool &removeFromStack) const - { - OstTraceFunctionEntry1(WPSPAGESTEPTWO_NEXTID_ENTRY, this) +{ + OstTraceFunctionEntry1(WPSPAGESTEPTWO_NEXTID_ENTRY, this); int id = WpsWizardPage::PageWpsWizardStep3_Button; removeFromStack = false; - if (mItemSelected == 0) + + if (mItemSelected == WpsPushButtonMode) { id = WpsWizardPage::PageWpsWizardStep3_Button; - else + + } else if (mItemSelected == WpsPinCodeMode) { id = WpsWizardPage::PageWpsWizardStep3_Number; - OstTraceFunctionExit1(WPSPAGESTEPTWO_NEXTID_EXIT, this) - - + + } else { + id = mWizard->nextPageId(false); + } + + OstTraceFunctionExit1(WPSPAGESTEPTWO_NEXTID_EXIT, this); return id; - } +} /*! - * Determines the Number of steps to move backwards when 'Prev' Button - * is clicked - * - * \return int Number of pages to move backwards + Determines the Number of steps to move backwards when 'Prev' Button + is clicked + + @return int Number of pages to move backwards */ -int WpsPageStepTwo::stepsBackwards() - { - OstTraceFunctionEntry1(WPSPAGESTEPTWO_STEPSBACKWARDS_ENTRY, this) - OstTraceFunctionExit1(WPSPAGESTEPTWO_STEPBACKWARDS_EXIT, this) - +int WpsPageStepTwo::previousTriggered() +{ + OstTraceFunctionEntry1(WPSPAGESTEPTWO_PREVIOUSTRIGGERED_ENTRY, this); + OstTraceFunctionExit1(WPSPAGESTEPTWO_PREVIOUSTRIGGERED_EXIT, this); return 1; - } +} /*! - * Callback when the previous button is clicked -*/ -void WpsPageStepTwo::previousTriggered() - { - OstTraceFunctionEntry1(WPSPAGESTEPTWO_PREVIOUSTRIGGERED_ENTRY, this) - OstTraceFunctionExit1(WPSPAGESTEPTWO_PREVIOUSTRIGGERED_EXIT, this) - - } + CallBack when the cancel button is clicked + */ +void WpsPageStepTwo::cancelTriggered() +{ + OstTraceFunctionEntry1(WPSPAGESTEPTWO_CANCELTRIGGERED_ENTRY, this); + OstTraceFunctionExit1(WPSPAGESTEPTWO_CANCELTRIGGERED_EXIT, this); +} /*! - * CallBack when the cancel button is clicked + Determines whether the Next action button should be enabled or not + + @return bool Indicating whether next button is enabled or not. */ -void WpsPageStepTwo::cancelTriggered() - { - OstTraceFunctionEntry1(WPSPAGESTEPTWO_CANCELTRIGGERED_ENTRY, this) - OstTraceFunctionExit1(WPSPAGESTEPTWO_CANCELTRIGGERED_EXIT, this) - - } +bool WpsPageStepTwo::showPage() +{ + return mValid; +} /*! - * Validates the content of the pages - * - * \return bool Indicating the result of the operation + Call back when an item is selected from the list on the UI + + @param [in] index Indcating the relative position in the list */ -bool WpsPageStepTwo::validate() const - { - OstTraceFunctionEntry1(WPSPAGESTEPTWO_VALIDATE_ENTRY, this) - OstTraceFunctionExit1(WPSPAGESTEPTWO_VALIDATE_EXIT, this) - - return mValid; - } +void WpsPageStepTwo::itemSelected(int index) +{ + OstTraceFunctionEntry1(WPSPAGESTEPTWO_ITEMSELECTED_ENTRY, this); + mValid = true; + mWizard->enableNextButton(mValid); + mItemSelected = index; + OstTraceFunctionExit1(WPSPAGESTEPTWO_ITEMSELECTED_EXIT, this); +} /*! - * Call back when an item is selected from the list on the UI - * - * \param int index Indcating the relative position in the list + Loads docml at initialization phase and when HbMainWindow sends + orientation() signal. + + @param [in] orientation orientation to be loaded. */ -void WpsPageStepTwo::itemSelected(int index) - { - OstTraceFunctionEntry1(WPSPAGESTEPTWO_ITEMSELECTED_ENTRY, this) +void WpsPageStepTwo::loadDocmlSection(Qt::Orientation orientation) +{ + bool ok = false; + + // Load the orientation specific section + if (orientation == Qt::Horizontal) { + mLoader->load(":/docml/occ_wps_01_05.docml", "landscape", &ok); + Q_ASSERT(ok); + } else { + Q_ASSERT(orientation == Qt::Vertical); + mLoader->load(":/docml/occ_wps_01_05.docml", "portrait", &ok); + Q_ASSERT(ok); + } +} - mValid = true; - mWizard->enableNextButton(mValid); - mItemSelected = index; - OstTraceFunctionExit1(WPSPAGESTEPTWO_ITEMSELECTED_EXIT, this) - - } - diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/stubs/stub_wlanmgmtclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/stubs/stub_wlanmgmtclient.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Management API stubbing for WPS Wizard use in emulator. +*/ + +#include +#include +#include "wlanmgmtclient.h" + +// --------------------------------------------------------- +// CWlanScanRequest::NewL +// --------------------------------------------------------- +// +CWlanMgmtClient* CWlanMgmtClient::NewL() + { + CWlanMgmtClient* self = new CWlanMgmtClient; + return self; + } + +// --------------------------------------------------------- +// CWlanScanRequest::~CWlanMgmtClient +// --------------------------------------------------------- +// +CWlanMgmtClient::~CWlanMgmtClient() + { + } + +// --------------------------------------------------------- +// CWlanScanRequest::CWlanMgmtClient +// --------------------------------------------------------- +// +CWlanMgmtClient::CWlanMgmtClient() + { + } + +// --------------------------------------------------------- +// CWlanScanRequest::RunProtectedSetup +// --------------------------------------------------------- +// +void CWlanMgmtClient::RunProtectedSetup( + TRequestStatus& aStatus, + const TWlanSsid& aSsid, + const TWlanWpsPin& /* aWpsPin */, + CArrayFixSeg& aCredentials ) +{ + // Complete the request immediately + TRequestStatus *status = &aStatus; + TInt err = KErrNone; + TWlanProtectedSetupCredentialAttribute attr; + + attr.iSsid.Copy(aSsid); + attr.iSecurityMode = EWlanIapSecurityModeAllowUnsecure; + attr.iAuthenticationMode = EWlanAuthenticationModeOpen; + attr.iOperatingMode = EWlanOperatingModeInfrastructure; + attr.iWepDefaultKey = EWlanDefaultWepKey1; + + TRAP(err, aCredentials.AppendL(attr) ); + User::RequestComplete(status, err); +} + +// --------------------------------------------------------- +// CWlanScanRequest::CancelProtectedSetup +// --------------------------------------------------------- +// +void CWlanMgmtClient::CancelProtectedSetup() + { + } + diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/stubs/stubs.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/stubs/stubs.pri Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,26 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# Stubs for WpsWizard emulator usage +# + +symbian { + mmpStubRules = \ + "$${LITERAL_HASH}ifdef WINSCW" \ + "USERINCLUDE stubs" \ + "SOURCEPATH stubs" \ + "SOURCE stub_wlanmgmtclient.cpp" \ + "$${LITERAL_HASH}endif" + MMP_RULES += mmpStubRules +} diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/stubs/wlanmgmtclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/stubs/wlanmgmtclient.h Thu Jul 22 16:44:32 2010 +0100 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Management API stubbing for WPSWizard +*/ + +#ifndef WLANMGMTCLIENT_H +#define WLANMGMTCLIENT_H + +#include "wlanmgmtcommon.h" +#include "wlanscaninfo.h" + +// CLASS DECLARATION + +class CWlanMgmtClient : public CBase + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + * @return Pointer to the constructed object. + */ + static CWlanMgmtClient* NewL(); + + /** + * Destructor. + */ + ~CWlanMgmtClient(); + + /** + * Start Protected Setup. + * + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aSsid SSID of the network to configure. + * @param aWpsPin PIN value to be used. "00000000" (string of eight zeros) + * if push button method is used. + * @param aCredentials Results of a successful Protected Setup operation. + * @sa \link psetup Protected Setup-specific error codes \endlink. + */ + virtual void RunProtectedSetup( + TRequestStatus& aStatus, + const TWlanSsid& aSsid, + const TWlanWpsPin& aWpsPin, + CArrayFixSeg& aCredentials ); + + /** + * Cancel an outstanding Protected Setup operation. + */ + virtual void CancelProtectedSetup(); + + private: // Data + + CWlanMgmtClient(); + }; + +#endif // WLANMGMTCLIENT_H diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/traces/OstTraceDefinitions.h --- a/wlanutilities/wpswizard/traces/OstTraceDefinitions.h Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/traces/OstTraceDefinitions.h Thu Jul 22 16:44:32 2010 +0100 @@ -11,9 +11,10 @@ * * Contributors: * - * Description: + * Description: TraceHeader ,includes the TraceAPI + * + * */ - #ifndef __OSTTRACEDEFINITIONS_H__ #define __OSTTRACEDEFINITIONS_H__ #include diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/wpswizard.pro --- a/wlanutilities/wpswizard/wpswizard.pro Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/wpswizard.pro Thu Jul 22 16:44:32 2010 +0100 @@ -10,50 +10,66 @@ # Nokia Corporation - initial contribution. # # Contributors: -# Description: # +# Description: WPS wizard +# + TEMPLATE = lib TARGET = wpswizard DEFINES += BUILD_WPS_WIZARD_DLL VERSION = 0.0.1 CONFIG += hb -MOC_DIR = _moc -RCC_DIR = _resources -RESOURCES += resources/resource.qrc -TRANSLATIONS += resources/wpswizardplugin.ts -HEADERS += ../inc/wpswizard.h \ +MOC_DIR = build +RCC_DIR = build +RESOURCES += resources/wpswizard_resource.qrc +TRANSLATIONS += wpswizardplugin.ts + +INCLUDEPATH += inc \ + ../inc + +HEADERS += inc/wpswizard.h \ inc/wpswizard_p.h \ inc/wpswizardpage.h \ inc/wpswizardsteptwo.h \ inc/wpswizardstepthreebutton.h \ inc/wpswizardstepthreenumber.h \ inc/wpswizardstepfour.h \ + inc/wpswizardstepfour_p.h \ inc/wpswizardstepfive.h \ inc/cwpsactiverunner.h \ inc/mwpsactiverunnercallback.h \ - traces/OstTraceDefinitions.h -SOURCES += src/wpswizardprivate.cpp \ + +SOURCES += src/wpswizard_p.cpp \ src/wpswizard.cpp \ src/wpswizardpage.cpp \ src/wpswizardsteptwo.cpp \ src/wpswizardstepthreebutton.cpp \ src/wpswizardstepthreenumber.cpp \ src/wpswizardstepfour.cpp \ + src/wpswizardstepfour_p.cpp \ src/wpswizardstepfive.cpp \ src/cwpsactiverunner.cpp -LIBS += -lecom + + symbian { - HEADERS += - SOURCES += - INCLUDEPATH += inc \ - ../../inc \ - ../wlanwizard/inc \ - $$MW_LAYER_SYSTEMINCLUDE \ - $$OS_LAYER_SYSTEMINCLUDE + + LIBS += -lecom + TARGET.UID3 = 0x2003D2FE TARGET.CAPABILITY = CAP_GENERAL_DLL - BLD_INF_RULES.prj_exports += "rom/wpswizard.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wpswizard.iby)" + TARGET.EPOCALLOWDLLDATA = 1 - MMP_RULES += EXPORTUNFROZEN + +    MMP_RULES += "USERINCLUDE traces" + + # location of directories for def files + defFilePath = . + + BLD_INF_RULES.prj_exports += "rom/wpswizard.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wpswizard.iby)" + BLD_INF_RULES.prj_exports += "rom/wpswizard_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(wpswizard_resources.iby)" + BLD_INF_RULES.prj_exports += "inc/wpswizard.h |../inc/wpswizard.h" } + +include (stubs/stubs.pri) +