# HG changeset patch # User Pat Downey # Date 1283340032 -3600 # Node ID f28ada11abbffa7af2d04e3f4d99e9314e13af14 # Parent 63be7eb3fc780149fb207f6a93d9e0b340bd7c71 Revert incorrect RCL_3 drop: Revision: 201029 Kit: 201035 diff -r 63be7eb3fc78 -r f28ada11abbf group/bld.inf --- a/group/bld.inf Tue Aug 31 16:18:40 2010 +0300 +++ b/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -24,6 +24,7 @@ PRJ_MMPFILES #include "../hotspotfw/group/bld.inf" #include "../hsfw_plat/group/bld.inf" +#include "../wlanutilities/group/bld.inf" PRJ_TESTMMPFILES diff -r 63be7eb3fc78 -r f28ada11abbf hotspotfw/group/bld.inf --- a/hotspotfw/group/bld.inf Tue Aug 31 16:18:40 2010 +0300 +++ b/hotspotfw/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -23,9 +23,13 @@ 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 @@ -52,5 +56,11 @@ ../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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/data/hsbrowser.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/data/hsbrowser.rss Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,187 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/data/hsbrowser_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/data/hsbrowser_reg.rss Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,36 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,29 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/group/hsbrowser.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/group/hsbrowser.mmp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,73 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/inc/am_debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/am_debug.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,76 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/inc/am_debug.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/am_debug.inl Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,78 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/inc/hsbrowserapp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowserapp.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,59 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/inc/hsbrowserappui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowserappui.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,105 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/inc/hsbrowsercommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowsercommon.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,57 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/inc/hsbrowsercontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowsercontainer.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,333 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/inc/hsbrowsercontainer.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowsercontainer.inl Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,89 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/inc/hsbrowserdocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowserdocument.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,99 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/inc/hsbrowserdocument.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowserdocument.inl Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,36 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/inc/hsbrowserhssrvnotifs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowserhssrvnotifs.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,90 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/inc/hsbrowserictsobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowserictsobserver.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,97 @@ +/* +* 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; + + /** + * Flag for authentication ok indication to Hotspot Server + */ + TBool iAuthenticatedOkSent; + }; + +#endif // HSBROWSERICTSOBSERVER_H + +// End of File + diff -r 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/inc/hsbrowserloadeventobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowserloadeventobserver.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,130 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/inc/hsbrowsermodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowsermodel.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,184 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/inc/hsbrowsermodel.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowsermodel.inl Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,265 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/inc/hsbrowserspecialloadobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowserspecialloadobserver.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,120 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/loc/hsbrowser.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/loc/hsbrowser.loc Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,55 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/src/hsbrowserapp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/src/hsbrowserapp.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,84 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/src/hsbrowserappui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/src/hsbrowserappui.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,204 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/src/hsbrowsercontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/src/hsbrowsercontainer.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,687 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/src/hsbrowserdocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/src/hsbrowserdocument.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,85 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/src/hsbrowserhssrvnotifs.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/src/hsbrowserhssrvnotifs.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,88 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/src/hsbrowserictsobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/src/hsbrowserictsobserver.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,121 @@ +/* +* 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 && !iAuthenticatedOkSent ) + { + // Send this only once per session + iAuthenticatedOkSent = ETrue; + model->SetState( EHsBrowserUiAuthenticatedOk, ETrue ); + // Do this only once too + iContainer->ShowLoginCompleteNote(); + iContainer->SendToBackground(); + iContainer->UpdateSoftkeys(); + } + } + } + +// --------------------------------------------------------- +// CHsBrowserIctsObserver::CHsBrowserIctsObserver +// --------------------------------------------------------- +// +CHsBrowserIctsObserver::CHsBrowserIctsObserver( + CHsBrowserContainer* aContainer ) : iContainer( aContainer ), + iAuthenticatedOkSent( EFalse ) + { + DEBUG( "CHsBrowserIctsObserver::CHsBrowserIctsObserver()" ); + } + +// --------------------------------------------------------- +// CHsBrowserIctsObserver::ConstructL +// --------------------------------------------------------- +// +void CHsBrowserIctsObserver::ConstructL() + { + DEBUG( "CHsBrowserIctsObserver::ConstructL()" ); + } + +// End of File diff -r 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/src/hsbrowserloadeventobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/src/hsbrowserloadeventobserver.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,324 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/src/hsbrowsermodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/src/hsbrowsermodel.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,153 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/src/hsbrowserspecialloadobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/src/hsbrowserspecialloadobserver.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,118 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsclient/inc/hssiaphandler.h --- a/hotspotfw/hsclient/inc/hssiaphandler.h Tue Aug 31 16:18:40 2010 +0300 +++ b/hotspotfw/hsclient/inc/hssiaphandler.h Wed Sep 01 12:20:32 2010 +0100 @@ -100,7 +100,14 @@ void PackWepKeyCommsDatL( const SHssWep& aInputKey, const EHssWEPKeyFormat& aFormat, CMDBField* aPackedKey ); - + + /** + * Converts Hotspot EAP settings to EAPOL EAP settings + * @param aHssEap, Hotspot EAP settings + * @param aEap, EAPOL EAP settings + */ + void ConvertEApSettings( THssEapSettings& aHssEap, EAPSettings& aEap ); + /** * Converts ascii to hecxadecimal * @param aSource, ascii @@ -110,6 +117,14 @@ HBufC8*& aDest ); /** + * Writes eap type to descriptor + * @param aEapType, Eap type + * @param aEapString, Eap type descrpitor + * @param aEapCode, Eap id code + */ + void GetEapTypeDesC( TUint aEapType, TDes8& aEapString, TChar& aEapCode ); + + /** * Removes brackets from UID * @param aUid, UID of the client */ diff -r 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsclient/src/hssiaphandler.cpp --- a/hotspotfw/hsclient/src/hssiaphandler.cpp Tue Aug 31 16:18:40 2010 +0300 +++ b/hotspotfw/hsclient/src/hssiaphandler.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -18,17 +18,18 @@ // INCLUDE FILES +#include #include #include "hssiaphandler.h" #include "hotspotclientserver.h" #include "am_debug.h" #include -#include +#include #include -#include +#include #include -#include +#include // CONSTANTS const TInt KRetryCount = 20; @@ -43,9 +44,9 @@ // ----------------------------------------------------------------------------- // CHssIapHandler::CHssIapHandler( ) - { + { DEBUG("CHssIapHandler::CHssIapHandler"); - } + } // ----------------------------------------------------------------------------- // ConstructL @@ -74,15 +75,15 @@ // ----------------------------------------------------------------------------- // CHssIapHandler::~CHssIapHandler() - { - DEBUG("CHssIapHandler::~CHssIapHandler()"); + { + DEBUG("CHssIapHandler::~CHssIapHandler()"); - if ( iWLANRecord != NULL ) - { - delete iWLANRecord; - } - iWLANRecord = NULL; - } + if ( iWLANRecord != NULL ) + { + delete iWLANRecord; + } + iWLANRecord = NULL; + } // ----------------------------------------------------------------------------- // ChangeSettingsL @@ -96,14 +97,23 @@ DEBUG("CHssIapHandler::ChangeSettingsL"); TInt ret( KErrNone ); - RCmManager cmManager; + RCmManagerExt 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); - RCmConnectionMethod plugin = cmManager.ConnectionMethodL( aIapID ); - CleanupClosePushL( plugin ); + RCmConnectionMethodExt plugin = cmManager.ConnectionMethodL( aIapID ); + CleanupClosePushL( plugin ); serviceId = plugin.GetIntAttributeL( EWlanServiceId ); DEBUG1("CHssIapHandler::ChangeSettingsL WLAN serviceId: %d", serviceId); @@ -119,7 +129,7 @@ CMDBSession* dbSession = CMDBSession::NewL(CMDBSession::LatestVersion()); CleanupStack::PushL( dbSession ); iWLANRecord = static_cast - ( CCDRecordBase::RecordFactoryL( 0 ) ); + ( CCDRecordBase::RecordFactoryL( 0)); iWLANRecord->InitializeL( KGenericTable(),NULL ); iWLANRecord->SetRecordId( serviceId ); @@ -150,9 +160,9 @@ // -> Destination can become unusable. TInt secMode = aSettings.iSecurityMode; if ( secMode > EHssWpa2Only ) - { - secMode = EHssAllowUnsecure; - } + { + secMode = EHssAllowUnsecure; + } if( secMode == EHssWep ) { @@ -188,12 +198,89 @@ *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanWpaKeyLength)) = aSettings.iWPAKeyLength; *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanEnableWpaPsk)) = aSettings.iEnableWpaPsk; } - else // Use EAP. EAP settings can be set with EAP API. + else // Use EAP { DEBUG("CHssIapHandler::ChangeSettingsL -> SecurityMode > EHssWep -> EAP"); *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanEnableWpaPsk)) = aSettings.iEnableWpaPsk; } } + + // access point updated EAP data can be now set if needed + if ( ( !aSettings.iEnableWpaPsk ) && secMode > EHssWep ) + { + DEBUG("CHssIapHandler::ChangeSettingsL -> Set EAP data"); + TBuf8 enabledEapList; + for (TInt i=0;i eapTypeCue; + TChar eapCode; + GetEapTypeDesC(aSettings.iEapDataArray[i]->iEAPType, eapTypeCue, eapCode ); + + CEapType* eapType = NULL; + TRAPD( error, ( eapType = CEapType::NewL( eapTypeCue, ELan, serviceId ) ) ); + DEBUG1(" CEapType::NewL error: %d", error); + if ( ( error == KErrNone ) && eapType ) + { + CleanupStack::PushL( eapType ); + EAPSettings* eapSettings = new (ELeave) EAPSettings; + + ConvertEApSettings( *aSettings.iEapDataArray[i], *eapSettings ); + + // Set EAP tunneling + if ( aSettings.iEapDataArray[i]->iEncapsulatedInside != EAPSettings::EEapNone ) + { + DEBUG("iEncapsulatedInside != EAPSettings::EEapNone"); + eapType->SetTunnelingType( + static_cast ( aSettings.iEapDataArray[i]->iEncapsulatedInside ) ); + } + else // Write to EAP list + { + DEBUG("CHssIapHandler::ChangeSettingsL -> Add to EAP list"); + TBuf8<8> expandedForm; + expandedForm.AppendFill( 0xFE, 1 ); + if ( THssEapSettings::EEapPlainMschapv2 == aSettings.iEapDataArray[i]->iEAPType ) + { + expandedForm.AppendFill( 0xFF, 3 ); + } + else{ + expandedForm.AppendFill( 0x00, 6 ); + } + + expandedForm.AppendFill( eapCode, 1 ); + + enabledEapList.Append( expandedForm ); + } + + DEBUG("CHssIapHandler::ChangeSettingsL -> eapType->SetConfigurationL"); + TRAPD( eapErr, eapType->SetConfigurationL( *eapSettings ) ); + DEBUG1(" eapType->SetConfigurationL error: %d", eapErr); + if( eapErr != KErrNone ) + { + CleanupStack::PopAndDestroy( eapType ); + CleanupStack::PopAndDestroy( dbSession ); + DEBUG("CHssIapHandler::ChangeSettingsL EapError DONE"); + return eapErr; + } + CleanupStack::PopAndDestroy( eapType ); + } + if ( error != KErrNone ) + { + DEBUG("CHssIapHandler::ChangeSettingsL Eap error"); + CleanupStack::PopAndDestroy( dbSession ); + return error; + } + } + + // Set enabled EAP list + if ( enabledEapList.Length() > 0 ) + { + DEBUG("CHssIapHandler::ChangeSettingsL -> Set EAP list"); + CMDBField* eaps = (CMDBField*)iWLANRecord->GetFieldByIdL( KCDTIdWlanEnabledEaps ); + //eaps->SetMaxLengthL( eapList16.Length() ) + eaps->SetL( enabledEapList ); + } + } + // Update access point, be prepared that Commsdat might be locked TInt errCode( KErrLocked ); TInt retryCount( 0 ); @@ -214,10 +301,10 @@ // override previous ret value only when error happened ret = errCode; } - + CleanupStack::PopAndDestroy( dbSession ); DEBUG("CHssIapHandler::ChangeSettingsL DONE"); - return ret; + return ret; } // ----------------------------------------------------------------------------- @@ -311,6 +398,65 @@ aPackedKey->SetL( wepBuf); } + +// ----------------------------------------------------------------------------- +// ConvertEApSettings +// ----------------------------------------------------------------------------- +// +void CHssIapHandler::ConvertEApSettings( THssEapSettings& aHssEap, EAPSettings& aEap ) + { + DEBUG("CHssIapHandler::ConvertEApSettings"); + aEap.iEAPType = static_cast(aHssEap.iEAPType); + aEap.iUsernamePresent = aHssEap.iUsernamePresent; + aEap.iUsername = aHssEap.iUsername; + aEap.iPasswordPresent = aHssEap.iPasswordPresent; + aEap.iPassword = aHssEap.iPassword; + aEap.iRealmPresent = aHssEap.iRealmPresent; + aEap.iRealm = aHssEap.iRealm; + aEap.iUsePseudonymsPresent = aHssEap.iUsePseudonymsPresent; + aEap.iUsePseudonyms = aHssEap.iUsePseudonyms; + aEap.iVerifyServerRealmPresent = aHssEap.iVerifyServerRealmPresent; + aEap.iVerifyServerRealm = aHssEap.iVerifyServerRealm; + aEap.iRequireClientAuthenticationPresent = aHssEap.iRequireClientAuthenticationPresent; + aEap.iRequireClientAuthentication = aHssEap.iRequireClientAuthentication; + aEap.iSessionValidityTimePresent = aHssEap.iSessionValidityTimePresent; + aEap.iSessionValidityTime = aHssEap.iSessionValidityTime; + aEap.iCipherSuitesPresent = aHssEap.iCipherSuitesPresent; + + for( TInt i = 0; i < aHssEap.iCipherSuitesCount; i++ ) + { + aEap.iCipherSuites.Append( aHssEap.iCipherSuites[i] ); + } + aEap.iPEAPVersionsPresent = aHssEap.iPEAPVersionsPresent; + aEap.iPEAPv0Allowed = aHssEap.iPEAPv0Allowed; + aEap.iPEAPv1Allowed = aHssEap.iPEAPv1Allowed; + aEap.iPEAPv2Allowed = aHssEap.iPEAPv2Allowed; + aEap.iCertificatesPresent = aHssEap.iCertificatesPresent; + for( TInt i = 0; i < aHssEap.iCertificatesCount; i++ ) + { + DEBUG("CHssIapHandler::ConvertEApSettings Certificates present"); + CertificateEntry entry; + + entry.iCertType = static_cast( aHssEap.iCertificates[i]->iCertType ); + entry.iSubjectNamePresent = aHssEap.iCertificates[i]->iSubjectNamePresent; + entry.iSubjectName = aHssEap.iCertificates[i]->iSubjectName; + entry.iIssuerNamePresent = aHssEap.iCertificates[i]->iIssuerNamePresent; + entry.iIssuerName = aHssEap.iCertificates[i]->iIssuerName; + entry.iSerialNumberPresent= aHssEap.iCertificates[i]->iSerialNumberPresent; + entry.iSerialNumber = aHssEap.iCertificates[i]->iSerialNumber; + entry.iSubjectKeyIDPresent = aHssEap.iCertificates[i]->iSubjectKeyIDPresent; + entry.iSubjectKeyID = aHssEap.iCertificates[i]->iSubjectKeyID; + + entry.iThumbprintPresent = aHssEap.iCertificates[i]->iThumbprintPresent; + entry.iThumbprint = aHssEap.iCertificates[i]->iThumbprint; + TRAP_IGNORE( aEap.iCertificates.AppendL( entry ) ); // Memory problem, ignored... + } + aEap.iEncapsulatedEAPTypesPresent = aHssEap.iEncapsulatedEAPTypesPresent; + for( TInt i = 0; i < aHssEap.iEncapsulatedEAPTypesCount; i++ ) + { + aEap.iEncapsulatedEAPTypes.Append( aHssEap.iEncapsulatedEAPTypes[i] ); + } + } // ----------------------------------------------------------------------------- // ConvertAsciiToHex @@ -332,6 +478,78 @@ } // ----------------------------------------------------------------------------- +// GetEapTypeDesC +// ----------------------------------------------------------------------------- +// +void CHssIapHandler::GetEapTypeDesC( TUint aEapType, TDes8& aEapString, TChar& aEapCode ) + { + DEBUG1( "CHssIapHandler::GetEapTypeDesC aEapType: %d", aEapType ); + switch ( aEapType ) + { + // EapNone + case 0: + aEapString.Copy( KEapNoneId, KEapExpandedIdLength ); + aEapCode = KEapNoneId[7]; + break; + // KEapGtc + case 6: + aEapString.Copy( KEapGtcId, KEapExpandedIdLength ); + aEapCode = KEapGtcId[7]; + break; + // KEapTls + case 13: + aEapString.Copy( KEapTlsId, KEapExpandedIdLength ); + aEapCode = KEapTlsId[7]; + break; + // KEapLeap + case 17: + aEapString.Copy( KEapLeapId, KEapExpandedIdLength ); + aEapCode = KEapLeapId[7]; + break; + // KEapSim + case 18: + aEapString.Copy( KEapSimId, KEapExpandedIdLength ); + aEapCode = KEapSimId[7]; + break; + // KEapTtls + case 21: + aEapString.Copy( KEapTtlsId, KEapExpandedIdLength ); + aEapCode = KEapTtlsId[7]; + break; + // KEapAka + case 23: + aEapString.Copy( KEapAkaId, KEapExpandedIdLength ); + aEapCode = KEapAkaId[7]; + break; + // KEapPeap + case 25: + aEapString.Copy( KEapPeapId, KEapExpandedIdLength ); + aEapCode = KEapPeapId[7]; + break; + // KEapMschapv2 + case 26: + aEapString.Copy( KEapMschapv2Id, KEapExpandedIdLength ); + aEapCode = KEapMschapv2Id[7]; + break; + // KEapSecurid + case 32: + aEapString.Copy( KEapSecuridId, KEapExpandedIdLength ); + aEapCode = KEapSecuridId[7]; + break; + // KEapPlainMschapv2 + case 99: + aEapString.Copy( KEapPlainMschapv2Id, KEapExpandedIdLength ); + aEapCode = KEapPlainMschapv2Id[7]; + break; + default: + aEapString.Copy( KEapNoneId, KEapExpandedIdLength ); + aEapCode = KEapNoneId[7]; + break; + } + DEBUG( "CHssIapHandler::GetEapTypeDesC DONE" ); + } + +// ----------------------------------------------------------------------------- // GetNetworkIdL // ----------------------------------------------------------------------------- // @@ -339,11 +557,11 @@ { DEBUG( "CHssIapHandler::GetNetworkIdL()" ); - RCmManager cmManager; + RCmManagerExt cmManager; cmManager.OpenL(); CleanupClosePushL( cmManager ); - RCmConnectionMethod plugin = cmManager.ConnectionMethodL( aIapId ); + RCmConnectionMethodExt plugin = cmManager.ConnectionMethodL( aIapId ); CleanupClosePushL( plugin ); aNetId = plugin.GetIntAttributeL( ECmNetworkId ); @@ -371,7 +589,7 @@ RArray destArray = RArray( 10 ); // KCmArrayGranularity instead of 10 CleanupClosePushL( destArray ); - RCmManager cmManager; + RCmManagerExt cmManager; cmManager.OpenL(); CleanupClosePushL( cmManager ); @@ -379,7 +597,7 @@ for (TInt i = 0; i < destArray.Count(); i++) { - RCmDestination dest = cmManager.DestinationL( destArray[i] ); + RCmDestinationExt dest = cmManager.DestinationL( destArray[i] ); CleanupClosePushL( dest ); for (TInt j = 0; j < dest.ConnectionMethodCount(); j++) diff -r 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsclient/src/hssmgmtscaninfoimpl.cpp --- a/hotspotfw/hsclient/src/hssmgmtscaninfoimpl.cpp Tue Aug 31 16:18:40 2010 +0300 +++ b/hotspotfw/hsclient/src/hssmgmtscaninfoimpl.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -124,9 +124,9 @@ // void CHssMgmtScanInfoImpl::Bssid( THssBssid& aBssid ) const { - TUint8 bssid[KHssMacAddressLength]; + TUint8 bssid[ KHssMacAddressLength ]; iScanInfo->BSSID( bssid ); - aBssid.Copy( &bssid[0], KHssMacAddressLength ); + aBssid.Copy( &bssid[ 0 ], KHssMacAddressLength ); } // --------------------------------------------------------- diff -r 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsserver/group/hotspotserver.mmp --- a/hotspotfw/hsserver/group/hotspotserver.mmp Tue Aug 31 16:18:40 2010 +0300 +++ b/hotspotfw/hsserver/group/hotspotserver.mmp Wed Sep 01 12:20:32 2010 +0100 @@ -15,6 +15,7 @@ * */ + #include TARGET HotSpotServer.exe @@ -35,18 +36,21 @@ 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsserver/inc/hotspotclientserver.h --- a/hotspotfw/hsserver/inc/hotspotclientserver.h Tue Aug 31 16:18:40 2010 +0300 +++ b/hotspotfw/hsserver/inc/hotspotclientserver.h Wed Sep 01 12:20:32 2010 +0100 @@ -30,6 +30,7 @@ _LIT( KHotSpotPlugin, "NetCfgExtnHotSpot" ); _LIT( KDhcpPlugin, "NetCfgExtnDhcp" ); +const TUint KEasyWlanServiceId = 1; const TUid KHotspotServerUid3={0x10282ECB}; const TUint KHssShutdown = 777; diff -r 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsserver/inc/hotspotserver.h --- a/hotspotfw/hsserver/inc/hotspotserver.h Tue Aug 31 16:18:40 2010 +0300 +++ b/hotspotfw/hsserver/inc/hotspotserver.h Wed Sep 01 12:20:32 2010 +0100 @@ -239,6 +239,13 @@ void CheckIapsL(); /** + * Activates WLAN notifications. + * @since Series 60 5.2 + * @return None + */ + void ActivateWlanNotificationsL(); + + /** * Get login timer value for the specified client. * @since Series 60 5.2 * @param aClientUid, clients user id @@ -288,6 +295,13 @@ * @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: @@ -386,7 +400,11 @@ * Array for storing client IAPs and their UIDs. */ RArray iClientIaps; - + + /** + * Easy WLAN IAP Id + */ + TInt iEasyWlanId; }; #endif diff -r 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsserver/inc/hotspotsession.h --- a/hotspotfw/hsserver/inc/hotspotsession.h Tue Aug 31 16:18:40 2010 +0300 +++ b/hotspotfw/hsserver/inc/hotspotsession.h Wed Sep 01 12:20:32 2010 +0100 @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include "hssnotif.h" #include "hssiapsettingshandler.h" #include "hssclientinterface.h" @@ -49,7 +51,8 @@ * @lib HotSpotServer.exe * @since Series 60 3.0 */ -NONSHARABLE_CLASS( CHotSpotSession ) : public CSession2, +NONSHARABLE_CLASS( CHotSpotSession ) : public CSession2, + public MIctsObserver, public MHssLoginTimerObserver, public MHssLogoutTimerObserver, public MWlanMgmtNotifications @@ -93,6 +96,16 @@ 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 @@ -137,20 +150,30 @@ */ 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 ProcessRegister( const RMessage2& aMessage ); + void ProcessRegisterL( const RMessage2& aMessage ); /** * Starts client unregister procedures * @param aMessage, RMessage from client side * @return None */ - void ProcessUnRegister( const RMessage2& aMessage ); + void ProcessUnRegisterL( const RMessage2& aMessage ); /** * Starts login procedures @@ -158,7 +181,7 @@ * @param aNetId, Network id * @return KErrNone, if successful, otherwice one of system wide errorcodes. */ - TInt ProcessStartLogin( const TUint aIapId, const TUint aNetId ); + TInt ProcessStartLoginL( const TUint aIapId, const TUint aNetId ); /** * Starts Join procedures @@ -203,6 +226,18 @@ void ProcessServerShutdown( const RMessage2& aMessage ); /** + * Updates UI state of HotSpot browser logon application. + * @param aMessage, Message for completing request + */ + void ProcessUiStateL( 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 */ @@ -282,6 +317,12 @@ * Own */ CHssIapSettingsHandler* iIapSettingsHandler; + + /** + * Internet Connectivity testing instance + * Own + */ + CIctsClientInterface* iIcts; /** * Timer used for client Login procedure diff -r 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsserver/inc/hssiapsettingshandler.h --- a/hotspotfw/hsserver/inc/hssiapsettingshandler.h Tue Aug 31 16:18:40 2010 +0300 +++ b/hotspotfw/hsserver/inc/hssiapsettingshandler.h Wed Sep 01 12:20:32 2010 +0100 @@ -135,11 +135,24 @@ const TDesC& aUid ); /** + * Create new IAP to Internet SNAP. + * @param aHotspot, ETrue if captive portal detected + * @return Iap ID, Otherwise aIapId will be null + */ + TInt CreateIapL( TBool aHotspot ); + + /** * Deletes the IAP * @param aIapID, IAP id */ void DeleteIapL( const TUint aIapId ); - + + /** + * Moves the IAP to Internet SNAP + * @param aIapID, IAP id + */ + void MoveIapL( const TUint aIapId ); + protected: /** diff -r 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsserver/src/hotspotserver.cpp --- a/hotspotfw/hsserver/src/hotspotserver.cpp Tue Aug 31 16:18:40 2010 +0300 +++ b/hotspotfw/hsserver/src/hotspotserver.cpp Wed Sep 01 12:20: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,15 +158,14 @@ 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. // When EWlanConnectionModeNotConnected is received we can cancel this. iMgtClient = CWlanMgmtClient::NewL(); -#ifndef __WINS__ - iMgtClient->ActivateNotificationsL( *this ); -#endif + ActivateWlanNotificationsL(); } // ----------------------------------------------------------------------------- @@ -203,7 +202,7 @@ void CHotSpotServer::FindClientIapsL() { DEBUG("CHotSpotServer::FindClientIapsL()"); - RCmManager cmManager; + RCmManagerExt cmManager; cmManager.OpenL(); CleanupClosePushL(cmManager); @@ -212,12 +211,16 @@ TBool supportedBearersOnly = ETrue; TBool legacyCmsOnly = EFalse; + // Read Easy WLAN IAP ID first + iEasyWlanId = cmManager.EasyWlanIdL(); + DEBUG1("CHotSpotServer::FindClientIapsL() iEasyWlanId: % d", iEasyWlanId); + cmManager.ConnectionMethodL( cmArray, supportedBearersOnly, legacyCmsOnly ); DEBUG1("CHotSpotServer::FindClientIapsL count: %d", cmArray.Count()); for( TInt i = 0; i < cmArray.Count(); i++ ) { - RCmConnectionMethod cm = cmManager.ConnectionMethodL( cmArray[i] ); + RCmConnectionMethodExt cm = cmManager.ConnectionMethodL( cmArray[i] ); CleanupClosePushL( cm ); HBufC* daemonName = cm.GetStringAttributeL( ECmConfigDaemonManagerName ); @@ -273,14 +276,14 @@ delete plugin; DEBUG1("CHotSpotServer::CheckIapsL find client error: %d", error ); - if ( error == KErrNotFound ) + if ( error != KErrNone ) { // Remove from database - RCmManager cmManager; + RCmManagerExt cmManager; cmManager.OpenL(); CleanupClosePushL(cmManager); - RCmConnectionMethod cm; + RCmConnectionMethodExt cm; cm = cmManager.ConnectionMethodL( iClientIaps[i].iIapId ); CleanupClosePushL( cm ); cmManager.RemoveAllReferencesL( cm ); @@ -299,6 +302,19 @@ } // ----------------------------------------------------------------------------- +// ActivateWlanNotificationsL +// ----------------------------------------------------------------------------- +// +void CHotSpotServer::ActivateWlanNotificationsL() + { + DEBUG("CHotSpotServer::ActivateWlanNotificationsL"); +#ifndef __WINS__ + iMgtClient->CancelNotifications(); + iMgtClient->ActivateNotificationsL( *this ); +#endif + } + +// ----------------------------------------------------------------------------- // NewSessionL // ----------------------------------------------------------------------------- // @@ -661,6 +677,16 @@ } } +// ----------------------------------------------------------------------------- +// GetEasyWlanId +// ----------------------------------------------------------------------------- +// +TInt CHotSpotServer::GetEasyWlanId() + { + DEBUG("CHotspotServer::GetEasyWlanId()"); + return iEasyWlanId; + } + // ========================== OTHER EXPORTED FUNCTIONS ========================= // ----------------------------------------------------------------------------- diff -r 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsserver/src/hotspotsession.cpp --- a/hotspotfw/hsserver/src/hotspotsession.cpp Tue Aug 31 16:18:40 2010 +0300 +++ b/hotspotfw/hsserver/src/hotspotsession.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -25,16 +25,23 @@ #include "hsslogouttimer.h" #include "hssclientinterface.h" #include "am_debug.h" +#include #include #include +#include #include #include #include +#include // Forward declarations class CWlanMgmtClient; class MWlanMgmtNotifications; +// Constants +const TInt KSeparatorsLength = 4; +const TInt KBrowserUid = 0x2000AFCC; // WLAN Login UID + // ============================ MEMBER FUNCTIONS =============================== // ----------------------------------------------------------------------------- @@ -43,7 +50,8 @@ // CHotSpotSession::CHotSpotSession( CHotSpotServer& aServer ) : iServer( aServer ), iClient( NULL ), iSrvNotifications ( NULL ), - iNotificationHandle( NULL ), iAllowNotifications( ETrue ), iHotspotExtension( ETrue ) + iNotificationHandle( NULL ), iAllowNotifications( ETrue ), + iHotspotExtension( ETrue ) { } @@ -115,7 +123,11 @@ iLogoutTimer->Cancel(); delete iLogoutTimer; } - + + if ( iIcts != NULL ) + { + delete iIcts; + } DEBUG( "CHotSpotSession::~CHotSpotSession() Done" ); } @@ -149,7 +161,6 @@ switch ( aMessage.Function() ) { case EHssActivateNotifications : - DEBUG( "CHotSpotSession::ActivateNotificationsL" ); iAllowNotifications = EFalse; if ( iNotifications == NULL ) @@ -160,7 +171,6 @@ HandleOrderNotifications( aMessage ); break; case EHssCancelNotifications : - DEBUG( "CHotSpotSession::CancelNotifications" ); iAllowNotifications = EFalse; iMgtClient->CancelNotifications( ); @@ -172,10 +182,10 @@ HandleCancelNotifications( aMessage ); break; case EHssRegister : - ProcessRegister( aMessage ); + ProcessRegisterL( aMessage ); break; case EHssUnRegister : - ProcessUnRegister( aMessage ); + ProcessUnRegisterL( aMessage ); break; case EHssJoin : iAllowNotifications = EFalse; @@ -248,12 +258,10 @@ { if ( value == KErrNone ) { - DEBUG( "EHssLoginComplete1" ); iServer.CompleteMessage( indx, KErrNone ); } else { - DEBUG( "EHssLoginComplete2" ); iServer.CompleteMessage( indx, KErrCancel ); iServer.SetLogoutFlag( ETrue ); } @@ -287,12 +295,12 @@ } else { - err = ProcessStartLogin( iIapId, iNetId ); + err = ProcessStartLoginL( iIapId, iNetId ); // If client not found, an error was returned. // Otherwise message completed elsewhere. if ( KErrNone != err ) { - indx = iServer.FindMessage(iIapId, EHssStartLogin ); + indx = iServer.FindMessage( iIapId, EHssStartLogin ); if ( indx >= 0 ) { iServer.CompleteMessage( indx , KErrNone ); @@ -455,11 +463,23 @@ aMessage.Complete( KErrNone ); break; case EHssUiState: - aMessage.Complete( KErrNotSupported ); + TRAP_IGNORE( ProcessUiStateL( aMessage ) ); + // Just complete the message + aMessage.Complete( KErrNone ); break; case EHssStartBrowser: { - aMessage.Complete( KErrNotSupported ); + 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); break; } case EHssSetTimerValues: @@ -580,6 +600,69 @@ } // ----------------------------------------------------------------------------- +// 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 : + // Create IAP first, then complete the message to connection. + TRAP_IGNORE( iIapSettingsHandler->CreateIapL( EFalse ) ); + indx = iServer.FindMessage( iIapId, EHssStartLogin ); + if ( KErrNotFound != indx ) + { + iServer.CompleteMessage( indx, KErrNone ); + } + break; + case EHttpAuthenticationNeeded : + // Start browser for authentication + TRAPD( browserStarted, AuthenticateL( aString ) ); + if ( browserStarted != KErrNone ) + { + // Starting of browser leaved. Complete the message. + indx = iServer.FindMessage( iIapId, EHssStartLogin ); + if ( KErrNotFound != indx ) + { + iServer.CompleteMessage( indx, KErrNone ); + } + } + break; + case EConnectionNotOk : + case ETimeout : + indx = iServer.FindMessage( iIapId, EHssStartLogin ); + if ( KErrNotFound != indx ) + { + iServer.CompleteMessage( indx, KErrNone ); + } + break; + default: + break; + } + } + +// ----------------------------------------------------------------------------- // LoginTimeout // ----------------------------------------------------------------------------- // @@ -632,12 +715,12 @@ } // --------------------------------------------------------- -// ProcessRegister +// ProcessRegisterL // --------------------------------------------------------- // -void CHotSpotSession::ProcessRegister( const RMessage2& aMessage ) +void CHotSpotSession::ProcessRegisterL( const RMessage2& aMessage ) { - DEBUG("CHotSpotSession::ProcessRegister"); + DEBUG("CHotSpotSession::ProcessRegisterL"); iAllowNotifications = EFalse; TBufC< KIapNameLength > iapName; @@ -677,25 +760,33 @@ } // --------------------------------------------------------- -// ProcessUnRegister +// ProcessUnRegisterL // --------------------------------------------------------- // -void CHotSpotSession::ProcessUnRegister( const RMessage2& aMessage ) +void CHotSpotSession::ProcessUnRegisterL( const RMessage2& aMessage ) { - DEBUG("CHotSpotSession::ProcessUnRegister"); + DEBUG("CHotSpotSession::ProcessUnRegisterL"); iAllowNotifications = EFalse; TInt ret( KErrNone ); // Read message TInt iapId = ( TInt )aMessage.Int0(); iServer.RemoveClientIap( iapId ); - - TRAPD( err, iIapSettingsHandler->DeleteIapL( iapId ) ); - // return KErrGeneral if IAP removal is not successful - if ( err != KErrNone ) + // Check that this is not Easy WLAN + TInt easyWlan = iServer.GetEasyWlanId(); + if ( easyWlan != iapId ) { - ret = KErrGeneral; + TRAPD( err, iIapSettingsHandler->DeleteIapL( iapId ) ); + // return KErrGeneral if IAP removal is not successful + if ( err != KErrNone ) + { + ret = KErrGeneral; + } } + else + { + ret = KErrPermissionDenied; + } aMessage.Complete( ret ); DEBUG("CHotSpotSession::ProcessUnRegisterL DONE"); } @@ -704,13 +795,24 @@ // ProcessStartLogin // ----------------------------------------------------------------------------- // -TInt CHotSpotSession::ProcessStartLogin( const TUint aIapId, const TUint aNetId ) +TInt CHotSpotSession::ProcessStartLoginL( 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 ); @@ -739,7 +841,7 @@ } // ----------------------------------------------------------------------------- -// ProcessStartL +// ProcessStart // ----------------------------------------------------------------------------- // TInt CHotSpotSession::ProcessStartL( const TUint aIapId ) @@ -935,6 +1037,147 @@ } // ----------------------------------------------------------------------------- +// ProcessUiStateL +// ----------------------------------------------------------------------------- +// +void CHotSpotSession::ProcessUiStateL( const RMessage2& aMessage ) + { + DEBUG( "CHotSpotSession::ProcessUiStateL()" ); + 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::ProcessUiStateL() EHsBrowserUiRunning" ); + break; + } + case EHsBrowserUiAuthenticatedOk: + { + DEBUG( "CHotSpotSession::ProcessUiStateL() EHsBrowserUiAuthenticatedOk" ); + // Check if Easy WLAN. + TInt easyWlan = iServer.GetEasyWlanId(); + if ( easyWlan != iIapId ) + { + iIapSettingsHandler->MoveIapL( iIapId ); + // Activate notifications and mark as client IAP so that + // IAP can be deleted after the use. + TBuf clientUid; + iServer.SetClientIap( iIapId, clientUid ); + iServer.ActivateWlanNotificationsL(); + } + else + { + TInt iapId( 0 ); + iapId = iIapSettingsHandler->CreateIapL( ETrue ); + if ( iapId > 0 ) + { + // Activate notifications and mark as client IAP so that + // IAP can be deleted after the use. + TBuf clientUid; + iServer.SetClientIap( iapId, clientUid ); + iServer.ActivateWlanNotificationsL(); + } + } + + completeMsg = ETrue; + DEBUG( "CHotSpotSession::ProcessUiStateL() EHsBrowserUiAuthenticatedOk Done" ); + break; + } + case EHsBrowserUiAuthenticatedNok: + { + DEBUG( "CHotSpotSession::ProcessUiStateL() EHsBrowserUiAuthenticatedNok" ); + + completeMsg = ETrue; + break; + } + case EHsBrowserUiClosed: + { + DEBUG( "CHotSpotSession::ProcessUiStateL() EHsBrowserUiClosed" ); + completeMsg = ETrue; + break; + } + default: + { + DEBUG( "CHotSpotSession::ProcessUiStateL() default" ); + completeMsg = ETrue; + } + } + + if ( completeMsg ) + { + // complete messages EHssStartLogin/EHssStartBrowser + if ( indx >= 0 ) + { + DEBUG( "CHotSpotSession::ProcessUiStateL() completing EHssStartLogin" ); + iServer.CompleteMessage( indx , KErrNone ); + } + + if ( indxBrowser >= 0 ) + { + DEBUG( "CHotSpotSession::ProcessUiStateL() completing EHssStartBrowser" ); + iServer.CompleteMessage( indxBrowser, ret ); + } + } + } + +// ----------------------------------------------------------------------------- +// Authenticate() +// ----------------------------------------------------------------------------- +// +void CHotSpotSession::AuthenticateL( const TDesC& aString ) + { + DEBUG("CHotSpotSession::AuthenticateL()"); + + // Count IAP Id length + TInt iapIdLength ( 1 ); + TInt iapId = iIapId; + while ( iapId >= 10 ) + { + iapId = iapId / 10; + iapIdLength++; + } + + // Count Network Id length + TInt netIdLength ( 1 ); + TInt netId = iNetId; + while ( netId >= 10 ) + { + netId = netId / 10; + netIdLength++; + } + + TInt length = aString.Length() + + iapIdLength + + netIdLength + + KSeparatorsLength; + HBufC* param = HBufC::NewLC( length ); + _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 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsserver/src/hssiapsettingshandler.cpp --- a/hotspotfw/hsserver/src/hssiapsettingshandler.cpp Tue Aug 31 16:18:40 2010 +0300 +++ b/hotspotfw/hsserver/src/hssiapsettingshandler.cpp Wed Sep 01 12:20: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"); - RCmManager cmManager; + RCmManagerExt cmManager; cmManager.OpenL(); CleanupClosePushL( cmManager ); @@ -91,7 +91,7 @@ CleanupClosePushL( destinations ); cmManager.AllDestinationsL( destinations ); - RCmDestination destination; + RCmDestinationExt destination; // Loop through each destination for( TInt i = 0; i < destinations.Count(); i++ ) { @@ -99,9 +99,10 @@ 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) + if ( destination.MetadataL( CMManager::ESnapMetadataPurpose ) == + CMManager::ESnapPurposeInternet ) { - RCmConnectionMethod plugin = cmManager.CreateConnectionMethodL( KUidWlanBearerType ); + RCmConnectionMethodExt plugin = cmManager.CreateConnectionMethodL( KUidWlanBearerType ); CleanupClosePushL( plugin ); plugin.SetStringAttributeL( ECmName, aIapName ); @@ -125,6 +126,111 @@ } // ----------------------------------------------------------------------------- +// CreateIapL +// ----------------------------------------------------------------------------- +// +TInt CHssIapSettingsHandler::CreateIapL( TBool aHotspot ) + { + DEBUG("CHssIapSettingsHandler::CreateIapL"); + TInt ret ( KErrNone ); + 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 ); + + if ( aHotspot ) + { + // A hotspot IAP. Mark it so it can be deleted after the use. + plugin.SetStringAttributeL( ECmConfigDaemonManagerName, + KHotSpotPlugin ); + } + + destination.AddConnectionMethodL( plugin ); + destination.UpdateL(); + serviceId = plugin.GetIntAttributeL( EWlanServiceId ); + ret = plugin.GetIntAttributeL( ECmIapId ); + 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 ); + + DEBUG1("CHssIapSettingsHandler::CreateIapL Done iapId: %d", ret); + return ret; + } + +// ----------------------------------------------------------------------------- // DeleteIapL // ----------------------------------------------------------------------------- // @@ -132,11 +238,11 @@ { DEBUG1("CHssIapSettingsHandler:::DeleteIapL aIapId=%d ", aIapId); - RCmManager cmManager; + RCmManagerExt cmManager; cmManager.OpenL(); CleanupClosePushL( cmManager ); - RCmConnectionMethod plugin = cmManager.ConnectionMethodL( aIapId ); + RCmConnectionMethodExt plugin = cmManager.ConnectionMethodL( aIapId ); CleanupClosePushL( plugin ); cmManager.RemoveAllReferencesL( plugin ); @@ -148,6 +254,50 @@ } // --------------------------------------------------------- +// MoveIapL() +// --------------------------------------------------------- +// +void CHssIapSettingsHandler::MoveIapL( const TUint aIapId ) + { + DEBUG1("CHssIapSettingsHandler::MoveIapL aIapId=%d ", aIapId); + // Now move to Internet SNAP + 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 ) + { + RCmConnectionMethodExt iap = cmManager.ConnectionMethodL( aIapId ); + CleanupClosePushL( iap ); + iap.SetStringAttributeL( ECmConfigDaemonManagerName, KHotSpotPlugin ); + destination.AddConnectionMethodL( iap ); + CleanupStack::PopAndDestroy( &iap ); + destination.UpdateL(); + } + CleanupStack::PopAndDestroy( &destination ); + } + CleanupStack::PopAndDestroy( &destinations ); + CleanupStack::PopAndDestroy( &cmManager ); + + DEBUG( "CHssIapSettingsHandler::MoveIapL Done" ); + } + +// --------------------------------------------------------- // SaveWEPKeyL() // --------------------------------------------------------- // diff -r 63be7eb3fc78 -r f28ada11abbf hotspotfw/internetconnectivitytestservice/src/ictsengine.cpp --- a/hotspotfw/internetconnectivitytestservice/src/ictsengine.cpp Tue Aug 31 16:18:40 2010 +0300 +++ b/hotspotfw/internetconnectivitytestservice/src/ictsengine.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -225,7 +225,10 @@ StopPolling(); iClient.ConnectivityObserver( EConnectionNotOk, iString ); } - iPollingIntervalTimer->After( iPollingInterval ); + else + { + iPollingIntervalTimer->After( iPollingInterval ); + } } // --------------------------------------------------------------------------- diff -r 63be7eb3fc78 -r f28ada11abbf hotspotfw/rom/hotspot.iby --- a/hotspotfw/rom/hotspot.iby Tue Aug 31 16:18:40 2010 +0300 +++ b/hotspotfw/rom/hotspot.iby Wed Sep 01 12:20:32 2010 +0100 @@ -36,6 +36,12 @@ 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 63be7eb3fc78 -r f28ada11abbf hotspotfw/rom/hotspotResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/rom/hotspotResources.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,29 @@ +/* +* 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 63be7eb3fc78 -r f28ada11abbf hsfw_plat/hotspot_framework_client_api/group/bld.inf --- a/hsfw_plat/hotspot_framework_client_api/group/bld.inf Tue Aug 31 16:18:40 2010 +0300 +++ b/hsfw_plat/hotspot_framework_client_api/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -32,4 +32,4 @@ ../inc/hssmgmtscaninfo.h MW_LAYER_PLATFORM_EXPORT_PATH(hssmgmtscaninfo.h) ../inc/hssmgmtclient.inl MW_LAYER_PLATFORM_EXPORT_PATH(hssmgmtclient.inl) ../inc/hssmgmtscaninfo.inl MW_LAYER_PLATFORM_EXPORT_PATH(hssmgmtscaninfo.inl) - +../inc/hssiapsettings.inl MW_LAYER_PLATFORM_EXPORT_PATH(hssiapsettings.inl) diff -r 63be7eb3fc78 -r f28ada11abbf hsfw_plat/hotspot_framework_client_api/inc/hssiapsettings.h --- a/hsfw_plat/hotspot_framework_client_api/inc/hssiapsettings.h Tue Aug 31 16:18:40 2010 +0300 +++ b/hsfw_plat/hotspot_framework_client_api/inc/hssiapsettings.h Wed Sep 01 12:20:32 2010 +0100 @@ -30,6 +30,9 @@ const TInt KHssMaxMedTextLength = 255; const TUint8 KHssMaxSSIDLength = 32; const TUint32 KHssMaxWEPKeyLength = 29; +const TUint KHssGeneralStringMaxLength = 255; +const TUint KHssKeyIdentifierLength = 20; +const TUint KHssThumbprintMaxLength = 64; const TInt KHssMaxNumberOfKeys = 4; // DATA TYPES @@ -73,6 +76,138 @@ /** Array that stores the WEP key. */ TUint8 KeyMaterial[KHssMaxWEPKeyLength]; }; + + + + +/** +* class containing Certificate info for EAP settings +*/ +class THssCertificateEntry +{ +public: + + enum THssCertType + { + EUser, + ECA + }; + + THssCertificateEntry(); + + // Specifies whether this entry describes user or CA certificate (mandatory) + THssCertType iCertType; + + // Subject name in distinguished name ASCII form. + // For example "/C=US/O=Some organization/CN=Some common name". + TBool iSubjectNamePresent; + TBuf iSubjectName; + + // Issuer name in distinguished name ASCII form. + // For example "/C=US/O=Some organization/CN=Some common name". + TBool iIssuerNamePresent; + TBuf iIssuerName; + + // Serial number in ASCII form. + TBool iSerialNumberPresent; + TBuf iSerialNumber; + + // Subject key in binary form + TBool iSubjectKeyIDPresent; + TBuf8 iSubjectKeyID; + + // Thumbprint in binary form + TBool iThumbprintPresent; + TBuf iThumbprint; +}; + + +/** +* class containing EAP settings +*/ +class THssEapSettings +{ +public: + + enum THssEapType + { + EEapNone = 0, + EEapGtc = 6, + EEapTls = 13, + EEapLeap = 17, + EEapSim = 18, + EEapTtls = 21, + EEapAka = 23, + EEapPeap = 25, + EEapMschapv2 = 26, + EEapSecurid = 32, + EEapPlainMschapv2 = 99 + }; + + THssEapSettings(); + + void ExternalizeL( RWriteStream& aStream ) const; + + void InternalizeL( RReadStream& aStream ); + + // Specifies the EAP type these settings are for. + // Is not really needed but is here so just some sanity checks can be made + THssEapType iEAPType; + + // Username in ASCII format + TBool iUsernamePresent; + TBuf iUsername; + + // Password in ASCII format + TBool iPasswordPresent; + TBuf iPassword; + + // Realm in ASCII format + TBool iRealmPresent; + TBuf iRealm; + + // Use pseudonym identities in EAP-SIM/AKA + TBool iUsePseudonymsPresent; + TBool iUsePseudonyms; + + // Whether EAP-TLS/TTLS/PEAP should verify server realm + TBool iVerifyServerRealmPresent; + TBool iVerifyServerRealm; + + // Whether EAP-TLS/TTLS/PEAP should require client authentication + TBool iRequireClientAuthenticationPresent; + TBool iRequireClientAuthentication; + + // General session validity time (in minutes) + TBool iSessionValidityTimePresent; + TUint iSessionValidityTime; + + // An array of allowed cipher suites for EAP-TLS/TTLS/PEAP. + // Refer to RFC2246 chapter A.5 for the values. + TBool iCipherSuitesPresent; + TUint iCipherSuitesCount; + RArray iCipherSuites; + + // In EAP-PEAP is version 0 allowed + TBool iPEAPVersionsPresent; + TBool iPEAPv0Allowed; + TBool iPEAPv1Allowed; + TBool iPEAPv2Allowed; + + // Array listing the allowed certificates for EAP-TLS/TTLS/PEAP + TBool iCertificatesPresent; + TUint iCertificatesCount; + RPointerArray iCertificates; + + // Array listing the encapsulated EAP types (in priority order) + TBool iEncapsulatedEAPTypesPresent; + TUint iEncapsulatedEAPTypesCount; + RArray iEncapsulatedEAPTypes; + + // EAP type that this THssEapSettings type is encapsulated to + // Example: For EEapMschapv2 type this value could be EEapPeap + THssEapType iEncapsulatedInside; +}; /** * struct containing all wlan settings data @@ -81,7 +216,7 @@ { public: - + THssIapSettings(); TBuf Name; EHssConnectionMode iConnectionMode; @@ -102,8 +237,13 @@ TBuf8 iWPAPreSharedKey; TUint32 iWPAKeyLength; TBool iEnableWpaPsk; + + RPointerArray iEapDataArray; }; + +#include "hssiapsettings.inl" + #endif // HSSIAPSETTINGS_H // end of file diff -r 63be7eb3fc78 -r f28ada11abbf hsfw_plat/hotspot_framework_client_api/inc/hssiapsettings.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/hotspot_framework_client_api/inc/hssiapsettings.inl Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,161 @@ +/* +* 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: EAP and WLAN authentication protocols. +* +*/ + + + +inline THssCertificateEntry::THssCertificateEntry() +: iSubjectNamePresent(EFalse) +, iIssuerNamePresent(EFalse) +, iSerialNumberPresent(EFalse) +, iSubjectKeyIDPresent(EFalse) +, iThumbprintPresent(EFalse) + { + } + +inline THssEapSettings::THssEapSettings() +: iUsernamePresent(EFalse) +, iPasswordPresent(EFalse) +, iRealmPresent(EFalse) +, iVerifyServerRealmPresent(EFalse) +, iRequireClientAuthenticationPresent(EFalse) +, iSessionValidityTimePresent(EFalse) +, iCipherSuitesPresent(EFalse) +, iCipherSuites(1) +, iPEAPVersionsPresent(EFalse) +, iCertificatesPresent(EFalse) +, iCertificates(1) +, iEncapsulatedEAPTypesPresent(EFalse) +, iEncapsulatedEAPTypes(1) +, iEncapsulatedInside( EEapNone ) + { + } + +inline void THssEapSettings::ExternalizeL( RWriteStream& aStream ) const + { + aStream.WriteInt32L( iEAPType ); + aStream.WriteUint32L( iUsernamePresent ); + aStream << iUsername; + aStream.WriteUint32L( iPasswordPresent ); + aStream << iPassword; + aStream.WriteUint32L( iRealmPresent ); + aStream << iRealm; + aStream.WriteUint32L( iUsePseudonymsPresent ); + aStream.WriteUint32L( iUsePseudonyms ); + aStream.WriteUint32L( iVerifyServerRealmPresent ); + aStream.WriteUint32L( iVerifyServerRealm ); + aStream.WriteUint32L( iRequireClientAuthenticationPresent ); + aStream.WriteUint32L( iRequireClientAuthentication ); + aStream.WriteUint32L( iSessionValidityTimePresent ); + aStream.WriteUint32L( iSessionValidityTime ); + aStream.WriteUint32L( iCipherSuitesPresent ); + aStream.WriteUint32L( iCipherSuitesCount); + for( TInt i = 0; i < iCipherSuitesCount; i++ ) + { + aStream.WriteUint32L(iCipherSuites[i]); + } + aStream.WriteUint32L( iPEAPVersionsPresent ); + aStream.WriteUint32L( iPEAPv0Allowed ); + aStream.WriteUint32L( iPEAPv1Allowed ); + aStream.WriteUint32L( iPEAPv2Allowed ); + aStream.WriteUint32L( iCertificatesPresent ); + aStream.WriteUint32L( iCertificatesCount); + for( TInt i = 0; i < iCertificatesCount; i++ ) + { + aStream.WriteInt32L( iCertificates[i]->iCertType ); + aStream.WriteUint32L( iCertificates[i]->iSubjectNamePresent ); + aStream << iCertificates[i]->iSubjectName; + aStream.WriteUint32L( iCertificates[i]->iIssuerNamePresent ); + aStream << iCertificates[i]->iIssuerName; + aStream.WriteUint32L( iCertificates[i]->iSerialNumberPresent ); + aStream << iCertificates[i]->iSerialNumber; + aStream.WriteUint32L( iCertificates[i]->iSubjectKeyIDPresent ); + aStream << iCertificates[i]->iSubjectKeyID; + aStream.WriteUint32L( iCertificates[i]->iThumbprintPresent ); + aStream << iCertificates[i]->iThumbprint; + } + aStream.WriteUint32L( iEncapsulatedEAPTypesPresent ); + aStream.WriteUint32L( iEncapsulatedEAPTypesCount ); + for( TInt i = 0; i < iEncapsulatedEAPTypesCount; i++ ) + { + aStream.WriteUint32L( iEncapsulatedEAPTypes[i] ); + } + } + +inline void THssEapSettings::InternalizeL( RReadStream& aStream ) + { + iEAPType = static_cast(aStream.ReadInt32L()); + iUsernamePresent = aStream.ReadUint32L(); + aStream >>iUsername; + iPasswordPresent = aStream.ReadUint32L(); + aStream >>iPassword; + iRealmPresent = aStream.ReadUint32L(); + aStream >>iRealm; + iUsePseudonymsPresent = aStream.ReadUint32L(); + iUsePseudonyms = aStream.ReadUint32L(); + iVerifyServerRealmPresent = aStream.ReadUint32L(); + iVerifyServerRealm = aStream.ReadUint32L(); + iRequireClientAuthenticationPresent = aStream.ReadUint32L(); + iRequireClientAuthentication = aStream.ReadUint32L(); + iSessionValidityTimePresent = aStream.ReadUint32L(); + iSessionValidityTime = aStream.ReadUint32L(); + iCipherSuitesPresent = aStream.ReadUint32L(); + iCipherSuitesCount = aStream.ReadUint32L(); + for( TInt i = 0; i < iCipherSuitesCount; i++ ) + { + iCipherSuites.Append(aStream.ReadUint32L()); + } + iPEAPVersionsPresent = aStream.ReadUint32L(); + iPEAPv0Allowed = aStream.ReadUint32L(); + iPEAPv1Allowed = aStream.ReadUint32L(); + iPEAPv2Allowed = aStream.ReadUint32L(); + iCertificatesPresent = aStream.ReadUint32L(); + iCertificatesCount = aStream.ReadUint32L(); + for( TInt i = 0; i < iCertificatesCount; i++ ) + { + THssCertificateEntry* entry = new (ELeave) THssCertificateEntry(); + + entry->iCertType = static_cast(aStream.ReadInt32L()); + entry->iSubjectNamePresent = aStream.ReadUint32L(); + aStream >> entry->iSubjectName; + entry->iIssuerNamePresent = aStream.ReadUint32L(); + aStream >> entry->iIssuerName; + entry->iSerialNumberPresent= aStream.ReadUint32L(); + aStream >> entry->iSerialNumber; + entry->iSubjectKeyIDPresent = aStream.ReadUint32L(); + aStream >> entry->iSubjectKeyID; + entry->iThumbprintPresent = aStream.ReadUint32L(); + aStream >> entry->iThumbprint; + iCertificates.Insert(entry, i); + } + iEncapsulatedEAPTypesPresent = aStream.ReadUint32L(); + iEncapsulatedEAPTypesCount = aStream.ReadUint32L(); + for( TInt i = 0; i < iEncapsulatedEAPTypesCount; i++ ) + { + iEncapsulatedEAPTypes.Append(aStream.ReadUint32L()); + } + +} + +inline THssIapSettings::THssIapSettings() +: iConnectionMode(EHssInfrastructure) +, iSecurityMode( EHssAllowUnsecure ) +, iAuthenticationMode(EHssOpen) +, iEapDataArray(1) +{ +} + +// end of file diff -r 63be7eb3fc78 -r f28ada11abbf layers.sysdef.xml --- a/layers.sysdef.xml Tue Aug 31 16:18:40 2010 +0300 +++ b/layers.sysdef.xml Wed Sep 01 12:20:32 2010 +0100 @@ -1,13 +1,13 @@ - ]> - + - + diff -r 63be7eb3fc78 -r f28ada11abbf package_definition.xml --- a/package_definition.xml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 63be7eb3fc78 -r f28ada11abbf package_map.xml --- a/package_map.xml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ - diff -r 63be7eb3fc78 -r f28ada11abbf sysdef_1_4_0.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_4_0.dtd Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 63be7eb3fc78 -r f28ada11abbf sysdef_1_5_1.dtd --- a/sysdef_1_5_1.dtd Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 63be7eb3fc78 -r f28ada11abbf wirelessacc.pro --- a/wirelessacc.pro Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -# -# 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: -# Qt project file for wirelessacc package. -# - -TEMPLATE = subdirs - -CONFIG += ordered - -SUBDIRS += wlanutilities - -symbian { - BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include \"./group/bld.inf\"" -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/cpwlansettingsplugin/cpwlansettingsplugin.pro --- a/wlanutilities/cpwlansettingsplugin/cpwlansettingsplugin.pro Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +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 "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -TEMPLATE = lib -TARGET = cpwlansettingsplugin -CONFIG += hb plugin - -INCLUDEPATH += traces - -HEADERS += inc/cpwlansettingsplugin.h \ - inc/cpwlansettingsgroupitemdata.h \ - inc/wlansettings.h \ - inc/wlansettings_s60_p.h \ - traces/OstTraceDefinitions.h - -SOURCES += src/cpwlansettingsplugin.cpp \ - src/cpwlansettingsgroupitemdata.cpp \ - src/wlansettings.cpp \ - src/wlansettings_s60.cpp - -TRANSLATIONS = cpwlansettingsplugin.ts - -LIBS += -lcpframework \ - -lcentralrepository \ - -lCOMMSDAT \ - -lcmmanagerdatabase \ - -lcmmanager \ - -lecom \ - -lxqsettingsmanager - -# Temporary solution to fix tracecompiler -# When tracecompiler is fixed, this can be removed -symbian: { - MMP_RULES += "USERINCLUDE traces" -} - -symbian: { - TARGET.EPOCALLOWDLLDATA = 1 - TARGET.UID3 = 0x2002DC79 - - BLD_INF_RULES.prj_exports += "rom/cpwlansettingsplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(cpwlansettingsplugin.iby)" - BLD_INF_RULES.prj_exports += "rom/cpwlansettingsplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(cpwlansettingsplugin_resources.iby)" -} -symbian { - deploy.path = C: - qtplugins.path = /resource/qt/plugins/controlpanel - qtplugins.sources += qmakepluginstubs/cpwlansettingsplugin.qtplugin - - # This is for new exporting system coming in garden - for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin $$deploy.path$$qtplugins.path/$$basename(qtplugin)" -} -TARGET.CAPABILITY = CAP_GENERAL_DLL -plugin.sources = cpwlansettingsplugin.dll -plugin.path = /resource/qt/plugins/controlpanel -DEPLOYMENT += plugin diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/cpwlansettingsplugin/inc/cpwlansettingsgroupitemdata.h --- a/wlanutilities/cpwlansettingsplugin/inc/cpwlansettingsgroupitemdata.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +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 "Eclipse Public License v1.0"" -* which accompanies 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 WLANSETTINGSGROUPITEMDATA_H_ -#define WLANSETTINGSGROUPITEMDATA_H_ - -// System includes - -#include -#include -#include -#include - -// User includes - -// Forward declarations - -class WlanSettings; - -// External data types - -// Constants - -// Class declaration - -class CpWlanSettingsGroupItemData: public CpSettingFormItemData -{ - Q_OBJECT - -public: - explicit CpWlanSettingsGroupItemData(CpItemDataHelper &itemDataHelper); - - virtual ~CpWlanSettingsGroupItemData(); - -private slots: - void scanItemChanged(const QString &text); - - void powerSavingItemChanged(int index); - - void joinWlanItemChanged(int index); - - void scanSliderPressed(); - - void scanValueChanged(int value); - - void scanSliderReleased(); - - void devicePowerSavingChanged(); - -private: - - Q_DISABLE_COPY(CpWlanSettingsGroupItemData) - - void createScanIntervalItem(); - - void removeScanIntervalItem(); - - void initialise(); - - void createWlanSettingItems(); - -private: // data - - CpSettingFormItemData *mJoinWlanItem; - CpSettingFormItemData *mScanNetworkItem; - CpSettingFormItemData *mPowerSavingItem; - CpSettingFormItemData *mUserDefinedItem; - - CpItemDataHelper &mItemDataHelper; - - /*! - User defined scan interval. Not in use, while "Automatic" is - selected, but remembered so that it can be restored when - "User defined" mode is selected again. - */ - int mUserDefinedScanInterval; - - //! For loading and saving Wlan settings - QScopedPointer mWlanSettings; -}; - -#endif /* WLANSETTINGSGROUPITEMDATA_H_ */ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/cpwlansettingsplugin/inc/cpwlansettingsplugin.h --- a/wlanutilities/cpwlansettingsplugin/inc/cpwlansettingsplugin.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +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 "Eclipse Public License v1.0"" -* which accompanies 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 WLANSETTINGSPLUGIN_H_ -#define WLANSETTINGSPLUGIN_H_ - -// System includes - -#include -#include -#include - -// User includes - -// Forward declarations - -class HbTranslator; - -// External data types - -// Constants - -// Class declaration - -class CpWlanSettingsPlugin : public QObject, public CpPluginInterface -{ - Q_OBJECT - Q_INTERFACES(CpPluginInterface) - -public: - - // Data types - - CpWlanSettingsPlugin(); - - virtual ~CpWlanSettingsPlugin(); - - virtual QList createSettingFormItemData( - CpItemDataHelper &itemDataHelper) const; - -signals: - -public slots: - -protected: - -protected slots: - -private: - - Q_DISABLE_COPY(CpWlanSettingsPlugin) - -private slots: - -private: // data - - QScopedPointer mTranslator; //!< Translator for localisation - - // Friend classes -}; - -#endif /* WLANSETTINGSPLUGIN_H_ */ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/cpwlansettingsplugin/inc/wlansettings.h --- a/wlanutilities/cpwlansettingsplugin/inc/wlansettings.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +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 "Eclipse Public License v1.0"" -* which accompanies 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 WLANSETTINGS_H_ -#define WLANSETTINGS_H_ - -// System includes - -#include - -// User includes - -// Forward declarations - -class CWlanSettingsPrivate; -class XQSettingsManager; - -// External data types - -// Constants - -// Class declaration - -class WlanSettings : public QObject -{ - Q_OBJECT - -public: - - // Data types - - enum ScanNetworkType { - EScanNetworkAuto = 0, - EScanNetworkUserDefined - }; - - static const uint ScanNetworkAuto = 0xFFFFFFFF; - static const uint ScanNetworkMin = 1; - static const uint ScanNetworkMax = 30; - - WlanSettings(); - - ~WlanSettings(); - - int init(); - - int loadSettings(); - - ScanNetworkType scanNetworkType(); - - uint scanInterval(); - - int joinWlanMode() const; - - int setJoinWlanMode(int mode); - - bool isWlanPowerSavingEnabled() const; - - bool isDevicePowerSavingEnabled(); - - int setWlanPowerSaving(int powerSavingOption); - - int setWlanScanInterval(uint scanInterval); - -signals: - - void devicePowerSavingUpdated(); - -public slots: - -protected: - -protected slots: - -private: - - Q_DISABLE_COPY(WlanSettings) - - void readDevicePowerSavingKey(); - -private slots: - - void devicePowerSavingKeyChanged(); - -private: // data - - //! Private Symbian specific implementation. - CWlanSettingsPrivate *d_ptr; - - //! Settings manager for platform settings reading & status changes. - XQSettingsManager *mSettingsManager; - - //! Device Power Saving Mode. - int mDevicePowerSavingMode; - - //! Is mDevicePowerSavingMode up to date, or do we need to read it again? - bool mDevicePowerSavingModeUpToDate; -}; - -#endif /* WLANSETTINGS_H_ */ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/cpwlansettingsplugin/inc/wlansettings_s60_p.h --- a/wlanutilities/cpwlansettingsplugin/inc/wlansettings_s60_p.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +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 "Eclipse Public License v1.0"" -* which accompanies 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 WLANSETTINGS_S60_H_ -#define WLANSETTINGS_S60_H_ - -// System includes - -#include -#include -#include -#include -#include - -// User includes - -// Forward declarations - -class WlanSettings; - -// External data types - -// Constants - -// Class declaration - -class CWlanSettingsPrivate : public CBase -{ -public: - - enum JoinWlanType { - EJoinWlanKnown = 0, - EJoinWlanManual - }; - - enum WlanOption { - EWlanPowerSaving = 0, - EWlanScanInterval - }; - - static CWlanSettingsPrivate* NewL(WlanSettings *q_ptr); - - ~CWlanSettingsPrivate(); - - void LoadDBSettingsL(); - - void SaveDBSettingsL(TInt option); - - TUint ScanInterval(); - - TBool PowerSaving(); - - TInt JoinWlanMode(); - - void SaveJoinWlanSettingL(TInt mode); - - void SetScanInterval(TUint interval); - - void SetPowerSaving(TBool powerSavingOption); - -private: - - CWlanSettingsPrivate(WlanSettings *q_ptr); - - void ConstructL(); - - void LoadJoinWlanSettingL(); - -private: //data - - //! Pointer to public implementation. - WlanSettings *q_ptr; - - CommsDat::CMDBSession *mSession; - - //Wlan management - CWlanMgmtClient *mWlanMgmtClient; - - // Power saving. - TBool mPowerSaving; - - // Scan networks interval in seconds. 0 for no scan, 0xFFFFFFFF for automatic. - TUint mScanInterval; - - JoinWlanType mJoinWlanType; - - //Struct to hold current settings - TCmGenConnSettings mCmSettings; -}; - -#endif /* WLANSETTINGS_S60_H_ */ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/cpwlansettingsplugin/rom/cpwlansettingsplugin.iby --- a/wlanutilities/cpwlansettingsplugin/rom/cpwlansettingsplugin.iby Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +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 "Eclipse Public License v1.0" -* which accompanies 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 CPWLANSETTINGPLUGIN_IBY -#define CPWLANSETTINGPLUGIN_IBY - -#include -#include - -file=ABI_DIR/BUILD_DIR/cpwlansettingsplugin.dll SHARED_LIB_DIR/cpwlansettingsplugin.dll -data=/epoc32/data/c/resource/qt/plugins/controlpanel/cpwlansettingsplugin.qtplugin resource/qt/plugins/controlpanel/cpwlansettingsplugin.qtplugin - -#endif // CPWLANSETTINGPLUGIN_IBY diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/cpwlansettingsplugin/rom/cpwlansettingsplugin_resources.iby --- a/wlanutilities/cpwlansettingsplugin/rom/cpwlansettingsplugin_resources.iby Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +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 "Eclipse Public License v1.0" -* which accompanies 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 CPWLANSETTINGPLUGIN_RESOURCES_IBY -#define CPWLANSETTINGPLUGIN_RESOURCES_IBY - -#include -#include - -//For localization resource -data=DATAZ_/QT_TRANSLATIONS_DIR/cpwlansettingsplugin.qm QT_TRANSLATIONS_DIR/cpwlansettingsplugin.qm - -#endif // CPWLANSETTINGPLUGIN_RESOURCES_IBY diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/cpwlansettingsplugin/src/cpwlansettingsgroupitemdata.cpp --- a/wlanutilities/cpwlansettingsplugin/src/cpwlansettingsgroupitemdata.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,425 +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 "Eclipse Public License v1.0"" -* which accompanies 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 - -// User includes - -#include "cpwlansettingsgroupitemdata.h" -#include "wlansettings.h" - -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "cpwlansettingsgroupitemdataTraces.h" -#endif - -/*! - \class CpWlanSettingsGroupItemData - \brief CpWlanSettingsGroupItemData class creates all widgets required for Manage - WLAN Settings. -*/ - -// External function prototypes - -// Local constants - -//! To Enable the setting of a widget propery. */ -static const int KEnableOption = 1; -//! Maximum widgets allowed for this Item Data. */ -static const int KMaxWidgets = 4; -//! Index of Slider widget for Scan Interval. */ -static const int KSliderIndex = 2; -//! Default value for user defined scan interval -static const int KDefaultUserDefinedScanInterval = 5; - - -// ======== MEMBER FUNCTIONS ======== - -/*! - Constructor. -*/ - -CpWlanSettingsGroupItemData::CpWlanSettingsGroupItemData( - CpItemDataHelper &itemDataHelper) : - CpSettingFormItemData(HbDataFormModelItem::GroupItem, hbTrId( - "txt_occ_subhead_wlan_settings")), - mItemDataHelper(itemDataHelper) -{ - OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_CPWLANSETTINGSGROUPITEMDATA_ENTRY ); - - initialise(); - createWlanSettingItems(); - - OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_CPWLANSETTINGSGROUPITEMDATA_EXIT ); -} - -/*! - Destructor. -*/ - -CpWlanSettingsGroupItemData::~CpWlanSettingsGroupItemData() -{ - OstTraceFunctionEntry0( DUP1_CPWLANSETTINGSGROUPITEMDATA_CPWLANSETTINGSGROUPITEMDATA_ENTRY ); - OstTraceFunctionExit0( DUP1_CPWLANSETTINGSGROUPITEMDATA_CPWLANSETTINGSGROUPITEMDATA_EXIT ); -} - -/*! - Initialises the member variables and reads the values of WLAN Settings. -*/ - -void CpWlanSettingsGroupItemData::initialise() -{ - OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_INITIALISE_ENTRY ); - - mWlanSettings.reset(new WlanSettings); - - bool connectStatus = connect( - mWlanSettings.data(), - SIGNAL(devicePowerSavingUpdated()), - this, - SLOT(devicePowerSavingChanged())); - Q_ASSERT(connectStatus); - - //Error needs to be handled. - int error = mWlanSettings->init(); - - //Error needs to be handled. - error = mWlanSettings->loadSettings(); - - mUserDefinedScanInterval = KDefaultUserDefinedScanInterval; - mUserDefinedItem = NULL; - - OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_INITIALISE_EXIT ); -} - -/*! - Creates the Widgets for displaying WLAN Settings. -*/ - -void CpWlanSettingsGroupItemData::createWlanSettingItems() -{ - OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_CREATEWLANSETTINGITEMS_ENTRY ); - - mJoinWlanItem = new CpSettingFormItemData( - HbDataFormModelItem::ComboBoxItem, - hbTrId("txt_occ_setlabel_join_wlan_networks")); - // name the object for test automation purposes - mJoinWlanItem->setObjectName("switchToWlan"); - - QStringList joinWlanItems; - - joinWlanItems.append( - hbTrId("txt_occ_setlabel_join_wlan_networks_val_known")); - - joinWlanItems.append( - hbTrId("txt_occ_setlabel_join_wlan_networks_val_manual")); - - mJoinWlanItem->setContentWidgetData("items", joinWlanItems); - - mItemDataHelper.addConnection( - mJoinWlanItem, - SIGNAL(currentIndexChanged (int)), - this, - SLOT(joinWlanItemChanged (int))); - - mJoinWlanItem->setContentWidgetData( - "currentIndex", - mWlanSettings->joinWlanMode()); - - this->appendChild(mJoinWlanItem); - - mScanNetworkItem = new CpSettingFormItemData( - HbDataFormModelItem::ComboBoxItem, - hbTrId("txt_occ_setlabel_scan_for_networks")); - // name the object for test automation purposes - mScanNetworkItem->setObjectName("scanNetworkItem"); - - QStringList scanNetworkItems; - - scanNetworkItems.append( - hbTrId("txt_occ_setlabel_scan_for_networks_val_automatic")); - - scanNetworkItems.append( - hbTrId("txt_occ_setlabel_scan_for_networks_val_userdefine")); - - mScanNetworkItem->setContentWidgetData("items", scanNetworkItems); - - mItemDataHelper.addConnection( - mScanNetworkItem, - SIGNAL(currentIndexChanged (const QString &)), - this, - SLOT(scanItemChanged (const QString &))); - - this->appendChild(mScanNetworkItem); - - WlanSettings::ScanNetworkType scanType = mWlanSettings->scanNetworkType(); - - mScanNetworkItem->setContentWidgetData("currentIndex", scanType); - - //In case of PSM mode for device user-defined value is not - //allowed,make it automatic forcefully. - if (mWlanSettings->isDevicePowerSavingEnabled()) { - mScanNetworkItem->setContentWidgetData( - "currentIndex", - WlanSettings::EScanNetworkAuto); - mScanNetworkItem->setContentWidgetData("enabled", false); - } else if (scanType == WlanSettings::EScanNetworkUserDefined) { - createScanIntervalItem(); - } - - mPowerSavingItem = new CpSettingFormItemData( - HbDataFormModelItem::ComboBoxItem, - hbTrId("txt_occ_setlabel_power_saving")); - // name the object for test automation purposes - mPowerSavingItem->setObjectName("powerSaving"); - - QStringList powerSavingItems; - - powerSavingItems.append( - hbTrId("txt_occ_setlabel_power_saving_val_disabled")); - - powerSavingItems.append( - hbTrId("txt_occ_setlabel_power_saving_val_enabled")); - - mPowerSavingItem->setContentWidgetData("items", powerSavingItems); - - mPowerSavingItem->setContentWidgetData( - "currentIndex", - mWlanSettings->isWlanPowerSavingEnabled()); - - mItemDataHelper.addConnection( - mPowerSavingItem, - SIGNAL(currentIndexChanged (int)), - this, - SLOT(powerSavingItemChanged (int))); - - this->appendChild(mPowerSavingItem); - - OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_CREATEWLANSETTINGITEMS_EXIT ); -} - -/*! - Creates the slider widget for displaying scan interval value. -*/ - -void CpWlanSettingsGroupItemData::createScanIntervalItem() -{ - OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_CREATESCANINTERVALITEM_ENTRY ); - - //Add Scan Interval Slider, if it doesn't already exist. - if (this->childCount() < KMaxWidgets) { - mUserDefinedItem = new CpSettingFormItemData( - HbDataFormModelItem::SliderItem, - hbTrId("txt_occ_setlabel_scan_interval_minutes")); - - mUserDefinedItem->setContentWidgetData("maximum", WlanSettings::ScanNetworkMax); - mUserDefinedItem->setContentWidgetData("minimum", WlanSettings::ScanNetworkMin); - mUserDefinedItem->setContentWidgetData("toolTipVisible", KEnableOption); - mUserDefinedItem->setContentWidgetData("tracking", KEnableOption); - - mItemDataHelper.addConnection( - mUserDefinedItem, - SIGNAL(valueChanged (int)), - this, - SLOT(scanValueChanged (int))); - - mItemDataHelper.addConnection( - mUserDefinedItem, - SIGNAL(sliderReleased ()), - this, - SLOT(scanSliderReleased ())); - - mItemDataHelper.addConnection( - mUserDefinedItem, - SIGNAL(sliderPressed ()), - this, - SLOT(scanSliderPressed ())); - - int interval = mWlanSettings->scanInterval(); - if (interval == WlanSettings::ScanNetworkAuto) { - interval = mUserDefinedScanInterval; - } - mUserDefinedItem->setContentWidgetData("value", interval); - - this->insertChild(KSliderIndex, mUserDefinedItem); - } - - OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_CREATESCANINTERVALITEM_EXIT ); -} - -/*! - Removes the slider widget, if it exists. -*/ - -void CpWlanSettingsGroupItemData::removeScanIntervalItem() -{ - OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_REMOVESCANINTERVALITEM_ENTRY ); - - if (KMaxWidgets == this->childCount()) { - this->removeChild(KSliderIndex); - mUserDefinedItem = NULL; //removeChild() will delete the item. - } - - OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_REMOVESCANINTERVALITEM_EXIT ); -} - -/*! - Slot for handling pressed signal of scan interval slider widget. -*/ - -void CpWlanSettingsGroupItemData::scanSliderPressed() -{ - OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_SCANSLIDERPRESSED_ENTRY ); - - int interval = mWlanSettings->scanInterval(); - if (interval == WlanSettings::ScanNetworkAuto) { - interval = mUserDefinedScanInterval; - } - mUserDefinedItem->setContentWidgetData( - "text", - QString("%1").arg(interval)); - - OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_SCANSLIDERPRESSED_EXIT ); -} - -/*! - Slot for handling value changed signal of scan interval slider widget. -*/ - -void CpWlanSettingsGroupItemData::scanValueChanged(int value) -{ - OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_SCANVALUECHANGED_ENTRY ); - - mUserDefinedItem->setContentWidgetData("text",QString("%1").arg(value)); - mUserDefinedScanInterval = value; - - OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_SCANVALUECHANGED_EXIT ); -} - -/*! - Slot for handling Released signal of scan interval slider widget. - Current value will be commited to database. -*/ - -void CpWlanSettingsGroupItemData::scanSliderReleased() -{ - OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_SCANSLIDERRELEASED_ENTRY ); - - mWlanSettings->setWlanScanInterval(mUserDefinedScanInterval); - - OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_SCANSLIDERRELEASED_EXIT ); -} - -/*! - Slot for handling item changed signal of Scan for network combo box widget. -*/ - -void CpWlanSettingsGroupItemData::scanItemChanged(const QString &text) -{ - OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_SCANITEMCHANGED_ENTRY ); - - if (hbTrId("txt_occ_setlabel_scan_for_networks_val_userdefine") == text) { - // User defined mode - mWlanSettings->setWlanScanInterval(mUserDefinedScanInterval); - createScanIntervalItem(); - } else { - // Automatic mode - removeScanIntervalItem(); - mWlanSettings->setWlanScanInterval(WlanSettings::ScanNetworkAuto); - } - - OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_SCANITEMCHANGED_EXIT ); -} - -/*! - Slot for handling item changed signal of Power saving combo box widget. -*/ - -void CpWlanSettingsGroupItemData::powerSavingItemChanged(int index) -{ - OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_POWERSAVINGITEMCHANGED_ENTRY ); - - mWlanSettings->setWlanPowerSaving(index); - - OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_POWERSAVINGITEMCHANGED_EXIT ); -} - -/*! - Slot for handling item changed signal of Join WLAN networks combo box widget. -*/ - -void CpWlanSettingsGroupItemData::joinWlanItemChanged(int index) -{ - OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_JOINWLANITEMCHANGED_ENTRY ); - - mWlanSettings->setJoinWlanMode(index); - - OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_JOINWLANITEMCHANGED_EXIT ); -} - -/*! - Slot for handling device power saving mode update signal. -*/ - -void CpWlanSettingsGroupItemData::devicePowerSavingChanged() -{ - OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_DEVICEPOWERSAVINGCHANGED_ENTRY ); - - // Disconnect the handling of currentIndexChanged, because - // we will programmatically update the index in this function. - mItemDataHelper.removeConnection( - mScanNetworkItem, - SIGNAL(currentIndexChanged (const QString &)), - this, - SLOT(scanItemChanged (const QString &))); - - if (mWlanSettings->isDevicePowerSavingEnabled()) { - // If device power saving mode is activated, force the scan - // setting to automatic, and disable the setting combo box - mScanNetworkItem->setContentWidgetData( - "currentIndex", - WlanSettings::EScanNetworkAuto); - mScanNetworkItem->setContentWidgetData("enabled", false); - removeScanIntervalItem(); - } else { - // If device power saving mode is deactivated, enable the - // setting combo box, and make sure the setting is in the - // same mode it was before power saving mode was activated - mScanNetworkItem->setContentWidgetData("enabled", true); - if (mWlanSettings->scanNetworkType() == - WlanSettings::EScanNetworkUserDefined) { - mScanNetworkItem->setContentWidgetData( - "currentIndex", - WlanSettings::EScanNetworkUserDefined); - createScanIntervalItem(); - } - } - - // Reconnect the handling of currentIndexChanged since we are - // done with the updates. - mItemDataHelper.addConnection( - mScanNetworkItem, - SIGNAL(currentIndexChanged (const QString &)), - this, - SLOT(scanItemChanged (const QString &))); - - OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_DEVICEPOWERSAVINGCHANGED_EXIT ); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/cpwlansettingsplugin/src/cpwlansettingsplugin.cpp --- a/wlanutilities/cpwlansettingsplugin/src/cpwlansettingsplugin.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +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 "Eclipse Public License v1.0"" -* which accompanies 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 - -// User includes - -#include "cpwlansettingsplugin.h" -#include "cpwlansettingsgroupitemdata.h" - -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "cpwlansettingspluginTraces.h" -#endif - -/*! - \class CpWlanSettingsPlugin - \brief CpWlanSettingsPlugin implements the WLAN Settings Control Panel Plugin - which will allow viewing/editing of Manage WLAN Settings. -*/ - -// External function prototypes - -// Local constants - -// ======== MEMBER FUNCTIONS ======== - -/*! - Constructor. -*/ - -CpWlanSettingsPlugin::CpWlanSettingsPlugin() : - QObject(), - mTranslator(new HbTranslator("cpwlansettingsplugin")) -{ - OstTraceFunctionEntry0( CPWLANSETTINGSPLUGIN_CPWLANSETTINGSPLUGIN_ENTRY ); - OstTraceFunctionExit0( CPWLANSETTINGSPLUGIN_CPWLANSETTINGSPLUGIN_EXIT ); -} - -/*! - Destructor. -*/ - -CpWlanSettingsPlugin::~CpWlanSettingsPlugin() -{ - OstTraceFunctionEntry0( DUP1_CPWLANSETTINGSPLUGIN_CPWLANSETTINGSPLUGIN_ENTRY ); - OstTraceFunctionExit0( DUP1_CPWLANSETTINGSPLUGIN_CPWLANSETTINGSPLUGIN_EXIT ); -} - -/*! - Plugin function for creating the WLAN Settings form item data. -*/ - -QList CpWlanSettingsPlugin::createSettingFormItemData( - CpItemDataHelper &itemDataHelper) const -{ - OstTraceFunctionEntry0( CPWLANSETTINGSPLUGIN_CREATESETTINGFORMITEMDATA_ENTRY ); - - QList settingFormData; - settingFormData.append(new CpWlanSettingsGroupItemData(itemDataHelper)); - - OstTraceFunctionExit0( CPWLANSETTINGSPLUGIN_CREATESETTINGFORMITEMDATA_EXIT ); - return settingFormData; - -} - -Q_EXPORT_PLUGIN2(cpwlansettingsplugin, CpWlanSettingsPlugin); diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/cpwlansettingsplugin/src/wlansettings.cpp --- a/wlanutilities/cpwlansettingsplugin/src/wlansettings.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,302 +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 "Eclipse Public License v1.0"" -* which accompanies 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 - -// User includes - -#include "wlansettings_s60_p.h" -#include "wlansettings.h" - -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlansettingsTraces.h" -#endif - -/*! - \class WlanSettings - \brief WlanSettings is a wrapper class for CWlanSettingsImpl. -*/ - -// External function prototypes - -// Local constants - -//! Device Power Saving Mode setting key -static const XQSettingsKey devicePowerSavingKey( - XQSettingsKey::TargetCentralRepository, - KCRUidPowerSaveMode.iUid, - KPsmCurrentMode); - -// ======== MEMBER FUNCTIONS ======== - -/*! - Constructor. -*/ - -WlanSettings::WlanSettings() : - QObject(), - mSettingsManager(new XQSettingsManager(this)), - mDevicePowerSavingMode(0), - mDevicePowerSavingModeUpToDate(false) -{ - OstTraceFunctionEntry0( WLANSETTINGS_WLANSETTINGS_ENTRY ); - OstTraceFunctionExit0( WLANSETTINGS_WLANSETTINGS_EXIT ); -} - -/*! - Destructor. -*/ - -WlanSettings::~WlanSettings() -{ - OstTraceFunctionEntry0( DUP1_WLANSETTINGS_WLANSETTINGS_ENTRY ); - - delete d_ptr; - - OstTraceFunctionExit0( DUP1_WLANSETTINGS_WLANSETTINGS_EXIT ); -} - -/*! - Creates the CWlanSettingsImpl object for reading/writing settings. - \return Error code. -*/ - -int WlanSettings::init() -{ - OstTraceFunctionEntry0( WLANSETTINGS_INIT_ENTRY ); - - // Listen for changes in the key value - bool connectStatus = connect( - mSettingsManager, - SIGNAL(valueChanged(XQSettingsKey, QVariant)), - this, - SLOT(devicePowerSavingKeyChanged())); - Q_ASSERT(connectStatus); - mSettingsManager->startMonitoring(devicePowerSavingKey); - - TRAPD(error,(d_ptr = CWlanSettingsPrivate::NewL(this))); - - OstTraceFunctionExit0( WLANSETTINGS_INIT_EXIT ); - return error; -} - -/*! - Reads the value of the Device Power Saving Mode setting. -*/ - -void WlanSettings::readDevicePowerSavingKey() -{ - OstTraceFunctionEntry0( WLANSETTINGS_READDEVICEPOWERSAVINGKEY_ENTRY ); - - mDevicePowerSavingMode = - mSettingsManager->readItemValue(devicePowerSavingKey).toInt(); - - mDevicePowerSavingModeUpToDate = true; - - OstTrace1( - TRACE_NORMAL, - WLANSETTINGS_READDEVICEPOWERSAVINGKEY, - "WlanSettings::readDevicePowerSavingKey;powerSaving=%d", - mDevicePowerSavingMode ); - - OstTraceFunctionExit0( WLANSETTINGS_READDEVICEPOWERSAVINGKEY_EXIT ); -} - -/*! - Slot for handling updates in the Device Power Saving Mode setting. -*/ - -void WlanSettings::devicePowerSavingKeyChanged() -{ - OstTraceFunctionEntry0( WLANSETTINGS_DEVICEPOWERSAVINGKEYCHANGED_ENTRY ); - - // Remember that we need to read the setting value again before - // using it, and notify UI of the change. - mDevicePowerSavingModeUpToDate = false; - emit devicePowerSavingUpdated(); - - OstTraceFunctionExit0( WLANSETTINGS_DEVICEPOWERSAVINGKEYCHANGED_EXIT ); -} - -/*! - Reads the WLAN setting values. - \return Error code. -*/ - -int WlanSettings::loadSettings() -{ - OstTraceFunctionEntry0( WLANSETTINGS_LOADSETTINGS_ENTRY ); - - TRAPD(error, d_ptr->LoadDBSettingsL()); - - OstTrace1( - TRACE_NORMAL, - WLANSETTINGS_LOADSETTINGS, - "WlanSettings::loadSettings;error=%d", - error ); - - OstTraceFunctionExit0( WLANSETTINGS_LOADSETTINGS_EXIT ); - return error; -} - -/*! - Function to get the scan network type. - \return ScanNetworkType which is automatic or user-defined. -*/ - -WlanSettings::ScanNetworkType WlanSettings::scanNetworkType() -{ - OstTraceFunctionEntry0( WLANSETTINGS_SCANNETWORKTYPE_ENTRY ); - - ScanNetworkType scanType; - if (d_ptr->ScanInterval() == ScanNetworkAuto) { - scanType = EScanNetworkAuto; - } else { - scanType = EScanNetworkUserDefined; - } - - OstTrace1( - TRACE_NORMAL, - WLANSETTINGS_SCANNETWORKTYPE, - "WlanSettings::scanNetworkType;scanType=%d", - scanType ); - - OstTraceFunctionExit0( WLANSETTINGS_SCANNETWORKTYPE_EXIT ); - return scanType; -} - -/*! - Function to get the scan interval. - \return Scan interval in minutes. -*/ - -uint WlanSettings::scanInterval() -{ - OstTraceFunctionEntry0( WLANSETTINGS_SCANINTERVAL_ENTRY ); - - uint scanInterval = d_ptr->ScanInterval(); - - OstTrace1( - TRACE_NORMAL, - WLANSETTINGS_SCANINTERVAL, - "WlanSettings::scanInterval;scanInterval=%u", - scanInterval ); - - OstTraceFunctionExit0( WLANSETTINGS_SCANINTERVAL_EXIT ); - return scanInterval; -} - -/*! - Function to get Wlan Power Saving Option. - \return True if Power Saving option is enabled, otherwise False. -*/ - -bool WlanSettings::isWlanPowerSavingEnabled() const -{ - OstTraceFunctionEntry0( WLANSETTINGS_ISWLANPOWERSAVINGENABLED_ENTRY ); - OstTraceFunctionExit0( WLANSETTINGS_ISWLANPOWERSAVINGENABLED_EXIT ); - return d_ptr->PowerSaving(); -} - -/*! - Function to set Power Saving Option. - \param powerSavingOption True to enable or false to disable power saving option. - \return Error code. -*/ - -int WlanSettings::setWlanPowerSaving(int powerSavingOption) -{ - OstTraceFunctionEntry0( WLANSETTINGS_SETWLANPOWERSAVING_ENTRY ); - - d_ptr->SetPowerSaving(powerSavingOption); - TRAPD(error, d_ptr->SaveDBSettingsL(CWlanSettingsPrivate::EWlanPowerSaving)); - - OstTraceFunctionExit0( WLANSETTINGS_SETWLANPOWERSAVING_EXIT ); - return error; -} - -/*! - Function to set Scan interval. - \param scanInterval Scan interval in minutes. - \return Error code. -*/ - -int WlanSettings::setWlanScanInterval(uint scanInterval) -{ - OstTraceFunctionEntry0( WLANSETTINGS_SETWLANSCANINTERVAL_ENTRY ); - - d_ptr->SetScanInterval(scanInterval); - TRAPD(error, d_ptr->SaveDBSettingsL(CWlanSettingsPrivate::EWlanScanInterval)); - - OstTraceFunctionExit0( WLANSETTINGS_SETWLANSCANINTERVAL_EXIT ); - return error; -} - -/*! - Function to get Join WLAN networks option. - \return 0 for Known, 1 for Manual. -*/ - -int WlanSettings::joinWlanMode() const -{ - OstTraceFunctionEntry0( WLANSETTINGS_JOINWLANMODE_ENTRY ); - OstTraceFunctionExit0( WLANSETTINGS_JOINWLANMODE_EXIT ); - return d_ptr->JoinWlanMode(); -} - -/*! - Function to set Join WLAN networks option. - \param mode 0 for Known, 1 for Manual. - \return Error code. -*/ - -int WlanSettings::setJoinWlanMode(int mode) -{ - OstTraceFunctionEntry0( WLANSETTINGS_SETJOINWLANMODE_ENTRY ); - - TRAPD(error, d_ptr->SaveJoinWlanSettingL(mode)); - - OstTraceFunctionExit0( WLANSETTINGS_SETJOINWLANMODE_EXIT ); - return error; -} - -/*! - Function to get Power Saving status of the device. - \return True if Power Saving is enabled. -*/ - -bool WlanSettings::isDevicePowerSavingEnabled() -{ - OstTraceFunctionEntry0( WLANSETTINGS_ISDEVICEPOWERSAVINGENABLED_ENTRY ); - - if (!mDevicePowerSavingModeUpToDate) { - readDevicePowerSavingKey(); - } - if (mDevicePowerSavingMode == EPsmsrvModeNormal) { - OstTraceFunctionExit0( WLANSETTINGS_ISDEVICEPOWERSAVINGENABLED_EXIT ); - return false; - } else { - OstTraceFunctionExit0( DUP1_WLANSETTINGS_ISDEVICEPOWERSAVINGENABLED_EXIT ); - return true; - } -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/cpwlansettingsplugin/src/wlansettings_s60.cpp --- a/wlanutilities/cpwlansettingsplugin/src/wlansettings_s60.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,406 +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 "Eclipse Public License v1.0"" -* which accompanies 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 - -// User includes - -#include "wlansettings.h" -#include "wlansettings_s60_p.h" - -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlansettings_s60Traces.h" -#endif - -/*! - \class CWlanSettingsPrivate - \brief CWlanSettingsPrivate is the actual implementation for - reading/writing WLAN Settings from/to database. -*/ - -// External function prototypes - -// Local constants -/** Seconds per minute. */ -static const TInt KWlanSettingsSecondsInMinute = 60; -/** Default "Scan Networks" setting. */ -static const TUint KWlanSettingsDefaultScanNetwork = - WlanSettings::ScanNetworkAuto; -/** Default "Power saving" setting. */ -static const TBool KWlanSettingsDefaultPowerSaving = ETrue; - -// ======== MEMBER FUNCTIONS ======== - -/*! - Static NewL function for creating CWlanSettingsPrivate object. - \return Pointer to CWlanSettingsPrivate object. -*/ - -CWlanSettingsPrivate* CWlanSettingsPrivate::NewL(WlanSettings *q_ptr) -{ - OstTraceFunctionEntry0(CWLANSETINGPRIVATE_NEWL_ENTRY); - - CWlanSettingsPrivate* impl = new ( ELeave ) CWlanSettingsPrivate(q_ptr); - CleanupStack::PushL( impl ); - impl->ConstructL(); - CleanupStack::Pop( impl ); - - OstTraceFunctionExit0(CWLANSETINGPRIVATE_NEWL_EXIT); - return impl; -} - -/*! - Second phase Constructor. -*/ - -void CWlanSettingsPrivate::ConstructL() -{ - OstTraceFunctionEntry0(CWLANSETINGPRIVATE_CONSTRUCTL_ENTRY); - - mSession = CMDBSession::NewL( KCDLatestVersion ); - -#ifndef __WINS__ - mWlanMgmtClient = CWlanMgmtClient::NewL(); -#endif - - OstTraceFunctionExit0(CWLANSETINGPRIVATE_CONSTRUCTL_EXIT); -} - -/*! - Constructor. -*/ - -CWlanSettingsPrivate::CWlanSettingsPrivate(WlanSettings *q_ptr) : - q_ptr(q_ptr), - mPowerSaving(KWlanSettingsDefaultPowerSaving), - mScanInterval(KWlanSettingsDefaultScanNetwork) -{ - OstTraceFunctionEntry0(CWLANSETINGPRIVATE_CWLANSETINGPRIVATE_ENTRY); - OstTraceFunctionExit0(CWLANSETINGPRIVATE_CWLANSETINGPRIVATE_EXIT); -} - -/*! - Destructor. -*/ - -CWlanSettingsPrivate::~CWlanSettingsPrivate() -{ - OstTraceFunctionEntry0(DUP1_CWLANSETINGPRIVATE_CWLANSETINGPRIVATE_ENTRY); - - delete mSession; -#ifndef __WINS__ - delete mWlanMgmtClient; -#endif - - OstTraceFunctionExit0(DUP1_CWLANSETINGPRIVATE_CWLANSETINGPRIVATE_EXIT); -} - -/*! - Function to load the WLAN Settings from CommsDB. -*/ - -void CWlanSettingsPrivate::LoadDBSettingsL() -{ - OstTraceFunctionEntry0(CWLANSETINGPRIVATE_LOADDBSETTINGSL_ENTRY); - - TBool ownTransaction( EFalse ); - if ( !mSession->IsInTransaction() ) { - ownTransaction = ETrue; - mSession->OpenTransactionL(); - } - TMDBElementId tableId = 0; - - tableId = CCDWlanDeviceSettingsRecord::TableIdL( *mSession ); - - CCDWlanDeviceSettingsRecord* record = new( ELeave ) - CCDWlanDeviceSettingsRecord( tableId ); - CleanupStack::PushL( record ); - - record->iWlanDeviceSettingsType = KWlanUserSettings; - - if ( record->FindL( *mSession ) ) { - record->LoadL( *mSession ); - } - - // Read scan interval - OstTrace1( - TRACE_NORMAL, - CWLANSETTINGSPRIVATE_LOADDBSETTINGSL_SCANINTERVAL, - "CWlanSettingsPrivate::LoadDBSettingsL ScanInterval;iBgScanInterval=%u", - record->iBgScanInterval ); - OstTrace1( - TRACE_NORMAL, - CWLANSETTINGSPRIVATE_LOADDBSETTINGSL_SAVEDSCANINTERVAL, - "CWlanSettingsPrivate::LoadDBSettingsL SavedScanInterval;iSavedBgScanInterval=%u", - record->iSavedBgScanInterval ); - mScanInterval = record->iSavedBgScanInterval; - //Safe check for scan interval, control should not come here. - if (mScanInterval > (WlanSettings::ScanNetworkMax - * KWlanSettingsSecondsInMinute)) { - mScanInterval = WlanSettings::ScanNetworkAuto; - } - - // Read power saving mode - mPowerSaving = record->iWlanPowerMode; - OstTraceExt1( - TRACE_NORMAL, - CWLANSETTINGSPRIVATE_LOADDBSETTINGSL_POWERSAVE, - "CWlanSettingsPrivate::LoadDBSettingsL PowerSave;mPowerSaving=%hhu", - mPowerSaving ); - - CleanupStack::PopAndDestroy( record ); - - if ( ownTransaction ) { - mSession->CommitTransactionL(); - // Rollback operation. - } - - //To Load CM Settings. - LoadJoinWlanSettingL(); - - OstTraceFunctionExit0(CWLANSETINGPRIVATE_LOADDBSETTINGSL_EXIT); -} - -/*! - Function to load the Join WLAN networks Setting from CMManager. -*/ - -void CWlanSettingsPrivate::LoadJoinWlanSettingL() -{ - OstTraceFunctionEntry0(CWLANSETINGPRIVATE_LOADJOINWLANSETTINGL_ENTRY); - - RCmManager CmManager; - CmManager.CreateTablesAndOpenL(); - CleanupClosePushL(CmManager); - CmManager.ReadGenConnSettingsL( mCmSettings ); - CleanupStack::PopAndDestroy( 1 ); //CmManager - - OstTraceFunctionExit0(CWLANSETINGPRIVATE_LOADJOINWLANSETTINGL_EXIT); -} - -/*! - Function to write the Join WLAN networks Setting using CMManager. -*/ - -void CWlanSettingsPrivate::SaveJoinWlanSettingL(TInt mode) -{ - OstTraceFunctionEntry0(CWLANSETINGPRIVATE_SAVEJOINWLANSETTINGL_ENTRY); - - switch ( mode ) { - case EJoinWlanKnown: - mCmSettings.iUsageOfWlan = ECmUsageOfWlanKnown; - break; - - case EJoinWlanManual: - mCmSettings.iUsageOfWlan = ECmUsageOfWlanManual; - break; - - default: - break; - } - - RCmManager CmManager; - CmManager.CreateTablesAndOpenL(); - CleanupClosePushL(CmManager); - CmManager.WriteGenConnSettingsL( mCmSettings ); - CleanupStack::PopAndDestroy( 1 ); - - OstTraceFunctionExit0(CWLANSETINGPRIVATE_SAVEJOINWLANSETTINGL_EXIT); -} - -/*! - Function to get the Join WLAN network setting. - \return 0 for Known, 1 for Manual. -*/ - -TInt CWlanSettingsPrivate::JoinWlanMode() -{ - OstTraceFunctionEntry0(CWLANSETINGPRIVATE_JOINWLANMODE_ENTRY); - - TInt mode = 0; - - switch ( mCmSettings.iUsageOfWlan ) { - case ECmUsageOfWlanKnown: - mode = EJoinWlanKnown; - break; - - case ECmUsageOfWlanManual: - mode = EJoinWlanManual; - break; - - default: - break; - } - - OstTraceFunctionExit0(CWLANSETINGPRIVATE_JOINWLANMODE_EXIT); - return mode; -} - -/*! - Function to write the WLAN Settings to CommsDb. -*/ - -void CWlanSettingsPrivate::SaveDBSettingsL(TInt option) -{ - OstTraceFunctionEntry0(CWLANSETINGPRIVATE_SAVEDBSETTINGSL_ENTRY); - - TBool ownTransaction( EFalse ); - if ( !mSession->IsInTransaction() ) { - ownTransaction = ETrue; - mSession->OpenTransactionL(); - } - TMDBElementId tableId = 0; - tableId = CCDWlanDeviceSettingsRecord::TableIdL( *mSession ); - - CCDWlanDeviceSettingsRecord* record = new( ELeave ) - CCDWlanDeviceSettingsRecord( tableId ); - - CleanupStack::PushL( record ); - - record->iWlanDeviceSettingsType = KWlanUserSettings; - - if ( record->FindL( *mSession ) ) { - record->LoadL( *mSession ); - } - - switch (option) { - case EWlanScanInterval: - record->iBgScanInterval = mScanInterval; - if (!q_ptr->isDevicePowerSavingEnabled()) { - record->iSavedBgScanInterval = mScanInterval; - } - OstTrace1( - TRACE_NORMAL, - CWLANSETTINGSPRIVATE_SAVEDBSETTINGSL_SCANINTERVAL, - "CWlanSettingsPrivate::SaveDBSettingsL ScanInterval;iBgScanInterval=%u", - record->iBgScanInterval ); - OstTrace1( - TRACE_NORMAL, - CWLANSETTINGSPRIVATE_SAVEDBSETTINGSL_SAVEDSCANINTERVAL, - "CWlanSettingsPrivate::SaveDBSettingsL SavedScanInterval;iSavedBgScanInterval=%u", - record->iSavedBgScanInterval ); - break; - - case EWlanPowerSaving: - OstTraceExt1( - TRACE_NORMAL, - CWLANSETTINGSPRIVATE_SAVEDBSETTINGSL_POWERSAVING, - "CWlanSettingsPrivate::SaveDBSettingsL PowerSaving;mPowerSaving=%hhu", - mPowerSaving ); - - record->iWlanPowerMode = mPowerSaving; - break; - - default: - break; - } - - // Whenever settings are modified, iUseDefaultSettings must be set to false. - record->iUseDefaultSettings = EFalse; - - record->ModifyL( *mSession ); - - CleanupStack::PopAndDestroy( record ); - if ( ownTransaction ) { - mSession->CommitTransactionL(); - } - -#ifndef __WINS__ - // Notifying WLAN Engine about changes in settings - mWlanMgmtClient->NotifyChangedSettings(); -#endif - - OstTraceFunctionExit0(CWLANSETINGPRIVATE_SAVEDBSETTINGSL_EXIT); -} - -/*! - Function to get the scan interval. - \return Scan interval in minutes. -*/ - -TUint CWlanSettingsPrivate::ScanInterval() -{ - TUint retVal; - if ( mScanInterval == WlanSettings::ScanNetworkAuto ) { - retVal = mScanInterval; - } else { - // Return scan time in minutes - retVal = mScanInterval / KWlanSettingsSecondsInMinute; - } - - OstTrace1( - TRACE_NORMAL, - CWLANSETTINGSPRIVATE_SCANINTERVAL, - "CWlanSettingsPrivate::ScanInterval;retVal=%u", - retVal ); - - return retVal; -} - -/*! - Function to get Power Saving Option. - \return True if Power Saving option is enabled, otherwise False. -*/ - -TBool CWlanSettingsPrivate::PowerSaving() -{ - OstTraceExt1( - TRACE_NORMAL, - CWLANSETTINGSPRIVATE_POWERSAVING, - "CWlanSettingsPrivate::PowerSaving;mPowerSaving=%hhx", - mPowerSaving ); - - return mPowerSaving; -} - -/*! - Function to set Scan interval. - \param interval Scan interval in minutes. -*/ - -void CWlanSettingsPrivate::SetScanInterval(TUint interval) -{ - OstTraceFunctionEntry0(CWLANSETINGPRIVATE_SETSCANINTERVAL_ENTRY); - - if ( interval == WlanSettings::ScanNetworkAuto ) { - mScanInterval = interval; - } - else { - // Scan time stored in seconds - mScanInterval = interval * KWlanSettingsSecondsInMinute; - } - - OstTraceFunctionExit0(CWLANSETINGPRIVATE_SETSCANINTERVAL_EXIT); -} - -/*! - Function to set Power Saving Option. - \param powerSavingOption True to enable or false to disable power saving option. -*/ - -void CWlanSettingsPrivate::SetPowerSaving(TBool powerSavingOption) -{ - OstTraceFunctionEntry0(CWLANSETINGPRIVATE_SETPOWERSAVING_ENTRY); - - mPowerSaving = powerSavingOption; - - OstTraceFunctionExit0(CWLANSETINGPRIVATE_SETPOWERSAVING_EXIT); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/cpwlansettingsplugin/traces/OstTraceDefinitions.h --- a/wlanutilities/cpwlansettingsplugin/traces/OstTraceDefinitions.h Tue Aug 31 16:18:40 2010 +0300 +++ /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 63be7eb3fc78 -r f28ada11abbf wlanutilities/cpwlansettingsplugin/tsrc/main.cpp --- a/wlanutilities/cpwlansettingsplugin/tsrc/main.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +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 "Eclipse Public License v1.0"" -* which accompanies 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 "wlansettingstest.h" - - -int main(int /*argc*/, char *argv[]) -{ - WlanSettingsTest* test = new WlanSettingsTest; - - //Save test reults to a file - char *pass[3]; - pass[0] = argv[0]; - pass[1] = "-o"; - pass[2] = "c:\\data\\WlanSettingsTest.txt"; - - int res = QTest::qExec(test, 3, pass); - - delete test; - return res; -} - -#include "moc_wlansettingstest.cpp" diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.cpp --- a/wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,170 +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 "Eclipse Public License v1.0"" -* which accompanies 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 "wlansettingstest.h" - -//constructor -WlanSettingsTest::WlanSettingsTest() -{ - mSecuritySettings.reset(new WlanSettings); - - //Initialise the wlansettings - mSecuritySettings->init(); -} - - -//Test Scenario : 1 -void WlanSettingsTest::test_setWlanPowerMode() -{ - int powerSavingOption(ETrue); - - int error = mSecuritySettings->setWlanPowerSaving(powerSavingOption); - - QVERIFY(error == KErrNone); -} - -/////////////////////////////////////////Manual WLan joining Mode////////////////////////////////////////////////// - -//Test Scenario : 2 -void WlanSettingsTest::test_CheckJoinWlanModeManual() -{ - mJoinWlanMode = WlanSettings::EScanNetworkUserDefined; - int error = mSecuritySettings->setJoinWlanMode(mJoinWlanMode); - - QVERIFY(error == KErrNone); - - //Load the Settings - int loadError = mSecuritySettings->loadSettings(); - QVERIFY(loadError == KErrNone); - - //Verify Mode - int mode = mSecuritySettings->joinWlanMode(); - QVERIFY(mode == mJoinWlanMode ); -} - -/////////////////////////////////////////User-defined Scan Interval///////////////////////////////////// -//Test Scenario : 3 -void WlanSettingsTest::test_CheckWlanScanIntervalManual() -{ - - mScanIntervalManual = 16; - - //Set some user-defined Interval - int setError = mSecuritySettings->setWlanScanInterval(mScanIntervalManual); - QVERIFY(setError == KErrNone); - - //Load the Settings - int loadError = mSecuritySettings->loadSettings(); - QVERIFY(loadError == KErrNone); - - //Check if the interval set is right - uint scanIntervalset = mSecuritySettings->scanInterval(); - QVERIFY(scanIntervalset == mScanIntervalManual); - - //Verify the Network type, based on the scan interval set - int networkType = mSecuritySettings->scanNetworkType(); - QVERIFY(networkType == WlanSettings::EScanNetworkUserDefined); - -} - - -//////////////////////////////////////////Automatic WLAN joining Mode/////////////////////////////////////////// - -//Test Scenario : 4 -void WlanSettingsTest::test_CheckJoinWlanModeAuto() -{ - mJoinWlanMode = WlanSettings::EScanNetworkAuto; - int error = mSecuritySettings->setJoinWlanMode(mJoinWlanMode); - - QVERIFY(error == KErrNone); - - - //Load the Settings - int loadError = mSecuritySettings->loadSettings(); - QVERIFY(loadError == KErrNone); - - - //Verify Mode - int mode = mSecuritySettings->joinWlanMode(); - QVERIFY(mode == mJoinWlanMode ); - -} - -///////////////////////////////////////Automatic Scan Interval///////////////////////////////////////// -//Test Scenario : 5 -void WlanSettingsTest::test_CheckWlanScanIntervalAuto() -{ - uint KDefaultScanInterval(5); - - mScanIntervalAuto = WlanSettings::ScanNetworkAuto; - - //Set the Auto Interval - int setError = mSecuritySettings->setWlanScanInterval(mScanIntervalAuto); - QVERIFY(setError == KErrNone); - - //Load the Settings - int loadError = mSecuritySettings->loadSettings(); - QVERIFY(loadError == KErrNone); - - //Check the Auto Interval - uint scanIntervalset = mSecuritySettings->scanInterval(); - QVERIFY(scanIntervalset == KDefaultScanInterval ); - - //Verify the Network type, based on the scan interval set - int networkType = mSecuritySettings->scanNetworkType(); - QVERIFY(networkType == WlanSettings::EScanNetworkAuto); -} - -//Test Scenario : 6 -void WlanSettingsTest::test_CheckManualIntervalValidity() -{ - uint KDefaultScanInterval(5); - //Invalid User defined Interval - mScanIntervalManual = 45; - - int setError = mSecuritySettings->setWlanScanInterval(mScanIntervalManual); - QVERIFY(setError == KErrNone); - - //Load the Settings - int loadError = mSecuritySettings->loadSettings(); - QVERIFY(loadError == KErrNone); - - //Validate ;When User-defined Interval is invalid,Auto Interval should have been set - uint scanIntervalset = mSecuritySettings->scanInterval(); - QVERIFY(scanIntervalset == KDefaultScanInterval); - -} - -//Test Scenario : 7 -void WlanSettingsTest::test_CheckWlanPowerSavingMode() -{ - int wlanPowerSavingMode(ETrue); - - int setError = mSecuritySettings->setWlanPowerSaving(wlanPowerSavingMode); - QVERIFY(setError == KErrNone); - - //Verify Power saving mode parameter - int powerSavingMode = mSecuritySettings->isWlanPowerSavingEnabled(); - QVERIFY(powerSavingMode == wlanPowerSavingMode); -} - -//Delete data members -WlanSettingsTest::~WlanSettingsTest() -{ - -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.h --- a/wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +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 "Eclipse Public License v1.0"" -* which accompanies 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 WLANSETTINGSTEST_H_ -#define WLANSETTINGSTEST_H_ - - -#include -#include -#include "wlansettings.h" - -class WlanSettingsTest: public QObject -{ - Q_OBJECT - -public: - WlanSettingsTest(); - ~WlanSettingsTest(); - -private slots: - void test_setWlanPowerMode(); - - void test_CheckJoinWlanModeManual(); - - void test_CheckWlanScanIntervalManual(); - - void test_CheckJoinWlanModeAuto(); - - void test_CheckWlanScanIntervalAuto(); - - void test_CheckManualIntervalValidity(); - - void test_CheckWlanPowerSavingMode(); - -private: //data - - QScopedPointer mSecuritySettings; - uint mScanIntervalAuto; - uint mScanIntervalManual; - int mJoinWlanMode; - -}; - - -#endif /* WLANSETTINGSTEST_H_ */ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.loc --- a/wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.loc Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -// ============================================================================ -// * Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-03-03T16:18:22 -// * This file is generated by qmake and should not be modified by the -// * user. -// ============================================================================ - -#ifdef LANGUAGE_SC -#define STRING_r_short_caption "wlansettingstest" -#define STRING_r_caption "wlansettingstest" -#else -#define STRING_r_short_caption "wlansettingstest" -#define STRING_r_caption "wlansettingstest" -#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.pro --- a/wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.pro Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +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 "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -TEMPLATE = app -TARGET = wlansettingstest -QT += core \ - gui -HEADERS += wlansettingstest.loc \ - ../inc/wlansettings.h \ - ../inc/wlansettings_s60_p.h \ - ../traces/OstTraceDefinitions.h \ - wlansettingstest.h - -SOURCES += wlansettingstest.cpp \ - wlansettingstest.rss \ - wlansettingstest_reg.rss \ - main.cpp \ - ../src/wlansettings.cpp \ - ../src/wlansettings_s60.cpp - -FORMS += -RESOURCES += -symbian:TARGET.UID3 = 0xE05A6280 - -TARGET.CAPABILITY = All -TCB - -CONFIG += qtestlib -LIBS += -lCOMMSDAT \ - -lcommdb \ - -lcpframework \ - -lCOMMSDAT \ - -lcmmanagerdatabase \ - -lcmmanager \ - -lecom \ - -lxqsettingsmanager diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.rss --- a/wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.rss Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -// ============================================================================ -// * Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-03-03T16:18:22 -// * This file is generated by qmake and should not be modified by the -// * user. -// ============================================================================ - -#include -#include - -RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info - { - short_caption = STRING_r_short_caption; - caption_and_icon = - CAPTION_AND_ICON_INFO - { - caption = STRING_r_caption; - number_of_icons = 0; - icon_file = ""; - }; - } - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest_reg.rss --- a/wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest_reg.rss Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -// ============================================================================ -// * Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-03-03T16:18:22 -// * This file is generated by qmake and should not be modified by the -// * user. -// ============================================================================ - -#include -#include - -UID2 KUidAppRegistrationResourceFile -UID3 0xE05A6280 - -RESOURCE APP_REGISTRATION_INFO - { - app_file="wlansettingstest"; - localisable_resource_file="\\resource\\apps\\wlansettingstest"; - - } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/bwins/eapwizardu.def --- a/wlanutilities/eapwizard/bwins/eapwizardu.def Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -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 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/eabi/eapwizardu.def --- a/wlanutilities/eapwizard/eabi/eapwizardu.def Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -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 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/eapwizard.pro --- a/wlanutilities/eapwizard/eapwizard.pro Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +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 "Eclipse Public License v1.0" -# which accompanies 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 - -DOCML += \ - resources/occ_eap_wizard_01_02_04.docml \ - resources/occ_eap_wizard_03.docml \ - resources/occ_eap_wizard_05_07.docml \ - resources/occ_eap_wizard_06.docml \ - resources/occ_eap_wizard_08.docml - -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 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/inc/eapwizard.h --- a/wlanutilities/eapwizard/inc/eapwizard.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/inc/eapwizard_p.h --- a/wlanutilities/eapwizard/inc/eapwizard_p.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,183 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/inc/eapwizardpage.h --- a/wlanutilities/eapwizard/inc/eapwizardpage.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/inc/eapwizardpagecertca.h --- a/wlanutilities/eapwizard/inc/eapwizardpagecertca.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/inc/eapwizardpagecertuser.h --- a/wlanutilities/eapwizard/inc/eapwizardpagecertuser.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/inc/eapwizardpageidentity.h --- a/wlanutilities/eapwizard/inc/eapwizardpageidentity.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/inc/eapwizardpageinnertype.h --- a/wlanutilities/eapwizard/inc/eapwizardpageinnertype.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/inc/eapwizardpagenewpacstore.h --- a/wlanutilities/eapwizard/inc/eapwizardpagenewpacstore.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/inc/eapwizardpageoutertype.h --- a/wlanutilities/eapwizard/inc/eapwizardpageoutertype.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/inc/eapwizardpagepacstorepasswordconfirm.h --- a/wlanutilities/eapwizard/inc/eapwizardpagepacstorepasswordconfirm.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/inc/eapwizardpageusernamepassword.h --- a/wlanutilities/eapwizard/inc/eapwizardpageusernamepassword.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/inc/eapwizarduistrings.h --- a/wlanutilities/eapwizard/inc/eapwizarduistrings.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/resources/eapwizard_resource.qrc --- a/wlanutilities/eapwizard/resources/eapwizard_resource.qrc Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ - - - occ_eap_wizard_01_02_04.docml.bin - occ_eap_wizard_03.docml.bin - occ_eap_wizard_05_07.docml.bin - occ_eap_wizard_06.docml.bin - occ_eap_wizard_08.docml.bin - - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/resources/occ_eap_wizard_01_02_04.docml --- a/wlanutilities/eapwizard/resources/occ_eap_wizard_01_02_04.docml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - -
- - - - - -
diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/resources/occ_eap_wizard_03.docml --- a/wlanutilities/eapwizard/resources/occ_eap_wizard_03.docml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/resources/occ_eap_wizard_05_07.docml --- a/wlanutilities/eapwizard/resources/occ_eap_wizard_05_07.docml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - -
- - - - - -
diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/resources/occ_eap_wizard_06.docml --- a/wlanutilities/eapwizard/resources/occ_eap_wizard_06.docml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - -
- - - - - -
diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/resources/occ_eap_wizard_08.docml --- a/wlanutilities/eapwizard/resources/occ_eap_wizard_08.docml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - -
- - - - - -
diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/rom/eapwizard.iby --- a/wlanutilities/eapwizard/rom/eapwizard.iby Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/rom/eapwizard_resources.iby --- a/wlanutilities/eapwizard/rom/eapwizard_resources.iby Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/src/eapwizard.cpp --- a/wlanutilities/eapwizard/src/eapwizard.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/src/eapwizard_p.cpp --- a/wlanutilities/eapwizard/src/eapwizard_p.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,702 +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 "Eclipse Public License v1.0" - * which accompanies 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)) -{ - OstTraceFunctionEntry0( EAPWIZARDPRIVATE_EAPWIZARDPRIVATE_ENTRY ); - Q_ASSERT(wizardHelper); - createPages(); - OstTraceFunctionExit0( EAPWIZARDPRIVATE_EAPWIZARDPRIVATE_EXIT ); -} - -/*! - Destructor. - */ -EapWizardPrivate::~EapWizardPrivate() -{ - OstTraceFunctionEntry0( DUP1_EAPWIZARDPRIVATE_EAPWIZARDPRIVATE_ENTRY ); - OstTraceFunctionExit0( DUP1_EAPWIZARDPRIVATE_EAPWIZARDPRIVATE_EXIT ); -} - -/*! - See EapWizard::summary(). - */ -bool EapWizardPrivate::summary( - WlanWizardPlugin::Summary sum, - QString &item, - QString &value) -{ - OstTraceFunctionEntry0( EAPWIZARDPRIVATE_SUMMARY_ENTRY ); - 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; - - } - OstTraceFunctionExit0( EAPWIZARDPRIVATE_SUMMARY_EXIT ); - return ret; -} - -/*! - See EapWizard::storeSettings(). - - @return true - ok, false - failed - */ -bool EapWizardPrivate::storeSettings() -{ - OstTraceFunctionEntry0( EAPWIZARDPRIVATE_STORESETTINGS_ENTRY ); - 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; - } - - OstTraceFunctionExit0( EAPWIZARDPRIVATE_STORESETTINGS_EXIT ); - return ret; -} - -/*! - See WlanWizardPlugin::errorString(). - - Returns EAP spesific error string. - */ -QString EapWizardPrivate::errorString(int errorCode) -{ - OstTraceFunctionEntry0( EAPWIZARDPRIVATE_ERRORSTRING_ENTRY ); - 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(textId).arg(eapTypeToString(eapType)); - } - - OstTraceFunctionExit0( EAPWIZARDPRIVATE_ERRORSTRING_EXIT ); - 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 -{ - OstTraceFunctionEntry0( EAPWIZARDPRIVATE_CONFIGURATIONS_ENTRY ); - 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 - - OstTraceFunctionExit0( EAPWIZARDPRIVATE_CONFIGURATIONS_EXIT ); - 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) -{ - OstTraceFunctionEntry0( EAPWIZARDPRIVATE_SETCONFIGURATIONS_ENTRY ); -#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; - OstTraceFunctionExit0( EAPWIZARDPRIVATE_SETCONFIGURATIONS_EXIT ); -} - -/*! - @return pointer to EapQtConfigInterface. - */ -EapQtConfigInterface* EapWizardPrivate::eapConfigurationInterface() const -{ - OstTraceFunctionEntry0( EAPWIZARDPRIVATE_EAPCONFIGURATIONINTERFACE_ENTRY ); - Q_ASSERT(mEapConfIf.data()); - OstTraceFunctionExit0( EAPWIZARDPRIVATE_EAPCONFIGURATIONINTERFACE_EXIT ); - 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 -{ - OstTraceFunctionEntry0( EAPWIZARDPRIVATE_EAPTYPETOSTRING_ENTRY ); - 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; - } - - OstTraceFunctionExit0( EAPWIZARDPRIVATE_EAPTYPETOSTRING_EXIT ); - return locId; -} - -/*! - Accessor to WLAN Wizard Helper objects. - - @return a pointer to helper object. - */ -WlanWizardHelper *EapWizardPrivate::wizardHelper() const -{ - OstTraceFunctionEntry0( EAPWIZARDPRIVATE_WIZARDHELPER_ENTRY ); - Q_ASSERT(mWizardHelper); - OstTraceFunctionExit0( EAPWIZARDPRIVATE_WIZARDHELPER_EXIT ); - return mWizardHelper; -} - -/*! - Creates EAP Wizard pages and add those to the wizard framework. - */ -void EapWizardPrivate::createPages() -{ - OstTraceFunctionEntry0( EAPWIZARDPRIVATE_CREATEPAGES_ENTRY ); - 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)); - OstTraceFunctionExit0( EAPWIZARDPRIVATE_CREATEPAGES_EXIT ); -} - -/*! - Check whether selected outer type has inner method. - - @return true if inner method exists, false otherwise. - */ -bool EapWizardPrivate::hasInnerMethod() const -{ - OstTraceFunctionEntry0( EAPWIZARDPRIVATE_HASINNERMETHOD_ENTRY ); - int outerType = configurations(EapWizardPrivate::OuterType).toInt(); - bool ret = false; - - switch (outerType) { - case EapQtPluginHandle::PluginEapTtls: - case EapQtPluginHandle::PluginPeap: - case EapQtPluginHandle::PluginEapFast: - ret = true; - break; - } - - OstTraceFunctionExit0( EAPWIZARDPRIVATE_HASINNERMETHOD_EXIT ); - 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) -{ - OstTraceFunctionEntry0( EAPWIZARDPRIVATE_HANDLETLSMETHODSSETTINGS_ENTRY ); - // 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); - } - OstTraceFunctionExit0( EAPWIZARDPRIVATE_HANDLETLSMETHODSSETTINGS_EXIT ); -} - -/*! - Handles configurations for EAP-FAST. - - @param [in,out] eapConf EAP Configuration - - @param false in case of failure. - */ -bool EapWizardPrivate::handleEapFastSettings(EapQtConfig &eapConf) -{ - OstTraceFunctionEntry0( EAPWIZARDPRIVATE_HANDLEEAPFASTSETTINGS_ENTRY ); - 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; - } - - OstTraceFunctionExit0( EAPWIZARDPRIVATE_HANDLEEAPFASTSETTINGS_EXIT ); - return ret; -} - -/*! - Handles configurations for EAP-AKA and EAP-SIM. - - @param [in,out] eapConf EAP Configuration - */ -void EapWizardPrivate::handleEapAkaSimSettings(EapQtConfig &eapConf) -{ - OstTraceFunctionEntry0( EAPWIZARDPRIVATE_HANDLEEAPAKASIMSETTINGS_ENTRY ); - eapConf.setValue(EapQtConfig::UsernameAutomatic, true); - eapConf.setValue(EapQtConfig::RealmAutomatic, true); - OstTraceFunctionExit0( EAPWIZARDPRIVATE_HANDLEEAPAKASIMSETTINGS_EXIT ); -} - -/*! - Handles configurations for LEAP. - - @param [in,out] eapConf EAP Configuration - */ -void EapWizardPrivate::handleLeapSettings(EapQtConfig &eapConf) -{ - OstTraceFunctionEntry0( EAPWIZARDPRIVATE_HANDLELEAPSETTINGS_ENTRY ); - eapConf.setValue(EapQtConfig::UsernameAutomatic, false); - eapConf.setValue(EapQtConfig::Username, configurations(Username)); - eapConf.setValue(EapQtConfig::PasswordPrompt, false); - eapConf.setValue(EapQtConfig::Password, configurations(Password)); - OstTraceFunctionExit0( EAPWIZARDPRIVATE_HANDLELEAPSETTINGS_EXIT ); -} - -/*! - Store outer type settings. - - @param outerType reference to outertype - - @return false in case of failure. - */ -bool EapWizardPrivate::storeOuterTypeSettings(EapQtPluginHandle &outerType) -{ - OstTraceFunctionEntry0( EAPWIZARDPRIVATE_STOREOUTERTYPESETTINGS_ENTRY ); - 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)) { - OstTraceFunctionExit0( EAPWIZARDPRIVATE_STOREOUTERTYPESETTINGS_EXIT ); - 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(); - OstTraceFunctionExit0( DUP1_EAPWIZARDPRIVATE_STOREOUTERTYPESETTINGS_EXIT ); - return false; - } - - QList selectedOuterTypes; - selectedOuterTypes.append(outerType); - if (!mEapConfIf->setSelectedOuterTypes(selectedOuterTypes)){ - mEapConfIf->deleteConfiguration(); - OstTraceFunctionExit0( DUP2_EAPWIZARDPRIVATE_STOREOUTERTYPESETTINGS_EXIT ); - return false; - } - - OstTraceFunctionExit0( DUP3_EAPWIZARDPRIVATE_STOREOUTERTYPESETTINGS_EXIT ); - return true; -} - - -/*! - Store inner type settings if exists. - - @param outerType reference to outertype - - @return false in case of failure. - */ -bool EapWizardPrivate::storeInnerTypeSettings(EapQtPluginHandle &outerType) -{ - OstTraceFunctionEntry0( EAPWIZARDPRIVATE_STOREINNERTYPESETTINGS_ENTRY ); - 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; - } - } - OstTraceFunctionExit0( EAPWIZARDPRIVATE_STOREINNERTYPESETTINGS_EXIT ); - return ret; -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/src/eapwizardpage.cpp --- a/wlanutilities/eapwizard/src/eapwizardpage.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +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 "Eclipse Public License v1.0" - * which accompanies 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" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "eapwizardpageTraces.h" -#endif - - -/*! - \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) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGE_EAPWIZARDPAGE_ENTRY ); - OstTraceFunctionExit0( EAPWIZARDPAGE_EAPWIZARDPAGE_EXIT ); -} - -/*! - Destructor. - */ -EapWizardPage::~EapWizardPage() -{ - OstTraceFunctionEntry0( DUP1_EAPWIZARDPAGE_EAPWIZARDPAGE_ENTRY ); - mWizard = NULL; - OstTraceFunctionExit0( DUP1_EAPWIZARDPAGE_EAPWIZARDPAGE_EXIT ); -} - -/*! - See WlanWizardPage. - */ -int EapWizardPage::nextId(bool &removeFromStack) const -{ - OstTraceFunctionEntry0( EAPWIZARDPAGE_NEXTID_ENTRY ); - removeFromStack = false; - OstTraceFunctionExit0( EAPWIZARDPAGE_NEXTID_EXIT ); - 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 -{ - OstTraceFunctionEntry0( EAPWIZARDPAGE_LOADDOCMLSECTION_ENTRY ); - 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); - } - OstTraceFunctionExit0( EAPWIZARDPAGE_LOADDOCMLSECTION_EXIT ); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/src/eapwizardpagecertca.cpp --- a/wlanutilities/eapwizard/src/eapwizardpagecertca.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,201 +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 "Eclipse Public License v1.0" -* which accompanies 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" - -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "eapwizardpagecertcaTraces.h" -#endif - - -/*! - \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) -{ - OstTraceFunctionEntry0(EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_ENTRY); - OstTraceFunctionExit0(EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_EXIT); -} - -/*! - Destructor. - */ -EapWizardPageCertCa::~EapWizardPageCertCa() -{ - OstTraceFunctionEntry0(DUP1_EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_ENTRY); - OstTraceFunctionExit0(DUP1_EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_EXIT); -} - -/*! - See WlanWizardPage. - */ -HbWidget* EapWizardPageCertCa::initializePage() -{ - OstTraceFunctionEntry0(EAPWIZARDPAGECERTCA_INITIALIZEPAGE_ENTRY); - - 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) { - list << mCerts.at(i).value(EapQtCertificateInfo::CertificateLabel).toString(); - } - - // 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); - } - - OstTraceFunctionExit0(EAPWIZARDPAGECERTCA_INITIALIZEPAGE_EXIT); - return mWidget; -} - -/*! - Loads the required orientation of docml. - - @param [in] orientation Orientation to be loaded. - */ -void EapWizardPageCertCa::loadDocmlSection(Qt::Orientation orientation) -{ - OstTraceFunctionEntry0(EAPWIZARDPAGECERTCA_LOADDOCMLSECTION_ENTRY); - - EapWizardPage::loadDocmlSection( - mDocumentLoader.data(), - orientation, - ":/docml/occ_eap_wizard_01_02_04.docml", - "portrait_section", - "landscape_section"); - - OstTraceFunctionExit0(EAPWIZARDPAGECERTCA_LOADDOCMLSECTION_EXIT); -} - -/*! - See WlanWizardPage. - - @return next wizard page: - - EapWizardPage::PageCertificateUser: For EAP-TLS - - EapWizardPage::PageIdentity: For EAP-TTLS and PEAP - */ -int EapWizardPageCertCa::nextId() const -{ - OstTraceFunctionEntry0(EAPWIZARDPAGECERTCA_NEXTID_ENTRY); - - 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))); - } - - OstTraceFunctionExit0(EAPWIZARDPAGECERTCA_NEXTID_EXIT); - return id; -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/src/eapwizardpagecertuser.cpp --- a/wlanutilities/eapwizard/src/eapwizardpagecertuser.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,209 +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 "Eclipse Public License v1.0" - * which accompanies 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" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "eapwizardpagecertuserTraces.h" -#endif - - -/*! - \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) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGECERTUSER_EAPWIZARDPAGECERTUSER_ENTRY ); - OstTraceFunctionExit0( EAPWIZARDPAGECERTUSER_EAPWIZARDPAGECERTUSER_EXIT ); -} - -/*! - Destructor. - */ -EapWizardPageCertUser::~EapWizardPageCertUser() -{ - OstTraceFunctionEntry0( DUP1_EAPWIZARDPAGECERTUSER_EAPWIZARDPAGECERTUSER_ENTRY ); - OstTraceFunctionExit0( DUP1_EAPWIZARDPAGECERTUSER_EAPWIZARDPAGECERTUSER_EXIT ); -} - -/*! - See WlanWizardPage. - */ -HbWidget* EapWizardPageCertUser::initializePage() -{ - OstTraceFunctionEntry0( EAPWIZARDPAGECERTUSER_INITIALIZEPAGE_ENTRY ); - 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; - } - } - OstTraceFunctionExit0( EAPWIZARDPAGECERTUSER_INITIALIZEPAGE_EXIT ); - return mWidget; -} - -/*! - Loads the required orientation of docml. - - @param [in] orientation Orientation to be loaded. - */ -void EapWizardPageCertUser::loadDocmlSection(Qt::Orientation orientation) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGECERTUSER_LOADDOCMLSECTION_ENTRY ); - EapWizardPage::loadDocmlSection( - mDocumentLoader.data(), - orientation, - ":/docml/occ_eap_wizard_06.docml", - "portrait_section", - "landscape_section"); - OstTraceFunctionExit0( EAPWIZARDPAGECERTUSER_LOADDOCMLSECTION_EXIT ); -} - -/*! - See WlanWizardPage. - - @return next wizard page: EapWizardPage::PageIdentity - */ -int EapWizardPageCertUser::nextId() const -{ - OstTraceFunctionEntry0( EAPWIZARDPAGECERTUSER_NEXTID_ENTRY ); - mWizard->setConfigurations( - EapWizardPrivate::CertificateUser, - qVariantFromValue( - mCerts.at(mCertList->selected()))); - - OstTraceFunctionExit0( EAPWIZARDPAGECERTUSER_NEXTID_EXIT ); - return EapWizardPage::PageIdentity; -} - -/*! - See WlanWizardPage. - - Validates the content of the page. - - @return true if content is valid. - */ -bool EapWizardPageCertUser::showPage() -{ - OstTraceFunctionEntry0( EAPWIZARDPAGECERTUSER_SHOWPAGE_ENTRY ); - OstTraceFunctionExit0( EAPWIZARDPAGECERTUSER_SHOWPAGE_EXIT ); - return mValid; -} - -/*! - Handler for itemsSelected() signal from HbRadioButtonList. - - @param [in] index NOT USED - */ -void EapWizardPageCertUser::itemSelected(int index) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGECERTUSER_ITEMSELECTED_ENTRY ); - Q_UNUSED(index); - mValid = true; - mWizard->wizardHelper()->enableNextButton(mValid); - OstTraceFunctionExit0( EAPWIZARDPAGECERTUSER_ITEMSELECTED_EXIT ); -} - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/src/eapwizardpageidentity.cpp --- a/wlanutilities/eapwizard/src/eapwizardpageidentity.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,315 +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 "Eclipse Public License v1.0" - * which accompanies 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" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "eapwizardpageidentityTraces.h" -#endif - - -/*! - \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) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEIDENTITY_EAPWIZARDPAGEIDENTITY_ENTRY ); - OstTraceFunctionExit0( EAPWIZARDPAGEIDENTITY_EAPWIZARDPAGEIDENTITY_EXIT ); -} - -/*! - Destructor. - */ -EapWizardPageIdentity::~EapWizardPageIdentity() -{ - OstTraceFunctionEntry0( DUP1_EAPWIZARDPAGEIDENTITY_EAPWIZARDPAGEIDENTITY_ENTRY ); - OstTraceFunctionExit0( DUP1_EAPWIZARDPAGEIDENTITY_EAPWIZARDPAGEIDENTITY_EXIT ); -} - -/*! - See WlanWizardPage. - */ -HbWidget* EapWizardPageIdentity::initializePage() -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEIDENTITY_INITIALIZEPAGE_ENTRY ); - 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("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); - - OstTraceFunctionExit0( EAPWIZARDPAGEIDENTITY_INITIALIZEPAGE_EXIT ); - return mWidget; -} - -/*! - Loads the required orientation of docml. - - @param [in] orientation Orientation to be loaded. - */ -void EapWizardPageIdentity::loadDocmlSection(Qt::Orientation orientation) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEIDENTITY_LOADDOCMLSECTION_ENTRY ); - EapWizardPage::loadDocmlSection( - mDocumentLoader.data(), - orientation, - ":/docml/occ_eap_wizard_03.docml", - "portrait_section", - "landscape_section"); - OstTraceFunctionExit0( EAPWIZARDPAGEIDENTITY_LOADDOCMLSECTION_EXIT ); -} - -/*! - See WlanWizardPage. - - @return next wizard page: - - WlanWizardPage::PageProcessSettings: For EAP-TLS - - EapWizardPage::PageInnerTypeEapTtls: For EAP-TTLS - - EapWizardPage::PageInnerTypePeap: For PEAP - */ -int EapWizardPageIdentity::nextId() const -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEIDENTITY_NEXTID_ENTRY ); - 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()); - - OstTraceFunctionExit0( EAPWIZARDPAGEIDENTITY_NEXTID_EXIT ); - return id; -} - -/*! - See WlanWizardPage. - - Validates the content of the page. - - @return true if content is valid. - */ -bool EapWizardPageIdentity::showPage() -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEIDENTITY_SHOWPAGE_ENTRY ); - bool valid = false; - - if (validateGroup(mEditUsername, mCheckUsername, mValidatorUsername.data()) && - validateGroup(mEditRealm, mCheckRealm, mValidatorRealm.data())) { - valid = true; - } - - OstTraceFunctionExit0( EAPWIZARDPAGEIDENTITY_SHOWPAGE_EXIT ); - return valid; -} - -/*! - Slot for textChanged() signal from HbLineEdit. - - @param [in] text NOT USED. - */ -void EapWizardPageIdentity::textChanged(const QString & text) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEIDENTITY_TEXTCHANGED_ENTRY ); - Q_UNUSED(text); - mWizard->wizardHelper()->enableNextButton(showPage()); - OstTraceFunctionExit0( EAPWIZARDPAGEIDENTITY_TEXTCHANGED_EXIT ); -} - -/*! - Slot for stateChanged() signal from HbCheckBox. - - @param [in] state NOT USED. - */ -void EapWizardPageIdentity::stateChanged(int state ) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEIDENTITY_STATECHANGED_ENTRY ); - Q_UNUSED(state); - mEditUsername->setEnabled(!mCheckUsername->isChecked()); - mEditRealm->setEnabled(!mCheckRealm->isChecked()); - mWizard->wizardHelper()->enableNextButton(showPage()); - OstTraceFunctionExit0( EAPWIZARDPAGEIDENTITY_STATECHANGED_EXIT ); -} - -/*! - 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 -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEIDENTITY_VALIDATEGROUP_ENTRY ); - bool status = false; - if (checkBox->isChecked() || - checkBox->isChecked() == false && - EapQtValidator::StatusOk == validator->validate(edit->text())) { - status = true; - } - OstTraceFunctionExit0( EAPWIZARDPAGEIDENTITY_VALIDATEGROUP_EXIT ); - return status; -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/src/eapwizardpageinnertype.cpp --- a/wlanutilities/eapwizard/src/eapwizardpageinnertype.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,222 +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 "Eclipse Public License v1.0" - * which accompanies 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" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "eapwizardpageinnertypeTraces.h" -#endif - - - -/*! - \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) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEINNERTYPE_EAPWIZARDPAGEINNERTYPE_ENTRY ); - OstTraceFunctionExit0( EAPWIZARDPAGEINNERTYPE_EAPWIZARDPAGEINNERTYPE_EXIT ); -} - -/*! - Destructor. - */ -EapWizardPageInnerType::~EapWizardPageInnerType() -{ - OstTraceFunctionEntry0( DUP1_EAPWIZARDPAGEINNERTYPE_EAPWIZARDPAGEINNERTYPE_ENTRY ); - OstTraceFunctionExit0( DUP1_EAPWIZARDPAGEINNERTYPE_EAPWIZARDPAGEINNERTYPE_EXIT ); -} - -/*! - See WlanWizardPage. - */ -HbWidget* EapWizardPageInnerType::initializePage() -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEINNERTYPE_INITIALIZEPAGE_ENTRY ); - 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("txt_occ_title_select_innear_eap_type_for_1").arg( - mWizard->eapTypeToString( - mWizard->configurations( - EapWizardPrivate::OuterType).toInt()))); - - OstTraceFunctionExit0( EAPWIZARDPAGEINNERTYPE_INITIALIZEPAGE_EXIT ); - return mWidget; -} - -/*! - Loads the required orientation of docml. - - @param [in] orientation Orientation to be loaded. - */ -void EapWizardPageInnerType::loadDocmlSection(Qt::Orientation orientation) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEINNERTYPE_LOADDOCMLSECTION_ENTRY ); - EapWizardPage::loadDocmlSection( - mDocumentLoader.data(), - orientation, - ":/docml/occ_eap_wizard_01_02_04.docml", - "portrait_section", - "landscape_section"); - OstTraceFunctionExit0( EAPWIZARDPAGEINNERTYPE_LOADDOCMLSECTION_EXIT ); -} - -/*! - See WlanWizardPage. - - @return next wizard page: EapWizardPage::PageUsernamePassword - */ -int EapWizardPageInnerType::nextId() const -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEINNERTYPE_NEXTID_ENTRY ); - mWizard->setConfigurations( - EapWizardPrivate::InnerType, - mEapTypes.at(mRadio->selected())); - - OstTraceFunctionExit0( EAPWIZARDPAGEINNERTYPE_NEXTID_EXIT ); - return EapWizardPage::PageUsernamePassword; -} - -/*! - See WlanWizardPage. - - Validates the content of the page. - - @return true if content is valid. - */ -bool EapWizardPageInnerType::showPage() -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEINNERTYPE_SHOWPAGE_ENTRY ); - OstTraceFunctionExit0( EAPWIZARDPAGEINNERTYPE_SHOWPAGE_EXIT ); - return mValid; -} - -/*! - Handler for itemsSelected() signal from HbRadioButtonList. - - @param [in] index NOT USED - */ -void EapWizardPageInnerType::itemSelected(int index ) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEINNERTYPE_ITEMSELECTED_ENTRY ); - Q_UNUSED(index); - mValid = true; - mWizard->wizardHelper()->enableNextButton(mValid); - OstTraceFunctionExit0( EAPWIZARDPAGEINNERTYPE_ITEMSELECTED_EXIT ); -} - -/*! - 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) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEINNERTYPE_APPENDTOLIST_ENTRY ); - if (mWizard->eapConfigurationInterface()->isSupportedInnerType( - static_cast(mOuterType), innerType)) { - items << mWizard->eapTypeToString(innerType); - mEapTypes.append(innerType); - } - OstTraceFunctionExit0( EAPWIZARDPAGEINNERTYPE_APPENDTOLIST_EXIT ); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/src/eapwizardpagenewpacstore.cpp --- a/wlanutilities/eapwizard/src/eapwizardpagenewpacstore.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,206 +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 "Eclipse Public License v1.0" - * which accompanies 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" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "eapwizardpagenewpacstoreTraces.h" -#endif - - -/*! - \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) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGENEWPACSTORE_EAPWIZARDPAGENEWPACSTORE_ENTRY ); - OstTraceFunctionExit0( EAPWIZARDPAGENEWPACSTORE_EAPWIZARDPAGENEWPACSTORE_EXIT ); -} - -/*! - Destructor. - */ -EapWizardPageNewPacStore::~EapWizardPageNewPacStore() -{ - OstTraceFunctionEntry0( DUP1_EAPWIZARDPAGENEWPACSTORE_EAPWIZARDPAGENEWPACSTORE_ENTRY ); - OstTraceFunctionExit0( DUP1_EAPWIZARDPAGENEWPACSTORE_EAPWIZARDPAGENEWPACSTORE_EXIT ); -} - -/*! - See WlanWizardPage. - */ -HbWidget* EapWizardPageNewPacStore::initializePage() -{ - OstTraceFunctionEntry0( EAPWIZARDPAGENEWPACSTORE_INITIALIZEPAGE_ENTRY ); - 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); - } - OstTraceFunctionExit0( EAPWIZARDPAGENEWPACSTORE_INITIALIZEPAGE_EXIT ); - return mWidget; -} - -/*! - Loads the required orientation of docml. - - @param [in] orientation Orientation to be loaded. - */ -void EapWizardPageNewPacStore::loadDocmlSection(Qt::Orientation orientation) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGENEWPACSTORE_LOADDOCMLSECTION_ENTRY ); - EapWizardPage::loadDocmlSection( - mDocumentLoader.data(), - orientation, - ":/docml/occ_eap_wizard_05_07.docml", - "portrait_section", - "landscape_section"); - OstTraceFunctionExit0( EAPWIZARDPAGENEWPACSTORE_LOADDOCMLSECTION_EXIT ); -} - -/*! - See WlanWizardPage. - - Validates the content of the page. - - @return true if content is valid. - */ -bool EapWizardPageNewPacStore::showPage() -{ - OstTraceFunctionEntry0( EAPWIZARDPAGENEWPACSTORE_SHOWPAGE_ENTRY ); - bool valid = false; - if (mValidator->validate(mEditPasswordNew->text()) == EapQtValidator::StatusOk && - mEditPasswordNew->text() == mEditPasswordConfirm->text()) { - valid = true; - } - OstTraceFunctionExit0( EAPWIZARDPAGENEWPACSTORE_SHOWPAGE_EXIT ); - return valid; -} - -/*! - See WlanWizardPage. - - @return next wizard page: EapWizardPage::PageUsernamePassword - */ -int EapWizardPageNewPacStore::nextId() const -{ - OstTraceFunctionEntry0( EAPWIZARDPAGENEWPACSTORE_NEXTID_ENTRY ); - mWizard->setConfigurations(EapWizardPrivate::PacStorePassword, mEditPasswordNew->text()); - OstTraceFunctionExit0( EAPWIZARDPAGENEWPACSTORE_NEXTID_EXIT ); - return EapWizardPage::PageUsernamePassword; -} - -/*! - Slot for textChanged() signal from HbLineEdit. - - @param [in] text NOT USED. - */ -void EapWizardPageNewPacStore::textChanged(const QString &text) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGENEWPACSTORE_TEXTCHANGED_ENTRY ); - Q_UNUSED(text); - mWizard->wizardHelper()->enableNextButton(showPage()); - OstTraceFunctionExit0( EAPWIZARDPAGENEWPACSTORE_TEXTCHANGED_EXIT ); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/src/eapwizardpageoutertype.cpp --- a/wlanutilities/eapwizard/src/eapwizardpageoutertype.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,283 +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 "Eclipse Public License v1.0" - * which accompanies 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" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "eapwizardpageoutertypeTraces.h" -#endif - - -/*! - \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) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEOUTERTYPE_EAPWIZARDPAGEOUTERTYPE_ENTRY ); - OstTraceFunctionExit0( EAPWIZARDPAGEOUTERTYPE_EAPWIZARDPAGEOUTERTYPE_EXIT ); -} - -/*! - Destructor. - */ -EapWizardPageOuterType::~EapWizardPageOuterType() -{ - OstTraceFunctionEntry0( DUP1_EAPWIZARDPAGEOUTERTYPE_EAPWIZARDPAGEOUTERTYPE_ENTRY ); - OstTraceFunctionExit0( DUP1_EAPWIZARDPAGEOUTERTYPE_EAPWIZARDPAGEOUTERTYPE_EXIT ); -} - -/*! - See WlanWizardPage. - */ -HbWidget* EapWizardPageOuterType::initializePage() -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEOUTERTYPE_INITIALIZEPAGE_ENTRY ); - 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); - } - OstTraceFunctionExit0( EAPWIZARDPAGEOUTERTYPE_INITIALIZEPAGE_EXIT ); - return mWidget; -} - -/*! - Loads the required orientation of docml. - - @param [in] orientation Orientation to be loaded. - */ -void EapWizardPageOuterType::loadDocmlSection(Qt::Orientation orientation) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEOUTERTYPE_LOADDOCMLSECTION_ENTRY ); - EapWizardPage::loadDocmlSection( - mDocumentLoader.data(), - orientation, - ":/docml/occ_eap_wizard_01_02_04.docml", - "portrait_section", - "landscape_section"); - OstTraceFunctionExit0( EAPWIZARDPAGEOUTERTYPE_LOADDOCMLSECTION_EXIT ); -} - -/*! - 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 -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEOUTERTYPE_NEXTID_ENTRY ); - 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); - - OstTraceFunctionExit0( EAPWIZARDPAGEOUTERTYPE_NEXTID_EXIT ); - return id; -} - -/*! - See WlanWizardPage. - - Validates the content of the page. - - @return true if content is valid. - */ -bool EapWizardPageOuterType::showPage() -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEOUTERTYPE_SHOWPAGE_ENTRY ); - OstTraceFunctionExit0( EAPWIZARDPAGEOUTERTYPE_SHOWPAGE_EXIT ); - return mValid; -} - -/*! - Slot for itemSelected() signal from HbRadioButtonList. - - @param [in] index NOT USED. - */ -void EapWizardPageOuterType::itemSelected(int index) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEOUTERTYPE_ITEMSELECTED_ENTRY ); - Q_UNUSED(index); - mValid = true; - mWizard->wizardHelper()->enableNextButton(mValid); - OstTraceFunctionExit0( EAPWIZARDPAGEOUTERTYPE_ITEMSELECTED_EXIT ); -} - -/*! - 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) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEOUTERTYPE_APPENDTOLIST_ENTRY ); - if (mWizard->eapConfigurationInterface()->isSupportedOuterType( - (EapQtPluginHandle::Plugin)pluginHandle)) { - items << mWizard->eapTypeToString(pluginHandle); - mEapTypes.append(pluginHandle); - } - OstTraceFunctionExit0( EAPWIZARDPAGEOUTERTYPE_APPENDTOLIST_EXIT ); -} - -/* - Getter for next page id when outer eap type is EAP-FAST. - - @return Page ID. - */ -int EapWizardPageOuterType::nextIdForEapFast() const -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEOUTERTYPE_NEXTIDFOREAPFAST_ENTRY ); - 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; - } - - OstTraceFunctionExit0( EAPWIZARDPAGEOUTERTYPE_NEXTIDFOREAPFAST_EXIT ); - return pageId; -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/src/eapwizardpagepacstorepasswordconfirm.cpp --- a/wlanutilities/eapwizard/src/eapwizardpagepacstorepasswordconfirm.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,206 +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 "Eclipse Public License v1.0" - * which accompanies 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" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "eapwizardpagepacstorepasswordconfirmTraces.h" -#endif - - -/*! - \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) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_ENTRY ); - OstTraceFunctionExit0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_EXIT ); -} - -/*! - Destructor. - */ -EapWizardPagePacStorePasswordConfirm::~EapWizardPagePacStorePasswordConfirm() -{ - OstTraceFunctionEntry0( DUP1_EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_ENTRY ); - OstTraceFunctionExit0( DUP1_EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_EXIT ); -} - -/*! - See WlanWizardPage. - */ -HbWidget* EapWizardPagePacStorePasswordConfirm::initializePage() -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_INITIALIZEPAGE_ENTRY ); - 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); - } - - OstTraceFunctionExit0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_INITIALIZEPAGE_EXIT ); - return mWidget; -} - - -/*! - Loads the required orientation of docml. - - @param [in] orientation Orientation to be loaded. - */ -void EapWizardPagePacStorePasswordConfirm::loadDocmlSection(Qt::Orientation orientation) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_LOADDOCMLSECTION_ENTRY ); - EapWizardPage::loadDocmlSection( - mDocumentLoader.data(), - orientation, - ":/docml/occ_eap_wizard_08.docml", - "portrait_section", - "landscape_section"); - OstTraceFunctionExit0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_LOADDOCMLSECTION_EXIT ); -} - -/*! - See WlanWizardPage. - - @return next wizard page: - - EapWizardPage::PageUsernamePassword: When password is ok - - WlanWizardPage::PageNone: When password is not ok - */ -int EapWizardPagePacStorePasswordConfirm::nextId() const -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_NEXTID_ENTRY ); - 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")); - } - - OstTraceFunctionExit0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_NEXTID_EXIT ); - return id; -} - -/*! - See WlanWizardPage::showPage(). - - Sets the focus to line editor, opens virtual keyboard. - - @return true, content is valid always. - */ -bool EapWizardPagePacStorePasswordConfirm::showPage() -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_SHOWPAGE_ENTRY ); - mEditPasswordConfirm->setFocus(); - OstTraceFunctionExit0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_SHOWPAGE_EXIT ); - 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) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_EVENTFILTER_ENTRY ); - if (obj == mEditPasswordConfirm && event->type() == QEvent::FocusIn) { - mLabelError->setPlainText(""); - } - OstTraceFunctionExit0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_EVENTFILTER_EXIT ); - return false; -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/src/eapwizardpageusernamepassword.cpp --- a/wlanutilities/eapwizard/src/eapwizardpageusernamepassword.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,228 +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 "Eclipse Public License v1.0" - * which accompanies 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" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "eapwizardpageusernamepasswordTraces.h" -#endif - - -/*! - \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) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEUSERNAMEPASSWORD_EAPWIZARDPAGEUSERNAMEPASSWORD_ENTRY ); - OstTraceFunctionExit0( EAPWIZARDPAGEUSERNAMEPASSWORD_EAPWIZARDPAGEUSERNAMEPASSWORD_EXIT ); -} - -/*! - Destructor. - */ -EapWizardPageUsernamePassword::~EapWizardPageUsernamePassword() -{ - OstTraceFunctionEntry0( DUP1_EAPWIZARDPAGEUSERNAMEPASSWORD_EAPWIZARDPAGEUSERNAMEPASSWORD_ENTRY ); - OstTraceFunctionExit0( DUP1_EAPWIZARDPAGEUSERNAMEPASSWORD_EAPWIZARDPAGEUSERNAMEPASSWORD_EXIT ); -} - -/*! - See WlanWizardPage. - */ -HbWidget* EapWizardPageUsernamePassword::initializePage() -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEUSERNAMEPASSWORD_INITIALIZEPAGE_ENTRY ); - 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("txt_occ_setlabel_user_name_for_1").arg( - mWizard->eapTypeToString(eapType))); - - OstTraceFunctionExit0( EAPWIZARDPAGEUSERNAMEPASSWORD_INITIALIZEPAGE_EXIT ); - return mWidget; -} - -/*! - Loads the required orientation of docml. - - @param [in] orientation Orientation to be loaded. - */ -void EapWizardPageUsernamePassword::loadDocmlSection(Qt::Orientation orientation) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEUSERNAMEPASSWORD_LOADDOCMLSECTION_ENTRY ); - EapWizardPage::loadDocmlSection( - mDocumentLoader.data(), - orientation, - ":/docml/occ_eap_wizard_05_07.docml", - "portrait_section", - "landscape_section"); - OstTraceFunctionExit0( EAPWIZARDPAGEUSERNAMEPASSWORD_LOADDOCMLSECTION_EXIT ); -} - -/*! - See WlanWizardPage. - - Validates the content of the page. - - @return true if content is valid. - */ -bool EapWizardPageUsernamePassword::showPage() -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEUSERNAMEPASSWORD_SHOWPAGE_ENTRY ); - bool valid = false; - if (mValidatorUsername->validate(mEditUsername->text()) == - EapQtValidator::StatusOk && - mValidatorPassword->validate(mEditPassword->text()) == - EapQtValidator::StatusOk) { - valid = true; - } - OstTraceFunctionExit0( EAPWIZARDPAGEUSERNAMEPASSWORD_SHOWPAGE_EXIT ); - return valid; -} - -/*! - See WlanWizardPage. - - @return next wizard page: EapWizardPage::PageProcessSettings - */ -int EapWizardPageUsernamePassword::nextId() const -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEUSERNAMEPASSWORD_NEXTID_ENTRY ); - mWizard->setConfigurations(EapWizardPrivate::Username, mEditUsername->text()); - mWizard->setConfigurations(EapWizardPrivate::Password, mEditPassword->text()); - OstTraceFunctionExit0( EAPWIZARDPAGEUSERNAMEPASSWORD_NEXTID_EXIT ); - return EapWizardPage::PageProcessSettings; -} - -/*! - Slot for textChanged() signal from HbLineEdit. - - @param [in] text NOT USED. - */ -void EapWizardPageUsernamePassword::textChanged(const QString & text ) -{ - OstTraceFunctionEntry0( EAPWIZARDPAGEUSERNAMEPASSWORD_TEXTCHANGED_ENTRY ); - Q_UNUSED(text); - mWizard->wizardHelper()->enableNextButton(showPage()); - OstTraceFunctionExit0( EAPWIZARDPAGEUSERNAMEPASSWORD_TEXTCHANGED_EXIT ); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/traces/OstTraceDefinitions.h --- a/wlanutilities/eapwizard/traces/OstTraceDefinitions.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/eapwizard/traces/trace.properties --- a/wlanutilities/eapwizard/traces/trace.properties Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ - - - - OuterType - InnerType - CertificateCa - CertificateUser - TunnelUsernameAutomatic - TunnelUsername - TunnelRealmAutomatic - TunnelRealm - Username - Password - PacStorePassword - PacStoreState - - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2001-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: Build information for wlanutilities +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +#include "../wlanplugin/group/bld.inf" +#include "../wlansettingsui/group/bld.inf" +#include "../wlansniffer/group/bld.inf" +#include "../wlanindicatorplugin/group/bld.inf" + + +PRJ_TESTMMPFILES \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/testwizard/inc/FirstView.h --- a/wlanutilities/testwizard/inc/FirstView.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/testwizard/inc/MyAppEngine.h --- a/wlanutilities/testwizard/inc/MyAppEngine.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/testwizard/inc/MyAppMainWindow.h --- a/wlanutilities/testwizard/inc/MyAppMainWindow.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/testwizard/inc/MyApplication.h --- a/wlanutilities/testwizard/inc/MyApplication.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/testwizard/resources/mainview.docml --- a/wlanutilities/testwizard/resources/mainview.docml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/testwizard/resources/resource.qrc --- a/wlanutilities/testwizard/resources/resource.qrc Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - - - mainview.docml.bin - - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/testwizard/rom/testwizard.iby --- a/wlanutilities/testwizard/rom/testwizard.iby Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/testwizard/src/FirstView.cpp --- a/wlanutilities/testwizard/src/FirstView.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +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 "Eclipse Public License v1.0" -* which accompanies 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"); - - 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(), - 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/testwizard/src/MyAppEngine.cpp --- a/wlanutilities/testwizard/src/MyAppEngine.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/testwizard/src/MyAppMainWindow.cpp --- a/wlanutilities/testwizard/src/MyAppMainWindow.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/testwizard/src/MyApplication.cpp --- a/wlanutilities/testwizard/src/MyApplication.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/testwizard/src/main.cpp --- a/wlanutilities/testwizard/src/main.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/testwizard/testwizard.pro --- a/wlanutilities/testwizard/testwizard.pro Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +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 "Eclipse Public License v1.0" -# which accompanies 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 - -DOCML += resources/mainview.docml - -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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanentryplugin/inc/cpwlanentryitemdata.h --- a/wlanutilities/wlanentryplugin/inc/cpwlanentryitemdata.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +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: -* WLAN Entry plugin item data implementation. -*/ - -#ifndef CPWLANENTRYITEMDATA_H -#define CPWLANENTRYITEMDATA_H - -// System includes - -#include "cpsettingformentryitemdata.h" - -// User includes - -// Forward declarations - -class WlanStatusInfo; - -// External data types - -// Constants - -// Class declaration - -class CpWlanEntryItemData : public CpSettingFormEntryItemData -{ - Q_OBJECT - -public: - - // Data types - - explicit CpWlanEntryItemData(CpItemDataHelper &itemDataHelper); - - virtual ~CpWlanEntryItemData(); - -signals: - -public slots: - -protected: - -protected slots: - -private: - - Q_DISABLE_COPY(CpWlanEntryItemData) - - virtual CpBaseSettingView *createSettingView() const; - -private slots: - - void statusUpdate(); - -private: // data - - WlanStatusInfo *mWlanStatusInfo; //!< WLAN status info handler - - // Friend classes - -}; - -#endif // CPWLANENTRYITEMDATA_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanentryplugin/inc/cpwlanentryplugin.h --- a/wlanutilities/wlanentryplugin/inc/cpwlanentryplugin.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +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: -* WLAN Entry plugin implementation. -*/ - -#ifndef CPWLANENTRYPLUGIN_H -#define CPWLANENTRYPLUGIN_H - -// System includes - -#include -#include -#include - -// User includes - -// Forward declarations - -class HbTranslator; - -// External data types - -// Constants - -// Class declaration - -class CpWlanEntryPlugin : public QObject, public CpPluginInterface -{ - Q_OBJECT - Q_INTERFACES(CpPluginInterface) - -public: - - // Data types - - CpWlanEntryPlugin(); - - virtual ~CpWlanEntryPlugin(); - - virtual QList createSettingFormItemData( - CpItemDataHelper &itemDataHelper) const; - -signals: - -public slots: - -protected: - -protected slots: - -private: - - Q_DISABLE_COPY(CpWlanEntryPlugin) - -private slots: - -private: // data - - //! WLAN dynamic ON/OFF configuration - bool mWlanSupported; - //! Translator for text ID's used in this plugin - QSharedPointer mTranslator; - - // Friend classes -}; - -#endif // CPWLANENTRYPLUGIN_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanentryplugin/inc/wlanstatusinfo.h --- a/wlanutilities/wlanentryplugin/inc/wlanstatusinfo.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +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: -* WLAN Status Info wrapper for WLAN entry plugin. -*/ - -#ifndef WLANSTATUSINFO_H -#define WLANSTATUSINFO_H - -// System includes - -#include - -// User includes - -// Forward declarations - -class WlanQtUtils; -class XQSettingsManager; - -// External data types - -// Constants - -// Class declaration - -class WlanStatusInfo : public QObject -{ - Q_OBJECT - -public: - - // Data types - - /*! - * WLAN Status value. - */ - enum { - //! WLAN is configured OFF. - WlanStatusOff = 0, - //! No WLAN connections. - WlanStatusIdle, - //! WLAN IAP is connected. - WlanStatusConnected, - }; - - explicit WlanStatusInfo(QObject *parent = 0); - - ~WlanStatusInfo(); - - int status() const; - - QString statusText() const; - -signals: - - /** - * Signal that informs that the WLAN status has changed. - */ - void statusUpdated(); - -public slots: - -protected: - -protected slots: - -private: - - Q_DISABLE_COPY(WlanStatusInfo) - - bool isWlanOn() const; - -private slots: - - void updateStatus(); - -private: // data - - //! 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanentryplugin/rom/wlanentryplugin.iby --- a/wlanutilities/wlanentryplugin/rom/wlanentryplugin.iby Tue Aug 31 16:18:40 2010 +0300 +++ /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: -* WLAN Entry Plugin iby file. -*/ - -#ifndef WLANENTRYPLUGIN_IBY -#define WLANENTRYPLUGIN_IBY - -#include -#include - -#ifdef __PROTOCOL_WLAN - -file=ABI_DIR/BUILD_DIR/cpwlanentryplugin.dll SHARED_LIB_DIR/cpwlanentryplugin.dll -data=/epoc32/data/c/resource/qt/plugins/controlpanel/cpwlanentryplugin.qtplugin resource/qt/plugins/controlpanel/cpwlanentryplugin.qtplugin - -#endif // __PROTOCOL_WLAN - -#endif // WLANENTRYPLUGIN_IBY diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanentryplugin/rom/wlanentryplugin_resources.iby --- a/wlanutilities/wlanentryplugin/rom/wlanentryplugin_resources.iby Tue Aug 31 16:18:40 2010 +0300 +++ /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: -* WLAN Entry Plugin resource iby file. -*/ - -#ifndef WLANENTRYPLUGIN_RESOURCES_IBY -#define WLANENTRYPLUGIN_RESOURCES_IBY - -#include -#include - -#ifdef __PROTOCOL_WLAN - -data=DATAZ_/QT_TRANSLATIONS_DIR/wlanentryplugin.qm QT_TRANSLATIONS_DIR/wlanentryplugin.qm - -#endif // __PROTOCOL_WLAN - -#endif // WLANENTRYPLUGIN_RESOURCES_IBY diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanentryplugin/src/cpwlanentryitemdata.cpp --- a/wlanutilities/wlanentryplugin/src/cpwlanentryitemdata.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,181 +0,0 @@ -/* -* 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 Entry plugin item data implementation. -*/ - -// System includes - -#include -#include -#include - -#ifdef WLANENTRYPLUGIN_SERVICETRACES -#include -#endif -#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 - -/*! - \class CpWlanEntryItemData - \brief Implementation of WLAN Status Plugin entry item data. - -*/ - -// External function prototypes - -// Local constants - -// ======== LOCAL FUNCTIONS ======== - -// ======== MEMBER FUNCTIONS ======== - -/*! - 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)) -{ - OstTraceFunctionEntry0(CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_ENTRY); - - // Listen for WLAN status updates - bool connectStatus = connect( - mWlanStatusInfo, - SIGNAL(statusUpdated()), - this, - SLOT(statusUpdate())); - Q_ASSERT(connectStatus); - - // Update to show initial WLAN status. - statusUpdate(); - - OstTraceFunctionExit0(CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_EXIT); -} - -/*! - Destructor. -*/ - -CpWlanEntryItemData::~CpWlanEntryItemData() -{ - OstTraceFunctionEntry0(DUP1_CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_ENTRY); - OstTraceFunctionExit0(DUP1_CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_EXIT); -} - -/*! - Function for handling the entry item click. -*/ - -CpBaseSettingView *CpWlanEntryItemData::createSettingView() const -{ - OstTraceFunctionEntry0(CPWLANENTRYITEMDATA_CREATESETTINGVIEW_ENTRY); - -#ifdef WLANENTRYPLUGIN_SERVICETRACES - qInstallMsgHandler(XQSERVICEMESSAGEHANDLER); - XQSERVICE_DEBUG_PRINT("CpWlanEntryItemData::createSettingView requesting listView()"); -#endif - - // Execute synchronous WLAN Sniffer list view - 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; - reqInfo.setInfo(XQINFO_KEY_WINDOW_TITLE, 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 request; - - OstTraceFunctionExit0(CPWLANENTRYITEMDATA_CREATESETTINGVIEW_EXIT); - return 0; -} - -/*! - Slot for updating the status shown by the plugin. - Updates both the text and icon. - */ -void CpWlanEntryItemData::statusUpdate() -{ - OstTraceFunctionEntry0(CPWLANENTRYITEMDATA_STATUSUPDATE_ENTRY); - - // Build icon with (possible) badge - HbIcon wlanIcon; - switch (mWlanStatusInfo->status()) { - case WlanStatusInfo::WlanStatusIdle: - wlanIcon = HbIcon("qtg_large_wlan"); - break; - - case WlanStatusInfo::WlanStatusOff: - wlanIcon = HbIcon("qtg_large_wlan_off"); - break; - - case WlanStatusInfo::WlanStatusConnected: - wlanIcon = HbIcon("qtg_large_wlan"); - wlanIcon.addBadge( - Qt::AlignBottom | Qt::AlignRight, - HbIcon("qtg_small_connection")); - break; - -#ifndef QT_NO_DEBUG - default: - // Unsupported status type detected - Q_ASSERT(0); - break; -#endif - } - - // Set the updated WLAN status - this->setEntryItemIcon(wlanIcon); - this->setDescription(mWlanStatusInfo->statusText()); - - OstTraceFunctionExit0(CPWLANENTRYITEMDATA_STATUSUPDATE_EXIT); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanentryplugin/src/cpwlanentryplugin.cpp --- a/wlanutilities/wlanentryplugin/src/cpwlanentryplugin.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +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: -* WLAN Entry plugin implementation. -*/ - -// System includes - -#include -#include -#include "qsysteminfo.h" - -// User includes - -#include "cpwlanentryitemdata.h" -#include "cpwlanentryplugin.h" - -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "cpwlanentrypluginTraces.h" -#endif - -using namespace QtMobility; - -/*! - \class CpWlanEntryPlugin - \brief CpWlanEntryPlugin implements the WLAN Status Control Panel Plugin - that shows the current WLAN status. -*/ - -// External function prototypes - -// Local constants - -// ======== LOCAL FUNCTIONS ======== - -// ======== MEMBER FUNCTIONS ======== - -/*! - Constructor. -*/ - -CpWlanEntryPlugin::CpWlanEntryPlugin() : - QObject(), - mWlanSupported(false), - mTranslator() -{ - OstTraceFunctionEntry0(CPWLANENTRYPLUGIN_CPWLANENTRYPLUGIN_ENTRY); - - // Check & store WLAN dynamic configuration - QtMobility::QSystemInfo sysinfo; - mWlanSupported = sysinfo.hasFeatureSupported(QSystemInfo::WlanFeature); - - if (mWlanSupported) { - // Install localization - mTranslator = QSharedPointer( - new HbTranslator("wlanentryplugin")); - } - - OstTraceFunctionExit0(CPWLANENTRYPLUGIN_CPWLANENTRYPLUGIN_EXIT); -} - -/*! - Destructor. -*/ - -CpWlanEntryPlugin::~CpWlanEntryPlugin() -{ - OstTraceFunctionEntry0(DUP1_CPWLANENTRYPLUGIN_CPWLANENTRYPLUGIN_ENTRY); - OstTraceFunctionExit0(DUP1_CPWLANENTRYPLUGIN_CPWLANENTRYPLUGIN_EXIT); -} - -/*! - Plugin function for creating the entry plugin form item data. - - @param [in,out] itemDataHelper Control Panel item data helper. -*/ - -QList CpWlanEntryPlugin::createSettingFormItemData( - CpItemDataHelper &itemDataHelper) const -{ - OstTraceFunctionEntry0(CPWLANENTRYPLUGIN_CREATESETTINGFORMITEMDATA_ENTRY); - - QList settingFormData; - - // The plugin is disabled if WLAN is not supported by the product. - if (mWlanSupported) { - settingFormData.append(new CpWlanEntryItemData(itemDataHelper)); - } - - OstTraceFunctionExit0(CPWLANENTRYPLUGIN_CREATESETTINGFORMITEMDATA_EXIT); - return settingFormData; -} - -Q_EXPORT_PLUGIN2(cpwlanentryplugin, CpWlanEntryPlugin); diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanentryplugin/src/wlanstatusinfo.cpp --- a/wlanutilities/wlanentryplugin/src/wlanstatusinfo.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,195 +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: -* WLAN Status Info wrapper for WLAN entry plugin. -*/ - -// System includes - -#include -#include -#include - -// User includes - -#include "wlanqtutils.h" - -#include "wlanstatusinfo.h" - -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlanstatusinfoTraces.h" -#endif - -/*! - \class WlanStatusInfo - \brief Class for maintaining and updating the WLAN status for the WLAN - 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 ======== - -/*! - Constructor. -*/ - -WlanStatusInfo::WlanStatusInfo(QObject *parent) : - QObject(parent), - mWlanQtUtils(new WlanQtUtils()), - mSettingsManager(new XQSettingsManager(this)), - mStatusText(""), - mStatus(WlanStatusOff) -{ - OstTraceFunctionEntry0(WLANSTATUSINFO_WLANSTATUSINFO_ENTRY); - - // Listen for WLAN ON/OFF switching - bool connectStatus = connect( - mSettingsManager, - SIGNAL(valueChanged(XQSettingsKey, QVariant)), - this, - SLOT(updateStatus())); - Q_ASSERT(connectStatus); - mSettingsManager->startMonitoring(masterWlanKey); - mSettingsManager->startMonitoring(wlanForceKey); - - // Listen for WLAN connection statuses - connectStatus = connect( - mWlanQtUtils, - SIGNAL(wlanNetworkOpened(int)), - this, - SLOT(updateStatus())); - Q_ASSERT(connectStatus == true); - connectStatus = connect( - mWlanQtUtils, - SIGNAL(wlanNetworkClosed(int, int)), - this, - SLOT(updateStatus())); - Q_ASSERT(connectStatus == true); - - // Set initial status - updateStatus(); - - OstTraceFunctionExit0(WLANSTATUSINFO_WLANSTATUSINFO_EXIT); -} - -/*! - Destructor. -*/ - -WlanStatusInfo::~WlanStatusInfo() -{ - OstTraceFunctionEntry0(DUP1_WLANSTATUSINFO_WLANSTATUSINFO_ENTRY); - - delete mWlanQtUtils; - - OstTraceFunctionExit0(DUP1_WLANSTATUSINFO_WLANSTATUSINFO_EXIT); -} - -/*! - Function for getting current WLAN status value (WlanStatusInfo::WlanStatus*). -*/ - -int WlanStatusInfo::status() const -{ - OstTraceFunctionEntry0(WLANSTATUSINFO_STATUS_ENTRY); - OstTraceFunctionExit0(WLANSTATUSINFO_STATUS_EXIT); - return mStatus; -} - -/*! - Returns the current WLAN status text. -*/ - -QString WlanStatusInfo::statusText() const -{ - 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() -{ - OstTraceFunctionEntry0(WLANSTATUSINFO_UPDATESTATUS_ENTRY); - - // Backup old status to detect changes - QString oldStatusText = mStatusText; - - // Figure out current WLAN status - if (!isWlanOn()) { - // WLAN is switched OFF. - mStatus = WlanStatusOff; - mStatusText = hbTrId("txt_occ_dblist_wireless_lan_val_off"); - } else if (mWlanQtUtils->connectionStatus() == WlanQtUtils::ConnStatusConnected) { - mStatus = WlanStatusConnected; - mStatusText = mWlanQtUtils->iapName(mWlanQtUtils->activeIap()); - } else { - mStatus = WlanStatusIdle; - mStatusText = hbTrId("txt_occ_dblist_wireless_lan_val_wlan_is_on"); - } - - // Inform about update if the status really changed. - if (oldStatusText != mStatusText) { - emit statusUpdated(); - } - - OstTraceFunctionExit0(WLANSTATUSINFO_UPDATESTATUS_EXIT); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanentryplugin/traces/OstTraceDefinitions.h --- a/wlanutilities/wlanentryplugin/traces/OstTraceDefinitions.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +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: -* OST trace definition header. -*/ - -#ifndef __OSTTRACEDEFINITIONS_H__ -#define __OSTTRACEDEFINITIONS_H__ -#include -#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanentryplugin/wlanentryplugin.pro --- a/wlanutilities/wlanentryplugin/wlanentryplugin.pro Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +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: -# WLAN Entry Plugin Qt project file. -# - -TEMPLATE = lib -TARGET = cpwlanentryplugin -DEPENDPATH += . -INCLUDEPATH += . -INCLUDEPATH += traces -# wlanutilities Private API -INCLUDEPATH += ../inc -CONFIG += hb plugin -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 += \ - inc/cpwlanentryplugin.h \ - inc/cpwlanentryitemdata.h \ - inc/wlanstatusinfo.h \ - traces/OstTraceDefinitions.h -SOURCES += \ - src/cpwlanentryplugin.cpp \ - src/cpwlanentryitemdata.cpp \ - src/wlanstatusinfo.cpp - -TRANSLATIONS = wlanentryplugin.ts - -symbian: { - TARGET.EPOCALLOWDLLDATA = 1 - TARGET.UID3 = 0x2002BCE0 - SYMBIAN_PLATFORMS = WINSCW ARMV5 - BLD_INF_RULES.prj_exports += "rom/wlanentryplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wlanentryplugin.iby)" - BLD_INF_RULES.prj_exports += "rom/wlanentryplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(wlanentryplugin_resources.iby)" - - # Enable for QtHighway tracing - # DEFINES += WLANENTRYPLUGIN_SERVICETRACES -} -symbian { - deploy.path = C: - qtplugins.path = /resource/qt/plugins/controlpanel - qtplugins.sources += qmakepluginstubs/cpwlanentryplugin.qtplugin - - # This is for new exporting system coming in garden - for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin $$deploy.path$$qtplugins.path/$$basename(qtplugin)" -} -TARGET.CAPABILITY = CAP_GENERAL_DLL -plugin.sources = cpwlanentryplugin.dll xqservice.dll -plugin.path = /resource/qt/plugins/controlpanel -DEPLOYMENT += plugin diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanindicatorplugin/data/2001247E.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/data/2001247E.rss Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 to launch WLAN indicator plugin +* +*/ + + +#include + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x2001247E; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x10275092; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x2001247E; + version_no = 1; + display_name = ""; + default_data = "Default"; + opaque_data = ""; + } + }; + } + }; + } + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanindicatorplugin/data/wlanindicator.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/data/wlanindicator.rss Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource definitions for project wlanindicatorplugin +* +*/ + + +// RESOURCE IDENTIFIER +NAME WLIN + +#include +#include + +RESOURCE RSS_SIGNATURE { } + + +RESOURCE TBUF r_qtn_uni_ind_wlan_avail_unknown + { + buf = qtn_uni_ind_wlan_avail_unknown; + } + +RESOURCE TBUF r_qtn_uni_ind_wlan_avail_unknown_many + { + buf = qtn_uni_ind_wlan_avail_unknown_many; + } + +RESOURCE TBUF r_qtn_uni_ind_wlan_avail_known + { + buf = qtn_uni_ind_wlan_avail_known; + } + +RESOURCE TBUF r_qtn_uni_ind_wlan_conn + { + buf = qtn_uni_ind_wlan_conn; + } + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanindicatorplugin/group/bld.inf --- a/wlanutilities/wlanindicatorplugin/group/bld.inf Tue Aug 31 16:18:40 2010 +0300 +++ b/wlanutilities/wlanindicatorplugin/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -22,7 +22,9 @@ DEFAULT PRJ_EXPORTS - +../rom/wlanindicatorplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wlanindicatorplugin.iby) +../rom/wlanindicatorpluginresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(wlanindicatorpluginresources.iby) +../loc/wlanindicatorplugin.loc MW_LAYER_LOC_EXPORT_PATH(wlanindicatorplugin.loc) PRJ_MMPFILES - +wlanindicatorplugin.mmp diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanindicatorplugin/group/wlanindicatorplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/group/wlanindicatorplugin.mmp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 project wlanindicatorplugin +* +*/ + + +#include +#include + +// Build target +TARGET wlanindicatorplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x2001247E +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +// Source files location +SOURCEPATH ../src +SOURCE dllmain.cpp +SOURCE wlanindicatorpluginimplementation.cpp + +// Resources +START RESOURCE ../data/2001247E.rss +TARGET wlanindicatorplugin.rsc +TARGETPATH ECOM_RESOURCE_DIR +END + +START RESOURCE ../data/wlanindicator.rss +HEADER +TARGETPATH RESOURCE_FILES_DIR +LANGUAGE_IDS +END + +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +LIBRARY ecom.lib +LIBRARY avkon.lib +LIBRARY euser.lib +LIBRARY eikcore.lib +LIBRARY apgrfx.lib +LIBRARY cone.lib +LIBRARY commonengine.lib +LIBRARY charconv.lib +LIBRARY connmon.lib +LIBRARY cmmanager.lib +LIBRARY bafl.lib + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanindicatorplugin/inc/wlanindicatorplugin.h --- a/wlanutilities/wlanindicatorplugin/inc/wlanindicatorplugin.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +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 WLANINDICATORPLUGIN_H -#define WLANINDICATORPLUGIN_H - -#include -#include -#include -#include -#include - -// Forward declarations -class HbTranslator; - -const int wlanNotConnected = 0; -const int wlanConnected = 1; - -class WlanIndicatorPlugin : public HbIndicatorInterface, public HbIndicatorPluginInterface -{ - Q_OBJECT - Q_INTERFACES(HbIndicatorPluginInterface) - -#ifdef WLANINDICATOR_UT - friend class WlanIndicatorUtCases; -#endif - -public: - WlanIndicatorPlugin(); - ~WlanIndicatorPlugin(); - -public: - //from HbIndicatorPluginInterface - QStringList indicatorTypes() const; - bool accessAllowed(const QString &indicatorType, - const QVariantMap &securityInfo ) const; - HbIndicatorInterface* createIndicator(const QString &indicatorType); - int error() const; -public: - //from HbIndicatorInterface - bool handleClientRequest (RequestType type, const QVariant ¶meter); - bool handleInteraction (InteractionType type); - QVariant indicatorData(int role) const; - -private: - - Q_DISABLE_COPY(WlanIndicatorPlugin) - QStringList mIndicatorTypes; // Type of indicator - int mError; // Indicator error - QVariant mParameter; // Used to contain the status of wlan - QProcess process; // Process to start external programs - QSharedPointer mTranslator; // Translator for the localisation Text Id's -}; -#endif //WLANINDICATORPLUGIN_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanindicatorplugin/inc/wlanindicatorpluginimplementation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/inc/wlanindicatorpluginimplementation.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defines the CWlanIndicatorPluginImplementation class +* +*/ + + + +#ifndef CWLANINDICATORPLUGINIMPLEMENTATION_H +#define CWLANINDICATORPLUGINIMPLEMENTATION_H + +// INCLUDES +#include // CAknIndicatorPlugin +#include + +// FORWARD DECLARATIONS +class CCoeEnv; + +/** +* WLAN Indicator Plug-in implementation +* +* @since 5.0 +*/ +class CWlanIndicatorPluginImplementation : public CAknIndicatorPlugin + + { + + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CWlanIndicatorPluginImplementation* NewL(); + + /** + * Destructor. + */ + ~CWlanIndicatorPluginImplementation(); + + + private: // From CAknIndicatorPlugin + + /** + * @see CAknIndicatorPlugin + */ + void HandleIndicatorTapL( const TInt aUid ); + + /** + * @see CAknIndicatorPlugin + */ + HBufC* TextL( const TInt aUid, TInt& aTextType ); + + + private: + + /** + * C++ default constructor. + */ + CWlanIndicatorPluginImplementation(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + + private: // new functions + + /** + * Creates text for the case "wlan networks available" + * @return Descriptor for the "wlan available" case + */ + HBufC* CreateWlanNetworksFoundTextL(); + + /** + * Creates text for the "connected" case (open or secure). + * @return Descriptor containing the "'myNetwork' connected" text + */ + HBufC* CreateWlanConnectedTextL(); + + /** + * Finds the WLAN connection name. + * @return Descriptor containing the name of the connected WLAN nw. + */ + HBufC* ConnectionNameL(); + + /** Finds the WLAN connection id + * @return WLAN connection id + */ + TUint FindWlanBearerConnectedL(); + + /** Checks if the given connection is WLAN + * @param Id of the active connection + */ + TBool CheckIfWlan( TUint aConnectionId ); + + /** + * Launches WlanSniffer application. + */ + void LaunchWlanSnifferL(); + + + private: // data + + /** + * Ref + */ + CCoeEnv* iCoeEnv; + + /** + * Resource file offset in CoeEnv's resource file list + */ + TInt iResource; + + /** + * Owned. Used for getting connection info + */ + RConnectionMonitor iConnMonitor; + + }; + +#endif // CWLANINDICATORPLUGINIMPLEMENTATION_H + +// End of File diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanindicatorplugin/loc/wlanindicatorplugin.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/loc/wlanindicatorplugin.loc Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 strings for project wlanindicatorplugin +* +*/ + + + +// d:One unknown network found. +// l:list_single_uniindi_pane_t1 +// r:5.0 +// +#define qtn_uni_ind_wlan_avail_unknown "WLAN network found" + +// d:Multiple unknown networks found. +// l:list_single_uniindi_pane_t1 +// r:5.0 +// +#define qtn_uni_ind_wlan_avail_unknown_many "WLAN networks found" + +// d:One or more known networks found. +// d: %U is the IAP of the network, or in case more than one found, +// d: %U is the first network in alphabetical order. +// l:list_single_uniindi_pane_t1 +// r:5.0 +// +#define qtn_uni_ind_wlan_avail_known "'%U' found" + +// d:WLAN connection exists. +// d: %U is the name of the WLAN IAP, or the SSID of the WLAN network in case +// d: connection was created using "Search for WLAN" functionality. +// l:list_single_uniindi_pane_t1 +// r:5.0 +// +#define qtn_uni_ind_wlan_conn "'%U' connected" + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanindicatorplugin/rom/wlanindicatorplugin.iby --- a/wlanutilities/wlanindicatorplugin/rom/wlanindicatorplugin.iby Tue Aug 31 16:18:40 2010 +0300 +++ b/wlanutilities/wlanindicatorplugin/rom/wlanindicatorplugin.iby Wed Sep 01 12:20:32 2010 +0100 @@ -1,19 +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: - * - */ +* 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: Image description file for WlanIndicatorPlugin +* +*/ -file=ABI_DIR\BUILD_DIR\wlanindicatorplugin.dll SHARED_LIB_DIR\wlanindicatorplugin.dll -data=\epoc32\data\z\resource\plugins\indicators\WlanIndicatorPlugin.qtplugin RESOURCE_FILES_DIR\plugins\indicators\wlanindicatorplugin.qtplugin +#ifndef __WLANINDICATORPLUGIN_IBY__ +#define __WLANINDICATORPLUGIN_IBY__ + + +#include + +ECOM_PLUGIN( wlanindicatorplugin.dll, wlanindicatorplugin.rsc ) + +#endif // __WLANINDICATORPLUGIN_IBY__ + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanindicatorplugin/rom/wlanindicatorplugin_resources.iby --- a/wlanutilities/wlanindicatorplugin/rom/wlanindicatorplugin_resources.iby Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +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 WLANINDICATORPLUGIN_RESOURCES_IBY -#define WLANINDICATORPLUGIN_RESOURCES_IBY - -#include -#include - -data=DATAZ_/QT_TRANSLATIONS_DIR/wlanindicatorplugin.qm QT_TRANSLATIONS_DIR/wlanindicatorplugin.qm - -#endif // WLANINDICATORPLUGIN_RESOURCES_IBY diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanindicatorplugin/rom/wlanindicatorpluginresources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/rom/wlanindicatorpluginresources.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,22 @@ +/* +* 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: Image description file for WlanIndicatorPlugin +* +*/ +#ifndef __WLAN_INDICATORPLUGIN_RESOURCES_IBY__ +#define __WLAN_INDICATORPLUGIN_RESOURCES_IBY__ + +data=DATAZ_\RESOURCE_FILES_DIR\wlanindicator.rsc RESOURCE_FILES_DIR\wlanindicator.rsc + +#endif // __WLAN_INDICATORPLUGIN_RESOURCES_IBY__ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanindicatorplugin/src/dllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/src/dllmain.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 for DllMain. +* +*/ + + +#include "wlanindicatorpluginimplementation.h" + +#include + +// Define the interface UIDs +// Map the interface implementation UIDs to implementation factory functions +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( 0x2001247E, + CWlanIndicatorPluginImplementation::NewL ) + }; + +// Exported proxy for instantiation method resolution. +EXPORT_C const TImplementationProxy* ImplementationGroupProxy + (TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(ImplementationTable[0]); + return ImplementationTable; + } + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanindicatorplugin/src/wlanindicatorplugin.cpp --- a/wlanutilities/wlanindicatorplugin/src/wlanindicatorplugin.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,223 +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 -#include -#include "wlanindicatorplugin.h" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlanindicatorpluginTraces.h" -#endif - -Q_EXPORT_PLUGIN(WlanIndicatorPlugin) - -const static char IndicatorType[] = "com.nokia.hb.indicator.connectivity.wlanindicatorplugin/1.0"; - - -/*! - WlanIndicatorPlugin constructor. -*/ -WlanIndicatorPlugin::WlanIndicatorPlugin() : - HbIndicatorInterface(IndicatorType, SettingCategory, InteractionActivated), - mError(0) -{ - OstTraceFunctionEntry1(WLANINDICATORPLUGIN_WLANINDICATORPLUGIN_ENTRY, this); - mIndicatorTypes << "com.nokia.hb.indicator.connectivity.wlanindicatorplugin/1.0"; - OstTraceFunctionExit1(WLANINDICATORPLUGIN_WLANINDICATORPLUGIN_ENTRY_EXIT, this); -} - -/*! - WlanIndicatorPlugin destructor. -*/ -WlanIndicatorPlugin::~WlanIndicatorPlugin() -{ - OstTraceFunctionEntry1(DUP1_WLANINDICATORPLUGIN_WLANINDICATORPLUGIN_ENTRY, this); - OstTraceFunctionExit1(DUP1_WLANINDICATORPLUGIN_WLANINDICATORPLUGIN_EXIT, this); -} - -/*! - The indicatorTypes returns type of indicator. In this case it is wlanindicatorplugin. -*/ -QStringList WlanIndicatorPlugin::indicatorTypes() const -{ - OstTraceFunctionEntry1(WLANINDICATORPLUGIN_INDICATORTYPES_ENTRY, this); - OstTraceFunctionExit1(WLANINDICATORPLUGIN_INDICATORTYPES_EXIT, this); - - return mIndicatorTypes; -} - -/*! - The handleClientRequest handles client request to change indicators parameters. -*/ -bool WlanIndicatorPlugin::accessAllowed(const QString &indicatorType, - const QVariantMap &securityInfo) const -{ - OstTraceFunctionEntry1(WLANINDICATORPLUGIN_ACCESSALLOWED_ENTRY, this); - - Q_UNUSED(indicatorType) - Q_UNUSED(securityInfo) - - OstTraceFunctionExit1(WLANINDICATORPLUGIN_ACCESSALLOWED_EXIT, this); - - return true; -} - -/*! - The createIndicator creates indicator plugin instance. -*/ -HbIndicatorInterface* WlanIndicatorPlugin::createIndicator( - const QString &indicatorType) -{ - OstTraceFunctionEntry1(WLANINDICATORPLUGIN_CREATEINDICATOR_ENTRY, this); - Q_UNUSED(indicatorType) - - // Install localization - mTranslator = QSharedPointer(new HbTranslator("wlanindicatorplugin")); - - OstTraceFunctionExit1(WLANINDICATORPLUGIN_CREATEINDICATOR_EXIT, this); - return this; -} - -/*! - The error returns indicator error to HbIndicatorPluginInterface. -*/ -int WlanIndicatorPlugin::error() const -{ - OstTraceFunctionEntry1(WLANINDICATORPLUGIN_ERROR_ENTRY, this); - OstTrace1( WLANINDICATORPLUGIN_ERR,ERROR,"WlanIndicatorPlugin error %u", mError); - OstTraceFunctionExit1(WLANINDICATORPLUGIN_ERROR_EXIT, this); - return mError; -} - -/*! - The handleInteraction is used launch WLAN list view. -*/ -bool WlanIndicatorPlugin::handleInteraction(InteractionType type) -{ - OstTraceFunctionEntry1(WLANINDICATORPLUGIN_HANDLEINTERACTION_ENTRY, this); - - bool handled = false; - QVariantMap data; - switch (type) { - case InteractionActivated: - // Emit a signal that will inform the client to start the wlan list view - emit userActivated(data); - handled = true; - break; - default: - break; - } - - OstTraceFunctionExit1(WLANINDICATORPLUGIN_HANDLEINTERACTION_EXIT, this); - - return handled; -} - -/*! - The handleClientRequest handles client request to change indicators paramters. -*/ -bool WlanIndicatorPlugin::handleClientRequest(RequestType type, const QVariant ¶meter) -{ - OstTraceFunctionEntry1(WLANINDICATORPLUGIN_CLIENTREQUEST_ENTRY, this); - - Q_UNUSED(parameter) - bool handled(false); - switch (type) { - case RequestActivate: - if (mParameter != parameter) { - mParameter = parameter; - emit dataChanged(); - } - handled = true; - break; - default: - mParameter.clear(); - } - - OstTraceFunctionExit1(WLANINDICATORPLUGIN_CLIENTREQUEST_EXIT, this); - return handled; -} - -/*! - The indicatorData takes care of showing indicator's data. -*/ -QVariant WlanIndicatorPlugin::indicatorData(int role) const -{ - OstTraceFunctionEntry1(WLANINDICATORPLUGIN_INDICATORDATA_ENTRY, this); - - QVariant qvariant(""); - QList indicatorText; - bool validParameters = false; - - switch (role) { - case PrimaryTextRole: - qvariant = QString(hbTrId("txt_occ_dblist_indi_menu_wireless_lan")); - break; - case SecondaryTextRole: - if (mParameter.isValid() && mParameter.type() == QVariant::List) { - - indicatorText = mParameter.toList(); - validParameters = true; - } - if (validParameters && (indicatorText.size() > 0)) { - - if (indicatorText[0] == wlanNotConnected){ - qvariant = QString(hbTrId("txt_occ_dblist_wireless_lan_val_not_connected")); - } - - else if (indicatorText[0] == wlanConnected){ - qvariant = indicatorText[1].toString(); - } - } - else - { - OstTrace0( WLANINDICATORPLUGIN_ERR,INVALID_PARAMS,"Invalid indicator parameters"); - } - break; - // this is the statusbar icon, which is shown only when a connection is active - case MonoDecorationNameRole: - OstTraceFunctionExit1(DUP1_WLANINDICATORPLUGIN_INDICATORDATA_EXIT, this); - - if (mParameter.isValid() && mParameter.type() == QVariant::List) { - indicatorText = mParameter.toList(); - if ((indicatorText.size() > 0) && (indicatorText[0] == wlanConnected)) { - qvariant = QString("qtg_status_wlan"); - } - } - break; - // this is the icon in the indicator - case DecorationNameRole: - OstTraceFunctionExit1(DUP2_WLANINDICATORPLUGIN_INDICATORDATA_EXIT, this); - qvariant = QString("qtg_small_wlan"); - break; - default: - OstTraceFunctionExit1(DUP3_WLANINDICATORPLUGIN_INDICATORDATA_EXIT, this); - break; - } - return qvariant; -} - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanindicatorplugin/src/wlanindicatorpluginimplementation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/src/wlanindicatorpluginimplementation.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,359 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: wlanindicatorplugin implementation +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "wlanindicatorpluginimplementation.h" + + +// CONSTANTS +const TUid KSnifferAppUid = { 0x10281CAA }; +_LIT( KDriveZ, "z:" ); +_LIT( KWlanIndicatorResourceFile, "wlanindicator.rsc" ); + +using namespace CMManager; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CWlanIndicatorPluginImplementation::CWlanIndicatorPluginImplementation +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CWlanIndicatorPluginImplementation::CWlanIndicatorPluginImplementation() + : iCoeEnv( CCoeEnv::Static() ) + { + } + +// --------------------------------------------------------------------------- +// CWlanIndicatorPluginImplementation::ConstructL +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CWlanIndicatorPluginImplementation::ConstructL() + { + TFileName fileName; + + fileName.Append( KDriveZ ); + fileName.Append( KDC_RESOURCE_FILES_DIR ); + fileName.Append( KWlanIndicatorResourceFile ); + + BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName ); + iResource = iCoeEnv->AddResourceFileL( fileName ); + + iConnMonitor.ConnectL(); + + } + +// ----------------------------------------------------------------------------- +// CWlanIndicatorPluginImplementation::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CWlanIndicatorPluginImplementation* CWlanIndicatorPluginImplementation::NewL() + { + CWlanIndicatorPluginImplementation* self = + new( ELeave ) CWlanIndicatorPluginImplementation; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CWlanIndicatorPluginImplementation::~CWlanIndicatorPluginImplementation +// Destructor. +// ----------------------------------------------------------------------------- +// +CWlanIndicatorPluginImplementation::~CWlanIndicatorPluginImplementation() + { + iCoeEnv->DeleteResourceFile( iResource ); + + iConnMonitor.Close(); + + } + + +// --------------------------------------------------------------------------- +// CWlanIndicatorPluginImplementation::HandleIndicatorTapL +// --------------------------------------------------------------------------- +// +void CWlanIndicatorPluginImplementation::HandleIndicatorTapL( const TInt aUid ) + { + + switch ( aUid ) + { + case EAknIndicatorWlanAvailable: + case EAknIndicatorWlanActive: + case EAknIndicatorWlanActiveSecure: + { + + LaunchWlanSnifferL(); + + break; + } + + default: + + break; + + } + + + } + + + +// --------------------------------------------------------------------------- +// CWlanIndicatorPluginImplementation::TextL( const TInt aUid, TInt& aTextType ) +// --------------------------------------------------------------------------- +// +HBufC* CWlanIndicatorPluginImplementation::TextL( const TInt aUid, + TInt& aTextType ) + { + + HBufC* textBuf = NULL; + + switch ( aUid ) + { + case EAknIndicatorWlanAvailable: + { + textBuf = CreateWlanNetworksFoundTextL(); + aTextType = EAknIndicatorPluginLinkText; + + break; + } + + case EAknIndicatorWlanActive: + case EAknIndicatorWlanActiveSecure: + { + textBuf = CreateWlanConnectedTextL(); + aTextType = EAknIndicatorPluginLinkText; + + break; + } + + default: + + break; + + } + + + return textBuf; + + } + +// --------------------------------------------------------------------------- +// CWlanIndicatorPluginImplementation::CreateWlanNetworksFoundTextL() +// --------------------------------------------------------------------------- +// +HBufC* CWlanIndicatorPluginImplementation::CreateWlanNetworksFoundTextL() + { + + HBufC* dynText = NULL; + + // "qtn_uni_ind_wlan_avail_unknown_many WLAN networks found" + dynText = StringLoader::LoadL ( + R_QTN_UNI_IND_WLAN_AVAIL_UNKNOWN_MANY, iCoeEnv ); + + return dynText; + } + + +// --------------------------------------------------------------------------- +// CWlanIndicatorPluginImplementation::CreateWlanConnectedTextL() +// --------------------------------------------------------------------------- +// +HBufC* CWlanIndicatorPluginImplementation::CreateWlanConnectedTextL() + { + + HBufC* dynText = NULL; + HBufC* connectedNetworkName = NULL; + + connectedNetworkName = ConnectionNameL( ); + + CleanupStack::PushL( connectedNetworkName ); + + if ( connectedNetworkName ) + { + // "qtn_uni_ind_wlan_conn '%U' connected" + dynText = StringLoader::LoadL ( + R_QTN_UNI_IND_WLAN_CONN, *connectedNetworkName, iCoeEnv ); + } + + CleanupStack::PopAndDestroy( connectedNetworkName ); + + return dynText; + } + + +// --------------------------------------------------------------------------- +// CWlanIndicatorPluginImplementation::ConnectionNameL() +// --------------------------------------------------------------------------- +// +HBufC* CWlanIndicatorPluginImplementation::ConnectionNameL( ) + { + HBufC* connName = NULL; + + // get the connection ID + TUint connectionId = FindWlanBearerConnectedL(); + + TUint connectedIapId(0); + TRequestStatus status; + + // get the IAP ID + iConnMonitor.GetUintAttribute( connectionId, 0, KIAPId, + connectedIapId, status ); + User::WaitForRequest( status ); + + // get the connection method from cmmanager + RCmManager cmManager; + cmManager.OpenLC(); + + RCmConnectionMethod connMethod = cmManager.ConnectionMethodL( connectedIapId ); + CleanupClosePushL( connMethod ); + + TUint32 easyWLANIapId = cmManager.EasyWlanIdL(); + if ( easyWLANIapId != connectedIapId ) + { + connName = connMethod.GetStringAttributeL( ECmName ); + } + else + { + connName = connMethod.GetStringAttributeL( EWlanUsedSSID ); + } + + CleanupStack::PopAndDestroy( 2, &cmManager ); //cmManager and connMethod + + return connName; + } + +// --------------------------------------------------------------------------- +// CWlanIndicatorPluginImplementation::FindWlanBearerConnectedL() +// --------------------------------------------------------------------------- +// +TUint CWlanIndicatorPluginImplementation::FindWlanBearerConnectedL( ) + { + TUint connectionId( 0 ); + + TUint connCount( 0 ); + TUint subConnectionCount( 0 ); + TRequestStatus status; + + iConnMonitor.GetConnectionCount( connCount, status ); + User::WaitForRequest( status ); + + if ( status.Int() == KErrNone ) + { + for ( TUint i = 1; i <= connCount; ++i ) + { + User::LeaveIfError( iConnMonitor.GetConnectionInfo( i, connectionId, + subConnectionCount ) ); + if ( CheckIfWlan( connectionId ) ) + { + break; + } + } + } + + return connectionId; + } + +// --------------------------------------------------------------------------- +// CWlanIndicatorPluginImplementation::CheckIfWlan() +// --------------------------------------------------------------------------- +// +TBool CWlanIndicatorPluginImplementation::CheckIfWlan( TUint aConnectionId ) + { + TConnMonBearerType bearerType( EBearerUnknown ); + + TBool foundWlanBearer( EFalse ); + + TRequestStatus status; + + // Add only connections with valid id + if ( aConnectionId > 0 ) + { + iConnMonitor.GetIntAttribute( aConnectionId, 0, KBearer, (TInt&)bearerType, + status ); + User::WaitForRequest( status ); + + if ( status.Int() == KErrNone ) + { + if ( bearerType == EBearerWLAN ) + { + foundWlanBearer = ETrue; + } + } + + } + + return foundWlanBearer; + + } + +// --------------------------------------------------------------------------- +// CWlanIndicatorPluginImplementation::LaunchWlanSnifferL() +// --------------------------------------------------------------------------- +// +void CWlanIndicatorPluginImplementation::LaunchWlanSnifferL() + { + + RApaLsSession appArcSession; + + User::LeaveIfError( appArcSession.Connect() ); // connect to AppArc server + CleanupClosePushL( appArcSession ); + + // check if the app is already running + TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); + TApaTask task = taskList.FindApp( KSnifferAppUid ); + + if ( task.Exists() ) + { + task.BringToForeground(); + } + else + { + TThreadId threadId; + User::LeaveIfError( appArcSession.StartDocument( KNullDesC, + KSnifferAppUid, threadId ) ); + + } + + CleanupStack::PopAndDestroy(); // appArcSession + + } + +// End of File diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanindicatorplugin/traces/OstTraceDefinitions.h --- a/wlanutilities/wlanindicatorplugin/traces/OstTraceDefinitions.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanindicatorplugin/wlanindicatorplugin.pro --- a/wlanutilities/wlanindicatorplugin/wlanindicatorplugin.pro Tue Aug 31 16:18:40 2010 +0300 +++ /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: -# - -TEMPLATE = lib -CONFIG += plugin -CONFIG += hb - -# directories -DEPENDPATH += . -INCLUDEPATH += ./inc - -HEADERS += inc/wlanindicatorplugin.h \ - traces/OstTraceDefinitions.h - -SOURCES += src/wlanindicatorplugin.cpp - -TRANSLATIONS = wlanindicatorplugin.ts - -symbian*::LIBS += -HbCore -HbWidgets - -symbian*: { - TARGET.EPOCALLOWDLLDATA = 1 - TARGET.CAPABILITY = CAP_GENERAL_DLL - TARGET.UID3 = 0x2002C39F - SYMBIAN_PLATFORMS = WINSCW ARMV5 - BLD_INF_RULES.prj_exports += "rom/wlanindicatorplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wlanindicatorplugin.iby)" - BLD_INF_RULES.prj_exports += "rom/wlanindicatorplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(wlanindicatorplugin_resources.iby)" - pluginstub.sources = wlanIndicatorplugin.dll - pluginstub.path = /resource/plugins/indicators - DEPLOYMENT += pluginstub -} - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/ictsqtwrapper/bwins/ictsqtwrapperu.def --- a/wlanutilities/wlanlogin/ictsqtwrapper/bwins/ictsqtwrapperu.def Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/ictsqtwrapper/eabi/ictsqtwrapperu.def --- a/wlanutilities/wlanlogin/ictsqtwrapper/eabi/ictsqtwrapperu.def Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/ictsqtwrapper/ictsqtwrapper.pro --- a/wlanutilities/wlanlogin/ictsqtwrapper/ictsqtwrapper.pro Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +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 "Eclipse Public License v1.0" -# which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/ictsqtwrapper/inc/ictsqtwrapper.h --- a/wlanutilities/wlanlogin/ictsqtwrapper/inc/ictsqtwrapper.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/ictsqtwrapper/inc/ictsqtwrapper_symbian.h --- a/wlanutilities/wlanlogin/ictsqtwrapper/inc/ictsqtwrapper_symbian.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/ictsqtwrapper/rom/ictsqtwrapper.iby --- a/wlanutilities/wlanlogin/ictsqtwrapper/rom/ictsqtwrapper.iby Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +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 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/ictsqtwrapper/src/ictsqtwrapper.cpp --- a/wlanutilities/wlanlogin/ictsqtwrapper/src/ictsqtwrapper.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/ictsqtwrapper/src/ictsqtwrapper_symbian.cpp --- a/wlanutilities/wlanlogin/ictsqtwrapper/src/ictsqtwrapper_symbian.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,162 +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: 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/ictsqtwrapper/traces/OstTraceDefinitions.h --- a/wlanutilities/wlanlogin/ictsqtwrapper/traces/OstTraceDefinitions.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/ictswlanlogininterface/bwins/ictswlanlogininterfaceu.def --- a/wlanutilities/wlanlogin/ictswlanlogininterface/bwins/ictswlanlogininterfaceu.def Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/ictswlanlogininterface/eabi/ictswlanlogininterfaceu.def --- a/wlanutilities/wlanlogin/ictswlanlogininterface/eabi/ictswlanlogininterfaceu.def Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/ictswlanlogininterface/ictswlanlogininterface.pro --- a/wlanutilities/wlanlogin/ictswlanlogininterface/ictswlanlogininterface.pro Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +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 "Eclipse Public License v1.0" -# which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/ictswlanlogininterface/inc/ictswlanlogininterface.h --- a/wlanutilities/wlanlogin/ictswlanlogininterface/inc/ictswlanlogininterface.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +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 "Eclipse Public License v1.0"" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/ictswlanlogininterface/rom/ictswlanlogininterface.iby --- a/wlanutilities/wlanlogin/ictswlanlogininterface/rom/ictswlanlogininterface.iby Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/ictswlanlogininterface/src/ictswlanlogininterface.cpp --- a/wlanutilities/wlanlogin/ictswlanlogininterface/src/ictswlanlogininterface.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,328 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/ictswlanlogininterface/traces/OstTraceDefinitions.h --- a/wlanutilities/wlanlogin/ictswlanlogininterface/traces/OstTraceDefinitions.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -#ifndef __OSTTRACEDEFINITIONS_H__ -#define __OSTTRACEDEFINITIONS_H__ -#include -#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanlogin.pro --- a/wlanutilities/wlanlogin/wlanlogin.pro Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +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 "Eclipse Public License v1.0" -# which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginapplication.h --- a/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginapplication.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/inc/wlanlogindocumentloader.h --- a/wlanutilities/wlanlogin/wlanloginapp/inc/wlanlogindocumentloader.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +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 "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Document loader of WLAN Login application -* -*/ - -#ifndef WLANLOGINDOCUMENTLOADER_H -#define WLANLOGINDOCUMENTLOADER_H - -// System includes -#include -#include - -// User includes - -// Forward declarations -class HbMainWindow; -class QString; - -// External data types - -// Constants - -// Class declaration -class WlanLoginDocumentLoader : public HbDocumentLoader -{ -public: - WlanLoginDocumentLoader(const HbMainWindow *window); - ~WlanLoginDocumentLoader(); -protected: - QObject *createObject(const QString& type, const QString &name); - -}; - -#endif // WLANLOGINDOCUMENTLOADER_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginengine.h --- a/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginengine.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +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 "Eclipse Public License v1.0" - * which accompanies 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 - IctsFailed, //!< Internet connectivity test has failed - IctsOk, //!< Internet connectivity test has been ran successfully - WaitingForStopRequest, //!< Waiting for stop service request - }; - - 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(); - -private: // Data - - // Not owned data - - // Owned data - EngineState mEngineState; //!< current state of the Engine - bool mStartRequestCompleted; //!< 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginmainwindow.h --- a/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginmainwindow.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +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 "Eclipse Public License v1.0" - * which accompanies 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; - WlanLoginApplication* application() 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginnetworkaccessmanager.h --- a/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginnetworkaccessmanager.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginservice.h --- a/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginservice.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +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 "Eclipse Public License v1.0"" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginview.h --- a/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginview.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +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 "Eclipse Public License v1.0" -* which accompanies 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 HbDocumentLoader; -class HbProgressBar; -class WlanLoginWebView; -class QNetworkAccessManager; -class HbWidget; - -// External data types - -// Constants - -// Class declaration -class WlanLoginView : public HbView - { - Q_OBJECT - -public: - WlanLoginView(WlanLoginMainWindow* mainWindow); - virtual ~WlanLoginView(); - - /*! - Enumeration type for current toolbar action in use - */ - enum ActionType { - Cancel, //!< "Cancel" button - Next //!< "Next" button - }; - -private: - void loadDocml(); - -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 handleIctsOk(); - -signals: - void cancelTriggered(); - void nextTriggered(); - - void startIcts(); - -private: // Data - - // Not owned data - WlanLoginMainWindow* mMainWindow; //!< pointer to main window instance - - // Owned data - - QScopedPointer mDocLoader; //! Document loader for list view - - HbProgressBar* mProgressBar; //!< pointer to HB progressbar - HbWidget* mScrollAreaContent; //!< pointer to scroll are content - WlanLoginWebView* mWebView; //!< pointer to web view - HbAction* mCancelAction; //!< pointer to "cancel" action - HbAction* mNextAction; //!< pointer to "next" action - bool mFirstIctsOkResult; //!< Variable for controlling automatic background sending - - }; - -#endif // WLANLOGINWEBVIEW_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginwebpage.h --- a/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginwebpage.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +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: 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginwebview.h --- a/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginwebview.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +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 "Eclipse Public License v1.0" -* which accompanies 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: - WlanLoginWebView(); - ~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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/res/service_conf.xml --- a/wlanutilities/wlanlogin/wlanloginapp/res/service_conf.xml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ - - - wlanlogin - No path - WLAN Login - - com.nokia.symbian.IWlanLogin - 1.0 - WLAN login start - - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/res/wlanlogin.qrc --- a/wlanutilities/wlanlogin/wlanloginapp/res/wlanlogin.qrc Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - - - wlanloginview.docml.bin - - - - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/res/wlanloginview.docml --- a/wlanutilities/wlanlogin/wlanloginapp/res/wlanloginview.docml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/rom/wlanlogin.iby --- a/wlanutilities/wlanlogin/wlanloginapp/rom/wlanlogin.iby Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/rom/wlanlogin_resources.iby --- a/wlanutilities/wlanlogin/wlanloginapp/rom/wlanlogin_resources.iby Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/src/main.cpp --- a/wlanutilities/wlanlogin/wlanloginapp/src/main.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /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: - * - */ - -#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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/src/wlanloginapplication.cpp --- a/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginapplication.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +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 "Eclipse Public License v1.0" -* which accompanies 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.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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/src/wlanlogindocumentloader.cpp --- a/wlanutilities/wlanlogin/wlanloginapp/src/wlanlogindocumentloader.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +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 "Eclipse Public License v1.0" -* which accompanies 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 document loader implementation -* -*/ - -// System includes -#include - -//User includes -#include "wlanloginwebview.h" -#include "wlanlogindocumentloader.h" - -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlanlogindocumentloaderTraces.h" -#endif - -/*! - \class WlanLoginDocumentLoader - \brief WLAN Login document loader implementation. -*/ - -// External function prototypes - -// Local constants - -// ======== LOCAL FUNCTIONS ======== - -// ======== MEMBER FUNCTIONS ======== - -/*! - Constructor -*/ -WlanLoginDocumentLoader::WlanLoginDocumentLoader(const HbMainWindow *window) : HbDocumentLoader(window) -{ - OstTraceFunctionEntry0(WLANLOGINDOCUMENTLOADER_WLANLOGINDOCUMENTLOADER_ENTRY); - OstTraceFunctionExit0(WLANLOGINDOCUMENTLOADER_WLANLOGINDOCUMENTLOADER_EXIT); -} - -/*! - Destructor -*/ -WlanLoginDocumentLoader::~WlanLoginDocumentLoader() -{ - OstTraceFunctionEntry0(WLANLOGINDOCUMENTLOADER_DESTRUCTOR_ENTRY); - OstTraceFunctionExit0(WLANLOGINDOCUMENTLOADER_DESTRUCTOR_EXIT); -} - -/*! - This function returns WLAN Login UI specific objects from DocML -*/ -QObject* WlanLoginDocumentLoader::createObject(const QString& type, const QString &name) -{ - OstTraceFunctionEntry0(WLANLOGINDOCUMENTLOADER_CREATEOBJECT_ENTRY); - - QObject *res(NULL); - if( type == WlanLoginWebView::staticMetaObject.className() ) { - res = new WlanLoginWebView(); - res->setObjectName(name); - } - - if (!res) { - res = HbDocumentLoader::createObject(type, name); - } - OstTraceFunctionEntry0(WLANLOGINDOCUMENTLOADER_CREATEOBJECT_EXIT); - return res; -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/src/wlanloginengine.cpp --- a/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginengine.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,576 +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 "Eclipse Public License v1.0" -* which accompanies 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 -const QString iapIdentifierPrefix = "I_"; - -// ======== LOCAL FUNCTIONS ======== - -// ======== MEMBER FUNCTIONS ======== - -/*! - Constructor. - */ -WlanLoginEngine::WlanLoginEngine(QObject *parent): - QObject(parent), - mEngineState(WaitingForStart), - mStartRequestCompleted(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); - - if (mNetworkSession) { - mNetworkSession->close(); - } - - OstTraceFunctionExit0(WLANLOGINENGINE_DESTRUCTOR_EXIT); -} - - -/*! - Function that returns pointer to network access manager. - - @return Pointer to WlanLoginNetworkAccessManager - */ -WlanLoginNetworkAccessManager* WlanLoginEngine::networkAccessManager() const -{ - OstTraceFunctionEntry0(WLANLOGINENGINE_NETWORKACCESSMANAGER_ENTRY); - OstTraceFunctionExit0(WLANLOGINENGINE_NETWORKACCESSMANAGER_EXIT); - - return mNetworkAccessManager; - -} - - -/*! - Function that returns current state of the engine. - - @return engine state - */ -WlanLoginEngine::EngineState WlanLoginEngine::engineState() -{ - OstTraceFunctionEntry0(WLANLOGINENGINE_ENGINESTATE_ENTRY); - OstTraceFunctionExit0(WLANLOGINENGINE_ENGINESTATE_EXIT); - - 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) -{ - OstTraceFunctionEntry0(WLANLOGINENGINE_SETENGINESTATE_ENTRY); - - mEngineState = newState; - OstTrace1( - TRACE_NORMAL, - WLANLOGINENGINE_SETENGINESTATE_STATE_TRACE, - "WlanLoginEngine::setEngineState;mEngineState=%d", - mEngineState); - - OstTraceFunctionExit0(WLANLOGINENGINE_SETENGINESTATE_EXIT); -} - - -/*! - 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 - - //Check that cancel has not been pressed - if (engineState() != WaitingForStopRequest) { - 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 - //Note that identifier must be given in format I_ + IAP ID - QNetworkConfiguration netConfiguration = mNetConfigurationManager->configurationFromIdentifier(iapIdentifierPrefix + 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); - - //Check that cancel has not been pressed - if (engineState() != WaitingForStopRequest) { - 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 IctsOk: - case IctsFailed: - 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); - - mIctsFirstRun = false; - - if (result == IctsWrapper::ConnectionOk){ - setEngineState(IctsOk); - emit ictsOk(); - } else { - setEngineState(IctsFailed); - } - - OstTraceFunctionExit0(WLANLOGINENGINE_HANDLECONNECTIVITYTESTRESULT_EXIT); -} - -/*! - This slot handles cancelTriggered signal from the view - - */ -void WlanLoginEngine::handleCancelTriggered() -{ - OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLECANCELTRIGGERED_ENTRY); - - //Check if Qt Highway request is completed - if (mStartRequestCompleted == false){ - - switch (engineState()) { - - case UpdatingNetworkConfigurations: - case OpeningNetworkSession: - case NetworkSessionOpened: - setEngineState(WaitingForStopRequest); - emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusCancel); - break; - - case RunningIcts: - stopIcts(); - setEngineState(WaitingForStopRequest); - if (mIctsFirstRun) { - emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusCancel); - } else { - emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusFailed); - } - break; - - case IctsFailed: - setEngineState(WaitingForStopRequest); - emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusFailed); - break; - - default: - break; - } - } else { - //Check race condition - if(engineState() != WaitingForStopRequest) { - qApp->exit(); - } - } - - OstTraceFunctionExit0(WLANLOGINENGINE_HANDLECANCELTRIGGERED_EXIT); -} - -/*! - This slot handles nextTriggered signal from the view - - */ -void WlanLoginEngine::handleNextTriggered() -{ - OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLENEXTTRIGGERED_ENTRY); - - if (mStartRequestCompleted == false ) { - emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusNext); - } - - //put application to background: - WlanLoginApplication* app = static_cast(this->parent()); - app->mainWindow()->lower(); - - OstTraceFunctionExit0(WLANLOGINENGINE_HANDLENEXTTRIGGERED_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 (mStartRequestCompleted == 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(); - } - - OstTraceFunctionExit0(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); - - mStartRequestCompleted = true; - OstTrace1( - TRACE_BORDER, - WLANLOGINENGINE_EMITCOMPLETESERVICEREQUEST_EMIT_TRACE, - "WlanLoginEngine::emitCompleteServiceRequest with status:;status=%d", - status); - emit completeServiceRequest(status); - - OstTraceFunctionExit0(WLANLOGINENGINE_EMITCOMPLETESERVICEREQUEST_EXIT); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/src/wlanloginmainwindow.cpp --- a/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginmainwindow.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +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 "Eclipse Public License v1.0" -* which accompanies 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(this); - 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; -} - -/*! - This function returns pointer to application instance - */ -WlanLoginApplication* WlanLoginMainWindow::application() const -{ - OstTraceFunctionEntry0(WLANLOGINMAINWINDOW_APPLICATION_ENTRY); - OstTraceFunctionExit0(WLANLOGINMAINWINDOW_APPLICATION_EXIT); - - return mAppRef; -} - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/src/wlanloginnetworkaccessmanager.cpp --- a/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginnetworkaccessmanager.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,139 +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: -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/src/wlanloginservice.cpp --- a/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginservice.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/src/wlanloginview.cpp --- a/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginview.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,407 +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 "Eclipse Public License v1.0" -* which accompanies 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 "wlanlogindocumentloader.h" -#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 -//! WLAN Login view docml file -static const QString wlanLoginViewDocml(":/docml/wlanloginview.docml"); - -// ======== LOCAL FUNCTIONS ======== - -// ======== MEMBER FUNCTIONS ======== - -/*! - Constructor - */ -WlanLoginView::WlanLoginView(WlanLoginMainWindow* mainWindow): - mMainWindow(mainWindow), - mDocLoader(new WlanLoginDocumentLoader(mainWindow)), - mProgressBar(NULL), - mScrollAreaContent(NULL), - mWebView(NULL), - mNextAction(NULL), - mFirstIctsOkResult(true) -{ - OstTraceFunctionEntry0(WLANLOGINVIEW_WLANLOGINVIEW_ENTRY); - - loadDocml(); - - setTitleBarVisible(false); - setStatusBarVisible(false); - - // Set white background to content widget - QPixmap pixmap(10,10); - pixmap.fill(Qt::white); - QGraphicsPixmapItem *pixmapItem = new QGraphicsPixmapItem(pixmap); - mScrollAreaContent->setBackgroundItem(pixmapItem); - - mWebView->page()->setNetworkAccessManager(mMainWindow->application()->engine()->networkAccessManager()); - - 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); - - show(); - - OstTraceFunctionExit0(WLANLOGINVIEW_WLANLOGINVIEW_EXIT); -} - -/*! - Loads widgets and objects from the docml file. - */ -void WlanLoginView::loadDocml() -{ - OstTraceFunctionEntry0( WLANLOGINVIEW_LOADDOCML_ENTRY ); - - setObjectName(QString("wlanLoginView")); - QObjectList objectList; - objectList.append(this); - mDocLoader->setObjectTree(objectList); - - bool ok = false; - - mDocLoader->load(wlanLoginViewDocml, &ok); - Q_ASSERT(ok); - - //Fetch pointer for progress bar - mProgressBar = reinterpret_cast( - mDocLoader->findObject("progressBar")); - Q_ASSERT(mProgressBar); - - //Fetch pointer for scroll area content - mScrollAreaContent = reinterpret_cast( - mDocLoader->findObject("scrollAreaContent")); - Q_ASSERT(mScrollAreaContent); - - //Fetch pointer for Web View - mWebView = reinterpret_cast( - mDocLoader->findObject("webView")); - Q_ASSERT(mWebView); - - //Fetch pointer for cancel action - mCancelAction = qobject_cast ( - mDocLoader->findObject("cancelAction")); - Q_ASSERT(mCancelAction != NULL); - - //Fetch pointer for next action - mNextAction = qobject_cast ( - mDocLoader->findObject("nextAction")); - Q_ASSERT(mNextAction != NULL); - - OstTraceFunctionExit0( WLANLOGINVIEW_LOADDOCML_EXIT ); -} - -/*! - Destructor - */ -WlanLoginView::~WlanLoginView() -{ - OstTraceFunctionEntry0(WLANLOGINVIEW_DESTRUCTOR_ENTRY); - - 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 = mMainWindow->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(mMainWindow->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); - - 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); - - OstTraceFunctionExit0(WLANLOGINVIEW_HANDLELOADFINISHED_EXIT); -} - - -/*! - This function handles formSumitted signal from WlanLoginWebPage - - */ -void WlanLoginView::handleFormSubmitted() -{ - OstTraceFunctionEntry0(WLANLOGINVIEW_HANDLEFORMSUBMITTED_ENTRY); - - //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); - - mWebView->stop(); - emit cancelTriggered(); - - OstTraceFunctionExit0(WLANLOGINVIEW_HANDLECANCELACTION_EXIT); -} - - -/*! - This function handles triggered signal from "next" button - - */ -void WlanLoginView::handleNextAction() -{ - OstTraceFunctionEntry0(WLANLOGINVIEW_HANDLENEXTACTION_ENTRY); - - emit nextTriggered(); - - OstTraceFunctionExit0(WLANLOGINVIEW_HANDLENEXTACTION_EXIT); -} - - -/*! - This function handles ictsOk signal from engine - - */ -void WlanLoginView::handleIctsOk() -{ - OstTraceFunctionEntry0(WLANLOGINVIEW_HANDLEICTSRESULT_ENTRY); - - mNextAction->setEnabled(true); - - //Send application to background automatically only in first successfull login - //as in other cases WLAN Wizard won't exist in the underneath - if (mFirstIctsOkResult) { - mFirstIctsOkResult = false; - emit nextTriggered(); - } - - OstTraceFunctionExit0(WLANLOGINVIEW_HANDLEICTSRESULT_EXIT); -} - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/src/wlanloginwebpage.cpp --- a/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginwebpage.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /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: - * - */ - -// 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/src/wlanloginwebview.cpp --- a/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginwebview.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +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 "Eclipse Public License v1.0" -* which accompanies 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(): - QGraphicsWebView(), - 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/traces/OstTraceDefinitions.h --- a/wlanutilities/wlanlogin/wlanloginapp/traces/OstTraceDefinitions.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanlogin/wlanloginapp/wlanloginapp.pro --- a/wlanutilities/wlanlogin/wlanloginapp/wlanloginapp.pro Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +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 "Eclipse Public License v1.0" -# which accompanies 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 no_icon -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/wlanlogindocumentloader.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/wlanlogindocumentloader.h \ - inc/wlanloginmainwindow.h \ - inc/wlanloginnetworkaccessmanager.h \ - inc/wlanloginservice.h \ - inc/wlanloginview.h \ - inc/wlanloginwebpage.h \ - inc/wlanloginwebview.h \ - traces/OstTraceDefinitions.h - -DOCML += res/wlanloginview.docml - -RESOURCES = res/wlanlogin.qrc - -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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanplugin/data/10281BCB.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/data/10281BCB.rss Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,44 @@ +/* +* 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: +* ECOM plugin resource file for WLAN Settings plugin. +* +* +*/ + +#include + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x10281BCB; // Plugin dll UID + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x10207236; // UID for CGSPluginInterface - do not change. + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x10281BCA; // Plugin UID + version_no = 1; + display_name = "WLAN Plugin"; // debug name + default_data = "0x10207250"; // Parent UID (Connection View) + opaque_data = "20"; // Order number + } + }; + } + }; + } + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanplugin/data/wlanpluginrsc.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/data/wlanpluginrsc.rss Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,72 @@ +/* +* 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: +* Resource file for WlanPlugin +* +*/ + + +// RESOURCE IDENTIFIER +NAME PWLB // 4 letter ID + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include + +#include + +// CONSTANTS + +// RESOURCE DEFINITIONS + +//---------------------------------------------------- +// +// +// Needed or loading the resource fails! +// +//---------------------------------------------------- +// +RESOURCE RSS_SIGNATURE + { + } + +//---------------------------------------------------- +// +// r_qtn_set_folder_conn_wlan +// Caption for Plugin. +// +//---------------------------------------------------- +// +RESOURCE TBUF r_qtn_set_folder_conn_wlan { buf = qtn_set_folder_conn_wlan; } + +RESOURCE TBUF r_qtn_cp_detail_wlan_no_nw_available { buf = qtn_cp_detail_wlan_no_nw_available; } + +RESOURCE TBUF r_qtn_cp_detail_wlan_scan_off { buf = qtn_cp_detail_wlan_scan_off; } + +RESOURCE TBUF r_qtn_cp_detail_wlan_known_nw_available { buf = qtn_cp_detail_wlan_known_nw_available; } + +RESOURCE TBUF r_qtn_cp_detail_wlan_network_available { buf = qtn_cp_detail_wlan_network_available; } + +RESOURCE TBUF r_qtn_cp_detail_wlan_networks_available { buf = qtn_cp_detail_wlan_networks_available; } + +RESOURCE TBUF r_qtn_cp_detail_wlan_connected { buf = qtn_cp_detail_wlan_connected; } + +RESOURCE TBUF r_qtn_err_os_general { buf = qtn_err_os_general ; } + +//End of File diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 WLAN Settings Plug-in +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +// export iby files +../rom/wlanplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wlanplugin.iby) +../rom/wlanpluginresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(wlanpluginresources.iby) + +// export localised loc file +../loc/wlanplugin.loc MW_LAYER_LOC_EXPORT_PATH(wlanplugin.loc) + +PRJ_MMPFILES +./wlanplugin.mmp + +// gnumakefile wlanpluginicons.mk + +PRJ_EXTENSIONS + +START EXTENSION s60/mifconv +OPTION TARGETFILE wlanplugin.mif +OPTION HEADERFILE wlanplugin.mbg +OPTION SOURCES -c16,8 qgn_prop_set_conn_wlan \ + -c16,8 qgn_prop_set_conn_wlan_conn \ + -c16,8 qgn_prop_set_conn_wlan_off \ + -c8,8 qgn_indi_wlan_signal_low_add \ + -c8,8 qgn_indi_wlan_signal_med_add \ + -c8,8 qgn_indi_wlan_signal_good_add +END + +// End of File diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanplugin/group/wlanplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/group/wlanplugin.mmp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,82 @@ +/* +* 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 project specification file for the wlanplugin. +* +* +*/ + +#include //this is needed for RESOURCE_FILES_DIR +#include + +CAPABILITY CAP_ECOM_PLUGIN +TARGET wlanplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x10281BCB +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE wlanplugin.cpp +SOURCE wlanpluginimplementationtable.cpp +SOURCE wlanpluginwlanstate.cpp +SOURCE wlanplugindbobserver.cpp +SOURCE wlanplugintimeshifter.cpp + +USERINCLUDE ../data + +// Component specific internal headers +USERINCLUDE ../inc +SYSTEMINCLUDE ../../inc + +//Macro to /epoc32 headers +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../data + +//ECOM resource definition +START RESOURCE 10281BCB.rss +TARGET wlanplugin.rsc +END // ECOM resource definition + +//WlanSettingsPlugin resources +START RESOURCE wlanpluginrsc.rss +HEADER +TARGETPATH RESOURCE_FILES_DIR +LANGUAGE_IDS +END//WlanPlugin resources + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY avkon.lib +LIBRARY FeatMgr.lib +LIBRARY bafl.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY commonengine.lib // RConeResourceLoader +LIBRARY aknskins.lib // AknsUtils.h +LIBRARY egul.lib +LIBRARY GSEcomPlugin.lib +LIBRARY apgrfx.lib +LIBRARY apparc.lib +LIBRARY ws32.lib +LIBRARY wsfwlaninfo.lib +LIBRARY wsfmodel.lib +LIBRARY wsfwlaninfosorting.lib +LIBRARY commonui.lib +LIBRARY aknnotify.lib +LIBRARY eiksrv.lib +LIBRARY COMMSDAT.lib +LIBRARY cmmanagerdatabase.lib +DEBUGLIBRARY flogger.lib + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanplugin/group/wlanpluginicons.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/group/wlanpluginicons.mk Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,71 @@ +# +# 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: Makefile for icons of WlanSettingsPlugin +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z +else +ZDIR=\epoc32\data\z +endif + + +TARGETDIR=$(ZDIR)\resource\apps +ICONTARGETFILENAME=$(TARGETDIR)\wlanplugin.mif + +HEADERDIR=\epoc32\include +HEADERFILENAME=$(HEADERDIR)\wlanplugin.mbg + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by +# MifConv if the mask detph is defined. +# +# NOTE 2: Usually, source paths should not be included in the bitmap +# definitions. MifConv searches for the icons in all icon directories in a +# predefined order, which is currently \s60\icons, \s60\bitmaps2, \s60\bitmaps. +# The directory \s60\icons is included in the search only if the feature flag +# __SCALABLE_ICONS is defined. +# ---------------------------------------------------------------------------- + +RESOURCE : + mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ + /c16,8 qgn_prop_set_conn_wlan.svg \ + /c16,8 qgn_prop_set_conn_wlan_conn.svg \ + /c16,8 qgn_prop_set_conn_wlan_off.svg \ + /c8,8 qgn_indi_wlan_signal_low_add.svg \ + /c8,8 qgn_indi_wlan_signal_med_add.svg \ + /c8,8 qgn_indi_wlan_signal_good_add.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(HEADERFILENAME)&& \ + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanplugin/inc/wlanplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/inc/wlanplugin.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,246 @@ +/* +* 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: +* Header file for CWlanPlugin class. +* +*/ + +#ifndef __C_WLANPLUGIN_H__ +#define __C_WLANPLUGIN_H__ + +// System includes +#include +#include +#include + +//forward declarations +class CAknNavigationDecorator; +class CAknViewAppUi; +class CAknNullService; +class CGSParentPlugin; +class CWlanPluginWlanState; + +/** +* WLAN plugin's UID +*/ +const TUid KWlanPluginUid = { 0x10281BCA }; + +/** +* WlanSniffer applicatoin's UID +*/ +const TUid KSnifferAppUid = { 0x10281CAA }; + +/** +* WLAN plugin class. +*/ +class CWlanPlugin : public CGSPluginInterface, + public MAknServerAppExitObserver + { + public://Constructors & destructors + + /** + * First phase constructor + * Creates new instance of CWlanPlugin + * @param aInitParams Initialising parameters + * @return a plugin instance + */ + static CWlanPlugin* NewL( TAny* aInitParams ); + + /** + * Destructor + */ + ~CWlanPlugin(); + + public: // Functions from base class + + /** + * From CAknView + */ + + /** + * Returns the Plugin's UID + * @return UID of the plugin + */ + TUid Id() const; + + /* + * Funtion called when This is activated. + * @param aPrevViewId The previous View Id + * @param aCustomMessageId Id of a custom message + * @param aCustomMessage Content of the custom message + */ + void DoActivateL( const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage ); + + /* + * Funtion called when this is deactivated. + */ + void DoDeactivate(); + + public: + + /** + * from CGSPluginInterface + */ + + /* + * Called by the CP framework. This returns the + * caption of the plugin, the first line of the listbox + * element of it, shown in the Control Panel UI. + * @param aCaption The caption is copied here + */ + void GetCaptionL( TDes& aCaption ) const; + + /* + * Returns if it has bitmap. + * @return The logical value of having birmap + */ + TBool HasBitmap() const; + + /* + * Returns a bitmap. + * @param aBitmap the returned bitmap + * @param aMask the returned mask of the bitmap + */ + void GetBitmapL( CFbsBitmap* aBitmap, CFbsBitmap* aMask ) const; + + + /* + * Returns a the plugin provider's cathegory + * @return The id of the cathegory + */ + TInt PluginProviderCategory() const; + + /* + * This function is called, when the plugin is selected. + * In this case it starts sniffer application + * @param aSelectionType The type of the selection + */ + void HandleSelection( const TGSSelectionTypes aSelectionType ); + + /* + * Returns the type of the item. + * @return The type of the item + */ + TGSListboxItemTypes ItemType(); + + /* + * Creates the asked type icon (main icon or D column icon) + * and returns a pointer to it. + * @param aIconType Type of the icon + * @return the asked icon + */ + CGulIcon* CreateIconL( const TUid aIconType ); + + /** + * Method for checking, if plugin should be visible and used in GS FW. + * (for example shown in listbox of the parent view). + * + * On default plugin is visible. Overwrite this function to enable or + * disable your plugin dynamically. + * + * @return ETrue if plugin should be visible in GS. + * @return EFalse if plugin should not be visible in GS. + */ + virtual TBool Visible() const; + + /* + * The aKey identified value is given back by it. Actually + * the the second line of the listbox element of this plugin + * is given by this function. + * @param aKey The id of the asked value. + * @param aValue The returned value. + */ + void GetValue( const TGSPluginValueKeys aKey, + TDes& aValue ); + + + void HandleServerAppExit(TInt aReason); + + + protected: + + /** + * Constructor + */ + CWlanPlugin(); + + private: + + /** + * Second phase constructor + */ + TAny ConstructL(); + + /** + * Opens the localized resource file + */ + void OpenLocalizedResourceFileL(); + + /** + * Launches Sniffer application + */ + void LaunchSnifferAppL(); + + /** + * Queries if wlan is supported + * @return if the wlan is supported + */ + TBool GetWlanSupported() const; + + /** + * Shows an error note in case of error. + * @param aErrorCode The error code. + */ + void ShowErrorNote(TInt aErrorCode); + + /** + * Shows the error note and resolves the error. + * @param aErrorCode The error code. + */ + TBool ShowErrorNoteL(TInt aErrorCode); + + /** + * Shows a general error note + */ + void ShowGeneralErrorNoteL(); + + private: //data + + /* + * @var resource loader + */ + RConeResourceLoader iResources; + + /* + * @var null service + */ + CAknNullService* iNullService; + + /* + * @var stores the present status line + */ + HBufC* iStatusLine; + + /* + * @var wlan state handler/observer + */ + CWlanPluginWlanState* iWlanState; + + }; + +#endif //__C_WLANPLUGIN_H__ + +//End of file \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanplugin/inc/wlanplugindbobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/inc/wlanplugindbobserver.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,105 @@ +/* +* 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: +* Header file for CWlanPluginDbObserver class. +* +*/ + + +#ifndef C_WLAN_PLUGIN_DB_OBSERVER +#define C_WLAN_PLUGIN_DB_OBSERVER + +// System includes +#include +#include +#include +#include +#include + +//forward declaration +class CWlanPluginWlanState; + +/** +* Database observer class. +*/ +NONSHARABLE_CLASS( CWlanPluginDbObserver ) : public CActive + { + public: + /** + * The Constructor. + * @param aState Pointer to the WLAN State object. + */ + CWlanPluginDbObserver( CWlanPluginWlanState* aState ); + + /** + * First phase of two phased construction. + * @param aState Pointer to the WLAN State object. + */ + static CWlanPluginDbObserver* NewL( CWlanPluginWlanState* aState ); + + /** + * This function activates this object as an active object. + */ + void ActivateItL(); + + /** + * Destructor. + */ + virtual ~CWlanPluginDbObserver(); + + protected: + /** + * When the WLAN device settings table is accessed this function + * is called. Handle of the active object. + */ + void RunL(); + + /** + * Whan waiting for a database access is stopped this function + * is called. + */ + void DoCancel(); + + private: + /** + * Second phase of two phase construction. + */ + void ConstructL(); + + private: + /** + * @var Pointer to the WLAN state object to ask and set scanning + * state. + */ + CWlanPluginWlanState * iWlanState; + + /** + * A CommsDat session fod database access. + */ + CMDBSession* iSession; + + /** + * A class representing a recor of WLAN Devive Settings table. + */ + CCDWlanDeviceSettingsRecord* iRecord; + + /** + * The value of it shows the scan state of the WLAN availablity + */ + TBool iOuterScanState; + + }; + + +#endif //C_WLAN_PLUGIN_DB_OBSERVER \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanplugin/inc/wlanpluginlogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/inc/wlanpluginlogger.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,101 @@ +/* +* 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: Functions and macros for debugging +* +* +*/ + + +#ifndef WLANPLUGINLOGGER_H_INCLUDED +#define WLANPLUGINLOGGER_H_INCLUDED + +// ========== INCLUDE FILES ================================ + +#include +#include + +#ifdef _DEBUG + +// Format string: enter function. +_LIT( KCCDLGLogEnterFn, "-> %S" ); +// Format string: leave function. +_LIT( KCCDLGLogLeaveFn, "<- %S" ); +// Format string: time. +_LIT( KCCDLGLogTimeFormatString, "%H:%T:%S:%*C2" ); + +// Logging directory. +_LIT( KCCDLGLogDir, "wlanplugin" ); +// Log file name. +_LIT( KCCDLGLogFile, "wlanplugin.txt" ); +_LIT( KCCDLGLogBanner, "****************\n\nWlanPlugin\n\n****************" ); +_LIT( KCCDLGLogExit, "WlanPlugin : Exit" ); + +#define CLOG_CREATE {FCreate();} +#define CLOG_DELETE {RFileLogger::Write(KCCDLGLogDir, KCCDLGLogFile, EFileLoggingModeAppend, KCCDLGLogExit);} +#define CLOG_ENTERFN(a) {_LIT(temp, a); RFileLogger::WriteFormat(KCCDLGLogDir, KCCDLGLogFile, EFileLoggingModeAppend, KCCDLGLogEnterFn, &temp);} +#define CLOG_LEAVEFN(a) {_LIT(temp, a); RFileLogger::WriteFormat(KCCDLGLogDir, KCCDLGLogFile, EFileLoggingModeAppend, KCCDLGLogLeaveFn, &temp);} +#define CLOG_WRITE(a) {_LIT(temp, a); RFileLogger::Write(KCCDLGLogDir, KCCDLGLogFile, EFileLoggingModeAppend, temp);} +#define CLOG_WRITE_TIMESTAMP(a) {_LIT(temp, a); TTime time; time.HomeTime(); TBuf<256> buffer; time.FormatL( buffer, KCCDLGLogTimeFormatString ); buffer.Insert(0, temp); RFileLogger::Write(KCCDLGLogDir, KCCDLGLogFile, EFileLoggingModeAppend, buffer); } +#define CLOG_WRITEF FPrint + + +inline void FPrint(const TRefByValue aFmt, ...) + { + VA_LIST list; + VA_START(list,aFmt); + RFileLogger::WriteFormat(KCCDLGLogDir, KCCDLGLogFile, EFileLoggingModeAppend, aFmt, list); + } + +inline void FPrint(const TDesC& aDes) + { + RFileLogger::WriteFormat(KCCDLGLogDir, KCCDLGLogFile, EFileLoggingModeAppend, aDes); + } + +inline void FHex(const TUint8* aPtr, TInt aLen) + { + RFileLogger::HexDump(KCCDLGLogDir, KCCDLGLogFile, EFileLoggingModeAppend, 0, 0, aPtr, aLen); + } + +inline void FHex(const TDesC8& aDes) + { + FHex(aDes.Ptr(), aDes.Length()); + } + +inline void FCreate() + { + TFileName path( _L( "c:\\logs\\" ) ); + path.Append( KCCDLGLogDir ); + path.Append( _L( "\\" ) ); + RFs& fs = CEikonEnv::Static()->FsSession(); + fs.MkDirAll( path ); + RFileLogger::WriteFormat( KCCDLGLogDir, KCCDLGLogFile, + EFileLoggingModeAppend, KCCDLGLogBanner ); + } + +#else // ! _DEBUG + +inline void FPrint(const TRefByValue /*aFmt*/, ...) { }; + +#define CLOG_CREATE +#define CLOG_DELETE +#define CLOG_ENTERFN(a) +#define CLOG_LEAVEFN(a) +#define CLOG_WRITE(a) +#define CLOG_WRITEF 1 ? ((void)0) : FPrint +#define CLOG_WRITE_TIMESTAMP(a) + +#endif // _DEBUG + + +#endif // WLANPLUGINLOGGER_H_INCLUDED diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanplugin/inc/wlanplugintimeshifter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/inc/wlanplugintimeshifter.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWlanPluginTimeShifter class. +* +*/ + + +#ifndef C_WLAN_PLUGIN_TIME_SHIFTER +#define C_WLAN_PLUGIN_TIME_SHIFTER + +#include + + +class CWlanPluginWlanState; + + +NONSHARABLE_CLASS( CWlanPluginTimeShifter ) : public CActive + { + + public: + /* + * First phase of two phase construction + */ + static CWlanPluginTimeShifter* NewLC( + CWlanPluginWlanState* aWlanState ); + + /* + * First phase of two phase construction + */ + static CWlanPluginTimeShifter* NewL( + CWlanPluginWlanState* aState ); + + /* + * Destructor + */ + virtual ~CWlanPluginTimeShifter(); + + /* + * + */ + void ActivateIt(); + + + protected: + + /** + * + * + */ + void RunL(); + + /** + * + * + */ + void DoCancel(); + + /** + * Constructor + */ + CWlanPluginTimeShifter( CWlanPluginWlanState* aWlanState ); + + + private: + + /* + * Second phase of 2 phase construction + */ + void ConstructL(); + + private: + + /** + * @var Pointer to the WLAN state object to ask and set scanning + * state. + */ + CWlanPluginWlanState * iWlanState; + + + + + }; + +#endif //C_WLAN_PLUGIN_TIME_SHIFTER \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanplugin/inc/wlanpluginwlanstate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/inc/wlanpluginwlanstate.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,345 @@ +/* +* 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: +* Header file for WlanPluginWlanState class. +* +*/ + + +#ifndef __C_WLANPLUGINWLANSTATE_H__ +#define __C_WLANPLUGINWLANSTATE_H__ + +// System includes +#include +#include +#include +#include + +//forward declarations +class CWsfModel; +class CWsfWlanInfoArray; +class CCoeEnv; +class CGSParentPlugin; +class CGulIcon; +class CWlanPluginDbObserver; +class CWsfWlanInfoArrayVisitor; +class CWlanPluginTimeShifter; + +/** +* WLAN state class. +*/ +class CWlanPluginWlanState : public CBase, + public MWsfStateChangeObserver + { + + public: + + /* + * Default constructor + * @param aParent The the parent plugin of it in. + * the Control Panel + */ + CWlanPluginWlanState( CGSParentPlugin *aParent ); + + /* + * Destructor + */ + virtual ~CWlanPluginWlanState(); + + /* + * First phase of 2 phase constructor. + * @param aParent pointer to parent plugin. + * @return An instance. + */ + static CWlanPluginWlanState* NewLC( CGSParentPlugin *aParent ); + + /* + * First phase of 2 phase constructor + * @param aParent Pointer to parent plugin. + * @return An instance. + */ + static CWlanPluginWlanState* NewL( CGSParentPlugin *aParent ); + + /* + * Gives back the wlan state descriptor into aDes. + * @param aDes Reference to the destination descriptor. + */ + void GetStateStringL( TDes& aDes ); + + /* + * Gives back the wlan state main icon. The result is + * ETrue if there is valid id. + * @param aPic The id of the icon. + * @param aPicMask The id of the mask. + */ + TBool GetMainIconL( TInt& aPic, + TInt& aPicMask, + TAknsItemID& aItemID ); + + /* + * Gives back the signal strength. The result is + * ETrue if there is valid strength, and the state + * is connected. + * @param aPic The id of the icon. + * @param aPicMask The id of the mask. + * @return If D column icon is needed. + */ + TBool GetStrengthIconL( TInt& aPic, + TInt& aPicMask, + TAknsItemID& aItemId ); + + /** + * Returns if the observed scanning is on + * @return If the scanning is on. + */ + TBool IsScanning(); + + /** + * Sets the scanning value, and manage effects, caused + * by it. It is used by the dbobserver class to manage + * setting scanning value caused by the "Wlan availability". + * @param aScanning The set value. + */ + void SetScanningL( TBool aScanning ); + + /** + * + */ + void DirectlyScanL(); + + /** + * + */ + void DeleteTimeShifter(); + + public: //from MWlanSnifferStateChangeObserver + /* + * The current wlan data has changed + * and it is ready to be retrieved. + */ + virtual void WlanListChangedL(); + + /* + * Engine error occured + * @param aError System wide error to describe what has happened. + */ + virtual void NotifyEngineError( TInt aError ); + + /* + * The network scanning has been disabled. + */ + virtual void ScanDisabledL(); + + /* + * The network scanning has been enabled. + */ + virtual void ScanEnabledL(); + + /* + * Wlan bearer opened using accesspoint + */ + virtual void WlanConnectionActivatedL(); + + /* + * wlan bearer has been closed + */ + virtual void WlanConnectionClosedL(); + + /** + * Connection creation process finished + * @param aError System wide error code + */ + virtual void ConnectionCreationProcessFinishedL( TInt aError ); + + protected: + /* + * Makes the wlan state descriptor according to + * the given info array. + * @param aArray the given info array. + * @param aDes the result is written here. + */ + void MakeStateStringL( CWsfWlanInfoArray* aArray, HBufC*& aBuf ); + + + /* + * Gives the connected wlan status string. + * @param aItem Ref to the result descriptor. + */ + void FormatConnectedL( HBufC*& aBuf ); + + /* + * Gives the offline wlan status string. + * @param aItem Ref to the result descriptor. + */ + void FormatStatusOffL( HBufC*& aBuf ); + + /* + * Decides if there is one interesting wlan or + * more and writes out wlan state string. + * @param aArray input array of wlans. + * @param aItem ref to the result descriptor. + */ + void CheckWlansL( CWsfWlanInfoArray* aArray, HBufC*& aBuf ); + + /* + * Decides if the wlan given is connected, or known + * and writes out the suitable text to aItem according + * to it. + * @param aWlan Input wlan info. + * @param aItem Ref to the result descriptor. + */ + void FormatWlanSingleLineL( TWsfWlanInfo& aWlan, HBufC*& aBuf ); + + /* + * Decides if there is one unknown or more + * networks and writes solution according to it. + * @param aMultipleUnknownWlans If + * there is more network available. + * @param aItem Ref to the result descriptor. + */ + void FormatUnknownWlansSingleLineL( + const TBool aMultipleUnknownWlans, + HBufC*& aBuf ); + + /* + * Gives the descripto meaning there are no + * wlans found. + * @param aItem Ref to output descriptor. + */ + void FormatNoWlansAvailableL( HBufC*& aBuf ); + + /* + * Checks if the wlan state is different from + * the one iPresentString represent. The + * result is ETrue if the state changed. + * @return If the state is changed. + */ + TBool IsStateChangedL(); + + /* + * Gets the present signal strength. It is a normal + * strength if the wlan state is connected, otherwise it is + * ENoSignal. + * @return The signal strength + */ + TWsfWlanSignalStrengthLevel GetSignalStrength(); + + /** + * Updates the parent plugin in Control Panel + */ + void UpdateParentViewL(); + + private: + + /* + * Second phase of two phase construction + */ + void ConstructL(); + + /** + * Updates the wlan list + */ + void UpdateWlanListL(); + + protected: + + /* + * @var pointer to a sniffer model + */ + CWsfModel* iEngine; + + /* + * @var present wlan info list + */ + CWsfWlanInfoArray* iInfoArray; + + /* + * @var if wlan is scanning + */ + TBool iScanning; + + /* + * @var if there is wlan connection + */ + TInt iConnected; + + /* + * @var true if the plugin explicitely started wlan scanning + */ + TInt iExplicitScanning; + + /* + * @var pointer to coeEnv + */ + CCoeEnv* iCoeEnv; + + /* + * @var pointer to parent plugin + */ + CGSParentPlugin* iParent; + + /* + * @var the present written out status string + */ + HBufC* iPresentString; + + /* + * @var the present signal strength + */ + TWsfWlanSignalStrengthLevel iSignalStrength; + + /** + * @var The Database observer class + */ + CWlanPluginDbObserver* iDbObserver; + + /** + * @var A bool representing if calling an update for parent + * plugin is enabled. True if the parent do not have be updated. + */ + TBool iSupressParentUpdate; + + /** + * @var A bool false, if wlan list update is valid to call + */ + TBool iSupressUpdateWlan; + + /** + * @var object needed filtering out wlans + */ + CWsfWlanInfoArrayVisitor* iWlanInfoBranding; + + /* + * @var the second line data reachable is valid + */ + TBool iValidSecondLine; + + /* + * @var tThe wlan info of the connected network + */ + TWsfWlanInfo iConnectedWlanInfo; + + /* + * @var Time shifter + */ + CWlanPluginTimeShifter* iTimeShifter; + + /* + * @var Time shifter supressing + */ + TBool iSupressTimeShifter; + + }; + +#endif //__C_WLANPLUGINWLANSTATE_H__ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanplugin/loc/wlanplugin.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/loc/wlanplugin.loc Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,69 @@ +/* +* 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 strings for Plugin +* +*/ + + +// LOCALISATION STRINGS + +//d:Text of a list item in Connection view's list +//d:Item opens WLAN view +//l:list_double_large_graphic_pane_t1 +//r:5.0 +#define qtn_set_folder_conn_wlan "WLAN" + +// d:Text to indicate that the wlan scanning is off. +// d:(one row) +// l:list_double_large_graphic_pane_t2 +#define qtn_cp_detail_wlan_scan_off "WLAN scanning off" + +// d:Text indicate that wlan scan did not find any wlan in the range +// d:(one row) +// l:list_double_large_graphic_pane_t2 +#define qtn_cp_detail_wlan_no_nw_available "No networks available" + +// d:Text used to tell that a preconfigured wlan accesspoint is found. +// d:%U stands for wlan ssid( max 50 digits ) +// d:(one row) +// l:list_double_large_graphic_pane_t2 +#define qtn_cp_detail_wlan_known_nw_available "'%U' available" + +// d:Text use to indicate that a non-configured wlan is in the range +// d:(one row) +// l:list_double_large_graphic_pane_t2 +#define qtn_cp_detail_wlan_network_available "Network available" + +// d:Text use to indicate that multiple non-configured wlans is in the range +// d:(one row) +// l:list_double_large_graphic_pane_t2 +#define qtn_cp_detail_wlan_networks_available "Networks available" + +// d:Text used the show connected wlan +// d: %U wlan ssid ( max 50 digits ) +// d:(one row) +// l:list_double_large_graphic_pane_t2 +#define qtn_cp_detail_wlan_connected "Connected to '%U'" + +//d: In case of error, the error code is passed to error resolver +//d: and the error note is displayed accordingly. If error resolver +//d: cannot resolve the error, an error note "System error" is displayed. +//l: popup_note_window/opt2 +//w: +//r:5.0 +// +#define qtn_err_os_general "System error" + +// End of File diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanplugin/rom/wlanplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/rom/wlanplugin.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,30 @@ +/* +* 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: Image description file for project WlanSettingsPlugin +* +*/ + + +#ifndef __WLANPLUGIN_IBY__ +#define __WLANPLUGIN_IBY__ + +#ifdef __PROTOCOL_WLAN + +ECOM_PLUGIN(wlanplugin.DLL,10281BCB.rsc) + +SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,wlanplugin) + +#endif //__PROTOCOL_WLAN + +#endif __WLANPLUGIN_IBY__ \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanplugin/rom/wlanpluginresources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/rom/wlanpluginresources.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,28 @@ +/* +* 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: Image description file for project WlanSettingsPlugin +* +*/ + + +#ifndef __WLANPLUGIN_RESOURCES_IBY__ +#define __WLANPLUGIN_RESOURCES_IBY__ + +#ifdef __PROTOCOL_WLAN + +data=DATAZ_\RESOURCE_FILES_DIR\wlanpluginrsc.rsc RESOURCE_FILES_DIR\wlanpluginrsc.rsc + +#endif //__PROTOCOL_WLAN + +#endif __WLANPLUGIN_RESOURCES_IBY__ \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanplugin/src/wlanplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/src/wlanplugin.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,493 @@ +/* +* 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: WlanPlugin class. +* +*/ + + +// INCLUDE FILES + +// User includes +#include "wlanplugin.h" +#include "wlanpluginwlanstate.h" +#include "wlanpluginlogger.h" + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +// Resource file location +_LIT( KWlanPluginResourceFileName, "z:wlanpluginrsc.rsc" ); + +// ROM folder +_LIT( KDriveZ, "z:" ); + +// Name of the MBM file containing icons +_LIT( KFileIcons, "wlanplugin.mif"); + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CWlanPlugin::NewL +// First phase constructor +// --------------------------------------------------------- +CWlanPlugin* CWlanPlugin::NewL( TAny* /*aInitParams*/ ) + { + CWlanPlugin* self = new ( ELeave ) CWlanPlugin(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------- +// Destructor +// --------------------------------------------------------- +CWlanPlugin::~CWlanPlugin() + { + CLOG_ENTERFN( "CWlanPlugin::~CWlanPlugin()" ); + + iResources.Close(); + + if( iNullService ) + { + delete iNullService; + } + if ( iWlanState ) + { + delete iWlanState; + } + + CLOG_ENTERFN( "CWlanPlugin::~CWlanPlugin()" ); + } + +// --------------------------------------------------------- +// CWlanPlugin::ConstructL +// --------------------------------------------------------- +TAny CWlanPlugin::ConstructL() + { + CLOG_CREATE; + + CLOG_ENTERFN( "CWlanPlugin::ConstructL()" ); + + BaseConstructL(); + + OpenLocalizedResourceFileL(); + + // Check Wlan support in construction phase to + // avoid creating of plugin when it is not necessary. + if( GetWlanSupported() ) + { + // This is the parent plugin + CGSParentPlugin* parent = static_cast( + AppUi()->View( KGSConPluginUid ) ); + + iWlanState = CWlanPluginWlanState::NewL( parent ); + } + else + { + User::Leave( KErrNotSupported ); + } + + CLOG_LEAVEFN( "CWlanPlugin::ConstructL()" ); + } + +// --------------------------------------------------------- +// CWlanPlugin::Id +// --------------------------------------------------------- +TUid CWlanPlugin::Id() const + { + CLOG_ENTERFN( "CWlanPlugin::Id()" ); + + CLOG_LEAVEFN( "CWlanPlugin::Id()" ); + + return KWlanPluginUid; + + } + +// --------------------------------------------------------- +// CWlanPlugin::DoActivateL +// --------------------------------------------------------- +void CWlanPlugin::DoActivateL( const TVwsViewId& /*aPrevViewId*/, + TUid /*aCustomMessageId*/, + const TDesC8& /*aCustomMessage*/ ) + { + CLOG_ENTERFN( "CWlanPlugin::DoActivateL()" ); + //no implementation required + CLOG_LEAVEFN( "CWlanPlugin::DoActivateL()" ); + } + +// --------------------------------------------------------- +// CWlanPlugin::DoDeactivate +// --------------------------------------------------------- +void CWlanPlugin::DoDeactivate() + { + CLOG_ENTERFN( "CWlanPlugin::DoDeactivate()" ); + //no implementation required + CLOG_LEAVEFN( "CWlanPlugin::DoDeactivate()" ); + } + +// --------------------------------------------------------- +// CWlanPlugin::GetCaptionL +// --------------------------------------------------------- +void CWlanPlugin::GetCaptionL( TDes& aCaption ) const + { + CLOG_ENTERFN( "CWlanPlugin::GetCaptionL()" ); + + StringLoader::Load( aCaption, R_QTN_SET_FOLDER_CONN_WLAN ); + + CLOG_LEAVEFN( "CWlanPlugin::GetCaptionL()" ); + } + +// --------------------------------------------------------- +// CWlanPlugin::HasBitmap +// --------------------------------------------------------- +TBool CWlanPlugin::HasBitmap() const + { + CLOG_ENTERFN( "CWlanPlugin::HasBitmap()" ); + + CLOG_LEAVEFN( "CWlanPlugin::HasBitmap()" ); + + return EFalse; + } + +// --------------------------------------------------------- +// CWlanPlugin::GetBitmapL +// --------------------------------------------------------- +void CWlanPlugin::GetBitmapL( CFbsBitmap* /*aBitmap*/, + CFbsBitmap* /*aMask*/ ) const + { + + CLOG_ENTERFN( "CWlanPlugin::GetBitmapL()" ); + CLOG_LEAVEFN( "CWlanPlugin::GetBitmapL()" ); + //no bitmap + User::Leave( KErrNotFound ); + } + +// --------------------------------------------------------- +// CWlanPlugin::PluginProviderCategory +// --------------------------------------------------------- +TInt CWlanPlugin::PluginProviderCategory() const + { + + CLOG_ENTERFN( "CWlanPlugin::PluginProviderCategory()" ); + CLOG_LEAVEFN( "CWlanPlugin::PluginProviderCategory()" ); + + return EGSPluginProviderOEM; + } + +// --------------------------------------------------------- +// CWlanPlugin::HandleSelection +// --------------------------------------------------------- +void CWlanPlugin::HandleSelection( + const TGSSelectionTypes /*aSelectionType*/ ) + { + CLOG_ENTERFN( "CWlanPlugin::HandleSelection()" ); + + TRAPD( error, LaunchSnifferAppL() ); + if( error != KErrNone && + error != KErrNotFound && + error != KErrServerTerminated ) + { + ShowErrorNote( error ); + } + + CLOG_LEAVEFN( "CWlanPlugin::HandleSelection()" ); + } + +// --------------------------------------------------------- +// CWlanPlugin::ItemType +// --------------------------------------------------------- +TGSListboxItemTypes CWlanPlugin::ItemType() + { + + CLOG_ENTERFN( "CWlanPlugin::ItemType()" ); + CLOG_LEAVEFN( "CWlanPlugin::ItemType()" ); + + return EGSItemTypeSettingDialog; + } + +// --------------------------------------------------------- +// CWlanPlugin::CreateIconL +// --------------------------------------------------------- +CGulIcon* CWlanPlugin::CreateIconL( const TUid aIconType ) + { + + CLOG_ENTERFN( "CWlanPlugin::CreateIconL()" ); + + TFileName iconsFileName; + + iconsFileName.Append( KDriveZ ); + iconsFileName.Append( KDC_APP_BITMAP_DIR ); + iconsFileName.Append( KFileIcons ); + + CGulIcon* icon; + + TInt pic, picmask; + TAknsItemID itemid; + //if the main icon is asked + if ( aIconType == KGSIconTypeLbxItem ) + { + if ( iWlanState->GetMainIconL( pic, picmask, itemid ) ) + { + icon = AknsUtils::CreateGulIconL( AknsUtils::SkinInstance(), + itemid, + iconsFileName, + pic, + picmask ); + } + else + { + icon = CGSPluginInterface::CreateIconL( aIconType ); + } + } + //if the secondary icon is asked + else if ( aIconType == KGSIconTypeDColumn ) + { + //if there should be icon + if ( iWlanState->GetStrengthIconL( pic, picmask, itemid ) ) + { + icon = CGulIcon::NewLC(); + CFbsBitmap* bitmap; + CFbsBitmap* mask; + + // Creates bitmap an icon. + AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(), + itemid, + KAknsIIDQsnIconColors, + EAknsCIQsnIconColorsCG13, + bitmap, + mask, + iconsFileName, + pic, + picmask, + KRgbBlack ); + + icon->SetBitmap( bitmap ); + icon->SetMask( mask ); + CleanupStack::Pop( icon ); + } + //if there should be no icons + else + { + icon = CGSPluginInterface::CreateIconL( aIconType ); + } + } + //in other case of icons + else + { + icon = CGSPluginInterface::CreateIconL( aIconType ); + } + + CLOG_LEAVEFN( "CWlanPlugin::CreateIconL()" ); + + return icon; + } + +// --------------------------------------------------------- +// CVWlanPlugin::Visible +// --------------------------------------------------------- +TBool CWlanPlugin::Visible() const + { + + CLOG_ENTERFN( "CWlanPlugin::Visible()" ); + CLOG_LEAVEFN( "CWlanPlugin::Visible()" ); + + return GetWlanSupported(); + } + +// --------------------------------------------------------- +// CWlanPlugin::CWlanPlugin +// --------------------------------------------------------- +CWlanPlugin::CWlanPlugin(): + iResources( *CCoeEnv::Static() ), + iNullService( NULL ) + { + // no implementation required + } + +// --------------------------------------------------------- +// CWlanPlugin::GetValue +// --------------------------------------------------------- +void CWlanPlugin::GetValue( const TGSPluginValueKeys aKey, + TDes& aValue ) + { + CLOG_ENTERFN( "CWlanPlugin::GetValue()" ); + + //if the second line of the listbox is asked + if( aKey == EGSPluginKeySettingsItemValueString ) + { + TRAP_IGNORE( iWlanState->GetStateStringL( aValue ) ); + } + + CLOG_LEAVEFN( "CWlanPlugin::GetValue()" ); + } + +// --------------------------------------------------------- +// CWlanPlugin::OpenLocalizedResourceFileL +// --------------------------------------------------------- +void CWlanPlugin::OpenLocalizedResourceFileL() + { + CLOG_ENTERFN( "CWlanPlugin::OpenLocalizedResourceFileL()" ); + + + RFs fsSession; + User::LeaveIfError( fsSession.Connect() ); + + // Find the resource file: + TParse parse; + parse.Set( KWlanPluginResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL ); + TFileName fileName( parse.FullName() ); + + // Get language of resource file: + BaflUtils::NearestLanguageFile( fsSession, fileName ); + + // Open resource file: + iResources.OpenL( fileName ); + + // If leave occurs before this, close is called automatically when the + // thread exits. + fsSession.Close(); + + CLOG_LEAVEFN( "CWlanPlugin::OpenLocalizedResourceFileL()" ); + } + +// --------------------------------------------------------- +// CWlanPlugin::LaunchSnifferAppL +// --------------------------------------------------------- +void CWlanPlugin::LaunchSnifferAppL() + { + CLOG_ENTERFN( "CWlanPlugin::LaunchSnifferAppL()" ); + + // Launch app + if ( iNullService ) + { + delete iNullService; + iNullService = NULL; + } + iNullService = CAknNullService::NewL( KSnifferAppUid, this ); + + CLOG_LEAVEFN( "CWlanPlugin::LaunchSnifferAppL()" ); + } + +// --------------------------------------------------------- +// CWlanPlugin::GetWlanSupported +// --------------------------------------------------------- +TBool CWlanPlugin::GetWlanSupported() const + { + CLOG_ENTERFN( "CWlanPlugin::GetWlanSupported()" ); + + TBool isWlanSupported = EFalse; + + TRAPD( error, FeatureManager::InitializeLibL() ); + + if( !error ) + { + isWlanSupported = + FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ); + + FeatureManager::UnInitializeLib(); + } + + CLOG_LEAVEFN( "CWlanPlugin::GetWlanSupported()" ); + + return isWlanSupported; + } + +// --------------------------------------------------------- +// CWlanPlugin::ShowErrorNote +// --------------------------------------------------------- +// +void CWlanPlugin::ShowErrorNote(TInt aErrorCode) + { + CLOG_ENTERFN( "CWlanPlugin::ShowErrorNote()" ); + + + TBool errorNoteShowed = EFalse; + + TRAPD(error, errorNoteShowed = ShowErrorNoteL(aErrorCode)); + + if(error || !errorNoteShowed) + { + TRAP_IGNORE( ShowGeneralErrorNoteL() ); + } + + CLOG_LEAVEFN( "CWlanPlugin::ShowErrorNote()" ); + } + +// --------------------------------------------------------- +// CWlanPlugin::ShowErrorNoteL +// --------------------------------------------------------- +// +TBool CWlanPlugin::ShowErrorNoteL(TInt aErrorCode) + { + CLOG_ENTERFN( "CWlanPlugin::ShowErrorNoteL()" ); + + CErrorUI* errorUi = CErrorUI::NewLC(); + + TBool errorNoteShowed = errorUi->ShowGlobalErrorNoteL( aErrorCode ); + + CleanupStack::PopAndDestroy( errorUi ); + + CLOG_LEAVEFN( "CWlanPlugin::ShowErrorNoteL()" ); + + return errorNoteShowed; + } + +// --------------------------------------------------------- +// CWlanPlugin::ShowGeneralErrorNoteL +// --------------------------------------------------------- +// +void CWlanPlugin::ShowGeneralErrorNoteL() + { + CLOG_ENTERFN( "CWlanPlugin::ShowGeneralErrorNoteL()" ); + + HBufC *msg = StringLoader::LoadLC( R_QTN_ERR_OS_GENERAL ); + + CAknGlobalNote *note = CAknGlobalNote::NewLC(); + + note->ShowNoteL( EAknGlobalErrorNote, *msg ); + + CleanupStack::PopAndDestroy( note ); + CleanupStack::PopAndDestroy( msg ); + + CLOG_LEAVEFN( "CWlanPlugin::ShowGeneralErrorNoteL()" ); + } + +// --------------------------------------------------------- +// CWlanPlugin::HandleServerAppExit +// --------------------------------------------------------- +// +void CWlanPlugin::HandleServerAppExit(TInt aReason) + { + CLOG_ENTERFN( "CWlanPlugin::HandleServerAppExit()" ); + //MAknServerAppExitObserver::HandleServerAppExit( aReason ); + if( aReason == EAknCmdExit ) + { + iAvkonViewAppUi->Exit(); + } + + CLOG_LEAVEFN( "CWlanPlugin::HandleServerAppExit()" ); + } + + +//End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanplugin/src/wlanplugindbobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/src/wlanplugindbobserver.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,157 @@ +/* +* 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 utilities functions. +* +* +*/ + + +//User includes +#include "wlanplugindbobserver.h" +#include "wlanpluginwlanstate.h" +#include "wlanpluginlogger.h" + +// --------------------------------------------------------- +// CWlanPluginDbObserver::CWlanPluginDbObserver +// Constructor +// --------------------------------------------------------- +CWlanPluginDbObserver::CWlanPluginDbObserver( CWlanPluginWlanState* aState ) +: CActive( EPriorityNormal ), + iWlanState( aState ) + { + } + +// --------------------------------------------------------- +// CWlanPluginDbObserver::NewL +// --------------------------------------------------------- +CWlanPluginDbObserver* CWlanPluginDbObserver::NewL( + CWlanPluginWlanState* aState ) + { + CWlanPluginDbObserver* self = new ( ELeave ) + CWlanPluginDbObserver( aState ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------- +// CWlanPluginDbObserver::ConstructL +// --------------------------------------------------------- +void CWlanPluginDbObserver::ConstructL() + { + CLOG_ENTERFN( "CWlanPluginDbObserver::ConstructL()" ); + + CActiveScheduler::Add(this); + + CLOG_LEAVEFN( "CWlanPluginDbObserver::ConstructL()" ); + } + +// --------------------------------------------------------- +// CWlanPluginDbObserver::~CWlanPluginDbObserver +// Destructor +// --------------------------------------------------------- +CWlanPluginDbObserver::~CWlanPluginDbObserver() + { + CLOG_ENTERFN( "CWlanPluginDbObserver::~CWlanPluginDbObserver()" ); + + Cancel(); + + delete iRecord; + + delete iSession; + + CLOG_LEAVEFN( "CWlanPluginDbObserver::~CWlanPluginDbObserver()" ); + } + +// --------------------------------------------------------- +// CWlanPluginDbObserver::RunL +// --------------------------------------------------------- +void CWlanPluginDbObserver::RunL() + { + CLOG_ENTERFN( "CWlanPluginDbObserver::RunL()" ); + + iRecord->RefreshL( *iSession ); + + //if scanning state changed start or stop the server + if ( iRecord->iBgScanInterval == 0 && iOuterScanState ) + { + CLOG_WRITE( "Scan disabled" ); + iWlanState->SetScanningL( EFalse ); + iOuterScanState = EFalse; + } + else if(iRecord->iBgScanInterval != 0 && !iOuterScanState ) + { + CLOG_WRITE( "Scan enabled" ); + iWlanState->SetScanningL( ETrue ); + iOuterScanState = ETrue; + } + + SetActive(); + + iRecord->RequestNotification(*iSession,iStatus); + + CLOG_LEAVEFN( "CWlanPluginDbObserver::RunL()" ); + } + +// --------------------------------------------------------- +// CWlanPluginDbObserver::DoCancel +// --------------------------------------------------------- +void CWlanPluginDbObserver::DoCancel() + { + CLOG_ENTERFN( "CWlanPluginDbObserver::DoCancel()" ); + + iRecord->CancelNotification( *iSession, iStatus ); + + CLOG_LEAVEFN( "CWlanPluginDbObserver::DoCancel()" ); + } + +// --------------------------------------------------------- +// CWlanPluginDbObserver::ActivateIt +// --------------------------------------------------------- +void CWlanPluginDbObserver::ActivateItL() + { + CLOG_ENTERFN( "CWlanPluginDbObserver::ActivateItL()" ); + + iSession = CMDBSession::NewL( KCDLatestVersion ); + + TMDBElementId tableId = 0; + + tableId = CCDWlanDeviceSettingsRecord::TableIdL( *iSession ); + + iRecord = new( ELeave ) + CCDWlanDeviceSettingsRecord( tableId ); + + iRecord->iWlanDeviceSettingsType = KWlanUserSettings; + + + if(iRecord->FindL( *iSession )) + { + iRecord->LoadL( *iSession ); + } + + + iRecord->RequestNotification(*iSession,iStatus); + + SetActive(); + + if ( iRecord->iBgScanInterval != 0 ) + { + iWlanState->SetScanningL( ETrue ); + iOuterScanState = ETrue; + } + + CLOG_LEAVEFN( "CWlanPluginDbObserver::ActivateItL()" ); + } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanplugin/src/wlanpluginimplementationtable.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/src/wlanpluginimplementationtable.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,46 @@ +/* +* 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: +* ECOM proxy table for this plugin +* +*/ + + +// System includes +#include + +// User includes +#include "wlanplugin.h" + +// Constants +const TImplementationProxy KWlanSettingsPluginImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x10281BCA, CWlanPlugin::NewL) + }; + + +// --------------------------------------------------------------------------- +// ImplementationGroupProxy +// Gate/factory function +// +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount ) + { + aTableCount = sizeof( KWlanSettingsPluginImplementationTable ) / + sizeof( TImplementationProxy ); + + return KWlanSettingsPluginImplementationTable; + } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanplugin/src/wlanplugintimeshifter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/src/wlanplugintimeshifter.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 time shifting +* +* +*/ + + +//User includes +#include "wlanplugintimeshifter.h" +#include "wlanpluginwlanstate.h" +#include "wlanpluginlogger.h" + + +// --------------------------------------------------------- +// CWlanPluginTimeShifter::NewLC +// --------------------------------------------------------- +CWlanPluginTimeShifter* CWlanPluginTimeShifter::NewLC( + CWlanPluginWlanState* aWlanState ) + { + CWlanPluginTimeShifter* self = new( ELeave ) + CWlanPluginTimeShifter( + aWlanState ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------- +// CWlanPluginTimeShifter::NewL +// --------------------------------------------------------- +CWlanPluginTimeShifter* CWlanPluginTimeShifter::NewL( + CWlanPluginWlanState* aWlanState ) + { + CWlanPluginTimeShifter* self = CWlanPluginTimeShifter::NewLC( + aWlanState ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------- +// CWlanPluginTimeShifter::~CWlanPluginTimeShifter +// --------------------------------------------------------- +CWlanPluginTimeShifter::~CWlanPluginTimeShifter() + { + Cancel(); + } + +// --------------------------------------------------------- +// CWlanPluginTimeShifter::CWlanPluginTimeShifter +// --------------------------------------------------------- +CWlanPluginTimeShifter::CWlanPluginTimeShifter( + CWlanPluginWlanState* aWlanState ) + : CActive( EPriorityNormal ), + iWlanState( aWlanState ) + { + + } + +// --------------------------------------------------------- +// CWlanPluginTimeShifter::ConstructL +// --------------------------------------------------------- +void CWlanPluginTimeShifter::ConstructL() + { + CLOG_ENTERFN( "CWlanPluginTimeShifter::ConstructL" ); + + CActiveScheduler::Add(this); + CLOG_LEAVEFN( "CWlanPluginTimeShifter::ConstructL" ); + } + +// --------------------------------------------------------- +// CWlanPluginTimeShifter::ConstructL +// --------------------------------------------------------- +void CWlanPluginTimeShifter::RunL() + { + CLOG_ENTERFN( "CWlanPluginTimeShifter::RunL" ); + + iWlanState->DirectlyScanL(); + iWlanState->DeleteTimeShifter(); + + CLOG_LEAVEFN( "CWlanPluginTimeShifter::RunL" ); + } + +// --------------------------------------------------------- +// CWlanPluginTimeShifter::ConstructL +// --------------------------------------------------------- +void CWlanPluginTimeShifter::DoCancel() + { + CLOG_ENTERFN( "CWlanPluginTimeShifter::DoCancel" ); + CLOG_LEAVEFN( "CWlanPluginTimeShifter::DoCancel" ); + } + +// --------------------------------------------------------- +// CWlanPluginTimeShifter::ConstructL +// --------------------------------------------------------- +void CWlanPluginTimeShifter::ActivateIt() + { + CLOG_ENTERFN( "CWlanPluginTimeShifter::ActivateIt" ); + + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + SetActive(); + + CLOG_LEAVEFN( "CWlanPluginTimeShifter::ActivateIt" ); + } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanplugin/src/wlanpluginwlanstate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/src/wlanpluginwlanstate.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,779 @@ +/* +* 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 utilities functions. +* +* +*/ + + +// INCLUDE FILES + +//User includes +#include "wlanpluginwlanstate.h" +#include "wlanplugindbobserver.h" +#include "wlanpluginlogger.h" +#include "wlanplugintimeshifter.h" + +//System includes +#include +#include +#include +#include +#include +#include +#include + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CWlanPluginWlanState::CWlanPluginWlanState +// Constructor +// --------------------------------------------------------- +CWlanPluginWlanState::CWlanPluginWlanState( CGSParentPlugin *aParent ) +: iScanning( EFalse ), + iConnected( EFalse ), + iExplicitScanning( 0 ), + iCoeEnv( CCoeEnv::Static() ), + iParent( aParent ), + iSignalStrength(ENoSignal), + iSupressParentUpdate( EFalse ), + iSupressUpdateWlan( EFalse ), + iValidSecondLine( ETrue ), + iSupressTimeShifter( EFalse ) + { + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::~CWlanPluginWlanState +// Descructor +// --------------------------------------------------------- +CWlanPluginWlanState::~CWlanPluginWlanState() + { + + CLOG_ENTERFN( "CWlanPluginWlanState::~CWlanPluginWlanState()" ); + + if ( iEngine ) + { + iEngine->CancelNotifyEvents(); + } + + if( iExplicitScanning ) + { + TRAP_IGNORE( SetScanningL( EFalse ) ); + } + if( iTimeShifter ) + { + delete iTimeShifter; + } + + delete iDbObserver; + + delete iWlanInfoBranding; + + //remove self from further notifications from the + //sniffer server + delete iEngine; + delete iPresentString; + + CLOG_LEAVEFN( "CWlanPluginWlanState::~CWlanPluginWlanState()" ); + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::NewLC +// --------------------------------------------------------- +CWlanPluginWlanState* CWlanPluginWlanState::NewLC( CGSParentPlugin *aParent ) + { + CWlanPluginWlanState* self= new ( ELeave ) + CWlanPluginWlanState( aParent ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::NewL +// --------------------------------------------------------- +CWlanPluginWlanState* CWlanPluginWlanState::NewL( CGSParentPlugin *aParent ) + { + CWlanPluginWlanState* self = CWlanPluginWlanState::NewLC( aParent ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::ConstructL +// --------------------------------------------------------- +void CWlanPluginWlanState::ConstructL() + { + CLOG_ENTERFN( "CWlanPluginWlanState::ConstructL()" ); + + iSupressParentUpdate = ETrue; + + iEngine = CWsfModel::NewL( *this, EFalse ); + + iWlanInfoBranding = CWsfWlanInfoArrayVisitor::NewL( ETrue ); + iWlanInfoBranding->LoadFilterDefinitionsL(); + + if( iEngine->IsScanEnabledL() ) + { + iScanning = ETrue; + UpdateWlanListL(); + } + + if( iEngine->IsConnectedL() ) + { + iEngine->GetConnectedWlanDetailsL( iConnectedWlanInfo ); + iConnected = iConnectedWlanInfo.Connected(); + } + + iDbObserver = CWlanPluginDbObserver::NewL( this ); + iDbObserver->ActivateItL(); + + if( !iConnected && !iScanning && iExplicitScanning ) + { + iValidSecondLine = EFalse; + } + + iSupressParentUpdate = EFalse; + + CLOG_LEAVEFN( "CWlanPluginWlanState::ConstructL()" ); + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::WlanListChangedL +// --------------------------------------------------------- +void CWlanPluginWlanState::WlanListChangedL() + { + CLOG_ENTERFN( "CWlanPluginWlanState::WlanListChangedL()" ); + + iValidSecondLine = ETrue; + //if there is modification + UpdateWlanListL(); + + UpdateParentViewL(); + + CLOG_LEAVEFN( "CWlanPluginWlanState::WlanListChangedL()" ); + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::NotifyEngineError +// --------------------------------------------------------- +void CWlanPluginWlanState::NotifyEngineError( TInt /*aError*/ ) + { + CLOG_ENTERFN( "CWlanPluginWlanState::NotifyEngineError()" ); + CLOG_LEAVEFN( "CWlanPluginWlanState::NotifyEngineError()" ); + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::ScanDisabledL +// --------------------------------------------------------- +void CWlanPluginWlanState::ScanDisabledL() + { + CLOG_ENTERFN( "CWlanPluginWlanState::ScanDisabledL()" ); + + iScanning = EFalse; + UpdateParentViewL(); + + CLOG_LEAVEFN( "CWlanPluginWlanState::ScanDisabledL()" ); + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::ScanEnabledL +// --------------------------------------------------------- +void CWlanPluginWlanState::ScanEnabledL() + { + CLOG_ENTERFN( "CWlanPluginWlanState::ScanEnabledL()" ); + + // plugin has enabled scanning - background scan is on + if ( iExplicitScanning ) + { + CLOG_WRITE( "Refresh scan results" ); + iEngine->RefreshScanL(); + } + + iScanning = ETrue; + UpdateWlanListL(); + UpdateParentViewL(); + + CLOG_LEAVEFN( "CWlanPluginWlanState::ScanEnabledL()" ); + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::WlanConnectionActivatedL +// --------------------------------------------------------- +void CWlanPluginWlanState::WlanConnectionActivatedL() + { + CLOG_ENTERFN( "CWlanPluginWlanState::WlanConnectionActivatedL()" ); + + iEngine->GetConnectedWlanDetailsL( iConnectedWlanInfo ); + iConnected = iConnectedWlanInfo.Connected(); + UpdateParentViewL(); + + CLOG_LEAVEFN( "CWlanPluginWlanState::WlanConnectionActivatedL()" ); + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::WlanConnectionClosedL +// --------------------------------------------------------- +void CWlanPluginWlanState::WlanConnectionClosedL() + { + CLOG_ENTERFN( "CWlanPluginWlanState::WlanConnectionClosedL()" ); + + iConnected = EFalse; + if( iScanning ) + { + UpdateWlanListL(); + } + + UpdateParentViewL(); + + CLOG_LEAVEFN( "CWlanPluginWlanState::WlanConnectionClosedL()" ); + } + +// --------------------------------------------------------------------------- +// CWlanPluginWlanState::ConnectionCreationProcessFinishedL +// --------------------------------------------------------------------------- +// +void CWlanPluginWlanState::ConnectionCreationProcessFinishedL( TInt /*aResult*/ ) + { + // no implementation required + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::GetStateStringL +// --------------------------------------------------------- +void CWlanPluginWlanState::GetStateStringL( TDes& aDes ) + { + CLOG_ENTERFN( "CWlanPluginWlanState::GetStateStringL()" ); + + if( !iValidSecondLine ) + { + return; + } + + //make the string according to it + HBufC* statestring = NULL; + MakeStateStringL( iInfoArray, statestring ); + aDes.Copy( statestring->Des() ); + + //keep it to decide later if it changed + delete iPresentString; + iPresentString = statestring; + + CLOG_LEAVEFN( "CWlanPluginWlanState::GetStateStringL()" ); + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::MakeStateStringL +// --------------------------------------------------------- +void CWlanPluginWlanState::MakeStateStringL( + CWsfWlanInfoArray* aArray, HBufC*& aBuf ) + { + CLOG_ENTERFN( "CWlanPluginWlanState::MakeStateStringL()" ); + + if( iConnected ) + { + CLOG_ENTERFN( "Connected format needed" ); + FormatConnectedL( aBuf ); + } + else if ( !iScanning ) + { + CLOG_ENTERFN( "Offline format needed" ); + FormatStatusOffL( aBuf ); + } + // if there's wlans avail + else if ( aArray && aArray->Count() ) + { + CLOG_ENTERFN( "wlans/wlan format needed" ); + CheckWlansL( aArray, aBuf ); + } + else + { + // no wlans available + CLOG_ENTERFN( "No wlan format needed" ); + FormatNoWlansAvailableL( aBuf ); + } + + CLOG_LEAVEFN( "CWlanPluginWlanState::MakeStateStringL()" ); + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::FormatConnectedL +// --------------------------------------------------------- +void CWlanPluginWlanState::FormatConnectedL( HBufC*& aBuf ) + { + CLOG_ENTERFN( "CWlanPluginWlanState::FormatConnectedL()" ); + + //Ssid as primary text + HBufC* ssid( NULL ); + + if ( iConnectedWlanInfo.iNetworkName.Length() ) // If there is IAP + { + ssid = iConnectedWlanInfo.GetIapNameAsUnicodeLC(); + } + else // If there no IAP + { + ssid = iConnectedWlanInfo.GetSsidAsUnicodeLC(); + } + + aBuf = StringLoader::LoadL( R_QTN_CP_DETAIL_WLAN_CONNECTED, + *ssid ); + + CleanupStack::PopAndDestroy( ssid ); + + CLOG_LEAVEFN( "CWlanPluginWlanState::FormatConnectedL()" ); + } + + +// --------------------------------------------------------- +// CWlanPluginWlanState::FormatStatusOffL +// --------------------------------------------------------- +void CWlanPluginWlanState::FormatStatusOffL( HBufC*& aBuf ) + { + CLOG_ENTERFN( "CWlanPluginWlanState::FormatStatusOffL()" ); + + aBuf = StringLoader::LoadL( R_QTN_CP_DETAIL_WLAN_SCAN_OFF ); + + CLOG_LEAVEFN( "CWlanPluginWlanState::FormatStatusOffL()" ); + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::FormatNoWlansAvailableL +// --------------------------------------------------------- +void CWlanPluginWlanState::FormatNoWlansAvailableL( HBufC*& aBuf ) + { + CLOG_ENTERFN( "CWlanPluginWlanState::FormatNoWlansAvailableL()" ); + + aBuf = StringLoader::LoadL( R_QTN_CP_DETAIL_WLAN_NO_NW_AVAILABLE ); + + CLOG_LEAVEFN( "CWlanPluginWlanState::FormatNoWlansAvailableL()" ); + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::CheckWlansL +// --------------------------------------------------------- +void CWlanPluginWlanState::CheckWlansL( CWsfWlanInfoArray* aArray, + HBufC*& aBuf ) + { + CLOG_ENTERFN( "CWlanPluginWlanState::CheckWlansL()" ); + + if ( aArray->At( 0 )->Known() ) + { + FormatWlanSingleLineL( *aArray->At( 0 ), aBuf ); + return; + } + TBool multipleUnknownWlans = ( aArray->Count() > 1 ); + FormatUnknownWlansSingleLineL( multipleUnknownWlans, aBuf ); + + CLOG_LEAVEFN( "CWlanPluginWlanState::CheckWlansL()" ); + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::FormatWlanSingleLineL +// --------------------------------------------------------- +void CWlanPluginWlanState::FormatWlanSingleLineL( + TWsfWlanInfo& aWlan, HBufC*& aBuf ) + { + CLOG_ENTERFN( "CWlanPluginWlanState::FormatWlanSingleLineL()" ); + + //Ssid as primary text + HBufC* ssid( NULL ); + + if ( aWlan.iNetworkName.Length() ) // If there is IAP + { + ssid = aWlan.GetIapNameAsUnicodeLC(); + } + else // If there no IAP + { + ssid = aWlan.GetSsidAsUnicodeLC(); + } + + TInt formatResource = R_QTN_CP_DETAIL_WLAN_KNOWN_NW_AVAILABLE; + + aBuf = StringLoader::LoadL ( formatResource, *ssid ); + + CleanupStack::PopAndDestroy( ssid ); + + CLOG_LEAVEFN( "CWlanPluginWlanState::FormatWlanSingleLineL()" ); + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::FormatUnknownWlansSingleLineL +// --------------------------------------------------------- +void CWlanPluginWlanState::FormatUnknownWlansSingleLineL( + const TBool aMultipleUnknownWlans, HBufC*& aBuf ) + { + CLOG_ENTERFN( "CWlanPluginWlanState::FormatUnknownWlansSingleLineL()" ); + + TInt unknownItemResource = aMultipleUnknownWlans ? + R_QTN_CP_DETAIL_WLAN_NETWORKS_AVAILABLE : + R_QTN_CP_DETAIL_WLAN_NETWORK_AVAILABLE; + + aBuf = StringLoader::LoadL( unknownItemResource ); + + CLOG_LEAVEFN( "CWlanPluginWlanState::FormatUnknownWlansSingleLineL()" ); + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::GetMainIconL +// --------------------------------------------------------- +TBool CWlanPluginWlanState::GetMainIconL( TInt& aPic, + TInt& aPicMask, + TAknsItemID& aItemId ) + { + CLOG_ENTERFN( "CWlanPluginWlanState::GetMainIconL()" ); + + if( !iValidSecondLine ) + { + aPic = EMbmWlanpluginQgn_prop_set_conn_wlan; + aPicMask = EMbmWlanpluginQgn_prop_set_conn_wlan_mask; + aItemId = KAknsIIDQgnPropSetConnWlanConn; + CLOG_LEAVEFN( "CWlanPluginWlanState::GetMainIconL()" ); + return ETrue; + } + + if( !iSupressTimeShifter) + { + iSupressTimeShifter = EFalse; + CLOG_WRITE(" Time shifter start not supressed "); + if( !iTimeShifter ) + { + CLOG_WRITE(" Time shifter started "); + iSupressTimeShifter = ETrue; + iTimeShifter = CWlanPluginTimeShifter::NewL( this ); + iTimeShifter->ActivateIt(); + } + } + else + { + CLOG_WRITE(" Time shifter start supressed "); + iSupressTimeShifter = EFalse; + } + if( iConnected ) + { + //CONNECTED + aPic = EMbmWlanpluginQgn_prop_set_conn_wlan_conn; + aPicMask = EMbmWlanpluginQgn_prop_set_conn_wlan_conn_mask; + aItemId = KAknsIIDQgnPropSetConnWlanConn; + } + else if( iScanning ) + { + //SCANNING BUT NOT CONNECTED + aPic = EMbmWlanpluginQgn_prop_set_conn_wlan; + aPicMask = EMbmWlanpluginQgn_prop_set_conn_wlan_mask; + aItemId = KAknsIIDQgnPropSetConnWlanConn; + } + else + { + //SCANNING DISABLED + aPic = EMbmWlanpluginQgn_prop_set_conn_wlan_off; + aPicMask = EMbmWlanpluginQgn_prop_set_conn_wlan_off_mask; + aItemId = KAknsIIDQgnPropSetConnWlanOff; + } + + CLOG_LEAVEFN( "CWlanPluginWlanState::GetMainIconL()" ); + return ETrue; + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::GetStrengthIconL +// --------------------------------------------------------- +TBool CWlanPluginWlanState::GetStrengthIconL( TInt& aPic, + TInt& aPicMask, + TAknsItemID& aItemId) + { + CLOG_ENTERFN( "CWlanPluginWlanState::GetStrengthIconL()" ); + + if( !iValidSecondLine ) + { + return EFalse; + } + if ( iConnected ) + { + switch( iConnectedWlanInfo.SignalStrength() ) + { + case EPoor: + aPic = EMbmWlanpluginQgn_indi_wlan_signal_low_add; + aPicMask = EMbmWlanpluginQgn_indi_wlan_signal_low_add_mask; + aItemId = KAknsIIDQgnIndiWlanSignalLowAdd; + break; + case EAverage: + aPic = EMbmWlanpluginQgn_indi_wlan_signal_med_add; + aPicMask = EMbmWlanpluginQgn_indi_wlan_signal_med_add_mask; + aItemId = KAknsIIDQgnIndiWlanSignalMedAdd; + break; + case EExcelent: + aPic = EMbmWlanpluginQgn_indi_wlan_signal_good_add; + aPicMask = EMbmWlanpluginQgn_indi_wlan_signal_good_add_mask; + aItemId = KAknsIIDQgnIndiWlanSignalGoodAdd; + break; + default: + aPic = EMbmWlanpluginQgn_indi_wlan_signal_low_add; + aPicMask = EMbmWlanpluginQgn_indi_wlan_signal_low_add_mask; + aItemId = KAknsIIDQgnIndiWlanSignalLowAdd; + } + iSignalStrength = iConnectedWlanInfo.SignalStrength(); + CLOG_LEAVEFN( "CWlanPluginWlanState::GetStrengthIconL()" ); + return ETrue; + } + iSignalStrength = ENoSignal; + + CLOG_LEAVEFN( "CWlanPluginWlanState::GetStrengthIconL()" ); + + return EFalse; + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::IsStateChangedL +// --------------------------------------------------------- +TBool CWlanPluginWlanState::IsStateChangedL() + { + CLOG_ENTERFN( "CWlanPluginWlanState::IsStateChangedL()" ); + + if ( !iPresentString ) + { + CLOG_LEAVEFN( "CWlanPluginWlanState::IsStateChangedL()" ); + return ETrue; + } + //alloc a buf + CLOG_WRITE( "CWlanPluginWlanState::IsStateChangedL - there is presentstring" ); + HBufC* buf = NULL; + + CLOG_WRITE( "CWlanPluginWlanState::IsStateChangedL - wlan list get" ); + //make the string that would be written out + MakeStateStringL( iInfoArray, buf ); + + CleanupStack::PushL( buf ); + + CLOG_WRITE( "CWlanPluginWlanState::IsStateChangedL - state string made" ); + + //decide if the string is the same as it was written before + //and the connection state is the same + TBool ret = + ( buf->Des().Compare( iPresentString->Des() ) || + iSignalStrength != GetSignalStrength() ) + ? ETrue : EFalse; + + CLOG_WRITE( "CWlanPluginWlanState::IsStateChangedL - ret get" ); + + CleanupStack::PopAndDestroy( buf ); + + if( ret ) + { + CLOG_WRITE( "State Changed" ); + } + else + { + CLOG_WRITE( "State NOT Changed" ); + } + + CLOG_LEAVEFN( "CWlanPluginWlanState::IsStateChangedL()" ); + + //just to have ETrue in all true cases + return ret; + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::GetSignalStrength +// --------------------------------------------------------- +TWsfWlanSignalStrengthLevel CWlanPluginWlanState::GetSignalStrength() + { + CLOG_ENTERFN( "CWlanPluginWlanState::GetSignalStrength()" ); + + if ( iConnected ) + { + CLOG_LEAVEFN( "CWlanPluginWlanState::GetSignalStrength()" ); + return iConnectedWlanInfo.SignalStrength(); + } + else + { + CLOG_LEAVEFN( "CWlanPluginWlanState::GetSignalStrength()" ); + return ENoSignal; + } + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::IsScanning +// --------------------------------------------------------- +TBool CWlanPluginWlanState::IsScanning() + { + CLOG_ENTERFN( "CWlanPluginWlanState::IsScanning()" ); + CLOG_LEAVEFN( "CWlanPluginWlanState::IsScanning()" ); + return iScanning; + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::SetScanning +// --------------------------------------------------------- +void CWlanPluginWlanState::SetScanningL( TBool aScanning ) + { + CLOG_ENTERFN( "CWlanPluginWlanState::SetScanningL()" ); + + if( aScanning ) + { + iExplicitScanning++; + if( iExplicitScanning == 1 && iEngine ) + { + iEngine->EnableScanL(); + } + } + else + { + iExplicitScanning--; + if( iExplicitScanning == 0 && iEngine ) + { + iEngine->DisableScanL(); + } + } + + CLOG_LEAVEFN( "CWlanPluginWlanState::SetScanningL()" ); + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::UpdateParentViewL +// --------------------------------------------------------- +void CWlanPluginWlanState::UpdateParentViewL() + { + CLOG_ENTERFN( "CWlanPluginWlanState::UpdateParentViewL()" ); + + + if( iSupressParentUpdate ) + { + CLOG_WRITE( "Parent update suppressed" ); + CLOG_LEAVEFN( "CWlanPluginWlanState::UpdateParentViewL()" ); + return; + } + + iSupressParentUpdate = ETrue; + + if ( IsStateChangedL() ) + { + iSupressTimeShifter = ETrue; + iParent->UpdateView(); + } + else + { + iSupressTimeShifter = EFalse; + } + + iSupressParentUpdate = EFalse; + + CLOG_LEAVEFN( "CWlanPluginWlanState::UpdateParentViewL()" ); + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::UpdateWlanListL +// --------------------------------------------------------- +void CWlanPluginWlanState::UpdateWlanListL() + { + CLOG_ENTERFN( "CWlanPluginWlanState::UpdateWlanListL()" ); + if( iSupressUpdateWlan ) + { + CLOG_WRITE( "Update WLAN List supressed" ); + CLOG_LEAVEFN( "CWlanPluginWlanState::UpdateWlanListL()" ); + return; + } + + iSupressUpdateWlan = ETrue; + + TRAPD( error, + iInfoArray = iEngine->GetWlanListL(); + + if( iConnected ) + { + iEngine->GetConnectedWlanDetailsL( iConnectedWlanInfo ); + iConnected = iConnectedWlanInfo.Connected(); + } + + iWlanInfoBranding->LoadFilterDefinitionsL(); + + iInfoArray->SortArrayL( *iWlanInfoBranding ); + ); + + if ( error != KErrNone ) + { + CLOG_WRITE( "Fetching wlan data leaved" ); + // Reset the temporary flag so that wlan list + // updates are not completely suppressed + iSupressUpdateWlan = EFalse; + User::Leave( error ); + } + +#ifdef _DEBUG + if( iInfoArray ) + { + if( iInfoArray->Count() <=0 ) + { + CLOG_WRITE( "EMPTY ARRAY" ); + } + for(TInt i = 0; i< iInfoArray->Count(); i++) + { + + CLOG_WRITE( "----AP----" ); + HBufC* buf = iInfoArray->At( i )->GetSsidAsUnicodeLC(); + CLOG_WRITEF(_L("AP: %S"), ( buf ) ); + CleanupStack::PopAndDestroy( buf ); + if( iInfoArray->At( i )->Connected() ) + { + CLOG_WRITE( "--Connected--" ); + } + else + { + CLOG_WRITE( "--NOT Connected--" ); + } + if( iInfoArray->At( i )->Known() ) + { + CLOG_WRITE( "--Known--" ); + } + else + { + CLOG_WRITE( "--NOT Known--" ); + } + } + } + else + { + CLOG_ENTERFN( "NO ARRAY" ); + } +#endif + + iSupressUpdateWlan = EFalse; + CLOG_LEAVEFN( "CWlanPluginWlanState::UpdateWlanListL()" ); + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::DirectlyScan +// --------------------------------------------------------- +void CWlanPluginWlanState::DirectlyScanL() + { + CLOG_ENTERFN( "CWlanPluginWlanState::DirectlyScan()" ); + if ( iExplicitScanning && iParent->IsForeground()) + { + iEngine->RefreshScanL(); + } + CLOG_LEAVEFN( "CWlanPluginWlanState::DirectlyScan()" ); + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::DeleteTimeShifter +// --------------------------------------------------------- +void CWlanPluginWlanState::DeleteTimeShifter() + { + CLOG_ENTERFN( "CWlanPluginWlanState::DeleteTimeShifter()" ); + delete iTimeShifter; + iTimeShifter = NULL; + CLOG_LEAVEFN( "CWlanPluginWlanState::DeleteTimeShifter()" ); + } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/base/inc/wlanqtutils.h --- a/wlanutilities/wlanqtutilities/base/inc/wlanqtutils.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,209 +0,0 @@ -/* -* 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 interface. -*/ - -#ifndef WLANQTUTILS_H -#define WLANQTUTILS_H - -// System includes - -#include -#include -#include - -// User includes - -// Forward declarations - -class WlanQtUtilsIap; -class WlanQtUtilsAp; -class WlanQtUtilsPrivate; - -// External data types - -// Constants - -//! 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. - }; - - /*! - 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(); - - ~WlanQtUtils(); - - 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 = false); - - void disconnectIap(int iapId); - - 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); - - /*! - 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); - - /*! - 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); - - /*! - Signal indicating that new WLAN network has been opened. - - @param [in] iapId ID of the opened IAP. - */ - void wlanNetworkOpened(int iapId); - - /*! - Signal indicating that a WLAN network has been closed. - - @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. - - @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); - -public slots: - -protected: - -protected slots: - -private: - - Q_DISABLE_COPY(WlanQtUtils) - -private slots: - -private: // data - - //! Pointer to private implementation - QScopedPointer d_ptr; - - // 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 - // call event handlers of wrappers from test code. - friend class TestWlanQtUtils; -}; - -#endif // WLANQTUTILS_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/base/inc/wlanqtutils_p.h --- a/wlanutilities/wlanqtutilities/base/inc/wlanqtutils_p.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,193 +0,0 @@ -/* -* 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 private implementation interface. -*/ - -#ifndef WLANQTUTILS_P_H -#define WLANQTUTILS_P_H - -// System includes - -#include -#include -#include - -// User includes - -#include "wlanqtutils.h" -#include "ictswlanlogininterface.h" - -// Forward declarations - -class WlanQtUtils; -class WlanQtUtilsIap; -class WlanQtUtilsAp; -class WlanQtUtilsConnection; -class WlanQtUtilsIapSettings; -class WlanQtUtilsConMonWrapper; -class WlanQtUtilsEsockWrapper; -class WlanQtUtilsScan; - -// External data types - -// Constants - -// Class declaration - -class WlanQtUtilsPrivate : public QObject -{ - Q_OBJECT - -public: - - // Data types - - explicit WlanQtUtilsPrivate(WlanQtUtils *q_ptr); - - virtual ~WlanQtUtilsPrivate(); - - 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: - - void updateAvailableWlanIaps( - QList< QSharedPointer > &availableIaps); - - void updateAvailableWlanAps( - QList< QSharedPointer > &availableWlans); - - void reportScanResult(int status); - - void updateConnectionStatus(bool isOpened); - - void addActiveConnection(uint connectionId); - - void removeActiveConnection(uint connectionId); - - void updateActiveConnection( - uint connectionId, - WlanQtUtils::ConnStatus connectionStatus); - - void updateIctResult(int ictsResult); - - void updateIctHotspotCase(); - -private: // data - - //! 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 - - //! Pointer to public implementation. - WlanQtUtils *q_ptr; - - // Owned data - - //! Iap settings handler. - WlanQtUtilsIapSettings *mSettings; - - //! Wrapper object for Connection Monitor and other parts of connmon library. - WlanQtUtilsConMonWrapper *mConMonWrapper; - - //! Wrapper object for WLAN scanning. - WlanQtUtilsScan *mScanWrapper; - - //! Wrapper object for esock library. - WlanQtUtilsEsockWrapper *mEsockWrapper; - - //! Instance of Icts Wlan Login Interface. - QSharedPointer mIctService; - - //! Current WLAN scan mode. - ScanMode mScanMode; - - //! List of available WLAN IAPs according to the latest scan. - QList< QSharedPointer > mIapScanList; - - //! 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), IapIdNone if not valid. - int mConnectingIapId; - - //! Information of possible active connection. - QSharedPointer mConnection; - - // 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 diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/base/inc/wlanqtutilsap.h --- a/wlanutilities/wlanqtutilities/base/inc/wlanqtutilsap.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,178 +0,0 @@ -/* -* 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. - - 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 - - ConfIdWlanScanSSID - */ - 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 (CMManagerShim::CmHidden). - ConfIdHidden = 12, - //! bool: Does WLAN AP need explicit scanning (CMManagerShim::WlanScanSSID) - ConfIdWlanScanSSID = 13, - //! bool: true - Wifi Protected setup is supported, false - not - ConfIdWpsSupported = 14 - }; - - /*! - 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/base/inc/wlanqtutilsconnection.h --- a/wlanutilities/wlanqtutilities/base/inc/wlanqtutilsconnection.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/base/inc/wlanqtutilsiap.h --- a/wlanutilities/wlanqtutilities/base/inc/wlanqtutilsiap.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* -* 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 IAP (Internet Access Point, known network) class. -*/ - -#ifndef WLANQTUTILSIAP_H -#define WLANQTUTILSIAP_H - -// System includes - -#include - -// User includes - -#include "wlanqtutilsap.h" - -// Forward declarations - -class WlanQtUtilsIapPrivate; - -// External data types - -// Constants - -//! 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(); - - virtual ~WlanQtUtilsIap(); - -signals: - -public slots: - -protected: - -protected slots: - -private: - - Q_DISABLE_COPY(WlanQtUtilsIap) - -private slots: - -private: // data - - QScopedPointer d_ptr; //!< Private implementation - - // Friend classes -}; - -#endif // WLANQTUTILSIAP_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/base/inc/wlanqtutilsiapsettings.h --- a/wlanutilities/wlanqtutilities/base/inc/wlanqtutilsiapsettings.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/base/src/wlanqtutils.cpp --- a/wlanutilities/wlanqtutilities/base/src/wlanqtutils.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,255 +0,0 @@ -/* -* 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 implementation. -*/ - -// System includes - -// User includes - -#include "wlanqtutilsap.h" -#include "wlanqtutilsiap.h" -#include "wlanqtutils_p.h" -#include "wlanqtutils.h" - -/*! - \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)) -{ -} - -/*! - Destructor. -*/ - -WlanQtUtils::~WlanQtUtils() -{ -} - -/*! - 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(); -} - -/*! - 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->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); -} - -/*! - 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 -{ - 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); -} - -/*! - 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->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); -} - -/*! - 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->iapName(iapId); -} - -/*! - Connection status getter. - - @return Current WLAN connection status. -*/ - -WlanQtUtils::ConnStatus WlanQtUtils::connectionStatus() const -{ - return d_ptr->connectionStatus(); -} - -/*! - Function for getting the ID of the (possibly) active WLAN IAP. - Active here means non-disconnected. - Use connectionStatus() for retrieving the actual status. - - @return ID of the active IAP, IapIdNone if not valid. -*/ - -int WlanQtUtils::activeIap() const -{ - return d_ptr->activeIap(); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/base/src/wlanqtutils_p.cpp --- a/wlanutilities/wlanqtutilities/base/src/wlanqtutils_p.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,865 +0,0 @@ -/* -* 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 private implementation. -*/ - -// System includes - -#include - -// User includes - -#include "wlanqtutilsap.h" -#include "wlanqtutilsiap.h" -#include "wlanqtutilsconnection.h" -#include "wlanqtutilsiapsettings.h" -#include "wlanqtutilsconmonwrapper.h" -#include "wlanqtutilsesockwrapper.h" -#include "wlanqtutilsscan.h" - -#include "wlanqtutils.h" -#include "wlanqtutils_p.h" - -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlanqtutils_pTraces.h" -#endif - -/*! - \class WlanQtUtilsPrivate - \brief Private implementation class for WLAN Qt Utilities. - - 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), - mIapScanList(), - mWlanScanList(), - mToBeTestedIapId(WlanQtUtils::IapIdNone), - mConnectingIapId(WlanQtUtils::IapIdNone), - mConnection() -{ - OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_WLANQTUTILSPRIVATE_ENTRY, this); - - // Make all connections. - bool connectStatus = connect( - mScanWrapper, - SIGNAL(availableWlanIaps(QList< QSharedPointer > &)), - this, - SLOT(updateAvailableWlanIaps(QList< QSharedPointer > &))); - Q_ASSERT(connectStatus); - - connectStatus = connect( - mScanWrapper, - SIGNAL(availableWlanAps(QList< QSharedPointer >&)), - this, - SLOT(updateAvailableWlanAps(QList< QSharedPointer >&))); - Q_ASSERT(connectStatus); - - connectStatus = connect( - mScanWrapper, - SIGNAL(scanFailed(int)), - this, - SLOT(reportScanResult(int))); - Q_ASSERT(connectStatus); - - connectStatus = connect( - mEsockWrapper, - SIGNAL(connectionStatusFromWrapper(bool)), - this, - SLOT(updateConnectionStatus(bool))); - Q_ASSERT(connectStatus); - - connectStatus = connect( - mConMonWrapper, - SIGNAL(connCreatedEventFromWrapper(uint)), - this, - SLOT(addActiveConnection(uint))); - Q_ASSERT(connectStatus); - - connectStatus = connect( - mConMonWrapper, - SIGNAL(connDeletedEventFromWrapper(uint)), - this, - SLOT(removeActiveConnection(uint))); - Q_ASSERT(connectStatus); - - connectStatus = connect( - mConMonWrapper, - SIGNAL(connStatusEventFromWrapper(uint, WlanQtUtils::ConnStatus)), - this, - SLOT(updateActiveConnection(uint, WlanQtUtils::ConnStatus))); - Q_ASSERT(connectStatus); - - // Retrieve initial status of active connections - mConnection = QSharedPointer( - mConMonWrapper->activeConnection()); - - OstTraceFunctionExit1(WLANQTUTILSPRIVATE_WLANQTUTILSPRIVATE_EXIT, this); -} - -/*! - Destructor. -*/ - -WlanQtUtilsPrivate::~WlanQtUtilsPrivate() -{ - 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); - - // Starting with an IAP scan, and continuing with AP scan - mScanMode = ScanModeAvailableWlans; - mScanWrapper->scanWlanIaps(); - - OstTraceFunctionExit1(WLANQTUTILSPRIVATE_SCANWLANS_EXIT, this); -} - -/*! - See WlanQtUtils::scanWlanAps(). -*/ - -void WlanQtUtilsPrivate::scanWlanAps() -{ - OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_SCANWLANAPS_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 broadcast WLAN scan - mScanMode = ScanModeAvailableWlanAps; - mScanWrapper->scanWlanAps(); - - OstTraceFunctionExit1(WLANQTUTILSPRIVATE_SCANWLANAPS_EXIT, this); -} - -/*! - 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_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(); - - // Read the list of configured IAPs - QList< QSharedPointer > configuredIapList; - mSettings->fetchIaps(configuredIapList); - - // Update the list of available IAPs - foreach (QSharedPointer iapIter, mIapScanList) { - int iapId = iapIter->value(WlanQtUtilsIap::ConfIdIapId).toInt(); - QSharedPointer iap(mSettings->fetchIap(iapId)); - if (iap) { - // Only add the IAP if we (still) have the settings for it - iap->setValue( - WlanQtUtilsAp::ConfIdSignalStrength, - iapIter->value(WlanQtUtilsAp::ConfIdSignalStrength)); - wlanIapList.append(iap); - } - } - - // Go through the scan results to find unknown APs - 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); - - // Just copy the results - wlanApList = mWlanScanList; - - OstTraceFunctionExit1(WLANQTUTILSPRIVATE_AVAILABLEWLANAPS_EXIT, this); -} - -/*! - See WlanQtUtils::createIap(). -*/ - -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; -} - -/*! - See WlanQtUtils::updateIap(). -*/ - -bool WlanQtUtilsPrivate::updateIap(int iapId, const WlanQtUtilsAp *wlanAp) -{ - OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_UPDATEIAP_ENTRY, this); - - bool success = mSettings->updateIap(iapId, wlanAp); - - 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); -} - -/*! - See WlanQtUtils::connectIap(). -*/ - -void WlanQtUtilsPrivate::connectIap(int iapId, bool runIct) -{ - OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_CONNECTIAP_ENTRY, this); - - OstTraceExt2( - TRACE_BORDER, - WLANQTUTILSPRIVATE_CONNECTIAP, - "WlanQtUtilsPrivate::connectIap;IAP ID=%d;runIct=%hhu", - iapId, - runIct); - - Q_ASSERT(iapId != WlanQtUtils::IapIdNone); - - 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_BORDER, - WLANQTUTILSPRIVATE_DISCONNECTIAP, - "WlanQtUtilsPrivate::disconnectIap;IAP ID=%d", - iapId); - - 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); -} - -/*! - See WlanQtUtils::connectionStatus(). -*/ - -WlanQtUtils::ConnStatus WlanQtUtilsPrivate::connectionStatus() const -{ - OstTraceFunctionEntry0(WLANQTUTILSPRIVATE_CONNECTIONSTATUS_ENTRY); - - WlanQtUtils::ConnStatus status = WlanQtUtils::ConnStatusDisconnected; - - if (mConnection) { - status = mConnection->connectionStatus(); - } - OstTrace1( - TRACE_BORDER, - WLANQTUTILSPRIVATE_CONNECTIONSTATUS, - "WlanQtUtilsPrivate::connectionStatus;status=%{ConnStatus};", - (TUint)status); - - OstTraceFunctionExit0(WLANQTUTILSPRIVATE_CONNECTIONSTATUS_EXIT); - return status; -} - -/*! - See WlanQtUtils::activeIap(). -*/ - -int WlanQtUtilsPrivate::activeIap() const -{ - OstTraceFunctionEntry0(WLANQTUTILSPRIVATE_ACTIVEIAP_ENTRY); - - int iapId = WlanQtUtils::IapIdNone; - - if (mConnection) { - iapId = mConnection->iapId(); - } - OstTrace1( - TRACE_BORDER, - WLANQTUTILSPRIVATE_ACTIVEIAP, - "WlanQtUtilsPrivate::activeIap;iapId=%d", - iapId); - - OstTraceFunctionExit0(WLANQTUTILSPRIVATE_ACTIVEIAP_EXIT); - return iapId; -} - -/*! - See WlanQtUtils::iapName(). -*/ - -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; -} - -/*! - 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. - - @return True, if suitable WLAN IAP found, false otherwise. -*/ - -bool WlanQtUtilsPrivate::wlanIapExists( - const QList< QSharedPointer > list, - const WlanQtUtilsAp *ap) const -{ - bool match = false; // Return value - - foreach (QSharedPointer iap, list) { - if (WlanQtUtilsAp::compare(iap.data(), ap) == 0) { - // Match found - match = true; - break; - } - } - - return match; -} - -/*! - This function traces the given IAPs and APs. - - @param [in] iaps IAPs to trace. - @param [in] aps APs to trace. -*/ - -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 -} - -/*! - Slot for handling WLAN IAP scan result event from wrapper. Results are - stored in a member variable. - - @param [in] availableIaps Available WLAN IAP's found in scan. -*/ - -void WlanQtUtilsPrivate::updateAvailableWlanIaps( - QList< QSharedPointer > &availableIaps) -{ - OstTraceFunctionEntry0(WLANQTUTILSPRIVATE_UPDATEAVAILABLEWLANIAPS_ENTRY); - - // Store the new IAP list - mIapScanList = availableIaps; - - // Continue with AP scan (which should come immediately from WLAN's scan cache) - mScanWrapper->scanWlanAps(); - - OstTraceFunctionExit0(WLANQTUTILSPRIVATE_UPDATEAVAILABLEWLANIAPS_EXIT); -} - -/*! - Slot for handling WLAN AP 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); - - // Old results 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 < mWlanScanList.count(); j++) { - if (WlanQtUtilsAp::compare( - availableWlanList[i].data(), - mWlanScanList[j].data()) == 0) { - duplicate = true; - break; - } - } - if (duplicate == false) { - mWlanScanList.append(availableWlanList[i]); - } - } - - // 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; - - 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); - - if (isOpened == false) { - // Opening failed, update connection status and inform UI - if (mConnection) { - mConnection->setConnectionStatus( - WlanQtUtils::ConnStatusDisconnected); - } - - // 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 status and inform UI - if (mConnection) { - mConnection->setConnectionStatus(WlanQtUtils::ConnStatusConnected); - } - - OstTrace1( - TRACE_BORDER, - WLANQTUTILSPRIVATE_WLANNETWORKOPENED, - "WlanQtUtilsPrivate::emit wlanNetworkOpened;IAP ID=%d", - mConnectingIapId); - emit q_ptr->wlanNetworkOpened(mConnectingIapId); - - // Start ICT, if needed - 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 - mConnectingIapId = WlanQtUtils::IapIdNone; - - OstTraceFunctionExit1(WLANQTUTILSPRIVATE_UPDATECONNECTIONSTATUS_EXIT, this); -} - -/*! - 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_UPDATEICTRESULT_ENTRY, this); - - Q_ASSERT(mToBeTestedIapId != WlanQtUtils::IapIdNone); - WlanQtUtils::IctStatus result = WlanQtUtils::IctFailed; - - if (ictsResult == IctsWlanLoginInterface::IctsPassed) { - // Move the tested IAP to Internet SNAP since the test passed - 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; - - OstTraceFunctionExit1(WLANQTUTILSPRIVATE_UPDATEICTRESULT_EXIT, this); -} - -/*! - Slot for setting IAP to be tested as hotspot IAP. -*/ - -void WlanQtUtilsPrivate::updateIctHotspotCase() -{ - OstTraceFunctionEntry1(WLANQTUTILSPRIVATE_UPDATEICTHOTSPOTCASE_ENTRY, 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); - OstTrace1( - TRACE_BORDER, - WLANQTUTILSPRIVATE_ADDACTIVECONNECTION, - "WlanQtUtilsPrivate::addActiveConnection;connectionId=%u", - connectionId); - - Q_ASSERT(mConnection == NULL); - mConnection = QSharedPointer( - mConMonWrapper->connectionInfo(connectionId)); - - 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); - OstTrace1( - TRACE_BORDER, - WLANQTUTILSPRIVATE_REMOVEACTIVECONNECTION, - "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); -} - -/*! - 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_UPDATEACTIVECONNECTION_ENTRY, this); - OstTraceExt2( - TRACE_BORDER, - WLANQTUTILSPRIVATE_UPDATEACTIVECONNECTION, - "WlanQtUtilsPrivate::updateActiveConnection;connectionId=%u;connectionStatus=%{ConnStatus}", - connectionId, - (uint)connectionStatus); - - 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()); - } - // 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 - - OstTraceFunctionExit1(WLANQTUTILSPRIVATE_UPDATEACTIVECONNECTION_EXIT, this); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/base/src/wlanqtutilsap.cpp --- a/wlanutilities/wlanqtutilities/base/src/wlanqtutilsap.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,173 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/base/src/wlanqtutilsconnection.cpp --- a/wlanutilities/wlanqtutilities/base/src/wlanqtutilsconnection.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/base/src/wlanqtutilsiap.cpp --- a/wlanutilities/wlanqtutilities/base/src/wlanqtutilsiap.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* -* 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 IAP (Internet Access Point, known network) class. -*/ - -// System includes - -// User includes - -#include "wlanqtutilsiap.h" - -/*! - \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()) -{ -} - -/*! - Destructor. -*/ - -WlanQtUtilsIap::~WlanQtUtilsIap() -{ -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/base/src/wlanqtutilsiapsettings.cpp --- a/wlanutilities/wlanqtutilities/base/src/wlanqtutilsiapsettings.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,633 +0,0 @@ -/* -* 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()); - iap->setBoolAttribute( - CMManagerShim::CmHidden, - wlanAp->value(WlanQtUtilsAp::ConfIdHidden).toBool()); - iap->setBoolAttribute( - CMManagerShim::WlanScanSSID, - wlanAp->value(WlanQtUtilsAp::ConfIdWlanScanSSID).toBool()); - - // 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/bwins/wlanqtutilitiesu.def --- a/wlanutilities/wlanqtutilities/bwins/wlanqtutilitiesu.def Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -EXPORTS - ?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 * *) - ?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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/eabi/wlanqtutilitiesu.def --- a/wlanutilities/wlanqtutilities/eabi/wlanqtutilitiesu.def Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -EXPORTS - _ZN11WlanQtUtils10connectIapEib @ 1 NONAME - _ZN11WlanQtUtils11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME - _ZN11WlanQtUtils11qt_metacastEPKc @ 3 NONAME - _ZN11WlanQtUtils11scanWlanApsEv @ 4 NONAME - _ZN11WlanQtUtils12stopWlanScanEv @ 5 NONAME - _ZN11WlanQtUtils13disconnectIapEi @ 6 NONAME - _ZN11WlanQtUtils13wlanScanReadyEi @ 7 NONAME - _ZN11WlanQtUtils14scanWlanDirectERK7QString @ 8 NONAME - _ZN11WlanQtUtils15wlanScanApReadyEi @ 9 NONAME - _ZN11WlanQtUtils16staticMetaObjectE @ 10 NONAME DATA 16 - _ZN11WlanQtUtils17wlanNetworkClosedEii @ 11 NONAME - _ZN11WlanQtUtils17wlanNetworkOpenedEi @ 12 NONAME - _ZN11WlanQtUtils19getStaticMetaObjectEv @ 13 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/rom/wlanqtutilities.iby --- a/wlanutilities/wlanqtutilities/rom/wlanqtutilities.iby Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* 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 IBY file. -*/ - -#ifndef WLANQTUTILITIES_IBY -#define WLANQTUTILITIES_IBY - -#include - -#ifdef __PROTOCOL_WLAN - -file=ABI_DIR/BUILD_DIR/wlanqtutilities.dll SHARED_LIB_DIR/wlanqtutilities.dll - -#endif // __PROTOCOL_WLAN - -#endif // WLANQTUTILITIES_IBY diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/stubs/stub_connmon.cpp --- a/wlanutilities/wlanqtutilities/stubs/stub_connmon.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/stubs/stub_esock.cpp --- a/wlanutilities/wlanqtutilities/stubs/stub_esock.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/stubs/stub_wlanmgmtclient.cpp --- a/wlanutilities/wlanqtutilities/stubs/stub_wlanmgmtclient.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +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 "Eclipse Public License v1.0" -* which accompanies 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" - -// --------------------------------------------------------- -// CWlanMgmtClient::NewL -// --------------------------------------------------------- -// -CWlanMgmtClient* CWlanMgmtClient::NewL() - { - CWlanMgmtClient* self = new CWlanMgmtClient; - return self; - } - -// --------------------------------------------------------- -// CWlanMgmtClient::~CWlanMgmtClient -// --------------------------------------------------------- -// -CWlanMgmtClient::~CWlanMgmtClient() - { - } - -// --------------------------------------------------------- -// CWlanMgmtClient::CWlanMgmtClient -// --------------------------------------------------------- -// -CWlanMgmtClient::CWlanMgmtClient() - { - } - -// --------------------------------------------------------- -// CWlanMgmtClient::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; - } - -// --------------------------------------------------------- -// CWlanMgmtClient::GetScanResults -// --------------------------------------------------------- -// -void CWlanMgmtClient::GetScanResults( - TWlanSsid& aSsid, - TRequestStatus& aStatus, - CWlanScanInfo& aResults ) - { - (void)aSsid; - (void)aResults; - - // Complete the request immediately - TRequestStatus *status = &aStatus; - User::RequestComplete(status, KErrNone); - - // Results are returned when asked per AP - } - -// --------------------------------------------------------- -// CWlanMgmtClient::CancelGetScanResults -// --------------------------------------------------------- -// -void CWlanMgmtClient::CancelGetScanResults() - { - } - -// --------------------------------------------------------- -// CWlanMgmtClient::GetAvailableIaps -// --------------------------------------------------------- -// -void CWlanMgmtClient::GetAvailableIaps( - TInt& aCacheLifetime, - TUint& aMaxDelay, - TBool aFilteredResults, - TRequestStatus& aStatus, - RArray& aAvailableIaps ) - { - (void)aCacheLifetime; - (void)aMaxDelay; - (void)aFilteredResults; - (void)aAvailableIaps; - - // Complete the request immediately - TRequestStatus *status = &aStatus; - User::RequestComplete(status, KErrNone); - } - -// --------------------------------------------------------- -// CWlanMgmtClient::CancelGetAvailableIaps -// --------------------------------------------------------- -// -void CWlanMgmtClient::CancelGetAvailableIaps() - { - } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/stubs/stub_wlanscaninfo.cpp --- a/wlanutilities/wlanqtutilities/stubs/stub_wlanscaninfo.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,335 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/stubs/stubs.pri --- a/wlanutilities/wlanqtutilities/stubs/stubs.pri Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +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 "Eclipse Public License v1.0" -# which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/stubs/wlanmgmtclient.h --- a/wlanutilities/wlanqtutilities/stubs/wlanmgmtclient.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +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 "Eclipse Public License v1.0" -* which accompanies 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(); - - /** - * Get the available WLAN IAPs. - * - * @param aCacheLifetime Defines how many seconds old cached results the client - * is willing to accept. The valid is range is from 0 to - * 60 seconds. The value of -1 means the system default will - * be used. The aCacheLifetime parameter has a meaning only - * when the aMaxDelay parameter is zero. - * Value will be changed to the actual value used by the - * system. - * @param aMaxDelay Maximum amount of seconds the client is willing to wait for - * the availability results. The valid range is from 0 to 1200 - * seconds or KWlanInfiniteScanDelay. KWlanInfiniteScanDelay - * will never cause a scan, but the request will be - * completed when any other broadcast scan request is completed. - * Value will be changed to the actual value used by the system. - * @param aFilteredResults Whether availability is filtered based on signal strength. - * ETrue if filtering is allowed, EFalse if not. - * @param aStatus Status of the calling active object. On successful - * completion contains KErrNone, otherwise one of the - * system-wide error codes. - * @param aAvailableIaps Array of IAPs available. - */ - void GetAvailableIaps( - TInt& aCacheLifetime, - TUint& aMaxDelay, - TBool aFilteredResults, - TRequestStatus& aStatus, - RArray& aAvailableIaps ); - - /** - * Cancel an outstanding IAP availability request. - */ - void CancelGetAvailableIaps(); - - private: // Data - - CWlanMgmtClient(); - }; - -#endif // WLANMGMTCLIENT_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/stubs/wlanscaninfo.h --- a/wlanutilities/wlanqtutilities/stubs/wlanscaninfo.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/traces/OstTraceDefinitions.h --- a/wlanutilities/wlanqtutilities/traces/OstTraceDefinitions.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -/* -* 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__ -#include -#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/traces/trace.properties --- a/wlanutilities/wlanqtutilities/traces/trace.properties Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ - - - - 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/tsrc/context/wlanqtutilstestcontext.cpp --- a/wlanutilities/wlanqtutilities/tsrc/context/wlanqtutilstestcontext.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,314 +0,0 @@ -/* -* 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 "wlanqtutilsiap.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), - mWlanScanIapResultList(), - mWlanScanApResultList(), - mCompleteWlanIapScan(true), - mCompleteWlanApScan(true), - mIapScanRetValue(KErrNone), - mApScanRetValue(KErrNone) -{ -} - -WlanQtUtilsWlanScan::~WlanQtUtilsWlanScan() -{ - clearWlanScanIapResultList(); - clearWlanScanApResultList(); -} - -void WlanQtUtilsWlanScan::initialize() -{ - clearWlanScanIapResultList(); - clearWlanScanApResultList(); - mCompleteWlanIapScan = true; - mCompleteWlanApScan = true; - mIapScanRetValue = KErrNone; - mApScanRetValue = KErrNone; -} - -void WlanQtUtilsWlanScan::createDefaultWlanScanIapResultList(int numberOfWlanIaps) -{ - clearWlanScanIapResultList(); - - for (int i = 0; i < numberOfWlanIaps; i++) { - QSharedPointer iap(new WlanQtUtilsIap()); - iap->setValue(WlanQtUtilsIap::ConfIdIapId, i); - iap->setValue(WlanQtUtilsIap::ConfIdName, "TestWlanAp" + QString::number(i + 1)); - // ConfIdNetworkId? - iap->setValue(WlanQtUtilsAp::ConfIdSsid, "TestWlanAp" + QString::number(i + 1)); - iap->setValue(WlanQtUtilsAp::ConfIdSignalStrength, 20); - iap->setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Infra); - iap->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); - iap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, false); - mWlanScanIapResultList.append(iap); - } -} - -void WlanQtUtilsWlanScan::clearWlanScanIapResultList() -{ - mWlanScanIapResultList.clear(); -} - -void WlanQtUtilsWlanScan::verifyWlanScanIapResultList( - QList< QSharedPointer > wlanIapList) -{ - QCOMPARE(wlanIapList.count(), mWlanScanIapResultList.count()); - - for (int i = 0; i < mWlanScanIapResultList.count(); i++) { - QCOMPARE( - wlanIapList[i]->value(WlanQtUtilsIap::ConfIdIapId), - mWlanScanIapResultList[i]->value(WlanQtUtilsIap::ConfIdIapId)); - QCOMPARE( - wlanIapList[i]->value(WlanQtUtilsAp::ConfIdSignalStrength), - mWlanScanIapResultList[i]->value(WlanQtUtilsAp::ConfIdSignalStrength)); - //QCOMPARE( - // wlanIapList[i]->value(WlanQtUtilsAp::ConfIdSsid), - // mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdSsid)); - } -} - - -void WlanQtUtilsWlanScan::createDefaultWlanScanApResultList(int numberOfWlanAps) -{ - clearWlanScanApResultList(); - - 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); - mWlanScanApResultList.append(ap); - } -} - -void WlanQtUtilsWlanScan::clearWlanScanApResultList() -{ - mWlanScanApResultList.clear(); -} - -void WlanQtUtilsWlanScan::verifyWlanScanApResultList( - QList< QSharedPointer > wlanApList) -{ - QCOMPARE(wlanApList.count(), mWlanScanApResultList.count()); - - for (int i = 0; i < mWlanScanApResultList.count(); i++) { - QCOMPARE( - wlanApList[i]->value(WlanQtUtilsAp::ConfIdSsid), - mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdSsid)); - QCOMPARE( - wlanApList[i]->value(WlanQtUtilsAp::ConfIdBssid), - mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdBssid)); - QCOMPARE( - wlanApList[i]->value(WlanQtUtilsAp::ConfIdSignalStrength), - mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdSignalStrength)); - QCOMPARE( - wlanApList[i]->value(WlanQtUtilsAp::ConfIdConnectionMode), - mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdConnectionMode)); - QCOMPARE( - wlanApList[i]->value(WlanQtUtilsAp::ConfIdSecurityMode), - mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdSecurityMode)); - QCOMPARE( - wlanApList[i]->value(WlanQtUtilsAp::ConfIdWpaPskUse), - mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdWpaPskUse)); - QCOMPARE( - wlanApList[i]->value(WlanQtUtilsAp::ConfIdWpsSupported), - mWlanScanApResultList[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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/tsrc/context/wlanqtutilstestcontext.h --- a/wlanutilities/wlanqtutilities/tsrc/context/wlanqtutilstestcontext.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,291 +0,0 @@ -/* -* 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 IAPs for scan results. - * - * @param[in] numberOfWlanIaps Number of WLAN IAPs that are created. - */ - void createDefaultWlanScanIapResultList(int numberOfWlanIaps); - - /** - * Verifies that the given WLAN IAP list returned by the real application matches - * with the one in the context. - * - * @param[in] wlanIapList WLAN IAPs that are verified against the context. - */ - void verifyWlanScanIapResultList( - QList< QSharedPointer > wlanIapList); - - /** - * Creates a list of WLAN APs for scan results. - * - * @param[in] numberOfWlanAps Number of WLAN APs that are created. - */ - void createDefaultWlanScanApResultList(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 verifyWlanScanApResultList( - 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 IAPs that WLAN Management API stub will return when - // requesting for wlan IAP scan results. - QList< QSharedPointer > mWlanScanIapResultList; - - // List of WLAN access points that WLAN Management API stub will return when - // requesting for wlan scan results. - QList< QSharedPointer > mWlanScanApResultList; - - /** - * Should IAP scan be completed immediately or not? - */ - bool mCompleteWlanIapScan; - - /** - * Should AP scan be completed immediately or not? - */ - bool mCompleteWlanApScan; - - /** Return value of IAP scan request. */ - int mIapScanRetValue; - - /** Return value of AP scan request. */ - int mApScanRetValue; - -private: - - /** - * Destroys and clears the list of WLAN IAPs. - */ - void clearWlanScanIapResultList(); - - /** - * Destroys and clears the list of WLAN APs. - */ - void clearWlanScanApResultList(); -}; - -/** - * 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/tsrc/stubs/ictswlanlogininterface.h --- a/wlanutilities/wlanqtutilities/tsrc/stubs/ictswlanlogininterface.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +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 "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* ICTS Wlan Login Interface stubbing for WLAN Qt Utilities. -*/ - -#ifndef ICTSWLANLOGININTERFACE_H -#define ICTSWLANLOGININTERFACE_H - -// System includes -#include - -// User includes - -// Forward declarations - -// External data types - -// Constants - -// Class declaration -class 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(); - -signals: - - void ictsResult(int ictsResult); - - void hotspotCase(); -}; - -#endif // ICTSWLANLOGININTERFACE_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/tsrc/stubs/stub_connmon.cpp --- a/wlanutilities/wlanqtutilities/tsrc/stubs/stub_connmon.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/tsrc/stubs/stub_esock.cpp --- a/wlanutilities/wlanqtutilities/tsrc/stubs/stub_esock.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/tsrc/stubs/stub_ictswlanlogininterface.cpp --- a/wlanutilities/wlanqtutilities/tsrc/stubs/stub_ictswlanlogininterface.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +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 "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* ICTS Wlan Login Interface stubbing for WLAN Qt Utilities. -*/ - -#include "ictswlanlogininterface.h" - -#include "wlanqtutilstestcontext.h" - -extern WlanQtUtilsTestContext testContext; - -/*! - Constructor. -*/ -IctsWlanLoginInterface::IctsWlanLoginInterface(QObject *parent) -{ - Q_UNUSED(parent); -} - -/*! - Destructor. -*/ -IctsWlanLoginInterface::~IctsWlanLoginInterface() -{ -} - -/*! - 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) -{ - Q_UNUSED(iapId); - Q_UNUSED(netId); -} - -/*! - Function for stopping launched Wlan login application. -*/ -void IctsWlanLoginInterface::stop() -{ -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/tsrc/stubs/stub_wlanmgmtclient.cpp --- a/wlanutilities/wlanqtutilities/tsrc/stubs/stub_wlanmgmtclient.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,166 +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 "Eclipse Public License v1.0" -* which accompanies 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" -#include "wlanqtutilsiap.h" - -extern WlanQtUtilsTestContext testContext; - -// Request status for canceling stubbed GetScanResults async request -static TRequestStatus* iGetScanResultsStatus = 0; - -// Request status for canceling stubbed GetAvailableIaps async request -static TRequestStatus* iGetAvailableIapsStatus = 0; - -// --------------------------------------------------------- -// CWlanMgmtClient::NewL -// --------------------------------------------------------- -// -CWlanMgmtClient* CWlanMgmtClient::NewL() - { - CWlanMgmtClient* self = new CWlanMgmtClient; - return self; - } - -// --------------------------------------------------------- -// CWlanMgmtClient::~CWlanMgmtClient -// --------------------------------------------------------- -// -CWlanMgmtClient::~CWlanMgmtClient() - { - } - -// --------------------------------------------------------- -// CWlanMgmtClient::CWlanMgmtClient -// --------------------------------------------------------- -// -CWlanMgmtClient::CWlanMgmtClient() - { - } - -// --------------------------------------------------------- -// CWlanMgmtClient::GetScanResults -// --------------------------------------------------------- -// -void CWlanMgmtClient::GetScanResults( - TRequestStatus& aStatus, - CWlanScanInfo& aResults ) - { - (void)aResults; - - if (testContext.mScan.mCompleteWlanApScan) { - // Complete the request immediately - TRequestStatus *status = &aStatus; - User::RequestComplete( - status, - testContext.mScan.mApScanRetValue); - } else { - iGetScanResultsStatus = &aStatus; - } - - // Results are returned when asked per AP - } - -// --------------------------------------------------------- -// CWlanMgmtClient::GetScanResults -// --------------------------------------------------------- -// -void CWlanMgmtClient::GetScanResults( - TWlanSsid& aSsid, - TRequestStatus& aStatus, - CWlanScanInfo& aResults ) - { - (void)aSsid; - (void)aResults; - - if (testContext.mScan.mCompleteWlanApScan) { - // Complete the request immediately - TRequestStatus *status = &aStatus; - User::RequestComplete( - status, - testContext.mScan.mApScanRetValue); - } else { - iGetScanResultsStatus = &aStatus; - } - - // Results are returned when asked per AP - } - -// --------------------------------------------------------- -// CWlanMgmtClient::CancelGetScanResults -// --------------------------------------------------------- -// -void CWlanMgmtClient::CancelGetScanResults() - { - if (iGetScanResultsStatus) { - User::RequestComplete(iGetScanResultsStatus, KErrCancel); - iGetScanResultsStatus = NULL; - } - } - -// --------------------------------------------------------- -// CWlanMgmtClient::GetAvailableIaps -// --------------------------------------------------------- -// -void CWlanMgmtClient::GetAvailableIaps( - TInt& aCacheLifetime, - TUint& aMaxDelay, - TBool aFilteredResults, - TRequestStatus& aStatus, - RArray& aAvailableIaps ) - { - (void)aCacheLifetime; - (void)aMaxDelay; - (void)aFilteredResults; - (void)aAvailableIaps; - - if (testContext.mScan.mCompleteWlanIapScan) { - // Form results as defined in context - aAvailableIaps.Reset(); - for (int i=0; i < testContext.mScan.mWlanScanIapResultList.count(); i++) { - QSharedPointer iap(testContext.mScan.mWlanScanIapResultList[i]); - TWlanIapAvailabilityData data; - data.iIapId = (TUint)iap->value(WlanQtUtilsIap::ConfIdIapId).toInt(); - data.iRssi = (TUint)iap->value(WlanQtUtilsAp::ConfIdSignalStrength).toInt(); - aAvailableIaps.AppendL(data); - } - - // Complete the request immediately - TRequestStatus *status = &aStatus; - User::RequestComplete( - status, - testContext.mScan.mIapScanRetValue); - } else { - iGetAvailableIapsStatus = &aStatus; - } - } - -// --------------------------------------------------------- -// CWlanMgmtClient::CancelGetAvailableIaps -// --------------------------------------------------------- -// -void CWlanMgmtClient::CancelGetAvailableIaps() - { - if (iGetAvailableIapsStatus) { - User::RequestComplete(iGetAvailableIapsStatus, KErrCancel); - iGetAvailableIapsStatus = 0; - } - } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/tsrc/stubs/stub_wlanscaninfo.cpp --- a/wlanutilities/wlanqtutilities/tsrc/stubs/stub_wlanscaninfo.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,287 +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 "Eclipse Public License v1.0" -* which accompanies 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.mWlanScanApResultList.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 - ssidBuffer.SetLength(0); - QString ssid = ap->value(WlanQtUtilsAp::ConfIdSsid).toString(); - for (int i = 0; i < ssid.length(); i++) { - QChar character = ssid[i]; - ssidBuffer.Append((TUint8)(character.unicode() & 0x000000FF)); - } - - // 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.mWlanScanApResultList[ - testContext.mScan.mScanResultIterator]); - - return ap; - } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/tsrc/stubs/wlanmgmtclient.h --- a/wlanutilities/wlanqtutilities/tsrc/stubs/wlanmgmtclient.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +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 "Eclipse Public License v1.0" -* which accompanies 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(); - - /** - * Get the available WLAN IAPs. - * - * @param aCacheLifetime Defines how many seconds old cached results the client - * is willing to accept. The valid is range is from 0 to - * 60 seconds. The value of -1 means the system default will - * be used. The aCacheLifetime parameter has a meaning only - * when the aMaxDelay parameter is zero. - * Value will be changed to the actual value used by the - * system. - * @param aMaxDelay Maximum amount of seconds the client is willing to wait for - * the availability results. The valid range is from 0 to 1200 - * seconds or KWlanInfiniteScanDelay. KWlanInfiniteScanDelay - * will never cause a scan, but the request will be - * completed when any other broadcast scan request is completed. - * Value will be changed to the actual value used by the system. - * @param aFilteredResults Whether availability is filtered based on signal strength. - * ETrue if filtering is allowed, EFalse if not. - * @param aStatus Status of the calling active object. On successful - * completion contains KErrNone, otherwise one of the - * system-wide error codes. - * @param aAvailableIaps Array of IAPs available. - */ - void GetAvailableIaps( - TInt& aCacheLifetime, - TUint& aMaxDelay, - TBool aFilteredResults, - TRequestStatus& aStatus, - RArray& aAvailableIaps ); - - /** - * Cancel an outstanding IAP availability request. - */ - void CancelGetAvailableIaps(); - - private: // Data - - CWlanMgmtClient(); - }; - -#endif // WLANMGMTCLIENT_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/tsrc/stubs/wlanscaninfo.h --- a/wlanutilities/wlanqtutilities/tsrc/stubs/wlanscaninfo.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.cpp --- a/wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1575 +0,0 @@ -/* -* 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.createDefaultWlanScanApResultList(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.verifyWlanScanApResultList(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.createDefaultWlanScanApResultList(11); - testContext.mScan.mWlanScanApResultList[0]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID"); - testContext.mScan.mWlanScanApResultList[2]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID"); - testContext.mScan.mWlanScanApResultList[5]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID, different SecMode"); - testContext.mScan.mWlanScanApResultList[5]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa); - testContext.mScan.mWlanScanApResultList[6]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID, different SecMode"); - testContext.mScan.mWlanScanApResultList[6]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeOpen); - testContext.mScan.mWlanScanApResultList[7]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID & SecMode diff Psk"); - testContext.mScan.mWlanScanApResultList[7]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa2); - testContext.mScan.mWlanScanApResultList[9]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID & SecMode diff Psk"); - testContext.mScan.mWlanScanApResultList[9]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa2); - testContext.mScan.mWlanScanApResultList[9]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse,true); - testContext.mScan.mWlanScanApResultList[10]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID"); - testContext.mScan.mWlanScanApResultList[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.mWlanScanApResultList.removeAt(2); - testContext.mScan.verifyWlanScanApResultList(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.createDefaultWlanScanApResultList(11); - testContext.mScan.mWlanScanApResultList[0]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); - testContext.mScan.mWlanScanApResultList[0]->setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Adhoc); - testContext.mScan.mWlanScanApResultList[1]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWep); - testContext.mScan.mWlanScanApResultList[2]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWep); - testContext.mScan.mWlanScanApResultList[3]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecMode802_1x); - testContext.mScan.mWlanScanApResultList[4]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa); - testContext.mScan.mWlanScanApResultList[5]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa); - testContext.mScan.mWlanScanApResultList[5]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); - testContext.mScan.mWlanScanApResultList[6]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa2); - testContext.mScan.mWlanScanApResultList[7]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa2); - testContext.mScan.mWlanScanApResultList[7]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); - testContext.mScan.mWlanScanApResultList[8]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWapi); - testContext.mScan.mWlanScanApResultList[9]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWapi); - // Let's trick the stub to return WapiPsk by putting WpaPskUse on * - testContext.mScan.mWlanScanApResultList[9]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); - testContext.mScan.mWlanScanApResultList[10]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa2); - testContext.mScan.mWlanScanApResultList[10]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); - testContext.mScan.mWlanScanApResultList[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.mWlanScanApResultList[9]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse,false); - testContext.mScan.verifyWlanScanApResultList(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.createDefaultWlanScanApResultList(6); - testContext.mScan.mWlanScanApResultList[1]->setValue(WlanQtUtilsAp::ConfIdSsid, " "); - testContext.mScan.mWlanScanApResultList[2]->setValue(WlanQtUtilsAp::ConfIdSsid, " whitespace around ssid "); - testContext.mScan.mWlanScanApResultList[3]->setValue(WlanQtUtilsAp::ConfIdSsid, QString(QChar())); - testContext.mScan.mWlanScanApResultList[4]->setValue(WlanQtUtilsAp::ConfIdSsid, "maximum length ssid that is 32 c"); - testContext.mScan.mWlanScanApResultList[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.mWlanScanApResultList.removeAt(3); - testContext.mScan.mWlanScanApResultList.removeAt(1); - testContext.mScan.verifyWlanScanApResultList(aps); - QCOMPARE(iaps.count(), 0); -} - -/** - * Test available WLAN APs when there are also WLAN IAPs available. - */ -void TestWlanQtUtils::testAvailableWlanWithIaps() -{ - // Form WLAN IAP scan result list - testContext.mScan.createDefaultWlanScanIapResultList(3); - testContext.mScan.mWlanScanIapResultList.removeAt(1); - testContext.mScan.mWlanScanIapResultList[0]->setValue(WlanQtUtilsIap::ConfIdIapId, 5); - testContext.mScan.mWlanScanIapResultList[1]->setValue(WlanQtUtilsIap::ConfIdIapId, 7); - - // Form WLAN AP scan result list - testContext.mScan.createDefaultWlanScanApResultList(7); - testContext.mScan.mWlanScanApResultList[1]->setValue(WlanQtUtilsAp::ConfIdSsid, "WLAN IAP 3"); - testContext.mScan.mWlanScanApResultList[1]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa); - testContext.mScan.mWlanScanApResultList[1]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse,true); - testContext.mScan.mWlanScanApResultList[5]->setValue(WlanQtUtilsAp::ConfIdSsid, "WLAN IAP 1"); - // SSID is found in Internet Snap, but security mode does not match: - testContext.mScan.mWlanScanApResultList[6]->setValue(WlanQtUtilsAp::ConfIdSsid, "WLAN IAP 2"); - testContext.mScan.mWlanScanApResultList[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 IAP list - testContext.mScan.verifyWlanScanIapResultList(iaps); - - // Verify WLAN AP list. First, remove scan results that will not appear - // because they are WLAN IAPs. - testContext.mScan.mWlanScanApResultList.removeAt(5); - testContext.mScan.mWlanScanApResultList.removeAt(1); - testContext.mScan.verifyWlanScanApResultList(aps); - - 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.createDefaultWlanScanApResultList(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.verifyWlanScanApResultList(aps); - QCOMPARE(iaps.count(), 0); - aps.clear(); - - // **************** 2nd scan ******************** - // 2 APs are required for this scan - testContext.mScan.createDefaultWlanScanApResultList(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.verifyWlanScanApResultList(aps); - QCOMPARE(iaps.count(), 0); - aps.clear(); - - // **************** 3rd scan ******************** - // 4 APs are required for the 3rd scan - testContext.mScan.createDefaultWlanScanApResultList(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.verifyWlanScanApResultList(aps); - QCOMPARE(iaps.count(), 0); - aps.clear(); -} - -/** - * Test availability scan that finds nothing. - */ -void TestWlanQtUtils::testAvailableWlanScanEmpty() -{ - // Form result list - testContext.mScan.createDefaultWlanScanApResultList(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.verifyWlanScanApResultList(aps); - QCOMPARE(iaps.count(), 0); -} - -/** - * Test WLAN availability scan failure. - */ -void TestWlanQtUtils::testAvailableWlanScanError() -{ - // Set the scan to fail - testContext.mScan.mApScanRetValue = 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.createDefaultWlanScanApResultList(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.verifyWlanScanApResultList(aps); - aps.clear(); -} - -/** - * Test a direct scan that finds nothing. - */ -void TestWlanQtUtils::testAvailableWlanApsScanEmpty() -{ - // Form result list - testContext.mScan.createDefaultWlanScanApResultList(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.verifyWlanScanApResultList(aps); -} - -/** - * Test cancellation of WLAN AP scan. - */ -void TestWlanQtUtils::testStopWlanApScan() -{ - // Do not complete scan request immediately - testContext.mScan.mCompleteWlanApScan = 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.mApScanRetValue = KErrGeneral; - - // Start the scan - wlanQtUtils_->scanWlanAps(); - - // Catch & check the scan result signal - subTestScanResultSignal(mSignalScanApReady, WlanQtUtils::ScanStatusError); -} - -/** - * Test WLAN AP scan with special characters. - */ -void TestWlanQtUtils::testAvailableWlanApsSpecialChars() -{ - testContext.mScan.createDefaultWlanScanApResultList(3); - // Set SSID's to include special characters - testContext.mScan.mWlanScanApResultList[0]->setValue( - WlanQtUtilsAp::ConfIdSsid, - "\x57\x41\x50\x49\xBD\xA7\xA4\xE4\xF6"); - testContext.mScan.mWlanScanApResultList[1]->setValue( - WlanQtUtilsAp::ConfIdSsid, - "\x01\x02\x03\xAB\x43\x52\x41\x50\xBB\xA7\xA4\xFE\xFF"); - testContext.mScan.mWlanScanApResultList[2]->setValue( - WlanQtUtilsAp::ConfIdSsid, - "12345678901234567890123456789012"); // Maximum SSID length of 32 bytes - - // 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.verifyWlanScanApResultList(aps); - aps.clear(); -} - -/** - * Test a basic direct scan. - */ -void TestWlanQtUtils::testDirectScanBasic() -{ - // Form result list - testContext.mScan.createDefaultWlanScanApResultList(2); - testContext.mScan.mWlanScanApResultList[0]->setValue(WlanQtUtilsAp::ConfIdSsid, "testssid"); - testContext.mScan.mWlanScanApResultList[0]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); - testContext.mScan.mWlanScanApResultList[1]->setValue(WlanQtUtilsAp::ConfIdSsid, "testssid"); - testContext.mScan.mWlanScanApResultList[1]->setValue(WlanQtUtilsAp::ConfIdBssid, "654321"); - testContext.mScan.mWlanScanApResultList[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.verifyWlanScanApResultList(aps); - aps.clear(); -} - -/** - * Test a direct scan that finds nothing. - */ -void TestWlanQtUtils::testDirectScanEmpty() -{ - // Form result list - testContext.mScan.createDefaultWlanScanApResultList(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.verifyWlanScanApResultList(aps); -} - -/** - * Test cancellation of direct scan. - */ -void TestWlanQtUtils::testDirectScanStop() -{ - // Do not complete scan request immediately - testContext.mScan.mCompleteWlanApScan = 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.mApScanRetValue = 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() -{ - // Form WLAN AP scan result list - testContext.mScan.createDefaultWlanScanApResultList(1); - testContext.mScan.mWlanScanApResultList[0]->setValue(WlanQtUtilsAp::ConfIdSsid, "testCreateIapOk"); - testContext.mScan.mWlanScanApResultList[0]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa); - testContext.mScan.mWlanScanApResultList[0]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse,true); - - // Form WLAN IAP scan result list - testContext.mScan.createDefaultWlanScanIapResultList(0); - - // 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.verifyWlanScanApResultList(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); - - // Form WLAN IAP scan result list - testContext.mScan.createDefaultWlanScanIapResultList(1); - testContext.mScan.mWlanScanIapResultList[0]->setValue(WlanQtUtilsIap::ConfIdIapId, iapId); - testContext.mScan.mWlanScanIapResultList[0]->setValue(WlanQtUtilsIap::ConfIdName, QString("testCreateIapOk")); - testContext.mScan.mWlanScanIapResultList[0]->setValue(WlanQtUtilsIap::ConfIdSsid, QString("testCreateIapOk")); - testContext.mScan.mWlanScanIapResultList[0]->setValue(WlanQtUtilsIap::ConfIdSecurityMode, (int)(CMManagerShim::WlanSecModeWpa)); - testContext.mScan.mWlanScanIapResultList[0]->setValue(WlanQtUtilsIap::ConfIdWpaPskUse, true); - - // Re-execute the scan so that scan lists get updated due to the IAP creation - wlanQtUtils_->scanWlans(); - subTestScanResultSignal(mSignalScanReady, WlanQtUtils::ScanStatusOk); - - // Verify that created IAP is in the IAP list and AP list is empty. - wlanQtUtils_->availableWlans(iaps, aps); - testContext.mScan.verifyWlanScanIapResultList(iaps); - QCOMPARE(aps.count(), 0); -} - -/** - * 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.mCompleteWlanApScan = 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.mCompleteWlanApScan = 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 - wlanQtUtils_->d_ptr->updateIctResult(IctsWlanLoginInterface::IctsPassed); - - subTestSignalWaitAndTake(signalIctResult_, &arguments); - QCOMPARE(arguments.at(0).toInt(), iapId); - QCOMPARE(arguments.at(1).toInt(), (int)WlanQtUtils::IctPassed); -} - -/** - * 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, "testConnectionTestErr1"); - 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 - wlanQtUtils_->d_ptr->updateIctResult(IctsWlanLoginInterface::IctsFailed); - - subTestSignalWaitAndTake(signalIctResult_, &arguments); - QCOMPARE(arguments.at(0).toInt(), iapId); - QCOMPARE(arguments.at(1).toInt(), (int)WlanQtUtils::IctFailed); - - // Repeat with cancel status - // 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(), iapId); - QCOMPARE(arguments.at(1).toInt(), KErrNone); - - wlanAp->setValue(WlanQtUtilsAp::ConfIdSsid, "testConnectionTestErr2"); - - 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)); - 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 - wlanQtUtils_->d_ptr->updateIctResult(IctsWlanLoginInterface::IctsCanceled); - - subTestSignalWaitAndTake(signalIctResult_, &arguments); - QCOMPARE(arguments.at(0).toInt(), iapId); - QCOMPARE(arguments.at(1).toInt(), (int)WlanQtUtils::IctCancelled); -} - -/** - * This function tests ICT when connection test passes in hotspot case. - */ -void TestWlanQtUtils::testConnectionTestHotspot() -{ - // Create new IAP to test - QScopedPointer wlanAp(subTestNewAp()); - wlanAp->setValue(WlanQtUtilsAp::ConfIdSsid, "testConnectionTestHotspot"); - 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 hotspot case slot explicitly - wlanQtUtils_->d_ptr->updateIctHotspotCase(); - - // Call result function explicitly - // No interface exists that we could check that the IAP is not moved to another SNAP - wlanQtUtils_->d_ptr->updateIctResult(IctsWlanLoginInterface::IctsHotspotPassed); - - subTestSignalWaitAndTake(signalIctResult_, &arguments); - QCOMPARE(arguments.at(0).toInt(), iapId); - QCOMPARE(arguments.at(1).toInt(), (int)WlanQtUtils::IctHotspotPassed); -} - -/** - * 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); - ap->setValue(WlanQtUtilsAp::ConfIdWlanScanSSID, false); - - return ap; -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.h --- a/wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -/* -* 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(); - void testAvailableWlanApsSpecialChars(); - - // 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 testConnectionTestHotspot(); - - 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.pro --- a/wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.pro Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -# -# 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" -} - -# Stub headers must be used instead of real ones -symbian { - MMP_RULES += "USERINCLUDE stubs" -} - -#BUILD_DLL macro is used to define export macro -DEFINES += BUILD_WLANQTUTILITIES_DLL - -INCLUDEPATH += \ - . \ - stubs \ - ../../inc \ - ../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/wlanqtutilsscanap_symbian.h \ - ../wrapper/inc/wlanqtutilsscaniap_symbian.h \ - stubs/ictswlanlogininterface.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/wlanqtutilsscanap_symbian.cpp \ - ../wrapper/src/wlanqtutilsscaniap_symbian.cpp \ - stubs/stub_connmon.cpp \ - stubs/stub_esock.cpp \ - stubs/stub_ictswlanlogininterface.cpp \ - stubs/stub_wlanmgmtclient.cpp \ - stubs/stub_wlanscaninfo.cpp -} - -LIBS += -lconnmon -lconnection_settings_shim -lextendedconnpref -lnetmeta -lesock -lcharconv diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/tsrc/tools/default.cre Binary file wlanutilities/wlanqtutilities/tsrc/tools/default.cre has changed diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/tsrc/tools/make_wst.bat --- a/wlanutilities/wlanqtutilities/tsrc/tools/make_wst.bat Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,197 +0,0 @@ -::============================================================================= -:: 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/tsrc/tools/run_wst.bat --- a/wlanutilities/wlanqtutilities/tsrc/tools/run_wst.bat Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,173 +0,0 @@ -::============================================================================= -:: 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/tsrc/tools/variantdata_wlanqtutils.xml --- a/wlanutilities/wlanqtutilities/tsrc/tools/variantdata_wlanqtutils.xml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,764 +0,0 @@ - - - - - - whenneeded - 11 - 0 - 1 - 2 - 3 - 4 - 6 - 7 - 256 - 256 - 9 - 0 - 8 - 1 - 2 - 4 - 5 - 6 - 7 - Destination - Internet - Known - Confirm - Wlan only - -1 - 1 - -1 - -1 - 1 - -1 - -1 - 1 - 4 - 7 - 2347 - 100 - 1 - 0 - - - - packet data 1 - 1 - No - No - No - No - ConfirmFirst - IPv4 - packetdata1 - - No - - Normal - - http://www.nokia.com - On - Continuous - - - - - - - 0 - - Yes - 0 - - - - packet data 2 - 3 - No - No - No - No - ConfirmFirst - IPv4 - packetdata2 - - No - - Normal - - http://www.nokia.com - On - Continuous - - - - - - - 0 - - Yes - 0 - - - - packet data 3 - 4 - No - No - No - No - ConfirmFirst - IPv4 - packetdata3 - - No - - Normal - - http://www.nokia.com - On - Continuous - - - - - - - 0 - - Yes - 0 - - - - Streaming - 9 - No - No - No - No - ConfirmFirst - IPv4 - streaming - - No - - Normal - - http://www.nokia.com - On - Continuous - - - - - - - 0 - - Yes - 0 - - - - - - WLAN IAP 1 - 5 - No - No - No - No - ShowProgress - WLAN IAP 1 - - Infrastructure - Open - - - - - - - - - - No - - - key1 - Shared - 64 - ASCII - - 64 - ASCII - - 64 - ASCII - - 64 - ASCII - - - No - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - WLAN IAP 2 - 6 - No - No - No - No - ConfirmFirst - WLAN IAP 2 - http://themaximus.security.max - Ad-hoc - WEP - - - - - - - 192.168.100.200 - 8000 - - No - - - key1 - Open - 64 - ASCII - w2key - 64 - Hexadecimal - - 64 - ASCII - - 64 - ASCII - - - No - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - WLAN IAP 3 - 7 - No - No - No - No - ConfirmFirst - WLAN IAP 3 - - Infrastructure - WPA - - - - - - - - - - No - - - key1 - Shared - 64 - ASCII - - 64 - ASCII - - 64 - ASCII - - 64 - ASCII - - wlan3key - Yes - 8 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Home WLAN - 8 - No - No - No - No - ShowProgress - Home WLAN - - Infrastructure - Open - - - - - - - - - - No - - - key1 - Shared - 64 - ASCII - - 64 - ASCII - - 64 - ASCII - - 64 - ASCII - - - No - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Internet - 3 - Internet - 2 - No - No - Yes - 0 - - packet data 1 - packet data 2 - packet data 3 - WLAN IAP 1 - WLAN IAP 2 - WLAN IAP 3 - - - - - - - Multimedia msg. - 4 - MMS - 2 - No - Yes - No - 2 - - - - - - - - - - - - - - WAP services - 5 - Operator - 2 - No - No - No - 4 - - - - - - - - - - - - - - >My SNAP - 6 - - 2 - No - No - No - 3 - - Home WLAN - Streaming - - - - - - - - - - - \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/wlanqtutilities.pro --- a/wlanutilities/wlanqtutilities/wlanqtutilities.pro Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -# -# 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 project file. -# - -TEMPLATE = lib -TARGET = wlanqtutilities - -#BUILD_DLL macro is used to define export macro -DEFINES += BUILD_WLANQTUTILITIES_DLL -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" -} - -INCLUDEPATH += \ - ../inc \ - base/inc \ - wrapper/inc \ - traces - -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/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 - -# Common libraries -LIBS += -lconnection_settings_shim - -symbian: { - HEADERS += \ - wrapper/inc/wlanqtutilsconmonwrapperdisconnect_symbian.h \ - wrapper/inc/wlanqtutilsconmonwrapperinfo_symbian.h \ - wrapper/inc/wlanqtutilsesockwrapper_symbian.h \ - wrapper/inc/wlanqtutilsscanap_symbian.h \ - wrapper/inc/wlanqtutilsscaniap_symbian.h - SOURCES += \ - wrapper/src/wlanqtutilsconmonwrapperdisconnect_symbian.cpp \ - wrapper/src/wlanqtutilsconmonwrapperinfo_symbian.cpp \ - wrapper/src/wlanqtutilsesockwrapper_symbian.cpp \ - wrapper/src/wlanqtutilsscanap_symbian.cpp \ - wrapper/src/wlanqtutilsscaniap_symbian.cpp - - TARGET.CAPABILITY = CAP_GENERAL_DLL - TARGET.EPOCALLOWDLLDATA = 1 - TARGET.UID3 = 0x20029F52 - 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/wlanqtutilsap.h |../inc/wlanqtutilsap.h" \ - "base/inc/wlanqtutilsiap.h |../inc/wlanqtutilsiap.h" - - # S60 libraries - LIBS += -lconnmon -lecom -lesock -lextendedconnpref -lnetmeta -lictswlanlogininterface -lcharconv -} - -# Stubs for emulator -include(stubs/stubs.pri) diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconmonwrapper.h --- a/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconmonwrapper.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* -* 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: -* Wrapper for Symbian Connection Monitor library. -*/ - -#ifndef WLANQTUTILSCONMONWRAPPER_H -#define WLANQTUTILSCONMONWRAPPER_H - -// System includes - -#include -#include -#include -#include - -// User includes - -#include "wlanqtutils.h" - -// Forward declarations - -class WlanQtUtilsAp; -class WlanQtUtilsConnection; -class WlanQtUtilsConMonWrapperInfo; -class WlanQtUtilsConMonWrapperDisconnect; - -// External data types - -// Constants - -// Class declaration - -class WlanQtUtilsConMonWrapper : public QObject -{ - Q_OBJECT - -public: - - // Data types - - explicit WlanQtUtilsConMonWrapper(QObject *parent = 0); - - ~WlanQtUtilsConMonWrapper(); - - WlanQtUtilsConnection *activeConnection() const; - - WlanQtUtilsConnection *connectionInfo(uint connectionId) const; - - void disconnectIap(int iapId); - -signals: - - /*! - 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. - */ - void connDeletedEventFromWrapper(uint connectionId); - - /*! - Signal indicating that status of a connection has changed. - - @param [in] connectionId Connection ID. - @param [in] connectionStatus Connection status. - */ - void connStatusEventFromWrapper( - uint connectionId, - WlanQtUtils::ConnStatus connectionStatus); - -public slots: - -protected: - -protected slots: - -private: - -private slots: - -private: // data - - // Owned data - - //! Private implementation of connection info interface - QScopedPointer d_ptrInfo; - - //! Private implementation of connection disconnect interface - QScopedPointer d_ptrDisconnect; - - // 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; -}; - -#endif // WLANQTUTILSCONMONWRAPPER_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconmonwrapperdisconnect_symbian.h --- a/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconmonwrapperdisconnect_symbian.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconmonwrapperinfo_symbian.h --- a/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconmonwrapperinfo_symbian.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsesockwrapper.h --- a/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsesockwrapper.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* -* 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: -* Wrapper for Symbian Esock library. -*/ - -#ifndef WLANQTUTILSESOCKWRAPPER_H -#define WLANQTUTILSESOCKWRAPPER_H - -// System includes - -#include -#include - -// User includes - -// Forward declarations - -class WlanQtUtilsEsockWrapperPrivate; - -// External data types - -// Constants - -// Class declaration - -class WlanQtUtilsEsockWrapper: public QObject -{ - Q_OBJECT - -public: - - // Data types - - WlanQtUtilsEsockWrapper(QObject *parent = 0); - - ~WlanQtUtilsEsockWrapper(); - - void updateConnection(bool isOpened, int platformStatusCode); - - int lastStatusCode(); - -signals: - - void connectionStatusFromWrapper(bool isOpened); - -public slots: - - void connectIap(int iapId); - - void disconnectIap(); - -protected: - -protected slots: - -private: - -private slots: - -private: // data - - //! Private implementation - QScopedPointer d_ptr; - - //! Platform status code of latest connection creation attempt - int mLastStatusCode; - - // Friend classes -}; - -#endif // WLANQTUTILSESOCKWRAPPER_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsesockwrapper_symbian.h --- a/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsesockwrapper_symbian.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsscan.h --- a/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsscan.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +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 "Eclipse Public License v1.0" -* which accompanies 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 "wlanqtutilsiap.h" - -// Forward declarations - -class WlanQtUtilsScanIapPrivate; -class WlanQtUtilsScanApPrivate; - -// External data types - -// Constants - -// Class declaration - -class WlanQtUtilsScan : public QObject -{ - Q_OBJECT - -public: - - // Data types - - explicit WlanQtUtilsScan(QObject *parent = 0); - - ~WlanQtUtilsScan(); - - void scanWlanIaps(); - - void scanWlanAps(); - - void scanWlanDirect(const QString &ssid); - - void stopScan(); - -signals: - - /*! - Signal indicating available WLAN IAP's. - - @param [in] availableIaps Available WLAN IAP's found in scan. - */ - void availableWlanIaps( - QList< QSharedPointer > &availableIaps); - - /*! - 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 IAP scan interface - WlanQtUtilsScanIapPrivate *d_ptrIap; - - //! Private implementation of AP scan interface - WlanQtUtilsScanApPrivate *d_ptrAp; - - // Not owned data - - // Friend classes - - // Needed to be able to emit public signals directly from - // private implementation. - friend class WlanQtUtilsScanIapPrivate; - friend class WlanQtUtilsScanApPrivate; -}; - -#endif // WLANQTUTILSSCAN_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsscanap_symbian.h --- a/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsscanap_symbian.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +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 "Eclipse Public License v1.0" -* which accompanies 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 AP scanning. -*/ - -#ifndef WLANQTUTILSSCANAP_SYMBIAN_H -#define WLANQTUTILSSCANAP_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 WlanQtUtilsScanApPrivate : public CActive -{ - -public: - - // Data types - - static WlanQtUtilsScanApPrivate *NewL(WlanQtUtilsScan *wrapper); - - ~WlanQtUtilsScanApPrivate(); - - void Scan(); - - void Scan(const QString &ssid); - - void StopScan(); - -protected: - - void RunL(); - - void DoCancel(); - -private: - - explicit WlanQtUtilsScanApPrivate(WlanQtUtilsScan *wrapper); - - 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 // WLANQTUTILSSCANAP_SYMBIAN_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsscaniap_symbian.h --- a/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsscaniap_symbian.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +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 "Eclipse Public License v1.0" -* which accompanies 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 IAP scanning. -*/ - -#ifndef WLANQTUTILSSCANIAP_SYMBIAN_H -#define WLANQTUTILSSCANIAP_SYMBIAN_H - -// System includes - -#include -#include - -// User includes - -#include "wlanqtutilsiap.h" - -// Forward declarations - -class CWlanMgmtClient; -class WlanQtUtilsScan; - -// External data types - -// Constants - -// Class declaration - -class WlanQtUtilsScanIapPrivate : public CActive -{ - -public: - - // Data types - - static WlanQtUtilsScanIapPrivate *NewL(WlanQtUtilsScan *wrapper); - - ~WlanQtUtilsScanIapPrivate(); - - void ScanIaps(); - - void StopScan(); - -protected: - - void RunL(); - - void DoCancel(); - -private: - - explicit WlanQtUtilsScanIapPrivate(WlanQtUtilsScan *wrapper); - - void ConstructL(); - - void ExtractScanResults( - QList< QSharedPointer > &scanResults); - -private: // data - - //! Public implementation reference - WlanQtUtilsScan *q_ptr; - - // Owned data - - //! WLAN Management Client - CWlanMgmtClient *mWlanMgmtClient; - - //! Accepted cache lifetime - TInt mCacheLifetime; - - //! Accepted maximum delay - TUint mMaxDelay; - - //! Scan results - RArray mAvailableIaps; - - // Not owned data - - // Friend classes -}; - -#endif // WLANQTUTILSSCANIAP_SYMBIAN_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapper.cpp --- a/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapper.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -/* -* 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: -* Wrapper for Symbian Connection Monitor library. -*/ - -// System includes - -#include -#include - -// User includes - -#include "wlanqtutilsconmonwrapperdisconnect_symbian.h" -#include "wlanqtutilsconmonwrapperinfo_symbian.h" -#include "wlanqtutilsconmonwrapper.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 - -// ======== LOCAL FUNCTIONS ======== - -// ======== MEMBER FUNCTIONS ======== - -/*! - Constructor. - - @param [in] parent Parent object. -*/ - -WlanQtUtilsConMonWrapper::WlanQtUtilsConMonWrapper(QObject *parent) : - QObject(parent), - d_ptrInfo(new WlanQtUtilsConMonWrapperInfo(this)), - d_ptrDisconnect(new WlanQtUtilsConMonWrapperDisconnect(this)) -{ -} - -/*! - Destructor. -*/ - -WlanQtUtilsConMonWrapper::~WlanQtUtilsConMonWrapper() -{ -} - -/*! - Return active connection information. - - @return Information of active connection, 0 if not found. -*/ - -WlanQtUtilsConnection *WlanQtUtilsConMonWrapper::activeConnection() const -{ - return d_ptrInfo->ActiveConnection(); -} - -/*! - 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 -{ - return d_ptrInfo->ConnectionInfo(connectionId); -} - -/*! - Stops given connection regardless of how many applications are using it. - - @param [in] iapId IAP ID to disconnect. -*/ - -void WlanQtUtilsConMonWrapper::disconnectIap(int iapId) -{ - d_ptrDisconnect->DisconnectConnection(iapId); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapperdisconnect_symbian.cpp --- a/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapperdisconnect_symbian.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -/* - * 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapperinfo_symbian.cpp --- a/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapperinfo_symbian.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,354 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsesockwrapper.cpp --- a/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsesockwrapper.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -/* -* 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: -* Wrapper for Symbian Esock library. -*/ - -// System includes - -#include - -// User includes - -#include "wlanqtutilsesockwrapper.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 - -// ======== LOCAL FUNCTIONS ======== - -// ======== MEMBER FUNCTIONS ======== - -/*! - Constructor. - - @param [in] parent Parent object. - */ - -WlanQtUtilsEsockWrapper::WlanQtUtilsEsockWrapper(QObject *parent) : - QObject(parent), - d_ptr(new WlanQtUtilsEsockWrapperPrivate(this)), - mLastStatusCode(KErrNone) -{ -} - -/*! - Destructor. - */ - -WlanQtUtilsEsockWrapper::~WlanQtUtilsEsockWrapper() -{ -} - -/*! - 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); -} - -/*! - Returns last received connection creation status code. Clears status. - - @return Platform specific status code of the last connection attempt. - */ - -int WlanQtUtilsEsockWrapper::lastStatusCode() -{ - // Return current status and clear it - int status = mLastStatusCode; - mLastStatusCode = KErrNone; - return status; -} - -/*! - Starts connection creation to given IAP. - - @param [in] iapId IAP ID to connect. - */ - -void WlanQtUtilsEsockWrapper::connectIap(int iapId) -{ - d_ptr->ConnectIap(iapId); -} - -/*! - Disconnects connection, if one is active. - */ - -void WlanQtUtilsEsockWrapper::disconnectIap() -{ - d_ptr->DisconnectIap(); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsesockwrapper_symbian.cpp --- a/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsesockwrapper_symbian.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,196 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsscan.cpp --- a/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsscan.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +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 "Eclipse Public License v1.0" -* which accompanies 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 "wlanqtutilsscaniap_symbian.h" -#include "wlanqtutilsscanap_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_ptrIap = WlanQtUtilsScanIapPrivate::NewL(this); - d_ptrAp = WlanQtUtilsScanApPrivate::NewL(this)); -} - -/*! - Destructor. -*/ - -WlanQtUtilsScan::~WlanQtUtilsScan() -{ - delete d_ptrIap; - delete d_ptrAp; -} - -/*! - Scans available WLAN IAP's, including hidden ones. -*/ - -void WlanQtUtilsScan::scanWlanIaps() -{ - d_ptrIap->ScanIaps(); -} - -/*! - Scans available WLAN AP's (i.e. broadcast scan). -*/ - -void WlanQtUtilsScan::scanWlanAps() -{ - d_ptrAp->Scan(); -} - -/*! - Scans with given WLAN SSID (i.e. direct scan). - - @param [in] ssid WLAN SSID to scan. -*/ - -void WlanQtUtilsScan::scanWlanDirect(const QString &ssid) -{ - d_ptrAp->Scan(ssid); -} - -/*! - Stops current scan. Can also be called if there is no scan in progres. -*/ - -void WlanQtUtilsScan::stopScan() -{ - d_ptrIap->StopScan(); - d_ptrAp->StopScan(); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsscanap_symbian.cpp --- a/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsscanap_symbian.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,428 +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 "Eclipse Public License v1.0" -* which accompanies 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 AP scanning. -*/ - -// System includes - -#include -#include -#include - -// User includes - -#include "wlanqtutils.h" -#include "wlanqtutilsap.h" -#include "wlanqtutilsscan.h" -#include "wlanqtutilsscanap_symbian.h" - -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlanqtutilsscanap_symbianTraces.h" -#endif - - -/*! - \class WlanQtUtilsScanApPrivate - \brief Symbian platform specific implementation of WLAN AP scanning. - - Symbian platform specific implementation of WLAN AP 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. -*/ - -WlanQtUtilsScanApPrivate *WlanQtUtilsScanApPrivate::NewL(WlanQtUtilsScan *wrapper) -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANAPPRIVATE_NEWL_ENTRY); - - WlanQtUtilsScanApPrivate *self = new (ELeave) WlanQtUtilsScanApPrivate(wrapper); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - - OstTraceFunctionExit0(WLANQTUTILSSCANAPPRIVATE_NEWL_EXIT); - return self; -} - -/*! - Destructor. -*/ - -WlanQtUtilsScanApPrivate::~WlanQtUtilsScanApPrivate() -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANAPPRIVATE_WLANQTUTILSSCANAPPRIVATE_ENTRY); - - Cancel(); - delete mWlanMgmtClient; - mWlanMgmtClient = NULL; - delete mResults; - mResults = NULL; - - OstTraceFunctionExit0(WLANQTUTILSSCANAPPRIVATE_WLANQTUTILSSCANAPPRIVATE_EXIT); -} - -/*! - Starts a broadcast scan of available access points. -*/ - -void WlanQtUtilsScanApPrivate::Scan() -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANAPPRIVATE_SCAN_ENTRY); - - // Scanning while previous scan is not complete is not supported - Q_ASSERT(!IsActive()); - - // Make the scan - mWlanMgmtClient->GetScanResults(iStatus, *mResults); - SetActive(); - - OstTraceFunctionExit0(WLANQTUTILSSCANAPPRIVATE_SCAN_EXIT); -} - -/*! - Starts a direct scan of available access points having given SSID. - - @param ssid SSID to scan. -*/ - -void WlanQtUtilsScanApPrivate::Scan(const QString &ssid) -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANAPPRIVATE_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, - WLANQTUTILSSCANAPPRIVATE_SCAN_SSID, - "WlanQtUtilsScanApPrivate::Scan;mWlanSsid=%s", - mWlanSsid); - - // Make the scan - mWlanMgmtClient->GetScanResults(mWlanSsid, iStatus, *mResults); - SetActive(); - - OstTraceFunctionExit0(WLANQTUTILSSCANAPPRIVATE_SCAN_SSID_EXIT); -} - -/*! - Stops an ongoing scan. -*/ - -void WlanQtUtilsScanApPrivate::StopScan() -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANAPPRIVATE_STOPSCAN_ENTRY); - - Cancel(); - - OstTraceFunctionExit0(WLANQTUTILSSCANAPPRIVATE_STOPSCAN_EXIT); -} - -/*! - Scan results handler. -*/ - -void WlanQtUtilsScanApPrivate::RunL() -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANAPPRIVATE_RUNL_ENTRY); - - QT_TRYCATCH_LEAVING( - if (iStatus != KErrNone) { - // Scan failed - emit q_ptr->scanFailed(WlanQtUtils::ScanStatusError); - } else { - // Scan succeeded - QList< QSharedPointer > scanResults; - ExtractScanResults(scanResults); - - // Inform about the results - emit q_ptr->availableWlanAps(scanResults); - } - ); - - OstTraceFunctionExit0(WLANQTUTILSSCANAPPRIVATE_RUNL_EXIT); -} - -/*! - Cancels an outstanding request. -*/ - -void WlanQtUtilsScanApPrivate::DoCancel() -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANAPPRIVATE_DOCANCEL_ENTRY); - - mWlanMgmtClient->CancelGetScanResults(); - - OstTraceFunctionExit0(WLANQTUTILSSCANAPPRIVATE_DOCANCEL_EXIT); -} - -/*! - Constructor. - - @param [in,out] wrapper Public implementation class reference. -*/ - -WlanQtUtilsScanApPrivate::WlanQtUtilsScanApPrivate(WlanQtUtilsScan *wrapper) : - CActive(EPriorityStandard), - q_ptr(wrapper), - mWlanMgmtClient(NULL), - mResults(NULL) -{ - OstTraceFunctionEntry0(DUP1_WLANQTUTILSSCANAPPRIVATE_WLANQTUTILSSCANAPPRIVATE_ENTRY); - OstTraceFunctionExit0(DUP1_WLANQTUTILSSCANAPPRIVATE_WLANQTUTILSSCANAPPRIVATE_EXIT); -} - -/*! - Second phase constructor. -*/ - -void WlanQtUtilsScanApPrivate::ConstructL() -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANAPPRIVATE_CONSTRUCTL_ENTRY); - - CActiveScheduler::Add(this); - mWlanMgmtClient = CWlanMgmtClient::NewL(); - mResults = CWlanScanInfo::NewL(); - - OstTraceFunctionExit0(WLANQTUTILSSCANAPPRIVATE_CONSTRUCTL_EXIT); -} - -/* - Extracts scan results and stores them into the given AP list. - - @param [out] scanResults Scan result list. -*/ - -void WlanQtUtilsScanApPrivate::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); - ap->setValue(WlanQtUtilsAp::ConfIdWlanScanSSID, 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 WlanQtUtilsScanApPrivate::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, - WLANQTUTILSSCANAPPRIVATE_EXTRACTSSID_DATA, - "WlanQtUtilsScanApPrivate::ExtractSsid data 0x%{hex8[]}", - ieData, - ieLen); - - // The IEEE 802.11-2007 section 7.3.2.1 only specifies that - // the SSID is 0-32 octets, leaving the format of the octets - // completely open. - // To support a bit wider character set than 7-bit ASCII, we - // treat the raw SSID bytes as the lowest octets of Unicode. - for (int i = 0; i < ieLen; i++) { - ssid.append(QChar((uint)ieData[i])); - } - -#ifdef OST_TRACE_COMPILER_IN_USE - TPtrC16 string(ssid.utf16(), ssid.length()); - OstTraceExt1( - TRACE_DUMP, - WLANQTUTILSSCANAPPRIVATE_EXTRACTSSID_STRING, - "WlanQtUtilsScanApPrivate::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 WlanQtUtilsScanApPrivate::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, - WLANQTUTILSSCANAPPRIVATE_EXTRACTBSSID, - "WlanQtUtilsScanApPrivate::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 WlanQtUtilsScanApPrivate::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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsscaniap_symbian.cpp --- a/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsscaniap_symbian.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,226 +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 "Eclipse Public License v1.0" -* which accompanies 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 IAP scanning. -*/ - -// System includes - -#include -#include - -// User includes - -#include "wlanqtutils.h" -#include "wlanqtutilsiap.h" -#include "wlanqtutilsscan.h" -#include "wlanqtutilsscaniap_symbian.h" - -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlanqtutilsscaniap_symbianTraces.h" -#endif - - -/*! - \class WlanQtUtilsScanIapPrivate - \brief Symbian platform specific implementation of WLAN IAP scanning. - - Symbian platform specific implementation of WLAN IAP scanning. -*/ - - -// External function prototypes - -// Local constants - -// ======== LOCAL FUNCTIONS ======== - -// ======== MEMBER FUNCTIONS ======== - -/*! - Static factory constructor. - - @param [in,out] wrapper Public implementation class reference. - - @return New instance of the class. -*/ - -WlanQtUtilsScanIapPrivate *WlanQtUtilsScanIapPrivate::NewL(WlanQtUtilsScan *wrapper) -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANIAPPRIVATE_NEWL_ENTRY); - - WlanQtUtilsScanIapPrivate *self = new (ELeave) WlanQtUtilsScanIapPrivate(wrapper); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - - OstTraceFunctionExit0(WLANQTUTILSSCANIAPPRIVATE_NEWL_EXIT); - return self; -} - -/*! - Destructor. -*/ - -WlanQtUtilsScanIapPrivate::~WlanQtUtilsScanIapPrivate() -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANIAPPRIVATE_WLANQTUTILSSCANIAPPRIVATE_ENTRY); - - Cancel(); - delete mWlanMgmtClient; - mWlanMgmtClient = NULL; - mAvailableIaps.Close(); - - OstTraceFunctionExit0(WLANQTUTILSSCANIAPPRIVATE_WLANQTUTILSSCANIAPPRIVATE_EXIT); -} - -/*! - Starts a scan to see currently available WLAN IAPs. -*/ - -void WlanQtUtilsScanIapPrivate::ScanIaps() -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANIAPPRIVATE_SCANIAPS_ENTRY); - - // Scanning while previous scan is not complete is not supported - Q_ASSERT(!IsActive()); - - // Make the scan - mAvailableIaps.Reset(); - mWlanMgmtClient->GetAvailableIaps( - mCacheLifetime, - mMaxDelay, - EFalse, - iStatus, - mAvailableIaps); - SetActive(); - - OstTraceFunctionExit0(WLANQTUTILSSCANIAPPRIVATE_SCANIAPS_EXIT); -} - -/*! - Stops an ongoing scan. -*/ - -void WlanQtUtilsScanIapPrivate::StopScan() -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANIAPPRIVATE_STOPSCAN_ENTRY); - - Cancel(); - - OstTraceFunctionExit0(WLANQTUTILSSCANIAPPRIVATE_STOPSCAN_EXIT); -} - -/*! - Scan results handler. -*/ - -void WlanQtUtilsScanIapPrivate::RunL() -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANIAPPRIVATE_RUNL_ENTRY); - - QT_TRYCATCH_LEAVING( - if (iStatus != KErrNone) { - // Scan failed - emit q_ptr->scanFailed(WlanQtUtils::ScanStatusError); - } else { - // Scan succeeded - QList< QSharedPointer > scanResults; - ExtractScanResults(scanResults); - - // Inform about the results - emit q_ptr->availableWlanIaps(scanResults); - } - ); - - OstTraceFunctionExit0(WLANQTUTILSSCANIAPPRIVATE_RUNL_EXIT); -} - -/*! - Cancels an outstanding request. -*/ - -void WlanQtUtilsScanIapPrivate::DoCancel() -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANIAPPRIVATE_DOCANCEL_ENTRY); - - mWlanMgmtClient->CancelGetAvailableIaps(); - - OstTraceFunctionExit0(WLANQTUTILSSCANIAPPRIVATE_DOCANCEL_EXIT); -} - -/*! - Constructor. - - @param [in,out] wrapper Public implementation class reference. -*/ - -WlanQtUtilsScanIapPrivate::WlanQtUtilsScanIapPrivate(WlanQtUtilsScan *wrapper) : - CActive(EPriorityStandard), - q_ptr(wrapper), - mWlanMgmtClient(NULL), - mCacheLifetime(0), - mMaxDelay(0), - mAvailableIaps() -{ - OstTraceFunctionEntry0(DUP1_WLANQTUTILSSCANIAPPRIVATE_WLANQTUTILSSCANIAPPRIVATE_ENTRY); - OstTraceFunctionExit0(DUP1_WLANQTUTILSSCANIAPPRIVATE_WLANQTUTILSSCANIAPPRIVATE_EXIT); -} - -/*! - Second phase constructor. -*/ - -void WlanQtUtilsScanIapPrivate::ConstructL() -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANIAPPRIVATE_CONSTRUCTL_ENTRY); - - CActiveScheduler::Add(this); - mWlanMgmtClient = CWlanMgmtClient::NewL(); - - OstTraceFunctionExit0(WLANQTUTILSSCANIAPPRIVATE_CONSTRUCTL_EXIT); -} - -/* - Extracts scan results and stores them into the given AP list. - - @param [out] scanResults Scan result list. -*/ - -void WlanQtUtilsScanIapPrivate::ExtractScanResults( - QList< QSharedPointer > &scanResults) -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANIAPPRIVATE_EXTRACTSCANRESULTS_ENTRY); - - for (int i=0; i < mAvailableIaps.Count(); i++) { - // Create an IAP for each result - QSharedPointer iap(new WlanQtUtilsIap()); - - // IAP ID - iap->setValue( - WlanQtUtilsIap::ConfIdIapId, - (int)mAvailableIaps[i].iIapId); - - // Signal strength - iap->setValue( - WlanQtUtilsIap::ConfIdSignalStrength, - (int)mAvailableIaps[i].iRssi); - - // Append the IAP to scan result list - scanResults.append(iap); - } - - OstTraceFunctionExit0(WLANQTUTILSSCANIAPPRIVATE_EXTRACTSCANRESULTS_EXIT); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/bwinscw/wlansettingsuiu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/bwinscw/wlansettingsuiu.def Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,6 @@ +EXPORTS + ??1CWlanSettingsUi@@UAE@XZ @ 1 NONAME ; CWlanSettingsUi::~CWlanSettingsUi(void) + ?NewL@CWlanSettingsUi@@SAPAV1@AAVCEikonEnv@@@Z @ 2 NONAME ; class CWlanSettingsUi * CWlanSettingsUi::NewL(class CEikonEnv &) + ?RunSettingsL@CWlanSettingsUi@@QAEXPAVCMDBSession@CommsDat@@@Z @ 3 NONAME ; void CWlanSettingsUi::RunSettingsL(class CommsDat::CMDBSession *) + ?RunSettingsL@CWlanSettingsUi@@QAEXXZ @ 4 NONAME ; void CWlanSettingsUi::RunSettingsL(void) + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/data/wlansettingsui.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/data/wlansettingsui.rss Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,319 @@ +/* +* 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: +* Resource file for wlansettingsui +* +*/ + + +// RESOURCE IDENTIFIER +NAME PWLC // 4 letter ID + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include + +#include "wlansettingsui.hrh" +#include + +// CONSTANTS + +// RESOURCE DEFINITIONS + +//---------------------------------------------------- +// +// +// Needed or loading the resource fails! +// +//---------------------------------------------------- +// +RESOURCE RSS_SIGNATURE + { + } + +RESOURCE TBUF { buf="wlansettingsui"; } + + +//---------------------------------------------------- +// +// r_qtn_err_os_general +// General error message. +// +//---------------------------------------------------- +// +RESOURCE TBUF r_qtn_err_os_general { buf = qtn_err_os_general ; } + +RESOURCE TBUF + { + buf = "wlan"; + } + +RESOURCE TBUF r_wlan_sett_bg_scan_auto + { + buf = qtn_wlan_sett_bg_scan_auto; + } + +RESOURCE TBUF r_wlan_sett_bg_scan_1_min + { + buf = qtn_wlan_sett_bg_scan_1_min; + } + +RESOURCE TBUF r_wlan_sett_bg_scan_x_min + { + buf = qtn_wlan_sett_bg_scan_x_min; + } + +RESOURCE TBUF r_wlan_prmpt_bg_scan_interval + { + buf = qtn_wlan_prmpt_bg_scan_interval; + } + +RESOURCE TBUF r_wlan_settings_ui_title + { + buf = qtn_wlan_main_title; + } + +RESOURCE MENU_BAR r_wlan_settings_ui_main_view_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = r_wlan_settings_ui_main_view_menu; + } + }; + } + +RESOURCE MENU_PANE r_wlan_settings_ui_main_view_menu + { + items = + { + MENU_ITEM + { + command = EWlanSettingsUiCmdChange; + txt = qtn_options_change; + flags = EEikMenuItemAction; + }, + MENU_ITEM + { + command = EAknCmdHelp; + txt = qtn_options_help; + }, + MENU_ITEM + { + command = EAknCmdExit; + txt = qtn_options_exit; + } + }; + } + +//---------------------------------------------------- +// +// r_wlan_settings_ui_main_view_buttons +// +//---------------------------------------------------- +// +RESOURCE CBA r_wlan_settings_ui_main_view_buttons + { + buttons = + { + CBA_BUTTON {id=EAknSoftkeyOptions; txt=text_softkey_option;}, + CBA_BUTTON {id=EAknSoftkeyBack; txt=text_softkey_back;}, + CBA_BUTTON {id=EAknSoftkeyChange; txt=qtn_msk_change;} + }; + } + +RESOURCE DIALOG r_wlan_settings_ui_main_view_dialog + { + flags = EEikDialogFlagNoDrag | EEikDialogFlagFillAppClientRect | + EEikDialogFlagNoTitleBar |EEikDialogFlagButtonsRight | + EEikDialogFlagCbaButtons | EEikDialogFlagNoBorder | + EEikDialogFlagWait; + title = qtn_wlan_main_title; + buttons = r_wlan_settings_ui_main_view_buttons; + items = + { + DLG_LINE + { + type = EWlanSettingsUiSettingItemList; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + id = EWlanSettingsUiDlgSettingList; + control = AVKON_SETTING_ITEM_LIST + { + title = ""; + initial_number = EWlanSettingsUiItemListInitialNumber; + items = + { + AVKON_SETTING_ITEM + { + identifier = EWlanSettingsUiSettingShowWlanAvail; + setting_page_resource = + r_wlan_settings_ui_show_wlan_avail_setting_page; + name = qtn_wlan_sett_show_wlan_avail; + associated_resource = + r_wlan_settings_ui_show_wlan_avail_values; + }, + AVKON_SETTING_ITEM + { + identifier = EWlanSettingsUiSettingScanNetworks; + setting_page_resource = + r_wlan_settings_ui_scan_networks_setting_page; + name = qtn_wlan_sett_bg_scan_interval; + associated_resource = + r_wlan_settings_ui_scan_network_values; + }, + AVKON_SETTING_ITEM + { + identifier = EWlanSettingsUiSettingPowerSaving; + setting_page_resource = + r_wlan_settings_ui_power_saving_setting_page; + name = qtn_wlan_sett_power_saving; + associated_resource = + r_wlan_settings_ui_power_saving_values; + } + }; + }; + } + }; + } + +RESOURCE AVKON_SETTING_PAGE r_wlan_settings_ui_show_wlan_avail_setting_page + { + label= qtn_wlan_sett_show_wlan_avail; + softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + type = EAknCtPopupSettingList; + editor_resource_id = r_wlan_settings_ui_selection_popup_listbox; + } + +RESOURCE AVKON_POPUP_SETTING_TEXTS r_wlan_settings_ui_show_wlan_avail_values + { + setting_texts_resource = r_wlan_settings_ui_show_wlan_avail_value_array; + } + +RESOURCE ARRAY r_wlan_settings_ui_show_wlan_avail_value_array + { + items = + { + AVKON_ENUMERATED_TEXT + { + value = 0; + text = qtn_wlan_sett_bg_scan_never; + }, + AVKON_ENUMERATED_TEXT + { + value = 1; + text = qtn_wlan_sett_bg_scan_enabled; + } + }; + } + +RESOURCE AVKON_SETTING_PAGE r_wlan_settings_ui_scan_networks_setting_page + { + label = qtn_wlan_sett_bg_scan_interval; + softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + type = EAknCtPopupSettingList; + editor_resource_id = r_wlan_settings_ui_selection_popup_listbox; + } + +RESOURCE POPUP_SETTING_LIST r_wlan_settings_ui_selection_popup_listbox + { + flags = 0; + } + +RESOURCE AVKON_POPUP_SETTING_TEXTS r_wlan_settings_ui_scan_network_values + { + flags = 0; + setting_texts_resource = r_wlan_settings_ui_scan_network_values_array; + } + +RESOURCE ARRAY r_wlan_settings_ui_scan_network_values_array + { + items = + { + AVKON_ENUMERATED_TEXT + { + value = EWlanSettingsUiScanNetworkAuto; + text = qtn_wlan_sett_bg_scan_auto; + }, + AVKON_ENUMERATED_TEXT + { + value = EWlanSettingsUiScanNetworkUserDef; + text = qtn_wlan_sett_bg_scan_user_def; + } + }; + } + +RESOURCE AVKON_SETTING_PAGE r_wlan_settings_ui_power_saving_setting_page + { + label= qtn_wlan_sett_power_saving; + softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + type = EAknCtPopupSettingList; + editor_resource_id = r_wlan_settings_ui_selection_popup_listbox; + } + +RESOURCE AVKON_POPUP_SETTING_TEXTS r_wlan_settings_ui_power_saving_values + { + setting_texts_resource = r_wlan_settings_ui_power_saving_value_array; + } + +RESOURCE ARRAY r_wlan_settings_ui_power_saving_value_array + { + items = + { + AVKON_ENUMERATED_TEXT + { + value = 1; + text = qtn_wlan_sett_power_saving_enabled; + }, + AVKON_ENUMERATED_TEXT + { + value = 0; + text = qtn_wlan_sett_power_saving_disabled; + } + }; + } + +RESOURCE DIALOG r_wlan_settings_ui_number_editor_2 + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + items= + { + DLG_LINE + { + type=EAknCtQuery; + id=EGeneralQuery; + control= AVKON_DATA_QUERY + { + layout = ENumberLayout; + control = AVKON_INTEGER_EDWIN + { + maxlength = EWlanSettingsUiDlgMaxLength2; + }; + }; + } + }; + } + +RESOURCE TBUF r_wlan_settings_ui_power_saving_infonote + { + buf = qtn_power_saving_protected_settings_infonote; + } + +//End of File diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/eabi/wlansettingsuiu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/eabi/wlansettingsuiu.def Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,8 @@ +EXPORTS + _ZN15CWlanSettingsUi12RunSettingsLEPN8CommsDat11CMDBSessionE @ 1 NONAME + _ZN15CWlanSettingsUi12RunSettingsLEv @ 2 NONAME + _ZN15CWlanSettingsUi4NewLER9CEikonEnv @ 3 NONAME + _ZN15CWlanSettingsUiD0Ev @ 4 NONAME + _ZN15CWlanSettingsUiD1Ev @ 5 NONAME + _ZN15CWlanSettingsUiD2Ev @ 6 NONAME + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,41 @@ +/* +* 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: Build information for the wlansettingsui +* +*/ + + + +#include + +PRJ_EXPORTS +../inc/wlansettingsui.h |../../inc/wlansettingsui.h + +// export iby files +../rom/wlansettingsui.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wlansettingsui.iby) +../rom/wlansettingsuiresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(wlansettingsuiresources.iby) + +// export localised loc file +../loc/wlansettingsui.loc MW_LAYER_LOC_EXPORT_PATH(wlansettingsui.loc) + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +./wlansettingsui.mmp + +// End of File diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/group/wlansettingsui.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/group/wlansettingsui.mmp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,90 @@ +/* +* 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 project specification file for the wlansettingsui. +* +* +*/ + +#include //this is needed for RESOURCE_FILES_DIR +#include + + +TARGET wlansettingsui.dll +TARGETTYPE DLL +UID 0x1000008d 0x10281BC9 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE wlansettingsui.cpp +SOURCE wlansettingsuiimpl.cpp +SOURCE wlansettingsuimodel.cpp +SOURCE wlansettingsuidlg.cpp +SOURCE wlansettingsuimainviewdlg.cpp +SOURCE wlansettingsuisettingitemlist.cpp +SOURCE wlansettingsuistatuspane.cpp +SOURCE wlansettingsuipanic.cpp +SOURCE wlansettingsuiscanintervalsettingitem.cpp +SOURCE wlansettingsuibinarypopupsettingitem.cpp + +USERINCLUDE ../data + +// Component specific internal headers +USERINCLUDE ../inc + +// ADO-SUBSYSTEM specific internal headers +SYSTEMINCLUDE ../../inc + +// ADO specific internal headers +SYSTEMINCLUDE ../../../inc + +//Macro to /epoc32 headers +APP_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../data + +//wlansettingsui resources +START RESOURCE wlansettingsui.rss +HEADER +TARGETPATH RESOURCE_FILES_DIR +LANGUAGE_IDS +END//wlansettingsui resources + +LIBRARY hlplch.lib +LIBRARY euser.lib +LIBRARY avkon.lib +LIBRARY eikdlg.lib +LIBRARY FeatMgr.lib +LIBRARY bafl.lib +LIBRARY cone.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY aknlayout.lib +LIBRARY centralrepository.lib +LIBRARY COMMSDAT.lib +LIBRARY cmmanagerdatabase.lib +LIBRARY commonengine.lib +LIBRARY ecom.lib +LIBRARY efsrv.lib + + + +#if defined(ARMCC) + DEFFILE ../eabi/wlansettingsui.def +#elif defined( WINSCW ) + DEFFILE ../bwinscw/wlansettingsui.def +#endif + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/inc/wlansettingsui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsui.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 class CWlanSettingsUi. +* +* +*/ + + +#ifndef WLAN_SETTINGS_UI_H +#define WLAN_SETTINGS_UI_H + +// INCLUDES + +#include +#include + +// FORWARD DECLARATIONS + +class CEikonEnv; +class CWlanSettingsUiImpl; + +// CLASS DECLARATION + +/** +* Public interface of WLAN Settings UI. +* Proxy around the real implementation in CWlanSettingsUiImpl. +*/ +NONSHARABLE_CLASS( CWlanSettingsUi ): public CBase + { + + public: // Constructors and destructor + + /** + * Two-phased constructor. Leaves on failure. + * @param aEikEnv Eikon environment. + * @return The constructed CWlanSettingsUi object. + */ + IMPORT_C static CWlanSettingsUi* NewL( CEikonEnv& aEikEnv ); + + /** + * Destructor. + */ + IMPORT_C virtual ~CWlanSettingsUi(); + + public: // New methods + + /** + * Launch WLAN Settings view. + * @param aSession Commsdat session. + */ + IMPORT_C void RunSettingsL( CMDBSession* aSession ); + + /** + * Launch WLAN Settings view. + * with own session. + */ + IMPORT_C void RunSettingsL(); + + private: // Data + + CWlanSettingsUiImpl* iImpl; ///< Implementation. Owned. + + }; + +#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/inc/wlansettingsui.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsui.hrh Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Constant definitions for resources. +* +* +*/ + + +#ifndef WLAN_SETTINGS_UI_HRH +#define WLAN_SETTINGS_UI_HRH + +#include + +enum TWlanSettingsUiCommands /// Commands. + { + EWlanSettingsUiCmdChange = 5000 ///< "Change" command. + }; + +enum TWlanSettingsUiControlId ///< Control ids. + { + EWlanSettingsUiDlgSettingList = 1 ///< Setting list control id. + }; + +enum TWlanSettingsUiControlType /// Custom control types. + { + /// CWlanSettingsUiSettingItemList control type. + EWlanSettingsUiSettingItemList = KAknCtLastControlId + 1 + }; + +enum TWlanSettingsUiSettingId /// Setting ids. + { + EWlanSettingsUiSettingShowWlanAvail, ///< "Show WLAN avail." sett. id. + EWlanSettingsUiSettingScanNetworks, ///< "Update availability" sett id. + EWlanSettingsUiSettingPowerSaving ///< "Power saving" sett. id. + }; + +enum TWlanSettingsUiScanNetworkValue /// "Scan network" setting values. + { + EWlanSettingsUiScanNetworkAuto = 0, ///< "Scan network" adaptive. + EWlanSettingsUiScanNetworkUserDef ///< "Scan network" user defined. + }; + +/** +* User defined scan interval minimum +*/ +#define EWlanSettingsUiScanNetworkMin 1 + +/** +* User defined scan interval maximum +*/ +#define EWlanSettingsUiScanNetworkMax 30 + +/** +* User defined scan interval maximal length +*/ +#define EWlanSettingsUiScanNetworkMaxLength 2 + +/** +* 2nd dialog line max length +*/ +#define EWlanSettingsUiDlgMaxLength2 2 + +/** +* For initializing avkon settings items +*/ +#define EWlanSettingsUiItemListInitialNumber 3 + +#define EWlanSettingsUiEdwinUnsetValue -1 + +#endif + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/inc/wlansettingsuibinarypopupsettingitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuibinarypopupsettingitem.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 class CWlanSettingsUiBinaryPopupSettingItem. +* +* +*/ + + +#ifndef WLAN_SETTINGS_UI_BINARY_POPUP_SETTING_ITEM_H +#define WLAN_SETTINGS_UI_BINARY_POPUP_SETTING_ITEM_H + +// INCLUDES + +#include + +// FORWARD DECLARATIONS + +class CWlanSettingsUiBinaryPopupSettingItem; + +// CLASS DECLARATION + +/** +* Interface to observe change in internal value of an +* CAknBinaryPopupSettingItem. +*/ +NONSHARABLE_CLASS( MWlanSettingsUiBinaryPopupSettingObserver ) + { + + public: // New methods + + /** + * Binary setting internal value has changed. + * @param aItem Changed item. + * @param aNewInternalVal New internal value. + */ + virtual void BinarySettingChangedL + ( + CWlanSettingsUiBinaryPopupSettingItem* aItem, + TBool aNewInternalVal + ) = 0; + + }; + +/** +* Binary setting item. +* Added functionality: notifies observer about setting change. +*/ +NONSHARABLE_CLASS( CWlanSettingsUiBinaryPopupSettingItem ) +: public CAknBinaryPopupSettingItem + { + + public: // Constructors + + /** + * Constructor. + * @param aObserver observer reference + * @param aResourceId Resource id. + * @param aValue Value. + */ + CWlanSettingsUiBinaryPopupSettingItem + ( + MWlanSettingsUiBinaryPopupSettingObserver& aObserver, + TInt aResourceId, + TBool& aValue + ); + + private: // From CAknSettingItem & base classes + + /** + * Edit item. + * @param aCalledFromMenu ETrue if called from menu. + */ + void EditItemL( TBool aCalledFromMenu ); + + private: // Data + + MWlanSettingsUiBinaryPopupSettingObserver& iObserver; ///< Observer. + + }; + +#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/inc/wlansettingsuidefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuidefs.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Macro definitions and constants. +* +* +*/ + + +#ifndef WLAN_SETTINGS_UI_DEFS_H +#define WLAN_SETTINGS_UI_DEFS_H + + + +// CONSTANTS + +/// UID of application containing help texts (General Settings). +LOCAL_D const TUid KWlanSettingsUiHelpMajor = { 0x100058EC }; + +#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/inc/wlansettingsuidlg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuidlg.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 class CWlanSettingsUiDlg. +* +* +*/ + + +#ifndef WLAN_SETTINGS_UI_DLG_H +#define WLAN_SETTINGS_UI_DLG_H + +// INCLUDES + +#include + +// FORWARD DECLARATIONS + +class CWlanSettingsUiSettingItemList; +class CWlanSettingsUiModel; + +// CLASS DECLARATION + +/** +* WLAN settings dialog base. +*/ +NONSHARABLE_CLASS( CWlanSettingsUiDlg ): public CAknDialog + { + + protected: // Constructors + + /** + * Constructor. + * @param aModel Data model. + */ + inline CWlanSettingsUiDlg( CWlanSettingsUiModel* aModel ); + + public: // New methods + + /** + * Construct and execute the dialog. + * @return ETrue if dialog was accepted. + */ + virtual TInt ExecuteLD(); + + protected: // From CAknDialog & its base classes + + /** + * Create custom control. + * @param aControlType Control type. + * @return Control info. + */ + SEikControlInfo CreateCustomControlL( TInt aControlType ); + + /** + * Process command. + * @param aCommandId Command id. + */ + void ProcessCommandL( TInt aCommandId ); + + /** + * From @c CEikDialog. + * + * Handles a dialog button press for the specified button. + * + * This function is invoked when the user presses a button in the + * button panel. It is not called if the Cancel button is activated + * unless the @c EEikDialogFlagNotifyEsc flag has been set. + * + * + * @param aButtonId The ID of the button that was activated. + * @return @c ETrue to validate and exit the dialog, + * @c EFalse to keep the dialog active. If @c ETrue, the + * dialog will be destroyed automatically by @c ExecuteLD(). + * The default implementation returns @c ETrue no matter which + * button is pressed. + */ + TBool OkToExitL(TInt aButtonId); + + protected: // New methods + + /** + * Get the setting item list inside. + */ + CWlanSettingsUiSettingItemList& SettingItemList() const; + + /** + * Get menu bar resource id. + * @return Menu bar resource id. + */ + virtual TInt MenuBarResourceId() const = 0; + + /** + * Get dialog resource id. + * @return Dialog resource id. + */ + virtual TInt DialogResourceId() const = 0; + + /** + * Check if Help is supported on the phone or not, querying the + * KFeatureIdHelp feature flag. + * + * @return True If Help is supported, + * False If Help is not supported. + */ + static TBool IsHelpSupported(); + + protected: // Data + + CWlanSettingsUiModel* iModel; ///< Data model. + + }; + +#include "wlansettingsuidlg.inl" + +#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/inc/wlansettingsuidlg.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuidlg.inl Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWlanSettingsUiDlg. +* +* +*/ + + +#ifndef WLAN_SETTINGS_UI_DLG_INL +#define WLAN_SETTINGS_UI_DLG_INL + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CWlanSettingsUiDlg::CWlanSettingsUiDlg +// --------------------------------------------------------- +// +CWlanSettingsUiDlg::CWlanSettingsUiDlg( CWlanSettingsUiModel* aModel ) +: CAknDialog(), + iModel( aModel ) + { + } + +#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/inc/wlansettingsuiimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuiimpl.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 class CWlanSettingsUiImpl. +* +* +*/ + + +#ifndef WLAN_SETTINGS_UI_IMPL_H +#define WLAN_SETTINGS_UI_IMPL_H + +// INCLUDES + +#include +#include +#include + + +// FORWARD DECLARATIONS + +class CEikonEnv; +class CWlanSettingsUiImplImpl; +class CWlanMgmtClient; +class CRepository; + +// CLASS DECLARATION + +/** +* WLAN Settings UI implementation (behind proxy class CWlanSettingsUi): +* entry points for WLAN Settign UI functionality. +*/ +NONSHARABLE_CLASS( CWlanSettingsUiImpl ): public CBase + { + + public: // Constructors and destructor + + /** + * Two-phased constructor. Leaves on failure. + * @param aEikEnv Eikon environment. + * @return The constructed CWlanSettingsUiImpl object. + */ + static CWlanSettingsUiImpl* NewL( CEikonEnv& aEikEnv ); + + /** + * Destructor. + */ + virtual ~CWlanSettingsUiImpl(); + + protected: // Constructors + + /** + * Constructor. + * @param aEikEnv Eikon environment. + */ + CWlanSettingsUiImpl( CEikonEnv& aEikEnv ); + + /** + * Second-phase constructor. + */ + void ConstructL(); + + public: // New methods + + /** + * Launch General WLAN Settings view. + * @param aCommsDb Comms database. + */ + void RunSettingsL( CMDBSession* aSession ); + + private: // Data + + /* + * Eikon environment. Not owned. + */ + CEikonEnv* iEikEnv; + + /* + * @var resource loader + */ + RConeResourceLoader iResources; + + /* + * Wlan management + */ + CWlanMgmtClient* iWlanMgmtClient; + + /* + * Centeral Repository + */ + CRepository* iRepository; + + }; + +#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/inc/wlansettingsuimainviewdlg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuimainviewdlg.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 class CWlanSettingsUiMainViewDlg. +* +* +*/ + + +#ifndef WLAN_SETTINGS_UI_MAIN_VIEW_DLG_H +#define WLAN_SETTINGS_UI_MAIN_VIEW_DLG_H + +// INCLUDES + +#include "wlansettingsuidlg.h" +#include + +// CLASS DECLARATION + +/** +* WLAN settings main view dialog. +*/ +NONSHARABLE_CLASS( CWlanSettingsUiMainViewDlg ): public CWlanSettingsUiDlg + { + + public: // Constructors + + /** + * Constructor. + * @param aModel Data model. + */ + inline CWlanSettingsUiMainViewDlg( CWlanSettingsUiModel* aModel ); + + private: // From CWlanSettingsUiDlg + + /** + * Get menu bar resource id. + * @return Menu bar resource id. + */ + inline TInt MenuBarResourceId() const; + + /** + * Get dialog resource id. + * @return Dialog resource id. + */ + inline TInt DialogResourceId() const; + + void FocusChanged(TDrawNow aDrawNow); + + + + private: // From CAknDialog & its base classes + + /** + * Get help context. + * @param aContext Help context is returned here. + */ + void GetHelpContext( TCoeHelpContext& aContext ) const; + + /** + * Initialize menu pane. + * @param aResourceId Menu pane resource id. + * @param CEikMenuPane Menu pane. + */ + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + + /** + * Process command. + * @param aCommandId Command id. + */ + void ProcessCommandL( TInt aCommandId ); + + }; + +#include "wlansettingsuimainviewdlg.inl" + +#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/inc/wlansettingsuimainviewdlg.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuimainviewdlg.inl Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWlanSettingsUiMainViewDlg. +* +* +*/ + + +#ifndef WLAN_SETTINGS_UI_MAIN_VIEW_DLG_INL +#define WLAN_SETTINGS_UI_MAIN_VIEW_DLG_INL + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CWlanSettingsUiMainViewDlg::CWlanSettingsUiMainViewDlg +// --------------------------------------------------------- +// +CWlanSettingsUiMainViewDlg::CWlanSettingsUiMainViewDlg +( CWlanSettingsUiModel* aModel ) +: CWlanSettingsUiDlg( aModel ) + { + } + +// --------------------------------------------------------- +// CWlanSettingsUiMainViewDlg::MenuBarResourceId +// --------------------------------------------------------- +// +TInt CWlanSettingsUiMainViewDlg::MenuBarResourceId() const + { + return R_WLAN_SETTINGS_UI_MAIN_VIEW_MENUBAR; + } + +// --------------------------------------------------------- +// CWlanSettingsUiMainViewDlg::DialogResourceId +// --------------------------------------------------------- +// +TInt CWlanSettingsUiMainViewDlg::DialogResourceId() const + { + return R_WLAN_SETTINGS_UI_MAIN_VIEW_DIALOG; + } + +#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/inc/wlansettingsuimodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuimodel.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,238 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 class CWlanSettingsUiModel. +* +* +*/ + + +#ifndef WLAN_SETTINGS_UI_MODEL_H +#define WLAN_SETTINGS_UI_MODEL_H + +// INCLUDES + +#include +#include "wlansettingsui.hrh" +#include + + +// CONSTANTS + +/** + * Default "Show WLAN Availability" setting. + */ +LOCAL_D const TBool KWlanSettingsUiDefaultShowWlanAvail = EFalse; + +/** + * Value for scanning setting off. + */ +LOCAL_D const TUint KWlanSettingsUiScanNetworkNever = 0; + +/** + * Value for automatic scanning. + */ +LOCAL_D const TUint KWlanSettingsUiScanNetworkAuto = 0xFFFFFFFF; + +/** + * Default user-defined scan interval (5 minutes). + */ +LOCAL_D const TUint KWlanSettingsUiDefaultUserDefScanInterval = 5; + +/** + * Default "Scan Networks" setting. + */ +LOCAL_D const TUint KWlanSettingsUiDefaultScanNetwork = + KWlanSettingsUiScanNetworkAuto; + +/** + * Default "Power saving" setting. + */ +LOCAL_D const TBool KWlanSettingsUiDefaultPowerSaving = ETrue; + +// FORWARD DECLARATIONS + +class CWlanMgmtClient; +class CRepository; + +// CLASS DECLARATION + +/** +* Data model for WLAN Settings UI. +*/ +NONSHARABLE_CLASS( CWlanSettingsUiModel ) : public CBase + { + + public: // Constructors and destructor + + /** + * Destructor + */ + ~CWlanSettingsUiModel(); + + public: // Types + + enum TSettingType ///< Setting type. + { + EDefaultSettings, ///< Default settings. + EUserSettings ///< User settings. + }; + + public: // New methods + + + /** + * First phase of two phase construction + * @param - + * @return returns an instance + */ + static CWlanSettingsUiModel* NewL + ( + CMDBSession* aSession, + CWlanMgmtClient* aWlanMgmtClient, + CRepository* aRepository + ); + + /** + * Load settings from comms database. + */ + void LoadSettingsL(); + + /** + * Save settings to comms database. + */ + void SaveSettingsL(); + + /** + * Checks from CenRep if the PowerSave Mode is on (full or partial) + */ + void CheckPsmModeL(); + + + public: + //getters and setters + + /** + * Gets if Wlan availablity is shown. + * @return Returns wlan availablity. + */ + inline TBool ShowWlanAvail(); + + /** + * Gets scan networks mode. Returns 0 for no scan, 0xFFFFFFFF for + * automatic scan or user-defined scan time in minutes. + * @return Scan networks mode. + */ + TUint ScanNetworks(); + + /** + * Gets if power saving mode is enabled. + * @return Returns if power saving mode is enabled. + */ + inline TBool PowerSaving(); + + /** + * Sets the value of iShowWlanAvail. + * @param aShowWlanAvail The set value. + */ + inline void SetShowWlanAvail( TBool aShowWlanAvail ); + + /** + * Sets the value of iScanNetworks. 0 for no scan, 0xFFFFFFFF for + * automatic scan or user-defined scan time in minutes. + * @param aScanNetworks The set value. + */ + void SetScanNetworks( TUint aScanNetworks ); + + /** + * Sets the value of iPowerSaving. + * @param aPowerSaving The set value. + */ + inline void SetPowerSaving( TBool aPowerSaving ); + + /** + * Gets if user selectable power save mode is enabled. + * @return Returns ETrue/EFalse according to if PSM mode is enabled. + */ + inline TBool PsmModeOn(); + + + private: // New methods + + /** + * Constructor. + * @param aSession CommsDat session. + * @param aWlanMgmtClient Wlan management client. + * @param aRepository Centeral repository. + */ + CWlanSettingsUiModel + ( + CMDBSession* aSession, + CWlanMgmtClient* aWlanMgmtClient, + CRepository* aRepository + ); + + /** + * Second phase of two phase construction + */ + void ConstructL(); + + /** + * Fix "Scan networks" value: make sure that the numeric value is + * valid. Ensures fault tolerant behaviour if commsdb contains + * invalid value. + * @param TUint aSavedScanInternal The saved value of scan interval. + */ + void FixScanNetworks( TUint aSavedScanInternal ); + + /** + * Scan interval is stored in seconds in the database but the UI + * handles only 1-30 minutes. Method ensures that scan interval is + * 0, 1-30 minutes or automatic (0xFFFFFFFF). + * Ensures fault tolerant behaviour if commsdb contains invalid value. + * @param TUint aScanInterval this value will be converted. + * @return TUint the converted value. + */ + TUint FixScanInterval(TUint aScanInterval); + + private: + + /// Show WLAN availability. + TBool iShowWlanAvail; + /// Scan networks interval in seconds. 0 for no scan, 0xFFFFFFFF for automatic. + TUint iScanNetworks; + /// Power saving. + TBool iPowerSaving; + /// Full or partial PSM mode. + TBool iPsmMode; + + /// Comms database. + CMDBSession* iSession; + + // WLAN Management client + CWlanMgmtClient* iWlanMgmtClient; // not owned + + /** + * Central repository member + */ + CRepository* iRepository; // not owned + + // Power Save Mode Feature + TBool iPsmSupported; + + }; + +#include "wlansettingsuimodel.inl" + +#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/inc/wlansettingsuimodel.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuimodel.inl Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWlanSettingsUiModel. +* +* +*/ + + +#ifndef WLAN_SETTINGS_UI_MODEL_INL +#define WLAN_SETTINGS_UI_MODEL_INL + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CWlanSettingsUiModel::ShowWlanAvail +// --------------------------------------------------------- +// +TBool CWlanSettingsUiModel::ShowWlanAvail() + { + return iShowWlanAvail; + } + +// --------------------------------------------------------- +// CWlanSettingsUiModel::PowerSaving +// --------------------------------------------------------- +// +TBool CWlanSettingsUiModel::PowerSaving() + { + return iPowerSaving; + } + +// --------------------------------------------------------- +// CWlanSettingsUiModel::SetShowWlanAvail +// --------------------------------------------------------- +// +void CWlanSettingsUiModel::SetShowWlanAvail( TBool aShowWlanAvail ) + { + iShowWlanAvail = aShowWlanAvail; + } + +// --------------------------------------------------------- +// CWlanSettingsUiModel::SetPowerSaving +// --------------------------------------------------------- +// +void CWlanSettingsUiModel::SetPowerSaving( TBool aPowerSaving ) + { + iPowerSaving = aPowerSaving; + } + +// --------------------------------------------------------- +// CWlanSettingsUiModel::PsmModeOn +// --------------------------------------------------------- +// +TBool CWlanSettingsUiModel::PsmModeOn() + { + return iPsmMode; + } + +#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/inc/wlansettingsuipanic.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuipanic.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Panic function and codes. +* +* +*/ + + +#ifndef WLAN_SETTINGS_UI_PANIC_H +#define WLAN_SETTINGS_UI_PANIC_H + +// TYPES + +/** +* Panic reasons for WLAN Settings UI. +*/ +enum TWlanSettingsUiPanicReason + { + EWlanSettingsUiBadSetting, ///< Bad setting. + EWlanSettingsUiBadControl, ///< Bad control. + EWlanSettingsUiTransactionUnderflow ///< Transaction begin/commit mismatch. + }; + +// FUNCTION DECLARATIONS + +/** +* Panic the thread. +* @param aReason Reason for the panic. +*/ +void WlanSettingsUiPanic( TWlanSettingsUiPanicReason aReason ); + +#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/inc/wlansettingsuiscanintervalsettingitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuiscanintervalsettingitem.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,94 @@ +/* +* 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: Declaration of class CWlanSettingsUiScanIntervalSettingItem. +* +*/ + + +#ifndef __WLAN_SETTINGS_UI_SCAN_INTERVAL_SETTING_ITEM_H__ +#define __WLAN_SETTINGS_UI_SCAN_INTERVAL_SETTING_ITEM_H__ + +// System includes +#include + + +/** + * Specialized version of CAknEnumeratedTextPopupSettingItem class. + * + * @lib wlansettingsui.lib + * @since S60 v5.2 + */ +NONSHARABLE_CLASS(CWlanSettingsUiScanIntervalSettingItem) : + public CAknEnumeratedTextPopupSettingItem + { + public: + + /** + * Constructor + * @param aResourceId Resource id for the parent class + * @param aValue Value for the parent class + */ + CWlanSettingsUiScanIntervalSettingItem( + TInt aResourceId, TInt &aListValue, TInt& aValue, + CWlanSettingsUiModel* aModel ); + + /** + * Destructor. + */ + virtual ~CWlanSettingsUiScanIntervalSettingItem(); + + /** + * From CAknEnumeratedTextPopupSettingItem + * @return Setting item text (current value). + */ + const TDesC& SettingTextL(); + + /** + * From CAknEnumeratedTextPopupSettingItem + * @param aCalledFromMenu Ignored in this class. + */ + void EditItemL( TBool aCalledFromMenu ); + + /** + * From CAknSettingItem + * @param aSettingPage Pointer to setting page which has caused this callback. + * @param aEventType Occurred setting page event type. + */ + void HandleSettingPageEventL( CAknSettingPage* aSettingPage, + TAknSettingPageEvent aEventType ); + + private: + + /** + * Displays scan interval query + */ + TBool ShowScanIntervalQueryL(); + + /** + * Shows an information note if user tries to select a non-allowed + * value during full or partial PowerSave Mode. + */ + void ShowPowerSavingInfoNoteL(); + + private: // Data + + CWlanSettingsUiModel* iModel; + RBuf iSettingText; + TInt& iValue; + CEikonEnv* iEnv; + TBool iRevertBackToAutomaticScan; + }; + +#endif // __WLAN_SETTINGS_UI_SCAN_INTERVAL_SETTING_ITEM_H__ +//End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/inc/wlansettingsuisettingitemlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuisettingitemlist.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,144 @@ +/* +* Copyright (c) 2004-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 class CWlanSettingsUiSettingItemList. +* +* +*/ + + +#ifndef WLAN_SETTINGS_UI_SETTING_ITEM_LIST_H +#define WLAN_SETTINGS_UI_SETTING_ITEM_LIST_H + +// INCLUDES + +#include +#include "wlansettingsuibinarypopupsettingitem.h" + +// CLASS DECLARATION +class CWlanSettingsUiModel; + +/** +* WLAN settings item list. +* Added functionality: +* - Creates proper type setting items, based on setting id. +*/ +NONSHARABLE_CLASS( CWlanSettingsUiSettingItemList ) +: public CAknSettingItemList, + public MWlanSettingsUiBinaryPopupSettingObserver + { + + public: // Constructors + + /** + * Constructor. + * @param aModel Data model. + */ + inline CWlanSettingsUiSettingItemList + ( CWlanSettingsUiModel* aModel ); + + public: // New methods + + /** + * Edit current item. + * @param aCalledFromMenu ETrue if called from menu. + */ + void EditCurrentItemL( TBool aCalledFromMenu ); + + public: // From CAknSettingItemList & base classes + + /** + * Activate. + */ + void ActivateL(); + + /** + * Load settings. + */ + void LoadSettingsL(); + + /** + * Handle resource change + * @param aType message UID value + */ + void HandleResourceChange( TInt aType ); + + /** + * Launches the setting page for the current item by calling + * EditItemL on it + * @param aIndex Current item's (Visible) index in the list + * @param aCalledFromMenu Ignored in most classes; may alter + * the behaviour of the setting page + */ + void EditItemL( TInt aIndex, TBool aCalledFromMenu ); + + /** + * Create setting item. + * @param aSettingId Setting id. + * @return Setting item. + */ + CAknSettingItem* CreateSettingItemL( TInt aSettingId ); + + /** + * Set view (hide / show items as appropriate). + */ + void RefreshViewL(); + + private: // From MWlanSettingsUiBinaryPopupSettingObserver + + /** + * Binary setting internal value has changed. + * @param aItem Changed item. + * @param aNewInternalVal New internal value. + */ + void BinarySettingChangedL + ( + CWlanSettingsUiBinaryPopupSettingItem* aItem, + TBool aNewInternalVal + ); + + private: // New methods + + /** + * Sets the drawing rectangle for the listbox. + */ + void SetListBoxRect(); + + + private: // Data + + CWlanSettingsUiModel* iModel;///< Data model. + + TBool iShowWlanAvail; ///< Show WLAN availablility on/off + + ///< Scan networks mode selection (automatic/user-defined) + TInt iScanMode; + + ///< User selected scan interval needs to be checked if in PSM mode + TInt iScanInterval; + + TInt iPowerSaving; + + // Old scan networks value is reverted back if + // user turns PSM mode on and then off in settings UI + TBool iChangeScanNetworksValueBack; + + // Back up for the scan networks value + TUint iScanNetworksBackUp; + + }; + +#include "wlansettingsuisettingitemlist.inl" + +#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/inc/wlansettingsuisettingitemlist.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuisettingitemlist.inl Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWlanSettingsUiSettingItemList. +* +* +*/ + + +#ifndef WLAN_SETTINGS_UI_SETTING_ITEM_LIST_INL +#define WLAN_SETTINGS_UI_SETTING_ITEM_LIST_INL + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CWlanSettingsUiSettingItemList::CWlanSettingsUiSettingItemList +// --------------------------------------------------------- +// +CWlanSettingsUiSettingItemList::CWlanSettingsUiSettingItemList( + CWlanSettingsUiModel* aModel ) +: iModel( aModel ) + { + } + +#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/inc/wlansettingsuistatuspane.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuistatuspane.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 class CWlanSettingsUiStatusPane. +* +* +*/ + + +#ifndef WLAN_SETTINGS_UI_STATUS_PANE_H +#define WLAN_SETTINGS_UI_STATUS_PANE_H + +// INCLUDES + +#include + +// FORWARD DECLARATION + +class CEikonEnv; +class CEikStatusPane; +class CAknTitlePane; +class CAknNavigationControlContainer; +class CAknNavigationDecorator; + +// CLASS DECLARATION + +/** +* Status pane setter class. Replaces status pane text on construction, +* restores old text on deletion. +*/ +NONSHARABLE_CLASS( CWlanSettingsUiStatusPane ): public CBase + { + + public: // Constructors and destructor + + /** + * Two-phased constructor. Leaves on failure. + * @param aEikEnv Eikon environment. + * aResourceId TBUF resource id. + * @return The constructed object. + */ + static CWlanSettingsUiStatusPane* NewLC + ( const CEikonEnv* aEikEnv, TInt aResourceId ); + + /** + * Destructor. + */ + virtual ~CWlanSettingsUiStatusPane(); + + protected: // Constructors + + /** + * Second-phase constructor. + * @param aEikEnv Eikon environment. + * aResourceId TBUF resource id. + */ + void ConstructL( const CEikonEnv* aEikEnv, TInt aResourceId ); + + private: // Data + + CEikStatusPane* iStatusPane; ///< Status pane, not own. + CAknTitlePane* iTitlePane; ///< Title pane, not own. + CAknNavigationControlContainer* iNaviPane; ///< Navi pane, not own. + CAknNavigationDecorator* iNaviDecorator; ///< Navi decorator, own. + HBufC* iOldTitleText; ///< Old title text, own. + + }; + +#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/loc/wlansettingsui.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/loc/wlansettingsui.loc Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,153 @@ +/* +* 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 strings for the dll +* +*/ + + +// LOCALISATION STRINGS + +//d:Title pane text of WLAN (Wireless Local Area Network) settings. +//l:title_pane_t2/opt9 +//w: +//r:3.1 +// +#define qtn_wlan_main_title "Wireless LAN" + +//d:Setting list item name. +//d:"Show WLAN availability" setting: defines if WLAN availablility indicator +//d:is displayed or not. +//l:list_setting_pane_t1 +//w: +//r:3.1 +// +#define qtn_wlan_sett_show_wlan_avail "Show WLAN availability" + +//d:Setting choice item. +//d:qtn_wlan_sett_show_wlan_avail "Show WLAN availability" setting value: +//d:WLAN availability indicator is not displayed. +//d:Backround scan for WLAN networks is never performed (==off). +//l:list_set_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_wlan_sett_bg_scan_never "No" + +//d:Setting choice item. +//d:qtn_wlan_sett_show_wlan_avail "Show WLAN availability" setting value: +//d:WLAN availability indicator is displayed. +//d:Backround scan for WLAN networks is performed regularly. +//l:list_set_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_wlan_sett_bg_scan_enabled "Yes" + +//d:Setting list item name. +//d:"Scan networks" setting: controls the interval, how often a background scan +//d:for surrounding WLAN networks is performed. +//l:list_setting_pane_t1 +//w: +//r:3.1 +// +#define qtn_wlan_sett_bg_scan_interval "Update availability" + +//d:Setting choice item. +//d:qtn_wlan_sett_bg_scan_interval "Scan network" setting value: +//d:Backround scan for WLAN networks is performed in every 1 minute. +//l:list_set_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_wlan_sett_bg_scan_1_min "Every 1 min." + +//d:Setting choice item. +//d:qtn_wlan_sett_bg_scan_interval "Scan network" setting value: +//d:Backround scan for WLAN networks is performed in every %N minutes. +//l:list_set_graphic_pane_t1 +//w: +//r:5.2 +// +#define qtn_wlan_sett_bg_scan_x_min "Every %N minutes" + +//d:Setting list item name. +//d:"Power saving" setting: controls the status of the power mode. +//l:list_setting_pane_t1 +//w: +//r:3.1 +// +#define qtn_wlan_sett_power_saving "Power saving" + +//d:Setting choice item. +//d:qtn_wlan_sett_power_saving "Power saving" setting value: +//d:power saving enabled. +//l:list_set_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_wlan_sett_power_saving_enabled "Enabled" + +//d:Setting choice item. +//d:qtn_wlan_sett_power_saving "Power saving" setting value: +//d:power saving disabled. +//l:list_set_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_wlan_sett_power_saving_disabled "Disabled" + +//d: In case of error, the error code is passed to error resolver +//d: and the error note is displayed accordingly. If error resolver +//d: cannot resolve the error, an error note "System error" is displayed. +//l: popup_note_window/opt2 +//w: +//r:3.1 +// +#define qtn_err_os_general "System error" + +//d: In case the user wants to change the background scanning +//d: interval while the phone is in power save mode this a +//l:popup_note_window +//w: +//r:5.0 +// +#define qtn_power_saving_protected_settings_infonote "Power saving is active. Unable to edit." + +//d:Setting choice item. +//d:qtn_wlan_sett_bg_scan_interval "Scan network" setting value: +//d:Backround scan for WLAN networks is calculated by adaptive WLAN scanning engine +//l:list_set_graphic_pane_t1 +//w: +//r:5.0 +// +#define qtn_wlan_sett_bg_scan_auto "Automatically" + +//d:Setting choice item. +//d:qtn_wlan_sett_bg_scan_interval "Scan network" setting value: +//d:Backround scan interval for WLAN networks is defined by user +//l:list_set_graphic_pane_t1 +//w: +//r:5.2 +// +#define qtn_wlan_sett_bg_scan_user_def "User-defined interval" + +//d:"Interval (in minutes):" - data query +//l:popup_query_data_window/opt5 +//w: +//r:5.2 +// +#define qtn_wlan_prmpt_bg_scan_interval "Interval (in minutes):" + +// End of File diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/rom/wlansettingsui.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/rom/wlansettingsui.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,30 @@ +/* +* 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: Image description file for project wlansettingsui +* +*/ + + +#ifndef __WLAN_SETTINGS_UI_IBY__ +#define __WLAN_SETTINGS_UI_IBY__ + +#ifdef __PROTOCOL_WLAN + +FILE=ABI_DIR\BUILD_DIR\wlansettingsui.dll SHARED_LIB_DIR\wlansettingsui.dll + + +#endif //__PROTOCOL_WLAN + +#endif //__WLAN_SETTINGS_UI_IBY__ + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/rom/wlansettingsuiresources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/rom/wlansettingsuiresources.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,29 @@ +/* +* 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: Image description file for project wlansettingsui +* +*/ + + +#ifndef __WLAN_SETTINGS_UI_RESOURCES_IBY__ +#define __WLAN_SETTINGS_UI_RESOURCES_IBY__ + +#ifdef __PROTOCOL_WLAN + +data=DATAZ_\RESOURCE_FILES_DIR\wlansettingsui.rsc RESOURCE_FILES_DIR\wlansettingsui.rsc + +#endif //__PROTOCOL_WLAN + +#endif __WLAN_SETTINGS_UI_RESOURCES_IBY__ + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/src/wlansettingsui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/src/wlansettingsui.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 class CWlanSettingsUi. +* +* +*/ + + +// INCLUDE FILES + +#include "wlansettingsui.h" +#include "wlansettingsuiimpl.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CWlanSettingsUi::NewLC +// --------------------------------------------------------- +// +EXPORT_C CWlanSettingsUi* CWlanSettingsUi::NewL( CEikonEnv& aEikEnv ) + { + CWlanSettingsUi* ui = new ( ELeave ) CWlanSettingsUi(); + CleanupStack::PushL( ui ); + ui->iImpl = CWlanSettingsUiImpl::NewL( aEikEnv ); + CleanupStack::Pop( ui ); + return ui; + } + +// --------------------------------------------------------- +// CWlanSettingsUi::~CWlanSettingsUi +// --------------------------------------------------------- +// +EXPORT_C CWlanSettingsUi::~CWlanSettingsUi() + { + delete iImpl; + } + +// --------------------------------------------------------- +// CWlanSettingsUi::RunSettingsL +// --------------------------------------------------------- +// +EXPORT_C void CWlanSettingsUi::RunSettingsL( CMDBSession* aSession ) + { + iImpl->RunSettingsL( aSession ); + } + +// --------------------------------------------------------- +// CWlanSettingsUi::RunSettingsL +// --------------------------------------------------------- +// +EXPORT_C void CWlanSettingsUi::RunSettingsL() + { + CommsDat::CMDBSession* session = CMDBSession::NewLC( KCDLatestVersion ); + RunSettingsL( session ); + CleanupStack::PopAndDestroy( session ); + } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/src/wlansettingsuibinarypopupsettingitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/src/wlansettingsuibinarypopupsettingitem.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,49 @@ +/* +* 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: +* CWlanSettingsUiBinaryPopupSettingItem implementation. +* +* +*/ + + +#include "wlansettingsuibinarypopupsettingitem.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CWlanSettingsUiBinaryPopupSettingItem::CWlanSettingsUiBinaryPopupSettingItem +// --------------------------------------------------------- +// +CWlanSettingsUiBinaryPopupSettingItem::CWlanSettingsUiBinaryPopupSettingItem( + MWlanSettingsUiBinaryPopupSettingObserver& aObserver, + TInt aResourceId, + TBool& aValue ) +: CAknBinaryPopupSettingItem( aResourceId, aValue ), + iObserver( aObserver ) + { + } + +// --------------------------------------------------------- +// CWlanSettingsUiBinaryPopupSettingItem::EditItemL +// --------------------------------------------------------- +// +void CWlanSettingsUiBinaryPopupSettingItem::EditItemL( TBool aCalledFromMenu ) + { + // Since this is a binary setting, edit always means change. + // (There is no popup to Cancel, the setting changes in place.) + CAknBinaryPopupSettingItem::EditItemL( aCalledFromMenu ); + iObserver.BinarySettingChangedL( this, InternalValue() ); + } + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/src/wlansettingsuidlg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/src/wlansettingsuidlg.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,176 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 class CWlanSettingsUiDlg. +* +* +*/ + + +// INCLUDE FILES + +#include "wlansettingsuidlg.h" +#include "wlansettingsuisettingitemlist.h" +#include "wlansettingsuipanic.h" +#include "wlansettingsui.hrh" + +#include +#include + +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CWlanSettingsUiDlg::ExecuteLD +// --------------------------------------------------------- +// +TInt CWlanSettingsUiDlg::ExecuteLD() + { + CleanupStack::PushL( this ); + ConstructL( MenuBarResourceId() ); + CleanupStack::Pop( this ); + return CAknDialog::ExecuteLD( DialogResourceId() ); + } + +// --------------------------------------------------------- +// CWlanSettingsUiDlg::CreateCustomControlL +// --------------------------------------------------------- +// +SEikControlInfo CWlanSettingsUiDlg::CreateCustomControlL( TInt aControlType ) + { + SEikControlInfo controlInfo; + controlInfo.iControl = NULL; + controlInfo.iTrailerTextId = 0; + controlInfo.iFlags = 0; + switch ( aControlType ) + { + case EWlanSettingsUiSettingItemList: + { + controlInfo.iControl = new (ELeave) CWlanSettingsUiSettingItemList( + iModel ); + break; + } + + default: + { + __ASSERT_DEBUG( EFalse, \ + WlanSettingsUiPanic( EWlanSettingsUiBadControl ) ); + break; + } + } + return controlInfo; + } + +// --------------------------------------------------------- +// CWlanSettingsUiDlg::ProcessCommandL +// --------------------------------------------------------- +// +void CWlanSettingsUiDlg::ProcessCommandL( TInt aCommandId ) + { + if ( MenuShowing() ) + { + HideMenu(); + } + + switch( aCommandId ) + { + case EWlanSettingsUiCmdChange: + { + SettingItemList().EditCurrentItemL( ETrue ); + break; + } + + case EAknSoftkeyChange: + { + SettingItemList().EditCurrentItemL( EFalse ); + break; + } + + case EAknSoftkeyBack: + { + TryExitL( aCommandId ); + break; + } + + case EAknCmdHelp: + { + if( IsHelpSupported() ) + { + HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), + iEikonEnv->EikAppUi()->AppHelpContextL() ); + } + break; + } + + case EAknCmdExit: + case EEikCmdExit: + { + ( ( CAknAppUi* )iEikonEnv->EikAppUi() )-> + ProcessCommandL( aCommandId ); + break; + } + + default: + { + CAknDialog::ProcessCommandL( aCommandId ); + } + } + } + +// --------------------------------------------------------- +// CWlanSettingsUiDlg::OkToExitL +// --------------------------------------------------------- +// +TBool CWlanSettingsUiDlg::OkToExitL( TInt aButtonId ) + { + if ( aButtonId == EAknSoftkeyChange ) + { + ProcessCommandL( aButtonId ); + return EFalse; + } + + return CAknDialog::OkToExitL( aButtonId ); + } + +// --------------------------------------------------------- +// CWlanSettingsUiDlg::SettingItemList +// --------------------------------------------------------- +// +CWlanSettingsUiSettingItemList& CWlanSettingsUiDlg::SettingItemList() const + { + return *( STATIC_CAST( CWlanSettingsUiSettingItemList*, \ + Control( EWlanSettingsUiDlgSettingList ) ) ); + } + +// --------------------------------------------------------- +// CWlanSettingsUiDlg::IsHelpSupported +// --------------------------------------------------------- +// +TBool CWlanSettingsUiDlg::IsHelpSupported() + { + TBool isHelpSupported = EFalse; + + TRAPD( error, FeatureManager::InitializeLibL() ); + + if( !error ) + { + isHelpSupported = + FeatureManager::FeatureSupported( KFeatureIdHelp ); + + FeatureManager::UnInitializeLib(); + } + + return isHelpSupported; + } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/src/wlansettingsuiimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/src/wlansettingsuiimpl.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 class CWlanSettingsUiImpl. +* +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wlansettingsuiimpl.h" +#include "wlansettingsuimainviewdlg.h" +#include "wlansettingsuimodel.h" +#include "wlansettingsuistatuspane.h" + +// CONSTANTS + +/// WLAN Settings UI resource file path. +_LIT( KWlanSettingsUiResourceFile, "z:wlansettingsui.rsc" ); + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CWlanSettingsUiImpl::NewLC +// --------------------------------------------------------- +// +CWlanSettingsUiImpl* CWlanSettingsUiImpl::NewL( CEikonEnv& aEikEnv ) + { + CWlanSettingsUiImpl* ui = new ( ELeave ) CWlanSettingsUiImpl( aEikEnv ); + CleanupStack::PushL( ui ); + ui->ConstructL(); + CleanupStack::Pop( ui ); + return ui; + } + +// --------------------------------------------------------- +// CWlanSettingsUiImpl::~CWlanSettingsUiImpl +// --------------------------------------------------------- +// +CWlanSettingsUiImpl::~CWlanSettingsUiImpl() + { + iResources.Close(); + +#ifndef __WINS__ + delete iWlanMgmtClient; +#endif + delete iRepository; + } + +// --------------------------------------------------------- +// CWlanSettingsUiImpl::CWlanSettingsUiImpl +// --------------------------------------------------------- +// +CWlanSettingsUiImpl::CWlanSettingsUiImpl( CEikonEnv& aEikEnv ) +: iEikEnv( &aEikEnv ), + iResources( *CCoeEnv::Static() ) + { + } + +// --------------------------------------------------------- +// CWlanSettingsUiImpl::ConstructL +// --------------------------------------------------------- +// +void CWlanSettingsUiImpl::ConstructL() + { + RFs fsSession; + User::LeaveIfError( fsSession.Connect() ); + + // Find the resource file: + TParse parse; + parse.Set( KWlanSettingsUiResourceFile, &KDC_RESOURCE_FILES_DIR, NULL ); + TFileName fileName( parse.FullName() ); + + // Get language of resource file: + BaflUtils::NearestLanguageFile( fsSession, fileName ); + + // Open resource file: + iResources.OpenL( fileName ); + + // If leave occurs before this, close is called automatically when the + // thread exits. + fsSession.Close(); + + +#ifndef __WINS__ + iWlanMgmtClient = CWlanMgmtClient::NewL(); +#endif + iRepository = CRepository::NewL( KCRUidInternetConnectivitySettings ); + } + +// --------------------------------------------------------- +// CWlanSettingsUiImpl::RunSettingsL +// --------------------------------------------------------- +// +void CWlanSettingsUiImpl::RunSettingsL( CMDBSession* aSession ) + { + CWlanSettingsUiModel* model = CWlanSettingsUiModel::NewL( + aSession, + iWlanMgmtClient, + iRepository); + + CleanupStack::PushL( model ); + + model->LoadSettingsL(); + CWlanSettingsUiStatusPane* statusPane = + CWlanSettingsUiStatusPane::NewLC( iEikEnv, R_WLAN_SETTINGS_UI_TITLE ); + CWlanSettingsUiMainViewDlg* dlg = + new ( ELeave ) CWlanSettingsUiMainViewDlg( model ); + dlg->ExecuteLD(); + + CleanupStack::PopAndDestroy( statusPane ); + CleanupStack::PopAndDestroy( model ); + } + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/src/wlansettingsuimainviewdlg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/src/wlansettingsuimainviewdlg.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 class CWlanSettingsUiMainViewDlg. +* +* +*/ + + +// INCLUDE FILES + +#include +#include +#include "wlansettingsuimainviewdlg.h" +#include "wlansettingsui.hrh" +#include "wlansettingsuisettingitemlist.h" + +#include "wlansettingsuidefs.h" +#include + + +//CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + void FocusChanged(TDrawNow aDrawNow); +// --------------------------------------------------------- +// CWlanSettingsUiMainViewDlg::GetHelpContext +// --------------------------------------------------------- +// +void CWlanSettingsUiMainViewDlg::FocusChanged(TDrawNow /* aDrawNow */) + { + TRAP_IGNORE( SettingItemList().RefreshViewL() ); + } + +// --------------------------------------------------------- +// CWlanSettingsUiMainViewDlg::GetHelpContext +// --------------------------------------------------------- +// +void CWlanSettingsUiMainViewDlg::GetHelpContext +( TCoeHelpContext& aContext ) const + { + aContext.iMajor = KWlanSettingsUiHelpMajor; + aContext.iContext = KSET_HLP_WLAN_SETTINGS; + } + +// --------------------------------------------------------- +// CWlanSettingsUiMainViewDlg::DynInitMenuPaneL +// --------------------------------------------------------- +// +void CWlanSettingsUiMainViewDlg::DynInitMenuPaneL +( TInt aResourceId, CEikMenuPane* aMenuPane ) + { + CWlanSettingsUiDlg::DynInitMenuPaneL( aResourceId, aMenuPane ); + if ( aResourceId == R_WLAN_SETTINGS_UI_MAIN_VIEW_MENU ) + { + if ( !IsHelpSupported() ) + { + aMenuPane->DeleteMenuItem( EAknCmdHelp ); + } + } + } + +// --------------------------------------------------------- +// CWlanSettingsUiMainViewDlg::ProcessCommandL +// --------------------------------------------------------- +// +void CWlanSettingsUiMainViewDlg::ProcessCommandL( TInt aCommandId ) + { + if ( MenuShowing() ) + { + HideMenu(); + } + + switch( aCommandId ) + { + default: + { + CWlanSettingsUiDlg::ProcessCommandL( aCommandId ); + } + } + } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/src/wlansettingsuimodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/src/wlansettingsuimodel.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,327 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 class TWlanSettingsUiModel. +* +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include "wlansettingsuimodel.h" +#include "wlansettingsuipanic.h" + +#include +#include +#include +#include +#include + +// CONSTANTS + +const TInt KWlanSettingsUiSecondsInMinute = 60; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CWlanSettingsUiModel::NewL +// --------------------------------------------------------- +// +CWlanSettingsUiModel* CWlanSettingsUiModel::NewL + ( + CMDBSession* aSession, + CWlanMgmtClient* aWlanMgmtClient, + CRepository* aRepository + ) + { + CWlanSettingsUiModel* self = new( ELeave ) + CWlanSettingsUiModel(aSession, + aWlanMgmtClient, + aRepository); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------- +// CWlanSettingsUiModel::CWlanSettingsUiModel +// --------------------------------------------------------- +// +CWlanSettingsUiModel::CWlanSettingsUiModel + ( + CMDBSession* aSession, + CWlanMgmtClient* aWlanMgmtClient, + CRepository* aRepository + ) +: iShowWlanAvail( KWlanSettingsUiDefaultShowWlanAvail ), + iScanNetworks( KWlanSettingsUiDefaultScanNetwork ), + iPowerSaving( KWlanSettingsUiDefaultPowerSaving ), + iPsmMode( EFalse ), + iSession( aSession ), + iWlanMgmtClient( aWlanMgmtClient ), + iRepository( aRepository ), + iPsmSupported( EFalse ) + { + } + +// --------------------------------------------------------- +// CWlanSettingsUiModel::ConstructL +// --------------------------------------------------------- +// +void CWlanSettingsUiModel::ConstructL() + { + FeatureManager::InitializeLibL(); + // Set the member variable to indicate if full/partial PSM is on. + // This value stays the same for the whole WLAN Settings session, + // i.e. we ignore any mode changes during the session. + CheckPsmModeL(); + } + + +// --------------------------------------------------------- +// CWlanSettingsUiModel::~CWlanSettingsUiModel() +// --------------------------------------------------------- +// +CWlanSettingsUiModel::~CWlanSettingsUiModel() + { + FeatureManager::UnInitializeLib(); + } + +// --------------------------------------------------------- +// CWlanSettingsUiModel::LoadSettingsL +// --------------------------------------------------------- +// +void CWlanSettingsUiModel::LoadSettingsL() + { + TBool ownTransaction( EFalse ); + if( !iSession->IsInTransaction() ) + { + ownTransaction = ETrue; + iSession->OpenTransactionL(); + } + TMDBElementId tableId = 0; + + tableId = CCDWlanDeviceSettingsRecord::TableIdL( *iSession ); + + CCDWlanDeviceSettingsRecord* record = new( ELeave ) + CCDWlanDeviceSettingsRecord( tableId ); + CleanupStack::PushL( record ); + + record->iWlanDeviceSettingsType = KWlanUserSettings; + + if( record->FindL( *iSession ) ) + { + record->LoadL( *iSession ); + } + + // Read scan interval + + iScanNetworks = record->iBgScanInterval; + FixScanNetworks( record->iSavedBgScanInterval ); + + iPowerSaving = record->iWlanPowerMode; + CleanupStack::PopAndDestroy( record ); + + if ( ownTransaction ) + { + iSession->CommitTransactionL(); + // Rollback operation. + } + } + +// --------------------------------------------------------- +// CWlanSettingsUiModel::SaveSettingsL +// --------------------------------------------------------- +// +void CWlanSettingsUiModel::SaveSettingsL() + { + TBool ownTransaction( EFalse ); + if( !iSession->IsInTransaction() ) + { + ownTransaction = ETrue; + iSession->OpenTransactionL(); + } + TMDBElementId tableId = 0; + tableId = CCDWlanDeviceSettingsRecord::TableIdL( *iSession ); + + CCDWlanDeviceSettingsRecord* record = new( ELeave ) + CCDWlanDeviceSettingsRecord( tableId ); + + CleanupStack::PushL( record ); + + record->iWlanDeviceSettingsType = KWlanUserSettings; + + if( record->FindL( *iSession ) ) + { + record->LoadL( *iSession ); + } + + if ( iShowWlanAvail ) + { + record->iBgScanInterval = iScanNetworks; + } + else + { + record->iBgScanInterval = KWlanSettingsUiScanNetworkNever; + + // Do not change the saved interval value if in full or partial PSM Mode. + // We want to preserve the previous user-selected value in memory, not the + // forced PSM mode value (automatic). + if ( !PsmModeOn() ) + { + record->iSavedBgScanInterval = iScanNetworks; + } + } + + record->iWlanPowerMode = iPowerSaving; + + // Whenever settings are modified, iUseDefaultSettings must be set to false. + record->iUseDefaultSettings = EFalse; + + record->ModifyL( *iSession ); + + CleanupStack::PopAndDestroy( record ); + if ( ownTransaction ) + { + iSession->CommitTransactionL(); + } + +#ifndef __WINS__ + // Notifying WLAN Engine about changes in settings + iWlanMgmtClient->NotifyChangedSettings(); +#endif + } + +// --------------------------------------------------------- +// CWlanSettingsUiModel::FixScanNetworks +// --------------------------------------------------------- +// +void CWlanSettingsUiModel::FixScanNetworks( TUint aSavedScanInterval ) + { + if ( iScanNetworks == KWlanSettingsUiScanNetworkNever ) + { + iShowWlanAvail = EFalse; + + if( aSavedScanInterval == KWlanSettingsUiScanNetworkNever + || iPsmMode ) + { + iScanNetworks = KWlanSettingsUiDefaultScanNetwork; + } + else + { + iScanNetworks = FixScanInterval( aSavedScanInterval ); + } + } + + else + { + iShowWlanAvail = ETrue; + iScanNetworks = FixScanInterval( iScanNetworks ); + } + } + + +// --------------------------------------------------------- +// CWlanSettingsUiModel::FixScanInterval +// --------------------------------------------------------- +// +TUint CWlanSettingsUiModel::FixScanInterval( TUint aScanInterval ) + { + if( aScanInterval <= + ( EWlanSettingsUiScanNetworkMax * KWlanSettingsUiSecondsInMinute ) ) + { + // Return only full minutes + return aScanInterval - + ( aScanInterval % KWlanSettingsUiSecondsInMinute ); + } + else + { + return KWlanSettingsUiScanNetworkAuto; + } + } + +// --------------------------------------------------------- +// CWlanSettingsUiModel::CheckPsmModeL +// --------------------------------------------------------- +// +void CWlanSettingsUiModel::CheckPsmModeL() + { + iPsmSupported = FeatureManager::FeatureSupported( KFeatureIdPowerSave ); + if( iPsmSupported ) + { + TPsmsrvMode mode( EPsmsrvModeNormal ); + + CRepository* cenrep = NULL; + + TRAP_IGNORE( cenrep = CRepository::NewL( KCRUidPowerSaveMode ) ); + + if ( cenrep ) + { + TInt crValue(0); + cenrep->Get( KPsmCurrentMode, crValue ); + mode = static_cast( crValue ); + if ( mode == EPsmsrvModePowerSave || mode == EPsmsrvPartialMode ) + { + iPsmMode = ETrue; + } + else + { + iPsmMode = EFalse; + } + + delete cenrep; + cenrep = NULL; + } + } + } + +// --------------------------------------------------------- +// CWlanSettingsUiModel::ScanNetworks +// --------------------------------------------------------- +// +TUint CWlanSettingsUiModel::ScanNetworks() + { + if ( iScanNetworks == KWlanSettingsUiScanNetworkAuto ) + { + return iScanNetworks; + } + else + { + // Return scan time in minutes + return ( iScanNetworks / KWlanSettingsUiSecondsInMinute ); + } + } + +// --------------------------------------------------------- +// CWlanSettingsUiModel::SetScanNetworks +// --------------------------------------------------------- +// +void CWlanSettingsUiModel::SetScanNetworks( TUint aScanNetworks ) + { + if ( aScanNetworks == KWlanSettingsUiScanNetworkAuto ) + { + iScanNetworks = aScanNetworks; + } + else + { + // Scan time stored in seconds + iScanNetworks = aScanNetworks * KWlanSettingsUiSecondsInMinute; + } + } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/src/wlansettingsuipanic.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/src/wlansettingsuipanic.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 panic function. +* +* +*/ + + +// INCLUDE FILES + +#include +#include "wlansettingsuipanic.h" + +// ================= LOCAL FUNCTIONS ======================= + +// --------------------------------------------------------- +// WlanSettingsUiPanic() +// --------------------------------------------------------- +// +void WlanSettingsUiPanic( TWlanSettingsUiPanicReason aReason ) + { + _LIT( KWlanSettingsUi, "WLAN Settings UI" ); + User::Panic( KWlanSettingsUi, aReason ); + } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/src/wlansettingsuiscanintervalsettingitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/src/wlansettingsuiscanintervalsettingitem.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,200 @@ +/* +* 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: Declaration of class CWlanSettingsUiScanIntervalSettingItem. +* +*/ + +// INCLUDE FILES + +#include "wlansettingsui.hrh" +#include "wlansettingsuimodel.h" +#include "wlansettingsuiscanintervalsettingitem.h" + +#include +#include +#include +#include + +// CONSTANTS + +/** +* User defined scan interval minimum +*/ +const TInt KScanIntervalMin = EWlanSettingsUiScanNetworkMin; + +/** +* User defined scan interval maximum +*/ +const TInt KScanIntervalMax = EWlanSettingsUiScanNetworkMax; + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------------------------- +// CWlanSettingsUiScanIntervalSettingItem:: +// CWlanSettingsUiScanIntervalSettingItem +// --------------------------------------------------------------------------- +// +CWlanSettingsUiScanIntervalSettingItem:: + CWlanSettingsUiScanIntervalSettingItem( + TInt aResourceId, TInt& aListValue, TInt& aValue, + CWlanSettingsUiModel* aModel ) : + CAknEnumeratedTextPopupSettingItem( aResourceId, aListValue ), + iModel( aModel ), + iValue( aValue ), + iEnv( CEikonEnv::Static() ), + iRevertBackToAutomaticScan( EFalse ) + { + }; + +// --------------------------------------------------------------------------- +// CWlanSettingsUiScanIntervalSettingItem:: +// ~CWlanSettingsUiScanIntervalSettingItem +// Destructor +// --------------------------------------------------------------------------- +// +CWlanSettingsUiScanIntervalSettingItem:: + ~CWlanSettingsUiScanIntervalSettingItem() + { + iSettingText.Close(); + } + +// --------------------------------------------------------------------------- +// CWlanSettingsUiScanIntervalSettingItem::SettingTextL +// --------------------------------------------------------------------------- +// +const TDesC& CWlanSettingsUiScanIntervalSettingItem::SettingTextL() + { + HBufC* tempText; + + iSettingText.Close(); + + if ( InternalValue() == EWlanSettingsUiScanNetworkAuto ) + { + tempText = iEnv->AllocReadResourceL( R_WLAN_SETT_BG_SCAN_AUTO ); + } + else + { + if ( iValue == 1 ) + { + tempText = iEnv->AllocReadResourceL( R_WLAN_SETT_BG_SCAN_1_MIN ); + } + else + { + tempText = StringLoader::LoadL( R_WLAN_SETT_BG_SCAN_X_MIN, iValue, iEnv ); + } + } + + iSettingText.Assign( tempText ); + + AknTextUtils::LanguageSpecificNumberConversion( iSettingText ); + + return iSettingText; + } + +// --------------------------------------------------------------------------- +// CWlanSettingsUiScanIntervalSettingItem::EditItemL +// --------------------------------------------------------------------------- +// +void CWlanSettingsUiScanIntervalSettingItem::EditItemL( TBool aCalledFromMenu ) + { + CAknEnumeratedTextPopupSettingItem::EditItemL( aCalledFromMenu ); + + if ( iRevertBackToAutomaticScan ) + { + // Scan mode needs to be reverted back to automatic because we are + // either in power saving mode or user cancelled the user-defined + // scan interval query + SetInternalValue( EWlanSettingsUiScanNetworkAuto ); + SetSelectedIndex( IndexFromValue( EWlanSettingsUiScanNetworkAuto ) ); + UpdateListBoxTextL(); + iRevertBackToAutomaticScan = EFalse; + } + } + +// --------------------------------------------------------------------------- +// CWlanSettingsUiScanIntervalSettingItem::HandleSettingPageEventL +// --------------------------------------------------------------------------- +// +void CWlanSettingsUiScanIntervalSettingItem::HandleSettingPageEventL( + CAknSettingPage* aSettingPage, + TAknSettingPageEvent aEventType ) + { + if ( aEventType != EEventSettingCancelled ) + { + CEikListBox* listBox = (CEikListBox*)aSettingPage->EditorControl(); + TInt index = listBox->CurrentItemIndex(); + + if ( index == IndexFromValue( EWlanSettingsUiScanNetworkUserDef ) ) + { + // User-defined scan interval selected + if ( !iModel->PsmModeOn() ) + { + if ( iValue == 0 ) + { + // Set default scan interval for query dialog + iValue = KWlanSettingsUiDefaultUserDefScanInterval; + } + if ( ShowScanIntervalQueryL() == FALSE ) + { + // Dialog was cancelled, revert back to automatic scan? + if ( InternalValue() == EWlanSettingsUiScanNetworkAuto ) + { + // Previous selection was automatic, revert back to + // automatic + iRevertBackToAutomaticScan = ETrue; + } + } + } + else + { + // We are in power saving mode, user-defined interval not allowed + ShowPowerSavingInfoNoteL(); + iRevertBackToAutomaticScan = ETrue; + } + } + } + + CAknSettingItem::HandleSettingPageEventL(aSettingPage, aEventType); + } + +// --------------------------------------------------------------------------- +// CWlanSettingsUiScanIntervalSettingItem::ShowScanIntervalQueryL +// --------------------------------------------------------------------------- +// +TBool CWlanSettingsUiScanIntervalSettingItem::ShowScanIntervalQueryL() + { + HBufC* msg = StringLoader::LoadLC( R_WLAN_PRMPT_BG_SCAN_INTERVAL ); + + CAknNumberQueryDialog* dialog = CAknNumberQueryDialog::NewL( iValue ); + dialog->PrepareLC( R_WLAN_SETTINGS_UI_NUMBER_EDITOR_2 ); + dialog->SetPromptL( *msg ); + dialog->SetMinimumAndMaximum( KScanIntervalMin, KScanIntervalMax ); + TBool result = ( dialog->RunLD() == EAknSoftkeyOk ); + CleanupStack::PopAndDestroy( msg ); + return result; + } + +// --------------------------------------------------------------------------- +// CWlanSettingsUiScanIntervalSettingItem::ShowPowerSavingInfoNoteL +// --------------------------------------------------------------------------- +// +void CWlanSettingsUiScanIntervalSettingItem::ShowPowerSavingInfoNoteL() + { + HBufC* prompt = StringLoader::LoadLC( + R_WLAN_SETTINGS_UI_POWER_SAVING_INFONOTE ); + CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue ); + note->ExecuteLD( *prompt ); + CleanupStack::PopAndDestroy( prompt ); + } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/src/wlansettingsuisettingitemlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/src/wlansettingsuisettingitemlist.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,301 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 class CWlanSettingsUiSettingItemList. +* +* +*/ + + +// INCLUDE FILES + +#include "wlansettingsuisettingitemlist.h" +#include "wlansettingsuibinarypopupsettingitem.h" +#include "wlansettingsuimodel.h" +#include "wlansettingsuipanic.h" +#include "wlansettingsuidefs.h" +#include "wlansettingsui.hrh" +#include "wlansettingsuiscanintervalsettingitem.h" + +#include + + +// ================= MEMBER FUNCTIONS ======================= + + +// --------------------------------------------------------- +// CWlanSettingsUiSettingItemList::EditItemL +// --------------------------------------------------------- +// +void CWlanSettingsUiSettingItemList::EditItemL( TInt aIndex, + TBool aCalledFromMenu ) + { + __ASSERT_ALWAYS ( aIndex < SettingItemArray()->Count(), \ + User::Leave( KErrArgument ) ); + + CAknSettingItem* item = SettingItemArray()->At ( aIndex ); + + CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu); + CAknSettingItemList::StoreSettingsL(); + + switch ( item->Identifier() ) + { + case EWlanSettingsUiSettingScanNetworks: + { + if ( iScanMode == EWlanSettingsUiScanNetworkAuto ) + { + iModel->SetScanNetworks( KWlanSettingsUiScanNetworkAuto ); + } + else + { + iModel->SetScanNetworks( iScanInterval ); + } + break; + } + + case EWlanSettingsUiSettingPowerSaving: + { + iModel->SetPowerSaving( iPowerSaving ); + break; + } + + default: + { + break; + } + } + iModel->SaveSettingsL(); + + DrawNow(); + } + +// --------------------------------------------------------- +// CWlanSettingsUiSettingItemList::EditCurrentItemL +// --------------------------------------------------------- +// +void CWlanSettingsUiSettingItemList::EditCurrentItemL( TBool aCalledFromMenu ) + { + TInt index = SettingItemArray()->ItemIndexFromVisibleIndex + ( ListBox()->CurrentItemIndex() ); + EditItemL( index, aCalledFromMenu ); + } + +// --------------------------------------------------------- +// CWlanSettingsUiSettingItemList::LoadSettingsL +// --------------------------------------------------------- +// +void CWlanSettingsUiSettingItemList::LoadSettingsL() + { + CAknSettingItemList::LoadSettingsL(); + iShowWlanAvail = iModel->ShowWlanAvail(); + iScanInterval = iModel->ScanNetworks(); + if ( static_cast( iScanInterval ) == + KWlanSettingsUiScanNetworkAuto ) + { + iScanMode = EWlanSettingsUiScanNetworkAuto; + iScanInterval = KWlanSettingsUiDefaultUserDefScanInterval; + } + else + { + iScanMode = EWlanSettingsUiScanNetworkUserDef; + } + iPowerSaving = iModel->PowerSaving(); + iChangeScanNetworksValueBack = EFalse; + RefreshViewL(); + } + + +// --------------------------------------------------------- +// CWlanSettingsUiSettingItemList::CreateSettingItemL +// --------------------------------------------------------- +// +CAknSettingItem* CWlanSettingsUiSettingItemList::CreateSettingItemL +( TInt aSettingId ) + { + CAknSettingItem* item; + switch ( aSettingId ) + { + case EWlanSettingsUiSettingShowWlanAvail: + { + item = new (ELeave) CWlanSettingsUiBinaryPopupSettingItem + ( *this, aSettingId, iShowWlanAvail ); + break; + } + + case EWlanSettingsUiSettingScanNetworks: + { + item = new (ELeave)CWlanSettingsUiScanIntervalSettingItem + ( aSettingId, iScanMode, iScanInterval, iModel ); + break; + } + + case EWlanSettingsUiSettingPowerSaving: + { + item = new (ELeave) CAknBinaryPopupSettingItem + ( aSettingId, iPowerSaving ); + break; + } + + default: + { + __ASSERT_DEBUG( EFalse, \ + WlanSettingsUiPanic( EWlanSettingsUiBadSetting ) ); + item = new (ELeave) CAknSettingItem( aSettingId ); + break; + } + } + return item; + } + +// --------------------------------------------------------- +// CWlanSettingsUiSettingItemList::BinarySettingChangedL +// --------------------------------------------------------- +// +void CWlanSettingsUiSettingItemList::BinarySettingChangedL +( CWlanSettingsUiBinaryPopupSettingItem* aItem, TBool aNewInternalVal ) + { + switch ( aItem->Identifier() ) + { + case EWlanSettingsUiSettingShowWlanAvail: + { + iShowWlanAvail = aNewInternalVal; + iModel->SetShowWlanAvail( aNewInternalVal ); + break; + } + + default: + { + __ASSERT_DEBUG( EFalse, \ + WlanSettingsUiPanic( EWlanSettingsUiBadSetting ) ); + break; + } + } + RefreshViewL(); + } + +// --------------------------------------------------------- +// CWlanSettingsUiSettingItemList::RefreshViewL +// --------------------------------------------------------- +// +void CWlanSettingsUiSettingItemList::RefreshViewL() + { + TInt i; + CAknSettingItem* item; + for ( i = 0; i < SettingItemArray()->Count(); i++ ) + { + item = SettingItemArray()->At( i ); + switch ( item->Identifier() ) + { + case EWlanSettingsUiSettingShowWlanAvail: + { + // Always shown. + break; + } + + case EWlanSettingsUiSettingScanNetworks: + { + // Hidden if Show WLAN Availability is off. + item->SetHidden( !iShowWlanAvail ); + + if ( iShowWlanAvail ) + { + iModel->CheckPsmModeL(); + // check that the user selected value is allowed + // if we are in the PowerSave Mode + if ( iModel->PsmModeOn() ) + { + if ( iModel->ScanNetworks() != KWlanSettingsUiScanNetworkAuto ) + { + iScanMode = EWlanSettingsUiScanNetworkAuto; + iScanNetworksBackUp = iModel->ScanNetworks(); + iModel->SetScanNetworks( KWlanSettingsUiScanNetworkAuto ); + iChangeScanNetworksValueBack = ETrue; + CAknSettingItemList::LoadSettingsL(); + } + } + else + { + if ( iChangeScanNetworksValueBack ) + { + iScanMode = EWlanSettingsUiScanNetworkUserDef; + iModel->SetScanNetworks( iScanNetworksBackUp ); + iChangeScanNetworksValueBack = EFalse; + CAknSettingItemList::LoadSettingsL(); + } + } + } + + break; + } + + case EWlanSettingsUiSettingPowerSaving: + { + // Always shown. + break; + } + + default: + { + __ASSERT_DEBUG( EFalse, \ + WlanSettingsUiPanic( EWlanSettingsUiBadSetting ) ); + break; + } + } + } + HandleChangeInItemArrayOrVisibilityL(); + } + +// --------------------------------------------------------- +// CWlanSettingsUiSettingItemList::SetListBoxRect +// --------------------------------------------------------- +// +void CWlanSettingsUiSettingItemList::SetListBoxRect() +{ + TRect mainPaneRect; + AknLayoutUtils::LayoutMetricsRect( + AknLayoutUtils::EMainPane, mainPaneRect ); + + TAknLayoutRect layoutRect; + layoutRect.LayoutRect( + TRect( TPoint( 0, 0 ), mainPaneRect.Size() ), + AKN_LAYOUT_WINDOW_list_gen_pane( 0 ) ); + + ListBox()->SetRect( layoutRect.Rect() ); +} + +// --------------------------------------------------------- +// CWlanSettingsUiSettingItemList::HandleResourceChange +// --------------------------------------------------------- +// +void CWlanSettingsUiSettingItemList::HandleResourceChange( TInt aType ) + { + if ( aType == KEikDynamicLayoutVariantSwitch ) + { + SetListBoxRect(); + } + + // Base call + CAknSettingItemList::HandleResourceChange( aType ); + } + +// --------------------------------------------------------- +// CWlanSettingsUiSettingItemList::ActivateL +// --------------------------------------------------------- +// +void CWlanSettingsUiSettingItemList::ActivateL() + { + LoadSettingsL(); + SetListBoxRect(); + CAknSettingItemList::ActivateL(); + } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansettingsui/src/wlansettingsuistatuspane.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/src/wlansettingsuistatuspane.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 class CWlanSettingsUiStatusPane. +* +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include +#include +#include +#include + +#include "wlansettingsuistatuspane.h" +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CWlanSettingsUi::NewLC +// --------------------------------------------------------- +// +CWlanSettingsUiStatusPane* CWlanSettingsUiStatusPane::NewLC +( const CEikonEnv* aEikEnv, TInt aResourceId ) + { + CWlanSettingsUiStatusPane* sp = new (ELeave) CWlanSettingsUiStatusPane(); + CleanupStack::PushL( sp ); + sp->ConstructL( aEikEnv, aResourceId ); + return sp; + } + +// --------------------------------------------------------- +// CWlanSettingsUiStatusPane::~CWlanSettingsUiStatusPane +// --------------------------------------------------------- +// +CWlanSettingsUiStatusPane::~CWlanSettingsUiStatusPane() + { + delete iNaviDecorator; + if ( iOldTitleText ) + { + if ( iTitlePane ) + { + TRAP_IGNORE( iTitlePane->SetTextL( *iOldTitleText ) ) + } + delete iOldTitleText; + } + } + +// --------------------------------------------------------- +// CWlanSettingsUiStatusPane::ConstructL +// --------------------------------------------------------- +// +void CWlanSettingsUiStatusPane::ConstructL +( const CEikonEnv* aEikEnv, TInt aResourceId ) + { + iStatusPane = aEikEnv->AppUiFactory()->StatusPane(); + iTitlePane = (CAknTitlePane*)iStatusPane->ControlL + ( TUid::Uid( EEikStatusPaneUidTitle ) ); + iOldTitleText = iTitlePane->Text()->AllocL(); + + HBufC* newTitle = StringLoader::LoadLC( aResourceId ); + + iTitlePane->SetTextL( *newTitle ); + CleanupStack::PopAndDestroy( newTitle ); + iNaviPane = (CAknNavigationControlContainer*)iStatusPane->ControlL + ( TUid::Uid( EEikStatusPaneUidNavi ) ); + iNaviDecorator = iNaviPane->CreateNavigationLabelL( KNullDesC ); + iNaviPane->PushL( *iNaviDecorator ); + } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aihelper/data/wsfaihelper.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/data/wsfaihelper.rss Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource definitions for project AiHelper +* +*/ + + +NAME SNAH + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wsfaihelper.hrh" + + +// --------------------------------------------------------- +// Resource file signature +// --------------------------------------------------------- +RESOURCE RSS_SIGNATURE { } + + +// --------------------------------------------------------- +// Default Document Name +// --------------------------------------------------------- +RESOURCE TBUF r_default_document_name { buf=""; } + + +// --------------------------------------------------------- +// Default menu and CBA key. +// --------------------------------------------------------- +RESOURCE EIK_APP_INFO + { + menubar = r_snifferaihelper_menubar; + cba = R_AVKON_SOFTKEYS_EXIT; + } + +RESOURCE MENU_BAR r_snifferaihelper_menubar + { + titles = + { + }; + } + + +// --------------------------------------------------------- +// r_sniffer_ai_helper_view +// Resource for AiHelper main view +// --------------------------------------------------------- +RESOURCE AVKON_VIEW r_sniffer_ai_helper_view + { + menubar = r_snifferaihelper_menubar; + } + + +//---------------------------------------------------------------------------- +// r_waitnote_connecting +// Connecting waitnote +//---------------------------------------------------------------------------- +RESOURCE DIALOG r_waitnote_connecting + { + flags = EAknWaitNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EWaitNoteConnecting; + control = AVKON_NOTE + { + layout = EWaitLayout; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; + } + + + +//---------------------------------------------------------------------------- +// r_aihelper_localisable_app_info +// Localised application info +//---------------------------------------------------------------------------- +RESOURCE LOCALISABLE_APP_INFO r_aihelper_localisable_app_info + { + short_caption = qtn_sniffer_title; + caption_and_icon = + CAPTION_AND_ICON_INFO + { + caption = qtn_sniffer_title; + icon_file = "Z:"APP_BITMAP_DIR"\\wsficons_aif.mif"; + }; + } + +// END OF FILE diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aihelper/data/wsfaihelper_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/data/wsfaihelper_reg.rss Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource definitions for project AiHelper +* +*/ + + +#include +#include +#include + +UID2 KUidAppRegistrationResourceFile +UID3 0x10281CEB + +RESOURCE APP_REGISTRATION_INFO + { + hidden = KAppIsHidden; + app_file="wsfaihelper"; + localisable_resource_file = APP_RESOURCE_DIR"\\wsfaihelper"; + localisable_resource_id = R_AIHELPER_LOCALISABLE_APP_INFO; + } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aihelper/group/aihelper.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/group/aihelper.mmp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 project AiHelper +* +*/ + + +#include +#include + + +TARGET wsfaihelper.exe +TARGETTYPE exe +UID 0x100039CE 0x10281CEB + +EPOCSTACKSIZE 0x5000 + +CAPABILITY ReadDeviceData NetworkServices NetworkControl ProtServ \ + ReadUserData WriteDeviceData WriteUserData + + + +SOURCEPATH ../src +SOURCE wsfaihelper.cpp +SOURCE wsfaihelperapplication.cpp +SOURCE wsfaihelperappui.cpp +SOURCE wsfaihelperdocument.cpp +SOURCE wsfaihelperview.cpp +SOURCE wsfaihelpercontainer.cpp + + +// own headers +USERINCLUDE ../inc + +// inner API +USERINCLUDE ../../inc + +// private API +USERINCLUDE ../../../inc + + +//Macro to /epoc32 headers +APP_LAYER_SYSTEMINCLUDE + +LIBRARY ws32.lib +LIBRARY euser.lib +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY avkon.lib +LIBRARY apgrfx.lib +LIBRARY eikcore.lib +LIBRARY wsfwlaninfo.lib +LIBRARY wsfmodel.lib +LIBRARY aknskins.lib +LIBRARY eikcoctl.lib +LIBRARY fbscli.lib +LIBRARY egul.lib + +LIBRARY cmmanager.lib +LIBRARY commonengine.lib +LIBRARY commonui.lib +DEBUGLIBRARY flogger.lib + +START RESOURCE ../data/wsfaihelper.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +LANGUAGE_IDS +END + +START RESOURCE ../data/wsfaihelper_reg.rss +DEPENDS wsfaihelper.rsg +TARGETPATH /private/10003a3f/apps +END + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aihelper/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 file for project AiHelper +* +*/ + + +#include + + +PRJ_EXPORTS +../rom/wsfaihelperapp.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wsfaihelperapp.iby) +../rom/wsfaihelperappresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(wsfaihelperappresources.iby) + + +PRJ_MMPFILES +aihelper.mmp + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aihelper/inc/wsfaihelper.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/inc/wsfaihelper.hrh Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource headers for project AiHelper +* +*/ + + +#ifndef WSFAIHELPER_HRH +#define WSFAIHELPER_HRH + + +/** + * View ids for the helper application + */ +enum TWsfViewIds + { + ESnifferAiHelperViewId = 0x1000 + }; + + +/** + * Dialog ids for the helper application + */ +enum TWsfDialogIds + { + EWaitNoteConnecting = 6000 + }; + + +#endif // WSFAIHELPER_HRH diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aihelper/inc/wsfaihelperapplication.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/inc/wsfaihelperapplication.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for AiHelper +* +*/ + + +#ifndef C_WSFAIHELPERAPPLICATION_H +#define C_WSFAIHELPERAPPLICATION_H + +// EXTERNAL INCLUDES +#include + + +// CLASS DEFINITION +/** + * An instance of CWsfAiHelperApplication is the application part of + * the AVKON application framework. + * + * @since S60 5.0 + * @lib wsfaihelper.exe + */ +NONSHARABLE_CLASS( CWsfAiHelperApplication ): public CAknApplication + { + public: // from CAknApplication + + /** + * Returns the application UID value + * @since S60 5.0 + * @return The UID of this application + */ + TUid AppDllUid() const; + + protected: // from CAknApplication + /** + * Creates a CApaDocument object and return a pointer to it + * @since S60 5.0 + * @return A pointer to the created document + */ + CApaDocument* CreateDocumentL(); + }; + +#endif // C_WSFAIHELPERAPPLICATION_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aihelper/inc/wsfaihelperappui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/inc/wsfaihelperappui.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,232 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfAiHelperAppUi +* +*/ + + +#ifndef C_WSFAIHELPERAPPUI_H +#define C_WSFAIHELPERAPPUI_H + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "wsfmodelobserver.h" +#include "wsfstatechangeobserver.h" + + +// FORWARD DECLARATIONS +class TWsfWlanInfo; +class CWsfAiHelperDocument; + + +// CLASS DEFINITION +/** + * An instance of class CWsfApHelperAppUi is the UserInterface part of + * the AVKON application framework + * + * @since S60 5.0 + * @lib wsfaihelper.exe + */ +NONSHARABLE_CLASS( CWsfAiHelperAppUi ): public CAknViewAppUi, + public MWsfModelObserver, + public MWsfStateChangeObserver + { + public: + /** + * Second-phase constructor. + * @since S60 5.0 + */ + void ConstructL(); + + /** + * Constructor + * @since S60 5.0 + */ + CWsfAiHelperAppUi(); + + /** + * Destructor + * @since S60 5.0 + */ + ~CWsfAiHelperAppUi(); + + + public: // from CAknAppUi + /** + * Handle user menu selections + * @since S60 5.0 + * @param aCommand The enumerated code for the option selected + */ + void HandleCommandL( TInt aCommand ); + + + /** + * Processes shell commands. + * @since S60 5.0 + * @param aCommand The shell command sent to the application + * @param aDocumentName The name of the document as specified on + * the command line. + * @param aTail Command line tail + * @return Whether the final value of aDocumentName represents + * an existing file + */ + TBool ProcessCommandParametersL( TApaCommand aCommand, + TFileName& aDocumentName, + const TDesC8& aTail ); + + + public: // new methods + /** + * Returns the handle of application document instance + * @since S60 5.0 + * @return Pointer to the document. Ownership not passed. + */ + CWsfAiHelperDocument* Doc(); + + /** + * Called when the filename to be opened has been resolved + * @since S60 5.0 + */ + void NotifyFileName(); + + /** + * Sends Helper To Background + * @since S60 5.2 + */ + void SendHelperToBackground(); + + + public: // from MWsfModelObserver + + /** + * Called if the launch has been completed successfully + * @since S60 5.0 + */ + void BrowserLaunchCompleteL(); + + /** + * Called if the browser launch failed for some reason + * @since S60 5.0 + * @param aError error code + */ + void BrowserLaunchFailed( TInt aError ); + + /** + * Called when the previously launched browser exits + * @since S60 5.0 + */ + void BrowserExitL(); + + /** + * Notification that connection is going to be created + * @since S60 5.0 + * @param aIapId The IAP id of the connection being created + */ + void ConnectingL( TUint32 aIapId ); + + /** + * Notification that the connection creation process ended + * @since S60 5.0 + * @param aResult The result of the connection creation + */ + void ConnectingFinishedL( TInt aResult ); + + + public: // from MWsfStateChangeObserver + /** + * The current wlan data has changed and it is ready to be retrieved + * @since S60 5.0 + */ + void WlanListChangedL(); + + /** + * Engine error occured + * @since S60 5.0 + * @param aError System wide error code + */ + void NotifyEngineError( TInt aError ); + + /** + * Scanning has been disabled + * @since S60 5.0 + */ + void ScanDisabledL(); + + /** + * Scanning has been enabled + * @since S60 5.0 + */ + void ScanEnabledL(); + + /** + * A WLAN connection has been established + * @since S60 5.0 + */ + void WlanConnectionActivatedL(); + + /** + * A WLAN connection has been closed + * @since S60 5.0 + */ + void WlanConnectionClosedL(); + + /** + * Connection creation process finished + * @since S60 5.2 + * @param aError System wide error code + */ + void ConnectionCreationProcessFinishedL( TInt aError ); + + private: // new methods + + /** + * Called when application launch has been completed + * @since S60 5.0 + * @param aObject Pointer to this object + * @return Zero value means not be called again.(Stops timer) + */ + static TInt LaunchCompletedL( TAny* aObject ); + + /** + * Cleanup function to release the key events suppressing + * @since S60 5.0 + * @param aPtr Pointer for this class + */ + static void ReleaseSuppressingKeyEventsL( TAny* aPtr ); + + + private: // data + /** + * Used to begin accesspoint creation when app launching has completed + * (owned) + */ + CIdle* iIdle; + + /** + * Indicates whether keypress events are suppressed + */ + TBool iSuppressingKeyEvents; + + /** + * IAP creation return value + */ + TInt iResult; + }; + + +#endif // C_WSFAIHELPERAPPUI_H + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aihelper/inc/wsfaihelpercontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/inc/wsfaihelpercontainer.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfAiHelperContainer +* +*/ + + +#ifndef C_WSFAIHELPERCONTAINER_H +#define C_WSFAIHELPERCONTAINER_H + +// EXTERNAL INCLUDES +#include +#include + + +// FORWARD DECLARATIONS +class CWsfAiHelperAppUi; +class MAknsControlContext; + + +// CLASS DEFINITION +/** + * The container class for the helper application UI + * + * @since S60 5.0 + * @lib wsfaihelper.exe + */ +NONSHARABLE_CLASS( CWsfAiHelperContainer ): public CCoeControl + { + public: // Constructors and destructor + + /** + * Second-phase constructor + * @since S60 5.0 + * @param aRect Dimensions of this container + * @param aAppUi Pointer to the AppUi instance (ownership not passed) + */ + void ConstructL( TRect aRect, CWsfAiHelperAppUi* aAppUi ); + + /** + * Destructor + * @since S60 5.0 + */ + ~CWsfAiHelperContainer(); + + + public: // from CCoeControl + + /** + * Responds to changes to the size and position of the contents + * of this control. + * @since S60 5.0 + */ + void SizeChanged(); + + /** + * Used for scalable ui and landscape support. Handles a change to the + * control's resources. + * @since S60 5.0 + * @param aType The type of change. + */ + void HandleResourceChange( TInt aType ); + + + private: // from CCoeControl + + /** + * Retrieves an object of the same type as that encapsulated in aId + * @since S60 5.0 + * @param aId The id of the requested object type + * @return Pointer to the requested object + */ + TTypeUid::Ptr MopSupplyObject( TTypeUid aId ); + + /** + * Draws the control. + * @since S60 5.0 + * @param aRect The region of the control to be redrawn. + */ + void Draw( const TRect& aRect ) const; + + + private: // Data + + /** + * Pointer to the AppUi object (not owned) + */ + CWsfAiHelperAppUi* iAppUi; + + /** + * Pointer to the control context (owned) + */ + MAknsControlContext* iBackGround; + + }; + +#endif // C_WSFAIHELPERCONTAINER_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aihelper/inc/wsfaihelperdocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/inc/wsfaihelperdocument.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfAiHelperDocument +* +*/ + + +#ifndef C_WSFAIHELPERDOCUMENT_H +#define C_WSFAIHELPERDOCUMENT_H + + +// EXTERNAL INCLUDES +#include + + +// INTERNAL INCLUDES +#include "wsfwlaninfo.h" + + +// FORWARD DECLARATIONS +class CWsfAiHelperAppUi; +class CEikApplication; +class CWsfModel; + + +// CLASS DEFINITION +/** + * An instance of class CWsfAiHelperDocument is the Document part of the AVKON + * application framework + * + * @since S60 5.0 + * @lib wsfaihelper.exe + */ +NONSHARABLE_CLASS( CWsfAiHelperDocument ): public CAknDocument + { + public: + + /** + * Factory function + * @since S60 5.0 + * @param aApp Reference to the Application object + * (ownership not passed) + * @return Class instance + */ + static CWsfAiHelperDocument* NewL( CEikApplication& aApp ); + + /** + * Factory function + * @since S60 5.0 + * @param aApp Reference to the Application object + * (ownership not passed) + * @return Class instance + */ + static CWsfAiHelperDocument* NewLC( CEikApplication& aApp ); + + /** + * Destructor + * @since S60 5.0 + */ + ~CWsfAiHelperDocument(); + + + private: + + /** + * Second-phase constructor + * @since S60 5.0 + */ + void ConstructL(); + + /** + * Constructor + * @since S60 5.0 + * @param aApp Reference to the application creating this document + * (ownership not passed) + */ + CWsfAiHelperDocument( CEikApplication& aApp ); + + + public: // from CEikDocument + /** + * Constructs the application UI. + * @since S60 5.0 + * @return AppUi instance + */ + CEikAppUi* CreateAppUiL(); + + + /** + * Restores the document's state from the specified file, + * or creates a new default document. + * @since S60 5.0 + * @param aDoOpen True to open an existing file, + * false to create a new default file + * @param aFilename The path and name of the file to open or create. + * @param aFs File server session to use. + * @return The file store that stores the main document. + */ + CFileStore* OpenFileL( TBool aDoOpen, + const TDesC& aFilename, + RFs& aFs ); + + + public: // new methods + + /** + * Returns reference to the model + * @since S60 5.0 + * @return Reference to the model (ownership not passed) + */ + inline CWsfModel& Model(); + + /** + * Returns reference to the current wlaninfo + * @since S60 5.0 + * @return Reference to the wlaninfo used (ownership not passed) + */ + inline TWsfWlanInfo& WlanInfo(); + + + private: // data + + /** + * Model object (owned) + */ + CWsfModel* iModel; + + /** + * Data of the currently used WLAN network + */ + TWsfWlanInfo iWlanInfo; + + }; + + +#include "wsfaihelperdocument.inl" + +#endif // C_WSFAIHELPERDOCUMENT_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aihelper/inc/wsfaihelperdocument.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/inc/wsfaihelperdocument.inl Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 for CWsfAiHelperDocument +* +*/ + + + +// INLINE FUNCTIONS + +// --------------------------------------------------------------------------- +// CWsfAiHelperDocument::Model +// --------------------------------------------------------------------------- +// +CWsfModel& CWsfAiHelperDocument::Model() + { + return *iModel; + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperDocument::WlanInfo +// --------------------------------------------------------------------------- +// +TWsfWlanInfo& CWsfAiHelperDocument::WlanInfo() + { + return iWlanInfo; + } + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aihelper/inc/wsfaihelperview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/inc/wsfaihelperview.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfAiHelperView +* +*/ + + +#ifndef C_WSFAIHELPERVIEW_H +#define C_WSFAIHELPERVIEW_H + + +// EXTERNAL INCLUDES +#include + + +// FORWARD DECLARATIONS +class CWsfAiHelperAppUi; +class CWsfAiHelperContainer; + + +// CLASS DECLARATION +/** +* Main view class for the AiHelper application +* +* @since S60 5.0 +* @lib wsfaihelper.exe +*/ +NONSHARABLE_CLASS( CWsfAiHelperView ): public CAknView + { + public: // Constructors and destructor + /** + * Factory function + * @since S60 5.0 + * @param aAppUi Pointer to the appui instance (ownership not passed) + * @return Class instance + */ + static CWsfAiHelperView* NewL( CWsfAiHelperAppUi* aAppUi ); + + /** + * Factory function + * @since S60 5.0 + * @param aAppUi Pointer to the appui instance (ownership not passed) + * @return Class instance + */ + static CWsfAiHelperView* NewLC( CWsfAiHelperAppUi* aAppUi ); + + /** + * Destructor + * @since S60 5.0 + */ + ~CWsfAiHelperView(); + + private: // Constructors + + /** + * Constructor + * @since S60 5.0 + * @param aAppUi Pointer to the appui instance (ownership not passed) + */ + CWsfAiHelperView( CWsfAiHelperAppUi* aAppUi ); + + /** + * Second-phase constructor + * @since S60 5.0 + */ + void ConstructL(); + + + private: // From CAknView + + /** + * Returns views id + * @since S60 5.0 + * @return Id of this view + */ + TUid Id() const; + + /** + * Handles a view activation and passes the message of + * type aCustomMessageId + * @since S60 5.0 + * @param aPrevViewId Specifies the view previously active. + * @param aCustomMessageId Specifies the message type. + * @param aCustomMessage The activation message + */ + void DoActivateL( const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage ); + + /** + * View deactivation function + * @since S60 5.0 + */ + void DoDeactivate(); + + /** + * Handle user menu selections + * @since S60 5.0 + * @param aCommand The enumerated code for the option selected + */ + void HandleCommandL( TInt aCommand ); + + + private: // Data + /** + * Pointer to the appui object (not owned) + */ + CWsfAiHelperAppUi* iAppUi; + + /** + * Container object (owned) + */ + CWsfAiHelperContainer* iContainer; + }; + +#endif // C_WSFAIHELPERVIEW_H + +// End of File diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aihelper/rom/wsfaihelperapp.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/rom/wsfaihelperapp.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 AiHelper +* +*/ + + + +#ifndef WSFAIHELPERAPP_IBY +#define WSFAIHELPERAPP_IBY + +#ifdef __PROTOCOL_WLAN + +REM WlanSnifferAiHelperApplication + +#include + + +S60_APP_AIF_RSC(wsfaihelper) + +S60_APP_EXE(wsfaihelper) + +#endif // __PROTOCOL_WLAN + +#endif // WSFAIHELPERAPP_IBY diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aihelper/rom/wsfaihelperappresources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/rom/wsfaihelperappresources.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 AiHelper +* +*/ + + +#ifndef WSFAIHELPERAPPRESOURCES_IBY +#define WSFAIHELPERAPPRESOURCES_IBY + +#ifdef __PROTOCOL_WLAN + +REM WlanSnifferAiHelperApplicationResources + +#include + +S60_APP_RESOURCE(wsfaihelper) + +#endif // __PROTOCOL_WLAN + +#endif // WSFAIHELPERAPPRESOURCES_IBY diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aihelper/src/wsfaihelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/src/wsfaihelper.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 AiHelper entry point +* +*/ + + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "wsfaihelperapplication.h" + + +// --------------------------------------------------------------------------- +// ::NewApplication +// --------------------------------------------------------------------------- +// +CApaApplication* NewApplication() + { + return new CWsfAiHelperApplication; + } + + +// --------------------------------------------------------------------------- +// ::E32Main +// --------------------------------------------------------------------------- +// +TInt E32Main() + { + return EikStart::RunApplication( NewApplication ); + } + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aihelper/src/wsfaihelperapplication.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/src/wsfaihelperapplication.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfAiHelperApplication +* +*/ + + +#include "wsfaihelperdocument.h" +#include "wsfaihelperapplication.h" + + +/** + * UID for the application + */ +static const TUid KUidSnifferAiHelperApp = { 0x10281CEB }; + +// --------------------------------------------------------------------------- +// CWsfAiHelperApplication::CreateDocumentL +// --------------------------------------------------------------------------- +// +CApaDocument* CWsfAiHelperApplication::CreateDocumentL() + { + // Create an Sniffer document, and return a pointer to it + CApaDocument* document = CWsfAiHelperDocument::NewL( *this ); + return document; + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperApplication::AppDllUid +// --------------------------------------------------------------------------- +// +TUid CWsfAiHelperApplication::AppDllUid() const + { + // Return the UID for the Sniffer application + return KUidSnifferAiHelperApp; + } + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aihelper/src/wsfaihelperappui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/src/wsfaihelperappui.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,439 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfAiHelperAppUi +* +*/ + + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// CLASS HEADER +#include "wsfaihelperappui.h" + +// INTERNAL INCLUDES +#include "wsfaihelperdocument.h" +#include "wsfaihelperapplication.h" +#include "wsfmodel.h" +#include "wsfwlaninfo.h" +#include "wsfaihelperview.h" +#include "wsfaihelper.hrh" +#include "wsflogger.h" + + +// CONSTANTS + +// property keys for AiHelper return +static const TUint KWsfAiHelperExitCodeKey = 0; +static const TUint KWsfAiHelperIapIdKey = 1; + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::ConstructL +// --------------------------------------------------------------------------- +// +void CWsfAiHelperAppUi::ConstructL() + { + BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible ); + + iIdle = CIdle::NewL( CActive::EPriorityIdle ); + + // Create stub view for Wizard launching + CWsfAiHelperView* view = CWsfAiHelperView::NewLC( this ); + AddViewL( view ); + CleanupStack::Pop( view ); + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::CWsfAiHelperAppUi +// --------------------------------------------------------------------------- +// +CWsfAiHelperAppUi::CWsfAiHelperAppUi(): + iResult( KErrCancel ) + { + // no implementation required + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::~CWsfAiHelperAppUi +// --------------------------------------------------------------------------- +// +CWsfAiHelperAppUi::~CWsfAiHelperAppUi() + { + delete iIdle; + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::HandleCommandL +// --------------------------------------------------------------------------- +// +void CWsfAiHelperAppUi::HandleCommandL( TInt aCommand ) + { + LOG_ENTERFN( "CWsfAiHelperAppUi::HandleCommandL" ); + LOG_WRITEF( "command = %d", aCommand ); + + if ( iSuppressingKeyEvents ) + { + return; + } + + switch ( aCommand ) + { + case EAknCmdExit: + case EEikCmdExit: + case EAknSoftkeyBack: + case EAknSoftkeyExit: + { + // set the "exit code" value + RProperty::Define( Application()->AppDllUid(), + KWsfAiHelperExitCodeKey, + RProperty::EInt ); + + TInt err = RProperty::Set( Application()->AppDllUid(), + KWsfAiHelperExitCodeKey, + iResult ); + + if ( err == KErrNone ) + { + LOG_WRITEF( "exitcode property set to %d", iResult ); + } + else + { + LOG_WRITEF( "exitcode property setting failed with code = %d", + err ); + User::LeaveIfError( err ); + } + + Exit(); + break; + } + + default:; + } + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::ProcessCommandParametersL +// --------------------------------------------------------------------------- +// +TBool CWsfAiHelperAppUi::ProcessCommandParametersL( + TApaCommand /*aCommand*/, + TFileName& /*aDocumentName*/, + const TDesC8& /*aTail*/ ) + { + return EFalse; + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::NotifyFileName +// --------------------------------------------------------------------------- +// +void CWsfAiHelperAppUi::NotifyFileName() + { + LOG_ENTERFN( "CWsfAiHelperAppUi::NotifyFileName" ); + if ( !iIdle->IsActive() ) + { + iIdle->Start( TCallBack( LaunchCompletedL, this ) ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::Doc +// --------------------------------------------------------------------------- +// +CWsfAiHelperDocument* CWsfAiHelperAppUi::Doc() + { + return static_cast( iDocument ); + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::BrowserLaunchCompleteL +// --------------------------------------------------------------------------- +// +void CWsfAiHelperAppUi::BrowserLaunchCompleteL() + { + LOG_ENTERFN( "CWsfAiHelperAppUi::BrowserLaunchCompleteL" ); + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::BrowserExitL +// --------------------------------------------------------------------------- +// +void CWsfAiHelperAppUi::BrowserExitL() + { + LOG_ENTERFN( "CWsfAiHelperAppUi::BrowserExitL" ); + HandleCommandL( EAknCmdExit ); + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::BrowserLaunchFailed +// --------------------------------------------------------------------------- +// +void CWsfAiHelperAppUi::BrowserLaunchFailed( TInt /*aError*/ ) + { + LOG_ENTERFN( "CWsfAiHelperAppUi::BrowserLaunchFailed" ); + TRAP_IGNORE( HandleCommandL( EAknCmdExit ) ); + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::ConnectingL +// --------------------------------------------------------------------------- +// +void CWsfAiHelperAppUi::ConnectingL( TUint32 /*aIapId*/ ) + { + LOG_ENTERFN( "CWsfAiHelperAppUi::ConnectingL" ); + Doc()->Model().SetConnecting( ETrue ); + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::ConnectingFinishedL +// --------------------------------------------------------------------------- +// +void CWsfAiHelperAppUi::ConnectingFinishedL( TInt aResult ) + { + LOG_ENTERFN( "CWsfAiHelperAppUi::ConnectingFinishedL" ); + if ( Doc()->Model().IsConnecting() ) + { + Doc()->Model().SetConnecting( EFalse ); + } + + if ( aResult ) + { + // show an error note + LOG_WRITE( "showing error note" ); + CErrorUI* errorUi = CErrorUI::NewLC( *iCoeEnv ); + errorUi->ShowGlobalErrorNoteL( aResult ); + CleanupStack::PopAndDestroy( errorUi ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::SendHelperToBackground +// --------------------------------------------------------------------------- +// +void CWsfAiHelperAppUi::SendHelperToBackground() + { + LOG_ENTERFN( "CWsfAiHelperAppUi::SendHelperToBackground" ); + TApaTask task( iEikonEnv->WsSession() ); + task.SetWgId( iEikonEnv->RootWin().Identifier()); + task.SendToBackground(); + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::LaunchCompletedL +// --------------------------------------------------------------------------- +// +TInt CWsfAiHelperAppUi::LaunchCompletedL( TAny* aObject ) + { + LOG_ENTERFN( "CWsfAiHelperAppUi::LaunchCompletedL" ); + User::LeaveIfNull( aObject ); + CWsfAiHelperAppUi* appUi = static_cast( aObject ); + + MWsfModelObserver* observer = static_cast( appUi ); + CWsfModel& model( appUi->Doc()->Model() ); + + model.SetEngineObserver( observer ); + + TWsfWlanInfo* info( &appUi->Doc()->WlanInfo() ); + + if ( !info->Connected() ) + { + // make sure we don't suppress our key events forever + CleanupStack::PushL( TCleanupItem( ReleaseSuppressingKeyEventsL, appUi ) ); + // No appUi key input accepted during IAP connecting & connection test. + appUi->iSuppressingKeyEvents = ETrue; + + TBool setIapProperty = EFalse; + + if ( !info->Known() ) + { + TBool accessPointCreated = EFalse; + + // If not known yet, create an IAP. + TRAPD( accessPointCreatedError, + accessPointCreated = model.CreateAccessPointL( *info, + EFalse ) ); + + // notify user that Disk is full or creation of a WAPI IAP + // is not supported on-the-fly and leave + if ( accessPointCreatedError == KErrDiskFull || + accessPointCreatedError == KErrWlanProtectedSetupSetupLocked ) + { + appUi->ConnectingFinishedL(accessPointCreatedError); + User::Leave(accessPointCreatedError); + } + // just leave because we failed to create accesspoint + else if ( accessPointCreatedError != KErrNone ) + { + User::Leave(accessPointCreatedError); + } + + appUi->SendHelperToBackground(); + + if ( accessPointCreated ) + { + setIapProperty = ETrue; + } + } + else + { + setIapProperty = ETrue; + appUi->iResult = KErrNone; + } + + if ( setIapProperty ) + { + LOG_WRITE( "Set iap Property" ); + // Connected succesfully set IAP's property. + CWsfAiHelperApplication* app = + static_cast( + appUi->Application() ); + + RProperty::Define( app->AppDllUid(), + KWsfAiHelperIapIdKey, + RProperty::EInt ); + + TInt err = RProperty::Set( app->AppDllUid(), + KWsfAiHelperIapIdKey, + info->iIapId ); + + if ( err == KErrNone ) + { + LOG_WRITEF( "IAP id property " + L"set to %d", info->iIapId ); + } + else + { + LOG_WRITEF( "IAP id property setting failed " + L"with code = %d", err ); + User::LeaveIfError( err ); + } + appUi->iResult = KErrNone; + } + // pop cleanup item ReleaseSuppressingKeyEvents + CleanupStack::Pop(); + appUi->iSuppressingKeyEvents = EFalse; + } + + appUi->HandleCommandL( EAknCmdExit ); + + return 0; // Return false (zero) value not be called again. + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::WlanListChangedL +// --------------------------------------------------------------------------- +// +void CWsfAiHelperAppUi::WlanListChangedL() + { + // no implementation required + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::NotifyEngineError +// --------------------------------------------------------------------------- +// +void CWsfAiHelperAppUi::NotifyEngineError( TInt /*aError*/ ) + { + // no implementation required + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::ScanDisabledL +// --------------------------------------------------------------------------- +// +void CWsfAiHelperAppUi::ScanDisabledL() + { + // no implementation required + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::ScanEnabledL +// --------------------------------------------------------------------------- +// +void CWsfAiHelperAppUi::ScanEnabledL() + { + // no implementation required + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::WlanConnectionActivatedL +// --------------------------------------------------------------------------- +// +void CWsfAiHelperAppUi::WlanConnectionActivatedL() + { + // no implementation required + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::WlanConnectionClosedL +// --------------------------------------------------------------------------- +// +void CWsfAiHelperAppUi::WlanConnectionClosedL() + { + // no implementation required + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::ConnectingFinishedL +// --------------------------------------------------------------------------- +// +void CWsfAiHelperAppUi::ConnectionCreationProcessFinishedL( TInt /*aResult*/ ) + { + // no implementation required + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperAppUi::ReleaseSuppressingKeyEventsL +// --------------------------------------------------------------------------- +// +void CWsfAiHelperAppUi::ReleaseSuppressingKeyEventsL( TAny* aPtr ) + { + CWsfAiHelperAppUi* self = + static_cast( aPtr ); + self->iSuppressingKeyEvents = EFalse; + self->HandleCommandL( EAknCmdExit ); + } + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aihelper/src/wsfaihelpercontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/src/wsfaihelpercontainer.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfAiHelperContainer +* +*/ + + + +// EXTERNAL INCLUDES +#include +#include +#include + +// CLASS HEADER +#include "wsfaihelpercontainer.h" + +// INTERNAL INCLUDES +#include "wsfaihelperappui.h" +#include "wsfaihelperdocument.h" +#include "wsfmodelobserver.h" +#include "wsfaihelper.hrh" +#include "wsfmodel.h" +#include "wsflogger.h" + + +// CONSTRUCTION AND DESTRUCTION + + +// --------------------------------------------------------------------------- +// CWsfAiHelperContainer::~CWsfAiHelperContainer +// --------------------------------------------------------------------------- +// +CWsfAiHelperContainer::~CWsfAiHelperContainer() + { + delete iBackGround; + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperContainer::ConstructL +// --------------------------------------------------------------------------- +// +void CWsfAiHelperContainer::ConstructL( TRect aRect, + CWsfAiHelperAppUi* aAppUi ) + { + iAppUi = aAppUi; + iBackGround = CAknsBasicBackgroundControlContext::NewL( + KAknsIIDQsnBgAreaMain, Rect(), EFalse ); + + CreateWindowL(); + SetRect( aRect ); + ActivateL(); + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperContainer::SizeChanged +// --------------------------------------------------------------------------- +// +void CWsfAiHelperContainer::SizeChanged() + { + LOG_ENTERFN( "CWsfAiHelperContainer::SizeChanged" ); + + if ( iBackGround ) + { + delete iBackGround; + iBackGround = NULL; + // Throw away the error + TRAP_IGNORE( iBackGround = CAknsBasicBackgroundControlContext::NewL( + KAknsIIDQsnBgAreaMain, Rect(), EFalse ) ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperContainer::Draw +// --------------------------------------------------------------------------- +// +void CWsfAiHelperContainer::Draw( const TRect& aRect ) const + { + CWindowGc& gc = SystemGc(); + MAknsSkinInstance* skin = AknsUtils::SkinInstance(); + MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); + AknsDrawUtils::Background( skin, cc, this, gc, aRect ); + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperContainer::HandleResourceChange +// --------------------------------------------------------------------------- +// +void CWsfAiHelperContainer::HandleResourceChange( TInt aType ) + { + LOG_ENTERFN( "CWsfAiHelperContainer::HandleResourceChange" ); + CCoeControl::HandleResourceChange( aType ); + + if ( aType == KEikDynamicLayoutVariantSwitch ) + { + TRect mainPaneRect; + AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, + mainPaneRect ); + SetRect( mainPaneRect ); + DrawDeferred(); + } + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperContainer::MopSupplyObject +// --------------------------------------------------------------------------- +// +TTypeUid::Ptr CWsfAiHelperContainer::MopSupplyObject( TTypeUid aId ) + { + LOG_ENTERFN( "CWsfAiHelperContainer::MopSupplyObject" ); + if ( aId.iUid == MAknsControlContext::ETypeId && iBackGround ) + { + return MAknsControlContext::SupplyMopObject( aId, iBackGround ); + } + + return CCoeControl::MopSupplyObject( aId ); + } + + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aihelper/src/wsfaihelperdocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/src/wsfaihelperdocument.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,119 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfAiHelperDocument +* +*/ + + +#include "wsfaihelperappui.h" +#include "wsfaihelperdocument.h" +#include "wsfmodel.h" +#include "wsfwlaninfo.h" + + + +// --------------------------------------------------------------------------- +// CWsfAiHelperDocument::NewL +// --------------------------------------------------------------------------- +// +CWsfAiHelperDocument* CWsfAiHelperDocument::NewL( CEikApplication& aApp ) + { + CWsfAiHelperDocument* self = NewLC( aApp ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperDocument::NewLC +// --------------------------------------------------------------------------- +// +CWsfAiHelperDocument* CWsfAiHelperDocument::NewLC( CEikApplication& aApp ) + { + CWsfAiHelperDocument* self = new (ELeave) CWsfAiHelperDocument( aApp ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperDocument::ConstructL +// --------------------------------------------------------------------------- +// +void CWsfAiHelperDocument::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperDocument::CWsfAiHelperDocument +// --------------------------------------------------------------------------- +// +CWsfAiHelperDocument::CWsfAiHelperDocument( CEikApplication& aApp ): + CAknDocument( aApp ) + { + // no implementation required + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperDocument::~CWsfAiHelperDocument +// --------------------------------------------------------------------------- +// +CWsfAiHelperDocument::~CWsfAiHelperDocument() + { + delete iModel; + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperDocument::CreateAppUiL +// --------------------------------------------------------------------------- +// +CEikAppUi* CWsfAiHelperDocument::CreateAppUiL() + { + // Create the application user interface, and return a pointer to it, + // the framework takes ownership of this object + CWsfAiHelperAppUi* appUi = new (ELeave) CWsfAiHelperAppUi; + iModel = CWsfModel::NewL( *appUi, EFalse ); + + iModel->EnableScanL(); + return appUi; + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperDocument::OpenFileL +// --------------------------------------------------------------------------- +// +CFileStore* CWsfAiHelperDocument::OpenFileL( TBool /*aDoOpen*/, + const TDesC& aFilename, + RFs &/*aFs*/ ) + { + // Read the afilename arg + // Take that into a TWlanInfo and start creation of accesspoint + TPckgBuf info; + + info.Copy( aFilename.Left( sizeof( TWsfWlanInfo ) ) ); + + iWlanInfo = info(); + + static_cast( iAppUi )->NotifyFileName(); + + return NULL; + } + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aihelper/src/wsfaihelperview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/src/wsfaihelperview.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfAiHelperView +* +*/ + + + +// EXTERNAL INCLUDES +#include +#include + +// CLASS HEADER +#include "wsfaihelperview.h" + +// INTERNAL INCLUDES +#include "wsfaihelperappui.h" +#include "wsfmodelobserver.h" +#include "wsfaihelper.hrh" +#include "wsfmodel.h" +#include "wsfaihelperdocument.h" +#include "wsfaihelpercontainer.h" +#include "wsflogger.h" + + + +// CONSTRUCTION AND DESTRUCTION + +// --------------------------------------------------------------------------- +// CWsfAiHelperView::NewL +// --------------------------------------------------------------------------- +// +CWsfAiHelperView* CWsfAiHelperView::NewL( CWsfAiHelperAppUi* aAppUi ) + { + CWsfAiHelperView* self = CWsfAiHelperView::NewLC( aAppUi ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperView::NewLC +// --------------------------------------------------------------------------- +// +CWsfAiHelperView* CWsfAiHelperView::NewLC( CWsfAiHelperAppUi* aAppUi ) + { + CWsfAiHelperView* self = new (ELeave) CWsfAiHelperView( aAppUi ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperView::CWsfAiHelperView +// --------------------------------------------------------------------------- +// +CWsfAiHelperView::CWsfAiHelperView( CWsfAiHelperAppUi* aAppUi ): + CAknView(), + iAppUi( aAppUi ) + { + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperView::~CWsfAiHelperView +// --------------------------------------------------------------------------- +// +CWsfAiHelperView::~CWsfAiHelperView() + { + delete iContainer; + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperView::ConstructL +// --------------------------------------------------------------------------- +// +void CWsfAiHelperView::ConstructL() + { + BaseConstructL( R_SNIFFER_AI_HELPER_VIEW ); + + iContainer = new (ELeave) CWsfAiHelperContainer(); + iContainer->ConstructL( ClientRect(), iAppUi ); + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperView::Id +// --------------------------------------------------------------------------- +// +TUid CWsfAiHelperView::Id() const + { + return TUid::Uid( ESnifferAiHelperViewId ); + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperView::DoActivateL +// --------------------------------------------------------------------------- +// +void CWsfAiHelperView::DoActivateL( const TVwsViewId& /*aPrevViewId*/, + TUid /*aCustomMessageId*/, + const TDesC8& /*aCustomMessage*/ ) + { + LOG_ENTERFN( "CWsfAiHelperView::DoActivateL" ); + AppUi()->AddToStackL( *this, iContainer ); + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperView::DoDeactivate +// --------------------------------------------------------------------------- +// +void CWsfAiHelperView::DoDeactivate() + { + LOG_ENTERFN( "CWsfAiHelperView::DoDeactivate" ); + if ( iContainer ) + { + AppUi()->RemoveFromStack( iContainer ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperView::HandleCommandL +// --------------------------------------------------------------------------- +// +void CWsfAiHelperView::HandleCommandL( TInt aCommand ) + { + LOG_ENTERFN( "CWsfAiHelperView::HandleCommandL" ); + AppUi()->HandleCommandL( aCommand ); + } + + +// End of File diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/data/10281cae.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/data/10281cae.rss Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECOM plugin resource file for AiPlugin. +* +*/ + +// INCLUDES +#include "wsfaipluginuids.hrh" +#include +#include + +RESOURCE REGISTRY_INFO registry_info + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + // UID for the DLL + dll_uid = AI_UID_ECOM_DLL_CONTENTPUBLISHER_WIZARDPLUGIN; + + // Interface info array + interfaces = + { + INTERFACE_INFO + { + // UID of the implemented interface + interface_uid = HS_UID_ECOM_INTERFACE_CONTENTPUBLISHER; + + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = + AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_WIZARDPLUGIN; + version_no = 1; + display_name = "WizardPlugin"; + default_data = ""; + opaque_data = " "; + rom_only = 1; + } + }; + } + }; + } + +// End of File. diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/data/wsfaipluginrsc.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/data/wsfaipluginrsc.rss Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,381 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource definitions for project AiPlugin +* +*/ + + + +NAME WLPL + +#include +#include +#include +#include +#include +#include + +#include +#include + + +RESOURCE RSS_SIGNATURE { } + + +RESOURCE TBUF16 { buf=""; } + + + +// -------------------------------------------------------------------------- +// Localised strings +// -------------------------------------------------------------------------- +// +RESOURCE TBUF r_qtn_sniffer_plug_in_refreshing + { + buf = qtn_sniffer_plug_in_refreshing; + } + +RESOURCE TBUF r_qtn_sniffer_plug_in_connecting + { + buf = qtn_sniffer_plug_in_connecting; + } + +RESOURCE TBUF r_qtn_status_no_wlans_available + { + buf = qtn_sniffer_plug_in_no_wlans_found; + } + +RESOURCE TBUF r_qtn_sniffer_plug_in_scanning_off + { + buf = qtn_sniffer_plug_in_scanning_off; + } + +RESOURCE TBUF r_qtn_sniffer_plug_in_ssid_found + { + buf = qtn_sniffer_plug_in_ssid_found; + } + +RESOURCE TBUF r_qtn_sniffer_plug_in_unknown_ssid_found + { + buf = qtn_sniffer_plug_in_unknown_wlan_found; + } + +RESOURCE TBUF r_qtn_sniffer_plug_in_unknown_ssids_found + { + buf = qtn_sniffer_plug_in_unknown_wlans_found; + } + +RESOURCE TBUF r_qtn_sniffer_plug_in_connected_to_ssid + { + buf = qtn_sniffer_plug_in_iap_connected; + } + +RESOURCE TBUF r_qtn_wlan_manual_ssid_input + { + buf = qtn_wlan_manual_ssid_input; + } + +RESOURCE TBUF r_qtn_msk_sniffer_activate + { + buf = qtn_msk_sniffer_activate; + } + +RESOURCE TBUF r_qtn_ai_wizard_title + { + buf = qtn_ai_wizard_title; + } + +RESOURCE TBUF r_qtn_wlan_info_no_networks_found + { + buf = qtn_wlan_info_no_networks_found; + } + +RESOURCE TBUF r_qtn_wlan_info_connection_already_active + { + buf = qtn_wlan_info_connection_already_active; + } + +RESOURCE TBUF r_qtn_sniffer_plug_in_connected_to + { + buf = qtn_sniffer_plug_in_connected_to; + } + +RESOURCE TBUF r_qtn_sniffer_plug_in_wlan_network_found + { + buf = qtn_sniffer_plug_in_wlan_network_found; + } + +RESOURCE TBUF r_ssid + { + buf = L"'%U[16]'"; + } + + +// -------------------------------------------------------------------------- +// r_qtn_aiplugin_options_offline_items +// Options menu items for 'Offline' state +// -------------------------------------------------------------------------- +// +RESOURCE ARRAY r_qtn_aiplugin_options_offline_items + { + items = + { + LBUF + { + txt = qtn_sniffer_opt_start_web_browsing; + }, + LBUF + { + txt = qtn_sniffer_opt_connect; + }, + LBUF + { + txt = qtn_sniffer_plug_in_options_search_wlan_networks; + }, + LBUF + { + txt = qtn_sniffer_opt_set_scanning_off; + } + }; + } + + +// -------------------------------------------------------------------------- +// r_qtn_aiplugin_options_connected_items +// Options menu items for 'Connected' state +// -------------------------------------------------------------------------- +// +RESOURCE ARRAY r_qtn_aiplugin_options_connected_items + { + items = + { + LBUF + { + txt = qtn_sniffer_opt_start_web_browsing; + }, + LBUF + { + txt = qtn_sniffer_opt_disconnect_wlan; + } + }; + } + + +// -------------------------------------------------------------------------- +// r_qtn_aiplugin_options_connecting_items +// Options menu items for 'Connecting' state +// -------------------------------------------------------------------------- +// +RESOURCE ARRAY r_qtn_aiplugin_options_connecting_items + { + items = + { + LBUF + { + txt = qtn_sniffer_opt_disconnect_wlan; + } + }; + } + + +// -------------------------------------------------------------------------- +// r_qtn_aiplugin_options_browsing_items +// Options menu items for 'Browsing' state +// -------------------------------------------------------------------------- +// +RESOURCE ARRAY r_qtn_aiplugin_options_browsing_items + { + items = + { + LBUF + { + txt = qtn_sniffer_opt_continue_web_browsing; + }, + LBUF + { + txt = qtn_sniffer_opt_disconnect_wlan; + } + }; + } + + +// -------------------------------------------------------------------------- +// r_qtn_aiplugin_options_offline +// Options menu in 'Offline' state +// -------------------------------------------------------------------------- +// +RESOURCE AVKON_LIST_QUERY r_qtn_aiplugin_options_offline + { + flags = EGeneralQueryFlags; + softkeys = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control = AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_qtn_aiplugin_options_offline_items; + }; + }; + } + }; + } + + +// -------------------------------------------------------------------------- +// r_qtn_aiplugin_options_connected +// Options menu in 'Connected' state +// -------------------------------------------------------------------------- +// +RESOURCE AVKON_LIST_QUERY r_qtn_aiplugin_options_connected + { + flags = EGeneralQueryFlags; + softkeys = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control = AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_qtn_aiplugin_options_connected_items; + }; + }; + } + }; + } + + +// -------------------------------------------------------------------------- +// r_qtn_aiplugin_options_connecting +// Options menu in 'Connecting' state +// -------------------------------------------------------------------------- +// +RESOURCE AVKON_LIST_QUERY r_qtn_aiplugin_options_connecting + { + flags = EGeneralQueryFlags; + softkeys = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control = AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_qtn_aiplugin_options_connecting_items; + }; + }; + } + }; + } + + +// -------------------------------------------------------------------------- +// r_qtn_aiplugin_options_browsing +// Options menu in 'Browsing' state +// -------------------------------------------------------------------------- +// +RESOURCE AVKON_LIST_QUERY r_qtn_aiplugin_options_browsing + { + flags = EGeneralQueryFlags; + softkeys = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control = AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_qtn_aiplugin_options_browsing_items; + }; + }; + } + }; + } + + +// -------------------------------------------------------------------------- +// r_qtn_plugin_search_wlan_networks +// Search for wlan networks query +// -------------------------------------------------------------------------- +// +RESOURCE AVKON_LIST_QUERY r_qtn_plugin_search_wlan_networks + { + flags = EGeneralQueryFlags; + softkeys = r_qtn_plugin_search_wlan_network_buttons; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control = AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSingleGraphicPopupMenuListBox; + heading = qtn_wlan_prmpt_select_network; + listbox = AVKON_LIST_QUERY_LIST + { + }; + }; + } + }; + } + + +// -------------------------------------------------------------------------- +// r_qtn_plugin_search_wlan_network_buttons +// CBA buttons for search for wlan networks query +// -------------------------------------------------------------------------- +// +RESOURCE CBA r_qtn_plugin_search_wlan_network_buttons + { + buttons = + { + CBA_BUTTON { id = EEikBidOk; txt = qtn_sniffer_softkey_connect; }, + CBA_BUTTON { id = EEikBidCancel; txt = text_softkey_cancel; }, + CBA_BUTTON { id = EEikBidOk; txt = ""; } + }; + } + + +//---------------------------------------------------------------------------- +// r_restart_browsing_confirmation_query +// Query to restart browser with WLAN +//---------------------------------------------------------------------------- +RESOURCE DIALOG r_restart_browsing_confirmation_query + { + flags=EGeneralQueryFlags; + buttons=R_AVKON_SOFTKEYS_YES_NO__YES; + items= + { + DLG_LINE + { + type=EAknCtQuery; + id = EGeneralQuery; + control= AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + }; + } + }; + } + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/group/aiplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/group/aiplugin.mmp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,118 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 project AiPlugin +* +*/ + + +#include +#include + +#include "../inc/wsfaipluginuids.hrh" + +TARGET wsfaiplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D AI_UID_ECOM_DLL_CONTENTPUBLISHER_WIZARDPLUGIN + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE wsfaipluginproxy.cpp +SOURCE wsfaiplugin.cpp +SOURCE wsficonarraycreator.cpp +SOURCE wsfsearchwlansdialog.cpp +SOURCE wsfaimodel.cpp +SOURCE wsfaicontroller.cpp +SOURCE wsfaiview.cpp +SOURCE wsfactivewaiter.cpp +SOURCE wsfdbobserver.cpp +SOURCE wsfwlanlistactivewrapper.cpp +SOURCE wsfrefreshscanactivewrapper.cpp +SOURCE wsfdisconnectactivewrapper.cpp +SOURCE wsfconnectactivewrapper.cpp +SOURCE wsfactivewrappers.cpp +SOURCE wsflaunchaihelperactivewrapper.cpp + + +// Plugin's own resources. +START RESOURCE ../data/wsfaipluginrsc.rss +HEADER +TARGETPATH RESOURCE_FILES_DIR +LANGUAGE_IDS +END + +//ECOM resource definition +START RESOURCE ../data/10281cae.rss +TARGET wsfaiplugin.rsc +LANGUAGE_IDS +END + + +// own headers +USERINCLUDE ../inc + +// inner API +USERINCLUDE ../../inc + +// private API +USERINCLUDE ../../../inc + + +//Macro to /epoc32 headers +//MW_LAYER_SYSTEMINCLUDE is not enough because of +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY efsrv.lib //TParse + +LIBRARY bafl.lib // BaflUtils +LIBRARY Cone.lib + +LIBRARY AknSkins.lib +LIBRARY egul.lib + +LIBRARY AknIcon.lib +LIBRARY Avkon.lib + +LIBRARY aiutils.lib + +LIBRARY commonengine.lib //stringloader +LIBRARY eikdlg.lib +LIBRARY eikcore.lib +LIBRARY eikctl.lib +LIBRARY eikcoctl.lib + +LIBRARY wsfwlaninfo.lib +LIBRARY wsfwlaninfosorting.lib +LIBRARY wsfclient.lib +LIBRARY wsfmodel.lib +LIBRARY apgrfx.lib +LIBRARY commonui.lib +LIBRARY connmon.lib +LIBRARY apparc.lib +LIBRARY charconv.lib +LIBRARY COMMSDAT.lib +LIBRARY cmmanagerdatabase.lib +LIBRARY cmmanager.lib +LIBRARY centralrepository.lib +LIBRARY FeatMgr.lib +LIBRARY connectionuiutilities.lib + +DEBUGLIBRARY flogger.lib + +// End of File. + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 file for project AiPlugin +* +*/ + + +#include + + +PRJ_PLATFORMS +DEFAULT + + +PRJ_EXPORTS +// export localised loc file +../loc/wsfaiplugin.loc MW_LAYER_LOC_EXPORT_PATH(wsfaiplugin.loc) + +// IBY +../rom/wsfaiplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wsfaiplugin.iby) +../rom/wsfaipluginresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(wsfaipluginresources.iby) + + +PRJ_MMPFILES +aiplugin.mmp + + +// End of file + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/inc/wsfactivewaiter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfactivewaiter.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfActiveWaiter +* +*/ + + +#ifndef C_WSFACTIVEWAITER_H +#define C_WSFACTIVEWAITER_H + +// EXTERNAL INCLUDES +#include + + +// CLASS DEFINITION +/** + * CWsfActiveWaiter class, + * an active object to replace User::WaitForRequest() + * + * Usage: + * @code + * CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewL(); + * CleanupStack::PushL( waiter ); + * server.AsyncFunction( waiter->iStatus ); + * if ( waiter->WaitForRequest() == KErrNone ) + * { + * // handle success + * } + * else + * { + * // handle failure + * } + * CleanupStack::PopAndDestroy( waiter ); + * @endcode + * + * @lib wsfserver.exe + * @since S60 5.0 + */ +NONSHARABLE_CLASS( CWsfActiveWaiter ): public CActive + { + public: + /** + * Factory function + * @since S60 5.0 + * @return CWsfActiveWaiter instance. + */ + static CWsfActiveWaiter* NewL(); + + /** + * Factory function + * @since S60 5.0 + * @return CWsfActiveWaiter instance. + */ + static CWsfActiveWaiter* NewLC(); + + /** + * Destructor + * @since S60 5.0 + */ + virtual ~CWsfActiveWaiter(); + + protected: + /** + * Constructor + * @since S60 5.0 + */ + CWsfActiveWaiter(); + + protected: // from CActive + + /** + * Implements cancellation of an outstanding request. + * @since S60 5.0 + */ + void DoCancel(); + + /** + * Handles an active object's request completion event. + * @since S60 5.0 + */ + void RunL(); + + public: // new methods + /** + * Waits for its TRequestStatus to be completed + * @since S60 5.0 + * @return Error code returned from server after request is completed + */ + TInt WaitForRequest(); + + protected: // data + /** + * Nested waitloop + */ + CActiveSchedulerWait iWait; + }; + +#endif // C_WSFACTIVEWAITER_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/inc/wsfactivewrappers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfactivewrappers.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies 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 CWsfActiveWrappers. + * + */ + + + +#ifndef WSFACTIVEWRAPPERS_H +#define WSFACTIVEWRAPPERS_H + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "wsfcommon.h" +#include "wsfaicontroller.h" +#include "wsfmodel.h" + +// FORWARD DECLARATIONS +class CWsfWLANListActiveWrapper; +class CWsfRefreshScanActiveWrapper; +class CWsfDisconnectActiveWrapper; +class CWsfConnectActiveWrapper; +class CWsfLaunchAiHelperActiveWrapper; + +// CLASS DECLARATION + +/** + * Active object helper class that capsulates active wrapper classes + * + * @lib wsfaiplugin.lib + * @since S60 v5.2 + * + */ +class CWsfActiveWrappers : public CBase + { +public: + // Constructors and destructor + + /** + * Destructor. + * @since S60 5.2 + */ + ~CWsfActiveWrappers(); + + /** + * Two-phased constructor. + * @since S60 5.2 + */ + static CWsfActiveWrappers* NewL( CWsfModel* aModel, + TWsfAiController &aController ); + + /** + * Two-phased constructor. + * @since S60 5.2 + */ + static CWsfActiveWrappers* NewLC(CWsfModel* aModel, + TWsfAiController &aController ); + +public: + + /** + * Starts disconnecting + * @since S60 5.2 + */ + void Disconnect(); + + /** + * Starts connecting + * @since S60 5.2 + * @param aIapId WLAN IAP id to connect to. + * @param aConnectOnly ETrue if Connect selected + * @param aPersistence Persistence property of the IAP + */ + void Connect( TUint aIapID, TBool aConnectOnly, + TWsfIapPersistence aPersistence ); + + /** + * Starts refresh scan + * @since S60 5.2 + */ + void RefreshScan(); + + /** + * Starts wlan list refreshing + * @since S60 5.2 + * @param aStarUp is this called called from plugin start up + */ + void RefreshWLANList( TBool aStarUp ); + + /** + * Starts launching of ai helper + * @since S60 5.2 + * @param aWlanInfo The WlanInfo object to be passed to the helper app + * @param aConnectOnly ETrue if we are only connecting, + * EFalse if we should also launch the browser + * @param aTestAccessPoint ETrue if ICT is executed, + * EFalse if ICT is not executed + */ + void LaunchHelperApplicationL( TWsfWlanInfo& aInfo, TBool aConnectOnly, + TBool aTestAccessPoint ); + + /** + * Returns the list of found WLANs. + * Ownership not passed. + * @since S60 5.2 + * @return Array of WLANs + */ + CWsfWlanInfoArray* GetWLANList(); + + /** + * Returns the connected wlan network + * @since S60 5.2 + * @return TWsfWlanInfo + */ + TWsfWlanInfo GetConnectedWLANNetwork(); + +private: + + /** + * Constructor for performing 1st stage construction + */ + CWsfActiveWrappers(); + + /** + * Constructor for performing 2nd stage construction + */ + void ConstructL( CWsfModel* aModel, TWsfAiController &aController ); + +private: + // Data + + /** + * Pointer to CWsfWLANListActiveWrapper + * Own. + */ + CWsfWLANListActiveWrapper* iWLANListActiveWrapper; + + /** + * Pointer to CWsfRefreshScanActiveWrapper + * Own. + */ + CWsfRefreshScanActiveWrapper* iRefreshScanActiveWrapper; + + /** + * Pointer to CWsfDisconnectActiveWrapper + * Own. + */ + CWsfDisconnectActiveWrapper* iDisconnectActiveWrapper; + + /** + * Pointer to CWsfConnectActiveWrapper + * Own. + */ + CWsfConnectActiveWrapper* iConnectActiveWrapper; + + /** + * Pointer to CWsfLaunchAiHelperActiveWrapper + * Own. + */ + CWsfLaunchAiHelperActiveWrapper* iLaunchAiHelperActiveWrapper; + + }; + +#endif // WSFACTIVEWRAPPERS_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/inc/wsfaicontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaicontroller.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,380 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for TWsfAiController +* +*/ + +#ifndef T_WSFAICONTROLLER_H +#define T_WSFAICONTROLLER_H + +// EXTERNAL INCLUDES +#include +#include +#include + +// INTERNAL INCLUDES +#include "wsfwlaninfo.h" +#include "wsfstatechangeobserver.h" +#include "wsfmodelobserver.h" + + +// FORWARD DECLARATIONS +class CWsfModel; +class CWsfAiModel; +class MWsfAiUiObserver; +class TWsfWlanInfo; +class CWsfWlanInfoArray; +class CWsfDbObserver; +class CWsfActiveWrappers; + + +/** + * The controller class of the component. All functionality is reached + * through this class and all needed events are observed by this. + * + * @lib wsfaiplugin.lib + * @since S60 v5.0 + */ + +NONSHARABLE_CLASS( TWsfAiController ): public MWsfStateChangeObserver, + public MWsfModelObserver + { + public: // Constructors + + /** + * Default C++ constructor + * @since S60 5.0 + */ + TWsfAiController(); + + public: // New methods + + /** + * DeInitialization for this class + */ + void DeInitializeL(); + + /** + * PreInitialization for this class (set the models references) + * @since S60 5.0 + * @param aModel applicaton level model reference + * @param aAiModel model reference of AiPlugin + * @param aActiveWrappers reference of wrappers holder + */ + void InitializeL( CEikonEnv* aEnv, CWsfModel* aModel, + CWsfAiModel* aAiModel, CWsfDbObserver* aObserver, + CWsfActiveWrappers* aActiveWrappers ); + + /** + * Set the UI for the controller + * @since S60 5.0 + * @param aUi reference to AiPlugin UI control + */ + void SetUi( MWsfAiUiObserver& aUi ); + + + /** + * Handles keypresses coming from container + * @since S60 5.0 + */ + void HandleSelectionKeyL(); + + /** + * Start the sequential scanning for wlans + * @since S60 5.0 + */ + void EnableScanL(); + + /** + * Stop the sequential scanning for wlans + * @since S60 5.0 + */ + void DisableScanL(); + + /** + * Start initial refresh + * to the AI model + * @since S60 5.0 + */ + void StartupRefresh(); + + /** + * Propagates the network data from the engine + * to the AI model + * @since S60 5.2 + */ + void StartupRefreshDataReadyL(); + + /** + * Refreshes the refreshing icon + * @since S60 5.0 + */ + void RefreshRefreshingL(); + + /** + * Refreshes the connecting icon + * @since S60 5.2 + */ + void RefreshConnectingL(); + + /** + * Propagates the network data from the engine + * to the AI model + * @since S60 5.2 + */ + void WlanListDataReadyL(); + + /** + * Connect to the given wlan + * @since S60 5.2 + * @param aInfo Wlaninfo to connect with + * @param aConnectOnly ETrue if we are only connecting, + * EFalse if we should also launch the browser + * @param aTestAccessPoint ETrue if ICT is executed, + * EFalse if ICT is not executed + */ + void ConnectL( TWsfWlanInfo& aInfo, TBool aConnectOnly, + TBool aTestAccessPoint ); + + + public: // From MWsfStateChangeObserver + + /** + * The current wlan data has changed and it is ready to be retrieved + * @since S60 5.0 + */ + void WlanListChangedL(); + + /** + * Engine error occured + * @since S60 5.0 + * @param aError System wide error code + */ + void NotifyEngineError( TInt aError ); + + /** + * Scanning has been disabled + * @since S60 5.0 + */ + void ScanDisabledL(); + + /** + * Scanning has been enabled + * @since S60 5.0 + */ + void ScanEnabledL(); + + /** + * A WLAN connection has been established + * @since S60 5.0 + */ + void WlanConnectionActivatedL(); + + /** + * A WLAN connection has been closed + * @since S60 5.0 + */ + void WlanConnectionClosedL(); + + /** + * Connection creation process finished + * @since S60 5.2 + * @param aError System wide error code + */ + void ConnectionCreationProcessFinishedL( TInt aError ); + + + public: //From MWsfModelObserver + + /** + * Called if the launch has been completed successfully + * @since S60 5.0 + */ + void BrowserLaunchCompleteL(); + + /** + * Called if the browser launch failed for some reason + * @since S60 5.0 + * @param aError error code + */ + void BrowserLaunchFailed( TInt aError ); + + /** + * Called when the previously launched browser exits + * @since S60 5.0 + */ + void BrowserExitL(); + + /** + * Notification that connection is going to be created + * @since S60 5.0 + * @param aIapId The IAP id of the connection being created + */ + void ConnectingL( TUint32 aIapId ); + + /** + * Notification that the connection creation process ended + * @since S60 5.0 + * @param aResult The result of the connection creation + */ + void ConnectingFinishedL( TInt aResult ); + + private: + + /* + * Start web browsing with the given wlaninfo + * @since S60 5.0 + * @param aInfo Wlaninfo to connect with + */ + void StartBrowsingL( TWsfWlanInfo& aInfo ); + + /* + * Start web browser with the given wlaninfo + * @since S60 5.2 + * @param aInfo Wlaninfo to connect with + */ + void StartWebBrowserL( TWsfWlanInfo& aInfo ); + + /** + * Cleanup function to release connecting state + * @param aPtr Pointer for this class + */ + static void CleanUpConnectingL( TAny* aPtr ); + + /* + * Brings browser to the foreground + * @since S60 5.0 + */ + void ContinueBrowsingL(); + + /* + * Launches a listquerydialog which holds all available wlans. + * @since S60 5.0 + * @param aInfo The wlaninfo resulting from the selection if + * no error/cancellation occured + * @return ETrue if a valid network was selected, EFalse otherwise + */ + TBool LaunchSearchDialogL( TWsfWlanInfo& aInfo ); + + /* + * Trapped routine of LaunchSearchDialogL + * @param - aSelectedItem which list item was selected + * @return - ETrue if connection should be made, otherwise EFalse + */ + TBool DoLaunchSearchDialogL( TInt& aSelectedItem ); + + /* + * Refreshes the current ui when the ui changes + */ + void RefreshUiL(); + + /** + * Handle error event + * @since S60 5.0 + * @param aError System wide error code + */ + void DoHandleEngineErrorL( TInt aError ); + + /** + * Checks whether the browser is using the currently active WLAN + * connection (if any) + * @since S60 5.0 + * @return ETrue if there is a WLAN connection and browser is using it, + * EFalse otherwise + */ + TBool IsWlanUsedByBrowserL(); + + /** + * Handle MSK if not connected + * @since S60 5.0 + */ + void HandleMskIfOfflineL(); + + /** + * Handle MSK if connected to a WLAN + * @since S60 5.0 + */ + void HandleMskIfConnectedL(); + + /** + * Handle MSK if connecting to a WLAN + * @since S60 5.0 + */ + void HandleMskIfConnectingL(); + + /** + * Handle MSK if connected and browser is using the connection + * @since S60 5.0 + */ + void HandleMskIfBrowsingL(); + + + private: // data + + /** + * Handle to Eikon environment. + * Own. + */ + CEikonEnv* iEnv; + + /** + * Cache of the used info + */ + TWsfWlanInfo iUsedInfo; + + /** + * Reference to Wlan array + */ + CWsfWlanInfoArray* iInfoArray; + + /** + * Reference to Model + */ + CWsfModel* iModel; + + /** + * Reference to Active Idle plugin's Model + */ + CWsfAiModel* iAiModel; + + /** + * A pointer to active idle plugin ui control observer instance + */ + MWsfAiUiObserver* iUi; + + /** + * Cache of the connected WLAN data + */ + TWsfWlanInfo iConnectedWlan; + + /** + * The Database change observer + */ + CWsfDbObserver* iDbObserver; + + /** + * Indicates whether Connect or Start Web browsing was selected + */ + TBool iConnectOnly; + + /** + * A pointer to CWsfActiveWrappers + */ + CWsfActiveWrappers* iActiveWrappers; + + }; + +#endif // T_WSFAICONTROLLER_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/inc/wsfaicontrollercmds.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaicontrollercmds.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: TWsfAiController's commands +* +*/ + +#ifndef WSFAICONTROLLERCMDS_H +#define WSFAICONTROLLERCMDS_H + +/** + * Scanning on, not connected + */ +enum TWsfAiOffline + { + EAiOfflineStartBrowsing, + EAiOfflineConnect, + EAiOfflineSearchWlans, + EAiOfflineDisableScan + }; + + +/** + * Scanning on, connected but browser not active or not using WLAN + */ +enum TWsfAiConnected + { + EAiConnectedStartBrowsing, + EAiConnectedDisconnect + }; + + +/** + * Scanning on, connecting + */ +enum TWsfAiConnecting + { + EAiConnectingDisconnect + }; + + +/** + * Scanning on, connected and browser is using the connected WLAN + */ +enum TWsfAiBrowsing + { + EAiBrowsingContinueBrowsing, + EAiBrowsingDisconnect + }; + + + +#endif // WSFAICONTROLLERCMDS_H + + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/inc/wsfaimodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaimodel.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,358 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfAiModel +* +*/ + + +#ifndef C_WSFAIMODEL_H +#define C_WSFAIMODEL_H + +// EXTERNAL INCLUDES +#include +#include +#include "wsfwlaninfo.h" + +// FORWARD DECLARATIONS +class CWsfWlanInfoArray; +class CWsfWlanInfoArrayVisitor; +class CCoeEnv; +class CAknIconArray; +class CGulIcon; + +//class TWsfWlanInfo; + +/** + * The model part. It holds the list of available WLANs and creates the + * suitable texts and icons to display. + * + * @lib wsfaiplugin.lib + * @since S60 v5.0 + */ +class CWsfAiModel : public CBase + { +public: // Constructors and destructor + + /** + * Two-phased constructor + * @since S60 5.0 + * @return instance of CWsfAiModel class + */ + static CWsfAiModel* NewL(); + + /** + * Two-phased constructor. Leaves the object on CleanupStack + * @since S60 5.0 + * @return instance of CWsfAiModel class + */ + static CWsfAiModel* NewLC(); + + /** + * Destructor of CWsfAiModel class + * @since S60 5.0 + */ + ~CWsfAiModel(); + +private: // Constructors + + /** + * Default C++ constructor + * @since S60 5.0 + */ + CWsfAiModel(); + + /** + * 2nd phase constructor + * @since S60 5.0 + */ + void ConstructL(); + +public: // New methods + + /** + * Creates array for the listbox, it contains a formatted array of WLANs. + * @param aWlanList - Array of WLAN that will be formatted. + * @return Formatted WLAN list (Ownership not passed) + */ + CDesCArrayFlat* FormatWlanListL( CWsfWlanInfoArray* aWlanList, const TBool aUIPrioritySort ); + + /* + * Returns WLAN list that has already formatted + * @return Formatted WLAN list (Ownership not passed) + */ + CDesCArrayFlat* GetWlanList(); + + /** + * Returns a pointerarray for TWsfWlanInfo items. + * @return non-formatted WLAN list (Ownership not passed) + */ + CWsfWlanInfoArray* GetInfoArray(); + + /** + * Format the WlanList for one-line + * @param aWlanList - Array of WLAN that will be formatted. + * @return Formatted WLAN list (Ownership not passed) + */ + CDesCArrayFlat* FormatSingleLineWlanListL( + CWsfWlanInfoArray* aWlanList ); + + /** + * Load and format the refreshing information for the WLAN list + * @return Formatted WLAN list (Ownership not passed) + */ + CDesCArrayFlat* FormatRefreshingL(); + + /** + * Load and format the connecting information for the WLAN list + * @return Formatted WLAN list (Ownership not passed) + */ + CDesCArrayFlat* FormatConnectingL(); + + /** + * Appends icons of customer favourite networks to the given array + * @param aIconArray The icon array to which brand icons + * should be appended + */ + void AppendBrandIconsL( CAknIconArray& aIconArray ); + + /** + * Set the scanning status flag on + */ + inline void SetScanningOn(); + + /** + * Set the scanning status flag off + */ + inline void SetScanningOff(); + + /** + * Returns with the scanning status flag + * @since S60 5.0 + * @return ETrue if the scanning on, if it is off EFalse + */ + inline TBool ScanningOn(); + + /** + * Returns that the WLAN item connected or not. + * @return ETrue if it is connected otherwise EFalse + */ + inline TBool Connected(); + + /** + * Sets the connected flag + * @param - aConnected True if connected + */ + inline void SetConnected( TBool aConnected ); + + /** + * Sets the connected flag + * @param - aConnected True if connected + */ + inline void SetConnecting( TBool aConnecting ); + + /** + * Sets the connected wlan info + * @param aConnected - connected wlan info + */ + inline void SetConnectedWlanInfo( TWsfWlanInfo& aWlanInfo ); + + /** + * Initialize the refresh animation + */ + void InitializeRefreshAnimation(); + + /* + * Step the animation + */ + void AnimateRefresh(); + + /** + * Initialize the refresh animation + */ + void InitializeConnectingAnimation(); + + /* + * Step the animation + */ + void AnimateConnecting(); + +private: // New methods + + /** + * Format the Hidden WLANs for the listbox.(text and icon) + * @since S60 v5.0 + * @param aWlan - Reference to wlaninfo + * @param aItem - Listbox item + */ + void FormatHiddenWlanItemL( TWsfWlanInfo& aWlan, TPtr& aItem ); + + /** + * Format the listbox filed with the scanning status off information + * @since S60 v5.0 + * @param aItem - Listbox item + */ + void FormatStatusOffL( TPtr& aItem ); + + /** + * Format the listbox filed with the No Wlan found information + * @since S60 v5.0 + * @param aItem - Listbox item + */ + void FormatNoWlansAvailableL( TPtr& aItem ); + + /** + * Format the WlanList item for one-line or (visible networks) items for + * the listbox.(text and icon) + * @param aWlan - reference to wlaninfo + * @param aItem - Listbox item + * @param aSingleLine - ETrue if Single Line Item wanted to be shown + * EFalse if Visible Wlan Item wanted to be shown + */ + void FormatWlanSingleLineL( TWsfWlanInfo& aWlan, + TPtr& aItem, + TBool aSingleLine ); + + /** + * Format the WlanList items in one-line for Unknown networks + * @param aMultipleUnknownWlans - ETreue if more unknown network found + * @param aItem - Listbox item + */ + void FormatUnknownWlansSingleLineL( const TBool aMultipleUnknownWlans, + TPtr& aItem ); + + /** + * Go through the WLANs list and find Max signal strength amont know wlans + * @param aWlanList - array of WLANs + * @return the ID of the Wlan with the Max signal strength + */ + TInt FindPreferredKnownWlan( CWsfWlanInfoArray* aWlanList ); + + /** + * Check if there's connection and it is the first item in array + * @param aWlanList - array of WLANs + * @param aItem - Listbox item + */ + void CheckWlansL( CWsfWlanInfoArray* aWlanList, TPtr& aItem ); + + /** + * Formats the connected string. + * @param aItem - The name of the connected network to be put + */ + void FormatConnectedL( TPtr& aItem ); + +private: // Data + + /** + * Array of WLANs + * Not Own. + */ + CWsfWlanInfoArray* iWlanInfoArray; + + /** + * Coe env for loading string from resource + * Not Own. + */ + CCoeEnv* iCoeEnv; + + /** + * List that contains the WLAN items + * Own. + */ + CDesCArrayFlat* iFormattedWlanList; + + /** + * WlanInfoArrayVisitor + * Own. + */ + CWsfWlanInfoArrayVisitor *iWlanInfoBranding; + + /** + * The scanning status flag + */ + TBool iScanning; + + /** + * Connected status flag + */ + TBool iConnected; + + /** + * Connected status flag + */ + TBool iConnecting; + + /** + * Info of the connected WLAN + */ + TWsfWlanInfo iConnectedWlanInfo; + + /** + * List of animation states of refreshing icon + */ + TFixedArray iRefreshIcons; + + /** + * List of animation states of connecting icon + */ + TFixedArray iConnectingIcons; + + /** + * The refreshing animation frame index + */ + TInt iRefreshIndex; + + /** + * The connecting animation frame index + */ + TInt iConnectingIndex; + + /** + * Constants for 'WLAN scanning off' text + * Own. + */ + HBufC* iStatusScanningOff; + + /** + * Constants for 'Refreshing' text + * Own. + */ + HBufC* iStatusRefreshing; + + /** + * Constants for 'Connecting' text + * Own. + */ + HBufC* iStatusConnecting; + + /** + * Constants for 'Other (hidden netw.)' text + * Own. + */ + HBufC* iManualSSIDInputting; + + /** + * Constants for 'No WLAN network found' text + * Own. + */ + HBufC* iNoWLANsAvailable; + + }; + + +#include "wsfaimodel.inl" + + +#endif // C_WSFAIMODEL_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/inc/wsfaimodel.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaimodel.inl Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 for CWsfAiModel +* +*/ + + +// INLINE FUNCTIONS + +// -------------------------------------------------------------------------- +// CWsfAiModel::SetScanningOn +// -------------------------------------------------------------------------- +// +inline void CWsfAiModel::SetScanningOn() + { + // Set the scanning status flag on + iScanning = ETrue; + } + +// -------------------------------------------------------------------------- +// CWsfAiModel::SetScanningOff +// -------------------------------------------------------------------------- +// +inline void CWsfAiModel::SetScanningOff() + { + // Set the scanning status flag off + iScanning = EFalse; + } + +// -------------------------------------------------------------------------- +// CWsfAiModel::ScanningOn +// -------------------------------------------------------------------------- +// +inline TBool CWsfAiModel::ScanningOn() + { + return iScanning; + } + +// -------------------------------------------------------------------------- +// CWsfAiModel::Connected +// -------------------------------------------------------------------------- +// +inline TBool CWsfAiModel::Connected() + { + return iConnected; + } + +// ----------------------------------------------------------------------------- +// CWsfAiModel::SetConnected +// ----------------------------------------------------------------------------- +// +void CWsfAiModel::SetConnected( TBool aConnected ) + { + iConnected = aConnected; + } + +// ----------------------------------------------------------------------------- +// CWsfAiModel::SetConnected +// ----------------------------------------------------------------------------- +// +void CWsfAiModel::SetConnecting( TBool aConnecting ) + { + iConnecting = aConnecting; + } + +// ----------------------------------------------------------------------------- +// CWsfAiModel::SetConnectedWlanInfo +// ----------------------------------------------------------------------------- +// +void CWsfAiModel::SetConnectedWlanInfo( TWsfWlanInfo& aWlanInfo ) + { + iConnectedWlanInfo = aWlanInfo; + } + + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/inc/wsfaiplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaiplugin.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,372 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfAiPlugin +* +*/ + + +#ifndef C_WSFAIPLUGIN_H +#define C_WSFAIPLUGIN_H + +// EXTERNAL INCLUDES +#include +#include +#include + +// INTERNAL INCLUDES +#include "wsfaicontroller.h" +#include "wsfaipublishobserver.h" +#include "wsfaiplugincontentmodel.h" + +// CONSTANTS +LOCAL_D const TInt KDeferredWaitTime = 1000 * 1000; + // one second in milliseconds + +// FORWARD DECLARATIONS +class MAiPluginSettings; +class MAiContentObserver; +class MAiContentItemIterator; + +class CWsfModel; +class CWsfAiModel; +class CWsfAiView; +class CAknIconArray; +class CGulIcon; +class CWsfDbObserver; + + +// CLASS DECLARATION + +/** + * The main class, containing the plugin behavior. + * + * @lib wsfaiplugin.lib + * @since S60 v5.0 + */ +NONSHARABLE_CLASS( CWsfAiPlugin ): public CHsContentPublisher, + public MWsfAiPublishObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor + * @since S60 5.0 + * @return instance of CWsfAiPlugin class + */ + static CWsfAiPlugin* NewL(); + + /** + * Destructor of CWsfAiPlugin class + * @since S60 5.0 + */ + virtual ~CWsfAiPlugin(); + + private:// Constructors + + /** + * Default C++ constructor + * @since S60 5.0 + */ + CWsfAiPlugin(); + + /** + * 2nd phase constructor + * @since S60 5.0 + */ + void ConstructL(); + + /** + * Steps + * @param ptr Pointer to an instance of this class + */ + static TInt DoRefreshingStepL( TAny* ptr ); + + /** + * Steps the refresh animation + */ + void DoRefreshingStepL(); + + /** + * Steps + * @param ptr Pointer to an instance of this class + */ + static TInt DoConnectingStepL( TAny* ptr ); + + /** + * Steps the refresh animation + */ + void DoConnectingStepL(); + + public: // from CHSContentPublisher + + /** + * @see CHsContentPublisher + */ + void Start( TStartReason aReason ); + + /** + * @see CHsContentPublisher + */ + void Stop( TStopReason aReason ); + + /** + * @see CHsContentPublisher + */ + void Resume( TResumeReason aReason ); + + /** + * @see CHsContentPublisher + */ + void Suspend( TSuspendReason aReason ); + + /** + * @see CHsContentPublisher + */ + void SubscribeL( MAiContentObserver& aObserver ); + + /** + * @see CHsContentPublisher + */ + void ConfigureL( RAiSettingsItemArray& aSettings ); + + /** + * @see CHsContentPublisher + */ + TAny* GetProperty( TProperty aProperty ); + + /** + * @see CHsContentPublisher + */ + void HandleEvent( TInt aEvent, const TDesC& aParam ); + + + public: // From MWsfAiPublishObserver + + /** + * Publishes images from array and text + * @since S60 5.0 + * @param aPublishIconArray the published icons + * @param aText1 title text label + */ + void PublishContentL( CArrayFix* aPublishIconArray, + CEikLabel* aText1 ); + + /** + * Sets Scanning status on/off. + * @since S60 5.0 + * @param aScanState Scanning satus flag + */ + void SetScanningState( TBool aScanState ); + + /** + * Sets refreshing status on/off. + * @since S60 5.0 + * @param aScanState Refreshing status flag + */ + void SetRefreshingL( TBool aRefreshing ); + + /** + * Set connecting status on. + * @since S60 5.0 + */ + void StartConnectingL(); + + /** + * Publishes just status image from array + * @since S60 5.0 + * @param aPublishIconArray the published icons + * @param aText1 title text label + */ + void PublishStatusIconL( CArrayFix* aPublishIconArray, + CEikLabel* aText1 ); + + private: + + /** + * Allocates Engine, Model and functional UI for plugin + */ + void AllocateResourcesL(); + + /** + * Unpublishes (clears) all plugin content from AI2 view + */ + void ClearL(); + + /** + * Launch WLAN Wizard application + */ + void LaunchApplicationL(); + + /** + * Set the value of Middle Soft Key based on the + * Scanning status of the WLAN Wizard + */ + void SetMskL(); + + /** + * Publish the given text + * @param aObserver - pointer to the observer + * @param aContentId - content ID + * @param aText1 - title text label + * @return ETrue - if it can be published + * EFalse - if it can not be published + */ + TBool PublishText( MAiContentObserver* aObserver, + TWsfAiWizardContentIds aContentId, + const TDesC16& aText ); + + /** + * Publish the given icon + * @param aObserver - pointer to the observer + * @param aContentId - content ID + * @param aIconId - icon ID + * @return ETrue - if it can be published + * EFalse - if it can not be published + */ + TBool PublishIconL( MAiContentObserver* aObserver, + TWsfAiWizardContentIds aContentId, + TInt aIconId ); + + /** + * Cleanup function to to cancel publish transaction + * @since S60 5.0 + * @param aPtr Pointer for the observer class + */ + static void PublishCleanup( TAny* aPtr ); + + + private: // Data + + /** + * Handle to Eikon environment. + */ + CEikonEnv* iEnv; + + /** + * Array of content observers + */ + RPointerArray iObservers; + + /** + * Iterator for plugin content + * Own. + */ + MAiContentItemIterator* iContent; + + /** + * Iterator for plugin resources + * Own. + */ + MAiContentItemIterator* iResources; + + /** + * Iterator for plugin events + * Own. + */ + MAiContentItemIterator* iEvents; + + /** + * Pointer to CWsfModel + * Own. + */ + CWsfModel* iModel; + + /** + * Pointer to AI Model + * Own. + */ + CWsfAiModel* iAiModel; + + /** + * AI Controller + * Own. + */ + TWsfAiController iController; + + /** + * Pointer to CWsfAiView + * Own. + */ + CWsfAiView* iUi; + + /** + * The database observer observing changes in + * show WLAN availablity + */ + CWsfDbObserver* iDbObserver; + + /** + * The resource file offset + */ + TInt iResourceFileOffset; + + /** + * Constants for MSK activate text + * Own. + */ + HBufC* iMskActivate; + + /** + * Scanning status flag + */ + TBool iScanState; + + /** + * Flag for focus of information area + */ + TBool iInfoAreaFocus; + + /** + * The current observer item index + */ + TInt iCurrentObserverIndex; + + /** + * The current refreshing state + */ + TBool iRefreshing; + + /* + * The periodic that steps the refreshing animation + */ + CPeriodic* iAnimationPeriodic; + + /** + * Constants for 'Connected to:' text + * Own. + */ + HBufC* iConnectedTo; + + /** + * Constants for 'Known network found:' text + * Own. + */ + HBufC* iKnownNetworkFound; + + /** + * A pointer to CWsfActiveWrappers + */ + CWsfActiveWrappers* iActiveWrappers; + + /** + * Flag to publish network status text + */ + TBool iPublishNetworkStatusText; + + }; + + +#endif // C_WSFAIPLUGIN_H + +// End of File. diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/inc/wsfaiplugincommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaiplugincommon.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: PluginIcons +* +*/ + + +#ifndef WSFAIPLUGINCOMMON_H +#define WSFAIPLUGINCOMMON_H + +#include +#include + +// the drive letter +_LIT( KResourceDrive, "z:" ); +// resource file +_LIT( KResourceFile, "wsfaipluginrsc.rsc" ); +// icons +_LIT( KBitmapFile, "wsficons.mif" ); + +/** Icon ID constants */ +enum TWsfPluginIcons + { + //Constants + ESecureNetworkIcon, + ENoSignalIcon, + EPoorSignal, + EAverageSignal, + EExcelentSignal, + EConnectedNWIcon, + EKnownNWIcon, + ETransparentIcon, + EWlanOnIcon, + EWlanOnIcon_0, + EWlanOnIcon_1, + EWlanOffIcon, + EWlanNaviBarIcon + }; + +#endif // WSFAIPLUGINCOMMON_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/inc/wsfaiplugincontentmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaiplugincontentmodel.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Content enums +* +*/ + + +#ifndef WSFAIPLUGINCONTENTMODEL_H +#define WSFAIPLUGINCONTENTMODEL_H + + +#include + +#include "wsfaipluginuids.hrh" + +// Plug-in Implementation UID. +const TInt KImplUidWlanWizardPlugin = + AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_WIZARDPLUGIN; +const TUid KUidWlanWizardPlugin = { KImplUidWlanWizardPlugin }; + + +// ================================= Content ================================ + +/** + * Content Ids + */ +enum TWsfAiWizardContentIds + { + EAiWizardContentStatusIcon + ,EAiWizardContentStrengthIcon + ,EAiWizardContentSecureIcon + ,EAiWizardContentNetworkStatus + ,EAiWizardContentNetworkName + }; + +/** + * Content that the plugin will publish + */ +const TAiContentItem KAiWizardContent[] = + { + { EAiWizardContentStatusIcon, L"StatusIcon", KAiContentTypeBitmap } + ,{ EAiWizardContentStrengthIcon, L"StrengthIcon", KAiContentTypeBitmap } + ,{ EAiWizardContentSecureIcon, L"SecureIcon", KAiContentTypeBitmap } + ,{ EAiWizardContentNetworkStatus, L"NetworkStatus",KAiContentTypeText } + ,{ EAiWizardContentNetworkName, L"NetworkName", KAiContentTypeText } + }; + +// ============================ Events ============================== +/** + * Event Ids. + */ +enum TWsfAiWizardEventIds + { + EAiWizardEventLaunchApplication, + EAiWizardGainFocusInfoArea, + EAiWizardLostFocusInfoArea, + EAiWizardOpenMenu + }; + +/** + * Services that the plugin can perform + */ +const TAiContentItem KAiWizardEvents[] = + { + { EAiWizardEventLaunchApplication, L"LaunchApplication", "" } + ,{ EAiWizardGainFocusInfoArea, L"GainFocusInfoArea", "" } + ,{ EAiWizardLostFocusInfoArea, L"LostFocusInfoArea", "" } + ,{ EAiWizardOpenMenu, L"OpenMenu", "" } + }; + +#endif // WSFAIPLUGINCONTENTMODEL_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/inc/wsfaipluginuids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaipluginuids.hrh Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource headers for project AiPlugin +* +*/ + + +#ifndef WSFAIPLUGINUIDS_HRH +#define WSFAIPLUGINUIDS_HRH + +/** + * Ecom implementation uid for WLAN wizard plugin. + */ +#define AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_WIZARDPLUGIN 0x10281CAF + +/** + * Ecom dll uid for WLAN wizard plugin. + */ +#define AI_UID_ECOM_DLL_CONTENTPUBLISHER_WIZARDPLUGIN 0x10281CAE + + +#endif // WSFAIPLUGINUIDS_HRH diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/inc/wsfaipublishobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaipublishobserver.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for MWsfAiPublishObserver +* +*/ + + +#ifndef M_WSFAIPUBLISHOBSERVER_H +#define M_WSFAIPUBLISHOBSERVER_H + +#include + +class CAknIconArray; +class CEikLabel; + +/** + * Abstract interface for wlan active idle plugin + * + */ +class MWsfAiPublishObserver + { +public: + + /** + * Publishes images from array and text + * @since S60 5.0 + * @param aPublishIconArray the published icons + * @param aText1 title text label + */ + virtual void PublishContentL( CArrayFix< TInt >* aPublishIconArray, + CEikLabel* aText1 ) = 0; + + /** + * Sets Scanning status on/off. + * @since S60 5.0 + * @param aScanState Scanning satus flag + */ + virtual void SetScanningState( TBool aScanState ) = 0; + + /** + * Sets refreshing status on/off. + * @since S60 5.0 + * @param aScanState Refreshing status flag + */ + virtual void SetRefreshingL( TBool aRefreshing ) = 0; + + /** + * Sets connecting status on. + * @since S60 5.0 + * @param aScanState Refreshing status flag + */ + virtual void StartConnectingL() = 0; + + /** + * Publishes state image from array + * @since S60 5.0 + * @param aPublishIconArray the published icons + * @param aText1 title text label + */ + virtual void PublishStatusIconL( CArrayFix* aPublishIconArray, + CEikLabel* aText1 ) = 0; + + }; + + +#endif // M_WSFAIPUBLISHOBSERVER_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/inc/wsfaiuiobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaiuiobserver.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for wlan active idle plugin ui control +* +*/ + + +#ifndef M_WSFAIUIOBSERVER_H +#define M_WSFAIUIOBSERVER_H + + +#include +/** + * Abstract interface for wlan active idle plugin ui control + * - from the point of view of model + * @since S60 5.0 + */ +class MWsfAiUiObserver + { + + public: + + /** + * Update the contents of control + * Set the focus on aCurrentImte + * @since S60 5.0 + * @param aItemTextArray text of the current item + * @param aCurrentItem index of the current item + */ + virtual void UpdateHotSpotsL( MDesCArray* aItemTextArray, + TInt aCurrentItem ) = 0; + + /** + * Gives back the index of the selected item + * @since S60 5.0 + * @return the index of the selected item + */ + virtual TInt SelectedItem() = 0; + + + /* + * Check if the control is multiline capable control + * @since S60 5.0 + * @return Etrue if control is multiline capable control + */ + virtual TBool MultilineControl() = 0; + + /* + * Display engine off text in UI + * @since S60 5.0 + */ + virtual void DisplayEngineOffL() = 0; + + /* + * Set the refressing UI note visible + * @since S60 5.0 + */ + virtual void ForceRefreshingL() = 0; + + /** + * Update the contents of control + * @since S60 5.0 + * @param aItemTextArray text of the current item + */ + virtual void UpdateViewL( MDesCArray* aItemTextArray ) = 0; + + /** + * Update the contents of control + * @since S60 5.0 + * @param aItemTextArray text of the current item + */ + virtual void StartConnectingAnimationL() = 0; + }; + + +#endif // M_WSFAIUIOBSERVER_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/inc/wsfaiview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaiview.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,263 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfAiView +* +*/ + + +#ifndef C_WSFAIVIEW_H +#define C_WSFAIVIEW_H + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "wsfaiuiobserver.h" +#include "wsfaiplugincommon.h" + + +// CONSTANTS +// MACROS +// DATA TYPES +// FORWARD DECLARATIONS +class CEikLabel; +class MWsfAiPublishObserver; + +class CWsfAiView : public CBase, + public MWsfAiUiObserver + { + public: // Constructors + /** + * Two-phased constructor + * @since S60 5.0 + * @param aPublishObserver - reference to the plugin's + * abstract interface + * @return instance of CWsfAiView class + */ + static CWsfAiView* NewL( MWsfAiPublishObserver& aPublishObserver ); + + /** + * Two-phased constructor. Leaves the object on CleanupStack + * @since S60 5.0 + * @param aPublishObserver - reference to the plugin's + * abstract interface + * @return instance of CWsfAiView class + */ + static CWsfAiView* NewLC( MWsfAiPublishObserver& aPublishObserver ); + + /** + * Destructor of CWsfAiView class + * @since S60 5.0 + */ + ~CWsfAiView(); + + private: + + /** + * Default C++ constructor + * @since S60 5.0 + * @param aPublishObserver - reference to the plugin's + * abstract interface + */ + CWsfAiView( MWsfAiPublishObserver& aPublishObserver ); + + /** + * 2nd phase constructor + * @since S60 5.0 + */ + void ConstructL(); + + public: // from MWsfAiUiObserver + + /** + * Update the contents of control + * Set the focus on aCurrentImte + * @since S60 5.0 + * @param aItemTextArray text of the current item + * @param aCurrentItem index of the current item + */ + void UpdateHotSpotsL( MDesCArray* aItemTextArray, + TInt aCurrentItem ); + + /** + * Gives back the index of the selected item + * @since S60 5.0 + * @return the index of the selected item + */ + TInt SelectedItem(); + + /* + * Check if the control is multiline capable control + * @since S60 5.0 + * @return Etrue if control is multiline capable control + */ + TBool MultilineControl(); + + /* + * Display engine off text in UI + * @since S60 5.0 + */ + void DisplayEngineOffL(); + + /* + * Set the refressing UI note visible + * @since S60 5.0 + */ + void ForceRefreshingL(); + + /* + * Set the refressing UI note visible + * @since S60 5.0 + */ + void StartConnectingAnimationL(); + + /** + * Update the contents of control + * @since S60 5.0 + * @param aItemTextArray text of the current item + */ + void UpdateViewL( MDesCArray* aItemTextArray ); + + private: + + /* + * Parses the string into ui component data + * @since S60 5.0 + * @param aString - a string into ui + * @return - TBool - ETrue if deferred update is executed + */ + TBool ParseStringL( const TDesC& aString ); + + /* + * Complete the change for new data - this is + * a callback for deferred update + * @since S60 5.0 + * @param aPtr pointer to this + * @return ETrue if update is completed + */ + static TInt DoCompleteUpdateL( TAny* aPtr ); + + /* + * Commit the update change + * @since S60 5.0 + */ + void DoCompleteUpdateL(); + + /** + * Activates refresh timer + * @since S60 5.0 + */ + void ActivateRefreshTimer(); + + /** + * 'MakePublishIconsL' and 'MakeTransparentPublishIconsL' + * create arrays consisting of icon ids for the icons to publish + * @since S60 5.0 + */ + void MakePublishIconsL(); + + /** + * 'MakePublishIconsL' and 'MakeTransparentPublishIconsL' + * create arrays consisting of icon ids for the icons to publish + * @since S60 5.0 + */ + void MakeTransparentPublishIconsL(); + + private: // Data + + /** + * Coe env for loading string from resource + * Not Own. + */ + CCoeEnv* iEnv; + + /** + * Publish images in array + * Own. + */ + CArrayFix< TInt >* iPublishIconArray; + + /** + * Timer for update + * Own. + */ + CPeriodic* iDeferredUpdater; + + /** + * Times callback + * Own. + */ + TCallBack* iDeferredUpdateCallBack; + + /** + * Title text label + * Own. + */ + CEikLabel* iTextLabel; + + /** + * The label text + */ + TName iCurrentText; + + /** + * ID constants for Secure Icon + */ + TWsfPluginIcons iUpdateSecureIconDeferred; + + /** + * ID constants for Signal Strength Icon + */ + TWsfPluginIcons iUpdateSignalStrengthIconDeferred; + + /** + * ID constants for Status Icon + */ + TWsfPluginIcons iUpdateStatusIconDeferred; + + /** + * ID constants for Status Icon saved to remember after refreshing + */ + TWsfPluginIcons iSavedUpdateStatusIconDeferred; + + /** + * Pointer to Publish Observer interface + * Not Own. + */ + MWsfAiPublishObserver* iPublishObserver; + + /** + * Constants for 'WLAN scanning off' text + * Own. + */ + HBufC* iStatusScanningOff; + + /** + * Constants for 'Refreshing' text + * Own. + */ + HBufC* iStatusRefreshing; + + /** + * Constants for 'Connecting' text + * Own. + */ + HBufC* iStatusConnecting; + }; + + + +#endif // C_WSFAIVIEW_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/inc/wsfconnectactivewrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfconnectactivewrapper.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies 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 CWsfConnectActiveWrapper. + * + */ + +#ifndef CWSFCONNECTACTIVEWRAPPER_H +#define CWSFCONNECTACTIVEWRAPPER_H + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "wsfaicontroller.h" +#include "wsfcommon.h" + +// FORWARD DECLARATIONS +class CWsfModel; + +/** + * Active object that connects WLAN + * + * @lib wsfaiplugin.lib + * @since S60 v5.2 + */ +class CWsfConnectActiveWrapper : public CActive + { +public: + // Constructors and destructor + + /** + * Destructor + * @since S60 5.2 + */ + ~CWsfConnectActiveWrapper(); + + /** + * Two-phased constructor. + * @since S60 5.2 + */ + static CWsfConnectActiveWrapper* NewL( CWsfModel* aModel ); + + /** + * Two-phased constructor. + * @since S60 5.2 + */ + static CWsfConnectActiveWrapper* NewLC( CWsfModel* aModel ); + +public: + + /** + * Function for making the initial request + * @since S60 5.2 + * @param aIapId WLAN IAP id to connect to. + * @param aConnectOnly ETrue if Connect selected + * @param aPersistence Persistence property of the IAP + */ + void Start( TUint aIapID, TBool aConnectOnly, + TWsfIapPersistence aPersistence ); + +private: + + /** + * constructor + */ + CWsfConnectActiveWrapper(); + + /** + * Factory function. + * @since S60 5.2 + * @param aModel CWsfModel pointer + */ + void ConstructL( CWsfModel* aModel ); + +private: + // From CActive + /** + * @see CActive + */ + void RunL(); + + /** + * @see CActive + */ + void DoCancel(); + + /** + * @see CActive + */ + TInt RunError( TInt aError ); + +private: + /** + * States of the active object + */ + enum CWsfConnectActiveWrapperState + { + EUninitialized, // Uninitialized + EInitialized, // Initalized + EError + // Error condition + }; + +private: + + /** + * State of the active object + */ + TInt iState; // State of the active object + + /** + * Result + */ + TPckgBuf iPckg; + + /** + * Reference to Model + */ + CWsfModel* iModel; + + /** + * IAP ID + */ + TUint iIapID; + + /** + * Indicates whether Connect or Start Web browsing was selected + */ + TBool iConnectOnly; + + /** + * Persistence value of IAP + */ + TWsfIapPersistence iPersistence; + + }; + +#endif // CWSFCONNECTACTIVEWRAPPER_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/inc/wsfdbobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfdbobserver.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,133 @@ +/* +* 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: +* Header file for CWsfDbObserver class. +* +*/ + + +#ifndef C_WLAN_PLUGIN_DB_OBSERVER +#define C_WLAN_PLUGIN_DB_OBSERVER + +// System includes +#include +#include +#include +#include +#include +#include + +//forward declaration +class TWsfAiController; + +/** +* Database observer class. +*/ +NONSHARABLE_CLASS( CWsfDbObserver ) : public CActive + { + public: + /** + * The Constructor. + */ + CWsfDbObserver(); + + /** + * First phase of two phased construction. + */ + static CWsfDbObserver* NewL(); + + /** + * This function activates this object as an active object. + */ + void ActivateItL(); + + /** + * Destructor. + */ + virtual ~CWsfDbObserver(); + + /** + * Set the controller + */ + void SetController( TWsfAiController* aController ); + + /** + * Set WLAN availablity to scanning + */ + void EnableScanL(); + + /* + * Set WLAN availablity to not scanning + */ + void DisableScanL(); + + protected: + /** + * When the WLAN device settings table is accessed this function + * is called. Handle of the active object. + */ + void RunL(); + + /** + * Whan waiting for a database access is stopped this function + * is called. + */ + void DoCancel(); + + /** + * @see CActive + */ + TInt RunError( TInt aError ); + + private: + /** + * Second phase of two phase construction. + */ + void ConstructL(); + + /* + * Get default scanning interval + */ + TInt DefaultScanIntervalL(); + + private: + /** + * A CommsDat session fod database access. + */ + CMDBSession* iSession; + + /** + * A class representing a recor of WLAN Devive Settings table. + */ + CCDWlanDeviceSettingsRecord* iRecord; + + /** + * The value of it shows the scan state of the WLAN availablity + */ + TBool iOuterScanState; + + /** + * Reference to the controller class of the module. + */ + TWsfAiController* iController; + + /** + * Handle to the WLAN management client (owned) + */ + CWlanMgmtClient* iWlanMgmtClient; + + }; + + +#endif //C_WLAN_PLUGIN_DB_OBSERVER diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/inc/wsfdisconnectactivewrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfdisconnectactivewrapper.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies 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 CWsfDisconnectActiveWrapper. + * + */ + +#ifndef CWSFDISCONNECTACTIVEWRAPPER_H +#define CWSFDISCONNECTACTIVEWRAPPER_H + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "wsfaicontroller.h" + +// FORWARD DECLARATIONS +class CWsfModel; + +/** + * Active object that disconnects wlan + * + * @lib wsfaiplugin.lib + * @since S60 v5.2 + */ +class CWsfDisconnectActiveWrapper : public CActive + { +public: + // Constructors and destructor + + /** + * Destructor + * @since S60 5.2 + */ + ~CWsfDisconnectActiveWrapper(); + + /** + * Two-phased constructor. + * @since S60 5.2 + */ + static CWsfDisconnectActiveWrapper* NewL( CWsfModel* aModel ); + + /** + * Two-phased constructor. + * @since S60 5.2 + */ + static CWsfDisconnectActiveWrapper* NewLC( CWsfModel* aModel ); + +public: + + /** + * Function for making the initial request + * @since S60 5.2 + */ + void Start(); + +private: + + /** + * constructor + */ + CWsfDisconnectActiveWrapper(); + + /** + * Factory function. + * @since S60 5.2 + * @param aModel CWsfModel pointer + */ + void ConstructL( CWsfModel* aModel ); + +private: + // From CActive + /** + * @see CActive + */ + void RunL(); + + /** + * @see CActive + */ + void DoCancel(); + + /** + * @see CActive + */ + TInt RunError( TInt aError ); + +private: + /** + * States of the active object + */ + enum CWsfDisconnectActiveWrapperState + { + EUninitialized, // Uninitialized + EInitialized, // Initalized + EError + // Error condition + }; + +private: + + /** + * State of the active object + */ + TInt iState; // State of the active object + + /** + * Request result + */ + TPckgBuf iPckg; + + /** + * Reference to Model + */ + CWsfModel* iModel; + + }; + +#endif // CWSFDISCONNECTACTIVEWRAPPER_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/inc/wsficonarraycreator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsficonarraycreator.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfIconArrayCreator +* +*/ + + +#ifndef C_WSFICONARRAYCREATOR_H +#define C_WSFICONARRAYCREATOR_H + +// EXTERNAL INCLUDES +#include + + +// FORWARD DECLARATIONS +class CAknIconArray; +class CGulIcon; + +// CLASS DEFINITION +/** + * Responsible for the creation of the suitable needed icons. + * @since S60 5.0 + */ +NONSHARABLE_CLASS( CWsfIconArrayCreator ) : public CBase + { + public: // Constructors and destructor + + /** + * Create an icon array + * @since S60 5.0 + * @return The constructed icon array. Ownership passed. + */ + static CAknIconArray* CreateArrayL(); + + /** + * Returns the pointer to icon loaded by the AknIconUtils/AknUtil + * @param aIconId The id of the icon to load + * @return Pointer of the icon. + */ + static CGulIcon* GetIconLC( TInt aIconId ); + + }; + +#endif // C_WSFICONARRAYCREATOR_H + +// end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/inc/wsflaunchaihelperactivewrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsflaunchaihelperactivewrapper.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies 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 CWsfLaunchAiHelperActiveWrapper. + * + */ + +#ifndef CWSFLAUNCHAIHELPERACTIVEWRAPPER_H +#define CWSFLAUNCHAIHELPERACTIVEWRAPPER_H + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "wsfaicontroller.h" + +// FORWARD DECLARATIONS +class CWsfModel; + +/** + * Active object launches ai helper + * + * @lib wsfaiplugin.lib + * @since S60 v5.2 + */ +class CWsfLaunchAiHelperActiveWrapper : public CActive + { +public: // Constructors and destructor + + /** + * Destructor + * @since S60 5.2 + */ + ~CWsfLaunchAiHelperActiveWrapper(); + + /** + * Two-phased constructor. + * @since S60 5.2 + */ + static CWsfLaunchAiHelperActiveWrapper* NewL( CWsfModel* aModel, + TWsfAiController &aController ); + + /** + * Two-phased constructor. + * @since S60 5.2 + */ + static CWsfLaunchAiHelperActiveWrapper* NewLC( CWsfModel* aModel, + TWsfAiController &aController ); + +public: + /** + * Function for making the initial request + * @since S60 5.2 + * @param aWlanInfo The WlanInfo object to be passed to the helper app + * @param aConnectOnly ETrue if we are only connecting, + * EFalse if we should also launch the browser + * @param aTestAccessPoint ETrue if ICT is executed, + * EFalse if ICT is not executed + */ + void Start( TWsfWlanInfo& aInfo, TBool aConnectOnly, + TBool aTestAccessPoint ); + +private: + + /** + * constructor + */ + CWsfLaunchAiHelperActiveWrapper(); + + /** + * Factory function. + * @since S60 5.2 + * @param aModel Whether to react to screensaver events + * @param aController Whether to react to screensaver events + */ + void ConstructL( CWsfModel* aModel, TWsfAiController &aController ); + +private: // From CActive + + /** + * @see CActive + */ + void RunL(); + + /** + * @see CActive + */ + void DoCancel(); + + /** + * @see CActive + */ + TInt RunError( TInt aError ); + +private: + + /** + * States of the active object + */ + enum TCWsfWLANListActiveWrapperState + { + EUninitialized, // Uninitialized + EInitialized, // Initalized + EError // Error condition + }; + +private: + + /** + * State of the active object + */ + TInt iState; + + /** + * Reference to Model + */ + CWsfModel* iModel; + + /** + * Pointer to TWsfAiController + */ + TWsfAiController *iController; + + /** + * Handle to the ai helper exit code property value + */ + RProperty iAiHelperAppExitCode; + + /** + * Handle to the ai helper iap id property value + */ + RProperty iAiHelperAppIapId; + + /** + * Cache of the used info + */ + TWsfWlanInfo iUsedInfo; + + /** + * Indicates if "Connect" or "Start Web browsing" is selected. + */ + TBool iConnectOnly; + + /** + * Indicates if ICT needs to be executed + */ + TBool iTestAccessPoint; + + /** + * Indicates if ai helper was stopped + */ + TBool iStoppingHelper; + + /** + * Timer to wait for ai helper to close + */ + RTimer iTimer; + + }; + +#endif // CWSFLAUNCHAIHELPERACTIVEWRAPPER_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/inc/wsfrefreshscanactivewrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfrefreshscanactivewrapper.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies 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 CWsfRefreshScanActiveWrapper. + * + */ + +#ifndef CWSFREFRESHSCANACTIVEWRAPPER_H +#define CWSFREFRESHSCANACTIVEWRAPPER_H + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "wsfaicontroller.h" + +// FORWARD DECLARATIONS +class CWsfModel; + +/** + * Active object that requests scans + * + * @lib wsfaiplugin.lib + * @since S60 v5.2 + */ +class CWsfRefreshScanActiveWrapper : public CActive + { +public: + // Constructors and destructor + + /** + * Destructor + * @since S60 5.2 + */ + ~CWsfRefreshScanActiveWrapper(); + + /** + * Two-phased constructor. + * @since S60 5.2 + */ + static CWsfRefreshScanActiveWrapper* NewL(CWsfModel* aModel); + + /** + * Two-phased constructor. + * @since S60 5.2 + */ + static CWsfRefreshScanActiveWrapper* NewLC(CWsfModel* aModel); + +public: + + /** + * Function for making the initial request + * @since S60 5.2 + */ + void Start(); + +private: + + /** + * constructor + */ + CWsfRefreshScanActiveWrapper(); + + /** + * Factory function. + * @since S60 5.0 + * @param aModel CWsfModel pointer + */ + void ConstructL(CWsfModel* aModel); + +private: + // From CActive + /** + * @see CActive + */ + void RunL(); + + /** + * @see CActive + */ + void DoCancel(); + + /** + * @see CActive + */ + TInt RunError(TInt aError); + +private: + /** + * States of the active object + */ + enum CWsfRefreshScanActiveWrapperState + { + EUninitialized, // Uninitialized + EInitialized, // Initalized + EError + // Error condition + }; + +private: + + /** + * State of the active object + */ + TInt iState; // State of the active object + + /** + * Request result + */ + TPckgBuf iPckg; + + /** + * Reference to Model + */ + CWsfModel* iModel; + + }; + +#endif // CWSFREFRESHSCANACTIVEWRAPPER_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/inc/wsfsearchwlansdialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfsearchwlansdialog.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfSearchWlansDialog +* +*/ + + +#ifndef C_WSFSEARCHWLANSDIALOG_H +#define C_WSFSEARCHWLANSDIALOG_H + +#include +#include + +// INTERNAL INCLUDES +#include "wsfaiuiobserver.h" + + +NONSHARABLE_CLASS( CWsfSearchWlansDialog ) : public CAknListQueryDialog, + public MWsfAiUiObserver + { +public: + + /** + * Two-phased constructor + * @since S60 5.0 + * @param aSelectedItem - reference of the selected item + * @return instance of CWsfSearchWlansDialog class + */ + static CWsfSearchWlansDialog* NewL( TInt &aSelectedItem ); + + /** + * Two-phased constructor. Leaves the object on CleanupStack + * @since S60 5.0 + * @param aSelectedItem - reference of the selected item + * @return instance of CWsfSearchWlansDialog class + */ + static CWsfSearchWlansDialog* NewLC( TInt &aSelectedItem ); + + /** + * Destructor of CWsfSearchWlansDialog class + * @since S60 5.0 + */ + ~CWsfSearchWlansDialog(); + +private: + + /** + * Default C++ constructor + * @since S60 5.0 + * @param aSelectedItem - reference of the selected item + */ + CWsfSearchWlansDialog( TInt &aSelectedItem ); + + /** + * 2nd phase constructor + * @since S60 5.0 + */ + void ConstructL(); + +private: // from CEikDialog + + /** + * From CEikDialog + * Framework method called to processs a command ID + * @param aCommandId ID of the command to respond to. + */ + void ProcessCommandL( TInt aCommandId ); + + /** + * Sets the default value to the dialog. + */ + void PreLayoutDynInitL(); + +private: // from MWsfAiUiObserver + + /** + * Update the contents of control + * Set the focus on aCurrentImte + * @since S60 5.0 + * @param aItemTextArray text of the current item + * @param aCurrentItem index of the current item + */ + void UpdateHotSpotsL( MDesCArray* aItemTextArray, + TInt aCurrentItem ); + + /** + * Gives back the index of the selected item + * @since S60 5.0 + * @return the index of the selected item + */ + TInt SelectedItem(); + + /* + * Check if the control is multiline capable control + * @since S60 5.0 + * @return Etrue if control is multiline capable control + */ + TBool MultilineControl(); + + /* + * Display engine off text in UI + * @since S60 5.0 + */ + void DisplayEngineOffL(); + + /* + * Set the refressing UI note visible + * @since S60 5.0 + */ + void ForceRefreshingL(); + + /* + * Starts connecting animation + * @since S60 5.2 + */ + void StartConnectingAnimationL(); + + /** + * Update the contents of control + * @since S60 5.0 + * @param aItemTextArray text of the current item + */ + void UpdateViewL( MDesCArray* aItemTextArray ); + + +private: + + /** + * Reference of the selecte item + */ + TInt *iSelectedItem; + }; + + + +#endif // C_WSFSEARCHWLANSDIALOG_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/inc/wsfwlanlistactivewrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfwlanlistactivewrapper.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,195 @@ +/* + * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies 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 CWsfWLANListActiveWrapper. + * + */ + +#ifndef CWSFWLANLISTACTIVEWRAPPER_H +#define CWSFWLANLISTACTIVEWRAPPER_H + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "wsfaicontroller.h" + +// FORWARD DECLARATIONS +class CWsfModel; +class CWsfWlanInfoArray; + +/** + * Active object that fetches wlan list data + * + * @lib wsfaiplugin.lib + * @since S60 v5.2 + */ +class CWsfWLANListActiveWrapper : public CActive + { +public: // Constructors and destructor + + /** + * Destructor + * @since S60 5.2 + */ + ~CWsfWLANListActiveWrapper(); + + /** + * Two-phased constructor. + * @since S60 5.2 + */ + static CWsfWLANListActiveWrapper* NewL( CWsfModel* aModel, + TWsfAiController &aController ); + + /** + * Two-phased constructor. + * @since S60 5.2 + */ + static CWsfWLANListActiveWrapper* NewLC( CWsfModel* aModel, + TWsfAiController &aController ); + +public: + /** + * Function for making the initial request + * @since S60 5.2 + * @param aStarUp is start called from plugin start up + */ + void Start( TBool aStarUp ); + + /** + * Returns the list of found WLANs. + * Ownership not passed. + * @since S60 5.2 + * @return Array of WLANs + */ + CWsfWlanInfoArray* GetWlanList(); + + /** + * Returns the connected WLAN network + * @since S60 5.2 + * @return TWsfWlanInfo + */ + TWsfWlanInfo GetConnectedWLANNetwork(); + +private: + + /** + * constructor + */ + CWsfWLANListActiveWrapper(); + + /** + * Factory function. + * @since S60 5.2 + * @param aModel Whether to react to screensaver events + * @param aController Whether to react to screensaver events + */ + void ConstructL( CWsfModel* aModel, TWsfAiController &aController ); + +private: // From CActive + + /** + * @see CActive + */ + void RunL(); + + /** + * @see CActive + */ + void DoCancel(); + + /** + * @see CActive + */ + TInt RunError( TInt aError ); + +private: + + /** + * States of the active object + */ + enum TCWsfWLANListActiveWrapperState + { + EUninitialized, // Uninitialized + EInitialized, // Initalized + EProcessWLANListData, // Create wlan array from results + EGetConnectedNetwork, // Request connected network + EError + // Error condition + }; + +private: + + /** + * State of the active object + */ + TInt iState; // State of the active object + + /** + * Needed size to allocate result data + */ + TPckgBuf iPckgNeededSize; + + /** + * Data size in engine + */ + TPckgBuf iPckgAllocatedSize; + + /** + * Connected network request result + */ + TPckgBuf iPckg; + + /** + * Reference to Model + */ + CWsfModel* iModel; + + /** + * Array to store WLAN scan results. Owned. + */ + CWsfWlanInfoArray* iArray; + + /** + * TPtr to wlan data + */ + TPtr8 iPtr; + + /** + * Wlan data buffer + */ + HBufC8* iBuffer; + + /** + * Pointer to TWsfAiController + */ + TWsfAiController *iController; + + /** + * Is this object called from plugin startup + */ + TBool iStartUp; + + /** + * Retries to fetch data + */ + TInt iRetriesLeft; + + /** + * Cache of the connected WLAN data + */ + TWsfWlanInfo iConnectedWlan; + + }; + +#endif // CWSFWLANLISTACTIVEWRAPPER_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/loc/wsfaiplugin.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/loc/wsfaiplugin.loc Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 strings for project AP Wizard +* +*/ + + +// d:Text to indicate that the data is changing in the view - visible for one second +// d:(one row) +// l:ai_gene_pane_1_t1 +#define qtn_sniffer_plug_in_refreshing "Refreshing" + +// d:Text to indicate that the wlan scanning is off. +// d:(one row) +// l:ai_gene_pane_1_t1 +#define qtn_sniffer_plug_in_scanning_off "WLAN scanning off" + +// d:Text indicate that wlan scan did not find any wlan in the range +// d:(one row) +// l:ai_gene_pane_1_t1 +#define qtn_sniffer_plug_in_no_wlans_found "No WLAN network found" + +// d:Text used to tell that a preconfigured wlan accesspoint is found. +// d:%U stands for wlan ssid( max 50 digits ) +// d:(one row) +// l:ai_gene_pane_1_t1 +#define qtn_sniffer_plug_in_ssid_found "'%U' found" + +// d:Text use to indicate that a non-configured wlan is in the range +// d:(one row) +// l:ai_gene_pane_1_t1 +#define qtn_sniffer_plug_in_unknown_wlan_found "WLAN network found" + +// d:Text use to indicate that multiple non-configured wlans is in the range +// d:(one row) +// l:ai_gene_pane_1_t1 +#define qtn_sniffer_plug_in_unknown_wlans_found "WLAN networks found" + +// d:Text used the show connected wlan +// d: %U wlan ssid ( max 50 digits ) +// d:(one row) +// l:ai_gene_pane_1_t1 +#define qtn_sniffer_plug_in_iap_connected "'%U' connected" + +// d:Menu command text +// d:(one row) +// l: list_single_pane_t1_cp2 +#define qtn_sniffer_plug_in_options_search_wlan_networks "Search for WLAN" + +// d:Menu command text. Sets WLAN scanning off. +// d:(one row) +// l: list_single_pane_t1_cp2 +#define qtn_sniffer_opt_set_scanning_off "Switch WLAN scan off" + +// d: Dialog title text in select wlan network dialog +// d:(one row) +// l: heading_pane_t1 +#define qtn_wlan_prmpt_select_network "Select WLAN network:" + +//d: Connect to WLAN network softkey +//d: The command is used to connect WLAN using selected IAP +//l: control_pane_t1/opt7 +//r:3.0 +// +#define qtn_sniffer_softkey_connect "Connect" + +// d:List item in WLAN results +// d:(one row) +// l: list_single_graphic_pane_t1_cp2 +#define qtn_wlan_manual_ssid_input "Other (hidden netw.)" + +// d:Text for WLAN Wizard Active Idle2 Middle Soft Key +// d:This value is used when WLAN scanning is 'off' +// d:(one row) +// l:control_pane_t1/opt7 +#define qtn_msk_sniffer_activate "Activate" + +// d:Text for WLAN Wizard Active Idle2 Navigation Bar theme title +// d:(one row) +// l:heading_ai2_gene_pane_t1 +#define qtn_ai_wizard_title "WLAN" + +// d:Text used the show connected state +// d:(one row) +// l:ai_gene_pane_1_t1 +#define qtn_sniffer_plug_in_connected_to "Connected to:" + +// d:Text used the show one known network found state +// d:(one row) +// l:ai_gene_pane_1_t1 +#define qtn_sniffer_plug_in_wlan_network_found "WLAN network found:" + +// d: Text for a network that a connection is being established +// d:(one row) +// l:ai_gene_pane_1_t1 +#define qtn_sniffer_plug_in_connecting "Connecting" + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/rom/wsfaiplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/rom/wsfaiplugin.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 WlanInfoSorting +* +*/ + + +#ifndef WSFAIPLUGIN_IBY +#define WSFAIPLUGIN_IBY + +#ifdef __PROTOCOL_WLAN + +#include + + +ECOM_PLUGIN(wsfaiplugin.dll, 0x10281CAE.rsc) + + +#endif // __PROTOCOL_WLAN + +#endif // WSFAIPLUGIN_IBY + +// End of File diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/rom/wsfaipluginresources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/rom/wsfaipluginresources.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Active Idle plugin resources +* +*/ + +#ifndef WSFAIPLUGINRESOURCES_IBY +#define WSFAIPLUGINRESOURCES_IBY + +#include + +data = DATAZ_\RESOURCE_FILES_DIR\wsfaipluginrsc.rsc RESOURCE_FILES_DIR\wsfaipluginrsc.rsc + +#endif // WSFAIPLUGINRESOURCES_IBY + +// End of File diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/src/wsfactivewaiter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfactivewaiter.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfActiveWaiter +* +*/ + + +// INCLUDE FILES +#include "wsfactivewaiter.h" +#include "wsflogger.h" + + + +// --------------------------------------------------------- +// CWsfActiveWaiter* CWsfActiveWaiter::NewL +// --------------------------------------------------------- +// +CWsfActiveWaiter* CWsfActiveWaiter::NewL() + { + CWsfActiveWaiter* self = NewLC(); + CleanupStack::Pop( self ); + + return self; + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter* CWsfActiveWaiter::NewLC +// --------------------------------------------------------- +// +CWsfActiveWaiter* CWsfActiveWaiter::NewLC() + { + CWsfActiveWaiter* self = new ( ELeave ) CWsfActiveWaiter(); + CleanupStack::PushL( self ); + return self; + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::CWsfActiveWaiter +// --------------------------------------------------------- +// +CWsfActiveWaiter::CWsfActiveWaiter(): + CActive( CActive::EPriorityStandard ) + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::~CWsfActiveWaiter +// --------------------------------------------------------- +// +CWsfActiveWaiter::~CWsfActiveWaiter() + { + Cancel(); + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::DoCancel +// --------------------------------------------------------- +// +void CWsfActiveWaiter::DoCancel() + { + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::RunL +// --------------------------------------------------------- +// +void CWsfActiveWaiter::RunL() + { + LOG_ENTERFN( "CWsfActiveWaiter::RunL" ); + if ( iWait.IsStarted() ) + { + LOG_WRITE("async call completed, resuming."); + iWait.AsyncStop(); + } + } + +// --------------------------------------------------------- +// CWsfActiveWaiter::WaitForRequest +// --------------------------------------------------------- +// +TInt CWsfActiveWaiter::WaitForRequest() + { + LOG_ENTERFN("CWsfActiveWaiter::WaitForRequest"); + SetActive(); + iWait.Start(); + + return iStatus.Int(); + } + +// End of File + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/src/wsfactivewrappers.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfactivewrappers.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies 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 CWsfActiveWrappers. + * + */ + + + +// INCLUDE FILES +#include "wsflogger.h" +#include "wsfactivewrappers.h" +#include "wsfwlanlistactivewrapper.h" +#include "wsfrefreshscanactivewrapper.h" +#include "wsfdisconnectactivewrapper.h" +#include "wsfconnectactivewrapper.h" +#include "wsflaunchaihelperactivewrapper.h" + + +// ---------------------------------------------------------------------------- +// CWsfActiveWrappers::CWsfActiveWrappers +// ---------------------------------------------------------------------------- +// +CWsfActiveWrappers::CWsfActiveWrappers() + { + // No implementation required + } + + +// ---------------------------------------------------------------------------- +// CWsfActiveWrappers::~CWsfActiveWrappers +// ---------------------------------------------------------------------------- +// +CWsfActiveWrappers::~CWsfActiveWrappers() + { + delete iWLANListActiveWrapper; + delete iRefreshScanActiveWrapper; + delete iDisconnectActiveWrapper; + delete iConnectActiveWrapper; + delete iLaunchAiHelperActiveWrapper; + } + + +// ---------------------------------------------------------------------------- +// CWsfActiveWrappers::NewLC +// ---------------------------------------------------------------------------- +// +CWsfActiveWrappers* CWsfActiveWrappers::NewLC( CWsfModel* aModel, + TWsfAiController &aController ) + { + LOG_ENTERFN( "CWsfActiveWrappers::NewLC" ); + CWsfActiveWrappers* self = new ( ELeave ) CWsfActiveWrappers(); + CleanupStack::PushL( self ); + self->ConstructL( aModel, aController ); + return self; + } + + +// ---------------------------------------------------------------------------- +// CWsfActiveWrappers::NewL +// ---------------------------------------------------------------------------- +// +CWsfActiveWrappers* CWsfActiveWrappers::NewL( CWsfModel* aModel, + TWsfAiController &aController ) + { + LOG_ENTERFN( "CWsfActiveWrappers::NewL" ); + CWsfActiveWrappers* self = CWsfActiveWrappers::NewLC( aModel, aController ); + CleanupStack::Pop(); // self; + return self; + } + + +// ---------------------------------------------------------------------------- +// CWsfActiveWrappers::ConstructL +// ---------------------------------------------------------------------------- +// +void CWsfActiveWrappers::ConstructL( CWsfModel* aModel, + TWsfAiController &aController ) + { + LOG_ENTERFN( "CWsfActiveWrappers::ConstructL" ); + iWLANListActiveWrapper = CWsfWLANListActiveWrapper::NewL( aModel, + aController ); + + iRefreshScanActiveWrapper = CWsfRefreshScanActiveWrapper::NewL( aModel ); + + iDisconnectActiveWrapper = CWsfDisconnectActiveWrapper::NewL( aModel ); + + iConnectActiveWrapper = CWsfConnectActiveWrapper::NewL( aModel ); + + iLaunchAiHelperActiveWrapper = CWsfLaunchAiHelperActiveWrapper::NewL( + aModel, aController ); + } + + +// ---------------------------------------------------------------------------- +// CWsfActiveWrappers::Disconnect +// ---------------------------------------------------------------------------- +// +void CWsfActiveWrappers::Disconnect() + { + LOG_ENTERFN( "CWsfActiveWrappers::Disconnect" ); + iDisconnectActiveWrapper->Start(); + } + + +// ---------------------------------------------------------------------------- +// CWsfActiveWrappers::Connect +// ---------------------------------------------------------------------------- +// +void CWsfActiveWrappers::Connect( TUint aIapID, TBool aConnectOnly, + TWsfIapPersistence aPersistence ) + { + LOG_ENTERFN( "CWsfActiveWrappers::Connect" ); + iConnectActiveWrapper->Start( aIapID, aConnectOnly, aPersistence ); + } + + +// ---------------------------------------------------------------------------- +// CWsfActiveWrappers::RefreshScan +// ---------------------------------------------------------------------------- +// +void CWsfActiveWrappers::RefreshScan() + { + LOG_ENTERFN( "CWsfActiveWrappers::RefreshScan" ); + iRefreshScanActiveWrapper->Start(); + } + + +// ---------------------------------------------------------------------------- +// CWsfActiveWrappers::RefreshWLANList +// ---------------------------------------------------------------------------- +// +void CWsfActiveWrappers::RefreshWLANList( TBool aStarUp ) + { + LOG_ENTERFN( "CWsfActiveWrappers::RefreshWLANList" ); + iWLANListActiveWrapper->Start( aStarUp ); + } + + +// ---------------------------------------------------------------------------- +// CWsfActiveWrappers::LaunchHelperApplicationL +// ---------------------------------------------------------------------------- +// +void CWsfActiveWrappers::LaunchHelperApplicationL( TWsfWlanInfo& aInfo, + TBool aConnectOnly, + TBool aTestAccessPoint ) + { + LOG_ENTERFN( "CWsfActiveWrappers::LaunchHelperApplicationL" ); + iLaunchAiHelperActiveWrapper->Start( aInfo, aConnectOnly, aTestAccessPoint ); + } + + +// ---------------------------------------------------------------------------- +// CWsfActiveWrappers::GetWLANList +// ---------------------------------------------------------------------------- +// +CWsfWlanInfoArray* CWsfActiveWrappers::GetWLANList() + { + LOG_ENTERFN( "CWsfActiveWrappers::GetWLANList" ); + return iWLANListActiveWrapper->GetWlanList(); + } + + +// ---------------------------------------------------------------------------- +// CWsfActiveWrappers::GetConnectedWLANNetwork +// ---------------------------------------------------------------------------- +// +TWsfWlanInfo CWsfActiveWrappers::GetConnectedWLANNetwork() + { + LOG_ENTERFN( "CWsfActiveWrappers::GetConnectedWLANNetwork" ); + return iWLANListActiveWrapper->GetConnectedWLANNetwork(); + } + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/src/wsfaicontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfaicontroller.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,1207 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 TWsfAiController. +* +*/ + + + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// CLASS HEADER +#include "wsfaicontroller.h" + +// INTERNAL INCLUDES +#include "wsfwlaninfo.h" +#include "wsfwlaninfoarray.h" +#include "wsfaiuiobserver.h" +#include "wsfaimodel.h" +#include "wsficonarraycreator.h" +#include "wsfmodel.h" +#include "wsfsearchwlansdialog.h" +#include "wsfaicontrollercmds.h" +#include "wsfactivewaiter.h" +#include "wsflogger.h" +#include "wsfdbobserver.h" +#include "wsfactivewrappers.h" + + +// MACROS +#ifdef _DEBUG + _LIT( KControllerPanic, "CWsfAiController" ); + #define _ASS_D( cond ) __ASSERT_DEBUG( (cond), \ + User::Panic( KControllerPanic, __LINE__) ) +#else + #define _ASS_D( cond ) +#endif //_DEBUG + + +// LOCAL DEFINITIONS +LOCAL_D const TInt KFirstItemArrayIndex = 0; + +// index value to suppress 1 second refreshing state +static const TInt KSuppressRefreshIndex = 1024; + + + +// -------------------------------------------------------------------------- +// TWsfAiController::TWsfAiController +// -------------------------------------------------------------------------- +// +TWsfAiController::TWsfAiController(): + iModel( NULL ), + iAiModel( NULL ), + iUi( NULL ), + iDbObserver( NULL ), + iConnectOnly( EFalse ) + { + // null the pointers + iConnectedWlan.iConnectionState = ENotConnected; + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::DeInitializeL +// --------------------------------------------------------- +// +void TWsfAiController::DeInitializeL() + { + LOG_ENTERFN( "TWsfAiController::DeInitializeL" ); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::Initialize +// -------------------------------------------------------------------------- +// +void TWsfAiController::InitializeL( CEikonEnv* aEnv, CWsfModel* aModel, + CWsfAiModel* aAiModel, + CWsfDbObserver* aObserver, + CWsfActiveWrappers* aActiveWrappers ) + { + LOG_ENTERFN( "TWsfAiController::InitializeL" ); + iEnv = aEnv; + iModel = aModel; + iAiModel = aAiModel; + iDbObserver = aObserver; + iActiveWrappers = aActiveWrappers; + iDbObserver->SetController( this ); + iDbObserver->ActivateItL(); + iModel->SetEngineObserver( this ); + } + + +// --------------------------------------------------------------------------- +// TWsfMainController::BrowserLaunchCompleteL +// --------------------------------------------------------------------------- +// +void TWsfAiController::BrowserLaunchCompleteL() + { + LOG_ENTERFN( "TWsfAiController::BrowserLaunchCompleteL" ); + // no implementation required + } + + +// --------------------------------------------------------------------------- +// TWsfMainController::BrowserExitL +// --------------------------------------------------------------------------- +// +void TWsfAiController::BrowserExitL() + { + LOG_ENTERFN( "TWsfAiController::BrowserExitL" ); + // no implementation required + } + + +// --------------------------------------------------------------------------- +// TWsfMainController::BrowserLaunchFailed +// --------------------------------------------------------------------------- +// +#ifdef _DEBUG +void TWsfAiController::BrowserLaunchFailed( TInt aError ) + { + LOG_ENTERFN( "TWsfAiController::BrowserLaunchFailed" ); + LOG_WRITEF( "error = %d", aError ); +#else +void TWsfAiController::BrowserLaunchFailed( TInt /*aError*/ ) + { + // no implementation required +#endif + } + + +// --------------------------------------------------------------------------- +// TWsfMainController::ConnectingL +// --------------------------------------------------------------------------- +// +void TWsfAiController::ConnectingL( TUint32 /*aIapId*/ ) + { + LOG_ENTERFN( "TWsfAiController::ConnectingL" ); + iModel->SetConnecting( ETrue ); + iAiModel->SetConnecting( ETrue ); + iUi->StartConnectingAnimationL(); + RefreshUiL(); + } + + +// --------------------------------------------------------------------------- +// TWsfMainController::ConnectingFinishedL +// --------------------------------------------------------------------------- +// +#ifdef _DEBUG +void TWsfAiController::ConnectingFinishedL( TInt aResult ) + { + LOG_ENTERFN( "TWsfAiController::ConnectingFinishedL" ); + LOG_WRITEF( "aResult = %d", aResult ); +#else +void TWsfAiController::ConnectingFinishedL( TInt /*aResult*/ ) + { +#endif + if ( iModel->IsConnecting() ) + { + iModel->SetConnecting( EFalse ); + } + iAiModel->SetConnecting( EFalse ); + RefreshUiL(); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::StartupRefresh +// -------------------------------------------------------------------------- +// +void TWsfAiController::StartupRefresh() + { + LOG_ENTERFN( "TWsfAiController::StartupRefresh" ); + iActiveWrappers->RefreshWLANList( ETrue ); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::StartupRefreshDataReadyL +// -------------------------------------------------------------------------- +// +void TWsfAiController::StartupRefreshDataReadyL() + { + LOG_ENTERFN( "TWsfAiController::StartupRefreshDataReadyL" ); + + iInfoArray = iActiveWrappers->GetWLANList(); + iConnectedWlan = iActiveWrappers->GetConnectedWLANNetwork(); + iAiModel->SetConnected( iConnectedWlan.Connected() ); + iAiModel->SetConnectedWlanInfo( iConnectedWlan ); + + LOG_WRITEF( "Connected = %d", iConnectedWlan.Connected() ); + + MDesCArray* data = iAiModel->FormatSingleLineWlanListL( iInfoArray ); + + iUi->UpdateHotSpotsL( data, KSuppressRefreshIndex ); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::SetUi +// -------------------------------------------------------------------------- +// +void TWsfAiController::SetUi( MWsfAiUiObserver& aUi ) + { + LOG_ENTERFN( "TWsfAiController::SetUi" ); + iUi = &aUi; + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::HandleSelectionKeyL +// -------------------------------------------------------------------------- +// +void TWsfAiController::HandleSelectionKeyL() + { + LOG_ENTERFN( "TWsfAiController::HandleSelectionKeyL" ); + _ASS_D( iAiModel ); + + if ( !iAiModel->ScanningOn() && !iAiModel->Connected() ) + { + // scanning was off and there wasn't a connected network + EnableScanL(); + } + else + { + // scanning was on + // menu contents depend on the connection and browser status + if ( iModel->IsConnecting() ) + { + // connecting + HandleMskIfConnectingL(); + } + else if ( !iAiModel->Connected() ) + { + // not connected + HandleMskIfOfflineL(); + } + else + { + // connected + if ( IsWlanUsedByBrowserL() ) + { + // browser is using active WLAN connection + HandleMskIfBrowsingL(); + } + else + { + // browser is not running or not using the WLAN + HandleMskIfConnectedL(); + } + } + } + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::WlanListChangedL +// -------------------------------------------------------------------------- +// +void TWsfAiController::WlanListChangedL() + { + LOG_ENTERFN("TWsfAiController::WlanListChangedL" ); + + _ASS_D( iAiModel ); + + if ( !iAiModel->ScanningOn() ) + { + return; + } + + iActiveWrappers->RefreshWLANList( EFalse ); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::WlanListDataReadyL +// -------------------------------------------------------------------------- +// +void TWsfAiController::WlanListDataReadyL() + { + LOG_ENTERFN("TWsfAiController::WlanListDataReadyL" ); + + _ASS_D( iAiModel ); + + iInfoArray = iActiveWrappers->GetWLANList(); + iConnectedWlan = iActiveWrappers->GetConnectedWLANNetwork(); + iAiModel->SetConnected( iConnectedWlan.Connected() ); + iAiModel->SetConnectedWlanInfo( iConnectedWlan ); + + LOG_WRITEF( "Connected = %d", iConnectedWlan.Connected() ); + + if ( !iAiModel->ScanningOn() && !iAiModel->Connected() ) + { + return; + } + + _ASS_D( iModel ); + _ASS_D( iUi ); + + TBool match( EFalse ); + TWsfWlanInfo previousSelected; + CWsfWlanInfoArray* modelArr = iAiModel->GetInfoArray(); + + if ( modelArr ) + { + TInt selectedItem = iUi->SelectedItem(); + if ( selectedItem >= KFirstItemArrayIndex && + selectedItem < modelArr->Count() ) + { + TWsfWlanInfo* temp = modelArr->At( selectedItem ); + if ( temp ) + { + match = ETrue; + previousSelected = *temp; + } + } + } + + MDesCArray* data = iUi->MultilineControl() ? + iAiModel->FormatWlanListL( iInfoArray, ETrue ): + iAiModel->FormatSingleLineWlanListL( iInfoArray ); + + + TInt index( KErrNotFound ); + if ( match ) + { + TWsfWlanInfo* currentMatch = iInfoArray->Match( + previousSelected.iSsid, + iInfoArray->Count() ); + if ( currentMatch ) + { + index = iInfoArray->GetArrayIndex( currentMatch ); + } + } + + if ( !iUi->MultilineControl() && iModel->IsConnecting() ) + { + index = KSuppressRefreshIndex; + } + + iUi->UpdateHotSpotsL( data, index ); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::NotifyEngineError +// -------------------------------------------------------------------------- +// +void TWsfAiController::NotifyEngineError( TInt aError ) + { + LOG_ENTERFN( "TWsfAiController::NotifyEngineError" ); + //Let the user know about the error. + LOG_WRITEF( "error = %d", aError ); + TRAP_IGNORE( DoHandleEngineErrorL( aError ) ); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::ScanDisabledL +// -------------------------------------------------------------------------- +// +void TWsfAiController::ScanDisabledL() + { + LOG_ENTERFN( "TWsfAiController::ScanDisabledL" ); + // no implementation required + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::ScanEnabledL +// -------------------------------------------------------------------------- +// +void TWsfAiController::ScanEnabledL() + { + LOG_ENTERFN( "TWsfAiController::ScanEnabledL" ); + iActiveWrappers->RefreshScan(); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::WlanConnectionActivatedL +// -------------------------------------------------------------------------- +// +void TWsfAiController::WlanConnectionActivatedL() + { + LOG_ENTERFN( "TWsfAiController::WlanConnectionActivatedL" ); + iModel->SetConnecting( EFalse ); + iAiModel->SetConnected( ETrue ); + iAiModel->SetConnecting( EFalse ); + + iActiveWrappers->RefreshWLANList( EFalse ); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::WlanConnectionClosedL +// -------------------------------------------------------------------------- +// +void TWsfAiController::WlanConnectionClosedL() + { + LOG_ENTERFN( "TWsfAiController::WlanConnectionClosedL" ); + iModel->SetConnecting( EFalse ); + iAiModel->SetConnected( EFalse ); + iAiModel->SetConnecting( EFalse ); + if ( iAiModel->ScanningOn() ) + { + iActiveWrappers->RefreshWLANList( EFalse ); + } + else + { + iUi->DisplayEngineOffL(); + } + } + + +// --------------------------------------------------------------------------- +// TWsfMainController::ConnectionCreationProcessFinished +// --------------------------------------------------------------------------- +// +void TWsfAiController::ConnectionCreationProcessFinishedL( TInt aResult ) + { + LOG_ENTERFN( "TWsfAiController::ConnectionCreationProcessFinished" ); + LOG_WRITEF( "aResult = %d", aResult ); + // release flags if we leave occures + CleanupStack::PushL( TCleanupItem( CleanUpConnectingL, this ) ); + if ( iModel->IsConnecting() ) + { + iModel->SetConnecting( EFalse ); + } + iAiModel->SetConnecting( EFalse ); + if ( aResult == KErrNone ) + { + iAiModel->SetConnected( ETrue ); + if ( !iConnectOnly ) + { + StartWebBrowserL( iUsedInfo ); + } + } + else + { + iAiModel->SetConnected( EFalse ); + } + // pop cleanup item + CleanupStack::Pop(); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::StartBrowsingL +// -------------------------------------------------------------------------- +// +void TWsfAiController::StartBrowsingL( TWsfWlanInfo& aInfo ) + { + LOG_ENTERFN( "TWsfAiController::StartBrowsingL" ); + + _ASS_D( iModel ); + + iUsedInfo = aInfo; + + // Prevent connections to ad-hoc + WPA + if ( iUsedInfo.iNetMode == CMManager::EAdhoc + && iUsedInfo.iSecurityMode == CMManager::EWlanSecModeWpa ) + { + CErrorUI* errorUi = CErrorUI::NewLC(); + errorUi->ShowGlobalErrorNoteL( KErrNotSupported ); + CleanupStack::PopAndDestroy( errorUi ); // errorUi + return; + } + + // make sure we don't show connecting stuff forever + CleanupStack::PushL( TCleanupItem( CleanUpConnectingL, this ) ); + + if ( !iUsedInfo.Connected() ) + { + ConnectL( iUsedInfo, EFalse, EFalse ); + } + else + { + LOG_WRITE("Start browser to connected network..."); + iConnectOnly = EFalse; + StartWebBrowserL( iUsedInfo ); + } + + // pop cleanup item + CleanupStack::Pop(); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::StartWebBrowserL +// -------------------------------------------------------------------------- +// +void TWsfAiController::StartWebBrowserL( TWsfWlanInfo& aInfo ) + { + LOG_ENTERFN( "TWsfAiController::StartWebBrowserL" ); + + _ASS_D( iModel ); + + TUint32 passedIap( aInfo.iIapId ); + + if ( aInfo.Connected() && !passedIap ) + { + // in case we have an EasyWLAN here + RCmManager cmmanager; + cmmanager.OpenLC(); + + passedIap = cmmanager.EasyWlanIdL(); + + CleanupStack::PopAndDestroy( &cmmanager ); + } + + // launch the browser + iModel->LaunchBrowserL( passedIap ); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::ConnectL +// -------------------------------------------------------------------------- +// +void TWsfAiController::ConnectL( TWsfWlanInfo& aInfo, TBool aConnectOnly, + TBool aTestAccessPoint ) + { + LOG_ENTERFN( "TWsfAiController::ConnectL" ); + + _ASS_D( iModel ); + TBool testAccessPoint = aTestAccessPoint; + iConnectOnly = aConnectOnly; + iUsedInfo = aInfo; + + // Prevent connections to ad-hoc + WPA + if ( iUsedInfo.iNetMode == CMManager::EAdhoc + && iUsedInfo.iSecurityMode == CMManager::EWlanSecModeWpa ) + { + CErrorUI* errorUi = CErrorUI::NewLC(); + errorUi->ShowGlobalErrorNoteL(KErrNotSupported); + CleanupStack::PopAndDestroy(errorUi); // errorUi + return; + } + + // make sure we don't show connecting stuff forever + CleanupStack::PushL( TCleanupItem( CleanUpConnectingL, this ) ); + + if ( !iUsedInfo.iIapId && !iUsedInfo.Hidden() && + iUsedInfo.iSecurityMode == CMManager::EWlanSecModeOpen ) + { + TBool success( EFalse ); + // just create the IAP + TRAPD( accessPointCreatedError, + success = iModel->CreateAccessPointL( + iUsedInfo, EFalse ); + ); + + // notify user that Disk is full or creation of a WAPI IAP + // is not supported on-the-fly and leave + if ( accessPointCreatedError == KErrDiskFull || + accessPointCreatedError == KErrWlanProtectedSetupSetupLocked ) + { + LOG_WRITE( "showing error note" ); + CErrorUI* errorUi = CErrorUI::NewLC(); + errorUi->ShowGlobalErrorNoteL( accessPointCreatedError ); + CleanupStack::PopAndDestroy( errorUi ); + User::Leave( accessPointCreatedError ); + } + // just leave because we failed to create accesspoint + else if ( accessPointCreatedError != KErrNone || !success ) + { + User::Leave( accessPointCreatedError ); + } + ConnectingL( iUsedInfo.iIapId ); + testAccessPoint = ETrue; + } + else if ( !iUsedInfo.iIapId ) + { + testAccessPoint = ETrue; + // let the helper app do the query if necessary + LOG_WRITE("AiHelper needs to be launched"); + iActiveWrappers->LaunchHelperApplicationL( iUsedInfo, + iConnectOnly, + testAccessPoint ); + } + + // Connect + if ( iUsedInfo.iIapId ) + { + if ( testAccessPoint ) + { + iActiveWrappers->Connect( iUsedInfo.iIapId, iConnectOnly, + EIapExpireOnDisconnect ); + + } + else + { + iActiveWrappers->Connect( iUsedInfo.iIapId, iConnectOnly, + EIapPersistent ); + } + } + // pop cleanup item + CleanupStack::Pop(); + } + + +// --------------------------------------------------------------------------- +// TWsfAiController::CleanUpConnectingL +// --------------------------------------------------------------------------- +// +void TWsfAiController::CleanUpConnectingL( TAny* aPtr ) + { + LOG_ENTERFN( "TWsfAiController::CleanUpConnectingL" ); + TWsfAiController* self = static_cast( aPtr ); + self->iModel->SetConnecting( EFalse ); + self->iAiModel->SetConnecting( EFalse ); + TRAP_IGNORE( self->RefreshUiL()); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::ContinueBrowsingL +// -------------------------------------------------------------------------- +// +void TWsfAiController::ContinueBrowsingL() + { + LOG_ENTERFN( "TWsfAiController::ContinueBrowsingL" ); + + _ASS_D( iModel ); + + iModel->ContinueBrowsingL(); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::LaunchSearchDialogL +// -------------------------------------------------------------------------- +// +TBool TWsfAiController::LaunchSearchDialogL( TWsfWlanInfo& aInfo ) + { + LOG_ENTERFN( "TWsfAiController::LaunchSearchDialogL" ); + + _ASS_D( iAiModel ); + _ASS_D( iUi ); + + MWsfAiUiObserver* temp = iUi; + TInt selectedWlan( KFirstItemArrayIndex ); + TBool success( EFalse ); + + TRAPD( err, success = DoLaunchSearchDialogL( selectedWlan ) ); + + iUi = temp; + User::LeaveIfError( err ); + + if ( success ) + { + if ( iAiModel->Connected() ) + { + // show the error note of double connections + HBufC* txt = StringLoader::LoadLC( + R_QTN_WLAN_INFO_CONNECTION_ALREADY_ACTIVE ); + + CAknErrorNote* errorNote = new (ELeave) CAknErrorNote; + errorNote->ExecuteLD( *txt ); + + CleanupStack::PopAndDestroy( txt ); + success = EFalse; + } + else + { + CWsfWlanInfoArray* wlanArray = iAiModel->GetInfoArray(); + // check that the model still has the entry + if ( wlanArray && selectedWlan < wlanArray->Count() ) + { + // get wlan info + aInfo = *wlanArray->At( selectedWlan ); + } + else + { + // other unlisted item was selected + } + } + } + return success; + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::DoLaunchSearchDialogL +// -------------------------------------------------------------------------- +// +TBool TWsfAiController::DoLaunchSearchDialogL( TInt& aSelectedItem ) + { + LOG_ENTERFN( "TWsfAiController::DoLaunchSearchDialogL" ); + + _ASS_D( iAiModel ); + _ASS_D( iModel ); + + CWsfSearchWlansDialog* dialog = CWsfSearchWlansDialog::NewL( + aSelectedItem ); + dialog->PrepareLC( R_QTN_PLUGIN_SEARCH_WLAN_NETWORKS ); + + // ownership of the icon array is passed + CAknIconArray* icons = CWsfIconArrayCreator::CreateArrayL(); + CleanupStack::PushL( icons ); + iAiModel->AppendBrandIconsL( *icons ); + dialog->SetIconArrayL( icons ); // ownership of the icon array is passed + CleanupStack::Pop( icons ); + + // the dialog is ready to receive data... + iUi = dialog; + iUi->UpdateHotSpotsL( iAiModel->FormatWlanListL( + iActiveWrappers->GetWLANList(), EFalse ), + KFirstItemArrayIndex ); + + return dialog->RunLD(); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::RefreshUiL +// -------------------------------------------------------------------------- +// +void TWsfAiController::RefreshUiL() + { + LOG_ENTERFN( "TWsfAiController::RefreshUiL" ); + + _ASS_D( iAiModel ); + _ASS_D( iUi ); + + if ( !iInfoArray ) + { + return; + } + + MDesCArray* data = iUi->MultilineControl() ? + iAiModel->FormatWlanListL( iInfoArray, ETrue ): + iAiModel->FormatSingleLineWlanListL( iInfoArray ); + + TInt currentItem = ( iModel->IsConnecting() )? + KSuppressRefreshIndex: KFirstItemArrayIndex; + + iUi->UpdateHotSpotsL( data, currentItem ); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::EnableScanL +// -------------------------------------------------------------------------- +// +void TWsfAiController::EnableScanL() + { + LOG_ENTERFN( "TWsfAiController::EnableScanL" ); + + _ASS_D( iAiModel ); + _ASS_D( iModel ); + _ASS_D( iUi ); + + if ( iAiModel->ScanningOn() ) + { + return; + } + iModel->EnableScanL(); + iAiModel->SetScanningOn(); + + LOG_WRITE( "DbObserver enable scan" ); + iDbObserver->EnableScanL(); + + MDesCArray *data = iAiModel->FormatRefreshingL(); + iUi->UpdateHotSpotsL( data, KFirstItemArrayIndex ); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::DisableScanL +// -------------------------------------------------------------------------- +// +void TWsfAiController::DisableScanL() + { + LOG_ENTERFN( "TWsfAiController::DisableScanL" ); + + _ASS_D( iAiModel ); + _ASS_D( iModel ); + _ASS_D( iUi ); + + if ( !iAiModel->ScanningOn() ) + { + return; + } + iModel->DisableScanL(); + iAiModel->SetScanningOff(); + iDbObserver->DisableScanL(); + iUi->DisplayEngineOffL(); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::DoHandleEngineErrorL +// -------------------------------------------------------------------------- +// +void TWsfAiController::DoHandleEngineErrorL( TInt aError ) + { + LOG_ENTERFN( "TWsfAiController::DoHandleEngineErrorL" ); + // start by freeing some resources... + // we could start by freeing wlan search results + _ASS_D( iAiModel ); + + // show error to user... + iEnv->ResolveError( aError ); + } + + +// --------------------------------------------------------------------------- +// TWsfAiController::IsWlanUsedByBrowserL +// --------------------------------------------------------------------------- +// +TBool TWsfAiController::IsWlanUsedByBrowserL() + { + LOG_ENTERFN( "CWsfMainView::IsWlanUsedByBrowserL" ); + + _ASS_D( iAiModel ); + + const TInt KBrowserUid = 0x10008D39; + TUid id( TUid::Uid( KBrowserUid ) ); + + // Check if the Browser application is already running. + TApaTaskList taskList( iEnv->WsSession() ); + TApaTask task = taskList.FindApp( id ); + TBool isWlanUsed( EFalse ); + +#ifndef __WINS__ + + if ( task.Exists() ) + { + LOG_WRITE( "The Browser is running." ); + // The Browser is already running. + // Check if the selected WLAN is connected. + TBool connected( iAiModel->Connected() ); + LOG_WRITEF("Connected? %d", connected); + + if ( connected ) + { + RConnectionMonitor connectionMonitor; + connectionMonitor.ConnectL(); + // We have to check if the Browser using the selected + // connection. + // We have get the connectiond ID first. + CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewL(); + CleanupStack::PushL( waiter ); + + // first call, need to get the connection parameters + TUint connectionCount( 0 ); + + connectionMonitor.GetConnectionCount( connectionCount, + waiter->iStatus ); + waiter->WaitForRequest(); + + // find the connection with WLAN bearer + // that will be the selected WLAN + TUint connectionId( 0 ); + for ( TUint i = 1; i <= connectionCount; ++i ) + { + TUint tmpConnectionId( 0 ); + TUint subConnectionCount( 0 ); + TConnMonBearerType bearerType( EBearerUnknown ); + + connectionMonitor.GetConnectionInfo( i, + tmpConnectionId, + subConnectionCount ); + connectionMonitor.GetIntAttribute( tmpConnectionId, + 0, + KBearer, + ( TInt& )bearerType, + waiter->iStatus ); + waiter->WaitForRequest(); + if ( bearerType == EBearerWLAN ) + { + connectionId = tmpConnectionId; + break; + } + } + // Now we have the connectiond ID. + LOG_WRITEF( "connectionId: %d", connectionId ); + + TInt count( 0 ); + TConnMonClientEnumBuf clientBuf; + + connectionMonitor.GetPckgAttribute( connectionId, + 0, + KClientInfo, + clientBuf, + waiter->iStatus ); + waiter->WaitForRequest(); + if ( !waiter->iStatus.Int() ) + { + count = clientBuf().iCount; + } + + RApaLsSession appSess; + TApaAppInfo appInfo; + + // The connection could be shared by several applications + User::LeaveIfError( appSess.Connect() ); + + for ( TUint i = 0; i < count; i++ ) + { + appInfo.iCaption.Zero(); + TInt result = appSess.GetAppInfo( appInfo, + clientBuf().iUid[i] ); + + LOG_WRITEF( "result: %d", result ); + LOG_WRITEF( "iClientInfo.iUid[i].iUid: %x", + clientBuf().iUid[i].iUid ); + + if ( clientBuf().iUid[i].iUid == KBrowserUid ) + { + isWlanUsed = ETrue; + } + } + CleanupStack::PopAndDestroy( waiter ); + appSess.Close(); + connectionMonitor.Close(); + } + } + else + { + LOG_WRITE( "No Browser running." ); + } + +#endif // __WINS__ + + LOG_WRITEF( "isWlanUsedByBrowser: %d", isWlanUsed ); + return isWlanUsed; + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::HandleMskIfOfflineL +// -------------------------------------------------------------------------- +// +void TWsfAiController::HandleMskIfOfflineL() + { + LOG_ENTERFN( "TWsfAiController::HandleMskIfOfflineL" ); + + // create the dialog with options + TInt selectedMode( 0 ); + CAknListQueryDialog* listQuery = new (ELeave) CAknListQueryDialog( + &selectedMode ); + listQuery->PrepareLC( R_QTN_AIPLUGIN_OPTIONS_OFFLINE ); + + if ( !listQuery->RunLD() ) + { + // cancelled + return; + } + + CWsfWlanInfoArray* wlanArray = iAiModel->GetInfoArray(); + + switch ( selectedMode ) + { + case EAiOfflineStartBrowsing: + { + // Start web browsing was selected + if ( !wlanArray || !wlanArray->Count() || + !wlanArray->At( KFirstItemArrayIndex )->Known() ) + { + // no known networks, let the user choose one + TWsfWlanInfo info; + + if ( LaunchSearchDialogL( info ) ) + { + StartBrowsingL( info ); + } + } + else + { + // there are known networks + StartBrowsingL( *wlanArray->At( KFirstItemArrayIndex ) ); + } + + break; + } + + case EAiOfflineConnect: + { + // Connect was selected + if ( !wlanArray || !wlanArray->Count() || + !wlanArray->At( KFirstItemArrayIndex )->Known() ) + { + // no known networks, let the user choose one + TWsfWlanInfo info; + + if ( LaunchSearchDialogL( info ) ) + { + ConnectL( info, ETrue, EFalse ); + } + } + else + { + // there are known networks + ConnectL( *wlanArray->At( KFirstItemArrayIndex ), ETrue, + EFalse ); + } + + break; + } + + case EAiOfflineSearchWlans: + { + // Search for wlans was selected + if ( !wlanArray || !wlanArray->Count() ) + { + // there are no available networks + CConnectionUiUtilities* connUiUtils = CConnectionUiUtilities::NewL(); + connUiUtils->NoWLANNetworksAvailableNote(); + delete connUiUtils; + } + + // launch the search dialog + TWsfWlanInfo info; + + if ( LaunchSearchDialogL( info ) ) + { + ConnectL( info, ETrue, EFalse ); + } + else + { + // User canceled Search Wlans dialog and probably did not + // find anything interesting from the list - request scan + iActiveWrappers->RefreshScan(); + } + + break; + } + + case EAiOfflineDisableScan: + { + // disable the scan + DisableScanL(); + break; + } + + default: + { + } + } + } + + + +// -------------------------------------------------------------------------- +// TWsfAiController::HandleMskIfConnectedL +// -------------------------------------------------------------------------- +// +void TWsfAiController::HandleMskIfConnectedL() + { + LOG_ENTERFN( "TWsfAiController::HandleMskIfConnectedL" ); + + _ASS_D( iModel ); + + TInt selectedMode( 0 ); + CAknListQueryDialog* listQuery = new (ELeave) CAknListQueryDialog( + &selectedMode ); + listQuery->PrepareLC( R_QTN_AIPLUGIN_OPTIONS_CONNECTED ); + + if ( listQuery->RunLD() ) + { + if ( selectedMode == EAiConnectedStartBrowsing ) + { + StartBrowsingL( iConnectedWlan ); + } + else if ( selectedMode == EAiConnectedDisconnect ) + { + // disconnect wlan + iActiveWrappers->Disconnect(); + } + } + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::HandleMskIfConnectingL +// -------------------------------------------------------------------------- +// +void TWsfAiController::HandleMskIfConnectingL() + { + LOG_ENTERFN( "TWsfAiController::HandleMskIfConnectingL" ); + + _ASS_D( iModel ); + + TInt selectedMode( 0 ); + CAknListQueryDialog* listQuery = new (ELeave) CAknListQueryDialog( + &selectedMode ); + listQuery->PrepareLC( R_QTN_AIPLUGIN_OPTIONS_CONNECTING ); + + if ( listQuery->RunLD() ) + { + if ( selectedMode == EAiConnectingDisconnect ) + { + if ( !iModel->IsConnecting() ) + { + // disconnect wlan + iActiveWrappers->Disconnect(); + } + else + { + // disconnect wlan + iModel->AbortConnectingL(); + ConnectingFinishedL( KErrCancel ); + } + } + } + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::HandleMskIfBrowsingL +// -------------------------------------------------------------------------- +// +void TWsfAiController::HandleMskIfBrowsingL() + { + LOG_ENTERFN( "TWsfAiController::HandleMskIfBrowsingL" ); + + _ASS_D( iModel ); + + TInt selectedMode( KFirstItemArrayIndex ); + CAknListQueryDialog* listQuery = new (ELeave) CAknListQueryDialog( + &selectedMode ); + listQuery->PrepareLC( R_QTN_AIPLUGIN_OPTIONS_BROWSING ); + + if ( listQuery->RunLD() ) + { + if ( selectedMode == EAiBrowsingContinueBrowsing ) + { + // launch the browser... + ContinueBrowsingL(); + } + else if ( selectedMode == EAiBrowsingDisconnect ) + { + // disconnect wlan + iActiveWrappers->Disconnect(); + } + } + } + +// -------------------------------------------------------------------------- +// TWsfAiController::RefreshRefreshingL +// -------------------------------------------------------------------------- +// +void TWsfAiController::RefreshRefreshingL() + { + LOG_ENTERFN( "TWsfAiController::RefreshRefreshingL" ); + if ( !iUi->MultilineControl() ) + { + MDesCArray *data = iAiModel->FormatRefreshingL(); + iUi->UpdateViewL( data ); + } + else + { + LOG_WRITE( "Multiline control in use - no update done" ); + } + } + +// -------------------------------------------------------------------------- +// TWsfAiController::RefreshConnectingL +// -------------------------------------------------------------------------- +// +void TWsfAiController::RefreshConnectingL() + { + LOG_ENTERFN( "TWsfAiController::RefreshConnectingL" ); + if ( !iUi->MultilineControl() ) + { + MDesCArray *data = iAiModel->FormatConnectingL(); + iUi->UpdateViewL( data ); + } + else + { + LOG_WRITE( "Multiline control in use - no update done" ); + } + } + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/src/wsfaimodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfaimodel.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,681 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfAiModel. +* +*/ + +// EXTERNAL INCLUDES +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include "wsfaimodel.h" +#include "wsfwlaninfo.h" +#include "wsfwlaninfoarray.h" +#include "wsfaiplugincommon.h" +#include "wsfwlaninfoarrayvisitor.h" +#include "wsflogger.h" + +// MACROS +#ifdef _DEBUG + _LIT( KModelPanic, "CWsfAiModel" ); + #define _ASS_D( cond ) __ASSERT_DEBUG( (cond), \ + User::Panic( KModelPanic, __LINE__) ) +#else + #define _ASS_D( cond ) {} +#endif //_DEBUG + +// LOCAL DEFINITIONS +const TInt KListBoxItemMaxLength = 128; +const TUint KWLanListGranularity = 4; + +// List item format +_LIT( KListItemFormat, "%d\t%S\t%d\t%d" ); + +// List item format for "Other (unlisted)" item +_LIT( KHiddenItemFormat, "\t%S" ); + + +// CONSTRUCTION AND DESTRUCTION +// -------------------------------------------------------------------------- +// CWsfAiModel::NewL +// -------------------------------------------------------------------------- +// +CWsfAiModel* CWsfAiModel::NewL() + { + CWsfAiModel* self = CWsfAiModel::NewLC(); + CleanupStack::Pop( self ); + return self; + } + + +// -------------------------------------------------------------------------- +// CWsfAiModel::NewLC +// -------------------------------------------------------------------------- +// +CWsfAiModel* CWsfAiModel::NewLC() + { + CWsfAiModel* self = new( ELeave ) CWsfAiModel; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// -------------------------------------------------------------------------- +// CWsfAiModel::~CWsfAiModel +// -------------------------------------------------------------------------- +// +CWsfAiModel::~CWsfAiModel() + { + delete iWlanInfoBranding; + delete iFormattedWlanList; + if ( iStatusRefreshing ) + { + delete iStatusRefreshing; + } + if ( iStatusConnecting ) + { + delete iStatusConnecting; + } + if ( iStatusScanningOff ) + { + delete iStatusScanningOff; + } + if ( iManualSSIDInputting ) + { + delete iManualSSIDInputting; + } + } + + +// -------------------------------------------------------------------------- +// CWsfAiModel::CWsfAiModel +// -------------------------------------------------------------------------- +// +CWsfAiModel::CWsfAiModel(): + iCoeEnv( CCoeEnv::Static() ), + iScanning( EFalse ), + iConnected( EFalse ), + iRefreshIndex( iRefreshIcons.Count() - 1 ), + iConnectingIndex( iConnectingIcons.Count() - 1 ) + { + } + + +// -------------------------------------------------------------------------- +// CWsfAiModel::ConstructL +// -------------------------------------------------------------------------- +// +void CWsfAiModel::ConstructL() + { + iFormattedWlanList = new (ELeave) CDesCArrayFlat( KWLanListGranularity ); + iWlanInfoBranding = CWsfWlanInfoArrayVisitor::NewL( ETrue ); + iWlanInfoBranding->LoadFilterDefinitionsL(); + + iRefreshIcons[0] = EWlanOnIcon_0; + iRefreshIcons[1] = EWlanOnIcon_1; + iRefreshIcons[2] = EWlanOnIcon; + iRefreshIcons[3] = EWlanOnIcon_1; + + iConnectingIcons[0] = EWlanOnIcon_0; + iConnectingIcons[1] = EWlanOnIcon_1; + iConnectingIcons[2] = EWlanOnIcon; + iConnectingIcons[3] = EWlanOnIcon_1; + } + + +// -------------------------------------------------------------------------- +// CWsfAiModel::FormatWlanListL +// -------------------------------------------------------------------------- +// +CDesCArrayFlat* CWsfAiModel::FormatWlanListL( CWsfWlanInfoArray* aWlanList, const TBool aUIPrioritySort ) + { + LOG_ENTERFN( "CWsfAiModel::FormatWlanListL" ); + HBufC* item = HBufC::NewLC( KListBoxItemMaxLength ); + TPtr ptr( item->Des() ); + iFormattedWlanList->Reset(); + + // Function expects that items in list are already in proper order + iWlanInfoArray = aWlanList; + + if ( iWlanInfoArray ) + { + if ( aUIPrioritySort ) + { + iWlanInfoArray->SetUIPrioritySort( ETrue ); + iWlanInfoArray->SortArrayL( *iWlanInfoBranding ); + // Sort Array with default sort + // this sets the highest UI priority networks on top + iWlanInfoArray->SortArrayL( ); + iWlanInfoArray->SetUIPrioritySort( EFalse ); + } + else + { + iWlanInfoArray->SortArrayL( *iWlanInfoBranding ); + } + + for (TInt i = 0; i < iWlanInfoArray->Count(); ++i ) + { + TWsfWlanInfo* wlanInfo = iWlanInfoArray->At(i); + + // Hidden WLAN item is appended later for unknown hidden networks + if ( !wlanInfo || ( wlanInfo->Hidden() && !wlanInfo->iIapId ) ) + { + continue; + } + + // known hidden wlans are also "visible" + ptr.Zero(); + FormatWlanSingleLineL( *wlanInfo, ptr, EFalse ); + iFormattedWlanList->AppendL( ptr ); + } + } + + // now add "Other (unlisted)..." for hidden networks (always visible) + // make up a dummy wlaninfo + TWsfWlanInfo dummy; + + ptr.Zero(); + FormatHiddenWlanItemL( dummy, ptr ); + iFormattedWlanList->AppendL( ptr ); + + CleanupStack::PopAndDestroy ( item ); + return iFormattedWlanList; + } + + +// -------------------------------------------------------------------------- +// CWsfAiModel::GetWlanList +// -------------------------------------------------------------------------- +// +CDesCArrayFlat* CWsfAiModel::GetWlanList() + { + LOG_ENTERFN( "CWsfAiModel::GetWlanList" ); + return iFormattedWlanList; + } + + +// -------------------------------------------------------------------------- +// CWsfAiModel::GetInfoArray +// -------------------------------------------------------------------------- +// +CWsfWlanInfoArray* CWsfAiModel::GetInfoArray() + { + LOG_ENTERFN( "CWsfAiModel::GetInfoArray" ); + return iWlanInfoArray; + } + + +// -------------------------------------------------------------------------- +// CWsfAiModel::FormatSingleLineWlanListL +// -------------------------------------------------------------------------- +// +CDesCArrayFlat* CWsfAiModel::FormatSingleLineWlanListL( + CWsfWlanInfoArray* aWlanList ) + { + LOG_ENTERFN( "CWsfAiModel::FormatSingleLineWlanListL" ); + iWlanInfoArray = aWlanList; + + if ( iWlanInfoArray ) + { + iWlanInfoArray->SetUIPrioritySort( ETrue ); + iWlanInfoArray->SortArrayL( *iWlanInfoBranding ); + + // Sort Array with default sort + // this sets the highest UI priority networks on top + iWlanInfoArray->SortArrayL(); + iWlanInfoArray->SetUIPrioritySort( EFalse ); + } + + iFormattedWlanList->Reset(); + + HBufC* item = HBufC::NewLC( KListBoxItemMaxLength ); + TPtr ptr( item->Des() ); + + if ( iConnected ) + { + FormatConnectedL( ptr ); + iFormattedWlanList->AppendL( ptr ); + } + else if ( iConnecting ) + { + FormatConnectingL(); + } + else if ( !iScanning ) + { + FormatStatusOffL( ptr ); + iFormattedWlanList->AppendL( ptr ); + } + // if there's wlans avail + else if ( iWlanInfoArray && iWlanInfoArray->Count() ) + { + CheckWlansL( iWlanInfoArray, ptr ); + iFormattedWlanList->AppendL( ptr ); + } + else + { + // no wlans available + FormatNoWlansAvailableL( ptr ); + iFormattedWlanList->AppendL( ptr ); + } + + CleanupStack::PopAndDestroy( item ); + + return iFormattedWlanList; + } + + +// -------------------------------------------------------------------------- +// CWsfAiModel::FormatRefreshingL +// -------------------------------------------------------------------------- +// +CDesCArrayFlat* CWsfAiModel::FormatRefreshingL() + { + LOG_ENTERFN( "CWsfAiModel::FormatRefreshingL" ); + iFormattedWlanList->Reset(); + HBufC* item = HBufC::NewLC( KListBoxItemMaxLength ); + TPtr ptr( item->Des() ); + + if ( !iStatusRefreshing ) + { + iStatusRefreshing = StringLoader::LoadL( + R_QTN_SNIFFER_PLUG_IN_REFRESHING ); + } + + ptr.Format( KListItemFormat, ScanningOn() ? + iRefreshIcons[ iRefreshIndex ] + : EWlanOffIcon, + iStatusRefreshing, + ETransparentIcon, + ETransparentIcon ); + + iFormattedWlanList->AppendL( ptr ); + CleanupStack::PopAndDestroy ( item ); + + return iFormattedWlanList; + } + + +// -------------------------------------------------------------------------- +// CWsfAiModel::FormatConnecting +// -------------------------------------------------------------------------- +// +CDesCArrayFlat* CWsfAiModel::FormatConnectingL() + { + LOG_ENTERFN( "CWsfAiModel::FormatConnectingL" ); + iFormattedWlanList->Reset(); + HBufC* item = HBufC::NewLC( KListBoxItemMaxLength ); + TPtr ptr( item->Des() ); + + if ( !iStatusConnecting ) + { + iStatusConnecting = StringLoader::LoadL( + R_QTN_SNIFFER_PLUG_IN_CONNECTING ); + } + + ptr.Format( KListItemFormat, iConnectingIcons[ iConnectingIndex ], + iStatusConnecting, + ETransparentIcon, + ETransparentIcon ); + + iFormattedWlanList->AppendL( ptr ); + CleanupStack::PopAndDestroy ( item ); + return iFormattedWlanList; + } + + +// -------------------------------------------------------------------------- +// CWsfAiModel::AppendBrandIconsL +// -------------------------------------------------------------------------- +// +void CWsfAiModel::AppendBrandIconsL( CAknIconArray& aIconArray ) + { + LOG_ENTERFN( "CWsfAiModel::AppendBrandIconsL" ); + iWlanInfoBranding->AppendBrandingIconsL( aIconArray ); + } + + +// -------------------------------------------------------------------------- +// CWsfAiModel::FormatHiddenWlanItemL +// -------------------------------------------------------------------------- +// +void CWsfAiModel::FormatHiddenWlanItemL( TWsfWlanInfo& /*aWlan*/, + TPtr& aItem ) + { + LOG_ENTERFN( "CWsfAiModel::FormatHiddenWlanItemL" ); + if ( !iManualSSIDInputting ) + { + iManualSSIDInputting = StringLoader::LoadL( + R_QTN_WLAN_MANUAL_SSID_INPUT ); + } + + // Only Hidden WLAN text is shown. + // No icons for this item + aItem.Format( KHiddenItemFormat, iManualSSIDInputting ); + } + + +// -------------------------------------------------------------------------- +// CWsfAiModel::FormatStatusOffL +// -------------------------------------------------------------------------- +// +void CWsfAiModel::FormatStatusOffL( TPtr& aItem ) + { + LOG_ENTERFN( "CWsfAiModel::FormatStatusOffL" ); + if ( !iStatusScanningOff ) + { + iStatusScanningOff = StringLoader::LoadL( + R_QTN_SNIFFER_PLUG_IN_SCANNING_OFF ); + } + + aItem.Format( KListItemFormat, + EWlanOffIcon, + iStatusScanningOff, + ETransparentIcon, + ETransparentIcon ); + } + + +// -------------------------------------------------------------------------- +// CWsfAiModel::FormatNoWlansAvailableL +// -------------------------------------------------------------------------- +// +void CWsfAiModel::FormatNoWlansAvailableL( TPtr& aItem ) + { + LOG_ENTERFN( "CWsfAiModel::FormatNoWlansAvailableL" ); + + if ( !iNoWLANsAvailable ) + { + iNoWLANsAvailable = StringLoader::LoadL( + R_QTN_STATUS_NO_WLANS_AVAILABLE ); + } + + aItem.Format( KListItemFormat, + ScanningOn()? EWlanOnIcon: EWlanOffIcon, + iNoWLANsAvailable, + ETransparentIcon, + ETransparentIcon ); + } + + +// -------------------------------------------------------------------------- +// CWsfAiModel::FormatWlanSingleLineL +// -------------------------------------------------------------------------- +// +void CWsfAiModel::FormatWlanSingleLineL( TWsfWlanInfo& aWlan, + TPtr& aItem, + TBool aSingleLine ) + { + LOG_ENTERFN( "CWsfAiModel::FormatWlanSingleLineL" ); + //Ssid as primary text + HBufC* ssid( NULL ); + HBufC* formatData( NULL ); + TInt column1Icon( 0 ); + + if ( aWlan.iNetworkName.Length() ) // If there is IAP + { + ssid = aWlan.GetIapNameAsUnicodeLC(); + } + else // If there no IAP + { + ssid = aWlan.GetSsidAsUnicodeLC(); + } + + + column1Icon = ETransparentIcon; + + if ( aSingleLine ) + { + // AI single line mode + if ( aWlan.Connected() ) + { + column1Icon = EConnectedNWIcon; + } + else if ( aWlan.Known() ) + { + column1Icon = EWlanOnIcon; + } + + // format ssid into string '' + formatData = StringLoader::LoadLC( R_SSID, *ssid, iCoeEnv ); + } + else + { + // Search wlans dialog multiline mode + + if ( aWlan.BrandId() ) + { + column1Icon = EWlanOffIcon + aWlan.BrandId(); + } + else if ( aWlan.Connected() ) + { + column1Icon = EConnectedNWIcon; // qgn_prop_wlan_bearer.svg + } + else if ( aWlan.Known() ) + { + column1Icon = EKnownNWIcon; // qgn_prop_wlan_bearer.svg + } + } + + + // Signal strenght for column 4 + // No signal icon is set by default in case is SingleLine mode off + TInt column3Icon = aSingleLine ? ETransparentIcon: + ENoSignalIcon; //qgn_transparent.svg + TInt column4Icon = ETransparentIcon; + + if ( aWlan.Connected() || !aSingleLine ) + { + // Column 3 + // Show secure icon if network is secure. + // By default show transparant icon. + column4Icon = aWlan.Secure()? ESecureNetworkIcon: ETransparentIcon; + + switch ( aWlan.SignalStrength() ) + { + case EPoor: + { + //qgn_indi_wlan_signal_low_add.svg + column3Icon = EPoorSignal; + break; + } + case EAverage: + { + //qgn_indi_wlan_signal_med_add.svg + column3Icon = EAverageSignal; + break; + } + case EExcelent: + { + //qgn_indi_wlan_signal_good_add.svg + column3Icon = EExcelentSignal; + break; + } + + case ENoSignal: + default: + { + //qgn_indi_wlan_signal_no_wlan.svg + column3Icon = ENoSignalIcon; + break; + } + } + } + + if ( aSingleLine ) + { + aItem.Format( KListItemFormat, + column1Icon, + formatData, + column3Icon, + column4Icon ); + CleanupStack::PopAndDestroy( formatData ); + } + else + { + aItem.Format( KListItemFormat, + column1Icon, + ssid, + column3Icon, + column4Icon ); + } + CleanupStack::PopAndDestroy( ssid ); + } + + +// -------------------------------------------------------------------------- +// CWsfAiModel::FormatUnknownWlansSingleLineL +// -------------------------------------------------------------------------- +// +void CWsfAiModel::FormatUnknownWlansSingleLineL( + const TBool aMultipleUnknownWlans, + TPtr& aItem ) + { + LOG_ENTERFN( "CWsfAiModel::FormatUnknownWlansSingleLineL" ); + TInt unknownItemResource = aMultipleUnknownWlans ? + R_QTN_SNIFFER_PLUG_IN_UNKNOWN_SSIDS_FOUND : + R_QTN_SNIFFER_PLUG_IN_UNKNOWN_SSID_FOUND; + + HBufC* unknownWlansStatusText = iCoeEnv->AllocReadResourceLC( + unknownItemResource ); + + aItem.Format( KListItemFormat, ScanningOn()? EWlanOnIcon: EWlanOffIcon, + unknownWlansStatusText, + ETransparentIcon, + ETransparentIcon ); + + CleanupStack::PopAndDestroy( unknownWlansStatusText ); + } + + +// -------------------------------------------------------------------------- +// CWsfAiModel::FindPreferredKnownWlan +// -------------------------------------------------------------------------- +// +TInt CWsfAiModel::FindPreferredKnownWlan( CWsfWlanInfoArray* aWlanList ) + { + LOG_ENTERFN( "CWsfAiModel::FindPreferredKnownWlan" ); + _ASS_D( aWlanList ); + _ASS_D( aWlanList->Count() ); + + TWsfWlanInfo *preferred = NULL; + TWsfWlanInfo *temp = NULL; + TInt loopIndex( 0 ); + TInt preferredIndex( 0 ); + //loop through the list and find Max signal strength amont know wlans... + + preferred = aWlanList->At( loopIndex ); + loopIndex++; + + for ( ; loopIndex < aWlanList->Count(); ++loopIndex ) + { + temp = aWlanList->At( loopIndex ); + if ( !temp->Known() ) + { + // not known net any more... + break; + } + // check the signal strength + if ( temp->SignalStrength() > preferred->SignalStrength() ) + { + preferredIndex = loopIndex; + preferred = temp; + } + } + return preferredIndex; + } + + +// -------------------------------------------------------------------------- +// CWsfAiModel::CheckWlansL +// -------------------------------------------------------------------------- +// +void CWsfAiModel::CheckWlansL( CWsfWlanInfoArray* aWlanList, TPtr& aItem ) + { + LOG_ENTERFN( "CWsfAiModel::CheckWlansL" ); + _ASS_D( aWlanList ); + _ASS_D( aWlanList->Count() ); + // first check the connected + // if there's connection... it is the first item in array + + if ( aWlanList->At( 0 )->Known() ) + { + FormatWlanSingleLineL( *aWlanList->At( 0 ), aItem, ETrue ); + } + else + { + TBool multipleUnknownWlans = ( aWlanList->Count() > 1 ); + FormatUnknownWlansSingleLineL( multipleUnknownWlans, aItem ); + } + } + + +// -------------------------------------------------------------------------- +// CWsfAiModel::FormatConnectedL +// -------------------------------------------------------------------------- +// +void CWsfAiModel::FormatConnectedL( TPtr& aItem ) + { + LOG_ENTERFN( "CWsfAiModel::FormatConnectedL" ); + // Ssid as primary text + FormatWlanSingleLineL( iConnectedWlanInfo, aItem, ETrue ); + } + +// -------------------------------------------------------------------------- +// CWsfAiModel::InitializeRefreshAnimation +// -------------------------------------------------------------------------- +// +void CWsfAiModel::InitializeRefreshAnimation() + { + LOG_ENTERFN( "CWsfAiModel::InitializeRefreshAnimation" ); + iRefreshIndex = 0; + } + +// -------------------------------------------------------------------------- +// CWsfAiModel::InitializeRefreshAnimation +// -------------------------------------------------------------------------- +// +void CWsfAiModel::InitializeConnectingAnimation() + { + LOG_ENTERFN( "CWsfAiModel::InitializeConnectingAnimation" ); + iConnectingIndex = 0; + } + +// -------------------------------------------------------------------------- +// CWsfAiModel::AnimateRefresh +// -------------------------------------------------------------------------- +// +void CWsfAiModel::AnimateRefresh() + { + LOG_ENTERFN( "CWsfAiModel::AnimateRefresh" ); + ++iRefreshIndex %= iRefreshIcons.Count(); + } + +// -------------------------------------------------------------------------- +// CWsfAiModel::AnimateRefresh +// -------------------------------------------------------------------------- +// +void CWsfAiModel::AnimateConnecting() + { + LOG_ENTERFN( "CWsfAiModel::AnimateConnecting" ); + ++iConnectingIndex %= iConnectingIcons.Count(); + } + + + +// End of file + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/src/wsfaiplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfaiplugin.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,884 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfAiPlugin +* +*/ + + + +// EXTERNAL INCLUDES +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include // KDC_APP_BITMAP_DIR + +// INTERNAL INCLUDES +#include "wsfaiplugin.h" +#include "wsfaipluginuids.hrh" +#include "wsfaiplugincontentmodel.h" +#include "wsfaimodel.h" +#include "wsfmodel.h" +#include "wsfaiview.h" +#include "wsficonarraycreator.h" +#include "wsfdbobserver.h" +#include "wsflogger.h" +#include "wsfactivewrappers.h" + + +// define icon id for Navigation Bar icon +LOCAL_D const TUid KUidSnifferApp = {0x10281CAA}; +LOCAL_D const TInt KRefreshStepTime = 200 * 1000; +LOCAL_D const TInt KConnectingStepTime = 200 * 1000; + + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::NewL +// -------------------------------------------------------------------------- +// +CWsfAiPlugin* CWsfAiPlugin::NewL() + { + LOG_ENTERFN( "CWsfAiPlugin::NewL" ); + CWsfAiPlugin* self = new (ELeave) CWsfAiPlugin; + + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::~CWsfAiPlugin +// -------------------------------------------------------------------------- +// +CWsfAiPlugin::~CWsfAiPlugin() + { + LOG_ENTERFN( "CWsfAiPlugin::~CWsfAiPlugin" ); + // Cancel periodic animation update + if ( iAnimationPeriodic ) + { + LOG_WRITE( "Cancel animation update" ); + iAnimationPeriodic->Cancel(); + delete iAnimationPeriodic; + iAnimationPeriodic = NULL; + } + + delete iDbObserver; + + delete iActiveWrappers; + + delete iModel; + delete iAiModel; + delete iUi; + + if ( iMskActivate ) + { + delete iMskActivate; + } + + if ( iConnectedTo ) + { + delete iConnectedTo; + } + + if ( iKnownNetworkFound ) + { + delete iKnownNetworkFound; + } + + iEnv->DeleteResourceFile( iResourceFileOffset ); + + iObservers.Close(); + + Release( iContent ); + Release( iEvents ); + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::CWsfAiPlugin +// -------------------------------------------------------------------------- +// +CWsfAiPlugin::CWsfAiPlugin() + { + iEnv = CEikonEnv::Static(); + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::ConstructL +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::ConstructL() + { + LOG_ENTERFN( "CWsfAiPlugin::ConstructL" ); + AllocateResourcesL(); + + iContent = AiUtility::CreateContentItemArrayIteratorL( + KAiWizardContent ); + iEvents = AiUtility::CreateContentItemArrayIteratorL( KAiWizardEvents ); + + // create the engine first... + iModel = CWsfModel::NewL( iController, EFalse ); + + // then model + iAiModel = CWsfAiModel::NewL(); + iUi = CWsfAiView::NewL( *this ); + + iActiveWrappers = CWsfActiveWrappers::NewL( iModel, iController ); + + iDbObserver = CWsfDbObserver::NewL(); + + iController.SetUi( *static_cast( iUi ) ); + + iController.InitializeL( iEnv, iModel, iAiModel, iDbObserver, + iActiveWrappers ); + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::PublishContentL +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::PublishContentL( CArrayFix* aPublishIconArray, + CEikLabel* aText1 ) + { + LOG_ENTERFN( "CWsfAiPlugin::PublishContentL" ); + TInt leftBoundary( 0 ); + TInt rightBoundary( 0 ); + TChar boundary('\''); + HBufC* localCurrentStatusText( NULL ); + + HBufC* localCurrentNetworkStatus( NULL ); + HBufC* localCurrentNetworkName( NULL ); + + HBufC* localFullText = ( aText1->Text() )->AllocLC(); + + // Locate ' chars from the full string + TPtrC fullText = localFullText->Des(); + leftBoundary = fullText.Locate( boundary ); // char = ' + rightBoundary = fullText.LocateReverse( boundary ); + + // if we have status name then we parse it + if ( leftBoundary != rightBoundary && + leftBoundary != KErrNotFound && + rightBoundary != KErrNotFound ) + { + LOG_WRITE( "status name exists" ); + TPtrC begin = fullText.Mid( leftBoundary, + rightBoundary - leftBoundary + 1 ); + localCurrentStatusText = begin.AllocLC(); + localCurrentNetworkName = begin.AllocLC(); + + TPtrC end = fullText.Mid( rightBoundary + 1 ); + } + else + { + LOG_WRITE( "status name does not exist" ); + localCurrentStatusText = fullText.AllocLC(); + } + + //Connected + if ( localCurrentNetworkName ) + { + if ( iAiModel->Connected() ) + { + LOG_WRITE( "ai model is connected" ); + if ( !iConnectedTo ) + { + iConnectedTo = StringLoader::LoadL( + R_QTN_SNIFFER_PLUG_IN_CONNECTED_TO ); + } + localCurrentNetworkStatus = iConnectedTo; + } + else + { + if ( !iKnownNetworkFound ) + { + iKnownNetworkFound = StringLoader::LoadL( + R_QTN_SNIFFER_PLUG_IN_WLAN_NETWORK_FOUND ); + } + LOG_WRITE( "there is known network" ); + localCurrentNetworkStatus = iKnownNetworkFound; + } + } + else + { + LOG_WRITE( "use current status text" ); + localCurrentNetworkStatus = localCurrentStatusText; + } + + TBool published( EFalse ); + TInt iconId( 0 ); + + ClearL(); // Clear all WLAN Wizard content from the AI2 + + for ( iCurrentObserverIndex = 0; + iCurrentObserverIndex < iObservers.Count(); + ++iCurrentObserverIndex ) + { + LOG_WRITEF( "Start publish - index = %d", iCurrentObserverIndex ); + + MAiContentObserver* observer = iObservers[iCurrentObserverIndex]; + observer->StartTransaction( reinterpret_cast( this ) ); + // make sure we cancel the tracsaction if leaves + CleanupStack::PushL( TCleanupItem( PublishCleanup, this ) ); + + if ( localCurrentStatusText ) + { + LOG_WRITE( "Publish -> status icon" ); + // Publish Status icon: EAiWizardContentStatusIcon + iconId = aPublishIconArray->At( 0 ); + published = PublishIconL( observer, + EAiWizardContentStatusIcon, + iconId ) || published; + } + + LOG_WRITE( "Publish -> Strength icon" ); + // Publish Strength icon: EAiWizardContentStrengthIcon + iconId = aPublishIconArray->At( 2 ); + published = PublishIconL( observer, + EAiWizardContentStrengthIcon, + iconId ) || published; + + LOG_WRITE( "Publish -> secure icon" ); + // Publish Secure icon: EAiWizardContentSecureIcon + iconId = aPublishIconArray->At( 1 ); + published = PublishIconL( observer, + EAiWizardContentSecureIcon, + iconId ) || published; + + if ( localCurrentNetworkName ) + { + LOG_WRITE( "Publish -> localCurrentNetworkName" ); + // Publish NetworkName text: EAiWizardContentNetworkName + published = PublishText( observer, + EAiWizardContentNetworkName, + *localCurrentNetworkName ) || published; + } + + if ( localCurrentNetworkStatus ) + { + LOG_WRITE( "Publish -> localCurrentNetworkStatus" ); + // Publish NetworkName text: EAiWizardContentNetworkName + published = PublishText( observer, + EAiWizardContentNetworkStatus, + *localCurrentNetworkStatus ) || published; + } + + // If we published something then commit, + // otherwise cancel transaction + if ( published ) + { + LOG_WRITE( "Commit" ); + observer->Commit( reinterpret_cast( this ) ); + published = EFalse; + } + else + { + LOG_WRITE( "Cancel transaction" ); + observer->CancelTransaction( reinterpret_cast( this ) ); + } + CleanupStack::Pop( 1 ); // PublishCleanup() + } + + LOG_WRITE( "Publishing ready" ); + + if ( localCurrentNetworkName ) + { + CleanupStack::PopAndDestroy( localCurrentNetworkName ); + } + + if ( localCurrentStatusText ) + { + CleanupStack::PopAndDestroy( localCurrentStatusText ); + } + + CleanupStack::PopAndDestroy( localFullText ); + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::AllocateResourcesL +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::AllocateResourcesL() + { + LOG_ENTERFN( "CWsfAiPlugin::AllocateResourcesL" ); + // create resourcefile + TFileName resourceFile; + resourceFile.Append( KResourceDrive ); + resourceFile.Append( KDC_RESOURCE_FILES_DIR ); + resourceFile.Append( KResourceFile ); + + BaflUtils::NearestLanguageFile( iEnv->FsSession(), resourceFile ); + iResourceFileOffset = iEnv->AddResourceFileL( resourceFile ); + } + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::Start +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::Start( TStartReason /*aReason*/ ) + { + LOG_ENTERFN( "CWsfAiPlugin::Start"); + iController.StartupRefresh(); + } + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::Stop +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::Stop( TStopReason /*aReason*/ ) + { + LOG_ENTERFN( "CWsfAiPlugin::Stop" ); + TRAP_IGNORE( iController.DeInitializeL() ); + if ( iAnimationPeriodic ) + { + LOG_WRITE( "Cancel animation update" ); + iAnimationPeriodic->Cancel(); + delete iAnimationPeriodic; + iAnimationPeriodic = NULL; + } + } + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::Resume +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::Resume( TResumeReason aReason ) + { + LOG_ENTERFN( "CWsfAiPlugin::Resume" ); + if( aReason == EForeground ) + { + // HS came to foreground -> make refresh scan + if ( !iAiModel->Connected() && !iModel->IsConnecting() ) + { + LOG_WRITE( "Call Refresh scan" ); + iActiveWrappers->RefreshScan(); + } + else + { + LOG_WRITE( "Connected no need to refresh scan results" ); + } + } + } + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::Suspend +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::Suspend( TSuspendReason aReason ) + { + LOG_ENTERFN( "CWsfAiPlugin::Suspend" ); + + if( aReason == EBackground ) + { + if ( iAnimationPeriodic ) + { + LOG_WRITE( "Cancel animation update" ); + iAnimationPeriodic->Cancel(); + delete iAnimationPeriodic; + iAnimationPeriodic = NULL; + } + } + } + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::SubscribeL +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::SubscribeL( MAiContentObserver& aObserver ) + { + LOG_ENTERFN( "CWsfAiPlugin::Subscribe" ); + iObservers.AppendL( &aObserver ); + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::ConfigureL +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::ConfigureL( RAiSettingsItemArray& /*aSettings*/ ) + { + LOG_ENTERFN( "CWsfAiPlugin::ConfigureL" ); + } + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::GetPropertyL +// -------------------------------------------------------------------------- +// +TAny* CWsfAiPlugin::GetProperty( TProperty aProperty ) + { + if( aProperty == EPublisherContent ) + { + return iContent; + } + else if( aProperty == EPublisherEvents ) + { + return iEvents; + } + + return NULL; + } + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::HandleEvent +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::HandleEvent( TInt aEvent, const TDesC& /*aParam*/ ) + { + LOG_ENTERFN( "CWsfAiPlugin::HandleEvent" ); + switch ( aEvent ) + { + case EAiWizardEventLaunchApplication: + { + TRAP_IGNORE( LaunchApplicationL() ); + break; + } + + case EAiWizardGainFocusInfoArea: + { + iInfoAreaFocus = ETrue; + TRAP_IGNORE( SetMskL() ); + break; + } + + case EAiWizardLostFocusInfoArea: + { + iInfoAreaFocus = EFalse; + break; + } + + case EAiWizardOpenMenu: + { + if ( !iRefreshing ) + { + TRAP_IGNORE( iController.HandleSelectionKeyL() ); + } + break; + } + + default: + { + } + } + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::ClearL +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::ClearL() + { + LOG_ENTERFN( "CWsfAiPlugin::ClearL" ); + for ( TInt i = 0; i < iObservers.Count(); ++i ) + { + MAiContentObserver* observer = iObservers[i]; + + observer->StartTransaction( reinterpret_cast( this ) ); + + observer->Clean( *this, EAiWizardContentStatusIcon, + EAiWizardContentStatusIcon ); + observer->Clean( *this, EAiWizardContentStrengthIcon, + EAiWizardContentStrengthIcon ); + observer->Clean( *this, EAiWizardContentSecureIcon, + EAiWizardContentSecureIcon ); + observer->Clean( *this, EAiWizardContentNetworkName, + EAiWizardContentNetworkName ); + + observer->Commit( reinterpret_cast( this ) ); + } + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::SetScanningState +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::SetScanningState( TBool aScanState ) + { + LOG_ENTERFN( "CWsfAiPlugin::SetScanningState" ); + iScanState = aScanState; + TRAP_IGNORE( SetMskL() ); + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::SetRefreshingL +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::SetRefreshingL( TBool aRefreshing ) + { + LOG_ENTERFN( "CWsfAiPlugin::SetRefreshingL" ); + if( iRefreshing != aRefreshing ) + { + LOG_WRITEF( "iRefreshing = %d and aRefreshing = %d ", + iRefreshing, aRefreshing ); + if( aRefreshing ) + { + if ( iAnimationPeriodic ) + { + iAnimationPeriodic->Cancel(); + delete iAnimationPeriodic; + iAnimationPeriodic = NULL; + } + iPublishNetworkStatusText = ETrue; + iAiModel->InitializeRefreshAnimation(); + iAnimationPeriodic = CPeriodic::NewL( + CActive::EPriorityStandard ); + + iAnimationPeriodic->Start( + TTimeIntervalMicroSeconds32( KRefreshStepTime ), + TTimeIntervalMicroSeconds32( KRefreshStepTime ), + TCallBack( + CWsfAiPlugin::DoRefreshingStepL, + this + ) ); + } + else + { + if ( iAnimationPeriodic ) + { + iAnimationPeriodic->Cancel(); + delete iAnimationPeriodic; + iAnimationPeriodic = NULL; + } + } + } + iRefreshing = aRefreshing; + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::SetRefreshingL +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::StartConnectingL() + { + LOG_ENTERFN( "CWsfAiPlugin::StartConnectingL" ); + + if ( iAnimationPeriodic ) + { + iAnimationPeriodic->Cancel(); + delete iAnimationPeriodic; + iAnimationPeriodic = NULL; + } + + iPublishNetworkStatusText = ETrue; + iAiModel->InitializeConnectingAnimation(); + iAnimationPeriodic = CPeriodic::NewL( + CActive::EPriorityStandard ); + + iAnimationPeriodic->Start( + TTimeIntervalMicroSeconds32( KConnectingStepTime ), + TTimeIntervalMicroSeconds32( KConnectingStepTime ), + TCallBack( + CWsfAiPlugin::DoConnectingStepL, + this + ) ); + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::NewL +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::LaunchApplicationL() + { + LOG_ENTERFN( "CWsfAiPlugin::LaunchApplication" ); + RApaLsSession appArcSession; + + // connect to AppArc server + User::LeaveIfError( appArcSession.Connect() ); + CleanupClosePushL( appArcSession ); + + + // check if the app is already running ... and brings it to foreground. + TUid id( TUid::Uid( KUidSnifferApp.iUid ) ); + TApaTaskList taskList( iEnv->WsSession() ); + TApaTask task = taskList.FindApp( id ); + + if ( task.Exists() ) + { + task.BringToForeground(); + } + else + { + TThreadId threadId; + User::LeaveIfError( appArcSession.StartDocument( + KNullDesC, + TUid::Uid( KUidSnifferApp.iUid ), + threadId ) ); + } + + CleanupStack::PopAndDestroy( &appArcSession ); //appArcSession + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::SetMskL +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::SetMskL() + { + LOG_ENTERFN( "CWsfAiPlugin::SetMsk" ); + + if ( AknLayoutUtils::PenEnabled() ) + { + // MSK not updated in touch products + return; + } + + CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); + + if( cba ) + { + if ( iAiModel->ScanningOn() || iAiModel->Connected() ) + { + // Show context menu icon + cba->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknSoftkeyContextOptions, + KNullDesC ); + } + else + { + if ( !iMskActivate ) + { + iMskActivate = StringLoader::LoadL( R_QTN_MSK_SNIFFER_ACTIVATE ); + } + // Show 'Activate' + cba->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknSoftkeyOk, + *iMskActivate ); + } + cba->DrawDeferred(); + } + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::PublishText +// -------------------------------------------------------------------------- +// +TBool CWsfAiPlugin::PublishText( MAiContentObserver* aObserver, + TWsfAiWizardContentIds aContentId, + const TDesC16& aText ) + { + LOG_ENTERFN( "CWsfAiPlugin::PublishText" ); + TBool published( EFalse ); + TInt error( 0 ); + if ( aObserver->CanPublish( *this, aContentId, aContentId ) ) + { + error = aObserver->Publish( *this, + aContentId, + aText, + aContentId ); + + if ( error == KErrNone ) + { + published = ETrue; + } + } + return published; + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::PublishIconL +// -------------------------------------------------------------------------- +// +TBool CWsfAiPlugin::PublishIconL( MAiContentObserver* aObserver, + TWsfAiWizardContentIds aContentId, + TInt aIconId ) + { + LOG_ENTERFN( "CWsfAiPlugin::PublishIcon" ); + TBool published( EFalse ); + TInt error( 0 ); + if ( aObserver->CanPublish( *this, aContentId, aContentId ) ) + { + error = aObserver->PublishPtr( + *this, + aContentId, + CWsfIconArrayCreator::GetIconLC( aIconId ), + aContentId ); + + CleanupStack::Pop(); // pop the icon + + if ( error == KErrNone ) + { + published = ETrue; + } + } + return published; + } + + +// --------------------------------------------------------------------------- +// CWsfAiPlugin::PublishCleanup +// --------------------------------------------------------------------------- +// +void CWsfAiPlugin::PublishCleanup( TAny* aPtr ) + { + LOG_ENTERFN( "CWsfAiPlugin::PublishCleanup" ); + CWsfAiPlugin* self = static_cast( aPtr ); + + if ( self && self->iCurrentObserverIndex < self->iObservers.Count() ) + { + LOG_WRITE( "Cancel transaction" ); + self->iObservers[self->iCurrentObserverIndex] + ->CancelTransaction( reinterpret_cast( self ) ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfAiPlugin::DoRefreshingStepL +// --------------------------------------------------------------------------- +// +TInt CWsfAiPlugin::DoRefreshingStepL( TAny* ptr ) + { + LOG_ENTERFN( "CWsfAiPlugin::DoRefreshingStepL( ptr )" ); + static_cast( ptr )->DoRefreshingStepL(); + return ETrue; + } + +// --------------------------------------------------------------------------- +// CWsfAiPlugin::DoRefreshingStepL +// --------------------------------------------------------------------------- +// +void CWsfAiPlugin::DoRefreshingStepL() + { + LOG_ENTERFN( "CWsfAiPlugin::DoRefreshingStepL" ); + + if ( !iAiModel->ScanningOn() ) + { + LOG_WRITE( "Disable refreshing" ); + if ( iAnimationPeriodic ) + { + LOG_WRITE( "Cancel animation update" ); + iAnimationPeriodic->Cancel(); + delete iAnimationPeriodic; + iAnimationPeriodic = NULL; + } + iRefreshing = EFalse; + } + else + { + iAiModel->AnimateRefresh(); + iController.RefreshRefreshingL(); + } + } + +// --------------------------------------------------------------------------- +// CWsfAiPlugin::DoConnectingStepL +// --------------------------------------------------------------------------- +// +TInt CWsfAiPlugin::DoConnectingStepL( TAny* ptr ) + { + LOG_ENTERFN( "CWsfAiPlugin::DoConnectingStepL( ptr )" ); + static_cast( ptr )->DoConnectingStepL(); + return ETrue; + } + +// --------------------------------------------------------------------------- +// CWsfAiPlugin::DoConnectingStepL +// --------------------------------------------------------------------------- +// +void CWsfAiPlugin::DoConnectingStepL() + { + LOG_ENTERFN( "CWsfAiPlugin::DoConnectingStepL" ); + + if ( !iModel->IsConnecting() ) + { + LOG_WRITE( "Disable refreshing" ); + if ( iAnimationPeriodic ) + { + LOG_WRITE( "Cancel animation update" ); + iAnimationPeriodic->Cancel(); + delete iAnimationPeriodic; + iAnimationPeriodic = NULL; + } + } + else + { + iAiModel->AnimateConnecting(); + iController.RefreshConnectingL(); + } + } + +// --------------------------------------------------------------------------- +// CWsfAiPlugin::PublishStatusIconL +// --------------------------------------------------------------------------- +// +void CWsfAiPlugin::PublishStatusIconL( CArrayFix* aPublishIconArray, + CEikLabel* aText1 ) + { + LOG_ENTERFN( "CWsfAiPlugin::PublishStatusIconL" ); + TBool published( EFalse ); + TInt iconId( 0 ); + + ClearL(); // Clear all WLAN Wizard content from the AI2 + + for ( iCurrentObserverIndex = 0; + iCurrentObserverIndex < iObservers.Count(); + ++iCurrentObserverIndex ) + { + MAiContentObserver* observer = iObservers[iCurrentObserverIndex]; + + // Publish Status icon: EAiWizardContentStatusIcon + iconId = aPublishIconArray->At( 0 ); + published = PublishIconL( observer, + EAiWizardContentStatusIcon, + iconId ) || published; + + if ( iPublishNetworkStatusText && aText1 ) + { + iPublishNetworkStatusText = EFalse; + HBufC *statusText = aText1->Text()->AllocLC(); + published = PublishText( observer, + EAiWizardContentNetworkStatus, + *statusText ) || published; + CleanupStack::PopAndDestroy( statusText ); + } + + // If we published something then commit, + // otherwise cancel transaction + if ( published ) + { + published = EFalse; + } + } + } + + +// End of File. diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/src/wsfaipluginproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfaipluginproxy.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECOM proxy table for AiPlugin +* +*/ + + +#include +#include +#include "wsfaiplugin.h" +#include "wsfaipluginuids.hrh" + +// Provide a key pair value table for ECOM. +// Used to identify the correct construction function for +// the requested interface. +const TImplementationProxy ImplementationTable[] = +{ + IMPLEMENTATION_PROXY_ENTRY( + AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_WIZARDPLUGIN, + CWsfAiPlugin::NewL ) +}; + + +// -------------------------------------------------------------------------- +// ImplementationGroupProxy +// Return an instance of the proxy table. +// -------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount ) +{ + aTableCount = sizeof( ImplementationTable ) / sizeof( + TImplementationProxy ); + return ImplementationTable; +} + +// End of File diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/src/wsfaiview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfaiview.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,483 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfAiView +* +*/ + + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include "wsfaiview.h" +#include "wsfaipublishobserver.h" +#include "wsflogger.h" + +// LOCAL DEFINITIONS +// one second in milliseconds +LOCAL_D const TInt KDeferredWaitTime = 1000 * 1000; +LOCAL_D const TInt KAIPublishIconArrayGranularity = 3; + +// index value to suppress 1 second refreshing state +LOCAL_D const TInt KSuppressRefreshIndex = 1024; + + +// -------------------------------------------------------------------------- +// CWsfAiView::NewL() +// -------------------------------------------------------------------------- +// +CWsfAiView* CWsfAiView::NewL( MWsfAiPublishObserver& aPublishObserver ) + { + CWsfAiView *thisPtr = NewLC( aPublishObserver ); + CleanupStack::Pop( thisPtr ); + return thisPtr; + } + + +// -------------------------------------------------------------------------- +// CWsfAiView::NewLC() +// -------------------------------------------------------------------------- +// +CWsfAiView* CWsfAiView::NewLC( MWsfAiPublishObserver& aPublishObserver ) + { + CWsfAiView *thisPtr = new (ELeave) CWsfAiView( aPublishObserver ); + CleanupStack::PushL( thisPtr ); + thisPtr->ConstructL(); + return thisPtr; + } + + +// -------------------------------------------------------------------------- +// CWsfAiView::~CWsfAiView() +// -------------------------------------------------------------------------- +// +CWsfAiView::~CWsfAiView() + { + delete iPublishIconArray; + delete iDeferredUpdateCallBack; + delete iTextLabel; + + if ( iDeferredUpdater ) + { + iDeferredUpdater->Cancel(); + delete iDeferredUpdater; + } + + if ( iStatusScanningOff ) + { + delete iStatusScanningOff; + } + if ( iStatusRefreshing ) + { + delete iStatusRefreshing; + } + if ( iStatusConnecting ) + { + delete iStatusConnecting; + } + } + + +// -------------------------------------------------------------------------- +// CWsfAiView::CWsfAiView() +// -------------------------------------------------------------------------- +// +CWsfAiView::CWsfAiView( MWsfAiPublishObserver& aPublishObserver ) : + iUpdateSecureIconDeferred( ETransparentIcon ), + iUpdateSignalStrengthIconDeferred( ETransparentIcon ), + iUpdateStatusIconDeferred( ETransparentIcon ), + iSavedUpdateStatusIconDeferred( ETransparentIcon ), + iPublishObserver( &aPublishObserver ) + { + } + + +// -------------------------------------------------------------------------- +// CWsfAiView::ConstructL() +// -------------------------------------------------------------------------- +// +void CWsfAiView::ConstructL() + { + LOG_ENTERFN( "CWsfAiView::ConstructL" ); + iEnv = CCoeEnv::Static(); + + iDeferredUpdateCallBack = new ( ELeave ) + TCallBack( CWsfAiView::DoCompleteUpdateL, this ); + iDeferredUpdater = CPeriodic::NewL( CActive::EPriorityStandard ); + + iPublishIconArray = new ( ELeave ) CArrayFixFlat( + KAIPublishIconArrayGranularity ); + + iTextLabel = new (ELeave) CEikLabel; + if ( !iStatusScanningOff ) + { + iStatusScanningOff = StringLoader::LoadL( + R_QTN_SNIFFER_PLUG_IN_SCANNING_OFF ); + } + iTextLabel->SetTextL( *iStatusScanningOff ); + + iUpdateStatusIconDeferred = EWlanOffIcon; + } + + +// -------------------------------------------------------------------------- +// CWsfAiView::UpdateHotSpotsL() +// -------------------------------------------------------------------------- +// +void CWsfAiView::UpdateHotSpotsL( MDesCArray* aItemTextArray, + TInt aCurrentItem ) + { + LOG_ENTERFN( "CWsfAiView::UpdateHotSpotsL" ); + if ( ParseStringL( aItemTextArray->MdcaPoint( 0 ) ) ) + { + if ( aCurrentItem != KSuppressRefreshIndex ) + { + // init the deferred callback + ActivateRefreshTimer(); + } + else + { + // immediate callback (no Refreshing text) + DoCompleteUpdateL(); + return; + } + } + if ( !iStatusRefreshing ) + { + iStatusRefreshing = StringLoader::LoadL( + R_QTN_SNIFFER_PLUG_IN_REFRESHING ); + } + + if ( !iStatusConnecting ) + { + iStatusConnecting = StringLoader::LoadL( + R_QTN_SNIFFER_PLUG_IN_CONNECTING ); + } + + TInt resultRefreshing = iTextLabel->Text()->Compare( *iStatusRefreshing ); + TInt resultConnecting = iCurrentText.Compare( *iStatusConnecting ); + + if ( !resultConnecting ) + { + MakeTransparentPublishIconsL(); // all icons transparent + } + else if ( !resultRefreshing ) + { + iPublishObserver->SetRefreshingL( ETrue ); + MakeTransparentPublishIconsL(); // all icons transparent + } + else + { + MakePublishIconsL(); // icons based on the member info + } + + iPublishObserver->SetScanningState( ETrue ); + + TRAPD( error, + iPublishObserver->PublishContentL( iPublishIconArray, iTextLabel ) ); + if ( error ) + { + LOG_WRITEF( "Publish failed - %d error ignored", error ); + } + } + + +// -------------------------------------------------------------------------- +// CWsfAiView::SelectedItem() +// -------------------------------------------------------------------------- +// +TInt CWsfAiView::SelectedItem() + { + LOG_ENTERFN( "CWsfAiView::SelectedItem" ); + return 0; + } + + +// -------------------------------------------------------------------------- +// CWsfAiView::ForceRefreshingL() +// -------------------------------------------------------------------------- +// +void CWsfAiView::ForceRefreshingL() + { + LOG_ENTERFN( "CWsfAiView::ForceRefreshingL" ); + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::SetRefreshingL +// -------------------------------------------------------------------------- +// +void CWsfAiView::StartConnectingAnimationL() + { + LOG_ENTERFN( "CWsfAiView::StartConnectingAnimationL" ); + iPublishObserver->StartConnectingL(); + } + + +// -------------------------------------------------------------------------- +// CWsfAiView::MultilineControl +// -------------------------------------------------------------------------- +// +TBool CWsfAiView::MultilineControl() + { + LOG_ENTERFN( "CWsfAiView::MultilineControl" ); + return EFalse; + } + + +// -------------------------------------------------------------------------- +// CWsfAiView::ParseStringL() +// -------------------------------------------------------------------------- +// +TBool CWsfAiView::ParseStringL( const TDesC& aString ) + { + LOG_ENTERFN( "CWsfAiView::ParseStringL" ); + // start looking for '\t' digits and parse + // the icon identifiers and label text + + // if the data changes - ie - label text has changed + // - launch deferred update... + TChar delimiter('\t'); + TWsfPluginIcons statusIcon; + TWsfPluginIcons secureicon; + TWsfPluginIcons strengthIcon; + TInt firstTabPos = aString.Locate( delimiter ); + TInt secondTabPos = aString.Mid( + firstTabPos +1 ).Locate( + delimiter ) + firstTabPos + 1; + TInt thirdTabPos = aString.Mid( + secondTabPos +1 ).Locate( + delimiter ) + secondTabPos + 1; + + // ok we have the tab positions read the values... + //read the icons + TLex( aString.Mid( 0, firstTabPos )).Val( (TInt&)statusIcon ); + TLex( aString.Mid( + secondTabPos+1 , thirdTabPos - (secondTabPos+1) ) + ).Val( (TInt&) strengthIcon); + + TLex( aString.Mid( + thirdTabPos+1 , aString.Length() - ( thirdTabPos + 1 ) ) + ).Val( (TInt&) secureicon ); + + // and the label text + TPtrC labelText = aString.Mid( firstTabPos+1, + secondTabPos - ( firstTabPos + 1 ) ); + + iCurrentText.Copy( labelText ); + + if ( !iStatusRefreshing ) + { + iStatusRefreshing = StringLoader::LoadL( + R_QTN_SNIFFER_PLUG_IN_REFRESHING ); + } + iTextLabel->SetTextL( *iStatusRefreshing ); + + iUpdateSecureIconDeferred = secureicon; + iUpdateSignalStrengthIconDeferred = strengthIcon; + iUpdateStatusIconDeferred = statusIcon; + iSavedUpdateStatusIconDeferred = statusIcon; + + return ETrue; + } + + +// -------------------------------------------------------------------------- +// CWsfAiView::DoCompleteUpdateL() +// -------------------------------------------------------------------------- +// +void CWsfAiView::DoCompleteUpdateL() + { + LOG_ENTERFN( "CWsfAiView::DoCompleteUpdateL" ); + // cancel the periodic + iDeferredUpdater->Cancel(); + + // update the label text + iTextLabel->SetTextL( iCurrentText ); + iCurrentText = KNullDesC(); + + iUpdateStatusIconDeferred = iSavedUpdateStatusIconDeferred; + + MakePublishIconsL(); + + TRAPD( error, + iPublishObserver->PublishContentL( iPublishIconArray, iTextLabel ) ); + if ( error ) + { + LOG_WRITEF( "Publish failed - %d error ignored", error ); + } + + iPublishObserver->SetRefreshingL( EFalse ); + } + + +// -------------------------------------------------------------------------- +// CWsfAiView::DoCompleteUpdateL() +// -------------------------------------------------------------------------- +// +TInt CWsfAiView::DoCompleteUpdateL( TAny* aPtr ) + { + LOG_ENTERFN( "CWsfAiView::DoCompleteUpdateL" ); + static_cast( aPtr )->DoCompleteUpdateL(); + return ETrue; + } + + +// -------------------------------------------------------------------------- +// CWsfAiView::DisplayEngineOffL() +// -------------------------------------------------------------------------- +// +void CWsfAiView::DisplayEngineOffL() + { + LOG_ENTERFN( "CWsfAiView::DisplayEngineOffL" ); + iDeferredUpdater->Cancel(); + iPublishObserver->SetRefreshingL( EFalse ); + + if ( !iStatusScanningOff ) + { + iStatusScanningOff = StringLoader::LoadL( + R_QTN_SNIFFER_PLUG_IN_SCANNING_OFF ); + } + + iTextLabel->SetTextL( *iStatusScanningOff ); + + iUpdateSecureIconDeferred = ETransparentIcon; + iUpdateSignalStrengthIconDeferred = ETransparentIcon; + iUpdateStatusIconDeferred = EWlanOffIcon; + iPublishObserver->SetScanningState( EFalse ); + MakePublishIconsL(); + + TRAPD( error, + iPublishObserver->PublishContentL( iPublishIconArray, iTextLabel ) ); + if ( error ) + { + LOG_WRITEF( "Publish failed - %d error ignored", error ); + } + } + + +// -------------------------------------------------------------------------- +// CWsfAiView::ActivateRefreshTimer() +// -------------------------------------------------------------------------- +// +void CWsfAiView::ActivateRefreshTimer() + { + LOG_ENTERFN( "CWsfAiView::ActivateRefreshTimer" ); + iDeferredUpdater->Cancel(); + iDeferredUpdater->Start( + TTimeIntervalMicroSeconds32( KDeferredWaitTime ), + TTimeIntervalMicroSeconds32( KDeferredWaitTime ), + *iDeferredUpdateCallBack ); + } + + +// -------------------------------------------------------------------------- +// CWsfAiView::MakePublishIconsL() +// -------------------------------------------------------------------------- +// +void CWsfAiView::MakePublishIconsL() + { + LOG_ENTERFN( "CWsfAiView::MakePublishIconsL" ); + if ( iPublishIconArray ) + { + iPublishIconArray->Reset(); + iPublishIconArray->AppendL( iUpdateStatusIconDeferred ); + iPublishIconArray->AppendL( iUpdateSecureIconDeferred ); + iPublishIconArray->AppendL( iUpdateSignalStrengthIconDeferred ); + } + } + + +// -------------------------------------------------------------------------- +// CWsfAiView::MakeTransparentPublishIconsL() +// -------------------------------------------------------------------------- +// +void CWsfAiView::MakeTransparentPublishIconsL() + { + LOG_ENTERFN( "CWsfAiView::MakeTransparentPublishIconsL" ); + TWsfPluginIcons tmp2, tmp3; + + tmp2 = iUpdateSecureIconDeferred; + tmp3 = iUpdateSignalStrengthIconDeferred; + + iUpdateSecureIconDeferred = ETransparentIcon; + iUpdateSignalStrengthIconDeferred = ETransparentIcon; + + MakePublishIconsL(); + + iUpdateSecureIconDeferred = tmp2; + iUpdateSignalStrengthIconDeferred = tmp3; + } + + +// -------------------------------------------------------------------------- +// CWsfAiView::UpdateViewL() +// -------------------------------------------------------------------------- +// +void CWsfAiView::UpdateViewL( MDesCArray* aItemTextArray ) + { + LOG_ENTERFN( "CWsfAiView::UpdateViewL" ); + TChar delimiter('\t'); + TWsfPluginIcons statusIcon; + TWsfPluginIcons secureicon; + TWsfPluginIcons strengthIcon; + const TDesC& aString = aItemTextArray->MdcaPoint( 0 ) ; + + TInt firstTabPos = aString.Locate( delimiter ); + TInt secondTabPos = aString.Mid( + firstTabPos +1 ).Locate( + delimiter ) + firstTabPos + 1; + TInt thirdTabPos = aString.Mid( + secondTabPos +1 ).Locate( + delimiter ) + secondTabPos + 1; + + //read the icons + TLex( aString.Mid( 0, firstTabPos )).Val( (TInt&)statusIcon ); + TLex( aString.Mid( + secondTabPos+1 , thirdTabPos - (secondTabPos+1) ) + ).Val( (TInt&) strengthIcon); + + TLex( aString.Mid( + thirdTabPos+1 , aString.Length() - ( thirdTabPos + 1 ) ) + ).Val( (TInt&) secureicon ); + + // and the label text + TPtrC labelText = aString.Mid( firstTabPos+1, + secondTabPos - ( firstTabPos + 1 ) ); + + iTextLabel->SetTextL( labelText ); + + iUpdateStatusIconDeferred = statusIcon; + + MakeTransparentPublishIconsL(); + + iPublishObserver->PublishStatusIconL( iPublishIconArray, iTextLabel ); + } + +// END OF FILE diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/src/wsfconnectactivewrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfconnectactivewrapper.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,174 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfConnectActiveWrapper. +* +*/ + + + +// INCLUDE FILES +#include "wsflogger.h" +#include "wsfmodel.h" +#include "wsfwlaninfoarray.h" +#include "wsfconnectactivewrapper.h" + + +// -------------------------------------------------------------------------- +// CWsfConnectActiveWrapper::CWsfConnectActiveWrapper +// -------------------------------------------------------------------------- +// +CWsfConnectActiveWrapper::CWsfConnectActiveWrapper() : + CActive(EPriorityStandard) // Standard priority + { + } + + +// -------------------------------------------------------------------------- +// CWsfConnectActiveWrapper::NewLC +// -------------------------------------------------------------------------- +// +CWsfConnectActiveWrapper* CWsfConnectActiveWrapper::NewLC( CWsfModel* aModel ) + { + LOG_ENTERFN( "CWsfConnectActiveWrapper::NewLC" ); + CWsfConnectActiveWrapper* self = + new (ELeave) CWsfConnectActiveWrapper(); + CleanupStack::PushL(self); + self->ConstructL( aModel ); + return self; + } + + +// -------------------------------------------------------------------------- +// CWsfConnectActiveWrapper::NewL +// -------------------------------------------------------------------------- +// +CWsfConnectActiveWrapper* CWsfConnectActiveWrapper::NewL( CWsfModel* aModel ) + { + LOG_ENTERFN( "CWsfConnectActiveWrapper::NewL" ); + CWsfConnectActiveWrapper* self = + CWsfConnectActiveWrapper::NewLC( aModel ); + CleanupStack::Pop(); // self; + return self; + } + + +// -------------------------------------------------------------------------- +// CWsfConnectActiveWrapper::ConstructL +// -------------------------------------------------------------------------- +// +void CWsfConnectActiveWrapper::ConstructL( CWsfModel* aModel ) + { + LOG_ENTERFN( "CWsfConnectActiveWrapper::ConstructL" ); + CActiveScheduler::Add(this); // Add to scheduler + iModel = aModel; + } + + +// -------------------------------------------------------------------------- +// CWsfConnectActiveWrapper::~CWsfConnectActiveWrapper +// -------------------------------------------------------------------------- +// +CWsfConnectActiveWrapper::~CWsfConnectActiveWrapper() + { + LOG_ENTERFN( + "CWsfConnectActiveWrapper::~CWsfConnectActiveWrapper" ); + Cancel(); // Cancel any request, if outstanding + // Delete instance variables if any + } + + +// -------------------------------------------------------------------------- +// CWsfConnectActiveWrapper::DoCancel +// -------------------------------------------------------------------------- +// +void CWsfConnectActiveWrapper::DoCancel() + { + LOG_ENTERFN( "CWsfConnectActiveWrapper::DoCancel" ); + } + + +// -------------------------------------------------------------------------- +// CWsfConnectActiveWrapper::StartL +// -------------------------------------------------------------------------- +// +void CWsfConnectActiveWrapper::Start( TUint aIapID, TBool aConnectOnly, + TWsfIapPersistence aPersistence ) + { + LOG_ENTERFN( "CWsfConnectActiveWrapper::Start" ); + Cancel(); // Cancel any request, just to be sure + iState = EUninitialized; + iIapID = aIapID; + iConnectOnly = aConnectOnly; + iPersistence = aPersistence; + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + + +// -------------------------------------------------------------------------- +// CWsfConnectActiveWrapper::RunL +// -------------------------------------------------------------------------- +// +void CWsfConnectActiveWrapper::RunL() + { + LOG_ENTERFN( "CWsfConnectActiveWrapper::RunL" ); + if ( iStatus == KErrNone ) + { + if ( iState == EUninitialized ) + { + LOG_WRITE( "Start connect" ); + iModel->ConnectL( iPckg, iIapID, iConnectOnly, iPersistence, iStatus ); + iState = EInitialized; + SetActive(); // Tell scheduler a request is active + } + else if ( iState == EInitialized ) + { + LOG_WRITEF( "request result = %d", iPckg() ); + iModel->SetConnectResultL( iPckg(), iIapID ); + } + else + { + LOG_WRITEF( "iState = %d", iState ); + } + } + else + { + LOG_WRITEF( "ConnectActiveWrapper iStatus = %d", iStatus.Int() ); + } + } + + +// -------------------------------------------------------------------------- +// CWsfConnectActiveWrapper::RunError +// -------------------------------------------------------------------------- +// +#ifdef _DEBUG +TInt CWsfConnectActiveWrapper::RunError( TInt aError ) + { + LOG_ENTERFN( "CWsfConnectActiveWrapper::RunError" ); + LOG_WRITEF( "aError = %d", aError ); + TRAP_IGNORE( iModel->SetConnectResultL(iPckg(), iIapID ) ); + return aError; + } +#else +TInt CWsfConnectActiveWrapper::RunError( TInt /*aError*/ ) + { + TRAP_IGNORE( iModel->SetConnectResultL(iPckg(), iIapID ) ); + return KErrNone; + } +#endif + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/src/wsfdbobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfdbobserver.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,276 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 utilities functions. +* +* +*/ + + + +//User includes +#include "wsfdbobserver.h" +#include "wsfaicontroller.h" +#include "wsflogger.h" + +#include + +#include +#include + + +const TInt KWlanSettingsUiDefaultScanNetwork = 300; + + +// --------------------------------------------------------- +// CWsfDbObserver::CWsfDbObserver +// --------------------------------------------------------- +CWsfDbObserver::CWsfDbObserver( ) +: CActive( EPriorityNormal ), +iOuterScanState( EFalse ) + { + } + + +// --------------------------------------------------------- +// CWsfDbObserver::NewL +// --------------------------------------------------------- +CWsfDbObserver* CWsfDbObserver::NewL( ) + { + CWsfDbObserver* self = new ( ELeave ) CWsfDbObserver( ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + +// --------------------------------------------------------- +// CWsfDbObserver::ConstructL +// --------------------------------------------------------- +void CWsfDbObserver::ConstructL() + { +#ifndef __WINS__ // client is not available on wins + iWlanMgmtClient = CWlanMgmtClient::NewL(); +#endif + + FeatureManager::InitializeLibL(); + + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------- +// CWsfDbObserver::~CWsfDbObserver +// --------------------------------------------------------- +CWsfDbObserver::~CWsfDbObserver() + { + Cancel(); + + delete iRecord; + + delete iSession; + + delete iWlanMgmtClient; + + FeatureManager::UnInitializeLib(); + } + + +// --------------------------------------------------------- +// CWsfDbObserver::RunL +// --------------------------------------------------------- +void CWsfDbObserver::RunL() + { + LOG_ENTERFN( "CWsfDbObserver::RunL" ); + iRecord->LoadL( *iSession ); + + //if scanning state changed start or stop the server + TInt i = iRecord->iBgScanInterval; + TInt j = iRecord->iSavedBgScanInterval; + LOG_WRITEF( "CWsfDbObserver::RunL -- Bg:%d bg2:%d O:%d", i, j, + iOuterScanState ); + if ( iRecord->iBgScanInterval == 0 && iOuterScanState ) + { + LOG_WRITE( "CWsfDbObserver::RunL -- Scan disabled" ); + iController->DisableScanL(); + iOuterScanState = EFalse; + } + else if(iRecord->iBgScanInterval != 0 && !iOuterScanState ) + { + LOG_WRITE( "CWsfDbObserver::RunL -- Scan enabled" ); + iController->EnableScanL(); + iOuterScanState = ETrue; + } + + SetActive(); + + iRecord->RequestNotification(*iSession,iStatus); + } + + +// --------------------------------------------------------- +// CWsfDbObserver::DoCancel +// --------------------------------------------------------- +void CWsfDbObserver::DoCancel() + { + iRecord->CancelNotification( *iSession, iStatus ); + } + + +// --------------------------------------------------------- +// CWsfDbObserver::ActivateIt +// --------------------------------------------------------- +void CWsfDbObserver::ActivateItL() + { + LOG_ENTERFN( "CWsfDbObserver::ActivateItL" ); + + iSession = CMDBSession::NewL( KCDLatestVersion ); + + TMDBElementId tableId = 0; + + tableId = CCDWlanDeviceSettingsRecord::TableIdL( *iSession ); + + iRecord = new (ELeave) CCDWlanDeviceSettingsRecord( tableId ); + + iRecord->iWlanDeviceSettingsType = KWlanUserSettings; + + + if(iRecord->FindL( *iSession )) + { + iRecord->LoadL( *iSession ); + } + + if ( iRecord->iBgScanInterval != 0 ) + { + iController->EnableScanL(); + iOuterScanState = ETrue; + } + SetActive(); + + iRecord->RequestNotification(*iSession,iStatus); + + } + + +// --------------------------------------------------------- +// CWsfDbObserver::SetController +// --------------------------------------------------------- +void CWsfDbObserver::SetController( TWsfAiController* aController ) + { + iController = aController; + } + + +// --------------------------------------------------------- +// CWsfDbObserver::EnableScanL +// --------------------------------------------------------- +void CWsfDbObserver::EnableScanL() + { + LOG_ENTERFN( "CWsfDbObserver::EnableScanL" ); + if ( !iOuterScanState ) + { + iRecord->RefreshL( *iSession ); + if ( iRecord->iBgScanInterval == 0 ) // not scanning + { + TInt j; + j = iRecord->iSavedBgScanInterval; + if ( j == 0 ) + { + j = DefaultScanIntervalL(); + } + iRecord->iBgScanInterval = j; + iRecord->ModifyL( *iSession ); + iOuterScanState = ETrue; + } +#ifndef __WINS__ + // Notifying WLAN Engine about changes in settings + iWlanMgmtClient->NotifyChangedSettings(); +#endif + } + } + + +// --------------------------------------------------------- +// CWsfDbObserver::DisableScanL +// --------------------------------------------------------- +void CWsfDbObserver::DisableScanL() + { + LOG_ENTERFN( "CWsfDbObserver::DisableScanL" ); + if ( iOuterScanState ) + { + iRecord->RefreshL(*iSession); + if ( iRecord->iBgScanInterval != 0 ) // scanning + { + TInt i; + i = iRecord->iBgScanInterval; + iRecord->iBgScanInterval = 0; + iRecord->iSavedBgScanInterval = i; + iRecord->ModifyL( *iSession ); + iOuterScanState = EFalse; + } +#ifndef __WINS__ + // Notifying WLAN Engine about changes in settings + iWlanMgmtClient->NotifyChangedSettings(); +#endif + } + } + + +// --------------------------------------------------------- +// CWsfDbObserver::DefaultScanInterval +// --------------------------------------------------------- +TInt CWsfDbObserver::DefaultScanIntervalL() + { + LOG_ENTERFN( "CWsfDbObserver::DefaultScanIntervalL" ); + TBool iPsmSupported = FeatureManager::FeatureSupported( + KFeatureIdPowerSave ); + if ( iPsmSupported ) + { + // Read the default value from CenRep (different in PSM mode) + TInt defaultScanInterval( KWlanSettingsUiDefaultScanNetwork ); + + CRepository* repository = CRepository::NewLC( + KCRUidWlanDeviceSettingsRegistryId ); + if ( repository ) + { + repository->Get( KWlanDefaultBGScanInterval, defaultScanInterval ); + } + CleanupStack::PopAndDestroy( repository ); + return defaultScanInterval; + } + else + { + return KWlanSettingsUiDefaultScanNetwork; + } + } + + +// ---------------------------------------------------------------------------- +// CWsfDbObserver::RunError +// ---------------------------------------------------------------------------- +// +#ifdef _DEBUG +TInt CWsfDbObserver::RunError( TInt aError ) + { + LOG_ENTERFN( "CWsfDbObserver::RunError" ); + LOG_WRITEF( "aError = %d", aError ); +#else +TInt CWsfDbObserver::RunError( TInt /*aError*/ ) + { +#endif + return KErrNone; + } + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/src/wsfdisconnectactivewrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfdisconnectactivewrapper.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,165 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfDisconnectActiveWrapper. +* +*/ + + +// INCLUDE FILES +#include "wsflogger.h" +#include "wsfmodel.h" +#include "wsfwlaninfoarray.h" +#include "wsfdisconnectactivewrapper.h" + +// -------------------------------------------------------------------------- +// CWsfDisconnectActiveWrapper::CWsfDisconnectActiveWrapper +// -------------------------------------------------------------------------- +// +CWsfDisconnectActiveWrapper::CWsfDisconnectActiveWrapper() : + CActive(EPriorityStandard) // Standard priority + { + } + + +// -------------------------------------------------------------------------- +// CWsfDisconnectActiveWrapper::NewLC +// -------------------------------------------------------------------------- +// +CWsfDisconnectActiveWrapper* CWsfDisconnectActiveWrapper::NewLC( CWsfModel* aModel ) + { + LOG_ENTERFN( "CWsfDisconnectActiveWrapper::NewLC" ); + CWsfDisconnectActiveWrapper* self = + new (ELeave) CWsfDisconnectActiveWrapper(); + CleanupStack::PushL(self); + self->ConstructL( aModel ); + return self; + } + + +// -------------------------------------------------------------------------- +// CWsfDisconnectActiveWrapper::NewL +// -------------------------------------------------------------------------- +// +CWsfDisconnectActiveWrapper* CWsfDisconnectActiveWrapper::NewL( CWsfModel* aModel ) + { + LOG_ENTERFN( "CWsfDisconnectActiveWrapper::NewL" ); + CWsfDisconnectActiveWrapper* self = + CWsfDisconnectActiveWrapper::NewLC( aModel ); + CleanupStack::Pop(); // self; + return self; + } + + +// -------------------------------------------------------------------------- +// CWsfDisconnectActiveWrapper::ConstructL +// -------------------------------------------------------------------------- +// +void CWsfDisconnectActiveWrapper::ConstructL( CWsfModel* aModel ) + { + LOG_ENTERFN( "CWsfDisconnectActiveWrapper::ConstructL" ); + CActiveScheduler::Add(this); // Add to scheduler + iModel = aModel; + } + + +// -------------------------------------------------------------------------- +// CWsfDisconnectActiveWrapper::~CWsfDisconnectActiveWrapper +// -------------------------------------------------------------------------- +// +CWsfDisconnectActiveWrapper::~CWsfDisconnectActiveWrapper() + { + LOG_ENTERFN( + "CWsfDisconnectActiveWrapper::~CWsfDisconnectActiveWrapper" ); + Cancel(); // Cancel any request, if outstanding + // Delete instance variables if any + } + + +// -------------------------------------------------------------------------- +// CWsfDisconnectActiveWrapper::DoCancel +// -------------------------------------------------------------------------- +// +void CWsfDisconnectActiveWrapper::DoCancel() + { + LOG_ENTERFN( "CWsfDisconnectActiveWrapper::DoCancel" ); + } + + +// -------------------------------------------------------------------------- +// CWsfDisconnectActiveWrapper::StartL +// -------------------------------------------------------------------------- +// +void CWsfDisconnectActiveWrapper::Start() + { + LOG_ENTERFN( "CWsfDisconnectActiveWrapper::Start" ); + Cancel(); // Cancel any request, just to be sure + iState = EUninitialized; + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + + +// -------------------------------------------------------------------------- +// CWsfDisconnectActiveWrapper::RunL +// -------------------------------------------------------------------------- +// +void CWsfDisconnectActiveWrapper::RunL() + { + LOG_ENTERFN( "CWsfDisconnectActiveWrapper::RunL" ); + if ( iStatus == KErrNone ) + { + if (iState == EUninitialized) + { + LOG_WRITE( "disconnect" ); + iModel->Disconnect( iPckg, iStatus ); + iState = EInitialized; + SetActive(); // Tell scheduler a request is active + } + else if (iState == EInitialized ) + { + LOG_WRITEF( "request result = %d", iPckg() ); + } + else + { + LOG_WRITEF( "iState = %d", iState ); + } + } + else + { + LOG_WRITEF( "DisconnectActiveWrapper iStatus = %d", iStatus.Int() ); + } + } + + +// -------------------------------------------------------------------------- +// CWsfDisconnectActiveWrapper::RunError +// -------------------------------------------------------------------------- +// +#ifdef _DEBUG +TInt CWsfDisconnectActiveWrapper::RunError( TInt aError ) + { + LOG_ENTERFN( "CWsfDisconnectActiveWrapper::RunError" ); + LOG_WRITEF( "aError = %d", aError ); + return aError; + } +#else +TInt CWsfDisconnectActiveWrapper::RunError( TInt /*aError*/ ) + { + return KErrNone; + } +#endif + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/src/wsficonarraycreator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsficonarraycreator.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,366 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfIconArrayCreator. +* +*/ + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include "wsfaiplugincommon.h" +#include "wsficonarraycreator.h" + + +// LOCAL DEFINITIONS +const TInt KAIShortcutPluginGranularity = 10; +#ifdef _DEBUG + _LIT( KIconArrayCreatorPanic, "CWsfIconArrayCreator" ); + #define _ASS_D( cond ) __ASSERT_DEBUG( (cond), \ + User::Panic( KIconArrayCreatorPanic, __LINE__) ) +#else + #define _ASS_D( cond ) {} +#endif //_DEBUG + +// -------------------------------------------------------------------------- +// CleanUpResetAndDestroy +// -------------------------------------------------------------------------- +// +void CleanUpResetAndDestroy(TAny* aArray) + { + if(aArray) + { + CArrayPtrFlat* array=(CArrayPtrFlat*)aArray; + array->ResetAndDestroy(); + delete array; + } + } + +// -------------------------------------------------------------------------- +// LoadIconLC +// -------------------------------------------------------------------------- +// +CGulIcon* LoadIconLC( const TInt aIconId, const TFileName aBitmapFile ) + { + CGulIcon* icon = CGulIcon::NewLC(); + CFbsBitmap* bitmap; + CFbsBitmap* mask; + + // Creates bitmap an icon. + AknIconUtils::CreateIconL( bitmap, + mask, + aBitmapFile, + aIconId, + aIconId+1 ); + + icon->SetBitmap( bitmap ); + icon->SetMask( mask ); + return icon; + } + +// -------------------------------------------------------------------------- +// LoadSkinnableIconLC +// -------------------------------------------------------------------------- +// +CGulIcon* LoadSkinnableIconLC( const TAknsItemID aAknItemId, + const TInt aIconId, + const TFileName aBitmapFile ) + { + CGulIcon* icon = CGulIcon::NewLC(); + CFbsBitmap* bitmap; + CFbsBitmap* mask; + + // Creates bitmap an icon. + AknsUtils::CreateIconL( AknsUtils::SkinInstance(), + aAknItemId, + bitmap, + mask, + aBitmapFile, + aIconId, + aIconId + 1 ); + + icon->SetBitmap(bitmap); + icon->SetMask(mask); + return icon; + } + +// --------------------------------------------------------- +// LoadSkinnableBlackIconLC +// --------------------------------------------------------- +// +CGulIcon* LoadSkinnableBlackIconLC( const TAknsItemID aAknItemId, + const TInt aIconId, + const TFileName aBitmapFile ) + { + CGulIcon* icon = CGulIcon::NewLC(); + CFbsBitmap* bitmap; + CFbsBitmap* mask; + + // Creates bitmap an icon. + AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(), + aAknItemId, + KAknsIIDQsnIconColors, + EAknsCIQsnIconColorsCG13, + bitmap, + mask, + aBitmapFile, + aIconId, + aIconId+1, + KRgbBlack ); + + icon->SetBitmap( bitmap ); + icon->SetMask( mask ); + return icon; + } + +// -------------------------------------------------------------------------- +// CWsfIconArrayCreator::CreateArrayL +// -------------------------------------------------------------------------- +// +CAknIconArray* CWsfIconArrayCreator::CreateArrayL() + { + // Used bitmap file name + TFileName bitmapFileName; + bitmapFileName.Append( KDC_APP_BITMAP_DIR ); + bitmapFileName.Append( KBitmapFile ); + + CAknIconArray* icons = new(ELeave) CAknIconArray( + KAIShortcutPluginGranularity ); + + CleanupStack::PushL( TCleanupItem( CleanUpResetAndDestroy,icons) ); + + //ESecureNetworkIcon + icons->InsertL( ESecureNetworkIcon, LoadSkinnableBlackIconLC( + KAknsIIDQgnIndiWlanSecureNetworkAdd, + EMbmWsficonsQgn_indi_wlan_secure_network_add, + bitmapFileName ) ); + + CleanupStack::Pop(); /*icon*/ + + //ENoSignalIcon + icons->InsertL( ENoSignalIcon, LoadIconLC( + EMbmWsficonsEmpty13x13, + bitmapFileName ) ); + CleanupStack::Pop(); /*icon*/ + + //EPoorSignal + icons->InsertL( EPoorSignal, LoadSkinnableBlackIconLC( + KAknsIIDQgnIndiWlanSignalLowAdd, + EMbmWsficonsQgn_indi_wlan_signal_low_add, + bitmapFileName ) ); + + CleanupStack::Pop(); /*icon*/ + + //EAverageSignal + icons->InsertL( EAverageSignal, LoadSkinnableBlackIconLC( + KAknsIIDQgnIndiWlanSignalMedAdd, + EMbmWsficonsQgn_indi_wlan_signal_med_add, + bitmapFileName ) ); + CleanupStack::Pop(); /*icon*/ + + //EExcelentSignal + icons->InsertL( EExcelentSignal, LoadSkinnableBlackIconLC( + KAknsIIDQgnIndiWlanSignalGoodAdd , + EMbmWsficonsQgn_indi_wlan_signal_good_add, + bitmapFileName ) ); + CleanupStack::Pop(); /*icon*/ + + //EConnectedNWIcon + icons->InsertL( EConnectedNWIcon, + LoadSkinnableIconLC( KAknsIIDQgnIndiWlanSnifferPluginOn, + EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on, + bitmapFileName ) ); + + CleanupStack::Pop(); /*icon*/ + + //EKnownNWIcon + icons->InsertL( EKnownNWIcon, LoadSkinnableIconLC( + KAknsIIDQgnIndiWlanSnifferPluginOn, + EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on, + bitmapFileName ) ); + CleanupStack::Pop(); /*icon*/ + + //ETransparentIcon + icons->InsertL( ETransparentIcon, LoadIconLC( + EMbmWsficonsQgn_prop_empty, + bitmapFileName ) ); + CleanupStack::Pop(); /*icon*/ + + //EWlanOnIcon + icons->InsertL( EWlanOnIcon, LoadSkinnableIconLC( + KAknsIIDQgnIndiWlanSnifferPluginOn, + EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on, + bitmapFileName ) ); + CleanupStack::Pop(); /*icon*/ + + icons->InsertL( EWlanOnIcon_0, LoadSkinnableIconLC( + KAknsIIDQgnIndiWlanSnifferPluginOn0, + EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on_0, + bitmapFileName ) ); + CleanupStack::Pop(); /*icon*/ + + icons->InsertL( EWlanOnIcon_1, LoadSkinnableIconLC( + KAknsIIDQgnIndiWlanSnifferPluginOn1, + EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on_1, + bitmapFileName ) ); + CleanupStack::Pop(); /*icon*/ + + //ETransparentIcon + icons->InsertL( EWlanOffIcon, LoadSkinnableIconLC( + KAknsIIDQgnIndiWlanSnifferPluginOff, + EMbmWsficonsQgn_indi_wlan_sniffer_plugin_off, + bitmapFileName ) ); + CleanupStack::Pop(); + + icons->InsertL( EWlanNaviBarIcon, LoadSkinnableIconLC( + KAknsIIDQgnMenuWlanSniffer, + EMbmWsficonsQgn_menu_wlan_sniffer, + bitmapFileName ) ); + + CleanupStack::Pop(); /*icon*/ + CleanupStack::Pop( icons ); + + return icons; + } + +// -------------------------------------------------------------------------- +// CWsfIconArrayCreator::GetIconLC +// -------------------------------------------------------------------------- +// +CGulIcon* CWsfIconArrayCreator::GetIconLC( TInt aIconId ) + { + // Used bitmap file name + TFileName bitmapFileName; + bitmapFileName.Append( KDC_APP_BITMAP_DIR ); + bitmapFileName.Append( KBitmapFile ); + TAknsItemID localAknItemId( KAknsIIDQgnMenuWlanSniffer ); + TInt iconId( EMbmWsficonsQgn_menu_wlan_sniffer ); + + switch( aIconId ) + { + case ESecureNetworkIcon: + { + localAknItemId = KAknsIIDQgnIndiWlanSecureNetworkAdd; + iconId = EMbmWsficonsQgn_indi_wlan_secure_network_add; + break; + } + + case ENoSignalIcon: + return LoadIconLC( EMbmWsficonsEmpty13x13, bitmapFileName ); + + case EPoorSignal: + { + localAknItemId = KAknsIIDQgnIndiWlanSignalLowAdd; + iconId = EMbmWsficonsQgn_indi_wlan_signal_low_add; + break; + } + + case EAverageSignal: + { + localAknItemId = KAknsIIDQgnIndiWlanSignalMedAdd; + iconId = EMbmWsficonsQgn_indi_wlan_signal_med_add; + break; + } + + case EExcelentSignal: + { + localAknItemId = KAknsIIDQgnIndiWlanSignalGoodAdd; + iconId = EMbmWsficonsQgn_indi_wlan_signal_good_add; + break; + } + + case EConnectedNWIcon: + { + localAknItemId = KAknsIIDQgnIndiWlanSnifferPluginOn; + iconId = EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on; + break; + } + + case EKnownNWIcon: + { + localAknItemId = KAknsIIDQgnIndiWlanSnifferPluginOn; + iconId = EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on; + break; + } + + case ETransparentIcon: + return LoadIconLC( EMbmWsficonsQgn_prop_empty, bitmapFileName ); + + case EWlanOnIcon: + { + localAknItemId = KAknsIIDQgnIndiWlanSnifferPluginOn; + iconId = EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on; + break; + } + + case EWlanOnIcon_0: + { + localAknItemId = KAknsIIDQgnIndiWlanSnifferPluginOn0; + iconId = EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on_0; + break; + } + + case EWlanOnIcon_1: + { + localAknItemId = KAknsIIDQgnIndiWlanSnifferPluginOn1; + iconId = EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on_1; + break; + } + + case EWlanOffIcon: + { + localAknItemId = KAknsIIDQgnIndiWlanSnifferPluginOff; + iconId = EMbmWsficonsQgn_indi_wlan_sniffer_plugin_off; + break; + } + + case EWlanNaviBarIcon: + { + localAknItemId = KAknsIIDQgnMenuWlanSniffer; + iconId = EMbmWsficonsQgn_menu_wlan_sniffer; + break; + } + default: + { + _ASS_D( 0 ); + } + } + + switch( aIconId ) + { + case ESecureNetworkIcon: + case EPoorSignal: + case EAverageSignal: + case EExcelentSignal: + { + return LoadSkinnableBlackIconLC( localAknItemId, + iconId, + bitmapFileName ); + } + default: + { + break; + } + } + return LoadSkinnableIconLC( localAknItemId, + iconId, + bitmapFileName ); + } + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/src/wsflaunchaihelperactivewrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsflaunchaihelperactivewrapper.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,230 @@ +/* + * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies 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 CWsfLaunchAiHelperActiveWrapper. + * + */ + + +// INCLUDE FILES +#include "wsflogger.h" +#include "wsfmodel.h" +#include "wsfaicontroller.h" +#include "wsflaunchaihelperactivewrapper.h" + +// Category UID of AiHelper property +static const TUid KWsfAiHelperCategoryUid = { 0x10281CEB }; + +// key numbers within the property +static const TUint KWsfAiHelperExitCodeKey = 0; +static const TUint KWsfAiHelperIapIdKey = 1; + +/** +* Delay that we wait for the aihelper to terminate +*/ +static const TInt KTimerTickInterval = 1 * 1000 * 1000; + + +// ---------------------------------------------------------------------------- +// CWsfLaunchAiHelperActiveWrapper::CWsfLaunchAiHelperActiveWrapper +// ---------------------------------------------------------------------------- +// +CWsfLaunchAiHelperActiveWrapper::CWsfLaunchAiHelperActiveWrapper() : + CActive( EPriorityStandard ) // Standard priority + { + } + + +// ---------------------------------------------------------------------------- +// CWsfLaunchAiHelperActiveWrapper::NewLC +// ---------------------------------------------------------------------------- +// +CWsfLaunchAiHelperActiveWrapper* CWsfLaunchAiHelperActiveWrapper::NewLC( + CWsfModel* aModel, TWsfAiController &aController ) + { + LOG_ENTERFN( "CWsfLaunchAiHelperActiveWrapper::NewLC" ); + CWsfLaunchAiHelperActiveWrapper* self = + new (ELeave) CWsfLaunchAiHelperActiveWrapper(); + CleanupStack::PushL( self ); + self->ConstructL( aModel, aController ); + return self; + } + + +// ---------------------------------------------------------------------------- +// CWsfLaunchAiHelperActiveWrapper::NewL +// ---------------------------------------------------------------------------- +// +CWsfLaunchAiHelperActiveWrapper* CWsfLaunchAiHelperActiveWrapper::NewL( + CWsfModel* aModel, TWsfAiController &aController ) + { + LOG_ENTERFN( "CWsfLaunchAiHelperActiveWrapper::NewL" ); + CWsfLaunchAiHelperActiveWrapper* self = + CWsfLaunchAiHelperActiveWrapper::NewLC( aModel, aController ); + CleanupStack::Pop(); // self; + return self; + } + + +// ---------------------------------------------------------------------------- +// CWsfLaunchAiHelperActiveWrapper::ConstructL +// ---------------------------------------------------------------------------- +// +void CWsfLaunchAiHelperActiveWrapper::ConstructL( CWsfModel* aModel, + TWsfAiController &aController ) + { + LOG_ENTERFN( "CWsfLaunchAiHelperActiveWrapper::ConstructL" ); + CActiveScheduler::Add( this ); // Add to scheduler + iModel = aModel; + iController = &aController; + User::LeaveIfError( iTimer.CreateLocal() ); + User::LeaveIfError( iAiHelperAppExitCode.Attach( KWsfAiHelperCategoryUid, + KWsfAiHelperExitCodeKey ) ); + + User::LeaveIfError( iAiHelperAppIapId.Attach( KWsfAiHelperCategoryUid, + KWsfAiHelperIapIdKey ) ); + } + +// ---------------------------------------------------------------------------- +// CWsfLaunchAiHelperActiveWrapper::~CWsfLaunchAiHelperActiveWrapper +// ---------------------------------------------------------------------------- +// +CWsfLaunchAiHelperActiveWrapper::~CWsfLaunchAiHelperActiveWrapper() + { + LOG_ENTERFN( + "CWsfLaunchAiHelperActiveWrapper::~CWsfWLANListActiveWrapper" ); + Cancel(); // Cancel any request, if outstanding + // Delete instance variables if any + iAiHelperAppExitCode.Close(); + iAiHelperAppIapId.Close(); + iTimer.Close(); + } + +// ---------------------------------------------------------------------------- +// CWsfLaunchAiHelperActiveWrapper::DoCancel +// ---------------------------------------------------------------------------- +// +void CWsfLaunchAiHelperActiveWrapper::DoCancel() + { + iAiHelperAppExitCode.Cancel(); + iAiHelperAppIapId.Cancel(); + iTimer.Cancel(); + iStoppingHelper = iModel->CloseHelperApplication(); + } + +// ---------------------------------------------------------------------------- +// CWsfLaunchAiHelperActiveWrapper::Start +// ---------------------------------------------------------------------------- +// +void CWsfLaunchAiHelperActiveWrapper::Start( TWsfWlanInfo& aInfo, + TBool aConnectOnly, + TBool aTestAccessPoint ) + { + LOG_ENTERFN( "CWsfLaunchAiHelperActiveWrapper::Start" ); + iStoppingHelper = EFalse; + Cancel(); // Cancel any request, just to be sure + iState = EUninitialized; + iUsedInfo = aInfo; + iConnectOnly = aConnectOnly; + iTestAccessPoint = aTestAccessPoint; + + if ( iStoppingHelper ) + { + LOG_WRITE( "Helper was stopped - wait for a while" ); + iTimer.Cancel(); + iTimer.After( iStatus, KTimerTickInterval ); + } + else + { + LOG_WRITE( "Helper was not alive" ); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + } + SetActive(); + } + +// ---------------------------------------------------------------------------- +// CWsfLaunchAiHelperActiveWrapper::RunL +// ---------------------------------------------------------------------------- +// +void CWsfLaunchAiHelperActiveWrapper::RunL() + { + LOG_ENTERFN( "CWsfLaunchAiHelperActiveWrapper::RunL" ); + if ( iStatus == KErrNone ) + { + if ( iState == EUninitialized ) + { + LOG_WRITE( "Start launching ai helper" ); + // register for notification + iAiHelperAppExitCode.Subscribe( iStatus ); + iModel->LaunchHelperApplicationL( iUsedInfo ); + iState = EInitialized; + SetActive(); // Tell scheduler a request is active + } + else if (iState == EInitialized) + { + TInt exitCode( KErrNone ); + iAiHelperAppExitCode.Get( exitCode ); + + LOG_WRITEF( "AiHelper returned %d", exitCode ); + + if ( exitCode == KErrNone ) + { + TInt iapId(0); + iAiHelperAppIapId.Get( iapId ); + iUsedInfo.iIapId = TUint32( iapId ); + LOG_WRITEF( "AiHelper iap id = %d", iapId ); + if ( iUsedInfo.iIapId ) + { + LOG_WRITE( "Iap id exist - connect" ); + iController->ConnectL( iUsedInfo, iConnectOnly, + iTestAccessPoint ); + } + else + { + LOG_WRITE( "No iap id from ai helper" ); + } + } + else + { + User::Leave(exitCode); + } + } + else + { + LOG_WRITEF( "iState = %d", iState ); + } + } + else + { + LOG_WRITEF( "CWsfLaunchAiHelperActiveWrapper iStatus = %d", + iStatus.Int() ); + } + } + +// ---------------------------------------------------------------------------- +// CWsfLaunchAiHelperActiveWrapper::RunError +// ---------------------------------------------------------------------------- +// +#ifdef _DEBUG +TInt CWsfLaunchAiHelperActiveWrapper::RunError( TInt aError ) + { + LOG_ENTERFN( "CWsfLaunchAiHelperActiveWrapper::RunError" ); + LOG_WRITEF( "aError = %d", aError ); +#else +TInt CWsfLaunchAiHelperActiveWrapper::RunError( TInt /*aError*/ ) + { +#endif + return KErrNone; + } + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/src/wsfrefreshscanactivewrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfrefreshscanactivewrapper.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,166 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfRefreshScanActiveWrapper. +* +*/ + + +// INCLUDE FILES +#include "wsflogger.h" +#include "wsfmodel.h" +#include "wsfwlaninfoarray.h" +#include "wsfrefreshscanactivewrapper.h" + +// -------------------------------------------------------------------------- +// CWsfRefreshScanActiveWrapper::CWsfRefreshScanActiveWrapper +// -------------------------------------------------------------------------- +// +CWsfRefreshScanActiveWrapper::CWsfRefreshScanActiveWrapper() : + CActive(EPriorityStandard) // Standard priority + { + } + + +// -------------------------------------------------------------------------- +// CWsfRefreshScanActiveWrapper::NewLC +// -------------------------------------------------------------------------- +// +CWsfRefreshScanActiveWrapper* CWsfRefreshScanActiveWrapper::NewLC( CWsfModel* aModel ) + { + LOG_ENTERFN( "CWsfRefreshScanActiveWrapper::NewLC" ); + CWsfRefreshScanActiveWrapper* self = + new (ELeave) CWsfRefreshScanActiveWrapper(); + CleanupStack::PushL(self); + self->ConstructL( aModel ); + return self; + } + + +// -------------------------------------------------------------------------- +// CWsfRefreshScanActiveWrapper::NewL +// -------------------------------------------------------------------------- +// +CWsfRefreshScanActiveWrapper* CWsfRefreshScanActiveWrapper::NewL( CWsfModel* aModel ) + { + LOG_ENTERFN( "CWsfRefreshScanActiveWrapper::NewL" ); + CWsfRefreshScanActiveWrapper* self = + CWsfRefreshScanActiveWrapper::NewLC( aModel ); + CleanupStack::Pop(); // self; + return self; + } + + +// -------------------------------------------------------------------------- +// CWsfRefreshScanActiveWrapper::ConstructL +// -------------------------------------------------------------------------- +// +void CWsfRefreshScanActiveWrapper::ConstructL( CWsfModel* aModel ) + { + LOG_ENTERFN( "CWsfRefreshScanActiveWrapper::ConstructL" ); + CActiveScheduler::Add(this); // Add to scheduler + iModel = aModel; + } + + +// -------------------------------------------------------------------------- +// CWsfRefreshScanActiveWrapper::~CWsfRefreshScanActiveWrapper +// -------------------------------------------------------------------------- +// +CWsfRefreshScanActiveWrapper::~CWsfRefreshScanActiveWrapper() + { + LOG_ENTERFN( + "WsfRefreshScanActiveWrapper::~WsfRefreshScanActiveWrapper" ); + Cancel(); // Cancel any request, if outstanding + // Delete instance variables if any + } + + +// -------------------------------------------------------------------------- +// CWsfRefreshScanActiveWrapper::DoCancel +// -------------------------------------------------------------------------- +// +void CWsfRefreshScanActiveWrapper::DoCancel() + { + LOG_ENTERFN( "CWsfRefreshScanActiveWrapper::DoCancel" ); + } + + +// -------------------------------------------------------------------------- +// CWsfRefreshScanActiveWrapper::StartL +// -------------------------------------------------------------------------- +// +void CWsfRefreshScanActiveWrapper::Start() + { + LOG_ENTERFN( "CWsfRefreshScanActiveWrapper::Start" ); + Cancel(); // Cancel any request, just to be sure + iState = EUninitialized; + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + + +// -------------------------------------------------------------------------- +// CWsfRefreshScanActiveWrapper::RunL +// -------------------------------------------------------------------------- +// +void CWsfRefreshScanActiveWrapper::RunL() + { + LOG_ENTERFN( "CWsfRefreshScanActiveWrapper::RunL" ); + if (iStatus == KErrNone) + { + if (iState == EUninitialized) + { + LOG_WRITE( "request scan" ); + iModel->RefreshScan( iPckg, iStatus ); + iState = EInitialized; + SetActive(); // Tell scheduler a request is active + } + else if (iState == EInitialized ) + { + LOG_WRITEF( "request result = %d", iPckg() ); + iModel->SetRefreshState( iPckg() ); + } + else + { + LOG_WRITEF( "iState = %d", iState ); + } + } + else + { + LOG_WRITEF( "RefreshScanActiveWrapper iStatus = %d", iStatus.Int() ); + } + } + + +// -------------------------------------------------------------------------- +// CWsfRefreshScanActiveWrapper::RunError +// -------------------------------------------------------------------------- +// +#ifdef _DEBUG +TInt CWsfRefreshScanActiveWrapper::RunError( TInt aError ) + { + LOG_ENTERFN( "CWsfRefreshScanActiveWrapper::RunError" ); + LOG_WRITEF( "aError = %d", aError ); + return aError; + } +#else +TInt CWsfRefreshScanActiveWrapper::RunError( TInt /*aError*/ ) + { + return KErrNone; + } +#endif + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/src/wsfsearchwlansdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfsearchwlansdialog.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,218 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfSearchWlansDialog +* +*/ + + + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include "wsfsearchwlansdialog.h" +#include "wsflogger.h" + +// MACROS +#ifdef _DEBUG + _LIT( KSearchDialogPanic, "CWsfSearchWlansDialog" ); + #define _ASS_D( cond ) __ASSERT_DEBUG( (cond), \ + User::Panic( KSearchDialogPanic, __LINE__) ) +#else + #define _ASS_D( cond ) {} +#endif // DEBUG + + +// CONSTRUCTION AND DESTRUCTION +// -------------------------------------------------------------------------- +// CWsfSearchWlansDialog::NewL +// -------------------------------------------------------------------------- +// +CWsfSearchWlansDialog* CWsfSearchWlansDialog::NewL( TInt &aSelectedItem ) + { + CWsfSearchWlansDialog* thisPtr = NewLC( aSelectedItem ); + CleanupStack::Pop( thisPtr ); + return thisPtr; + } + + +// -------------------------------------------------------------------------- +// CWsfSearchWlansDialog::NewLC +// -------------------------------------------------------------------------- +// +CWsfSearchWlansDialog* CWsfSearchWlansDialog::NewLC( TInt &aSelectedItem ) + { + CWsfSearchWlansDialog* thisPtr = + new ( ELeave ) CWsfSearchWlansDialog( aSelectedItem ); + CleanupStack::PushL( thisPtr ); + thisPtr->ConstructL(); + return thisPtr; + } + + +// -------------------------------------------------------------------------- +// CWsfSearchWlansDialog::~CWsfSearchWlansDialog +// -------------------------------------------------------------------------- +// +CWsfSearchWlansDialog::~CWsfSearchWlansDialog() + { + } + + +// -------------------------------------------------------------------------- +// CWsfSearchWlansDialog::CWsfSearchWlansDialog +// -------------------------------------------------------------------------- +// +CWsfSearchWlansDialog::CWsfSearchWlansDialog( TInt &aSelectedItem ) : + CAknListQueryDialog( &aSelectedItem ), + iSelectedItem( &aSelectedItem ) + { + } + + +// -------------------------------------------------------------------------- +// CWsfSearchWlansDialog::ConstructL +// -------------------------------------------------------------------------- +// +void CWsfSearchWlansDialog::ConstructL() + { + // nothing at the moment... + } + + +// -------------------------------------------------------------------------- +// CWsfSearchWlansDialog::ProcessCommandL +// -------------------------------------------------------------------------- +// +void CWsfSearchWlansDialog::ProcessCommandL( TInt aCommandId ) + { + LOG_ENTERFN( "CWsfSearchWlansDialog::ProcessCommandL" ); + CAknListQueryDialog::ProcessCommandL( aCommandId ); + } + + +// -------------------------------------------------------------------------- +// CWsfSearchWlansDialog::UpdateHotSpotsL +// -------------------------------------------------------------------------- +// +void CWsfSearchWlansDialog::UpdateHotSpotsL( MDesCArray* aItemTextArray, + TInt aCurrentItem ) + { + LOG_ENTERFN( "CWsfSearchWlansDialog::UpdateHotSpotsL" ); + _ASS_D( ListBox() ); + + SetItemTextArray( aItemTextArray ); + SetOwnershipType( ELbmDoesNotOwnItemArray ); + ListBox()->HandleItemAdditionL(); + if ( aCurrentItem < 0 || aCurrentItem >= aItemTextArray->MdcaCount() ) + { + ListBox()->ClearSelection(); + } + else + { + ListBox()->SetCurrentItemIndex( aCurrentItem ); + } + } + + +// -------------------------------------------------------------------------- +// CWsfSearchWlansDialog::SelectedItem +// -------------------------------------------------------------------------- +// +TInt CWsfSearchWlansDialog::SelectedItem() + { + LOG_ENTERFN( "CWsfSearchWlansDialog::SelectedItem" ); + _ASS_D( ListBox() ); + + return ListBox()->CurrentItemIndex(); + } + + +// -------------------------------------------------------------------------- +// CWsfSearchWlansDialog::StartConnectingAnimationL +// -------------------------------------------------------------------------- +// +void CWsfSearchWlansDialog::StartConnectingAnimationL() + { + LOG_ENTERFN( "CWsfSearchWlansDialog::StartConnectingAnimationL" ); + } + + +// -------------------------------------------------------------------------- +// CWsfSearchWlansDialog::ForceRefreshingL +// -------------------------------------------------------------------------- +// +void CWsfSearchWlansDialog::ForceRefreshingL() + { + LOG_ENTERFN( "CWsfSearchWlansDialog::ForceRefreshingL" ); + } + + +// -------------------------------------------------------------------------- +// CWsfSearchWlansDialog::MultilineControl +// -------------------------------------------------------------------------- +// +TBool CWsfSearchWlansDialog::MultilineControl() + { + LOG_ENTERFN( "CWsfSearchWlansDialog::MultilineControl" ); + return ETrue; + } + + +// -------------------------------------------------------------------------- +// CWsfSearchWlansDialog::UpdateViewL +// -------------------------------------------------------------------------- +// +void CWsfSearchWlansDialog::UpdateViewL( MDesCArray* /*aItemTextArray*/ ) + { + LOG_ENTERFN( "CWsfSearchWlansDialog::UpdateViewL" ); + } + + +// -------------------------------------------------------------------------- +// CWsfSearchWlansDialog::DisplayEngineOffL +// -------------------------------------------------------------------------- +// +void CWsfSearchWlansDialog::DisplayEngineOffL() + { + LOG_ENTERFN( "CWsfSearchWlansDialog::DisplayEngineOffL" ); + } + + +// -------------------------------------------------------------------------- +// CWsfSearchWlansDialog::PreLayoutDynInitL +// -------------------------------------------------------------------------- +// +void CWsfSearchWlansDialog::PreLayoutDynInitL() + { + LOG_ENTERFN( "CWsfSearchWlansDialog::PreLayoutDynInitL" ); + _ASS_D( ListBox() ); + // add the empty text here.... + HBufC* noWlansAvailable = iCoeEnv->AllocReadResourceLC( + R_QTN_STATUS_NO_WLANS_AVAILABLE ); + + ListBox()->View()->SetListEmptyTextL( *noWlansAvailable ); + + CleanupStack::PopAndDestroy( noWlansAvailable ); + CAknListQueryDialog::PreLayoutDynInitL(); + } + +// End of file + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/aiplugin/src/wsfwlanlistactivewrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfwlanlistactivewrapper.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,281 @@ +/* + * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies 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 CWsfWLANListActiveWrapper. + * + */ + + +// INCLUDE FILES +#include "wsflogger.h" +#include "wsfmodel.h" +#include "wsfwlaninfoarray.h" +#include "wsfaicontroller.h" +#include "wsfwlanlistactivewrapper.h" + + +/** +* Number of retries to fetch wlan data +*/ +static const TInt KRetries = 5; + + +// ---------------------------------------------------------------------------- +// CWsfWLANListActiveWrapper::CWsfWLANListActiveWrapper +// ---------------------------------------------------------------------------- +// +CWsfWLANListActiveWrapper::CWsfWLANListActiveWrapper() : + CActive( EPriorityStandard ), // Standard priority + iPtr( NULL, 0 ) + { + } + + +// ---------------------------------------------------------------------------- +// CWsfWLANListActiveWrapper::NewLC +// ---------------------------------------------------------------------------- +// +CWsfWLANListActiveWrapper* CWsfWLANListActiveWrapper::NewLC( CWsfModel* aModel, + TWsfAiController &aController ) + { + LOG_ENTERFN( "CWsfWLANListActiveWrapper::NewLC" ); + CWsfWLANListActiveWrapper* self = + new (ELeave) CWsfWLANListActiveWrapper(); + CleanupStack::PushL(self); + self->ConstructL( aModel, aController ); + return self; + } + + +// ---------------------------------------------------------------------------- +// CWsfWLANListActiveWrapper::NewL +// ---------------------------------------------------------------------------- +// +CWsfWLANListActiveWrapper* CWsfWLANListActiveWrapper::NewL( CWsfModel* aModel, + TWsfAiController &aController ) + { + LOG_ENTERFN( "CWsfWLANListActiveWrapper::NewL" ); + CWsfWLANListActiveWrapper* self = CWsfWLANListActiveWrapper::NewLC( + aModel, aController ); + CleanupStack::Pop(); // self; + return self; + } + + +// ---------------------------------------------------------------------------- +// CWsfWLANListActiveWrapper::ConstructL +// ---------------------------------------------------------------------------- +// +void CWsfWLANListActiveWrapper::ConstructL( CWsfModel* aModel, + TWsfAiController &aController ) + { + LOG_ENTERFN( "CWsfWLANListActiveWrapper::ConstructL" ); + CActiveScheduler::Add(this); // Add to scheduler + iModel = aModel; + iController = &aController; + iArray = CWsfWlanInfoArray::NewL(); + } + +// ---------------------------------------------------------------------------- +// CWsfWLANListActiveWrapper::~CWsfWLANListActiveWrapper +// ---------------------------------------------------------------------------- +// +CWsfWLANListActiveWrapper::~CWsfWLANListActiveWrapper() + { + LOG_ENTERFN( "CWsfWLANListActiveWrapper::~CWsfWLANListActiveWrapper" ); + Cancel(); // Cancel any request, if outstanding + // Delete instance variables if any + if ( iBuffer ) + { + delete iBuffer; + } + delete iArray; + } + +// ---------------------------------------------------------------------------- +// CWsfWLANListActiveWrapper::DoCancel +// ---------------------------------------------------------------------------- +// +void CWsfWLANListActiveWrapper::DoCancel() + { + } + +// ---------------------------------------------------------------------------- +// CWsfWLANListActiveWrapper::Start +// ---------------------------------------------------------------------------- +// +void CWsfWLANListActiveWrapper::Start( TBool aStarUp ) + { + LOG_ENTERFN( "CWsfWLANListActiveWrapper::Start" ); + Cancel(); // Cancel any request, just to be sure + iStartUp = aStarUp; + iState = EUninitialized; + iRetriesLeft = KRetries; + iPckgAllocatedSize() = 0; + iPckgNeededSize() = 0; + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + } + +// ---------------------------------------------------------------------------- +// CWsfWLANListActiveWrapper::GetWlanList +// ---------------------------------------------------------------------------- +// +CWsfWlanInfoArray* CWsfWLANListActiveWrapper::GetWlanList() + { + LOG_ENTERFN( "CWsfWLANListActiveWrapper::GetWlanList" ); + return iArray; + } + +// ---------------------------------------------------------------------------- +// CWsfWLANListActiveWrapper::GetConnectedWLANNetwork +// ---------------------------------------------------------------------------- +// +TWsfWlanInfo CWsfWLANListActiveWrapper::GetConnectedWLANNetwork() + { + LOG_ENTERFN( "CWsfWLANListActiveWrapper::GetConnectedWLANNetwork" ); + return iConnectedWlan; + } + +// ---------------------------------------------------------------------------- +// CWsfWLANListActiveWrapper::RunL +// ---------------------------------------------------------------------------- +// +void CWsfWLANListActiveWrapper::RunL() + { + LOG_ENTERFN( "CWsfWLANListActiveWrapper::RunL" ); + if (iStatus == KErrNone) + { + if ( iState == EUninitialized ) + { + LOG_WRITE( "Get WLAN list size" ); + iModel->GetWlanListSize( iPckgNeededSize, iStatus ); + iState = EInitialized; + SetActive(); // Tell scheduler a request is active + } + else if ( iState == EInitialized ) + { + LOG_WRITEF( "WLAN data buffer size = %d", iPckgNeededSize() ); + + if ( !iPckgNeededSize() ) + { + LOG_WRITE( "no data.." ); + iState = EProcessWLANListData; + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + } + else + { + // alloc the required size buffer... + delete iBuffer; + iBuffer = NULL; + iBuffer = HBufC8::NewL( iPckgNeededSize() ); + iPtr.Set( iBuffer->Des() ); + + LOG_WRITE( "Get WLAN list" ); + iModel->GetWlanList( iPckgAllocatedSize, iPtr, iStatus ); + iState = EProcessWLANListData; + SetActive(); // Tell scheduler a request is active + } + } + else if ( iState == EProcessWLANListData ) + { + LOG_WRITEF( "actual bytes occupied = %d", iPckgAllocatedSize() ); + + if ( iPckgNeededSize() != iPckgAllocatedSize() ) + { + // the buffer is not long enough... stop + if ( iRetriesLeft > 0 ) + { + LOG_WRITEF( "iRetriesLeft = %d", iRetriesLeft ); + iRetriesLeft--; + iState = EUninitialized; + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + return; + } + else + { + // no more retries + User::Leave( KErrOverflow ); + } + } + + iArray->Reset(); + + if ( iPckgAllocatedSize() ) + { + iArray->AppendFromStreamBufferL( iPtr ); + } + + LOG_WRITEF( "Array count=%d startup=%d", iArray->Count(), iStartUp ); + + iModel->GetConnectedWlanDetails( iPckg, iConnectedWlan, iStatus ); + iState = EGetConnectedNetwork; + SetActive(); // Tell scheduler a request is active + } + else if ( iState == EGetConnectedNetwork ) + { + LOG_WRITEF( "request result = %d", iPckg() ); + + if ( !iPckg() ) + { + LOG_WRITE( "result is false, so wlaninfo is marked not connected" ); + iConnectedWlan.iConnectionState = ENotConnected; + } + + LOG_WRITEF( "Connected = %d", iConnectedWlan.Connected() ); + + LOG_WRITEF( "iConnectedWlan state = %d", + iConnectedWlan.iConnectionState ); + + if ( iStartUp ) + { + iController->StartupRefreshDataReadyL(); + } + else + { + iController->WlanListDataReadyL(); + } + } + else + { + LOG_WRITEF( "iState = %d", iState ); + } + } + else + { + LOG_WRITEF( "WLANListActiveWrapper iStatus = %d", iStatus.Int() ); + } + } + +// ---------------------------------------------------------------------------- +// CWsfWLANListActiveWrapper::RunError +// ---------------------------------------------------------------------------- +// +#ifdef _DEBUG +TInt CWsfWLANListActiveWrapper::RunError( TInt aError ) + { + LOG_ENTERFN( "CWsfWLANListActiveWrapper::RunError" ); + LOG_WRITEF( "aError = %d", aError ); + return aError; + } +#else +TInt CWsfWLANListActiveWrapper::RunError( TInt /*aError*/ ) + { + return KErrNone; + } +#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/apwizard/bwins/wsfapwizardu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/bwins/wsfapwizardu.def Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,7 @@ +EXPORTS + ??1CWsfWlanIapWizard@@UAE@XZ @ 1 NONAME ; CWsfWlanIapWizard::~CWsfWlanIapWizard(void) + ?CreateAccessPointL@CWsfWlanIapWizard@@QAEHXZ @ 2 NONAME ; int CWsfWlanIapWizard::CreateAccessPointL(void) + ?LaunchWizardL@CWsfWlanIapWizard@@QAEHAAVTWsfWlanInfo@@H@Z @ 3 NONAME ; int CWsfWlanIapWizard::LaunchWizardL(class TWsfWlanInfo &, int) + ?NewL@CWsfWlanIapWizard@@SAPAV1@XZ @ 4 NONAME ; class CWsfWlanIapWizard * CWsfWlanIapWizard::NewL(void) + ?NewLC@CWsfWlanIapWizard@@SAPAV1@XZ @ 5 NONAME ; class CWsfWlanIapWizard * CWsfWlanIapWizard::NewLC(void) + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/apwizard/data/wsfapwizard.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/data/wsfapwizard.rss Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,369 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource definitions for project ApWizard +* +*/ + + + +NAME WLWZ + +#include +#include +#include +#include +#include +#include +#include + + +#include +#include +#include "wsfapwizard.hrh" + + +RESOURCE RSS_SIGNATURE { } + + +RESOURCE TBUF16 { buf=""; } + + +// --------------------------------------------------------------------------- +// r_qtn_enter_network_ssid +// String for WLAN network name prompt +// --------------------------------------------------------------------------- +// +RESOURCE TBUF r_qtn_enter_network_ssid + { + buf = qtn_wlan_prmpt_network_name; + } + + +// --------------------------------------------------------------------------- +// r_qtn_cmon_quest_create_wlan_iap +// String for create AP query +// --------------------------------------------------------------------------- +// +RESOURCE TBUF r_qtn_cmon_quest_create_wlan_iap + { + buf = qtn_cmon_quest_create_wlan_iap; + } + + +// --------------------------------------------------------------------------- +// r_qtn_netw_conset_info_eap_settings_default +// String for default EAP settings infonote +// --------------------------------------------------------------------------- +// +RESOURCE TBUF r_qtn_netw_conset_info_eap_settings_default + { + buf = qtn_netw_conset_info_eap_settings_default; + } + + +// --------------------------------------------------------------------------- +// r_qtn_wlan_info_no_networks_found +// String for no networks infonote +// --------------------------------------------------------------------------- +// +RESOURCE TBUF r_qtn_wlan_info_no_networks_found + { + buf = qtn_wlan_info_no_networks_found; + } + + +// --------------------------------------------------------------------------- +// r_qtn_wizard_query_general +// Multi-purpose textfield + ok-cancel dialog +// --------------------------------------------------------------------------- +// +RESOURCE DIALOG r_qtn_wizard_query_general + { + flags = EGeneralQueryFlags | EEikDialogFlagNotifyEsc; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_DATA_QUERY + { + layout = EDataLayout; + control = EDWIN + { + default_case = EAknEditorLowerCase; + avkon_flags = EAknEditorFlagNoT9; + }; + }; + } + }; + } + + +// --------------------------------------------------------------------------- +// r_qtn_wizard_auth_modes +// Security mode list +// --------------------------------------------------------------------------- +// +RESOURCE ARRAY r_qtn_wizard_auth_modes + { + items = + { + LBUF + { + txt = qtn_netw_conset_wlan_security_mode_open; + }, + LBUF + { + txt = qtn_netw_conset_wlan_security_mode_wep; + }, + LBUF + { + txt = qtn_netw_conset_wlan_security_mode_802_1x; + }, + LBUF + { + txt = qtn_netw_conset_wlan_security_mode_wpa; + } + }; + } + + + +// --------------------------------------------------------------------------- +// r_qtn_wizard_auth_mode +// Security mode query +// --------------------------------------------------------------------------- +// +RESOURCE AVKON_LIST_QUERY r_qtn_wizard_auth_mode + { + flags = EGeneralQueryFlags; + softkeys = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control = AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_qtn_wizard_auth_modes; + }; + heading = qtn_netw_conset_prmpt_wlan_nw_security_mode; + }; + } + }; + } + + +// --------------------------------------------------------------------------- +// r_qtn_wizard_auth_modes_ad_hoc +// Security mode list +// --------------------------------------------------------------------------- +// +RESOURCE ARRAY r_qtn_wizard_auth_modes_ad_hoc + { + items = + { + LBUF + { + txt = qtn_netw_conset_wlan_security_mode_open; + }, + LBUF + { + txt = qtn_netw_conset_wlan_security_mode_wep; + } + }; + } + + +// --------------------------------------------------------------------------- +// r_qtn_wizard_auth_mode_ad_hoc +// Security mode query +// --------------------------------------------------------------------------- +// +RESOURCE AVKON_LIST_QUERY r_qtn_wizard_auth_mode_ad_hoc + { + flags = EGeneralQueryFlags; + softkeys = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control = AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_qtn_wizard_auth_modes_ad_hoc; + }; + heading = qtn_netw_conset_prmpt_wlan_nw_security_mode; + }; + } + }; + } + + +// --------------------------------------------------------------------------- +// r_qtn_wizard_network_modes +// Network mode list +// --------------------------------------------------------------------------- +// +RESOURCE ARRAY r_qtn_wizard_network_modes + { + items = + { + LBUF + { + txt = qtn_wlan_network_mode_infra_public; + }, + LBUF + { + txt = qtn_wlan_network_mode_infra_hidden; + }, + LBUF + { + txt = qtn_wlan_network_mode_adhoc_public; + } + }; + } + + +// --------------------------------------------------------------------------- +// r_qtn_wizard_network_mode +// Query of network modes +// --------------------------------------------------------------------------- +// +RESOURCE AVKON_LIST_QUERY r_qtn_wizard_network_mode + { + flags = EGeneralQueryFlags; + softkeys = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control = AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_qtn_wizard_network_modes; + }; + heading = qtn_netw_conset_prmpt_wlan_nw_mode_and_status; + }; + } + }; + } + + +// --------------------------------------------------------------------------- +// r_qtn_wizard_wpa_modes +// WPA mode list +// --------------------------------------------------------------------------- +// +RESOURCE ARRAY r_qtn_wizard_wpa_modes + { + items = + { + LBUF + { + txt = qtn_netw_conset_prmpt_wpa_mode_eap; + }, + LBUF + { + txt = qtn_netw_conset_prmpt_wpa_mode_psk; + } + }; + } + + +// --------------------------------------------------------------------------- +// r_qtn_wizard_wpa_mode +// Query of WPA modes +// --------------------------------------------------------------------------- +// +RESOURCE AVKON_LIST_QUERY r_qtn_wizard_wpa_mode + { + flags = EGeneralQueryFlags; + softkeys = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control = AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_qtn_wizard_wpa_modes; + }; + heading = qtn_netw_conset_prmpt_wlan_wpa_mode; + }; + } + }; + } + + + +// --------------------------------------------------------------------------- +// r_qtn_wizard_confirmation_query +// Multi-purpose yes-no query +// --------------------------------------------------------------------------- +// +RESOURCE DIALOG r_qtn_wizard_confirmation_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + }; + } + }; + } + + +// --------------------------------------------------------------------------- +// r_searching_wlan_wait_note +// Wait note while searching for networks +// --------------------------------------------------------------------------- +// +RESOURCE DIALOG r_searching_wlan_wait_note + { + flags = EAknWaitNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EWaitNoteSearchingWlans; + control = AVKON_NOTE + { + layout = EWaitLayout; + singular_label = qtn_wlan_wait_searching_networks; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; + } + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/apwizard/eabi/wsfapwizardu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/eabi/wsfapwizardu.def Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,9 @@ +EXPORTS + _ZN17CWsfWlanIapWizard13LaunchWizardLER12TWsfWlanInfoi @ 1 NONAME + _ZN17CWsfWlanIapWizard18CreateAccessPointLEv @ 2 NONAME + _ZN17CWsfWlanIapWizard4NewLEv @ 3 NONAME + _ZN17CWsfWlanIapWizard5NewLCEv @ 4 NONAME + _ZN17CWsfWlanIapWizardD0Ev @ 5 NONAME + _ZN17CWsfWlanIapWizardD1Ev @ 6 NONAME + _ZN17CWsfWlanIapWizardD2Ev @ 7 NONAME + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/apwizard/group/apwizard.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/group/apwizard.mmp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 project ApWizard +* +*/ + + + +#include +#include + + +TARGET wsfapwizard.dll +TARGETTYPE dll +UID 0x1000008e 0x10281CAD + +CAPABILITY CAP_GENERAL_DLL + + +START RESOURCE ../data/wsfapwizard.rss +HEADER +TARGETPATH resource +LANGUAGE_IDS +END + + +// Source files +SOURCEPATH ../src +SOURCE wsfwlaniapwizard.cpp +SOURCE wsfwlaniapcreator.cpp +SOURCE wsfwlanssiddiscovery.cpp +SOURCE wsfactivewaiter.cpp + + +// own headers +USERINCLUDE ../inc + +// inner API +USERINCLUDE ../../inc + +// private API +USERINCLUDE ../../../inc + + +//Macro to /epoc32 headers +MW_LAYER_SYSTEMINCLUDE + + + +// Used system libraries +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY estor.lib +LIBRARY commsdat.lib +LIBRARY avkon.lib +LIBRARY cone.lib +LIBRARY commonengine.lib +LIBRARY eikcoctl.lib +LIBRARY eikdlg.lib +LIBRARY eikcore.lib +LIBRARY esock.lib +LIBRARY commonui.lib +LIBRARY charconv.lib + +// Used project libraries +LIBRARY wsfwlaninfo.lib +LIBRARY cmmanagerdatabase.lib +LIBRARY cmmanager.lib +LIBRARY connectionuiutilities.lib +LIBRARY ecom.lib + +DEBUGLIBRARY flogger.lib + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/apwizard/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 file for project ApWizard +* +*/ + + + + +#include + +PRJ_PLATFORMS +DEFAULT + + +PRJ_EXPORTS +../inc/wsfwlaniapwizard.h |../../inc/wsfwlaniapwizard.h + +// export localised loc file +../loc/wsfapwizard.loc MW_LAYER_LOC_EXPORT_PATH(wsfapwizard.loc) + +../rom/wsfapwizard.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wsfapwizard.iby) +../rom/wsfapwizardresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(wsfapwizardresources.iby) + + +PRJ_MMPFILES +apwizard.mmp + + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/apwizard/inc/wsfactivewaiter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/inc/wsfactivewaiter.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfActiveWaiter +* +*/ + + + +#ifndef C_WSFACTIVEWAITER_H +#define C_WSFACTIVEWAITER_H + +// EXTERNAL INCLUDES +#include + + +// CLASS DEFINITION +/** + * CWsfActiveWaiter class, + * an active object to replace User::WaitForRequest() + * + * Usage: + * @code + * CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewL(); + * CleanupStack::PushL( waiter ); + * server.AsyncFunction( waiter->iStatus ); + * if ( waiter->WaitForRequest() == KErrNone ) + * { + * // handle success + * } + * else + * { + * // handle failure + * } + * CleanupStack::PopAndDestroy( waiter ); + * @endcode + * + * @lib wsfserver.exe + * @since S60 5.0 + */ +NONSHARABLE_CLASS( CWsfActiveWaiter ): public CActive + { + public: + /** + * Factory function + * @since S60 5.0 + * @return CWsfActiveWaiter instance. + */ + static CWsfActiveWaiter* NewL(); + + /** + * Factory function + * @since S60 5.0 + * @return CWsfActiveWaiter instance. + */ + static CWsfActiveWaiter* NewLC(); + + /** + * Destructor + * @since S60 5.0 + */ + virtual ~CWsfActiveWaiter(); + + protected: + /** + * Constructor + * @since S60 5.0 + */ + CWsfActiveWaiter(); + + protected: // from CActive + + /** + * Implements cancellation of an outstanding request. + * @since S60 5.0 + */ + void DoCancel(); + + /** + * Handles an active object's request completion event. + * @since S60 5.0 + */ + void RunL(); + + public: // new methods + /** + * Waits for its TRequestStatus to be completed + * @since S60 5.0 + * @return Error code returned from server after request is completed + */ + TInt WaitForRequest(); + + protected: // data + /** + * Nested waitloop + */ + CActiveSchedulerWait iWait; + }; + +#endif // C_WSFACTIVEWAITER_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/apwizard/inc/wsfapwizard.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/inc/wsfapwizard.hrh Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource headers for project ApWizard +* +*/ + + + +#ifndef WSFAPWIZARD_HRH +#define WSFAPWIZARD_HRH + +/** +* Dialog ID's in ApWizard +*/ +enum TWsfApWizardDialogIds + { + EWaitNoteSearchingWlans = 5000 + }; + + +#endif // WSFAPWIZARD_HRH + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/apwizard/inc/wsfwlaniapcreator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/inc/wsfwlaniapcreator.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,174 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfWlanIapCreator +* +*/ + + + + +#ifndef C_WSFWLANIAPCREATOR_H +#define C_WSFWLANIAPCREATOR_H + + +// EXTERNAL INCLUDES +#include +#include +#include + + +// INTERNAL INCLUDES +#include "wsfwlaninfo.h" + + + +// CLASS DEFINITION +/** +* Class collects various IAP creation related functions. +* +* @lib wsfapwizard.lib +* @since S60 5.0 +*/ +NONSHARABLE_CLASS( CWsfWlanIapCreator ): public CBase + { + public: + /** + * Factory function. + * @since S60 5.0 + * @return Class instance + */ + static CWsfWlanIapCreator* NewL(); + + /** + * Factory function. + * @since S60 5.0 + * @return Class instance + */ + static CWsfWlanIapCreator* NewLC(); + + /** + * Destructor + * @since S60 5.0 + */ + ~CWsfWlanIapCreator(); + + + private: // constructors + /** + * Constructor + * @since S60 5.0 + */ + CWsfWlanIapCreator(); + + /** + * Second-phase constructor + * @since S60 5.0 + */ + void ConstructL(); + + + public: // new methods + /** + * Sets the default destination for subsequent access point + * creation calls + * @since S60 5.0 + * @param aDestinationId The id of the new default destination + */ + void SetDefaultDestination( const TUint32 aDestinationId ); + + /** + * Creates an access point to wlan. + * @since S60 5.0 + * @param aWlanInfo Contains all available data from wlan scanner. + * Note: the network name field may change if + * IAP already exists, e.g. MyWlan -> MyWlan(01). + * Also the IAP id is changed on successful creation + * @param aPresharedKey The used key to access network + * @param aIsHex ETrue if the key is given in hexadecimal string format. + * Applicable only in case of WEP authentication. + */ + void CreateAccessPointL( TWsfWlanInfo& aWlanInfo, + const TDesC& aPresharedKey, + const TBool aIsHex ); + + + private: // new methods + /** + * Creates connection method using the given WLAN parameters + * @since S60 5.0 + * @param aWlanInfo WLAN parameters. + * Note: the network name field may change if + * IAP already exists, e.g. MyWlan -> MyWlan(01) + * @return The id of the created IAP + */ + TUint32 CreateConnectionMethodL( TWsfWlanInfo& aWlanInfo ); + + /** + * Stores WPA data + * @since S60 5.0 + * @param aIapId The IAP for which WPA data are to be stored + * @param aPresharedKey WPA key string. MUST be correct as the function + * DOES NOT verify its correctness! + * @param aSecMode Security mode (to tell apart WPA-PSK/EAP) + */ + void StoreWPADataL( const TInt aIapId, + const TDesC& aPresharedKey, + const CMManager::TWlanSecMode aSecMode ); + + /** + * Stores WEP key data + * @param S60 5.0 + * @param aIapId The IAP for which WEP data are to be stored + * @param aWepKey WEP key string. MUST be correct as the function + * DOES NOT verify its correctness! + * @param aIsHexWep To indicate whether the passed key is in hex format + */ + void StoreWEPDataL( const TInt aIapId, + const TDesC& aWepKey, + const TBool aIsHexWep ); + + /** + * Converts an ascii sequence to hexadecimal character string + * @since S60 5.0 + * @param aSource The ASCII string + * @param aDest The destination for the hex string + */ + void ConvertAsciiToHex( const TDesC8& aSource, TDes8& aDest ); + + /** + * Cleanup function for commsdat session + * @since S60 5.0 + * @param aDbSession The commsdat session to clean up + */ + static void RollbackCommsDat( TAny* aDbSession ); + + + private: // data + /** + * Commsdat session object (owned) + */ + CommsDat::CMDBSession *iDbSession; + + /** + * Handle to the CmManager + */ + RCmManagerExt iCmManagerExt; + + /** + * Default destination id + */ + TUint32 iDestinationId; + }; + +#endif // C_WSFWLANIAPCREATOR_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/apwizard/inc/wsfwlaniapwizard.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/inc/wsfwlaniapwizard.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,221 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfWlanIapCreator +* +*/ + + + +#ifndef C_WSFWLANIAPWIZARD_H +#define C_WSFWLANIAPWIZARD_H + + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "wsfwlaninfo.h" + + +// FORWARD DECLARATIONS +class CWsfWlanIapCreator; +class CWsfWlanSsidDiscovery; + + +// CLASS DEFINITION +/** +* Class to control the user interaction during access point creation +* +* @lib wsfapwizard.lib +* @since S60 5.0 +*/ +NONSHARABLE_CLASS( CWsfWlanIapWizard ): public CBase, + public MProgressDialogCallback + { + public: + /** + * Factory function. + * @since S60 5.0 + * @return Class instance + */ + IMPORT_C static CWsfWlanIapWizard* NewL(); + + /** + * Factory function. + * @since S60 5.0 + * @return Class instance + */ + IMPORT_C static CWsfWlanIapWizard* NewLC(); + + /** + * Destructor + * @since S60 5.0 + */ + IMPORT_C ~CWsfWlanIapWizard(); + + + private: + /** + * Constructor + * @since S60 5.0 + */ + CWsfWlanIapWizard(); + + /** + * Second-phase constructor + * @since S60 5.0 + */ + void ConstructL(); + + + private: // from MProgressDialogCallback + + /** + * Callback method. Gets called when a dialog is dismissed. + * @since S60 5.0 + * @param aButtonId The button which caused the dismiss + */ + void DialogDismissedL( TInt aButtonId ); + + + public: // new methods + /** + * Starts the IAP creation wizard using the given wlaninfo item + * @since S60 5.0 + * @param aWlanInfo The wlaninfo with the already known network details + * @param aDefineAccessPoint If ETrue, 'Define access point' was + * selected from 'Options' menu + * @return ETrue on success, otherwise EFalse + */ + IMPORT_C TBool LaunchWizardL( TWsfWlanInfo& aWlanInfo, + TBool aDefineAccessPoint ); + + /** + * Creates the accesspoint using the entered data + * @since S60 5.0 + * @return ETrue on success, EFalse if IAP creation was cancelled + */ + IMPORT_C TBool CreateAccessPointL(); + + + private: + /** + * Makes necessary questions when creating the IAP + * @since S60 5.0 + */ + void AskNetworkDetailsL(); + + /** + * Prompts for the WLAN SSID in case of hidden/unlisted networks + * @since S60 5.0 + * @return Buffer containing the entered SSID + */ + HBufC* AskSsidL(); + + /** + * General purpose text query + * @since S60 5.0 + * @param aQueryStringResource Resource id of the caption string + * @param aVariable The buffer to put the entered data into + * @param aMaxLength Max length of the buffer + * @return Id of the button which dismissed the query + */ + TInt QueryTextL( TInt aQueryStringResource, + TDes& aVariable, + const TInt& aMaxLength ); + + /** + * Queries the secure key + * @since S60 5.0 + * @return ETrue if query was accepted, EFalse on cancel + */ + TBool QuerySecureKeyL(); + + /** + * Cleanup function for the searching for wlan waitnote + * @since S60 5.0 + * @param aPtr Pointer to this class + */ + static void DismissWaitNote( TAny* aPtr ); + + + /** + * Initializes the resource file in the given UI context + * @since S60 5.0 + * @param aEnv The current UI environment + * @return Resource file offset + */ + static TInt InitResourcesL( CEikonEnv& aEnv ); + + /** + * Frees the given resource in the current UI context + * @since S60 5.0 + * @param aEnv The current UI environment + * @param aResOffset The resource to release + */ + static void ReleaseResources( CEikonEnv& aEnv, TInt aResOffset ); + + + private: // data + /** + * Reference to the Eikon environment (not owned) + */ + CEikonEnv& iEnv; + + /** + * Password for the current network (owned) + */ + HBufC* iUsedPassword; + + /** + * In case of WEP networks it indicates whether the password is given + * in hexadecimal format + */ + TBool iIsHexWep; + + /** + * IAP creator object (owned) + */ + CWsfWlanIapCreator* iCreator; + + /** + * Resource file offset + */ + TInt iResourceFileOffset; + + /** + * Pointer to the wlaninfo of the current network (not owned) + */ + TWsfWlanInfo* iWlanInfo; + + /** + * If ETrue, 'Define access point' was selected + */ + TBool iDefineNewAccessPoint; + + /** + * "Searching WLAN networks" wait dialog (owned) + */ + CAknWaitDialog* iWaitDialog; + + /** + * WLAN discovery object (owned) + */ + CWsfWlanSsidDiscovery* iSsidDiscovery; + + }; + + +#endif // C_WSFWLANIAPWIZARD_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/apwizard/inc/wsfwlanssiddiscovery.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/inc/wsfwlanssiddiscovery.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,157 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfWlanSsidDiscovery +* +*/ + + + +#ifndef C_WSFWLANSSIDDISCOVERY_H +#define C_WSFWLANSSIDDISCOVERY_H + + +// EXTERNAL INCLUDES +#include +#include + + +// FORWARD DECLARATIONS +class CWlanMgmtClient; +class CWlanScanInfo; + + +// CLASS DEFINITION +/** +* Class to carry out WLAN SSID discovery +* +* @since S60 5.0 +* @lib wsfapwizard.lib +*/ +NONSHARABLE_CLASS( CWsfWlanSsidDiscovery ): public CActive + { + /** + * States of the WLAN discovery + */ + enum TWsfWlanDiscoveryState + { + /** + * Scanning has been started + */ + EScanning, + + /** + * Scanning finished + */ + EDone, + + /** + * Scanning was aborted + */ + EAborted + }; + + + public: + /** + * Factory function. + * @since S60 5.0 + * @return Class instance + */ + static CWsfWlanSsidDiscovery* NewL(); + + /** + * Destructor + * @since S60 5.0 + */ + ~CWsfWlanSsidDiscovery(); + + + private: + /** + * Constructor + * @since S60 5.0 + */ + CWsfWlanSsidDiscovery(); + + /** + * Second-phase constructor + * @since S60 5.0 + */ + void ConstructL(); + + + public: // new methods + /** + * Executes a direct/broadcast scan + * @since S60 5.0 + * @param aSsid The SSID to look for in case of direct scan + * @param aBroadcast If set to ETrue, does a broadcast scan, + * otherwise direct + * @param aNetworkMode Network mode for the found network + * @param aSecurityMode Security mode for the found network + * @param aUsesPsk ETrue if the found network uses PSK in WPA mode + * @return ETrue if the scan was successful, otherwise EFalse + */ + TBool ScanForSsidL( TWlanSsid& aSsid, + TBool aBroadcast, + CMManager::TWlanNetMode& aNetworkMode, + CMManager::TWlanSecMode& aSecurityMode, + TBool& aUsesPsk ); + + /** + * Aborts the scanning process + * @since S60 5.0 + */ + void AbortScanning(); + + + private: // from CActive + + /** + * Implements cancellation of an outstanding request. + * @since S60 5.0 + */ + void DoCancel(); + + /** + * Handles an active object's request completion event. + * @since S60 5.0 + */ + void RunL(); + + + private: // data + /** + * Progress state + */ + TUint32 iProgState; + + /** + * Nested waitloop + */ + CActiveSchedulerWait iWait; + + /** + * Wlan management client interface (owned) + */ + CWlanMgmtClient* iWlanMgmt; + + /** + * Scan info object (owned) + */ + CWlanScanInfo* iScanInfo; + }; + + +#endif // C_WSFWLANSSIDDISCOVERY_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/apwizard/loc/wsfapwizard.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/loc/wsfapwizard.loc Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 strings for project AP Wizard +* +*/ + + +//d: Query to make sure the user wants to create an IAP for the given WLAN network +//l: popup_note_window +//r:3.0 +// +#define qtn_cmon_quest_create_wlan_iap "Create internet access point for WLAN network '%U'?" + +//d: An information note with the text is shown if access point creation succeed +//d: %U = Name of the access point which was created. +//l: popup_note_window +//r:3.0 +// +#define qtn_cmon_conf_wlan_iap_created "Internet access point defined for WLAN network '%U'" + + + +//------------------------------------------------------------------------------ +// Following string are defined on networking specification * +//------------------------------------------------------------------------------ + + +//d: A data query prompt text +//d: copied from S60: qtn_wlan_prmpt_network_name +//l: popup_query_data_window +//r:3.0 +// +#define qtn_wlan_prmpt_network_name "WLAN network name:" + + + +//d: Title of the Network mode dialog +//d: in the manual configuration of a new WLAN connection method +//l: heading_pane_t1 +//w: +//r:3.2 +// +#define qtn_netw_conset_prmpt_wlan_nw_mode_and_status "Network mode and status:" + +//d:Network mode selection list, sets the network mode setting +//d:to 'infrastructure' and network status to 'Public' +//l:list_single_pane_t1_cp2 +//w: +//r:3.2 +// +#define qtn_wlan_network_mode_infra_public "Infrastructure (public)" + +//d:Network mode selection list, sets the network mode setting +//d:to 'infrastructure' and network status to 'hidden' +//l:list_single_pane_t1_cp2 +//w: +//r:3.2 +// +#define qtn_wlan_network_mode_infra_hidden "Infrastructure (hidden)" + +//d:Network mode selection list, sets the network mode setting +//d:to 'Ad-hoc' and network status to 'Public' +//l:list_single_pane_t1_cp2 +//w: +//r:3.2 +// +#define qtn_wlan_network_mode_adhoc_public "Ad-hoc (public)" + +//d: Title of the Security Mode selection dialog +//d: in the manual configuration of a new WLAN connection method +//l: heading_pane_t1 +//w: +//r:3.2 +// +#define qtn_netw_conset_prmpt_wlan_nw_security_mode "Security Mode:" + +//d:Default value for WLAN security mode +//l:list_single_pane_t1_cp2 +//w: +//r:3.2 +// +#define qtn_netw_conset_wlan_security_mode_open "Open network" + +//d:Security settings mode "WEP" +//l:list_single_pane_t1_cp2 +//w: +//r:3.2 +// +#define qtn_netw_conset_wlan_security_mode_wep "WEP" + +//d:Security settings mode "802.1x" +//l:list_single_pane_t1_cp2 +//w: +//r:3.2 +// +#define qtn_netw_conset_wlan_security_mode_802_1x "802.1x" + +//d:Security settings mode "WPA/WPA2" +//l:list_single_pane_t1_cp2 +//w: +//r:3.2 +// +#define qtn_netw_conset_wlan_security_mode_wpa "WPA/WPA2" + + + +//d: Title of the WPA/WPA2 mode selection dialog in the manual +//d: configuration of a new WLAN connection method +//l: heading_pane_t1 +//w: +//r:3.2 +// +#define qtn_netw_conset_prmpt_wlan_wpa_mode "WPA/WPA2 mode:" + +//d:EAP item in the WPA/WPA2 mode selection dialog +//l:list_single_pane_t1_cp2 +//w: +//r:3.2 +// +#define qtn_netw_conset_prmpt_wpa_mode_eap "EAP" + +//d:Pre-shared item item in the WPA/WPA2 mode selection dialog +//l:list_single_pane_t1_cp2 +//w: +//r:3.2 +// +#define qtn_netw_conset_prmpt_wpa_mode_psk "Pre-shared key" + +//d: Note to indicate to user that the default EAP values have +//d: been set and advanced values can be edited in the +//d: security settings of the connection method +//l: popup_note_window +//w: +//r:3.2 +// +#define qtn_netw_conset_info_eap_settings_default "Default EAP values set. Configure advanced settings by editing the method." + +//d: Text of an information note used to ensure the user the a new connection +//d: method has been added successfully. +//l: popup_note_window +//w: +//r: 5.0 +// +#define qtn_netw_conset_conf_new_method_added "New connection method for '%U' added" + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/apwizard/rom/wsfapwizard.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/rom/wsfapwizard.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 ApWizard +* +*/ + + + + + +#ifndef WSFAPWIZARD_IBY +#define WSFAPWIZARD_IBY + +#ifdef __PROTOCOL_WLAN + +REM WlanSnifferApWizard + +#include + +file=ABI_DIR\BUILD_DIR\wsfapwizard.dll SHARED_LIB_DIR\wsfapwizard.dll + +#endif // __PROTOCOL_WLAN + +#endif // WSFAPWIZARD_IBY diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/apwizard/rom/wsfapwizardresources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/rom/wsfapwizardresources.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 ApWizard +* +*/ + + + + +#ifndef WSFAPWIZARDRESOURCES_IBY +#define WSFAPWIZARDRESOURCES_IBY + +#ifdef __PROTOCOL_WLAN + +REM WlanSnifferApWizardResources + +#include + +data=DATAZ_\RESOURCE_FILES_DIR\wsfapwizard.rsc RESOURCE_FILES_DIR\wsfapwizard.rsc + +#endif // __PROTOCOL_WLAN + +#endif // WSFAPWIZARDRESOURCES_IBY diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/apwizard/src/wsfactivewaiter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/src/wsfactivewaiter.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfActiveWaiter +* +*/ + + + +// INCLUDE FILES +#include "wsfactivewaiter.h" +#include "wsflogger.h" + + + +// --------------------------------------------------------- +// CWsfActiveWaiter* CWsfActiveWaiter::NewL +// --------------------------------------------------------- +// +CWsfActiveWaiter* CWsfActiveWaiter::NewL() + { + CWsfActiveWaiter* self = NewLC(); + CleanupStack::Pop( self ); + + return self; + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter* CWsfActiveWaiter::NewLC +// --------------------------------------------------------- +// +CWsfActiveWaiter* CWsfActiveWaiter::NewLC() + { + CWsfActiveWaiter* self = new ( ELeave ) CWsfActiveWaiter(); + CleanupStack::PushL( self ); + return self; + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::CWsfActiveWaiter +// --------------------------------------------------------- +// +CWsfActiveWaiter::CWsfActiveWaiter(): + CActive( CActive::EPriorityStandard ) + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::~CWsfActiveWaiter +// --------------------------------------------------------- +// +CWsfActiveWaiter::~CWsfActiveWaiter() + { + Cancel(); + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::DoCancel +// --------------------------------------------------------- +// +void CWsfActiveWaiter::DoCancel() + { + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::RunL +// --------------------------------------------------------- +// +void CWsfActiveWaiter::RunL() + { + LOG_ENTERFN( "CWsfActiveWaiter::RunL" ); + if ( iWait.IsStarted() ) + { + LOG_WRITE("async call completed, resuming."); + iWait.AsyncStop(); + } + } + +// --------------------------------------------------------- +// CWsfActiveWaiter::WaitForRequest +// --------------------------------------------------------- +// +TInt CWsfActiveWaiter::WaitForRequest() + { + LOG_ENTERFN("CWsfActiveWaiter::WaitForRequest"); + SetActive(); + iWait.Start(); + + return iStatus.Int(); + } + +// End of File + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/apwizard/src/wsfwlaniapcreator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/src/wsfwlaniapcreator.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,609 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfWlanIapCreator +* +*/ + + + + +// EXTERNAL INCLUDES +#include +#include +#include +#include + +// CLASS HEADER +#include "wsfwlaniapcreator.h" + +// INTERNAL INCLUDES +#include "wsfactivewaiter.h" +#include "wsflogger.h" + + +using namespace CMManager; + + +/** +* Order of first WEP key +*/ +static const TInt KFirstWepKey = 0; + +/** +* WEP authentication modes +*/ +static const TInt KWepAuthOpen = 0; // Open authentication + +/** +* Max length of WPA key +*/ +static const TUint KWpaKeyMaxLength = 64; + +/** +* Max length of WEP key +*/ +static const TUint KMaxWepKeyLen = 26; + + + + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapCreator::NewL +// ---------------------------------------------------------------------------- +// +CWsfWlanIapCreator* CWsfWlanIapCreator::NewL() + { + CWsfWlanIapCreator* thisPtr = NewLC(); + CleanupStack::Pop( thisPtr ); + return thisPtr; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapCreator::NewLC +// ---------------------------------------------------------------------------- +// +CWsfWlanIapCreator* CWsfWlanIapCreator::NewLC() + { + CWsfWlanIapCreator* thisPtr = new (ELeave) CWsfWlanIapCreator(); + CleanupStack::PushL( thisPtr ); + thisPtr->ConstructL(); + return thisPtr; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapCreator::~CWsfWlanIapCreator +// ---------------------------------------------------------------------------- +// +CWsfWlanIapCreator::~CWsfWlanIapCreator() + { + delete iDbSession; + iCmManagerExt.Close(); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapCreator::CWsfWlanIapCreator +// ---------------------------------------------------------------------------- +// +CWsfWlanIapCreator::CWsfWlanIapCreator() + { + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapCreator::ConstructL +// ---------------------------------------------------------------------------- +// +void CWsfWlanIapCreator::ConstructL() + { + iDbSession = CommsDat::CMDBSession::NewL( CMDBSession::LatestVersion() ); + iCmManagerExt.OpenL(); + iDestinationId = 0; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapCreator::StoreWPADataL +// ---------------------------------------------------------------------------- +// +void CWsfWlanIapCreator::StoreWPADataL( const TInt aIapId, + const TDesC& aPresharedKey, + const CMManager::TWlanSecMode aSecMode ) + { + LOG_ENTERFN( "CWsfWlanIapCreator::StoreWPADataL" ); + + CCDIAPRecord *iapRec = static_cast + ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) ); + + CleanupStack::PushL( iapRec ); + + iapRec->SetRecordId( aIapId ); + iapRec->LoadL( *iDbSession ); + + TUint32 serviceId = TUint32( iapRec->iService ); + + LOG_WRITEF("IAP(%d).serviceID = %d", aIapId, serviceId ); + + // we have the service id, now we can flush the iap record + CleanupStack::PopAndDestroy( iapRec ); + + // search for the record + CMDBGenericRecord* generic = static_cast( + CCDRecordBase::RecordFactoryL( 0 ) ); + CleanupStack::PushL( generic ); + generic->InitializeL( TPtrC( WLAN_SERVICE ), NULL ); + generic->LoadL( *iDbSession ); + + CMDBField* sidField = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanServiceId ) ); + + // prime with service id + *sidField = serviceId; + + TBool found = generic->FindL( *iDbSession ); + + LOG_WRITE( "saving common WPA settings..." ); + TBool usesPsk( aPresharedKey.Length() > 0 ); + + // Save PreShared Key as 8 bit string + TBuf8 keyWPA; + keyWPA.Copy( aPresharedKey ); + TInt len( keyWPA.Length() ); + LOG_WRITEF( "PSK:[%S] len = %d", &aPresharedKey, len ); + + + CMDBField* enableWpaPskField = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanEnableWpaPsk ) ); + enableWpaPskField->SetL( usesPsk ); + + CMDBField* secModeField = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanSecMode ) ); + secModeField->SetL( aSecMode ); + + CMDBField* wpaPskField = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanWpaPreSharedKey ) ); + wpaPskField->SetL( keyWPA ); + + // Save PreShared Key length + CMDBField* keyLengthField = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanWpaKeyLength ) ); + keyLengthField->SetL( keyWPA.Length() ); + + + if ( !usesPsk ) + { + // not PSK -> must be EAP + LOG_WRITE( "saving EAP info..." ); + RImplInfoPtrArray eapArray; + REComSession::ListImplementationsL( KEapTypeInterfaceUid, eapArray ); + CleanupClosePushL( eapArray ); + + for ( TInt i = 0; i < eapArray.Count(); ++i ) + { + // IsDisallowedOutsidePEAP actually means IsDisallowedOutsideTunnel + if ( !CEapType::IsDisallowedOutsidePEAP( *eapArray[i] ) ) + { + CEapType* eapType = CEapType::NewL( eapArray[i]->DataType(), + ELan, + serviceId ); + CleanupStack::PushL( eapType ); + + eapType->SetIndexL( ELan, serviceId ); + CleanupStack::PopAndDestroy( eapType ); + } + } + + eapArray.ResetAndDestroy(); + CleanupStack::PopAndDestroy( &eapArray ); + } + + if ( !found ) + { + // there wasn't any wlan service record, we have to create it now + LOG_WRITE("new service record"); + generic->SetRecordId( KCDNewRecordRequest ); + generic->StoreL( *iDbSession ); + } + else + { + // modify existing record + LOG_WRITE("existing service record"); + generic->ModifyL( *iDbSession ); + } + + CleanupStack::PopAndDestroy( generic ); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapCreator::StoreWEPDataL +// ---------------------------------------------------------------------------- +// +void CWsfWlanIapCreator::StoreWEPDataL( const TInt aIapId, + const TDesC& aWepKey, + const TBool aIsHexWep ) + { + LOG_ENTERFN( "CWsfWlanIapCreator::StoreWEPDataL" ); + + CCDIAPRecord *iapRec = static_cast + ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) ); + + CleanupStack::PushL( iapRec ); + + iapRec->SetRecordId( aIapId ); + iapRec->LoadL( *iDbSession ); + + TUint32 serviceId = TUint32( iapRec->iService ); + LOG_WRITEF("IAP(%d).serviceID = %d", aIapId, serviceId ); + + CleanupStack::PopAndDestroy( iapRec ); + + + CMDBGenericRecord* generic = static_cast + ( CCDRecordBase::RecordFactoryL( 0 ) ); + CleanupStack::PushL( generic ); + generic->InitializeL( TPtrC( WLAN_SERVICE ), NULL ); + generic->LoadL( *iDbSession ); + + CMDBField* sidField = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanServiceId ) ); + + // prime with service id + *sidField = serviceId; + + TBool found = generic->FindL( *iDbSession ); + + LOG_WRITE( "saving WEP settings..." ); + + + CMDBField* indexField = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanWepIndex ) ); + indexField->SetL( KFirstWepKey ); + + // Save authentication mode + CMDBField* authenticationField = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanAuthMode ) ); + authenticationField->SetL( KWepAuthOpen ); + + + + // now we need to convert the key to 8bit and to hex + // and again detect the required bits + TBuf8 key; + + // convert to 8 bit + key.Copy( aWepKey ); + + + if ( !aIsHexWep ) + { + // Must be converted to hexa and stored as a hexa + // Ascii key is half the length of Hex + HBufC8* buf8Conv = HBufC8::NewLC( key.Length()*2 ); + TPtr8 bufptr( buf8Conv->Des() ); + ConvertAsciiToHex( key, bufptr ); + + CMDBField* wepKey1Field = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanWepKey1 ) ); + wepKey1Field->SetL( buf8Conv->Des() ); + + CleanupStack::PopAndDestroy( buf8Conv ); + } + else + { + // already in hexa format + CMDBField* wepKey1Field = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanWepKey1 ) ); + wepKey1Field->SetL( key ); + } + + + // write default values to the rest of the columns + key.Zero(); + + CMDBField* wepKey2Field = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanWepKey2 ) ); + wepKey2Field->SetL( key ); + CMDBField* wepKey3Field = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanWepKey3 ) ); + wepKey3Field->SetL( key ); + CMDBField* wepKey4Field = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanWepKey4 ) ); + wepKey4Field->SetL( key ); + + + // write format data + TUint fmt( aIsHexWep ); + + CMDBField* formatKey1Field = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanFormatKey1 ) ); + formatKey1Field->SetL( fmt ); + CMDBField* formatKey2Field = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanFormatKey2 ) ); + formatKey2Field->SetL( fmt ); + CMDBField* formatKey3Field = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanFormatKey3 ) ); + formatKey3Field->SetL( fmt ); + CMDBField* formatKey4Field = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanFormatKey4 ) ); + formatKey4Field->SetL( fmt ); + + + if ( !found ) + { + // there wasn't any wlan service record, we have to create it now + LOG_WRITE("new service record"); + generic->SetRecordId( KCDNewRecordRequest ); + generic->StoreL( *iDbSession ); + } + else + { + // modify existing record + LOG_WRITE("existing service record"); + generic->ModifyL( *iDbSession ); + } + + CleanupStack::PopAndDestroy( generic ); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapCreator::ConvertAsciiToHex +// ---------------------------------------------------------------------------- +// +void CWsfWlanIapCreator::ConvertAsciiToHex( const TDesC8& aSource, + TDes8& aDest ) + { + LOG_ENTERFN( "CWsfWlanIapCreator::ConvertAsciiToHex" ); + _LIT8( hex, "0123456789ABCDEF" ); + TInt size = aSource.Size(); + aDest.Zero(); + + for ( TInt ii = 0; ii < size; ii++ ) + { + TText8 ch = aSource[ii]; + aDest.Append( hex()[(ch/16)&0x0f] ); + aDest.Append( hex()[ch&0x0f] ); + } + } + + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapCreator::SetDefaultDestination +// ---------------------------------------------------------------------------- +// +void CWsfWlanIapCreator::SetDefaultDestination( const TUint32 aDestinationId ) + { + LOG_ENTERFN( "CWsfWlanIapCreator::SetDefaultDestination" ); + LOG_WRITEF( "destId = %d", aDestinationId ); + iDestinationId = aDestinationId; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapCreator::CreateAccessPointL +// ---------------------------------------------------------------------------- +// +void CWsfWlanIapCreator::CreateAccessPointL( TWsfWlanInfo& aWlanInfo, + const TDesC& aPresharedKey, + const TBool aIsHex ) + { + LOG_ENTERFN( "CWsfWlanIapCreator::CreateAccessPointL" ); + TUint32 iapId( 0 ); + + // create connection method + iapId = CreateConnectionMethodL( aWlanInfo ); + + + // open a transaction + const TUint KMaxOpenTransAttempts = 10; + const TUint KRetryAfter = 100000; + + TInt err( KErrNone ); + TUint attempts( KMaxOpenTransAttempts ); + + CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewLC(); + RTimer timer; + timer.CreateLocal(); + CleanupClosePushL( timer ); + + do + { + TRAP( err, iDbSession->OpenTransactionL() ); + if ( err ) + { + timer.After( waiter->iStatus, + TTimeIntervalMicroSeconds32( KRetryAfter ) ); + waiter->WaitForRequest(); + } + } + while ( err && attempts-- ); + + User::LeaveIfError( err ); + + CleanupStack::PopAndDestroy( &timer ); + CleanupStack::PopAndDestroy( waiter ); + + CleanupStack::PushL( TCleanupItem( RollbackCommsDat, iDbSession ) ); + + + // now we have a valid transaction, save security settings + + switch ( aWlanInfo.iSecurityMode ) + { + case EWlanSecModeWep: + { + StoreWEPDataL( iapId, aPresharedKey, aIsHex ); + break; + } + case EWlanSecMode802_1x: + case EWlanSecModeWpa: + case EWlanSecModeWpa2: + { + StoreWPADataL( iapId, aPresharedKey, aWlanInfo.iSecurityMode ); + break; + } + case EWlanSecModeOpen: // fall through on purpose + default: + { + } + } + + CleanupStack::Pop( 1 ); // transaction rollback popped + + // commit changes + if ( iDbSession->IsInTransaction() ) + { + iDbSession->CommitTransactionL(); + } + + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapCreator::RollbackCommsDat +// ---------------------------------------------------------------------------- +void CWsfWlanIapCreator::RollbackCommsDat( TAny* aDbSession ) + { + CommsDat::CMDBSession* session = static_cast( + aDbSession ); + TRAP_IGNORE( session->RollbackTransactionL() ); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapCreator::CreateConnectionMethodL +// ---------------------------------------------------------------------------- +// +TUint32 CWsfWlanIapCreator::CreateConnectionMethodL( TWsfWlanInfo& aWlanInfo ) + { + LOG_ENTERFN( "CWsfWlanIapCreator::CreateConnectionMethodL" ); + + HBufC* name16 = NULL; + HBufC* ssid16 = NULL; + + if ( aWlanInfo.iRawSsid.Length() ) + { + // ssid is from scan result store it as it is + // since the encoding of ssid is unknown + name16 = HBufC::NewLC( aWlanInfo.iRawSsid.Length() ); + name16->Des().Copy( aWlanInfo.iRawSsid ); + ssid16 = HBufC::NewLC( aWlanInfo.iRawSsid.Length() ); + ssid16->Des().Copy( aWlanInfo.iRawSsid ); + } + else + { + // user has inputted ssid store it to name as unicode since it is utf-8 + name16 = aWlanInfo.GetSsidAsUnicodeLC(); + ssid16 = HBufC::NewLC( aWlanInfo.iSsid.Length() ); + ssid16->Des().Copy( aWlanInfo.iSsid ); + } + + TUint32 iapId( 0 ); + + if ( !iDestinationId ) + { + // possibly temporary iap to uncategorized + LOG_WRITE( "destId not set -> temporary into Uncategorised" ); + + RCmConnectionMethodExt cm = iCmManagerExt.CreateConnectionMethodL( + KUidWlanBearerType ); + CleanupClosePushL( cm ); + + cm.SetStringAttributeL( ECmName, *name16 ); + cm.SetStringAttributeL( EWlanSSID, *ssid16 ); + cm.SetIntAttributeL( EWlanSecurityMode, aWlanInfo.iSecurityMode ); + cm.SetIntAttributeL( EWlanConnectionMode, aWlanInfo.iNetMode ); + cm.SetBoolAttributeL( EWlanScanSSID, !aWlanInfo.iVisibility ); + + // commit changes + cm.UpdateL(); + + // get the iap id + iapId = cm.GetIntAttributeL( ECmId ); + + // now retrieve the name again to see if it has been changed + // (ExistingCmName -> ExistingCmName(01) and alike) + HBufC* cmName = cm.GetStringAttributeL( ECmName ); + + TInt error = CnvUtfConverter::ConvertFromUnicodeToUtf8( + aWlanInfo.iNetworkName, + *cmName ); + if ( error ) + { + LOG_WRITE( "ConvertFromUnicodeToUtf8 failed"); + aWlanInfo.iNetworkName.Copy( *cmName ); + } + + delete cmName; + + CleanupStack::PopAndDestroy( &cm ); + } + else + { + // final iap to the default destination + LOG_WRITEF( "destId = %d", iDestinationId ); + + RCmDestinationExt destination = iCmManagerExt.DestinationL( + iDestinationId ); + CleanupClosePushL( destination ); + + RCmConnectionMethodExt cm = destination.CreateConnectionMethodL( + KUidWlanBearerType ); + CleanupClosePushL( cm ); + + cm.SetStringAttributeL( ECmName, *name16 ); + cm.SetStringAttributeL( EWlanSSID, *ssid16 ); + cm.SetIntAttributeL( EWlanSecurityMode, aWlanInfo.iSecurityMode ); + cm.SetIntAttributeL( EWlanConnectionMode, aWlanInfo.iNetMode ); + cm.SetBoolAttributeL( EWlanScanSSID, !aWlanInfo.iVisibility ); + + // commit changes + destination.UpdateL(); + + // get the iap id + iapId = cm.GetIntAttributeL( ECmId ); + + // now retrieve the name again to see if it has been changed + // (ExistingCmName -> ExistingCmName(01) and alike) + HBufC* cmName = cm.GetStringAttributeL( ECmName ); + TInt error = CnvUtfConverter::ConvertFromUnicodeToUtf8( + aWlanInfo.iNetworkName, + *cmName ); + if ( error ) + { + LOG_WRITE( "ConvertFromUnicodeToUtf8 failed"); + aWlanInfo.iNetworkName.Copy( *cmName ); + } + + delete cmName; + + CleanupStack::PopAndDestroy( &cm ); + CleanupStack::PopAndDestroy( &destination ); + } + + CleanupStack::PopAndDestroy( ssid16 ); + CleanupStack::PopAndDestroy( name16 ); + + aWlanInfo.iIapId = iapId; + LOG_WRITEF( "new iapId = %d", iapId ); + + return iapId; + } + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/apwizard/src/wsfwlaniapwizard.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/src/wsfwlaniapwizard.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,679 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfWlanIapWizard +* +*/ + + + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// CLASS HEADER +#include "wsfwlaniapwizard.h" + +// INTERNAL INCLUDES +#include "wsfwlaniapcreator.h" +#include "wsfwlanssiddiscovery.h" +#include "wsflogger.h" + + + +using namespace CMManager; + + +/** +* ROM folder +*/ +_LIT( KDriveZ, "z:" ); + +/** +* Resource file name +*/ +_LIT( KResourceFileName, "wsfapwizard.rsc" ); + +/** +* the longest possible key is the 64 character long hex WPA key +*/ +static const TInt KMaxSecureKeyLength = 64; + + + +#ifdef _DEBUG + _LIT( KApWizardPanic, "wsfapwizard" ); + #define __ASSERTD( v ) __ASSERT_DEBUG( (v), \ + User::Panic( KApWizardPanic, 0 ) ) +#else + #define __ASSERTD( v ) +#endif + + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapWizard::NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CWsfWlanIapWizard* CWsfWlanIapWizard::NewL() + { + CWsfWlanIapWizard* thisPtr = NewLC(); + CleanupStack::Pop( thisPtr ); + return thisPtr; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapWizard::NewLC +// ---------------------------------------------------------------------------- +// +EXPORT_C CWsfWlanIapWizard* CWsfWlanIapWizard::NewLC() + { + CWsfWlanIapWizard* thisPtr = new (ELeave) CWsfWlanIapWizard(); + CleanupStack::PushL( thisPtr ); + thisPtr->ConstructL(); + return thisPtr; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapWizard::CWsfWlanIapWizard +// ---------------------------------------------------------------------------- +// +CWsfWlanIapWizard::CWsfWlanIapWizard(): + iEnv( *CEikonEnv::Static() ), + iResourceFileOffset( -1 ), + iWlanInfo( NULL ) + { + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapWizard::ConstructL +// ---------------------------------------------------------------------------- +// +void CWsfWlanIapWizard::ConstructL() + { + iResourceFileOffset = InitResourcesL( iEnv ); + + iCreator = CWsfWlanIapCreator::NewL(); + iSsidDiscovery = CWsfWlanSsidDiscovery::NewL(); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapWizard::~CWsfWlanIapWizard +// ---------------------------------------------------------------------------- +// +EXPORT_C CWsfWlanIapWizard::~CWsfWlanIapWizard() + { + delete iCreator; + + ReleaseResources( iEnv, iResourceFileOffset ); + + delete iUsedPassword; + delete iWaitDialog; + delete iSsidDiscovery; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanIapWizard::InitResourcesL +// --------------------------------------------------------------------------- +// +TInt CWsfWlanIapWizard::InitResourcesL( CEikonEnv& aEnv ) + { + // The resource has to be loaded manually since it is not an application. + TFileName resourceFileName; + + resourceFileName.Append( KDriveZ ); + resourceFileName.Append( KDC_RESOURCE_FILES_DIR ); + resourceFileName.Append( KResourceFileName ); + + BaflUtils::NearestLanguageFile( aEnv.FsSession(), resourceFileName ); + + return aEnv.AddResourceFileL( resourceFileName ); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanIapWizard::ReleaseResources +// --------------------------------------------------------------------------- +// +void CWsfWlanIapWizard::ReleaseResources( CEikonEnv& aEnv, TInt aResOffset ) + { + if ( aResOffset != -1 ) + { + aEnv.DeleteResourceFile( aResOffset ); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapWizard::LaunchWizardL +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CWsfWlanIapWizard::LaunchWizardL( TWsfWlanInfo& aWlanInfo, + TBool aDefineNewAccessPoint ) + { + LOG_ENTERFN( "CWsfWlanIapWizard::LaunchWizardL" ); + LOG_WRITEF( "defineAp = %d", aDefineNewAccessPoint ); + + if ( aDefineNewAccessPoint && + !( aWlanInfo.Hidden() && !aWlanInfo.Known() ) ) + { + HBufC* ssid16 = aWlanInfo.GetSsidAsUnicodeLC(); + LOG_WRITEF( "ssid = %S", ssid16 ); + HBufC* infoText = StringLoader::LoadLC( + R_QTN_CMON_QUEST_CREATE_WLAN_IAP, + *ssid16 ); + + CAknQueryDialog* confirmQuery = CAknQueryDialog::NewL(); + TBool result = confirmQuery->ExecuteLD( + R_QTN_WIZARD_CONFIRMATION_QUERY, + *infoText ); + + CleanupStack::PopAndDestroy( infoText ); + CleanupStack::PopAndDestroy( ssid16 ); + + if ( !result ) + { + return result; + } + } + + iWlanInfo = &aWlanInfo; + iDefineNewAccessPoint = aDefineNewAccessPoint; + + TRAPD( err, AskNetworkDetailsL() ); + if ( err ) + { + // We are here also if selection of + // the hidden network AP leaves or is + // cancelled by the end-user + LOG_WRITE( "AskNetworkDetailsL failed" ); + } + + return ( !err ); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapWizard::CreateAccessPointL +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CWsfWlanIapWizard::CreateAccessPointL() + { + LOG_ENTERFN( "CWsfWlanIapWizard::CreateAccessPointL" ); + __ASSERTD( iWlanInfo ); + + + if ( iWlanInfo->iIapId != 0 ) + { + // Access Point already exists + User::Leave( KErrAlreadyExists ); + } + + + // otherwise new Access Point will be created + if ( !iWlanInfo->iSsid.Length() ) + { + User::Leave( KErrGeneral ); + } + + TPtrC sharedKey = iUsedPassword ? *iUsedPassword : KNullDesC(); + + TUint32 destId( 0 ); + + if ( iDefineNewAccessPoint ) + { + // define access point was selected, select destination query follows + LOG_WRITE( "defineAp = ETrue, opening select destination dialog..." ); + + CCmSettingsUi* settings = CCmSettingsUi::NewL(); + CleanupStack::PushL( settings ); + + TBool result( EFalse ); + result = settings->SelectDestinationDlgL( destId ); + + CleanupStack::PopAndDestroy( settings ); //settings + + if ( !result ) + { + LOG_WRITE( "dialog cancelled" ); + // cancel was pressed, abort creation + return EFalse; + } + LOG_WRITEF( "target destination = %d", destId ); + } + + iCreator->SetDefaultDestination( destId ); + + iCreator->CreateAccessPointL( *iWlanInfo, sharedKey, iIsHexWep ); + + return ETrue; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapWizard::QueryTextL +// ---------------------------------------------------------------------------- +// +TInt CWsfWlanIapWizard::QueryTextL( TInt aQueryStringResource, + TDes& aVariable, + const TInt &aMaxLength ) + { + LOG_ENTERFN( "CWsfWlanIapWizard::QueryTextL" ); + HBufC* queryText = StringLoader::LoadLC( aQueryStringResource ); + CAknTextQueryDialog* textQuery = CAknTextQueryDialog::NewL( aVariable ); + CleanupStack::PushL( textQuery ); + textQuery->SetPromptL( *queryText ); + textQuery->SetMaxLength( aMaxLength ); + CleanupStack::Pop( textQuery ); + TInt result = textQuery->ExecuteLD( R_QTN_WIZARD_QUERY_GENERAL ); + CleanupStack::PopAndDestroy( queryText ); + return result; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapWizard::QuerySecureKeyL +// ---------------------------------------------------------------------------- +// +TBool CWsfWlanIapWizard::QuerySecureKeyL() + { + LOG_ENTERFN( "CWsfWlanIapWizard::QuerySecureKeyL" ); + TBool okPressed( ETrue ); + + switch ( iWlanInfo->iSecurityMode ) + { + case EWlanSecModeWep: + { + LOG_WRITE( "secmode WEP" ); + CConnectionUiUtilities* connUiUtils = + CConnectionUiUtilities::NewL(); + CleanupStack::PushL( connUiUtils ); + iUsedPassword = HBufC::NewL( KMaxSecureKeyLength ); + TPtr ptr( iUsedPassword->Des() ); + okPressed = connUiUtils->EasyWepDlg( &ptr, iIsHexWep ); + CleanupStack::PopAndDestroy( connUiUtils ); + break; + } + + case EWlanSecModeWpa: + case EWlanSecModeWpa2: + case EWlanSecMode802_1x: + { + if ( iWlanInfo->UsesPreSharedKey() ) + { + // WPA-PSK + LOG_WRITE( "secmode WPA-PSK" ); + + CConnectionUiUtilities* connUiUtils = + CConnectionUiUtilities::NewL(); + CleanupStack::PushL( connUiUtils ); + iUsedPassword = HBufC::NewL( KMaxSecureKeyLength ); + TPtr ptr( iUsedPassword->Des() ); + okPressed = connUiUtils->EasyWpaDlg( &ptr ); + CleanupStack::PopAndDestroy( connUiUtils ); + } + else + { + // no key prompt in EAP mode, but the usual note is shown + LOG_WRITE( "secmode WPA-EAP" ); + + HBufC* eapText = StringLoader::LoadLC( + R_QTN_NETW_CONSET_INFO_EAP_SETTINGS_DEFAULT ); + CAknInformationNote* informationNote = + new (ELeave) CAknInformationNote( ETrue ); + informationNote->ExecuteLD( *eapText ); + + CleanupStack::PopAndDestroy( eapText ); + } + + break; + } + + case EWlanSecModeOpen: + default: + { + LOG_WRITE( "secmode Open" ); + + delete iUsedPassword; + iUsedPassword = NULL; + } + } + + return okPressed; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapWizard::DismissWaitNote +// ---------------------------------------------------------------------------- +// +void CWsfWlanIapWizard::DismissWaitNote( TAny* aPtr ) + { + LOG_ENTERFN( "CWsfWlanIapWizard::DismissWaitNote" ); + CWsfWlanIapWizard* self = static_cast( aPtr ); + + if ( self->iWaitDialog ) + { + // close waitnote + LOG_WRITE( "closing waitnote..." ); + TRAP_IGNORE( self->iWaitDialog->ProcessFinishedL() ); + + // cleanup + delete self->iWaitDialog; + self->iWaitDialog = NULL; + } + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapWizard::AskNetworkDetailsL +// ---------------------------------------------------------------------------- +// +void CWsfWlanIapWizard::AskNetworkDetailsL() + { + LOG_ENTERFN( "CWsfWlanIapWizard::AskNetworkDetailsL" ); + + + // check the wlan info, and make proper questions.... + if ( iWlanInfo->Hidden() && !iWlanInfo->Known() ) + { + LOG_WRITE( "unlisted network" ); + + // query network SSID + HBufC* ssid16 = AskSsidL(); + LOG_WRITEF( "SSID: [%S]", ssid16 ); + + // update SSID + CnvUtfConverter::ConvertFromUnicodeToUtf8( iWlanInfo->iSsid, *ssid16 ); + delete ssid16; + + // pop up waitnote + iWaitDialog = new ( ELeave ) CAknWaitDialog( + reinterpret_cast( &iWaitDialog ), ETrue ); + iWaitDialog->SetCallback( this ); + iWaitDialog->ExecuteLD( R_SEARCHING_WLAN_WAIT_NOTE ); + + CleanupStack::PushL( TCleanupItem( DismissWaitNote, this ) ); + + // start to scan for surrounding WLAN networks + TBool foundSsid( EFalse ); + TBool usePsk( EFalse ); + TWlanSsid ssid( iWlanInfo->iSsid ); + + // make a broadcast scan + LOG_WRITE( "broadcast scanning for SSID" ); + foundSsid = iSsidDiscovery->ScanForSsidL( ssid, ETrue, + iWlanInfo->iNetMode, + iWlanInfo->iSecurityMode, + usePsk ); + + // SSID found? + if ( !foundSsid ) + { + // must be really hidden, direct scan for SSID + LOG_WRITE( "broadcast scan failed, direct scanning for SSID" ); + foundSsid = iSsidDiscovery->ScanForSsidL( ssid, EFalse, + iWlanInfo->iNetMode, + iWlanInfo->iSecurityMode, + usePsk ); + + // it can only be found as hidden + iWlanInfo->iVisibility = EFalse; + + CleanupStack::PopAndDestroy( 1 ); // DismissWaitNote + + if ( !foundSsid ) + { + LOG_WRITE( "direct scan failed, entering fully manual mode" ); + + // pop up discreet popup: No WLANs found + CConnectionUiUtilities* connUiUtils = CConnectionUiUtilities::NewL(); + connUiUtils->NoWLANNetworksAvailableNote(); + delete connUiUtils; + + // now entering fully manual mode + + // query network mode + TInt mode( 0 ); + CAknListQueryDialog* listQuery = + new (ELeave) CAknListQueryDialog( &mode ); + listQuery->PrepareLC( R_QTN_WIZARD_NETWORK_MODE ); + TInt retval = listQuery->RunLD(); + if ( !retval ) + { + User::Leave( KErrCancel ); + } + + const TInt KModeInfraPublic = 0; + const TInt KModeInfraHidden = 1; + const TInt KModeAdhocPublic = 2; + + TBool adhoc( EFalse ); + + switch ( mode ) + { + case KModeInfraPublic: + { + LOG_WRITE( "infra public mode" ); + iWlanInfo->iNetMode = EInfra; + iWlanInfo->iVisibility = ETrue; + break; + } + + case KModeInfraHidden: + { + LOG_WRITE( "infra hidden mode" ); + iWlanInfo->iNetMode = EInfra; + iWlanInfo->iVisibility = EFalse; + break; + } + + case KModeAdhocPublic: + { + LOG_WRITE( "adhoc public mode" ); + adhoc = ETrue; + iWlanInfo->iNetMode = EAdhoc; + iWlanInfo->iVisibility = ETrue; + break; + } + } + + + // query security mode + const TInt KSecModeOpen = 0; + const TInt KSecModeWep = 1; + const TInt KSecMode8021x = 2; + const TInt KSecModeWpa = 3; + + mode = KSecModeOpen; + listQuery = new (ELeave) CAknListQueryDialog( &mode ); + + if ( adhoc ) + { + listQuery->PrepareLC( R_QTN_WIZARD_AUTH_MODE_AD_HOC ); + } + else + { + listQuery->PrepareLC( R_QTN_WIZARD_AUTH_MODE ); + } + + retval = listQuery->RunLD(); + + if ( !retval ) + { + User::Leave( KErrCancel ); + } + + // map the security mode + + switch ( mode ) + { + case KSecModeWep: + { + LOG_WRITE( "security: WEP" ); + iWlanInfo->iSecurityMode = EWlanSecModeWep; + break; + } + case KSecMode8021x: + { + LOG_WRITE( "security: 802.1x" ); + iWlanInfo->iSecurityMode = EWlanSecMode802_1x; + break; + } + case KSecModeWpa: + { + LOG_WRITE( "security: WPA" ); + iWlanInfo->iSecurityMode = EWlanSecModeWpa; + break; + } + + case KSecModeOpen: + default: + { + LOG_WRITE( "security: Open" ); + iWlanInfo->iSecurityMode = EWlanSecModeOpen; + } + } + + // if WPA, query WPA mode + if ( iWlanInfo->iSecurityMode == EWlanSecModeWpa ) + { + const TInt KWpaModeEap = 0; + const TInt KWpaModePsk = 1; + + mode = KWpaModeEap; + listQuery = new (ELeave) CAknListQueryDialog( &mode ); + listQuery->PrepareLC( R_QTN_WIZARD_WPA_MODE ); + retval = listQuery->RunLD(); + if ( !retval ) + { + User::Leave( KErrCancel ); + } + + // 0 - EAP, 1 - PSK + + usePsk = ( mode == KWpaModePsk ); + if ( usePsk ) + { + LOG_WRITE( "WPA-PSK" ); + } + else + { + LOG_WRITE( "WPA-EAP" ); + } + } + + } // if !foundssid (direct) + + + } // if !foundssid (broadcast) + else + { + // it was thought to be hidden but actually it isn't + LOG_WRITE( "broadcast scan succeeded, " + L"network isn't hidden as it was thought" ); + LOG_WRITEF( "netmode: %d, secmode: %d, usepsk: %d", + iWlanInfo->iNetMode, + iWlanInfo->iSecurityMode, + usePsk ); + + CleanupStack::PopAndDestroy( 1 ); // DismissWaitNote + + // set WLAN to public + iWlanInfo->iVisibility = ETrue; + } + + // convey PSK settings to iwlaninfo + // (netmode and secmode are already updated) + iWlanInfo->SetUsesPreSharedKey( usePsk ); + + } + else + { + // if NOT hidden + LOG_WRITE( "visible network" ); + LOG_WRITEF( "netmode: %d, secmode: %d, usepsk: %d", + iWlanInfo->iNetMode, + iWlanInfo->iSecurityMode, + iWlanInfo->UsesPreSharedKey() ); + } + + // query the key and leave if cancelled + if ( !QuerySecureKeyL() ) + { + User::Leave( KErrCancel ); + } + + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapWizard::AskSsidL +// ---------------------------------------------------------------------------- +// +HBufC* CWsfWlanIapWizard::AskSsidL() + { + LOG_ENTERFN( "CWsfWlanIapWizard::AskSsidL" ); + + HBufC* apName = HBufC::NewLC( KWlanMaxSsidLength ); + TPtr namePtr( apName->Des() ); + if ( iWlanInfo->iSsid.Length() ) + { + CnvUtfConverter::ConvertToUnicodeFromUtf8( namePtr, iWlanInfo->iSsid ); + } + TInt response = QueryTextL( R_QTN_ENTER_NETWORK_SSID, + namePtr, + KWlanMaxSsidLength ); + if ( response != EEikBidOk ) + { + User::Leave( KErrCancel ); + } + + CleanupStack::Pop( apName ); + return apName; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanIapWizard::DialogDismissedL +// ---------------------------------------------------------------------------- +// +void CWsfWlanIapWizard::DialogDismissedL( TInt aButtonId ) + { + LOG_ENTERFN( "CWsfWlanIapWizard::DialogDismissedL" ); + iWaitDialog = NULL; + + if ( aButtonId == EEikBidCancel ) + { + // dialog was cancelled by the user + LOG_WRITE( "dialog was cancelled" ); + iSsidDiscovery->AbortScanning(); + } + } + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/apwizard/src/wsfwlanssiddiscovery.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/src/wsfwlanssiddiscovery.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,323 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 WLAN SSID discovery class +* +*/ + + + +// EXTERNAL INCLUDES +#include +#include + +// CLASS HEADER +#include "wsfwlanssiddiscovery.h" + +// INTERNAL INCLUDES +#include "wsflogger.h" + + +using namespace CMManager; + + +/** +* Management frame information element IDs. +* needed to determine SSID +* (from \S60\osext\wlan\wlanldd\wlan_common\umac_common\inc\802dot11.h) +*/ +enum TWsf802Dot11InformationElementID + { + E802Dot11SsidIE = 0, + E802Dot11SupportedRatesIE = 1, + E802Dot11FhParameterSetIE = 2, + E802Dot11DsParameterSetIE = 3, + E802Dot11CfParameterSetIE = 4, + E802Dot11TimIE = 5, + E802Dot11IbssParameterSetIE = 6, + E802Dot11CountryIE = 7, + E802Dot11HoppingPatternParamIE = 8, + E802Dot11HoppingPatternTableIE = 9, + E802Dot11RequestIE = 10, + + E802Dot11ChallengeTextIE = 16, + // Reserved for challenge text extension 17 - 31 + E802Dot11ErpInformationIE = 42, + E802Dot11ExtendedRatesIE = 50, + E802Dot11AironetIE = 133, + E802Dot11ApIpAddressIE = 149, + E802Dot11RsnIE = 221 + }; + + +/** +* Bit masks for Capability Information field. +* (from \S60\osext\wlan\wlanldd\wlan_common\umac_common\inc\802dot11.h) +*/ +enum TWsf802Dot11CapabilityBitMask + { + E802Dot11CapabilityEssMask = 0x0001, + E802Dot11CapabilityIbssMask = 0x0002, + E802Dot11CapabilityCfPollableMask = 0x0004, + E802Dot11CapabilityCfPollRequestMask= 0x0008, + E802Dot11CapabilityPrivacyMask = 0x0010, + E802Dot11ShortPreambleMask = 0x0020, + E802Dot11PbccMask = 0x0040, + E802Dot11ChannelAgilityMask = 0x0080 + }; + + +// ======================= MEMBER FUNCTIONS ================================= + +// ---------------------------------------------------------------------------- +// CWsfWlanSsidDiscovery::NewL +// ---------------------------------------------------------------------------- +// +CWsfWlanSsidDiscovery* CWsfWlanSsidDiscovery::NewL() + { + CWsfWlanSsidDiscovery* self = new (ELeave) CWsfWlanSsidDiscovery(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSsidDiscovery::CWsfWlanSsidDiscovery +// ---------------------------------------------------------------------------- +// +CWsfWlanSsidDiscovery::CWsfWlanSsidDiscovery(): CActive( EPriorityStandard ) + { + CActiveScheduler::Add( this ); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSsidDiscovery::ConstructL +// ---------------------------------------------------------------------------- +// +void CWsfWlanSsidDiscovery::ConstructL() + { + LOG_ENTERFN( "CWsfWlanSsidDiscovery::ConstructL" ); +#ifndef __WINS__ + iWlanMgmt = CWlanMgmtClient::NewL(); + iScanInfo = CWlanScanInfo::NewL(); +#endif + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSsidDiscovery::~CWsfWlanSsidDiscovery() +// ---------------------------------------------------------------------------- +// +CWsfWlanSsidDiscovery::~CWsfWlanSsidDiscovery() + { + LOG_ENTERFN( "CWsfWlanSsidDiscovery::~CWsfWlanSsidDiscovery" ); + Cancel(); + delete iWlanMgmt; + delete iScanInfo; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSsidDiscovery::DoCancel +// ---------------------------------------------------------------------------- +// +void CWsfWlanSsidDiscovery::DoCancel() + { + LOG_ENTERFN( "CWsfWlanSsidDiscovery::DoCancel" ); +#ifndef __WINS__ + iWlanMgmt->CancelGetScanResults(); +#endif + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSsidDiscovery::AbortScanning +// ---------------------------------------------------------------------------- +// +void CWsfWlanSsidDiscovery::AbortScanning() + { + LOG_ENTERFN( "CWsfWlanSsidDiscovery::AbortScanning" ); + if ( iWait.IsStarted() ) + { + LOG_WRITE( "aborting..." ); + Cancel(); + + iProgState = EAborted; + iWait.AsyncStop(); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSsidDiscovery::RunL +// ---------------------------------------------------------------------------- +// +void CWsfWlanSsidDiscovery::RunL() + { + LOG_ENTERFN( "CWsfWlanSsidDiscovery::RunL" ); + + if ( iProgState == EScanning ) + { + if ( !iStatus.Int() ) + // The list is ready + { + LOG_WRITE( "No error" ); + iProgState = EDone; + } + else + // something went wrong -> no coverage. + { + LOG_WRITE( "error" ); + } + } + + // stop blocking + if ( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSsidDiscovery::ScanForSsidL +// ---------------------------------------------------------------------------- +// +TBool CWsfWlanSsidDiscovery::ScanForSsidL( TWlanSsid& aEnteredSsid, + TBool aBroadcast, + CMManager::TWlanNetMode& aNetworkMode, + CMManager::TWlanSecMode& aSecurityMode, + TBool& aUsesPsk ) + { + LOG_ENTERFN( "CWsfWlanSsidDiscovery::ScanForSsidL" ); + + if ( IsActive() ) + { + return EFalse; + } + + TBool found = EFalse; +#ifndef __WINS__ + iProgState = EScanning; + + if ( aBroadcast ) + { + LOG_WRITE( "performing broadcast scan" ); + iWlanMgmt->GetScanResults( iStatus, *iScanInfo ); + } + else + { + LOG_WRITE( "performing direct scan" ); + iWlanMgmt->GetScanResults( aEnteredSsid, iStatus, *iScanInfo ); + } + + SetActive(); + iWait.Start(); + + // now we have the results and might start to work on them... + if ( iProgState == EDone ) + { + LOG_WRITE( "iProgState = EDone" ); + //finished without error, work on the result... + for ( iScanInfo->First(); !found && !iScanInfo->IsDone(); + iScanInfo->Next() ) + { + TUint8 ieLen( 0 ); + const TUint8* ieData; + + TInt ret = iScanInfo->InformationElement( E802Dot11SsidIE, ieLen, + &ieData ); + User::LeaveIfError( ret ); + + // get the ssid + TWlanSsid ssid; + ssid.Copy( ieData, ieLen ); + + if ( !aEnteredSsid.Compare( ssid ) ) + { + // SSID matched + LOG_WRITE( "SSID matched, processing security settings" ); + found = ETrue; + + // adhoc or infrastructure + aNetworkMode = ( iScanInfo->Capability() & + E802Dot11CapabilityEssMask ) ? + EInfra : EAdhoc; + + // security mode + TWlanConnectionSecurityMode connSec = + iScanInfo->SecurityMode(); + + // convert TWlanConnectionSecurityMode to + // CMManager::TWlanSecMode + switch ( connSec ) + { + case EWlanConnectionSecurityOpen: + { + aSecurityMode = EWlanSecModeOpen; + break; + } + case EWlanConnectionSecurityWep: + { + aSecurityMode = EWlanSecModeWep; + break; + } + case EWlanConnectionSecurity802d1x: + { + aSecurityMode = EWlanSecMode802_1x; + break; + } + case EWlanConnectionSecurityWpa: + case EWlanConnectionSecurityWpaPsk: + { + aSecurityMode = EWlanSecModeWpa; + break; + } + default: + { + } + } + + aUsesPsk = ( connSec == EWlanConnectionSecurityWpaPsk ); + + } // if aEnteredSsid + + } // for + + } + else if ( iProgState == EAborted ) + { + LOG_WRITE( "iProgState = EAborted" ); + User::Leave( KErrCancel ); + } + else + { + LOG_WRITEF( "iProgState = ???, iStatus = %d", iStatus.Int() ); + User::LeaveIfError( iStatus.Int() ); + } + +#else // __WINS__ + + // we don't like warnings + aEnteredSsid, aBroadcast, aNetworkMode, aSecurityMode, aUsesPsk; + +#endif // __WINS__ + + return found; + } + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/client/bwins/wsfclientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/client/bwins/wsfclientu.def Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,30 @@ +EXPORTS + ?SetIapPersistenceL@RWsfSession@@QAEHW4TWsfIapPersistence@@@Z @ 1 NONAME ; int RWsfSession::SetIapPersistenceL(enum TWsfIapPersistence) + ?GetWlanList@RWsfSession@@QAEXAAV?$TPckgBuf@I@@AAVTPtr8@@AAVTRequestStatus@@@Z @ 2 NONAME ; void RWsfSession::GetWlanList(class TPckgBuf &, class TPtr8 &, class TRequestStatus &) + ?DisconnectWlanBearer@RWsfSession@@QAEXAAV?$TPckgBuf@H@@AAVTRequestStatus@@@Z @ 3 NONAME ; void RWsfSession::DisconnectWlanBearer(class TPckgBuf &, class TRequestStatus &) + ?GetConnectedWlanDetails@RWsfSession@@QAEXAAV?$TPckgBuf@H@@AAVTWsfWlanInfo@@AAVTRequestStatus@@@Z @ 4 NONAME ; void RWsfSession::GetConnectedWlanDetails(class TPckgBuf &, class TWsfWlanInfo &, class TRequestStatus &) + ?RequestScanL@RWsfSession@@QAEHXZ @ 5 NONAME ; int RWsfSession::RequestScanL(void) + ??0RWsfSession@@QAE@XZ @ 6 NONAME ; RWsfSession::RWsfSession(void) + ?ConnectWlanBearerL@RWsfSession@@QAEHKHW4TWsfIapPersistence@@@Z @ 7 NONAME ; int RWsfSession::ConnectWlanBearerL(unsigned long, int, enum TWsfIapPersistence) + ?CancelNotifyEvent@RWsfSession@@QAEXXZ @ 8 NONAME ; void RWsfSession::CancelNotifyEvent(void) + ?CancelAll@RWsfSession@@QAEXXZ @ 9 NONAME ; void RWsfSession::CancelAll(void) + ?GetConnectedWlanDetailsL@RWsfSession@@QAEHAAVTWsfWlanInfo@@@Z @ 10 NONAME ; int RWsfSession::GetConnectedWlanDetailsL(class TWsfWlanInfo &) + ?EnableScanL@RWsfSession@@QAEHXZ @ 11 NONAME ; int RWsfSession::EnableScanL(void) + ?DisconnectWlanBearerL@RWsfSession@@QAEHXZ @ 12 NONAME ; int RWsfSession::DisconnectWlanBearerL(void) + ?UpdateWlanListL@RWsfSession@@QAEXPAVCWsfWlanInfoArray@@@Z @ 13 NONAME ; void RWsfSession::UpdateWlanListL(class CWsfWlanInfoArray *) + ?NotifyEventL@RWsfSession@@QAEXAAVMWsfStateChangeObserver@@@Z @ 14 NONAME ; void RWsfSession::NotifyEventL(class MWsfStateChangeObserver &) + ?MonitorAccessPointL@RWsfSession@@QAEXK@Z @ 15 NONAME ; void RWsfSession::MonitorAccessPointL(unsigned long) + ?GetWlanListSize@RWsfSession@@QAEXAAV?$TPckgBuf@I@@AAVTRequestStatus@@@Z @ 16 NONAME ; void RWsfSession::GetWlanListSize(class TPckgBuf &, class TRequestStatus &) + ?AbortConnectingL@RWsfSession@@QAEXXZ @ 17 NONAME ; void RWsfSession::AbortConnectingL(void) + ?ConnectedAccountNameL@RWsfSession@@QAEPAVHBufC16@@XZ @ 18 NONAME ; class HBufC16 * RWsfSession::ConnectedAccountNameL(void) + ?ConnectWlanBearer@RWsfSession@@QAEXAAV?$TPckgBuf@H@@KHW4TWsfIapPersistence@@AAVTRequestStatus@@@Z @ 19 NONAME ; void RWsfSession::ConnectWlanBearer(class TPckgBuf &, unsigned long, int, enum TWsfIapPersistence, class TRequestStatus &) + ?SetConnectWlanBearerResult@RWsfSession@@QAEXH@Z @ 20 NONAME ; void RWsfSession::SetConnectWlanBearerResult(int) + ?AbortScanningL@RWsfSession@@QAEXXZ @ 21 NONAME ; void RWsfSession::AbortScanningL(void) + ?RequestScan@RWsfSession@@QAEXAAV?$TPckgBuf@H@@AAVTRequestStatus@@@Z @ 22 NONAME ; void RWsfSession::RequestScan(class TPckgBuf &, class TRequestStatus &) + ?IsConnectedL@RWsfSession@@QAEHXZ @ 23 NONAME ; int RWsfSession::IsConnectedL(void) + ?Close@RWsfSession@@QAEXXZ @ 24 NONAME ; void RWsfSession::Close(void) + ?IsScanEnabledL@RWsfSession@@QAEHXZ @ 25 NONAME ; int RWsfSession::IsScanEnabledL(void) + ?ControlDisconnectTimerL@RWsfSession@@QAEHI@Z @ 26 NONAME ; int RWsfSession::ControlDisconnectTimerL(unsigned int) + ?Connect@RWsfSession@@QAEHXZ @ 27 NONAME ; int RWsfSession::Connect(void) + ?DisableScanL@RWsfSession@@QAEHXZ @ 28 NONAME ; int RWsfSession::DisableScanL(void) + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/client/eabi/wsfclientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/client/eabi/wsfclientu.def Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,30 @@ +EXPORTS + _ZN11RWsfSession11EnableScanLEv @ 1 NONAME + _ZN11RWsfSession11GetWlanListER8TPckgBufIjER5TPtr8R14TRequestStatus @ 2 NONAME + _ZN11RWsfSession11RequestScanER8TPckgBufIiER14TRequestStatus @ 3 NONAME + _ZN11RWsfSession12DisableScanLEv @ 4 NONAME + _ZN11RWsfSession12IsConnectedLEv @ 5 NONAME + _ZN11RWsfSession12NotifyEventLER23MWsfStateChangeObserver @ 6 NONAME + _ZN11RWsfSession12RequestScanLEv @ 7 NONAME + _ZN11RWsfSession14AbortScanningLEv @ 8 NONAME + _ZN11RWsfSession14IsScanEnabledLEv @ 9 NONAME + _ZN11RWsfSession15GetWlanListSizeER8TPckgBufIjER14TRequestStatus @ 10 NONAME + _ZN11RWsfSession15UpdateWlanListLEP17CWsfWlanInfoArray @ 11 NONAME + _ZN11RWsfSession16AbortConnectingLEv @ 12 NONAME + _ZN11RWsfSession17CancelNotifyEventEv @ 13 NONAME + _ZN11RWsfSession17ConnectWlanBearerER8TPckgBufIiEmi18TWsfIapPersistenceR14TRequestStatus @ 14 NONAME + _ZN11RWsfSession18ConnectWlanBearerLEmi18TWsfIapPersistence @ 15 NONAME + _ZN11RWsfSession18SetIapPersistenceLE18TWsfIapPersistence @ 16 NONAME + _ZN11RWsfSession19MonitorAccessPointLEm @ 17 NONAME + _ZN11RWsfSession20DisconnectWlanBearerER8TPckgBufIiER14TRequestStatus @ 18 NONAME + _ZN11RWsfSession21ConnectedAccountNameLEv @ 19 NONAME + _ZN11RWsfSession21DisconnectWlanBearerLEv @ 20 NONAME + _ZN11RWsfSession23ControlDisconnectTimerLEj @ 21 NONAME + _ZN11RWsfSession23GetConnectedWlanDetailsER8TPckgBufIiER12TWsfWlanInfoR14TRequestStatus @ 22 NONAME + _ZN11RWsfSession24GetConnectedWlanDetailsLER12TWsfWlanInfo @ 23 NONAME + _ZN11RWsfSession26SetConnectWlanBearerResultEi @ 24 NONAME + _ZN11RWsfSession5CloseEv @ 25 NONAME + _ZN11RWsfSession7ConnectEv @ 26 NONAME + _ZN11RWsfSessionC1Ev @ 27 NONAME + _ZN11RWsfSessionC2Ev @ 28 NONAME + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/client/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/client/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 file for project Engine/Client +* +*/ + + +#include + + +PRJ_PLATFORMS +DEFAULT + + +PRJ_EXPORTS +// private API +../inc/wsfsession.h |../../../../inc/wsfsession.h +../inc/wsfstatechangeobserver.h |../../../../inc/wsfstatechangeobserver.h + +../rom/wsfclient.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wsfclient.iby) + + +PRJ_MMPFILES +client.mmp + + +// End of file + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/client/group/client.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/client/group/client.mmp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 project Engine/Client +* +*/ + + + +#include +#include + + +TARGET wsfclient.dll +TARGETTYPE dll +UID 0x1000008d 0x10281CAC + +CAPABILITY ALL -TCB + + +SOURCEPATH ../src +SOURCE wsfsession.cpp +SOURCE wsfeventhandler.cpp +SOURCE wsfactivewaiter.cpp + +// own headers +USERINCLUDE ../inc + +// server-client common headers +USERINCLUDE ../../inc + +// inner API +USERINCLUDE ../../../inc + +// private API +USERINCLUDE ../../../../inc + + +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY estor.lib +LIBRARY charconv.lib +LIBRARY wsfwlaninfo.lib + +DEBUGLIBRARY flogger.lib + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/client/inc/wsfactivewaiter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/client/inc/wsfactivewaiter.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,95 @@ +/* +* 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 CWsfActiveWaiter +* +*/ + + + + +#ifndef __WSFCLIENT_ACTIVE_WAITER_H__ +#define __WSFCLIENT_ACTIVE_WAITER_H__ + +// INCLUDES +#include + +/** + * CWsfActiveWaiter class, + * an active object to replace User::WaitForRequest + * + * Usage: + * CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewL(); + * CleanupStack::PushL( waiter ); + * server.AsyncFunction( waiter->iStatus ); + * if ( waiter->WaitForRequest == KErrNone ) + * { + * // handle success + * } + * else + * { + * // handle failure + * } + * CleanupStack::PopAndDestroy( waiter ); + * + */ +NONSHARABLE_CLASS( CWsfActiveWaiter ) : public CActive + { + public: + /** + * NewL function + * @param aPlugin a pointer to notifier plugin + */ + static CWsfActiveWaiter* NewL( ); + + /** + * Destructor + */ + virtual ~CWsfActiveWaiter(); + + /** + * Waits for it's TRequestStatus to be completed + * @return Error code returned from server after request is + * completed + */ + TInt WaitForRequest( ); + + protected: + /** + * ConstructL + */ + void ConstructL(); + + /** + * Constructor + * @param aPlugin a pointer to notifier plugin + */ + CWsfActiveWaiter(); + + /** + * DoCancel from CActive + */ + virtual void DoCancel(); + + /** + * RunL from CActive + */ + virtual void RunL(); + + protected: + CActiveSchedulerWait iWait; + }; + +#endif // __WSFCLIENT_ACTIVE_WAITER_H__ + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/client/inc/wsfeventhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/client/inc/wsfeventhandler.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,171 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfEventHandler +* +*/ + + + + + +#ifndef C_WSFEVENTHANDLER_H +#define C_WSFEVENTHANDLER_H + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "wsfsession.h" +#include "wsfservercommon.h" +#include "wsfstatechangeobserver.h" + + +// CLASS DEFINITION +/** + * Class to handle callbacks from the server + * + * CWsfEventHandler acts as a gateway between the client and the server. + * Its main task is to hand over notifications of server events if the client + * has requested that. + * + * @lib wsfclient.lib + * @since S60 5.0 + */ + +NONSHARABLE_CLASS( CWsfEventHandler ): public CActive + { + public: // Constructors and destructor + /** + * Factory function. + * @since S60 5.0 + * @param aSession Client-side handle to the server session + * Ownership not passed. + * @param aObserver The object which should be notified on event + * Ownership not passed. + */ + static CWsfEventHandler* NewL( RWsfSession& aSession, + MWsfStateChangeObserver& aObserver ); + + ~CWsfEventHandler(); + + + private: + /** + * Constructor + * @since S60 5.0 + * @param aSession Client-side handle to the server session. + * Ownership not passed. + * @param aObserver The object which should be notified on event. + * Ownership not passed. + */ + CWsfEventHandler( RWsfSession& aSession, + MWsfStateChangeObserver& aObserver ); + + void ConstructL(); + + + public: // new methods + /** + * Set the listening active object as active + * @since S60 5.0 + */ + void Start(); + + /** + * Get reference to the event container + * @since S60 5.0 + * @return Reference to the event container. + */ + TPckgBuf& EventContainer(); + + /** + * Change the event observer by resetting the reference + * @since S60 5.0 + * @param aObserver The object which should be notified on event. + * Ownership not passed. + */ + void ResetObserver( MWsfStateChangeObserver& aObserver ); + + /** + * Prevents the ongoing connecting process from notifying the observer + * if the connecting flag is set + * @since S60 5.0 + */ + void BlockNextConnectedEvent(); + + /** + * Resets the flag that prevents the ongoing connecting process + * from notifying the observer + * @since S60 5.2 + */ + void UnBlockNextConnectedEvent(); + + /** + * Sets the connecting flag. Used by RWsfSession to mark the interval + * of the connection creation. + * @since S60 5.0 + * @param aConnecting The value of the flag. + */ + void SetConnecting( TBool aConnecting ); + + /** + * Gets the connecting flag. + * @since S60 5.0 + * @return The value of the flag. + */ + TBool Connecting() const; + + + private: // from CActive + void RunL(); + void DoCancel(); + TInt RunError( TInt aError ); + + private: + /** + * Handle the RunL trapped + * @since S60 5.0 + */ + void DoRunL(); + + private: + /** + * Client-side handle for the server session. Not owned. + */ + RWsfSession* iSession; + + /** + * The object which should be notified on event. Not owned. + */ + MWsfStateChangeObserver* iObserver; + + /** + * Event container + */ + TPckgBuf iEvent; + + /** + * Indicates whether the connection created event should be suppressed + */ + TBool iBlockConnectedEvent; + + /** + * Indicates whether there is an ongoing connecting process + */ + TBool iConnecting; + + }; + + +#endif // C_WSFEVENTHANDLER_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/client/inc/wsfsession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/client/inc/wsfsession.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,354 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for RWsfSession +* +*/ + + + + + +#ifndef R_WSFSESSION_H +#define R_WSFSESSION_H + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "wsfcommon.h" + + +// FORWARD DECLARATIONS +class CWsfWlanInfoArray; +class CWsfEventHandler; +class MWsfStateChangeObserver; +class TWsfWlanInfo; +class CWsfActiveWaiter; + + +// CLASS DEFINITION +/** + * Client-side handle to server session + * + * RWsfSession is the client-side session of a connection to the server. + * It provides an interface through which the different scanning services + * can be reached and results obtained. + * + * @lib wsfclient.lib + * @since S60 5.0 + */ +NONSHARABLE_CLASS( RWsfSession ): public RSessionBase + { + friend class CWsfEventHandler; + + + public: // Constructor + + IMPORT_C RWsfSession(); + + + public: // New methods + + /** + * Initiates a connection to the server and also launches it + * if it was not running yet. + * @since S60 5.0 + */ + IMPORT_C TInt Connect(); + + /** + * Returns the version number of the session class + * @since S60 5.0 + * @return A version structure + */ + inline TVersion Version() const; + + /** + * Closes this session. + * @since S60 5.0 + */ + IMPORT_C void Close(); + + /** + * Subscribes to server events + * @since S60 5.0 + * @param aObserver The object which should be notified on event + */ + IMPORT_C void NotifyEventL( MWsfStateChangeObserver& aObserver ); + + /** + * Cancels the subscription + * @since S60 5.0 + */ + IMPORT_C void CancelNotifyEvent(); + + /** + * Sets the wlan scanning on if not already active + * @since S60 5.0 + * @return ETrue on success. + */ + IMPORT_C TBool EnableScanL(); + + /** + * Disables the scanning + * @since S60 5.0 + * @return ETrue on success. + */ + IMPORT_C TBool DisableScanL(); + + /** + * Queries the current scanning status. + * @since S60 5.0 + * @return ETrue if scanning is enabled, EFalse otherwise. + */ + IMPORT_C TBool IsScanEnabledL(); + + /** + * Requests the scan results from the server + * @since S60 5.0 + * @param aInfoArray Array for the scan results. Ownership not changed. + */ + IMPORT_C void UpdateWlanListL( CWsfWlanInfoArray* aInfoArray ); + + /** + * Asyncronous request to the server to return wlan list size + * @since S60 5.2 + * @param aPckg request result + * @param aStatus The request status object used to contain + * the completion status of the request. + */ + IMPORT_C void GetWlanListSize( TPckgBuf& aPckg, + TRequestStatus& aStatus ); + + + /** + * Asyncronous request to the server to return wlan list + * @since S60 5.2 + * @param aPckg request result + * @param aPtr wlan list + * @param aStatus The request status object used to contain + * the completion status of the request. + */ + IMPORT_C void GetWlanList( TPckgBuf& aPckg, TPtr8& aPtr, + TRequestStatus& aStatus ); + + /** + * Cancel all pending tasks. + * @since S60 5.0 + */ + IMPORT_C void CancelAll(); + + /** + * Return the connected wlan network name + * @since S60 5.0 + * @return The connected account name, or NULL if not connected + */ + IMPORT_C HBufC* ConnectedAccountNameL(); + + /** + * Return the connected wlan's details + * @since S60 5.0 + * @param aWlanInfo The wlaninfo object to fill + * @return ETrue if success, EFalse otherwise + */ + IMPORT_C TBool GetConnectedWlanDetailsL( TWsfWlanInfo& aWlanInfo ); + + /** + * Asyncronous request to the server to return connected wlan network + * @since S60 5.2 + * @param aPckg request result + * @param aWlanInfo The wlaninfo object to fill + * @param aStatus The request status object used to contain + * the completion status of the request. + */ + IMPORT_C void GetConnectedWlanDetails( TPckgBuf& aPckg, + TWsfWlanInfo& aWlanInfo, + TRequestStatus& aStatus ); + + /** + * Start monitoring events for the specified access point + * @since S60 5.0 + * @param aMonitoredIap The id of the IAP to be monitored + */ + IMPORT_C void MonitorAccessPointL( TUint32 aMonitoredIap ); + + /** + * Connect to the given WLAN IAP. The function requests the server, + * then starts a synchronous wait until the connection is established. + * @since S60 5.0 + * @param aIapId The id of the IAP to connect to + * @param aConnectOnly ETrue if Connect selected + * @param aPersistence The value of the persistence property + * @return KErrNone if managed to connect, otherwise error code + */ + IMPORT_C TInt ConnectWlanBearerL( TUint32 aIapId, + TBool aConnectOnly, + TWsfIapPersistence aPersistence = EIapPersistent ); + + /** + * Asyncronous request to the server to connect + * @since S60 5.2 + * @param aPckg request result + * @param aIapId The id of the IAP to connect to + * @param aConnectOnly ETrue if Connect selected + * @param aPersistence The value of the persistence property + * @param aStatus The request status object used to contain + * the completion status of the request. + */ + IMPORT_C void ConnectWlanBearer( TPckgBuf& aPckg, + TUint32 aIapId, + TBool aConnectOnly, + TWsfIapPersistence aPersistence, + TRequestStatus& aStatus ); + + /** + * Sets connection result + * @since S60 5.2 + * @param aResult The connection request result + */ + IMPORT_C void SetConnectWlanBearerResult( TInt aResult ); + + /** + * Sets the persistence property of the currently monitored IAP + * @since S60 5.0 + * @param aPersistence The value of the property + * @return ETrue on success, otherwise false + */ + IMPORT_C TBool SetIapPersistenceL( TWsfIapPersistence aPersistence ); + + /** + * Disconnect the current wlan connection + * @since S60 5.0 + * @return ETrue if there was an active connection and it was + * disconnected successfully, otherwise EFalse + */ + IMPORT_C TBool DisconnectWlanBearerL(); + + /** + * Asyncronous request to the server to disconnect + * @since S60 5.2 + * @param aPckg request result + * @param aStatus The request status object used to contain + * the completion status of the request. + */ + IMPORT_C void DisconnectWlanBearer( TPckgBuf& aPckg, + TRequestStatus& aStatus ); + + /** + * Request the server to make a forced scan + * @since S60 5.0 + * @return ETrue on success + */ + IMPORT_C TBool RequestScanL(); + + /** + * Asyncronous request to the server to make a scan + * @since S60 5.2 + * @param aPckg request result + * @param aStatus The request status object used to contain + * the completion status of the request. + */ + IMPORT_C void RequestScan( TPckgBuf& aPckg, + TRequestStatus& aStatus ); + + /** + * Queries if there is an active WLAN connection. + * @since S60 5.0 + * @return ETrue if there is an active WLAN connection, + * * EFalse otherwise. + */ + IMPORT_C TBool IsConnectedL(); + + /** + * Aborts the currently ongoing connecting process + * @since S60 5.0 + */ + IMPORT_C void AbortConnectingL(); + + /** + * Aborts the currently ongoing scanning process + * @since S60 5.0 + */ + IMPORT_C void AbortScanningL(); + + /** + * Controls the auto-disconnect timer in the server + * for owned connections + * @since S60 5.0 + * @param aAdcCommand Command bitmask for the timer, + * see TWsfAutoDisconnectCommand + * @return ETrue if the timer has been started (also if it had been + * started earlier), EFalse if the timer couldn't be started + * (e.g. because there is no owned connection). + */ + IMPORT_C TBool ControlDisconnectTimerL( TUint aAdcCommand ); + + + private: + /** + * Starts the server if it was not running already. + * @since S60 5.0 + * @return KErrNone on success, otherwise error code + */ + TInt StartServer(); + + + private: + /** + * Cancels the notifications from the server. + * Only called by CWsfEventHandler. + * @since S60 5.0 + */ + void DoCancelNotifyEvent(); + + /** + * Tries to restart the server after it died because of an error. + * Only called by CWsfEventHandler. + * @since S60 5.0 + * @param aObserver The object which should be notified on + * server events. (This call just passes the current + * observer of the event handler, which is needed + * for the initialisation.) + * @return ETrue if the restart succeeded + */ + TBool RecoverFromServerTermination( + MWsfStateChangeObserver& aObserver ); + + /** + * Stops the waiting for connection creation started by + * ConnectWlanBearerL. + * @since S60 5.0 + */ + void StopConnectingWait(); + + + private: // Data + /** + * Event handler active object for the server-generated events. Owned. + */ + CWsfEventHandler* iEventHandler; + + /** + * Indicates the result of the connecting process + */ + TInt iConnectingResult; + + /** + * Waiter to make the asynchronous connect call synchronous + * on client-side + */ + CActiveSchedulerWait* iConnWaiter; + }; + +#endif // R_WSFSESSION_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/client/inc/wsfstatechangeobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/client/inc/wsfstatechangeobserver.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for MWsfStateChangeObserver +* +*/ + + + + +#ifndef M_WSFSTATECHANGEOBSERVER_H +#define M_WSFSTATECHANGEOBSERVER_H + +// EXTERNAL INCLUDES +#include + + +// CLASS DEFINITION +/** + * Mixin class to handle server events + * + * MWsfStateChangeObserver provides an interface through which + * the implementing class can receive notifications of different server events + * communicated by the client-side event handler. + * + * @since S60 5.0 + */ +class MWsfStateChangeObserver + { + public: + /** + * The current wlan data has changed and it is ready to be retrieved + * @since S60 5.0 + */ + virtual void WlanListChangedL() = 0; + + /** + * Engine error occured + * @since S60 5.0 + * @param aError System wide error code + */ + virtual void NotifyEngineError( TInt aError ) = 0; + + /** + * Scanning has been disabled + * @since S60 5.0 + */ + virtual void ScanDisabledL() = 0; + + /** + * Scanning has been enabled + * @since S60 5.0 + */ + virtual void ScanEnabledL() = 0; + + /** + * A WLAN connection has been established + * @since S60 5.0 + */ + virtual void WlanConnectionActivatedL() = 0; + + /** + * A WLAN connection has been closed + * @since S60 5.0 + */ + virtual void WlanConnectionClosedL() = 0; + + /** + * A WLAN connection creation finished + * @since S60 5.2 + * @param aError System wide error code + */ + virtual void ConnectionCreationProcessFinishedL( TInt aError ) = 0; + + + }; + + +#endif // M_WSFSTATECHANGEOBSERVER_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/client/rom/wsfclient.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/client/rom/wsfclient.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 Engine/Client +* +*/ + + + + +#ifndef WSFCLIENT_IBY +#define WSFCLIENT_IBY + +#ifdef __PROTOCOL_WLAN + +REM WlanSnifferClient + +#include + + +file=ABI_DIR\BUILD_DIR\wsfclient.dll SHARED_LIB_DIR\wsfclient.dll + +#endif // __PROTOCOL_WLAN + +#endif // WSFCLIENT_IBY diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/client/src/wsfactivewaiter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/client/src/wsfactivewaiter.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,108 @@ +/* +* 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 CWsfActiveWaiter. +* +*/ + + +// INCLUDE FILES +#include "wsfactivewaiter.h" +#include "wsflogger.h" + + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CWsfActiveWaiter* CWsfActiveWaiter::NewL() +// --------------------------------------------------------- +// +CWsfActiveWaiter* CWsfActiveWaiter::NewL( ) + { + CWsfActiveWaiter* self = + new ( ELeave ) CWsfActiveWaiter( ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// --------------------------------------------------------- +// CWsfActiveWaiter::ConstructL() +// --------------------------------------------------------- +// +void CWsfActiveWaiter::ConstructL() + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::CWsfActiveWaiter() +// --------------------------------------------------------- +// +CWsfActiveWaiter::CWsfActiveWaiter() +: CActive( EPriorityNormal ) + { + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::~CWsfActiveWaiter() +// --------------------------------------------------------- +// +CWsfActiveWaiter::~CWsfActiveWaiter() + { + Cancel(); + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::DoCancel() +// --------------------------------------------------------- +// +void CWsfActiveWaiter::DoCancel() + { + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::RunL() +// --------------------------------------------------------- +// +void CWsfActiveWaiter::RunL() + { + LOG_ENTERFN( "CWsfActiveWaiter::RunL" ); + if ( iWait.IsStarted() ) + { + LOG_WRITE("async call completed, resuming."); + iWait.AsyncStop(); + } + } + +// --------------------------------------------------------- +// CWsfActiveWaiter::WaitForRequest() +// --------------------------------------------------------- +// +TInt CWsfActiveWaiter::WaitForRequest() + { + LOG_ENTERFN("CWsfActiveWaiter::WaitForRequest"); + SetActive(); + iWait.Start(); + + return iStatus.Int(); + } +// End of File + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/client/src/wsfeventhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/client/src/wsfeventhandler.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,341 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfEventHandler +* +*/ + + + + +// CLASS HEADER +#include "wsfeventhandler.h" + +// INTERNAL INCLUDES +#include "wsfstatechangeobserver.h" +#include "wsflogger.h" + + +// --------------------------------------------------------------------------- +// CWsfEventHandler::NewL +// --------------------------------------------------------------------------- +// +CWsfEventHandler* CWsfEventHandler::NewL( RWsfSession& aSession, + MWsfStateChangeObserver& aObserver ) + { + CWsfEventHandler* thisPtr = new (ELeave) CWsfEventHandler( aSession, + aObserver ); + CleanupStack::PushL( thisPtr ); + thisPtr->ConstructL(); + CleanupStack::Pop( thisPtr ); + return thisPtr; + } + + +// --------------------------------------------------------------------------- +// CWsfEventHandler::~CWsfEventHandler +// --------------------------------------------------------------------------- +// +CWsfEventHandler::~CWsfEventHandler() + { + Cancel(); + iSession = NULL; + iObserver = NULL; + } + + +// --------------------------------------------------------------------------- +// CWsfEventHandler::CWsfEventHandler +// --------------------------------------------------------------------------- +// +CWsfEventHandler::CWsfEventHandler( RWsfSession& aSession, + MWsfStateChangeObserver& aObserver ): + CActive( CActive::EPriorityStandard ) + { + iSession = &aSession; + iObserver = &aObserver; + } + + +// --------------------------------------------------------------------------- +// CWsfEventHandler::ConstructL +// --------------------------------------------------------------------------- +// +void CWsfEventHandler::ConstructL() + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------------------------- +// CWsfEventHandler::DoRunL +// --------------------------------------------------------------------------- +// +void CWsfEventHandler::DoRunL() + { + LOG_ENTERFN( "CWsfEventHandler::DoRunL" ); + LOG_WRITEF( "CWsfEventHandler::DoRunL event = %d", iEvent().iEvent ); + + switch ( iEvent().iEvent ) + { + case EEngineWlanDataChanged: + { + iObserver->WlanListChangedL(); + break; + } + + case EEngineScanDisabled: + { + iObserver->ScanDisabledL(); + break; + } + + case EEngineScanEnabled: + { + iObserver->ScanEnabledL(); + break; + } + + case EEngineConnected: + { + if ( !iBlockConnectedEvent ) + { + // if the event wasn't blocked, notify the observer + iObserver->WlanConnectionActivatedL(); + } + else + { + // if it was blocked, just clear the flag + iBlockConnectedEvent = EFalse; + } + + // anyhow, connecting process is finished + if ( iConnecting ) + { + iConnecting = EFalse; + iSession->StopConnectingWait(); + iObserver->ConnectionCreationProcessFinishedL( + KErrNone ); + } + break; + } + + case EEngineDisconnected: + { + iObserver->WlanConnectionClosedL(); + break; + } + + case EEngineError: + { + iObserver->NotifyEngineError( iEvent().iError ); + break; + } + + case EEngineConnectingFailed: + { + if ( iConnecting ) + { + // connecting is over + iConnecting = EFalse; + + // make client return with KErrCancel + iSession->iConnectingResult = iEvent().iError; + iSession->StopConnectingWait(); + iObserver->ConnectionCreationProcessFinishedL( + iSession->iConnectingResult ); + } + break; + } + + default: + __ASSERT_DEBUG(0, _L("CWsfEventHandler - Invalid EngineEvent")); + break; + } + + } + + +// --------------------------------------------------------------------------- +// CWsfEventHandler::RunL +// --------------------------------------------------------------------------- +// +void CWsfEventHandler::RunL() + { + LOG_ENTERFN( "CWsfEventHandler::RunL" ); + TInt notifyError( KErrNone ); + TBool reissue( ETrue ); + + if ( iStatus.Int() >= KErrNone && iObserver ) + { + TRAP( notifyError, DoRunL() ); + } + + if ( notifyError ) + { + // notified class leaved + LOG_WRITEF( "CWsfEventHandler::RunL notify error %d", notifyError ); + } + else if ( iStatus.Int() != KErrNone ) + { + if ( iStatus.Int() == KErrCancel ) + { + // KErrCancel is the signal that we are going down + LOG_WRITE( "going down..." ); + reissue = EFalse; + } + else + { + // error on the server side + LOG_WRITEF( "CWsfEventHandler::RunL engine error %d", + iStatus.Int() ); + + TBool notify( ETrue ); + + if ( iStatus.Int() == KErrServerTerminated ) + { + reissue = EFalse; + + if ( iObserver + && iSession->RecoverFromServerTermination( *iObserver ) ) + { + // no need to reissue if recovered since it is already + // done in the recovery process + notify = EFalse; + } + } + + if ( notify && iObserver ) + { + // let the client decide what to do + iObserver->NotifyEngineError( iStatus.Int() ); + } + } + } + + + if ( reissue && iObserver ) + { + // reissue callback request + iSession->NotifyEventL( *iObserver ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfEventHandler::DoCancel +// --------------------------------------------------------------------------- +// +void CWsfEventHandler::DoCancel() + { + LOG_ENTERFN( "CWsfEventHandler::DoCancel" ); + iSession->DoCancelNotifyEvent(); + } + + +// --------------------------------------------------------------------------- +// CWsfEventHandler::RunError +// --------------------------------------------------------------------------- +// +TInt CWsfEventHandler::RunError( TInt aError ) + { + LOG_ENTERFN( "CWsfEventHandler::RunError" ); + LOG_WRITEF( "CWsfEventHandler::RunError error = %d", aError ); + if ( iObserver ) + { + iObserver->NotifyEngineError( aError ) ; + } + return KErrNone; // we don't wan't to panic euser-47 - do we? + } + + +// --------------------------------------------------------------------------- +// CWsfEventHandler::Start +// --------------------------------------------------------------------------- +// +void CWsfEventHandler::Start() + { + SetActive(); + } + + +// --------------------------------------------------------------------------- +// CWsfEventHandler::EventContainer +// --------------------------------------------------------------------------- +// +TPckgBuf& CWsfEventHandler::EventContainer() + { + return iEvent; + } + + +// --------------------------------------------------------------------------- +// CWsfEventHandler::ResetObserver +// --------------------------------------------------------------------------- +// +void CWsfEventHandler::ResetObserver( MWsfStateChangeObserver& aObserver ) + { + LOG_ENTERFN( "CWsfEventHandler::ResetObserver" ); + iObserver = &aObserver; + } + + +// --------------------------------------------------------------------------- +// CWsfEventHandler::BlockNextConnectedEvent +// --------------------------------------------------------------------------- +// +void CWsfEventHandler::BlockNextConnectedEvent() + { + LOG_ENTERFN( "CWsfEventHandler::BlockNextConnectedEvent" ); + if ( iConnecting ) + { + LOG_WRITE( "iBlockConnectedEvent to true" ); + // set the flag only if we are the ones who are connecting + iBlockConnectedEvent = ETrue; + } + } + + +// --------------------------------------------------------------------------- +// CWsfEventHandler::UnBlockNextConnectedEvent +// --------------------------------------------------------------------------- +// +void CWsfEventHandler::UnBlockNextConnectedEvent() + { + LOG_ENTERFN( "CWsfEventHandler::UnBlockNextConnectedEvent" ); + LOG_WRITE( "iBlockConnectedEvent to false" ); + iBlockConnectedEvent = EFalse; + } + + +// --------------------------------------------------------------------------- +// CWsfEventHandler::SetConnecting +// --------------------------------------------------------------------------- +// +void CWsfEventHandler::SetConnecting( TBool aConnecting ) + { + LOG_ENTERFN( "CWsfEventHandler::SetConnecting" ); + LOG_WRITEF( "iConnecting=%d, aConnecting=%d", iConnecting, aConnecting ); + iConnecting = aConnecting; + } + + +// --------------------------------------------------------------------------- +// CWsfEventHandler::Connecting +// --------------------------------------------------------------------------- +// +TBool CWsfEventHandler::Connecting() const + { + return iConnecting; + } + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/client/src/wsfsession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/client/src/wsfsession.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,807 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 RWsfSession +* +*/ + + + +// CLASS HEADER +#include "wsfsession.h" + +// INTERNAL INCLUDES +#include "wsfwlaninfoarray.h" +#include "wsfeventhandler.h" +#include "wsfactivewaiter.h" +#include "wsfservercommon.h" +#include "wsflogger.h" + + + +// LOCAL DEFINITIONS +/** +* Number of message slots at the server +*/ +static const TInt KIPCSlots = 6; + +/** +* Number of retries to start the server +*/ +static const TInt KRetries = 3; + + + +// --------------------------------------------------------------------------- +// RWsfSession::RWsfSession +// --------------------------------------------------------------------------- +EXPORT_C RWsfSession::RWsfSession(): + RSessionBase(), + iEventHandler( 0 ), + iConnectingResult( KErrNone ) + { + } + + +// --------------------------------------------------------------------------- +// RWsfSession::StartServer +// --------------------------------------------------------------------------- +TInt RWsfSession::StartServer() + { + LOG_ENTERFN( "RWsfSession::StartServerL" ); + + TInt res( KErrNone ); + // create server - if one of this name does not already exist + TFindServer findServer( KWlanSnifferServerName ); + TFullName name; + + if ( findServer.Next( name ) != KErrNone ) // we don't exist already + { + RProcess server; + // Create the server process + res = server.Create( KWlanSnifferServerExe, KNullDesC ); + + if ( res != KErrNone ) // thread created ok - now start it going + { + return res; + } + + // Rendezvous is used to detect server start + TRequestStatus status; + server.Rendezvous( status ); + + if ( status != KRequestPending ) + { + LOG_WRITEF( "StartServer Rendezvous ERROR: %d", status.Int() ); + server.Kill( 0 ); // abort startup + } + else + { + server.Resume(); // logon OK - start the server + } + + LOG_WRITE( "StartServer wait for start" ); + User::WaitForRequest( status ); // wait for start or death + + // We can't use the 'exit reason' if the server paniced as this + // is the panic 'reason' and may be '0' which cannot be distinguished + // from KErrNone + res = ( server.ExitType() == EExitPanic ) ? KErrGeneral : status.Int(); + + // we're no longer interested in the other process + server.Close(); + } + + return res; + } + + +// --------------------------------------------------------------------------- +// RWsfSession::Connect +// --------------------------------------------------------------------------- +// +EXPORT_C TInt RWsfSession::Connect() + { + LOG_ENTERFN( "RWsfSession::Connect" ); + TInt err = StartServer(); + + for (TInt tries = 0; tries < KRetries; tries++) + { + LOG_WRITE( "server started" ); + + err = CreateSession( KWlanSnifferServerName, Version(), KIPCSlots ); + + LOG_WRITEF( "CreateSession() returned %d", err ); + + if (!err) + { + LOG_WRITE( "connected" ); + TRAP( err, iConnWaiter = new (ELeave) CActiveSchedulerWait() ); + break; + } + if (err != KErrNotFound && err != KErrServerTerminated) + { + LOG_WRITE( "problems session creation - break" ); + break; + } + + TInt err = StartServer(); // try to launch the server + + if (!err) + { + LOG_WRITE( "ok - try to connect again" ); + continue; + } + + if (err == KErrAlreadyExists) + { + LOG_WRITE( "someone else started - try to connect again" ); + continue; + } + + LOG_WRITE( "problems - break" ); + break; + } + + LOG_WRITEF( "connect exit value = %d", err ); + + return err; + } + + +// --------------------------------------------------------------------------- +// RWsfSession::Version +// --------------------------------------------------------------------------- +// +TVersion RWsfSession::Version() const + { + return TVersion( KWlanSnifferServerMajor, + KWlanSnifferServerMinor, + KWlanSnifferServerBuild ); + } + + +// --------------------------------------------------------------------------- +// RWsfSession::CancelNotifyEvent +// --------------------------------------------------------------------------- +// +EXPORT_C void RWsfSession::CancelNotifyEvent() + { + LOG_ENTERFN( "RWsfSession::CancelNotifyEvent" ); + if ( iEventHandler ) + { + iEventHandler->Cancel(); + } + } + + +// --------------------------------------------------------------------------- +// RWsfSession::ConnectedAccountNameL +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC* RWsfSession::ConnectedAccountNameL() + { + LOG_ENTERFN("RWsfSession::ConnectedAccountNameL"); + TPckgBuf package; + CWsfActiveWaiter *waiter = CWsfActiveWaiter::NewL(); + CleanupStack::PushL( waiter ); + SendReceive( ESnifferCmdConnectionName, TIpcArgs( &package ), + waiter->iStatus ); + waiter->WaitForRequest(); + LOG_WRITEF( "message[%d] call returned %d", + ESnifferCmdConnectionName, + waiter->iStatus.Int() ); + User::LeaveIfError( waiter->iStatus.Int() ); + CleanupStack::PopAndDestroy( waiter ); + + if ( package().iConnected ) + { + return package().iConnectedAccountName.AllocL(); + } + return KNullDesC().AllocL(); + } + + +// --------------------------------------------------------------------------- +// RWsfSession::GetConnectedWlanDetailsL +// --------------------------------------------------------------------------- +// +EXPORT_C TBool RWsfSession::GetConnectedWlanDetailsL( TWsfWlanInfo& aWlanInfo ) + { + LOG_ENTERFN("RWsfSession::GetConnectedWlanDetailsL"); + TPckgBuf ret( EFalse ); + TPckg package( aWlanInfo ); + + CWsfActiveWaiter *waiter = CWsfActiveWaiter::NewL(); + CleanupStack::PushL( waiter ); + + SendReceive( ESnifferCmdConnectedDetails, TIpcArgs( &ret, &package ), + waiter->iStatus ); + waiter->WaitForRequest(); + LOG_WRITEF( "message[%d] call returned %d", + ESnifferCmdConnectedDetails, + waiter->iStatus.Int() ); + User::LeaveIfError( waiter->iStatus.Int() ); + CleanupStack::PopAndDestroy( waiter ); + + return ret(); + } + + +// --------------------------------------------------------------------------- +// RWsfSession::GetConnectedWlanDetails +// --------------------------------------------------------------------------- +// +EXPORT_C void RWsfSession::GetConnectedWlanDetails( TPckgBuf& aPckg, + TWsfWlanInfo& aWlanInfo, + TRequestStatus& aStatus ) + { + LOG_ENTERFN("RWsfSession::GetConnectedWlanDetails"); + TPckg package( aWlanInfo ); + + SendReceive( ESnifferCmdConnectedDetails, TIpcArgs( &aPckg, &package ), + aStatus ); + } + + +// --------------------------------------------------------------------------- +// RWsfSession::NotifyEventL +// --------------------------------------------------------------------------- +// +EXPORT_C void RWsfSession::NotifyEventL( MWsfStateChangeObserver& aObserver ) + { + LOG_ENTERFN("RWsfSession::NotifyEventL"); + if ( !iEventHandler ) + { + iEventHandler = CWsfEventHandler::NewL( *this, aObserver ); + } + iEventHandler->ResetObserver( aObserver ); + if ( !iEventHandler->IsActive() ) + { + iEventHandler->Start(); + SendReceive( ESnifferCmdNotifyEvents, + TIpcArgs( &iEventHandler->EventContainer() ), + iEventHandler->iStatus ); + } + } + + +// --------------------------------------------------------------------------- +// RWsfSession::EnableScanL +// --------------------------------------------------------------------------- +// +EXPORT_C TBool RWsfSession::EnableScanL() + { + LOG_ENTERFN("RWsfSession::EnableScanL"); + + TInt err = Send( ESnifferCmdActivateScan ); + LOG_WRITEF( "message[%d] call returned %d", ESnifferCmdActivateScan, err ); + + User::LeaveIfError( err ); + + return !err; + } + + +// --------------------------------------------------------------------------- +// RWsfSession::DisableScanL +// --------------------------------------------------------------------------- +// +EXPORT_C TBool RWsfSession::DisableScanL() + { + LOG_ENTERFN("RWsfSession::DisableScanL"); + + TInt err = Send( ESnifferCmdDisableScan ); + LOG_WRITEF( "message[%d] call returned %d", ESnifferCmdDisableScan, err ); + + User::LeaveIfError( err ); + + return !err; + } + + +// --------------------------------------------------------------------------- +// RWsfSession::IsScanEnabledL +// --------------------------------------------------------------------------- +// +EXPORT_C TBool RWsfSession::IsScanEnabledL() + { + LOG_ENTERFN("RWsfSession::IsScanEnabledL"); + TBool res = 0; + TPckgBuf pckg; + + CWsfActiveWaiter *waiter = CWsfActiveWaiter::NewL(); + CleanupStack::PushL( waiter ); + + SendReceive( ESnifferCmdIsScanEnabled, TIpcArgs( &pckg ), + waiter->iStatus ); + waiter->WaitForRequest(); + LOG_WRITEF( "message[%d] call returned %d", + ESnifferCmdIsScanEnabled, + waiter->iStatus.Int() ); + User::LeaveIfError( waiter->iStatus.Int() ); + CleanupStack::PopAndDestroy( waiter ); + + res = pckg(); + return res; + } + + +// --------------------------------------------------------------------------- +// RWsfSession::UpdateWlanListL +// --------------------------------------------------------------------------- +// +EXPORT_C void RWsfSession::UpdateWlanListL( CWsfWlanInfoArray* aInfoArray ) + { + LOG_ENTERFN("RWsfSession::UpdateWlanListL"); + // first request the buffer size for wlan data... + TPckgBuf pckg; + TUint infoArrayElementCount = aInfoArray->Count(); + + CWsfActiveWaiter *waiter = CWsfActiveWaiter::NewL(); + CleanupStack::PushL( waiter ); + + SendReceive( ESnifferCmdWlanDataSize, TIpcArgs( &pckg ), waiter->iStatus ); + waiter->WaitForRequest(); + LOG_WRITEF( "message[%d] call returned %d", + ESnifferCmdWlanDataSize, + waiter->iStatus.Int() ); + User::LeaveIfError( waiter->iStatus.Int() ); + + // alloc the required size buffer... + TInt requiredSize = pckg(); + LOG_WRITEF( "WLAN data buffer size = %d", requiredSize ); + + if ( !requiredSize ) + { + // no data ... + CleanupStack::PopAndDestroy( waiter ); + return; + } + + HBufC8* buffer = HBufC8::NewLC( requiredSize ); + TPtr8 ptr = buffer->Des(); + + SendReceive( ESnifferCmdGetWlanInfo, TIpcArgs( &pckg, &ptr ), + waiter->iStatus ); + waiter->WaitForRequest(); + LOG_WRITEF( "message[%d] call returned %d", + ESnifferCmdGetWlanInfo, + waiter->iStatus.Int() ); + User::LeaveIfError( waiter->iStatus.Int() ); + + + LOG_WRITEF( "actual bytes occupied = %d", pckg() ); + + if ( requiredSize != pckg() ) + { + // the buffer is not long enough... we must try again... + User::Leave( KErrOverflow ); + } + + // Check that aInfoArray has not been modified + // while we waited server response + if ( aInfoArray->Count() != infoArrayElementCount ) + { + LOG_WRITEF( "aInfoArray data has changed %d != %d ", + aInfoArray->Count(), infoArrayElementCount ); + aInfoArray->Reset(); + } + + aInfoArray->AppendFromStreamBufferL( ptr ); + CleanupStack::PopAndDestroy( buffer ); + CleanupStack::PopAndDestroy( waiter ); + } + + +// --------------------------------------------------------------------------- +// RWsfSession::GetWlanListSize +// --------------------------------------------------------------------------- +// +EXPORT_C void RWsfSession::GetWlanListSize( TPckgBuf &aPckg, TRequestStatus& aStatus ) + { + LOG_ENTERFN("RWsfSession::GetWlanListSize"); + SendReceive( ESnifferCmdWlanDataSize, TIpcArgs( &aPckg ), aStatus ); + } + + +// --------------------------------------------------------------------------- +// RWsfSession::GetWlanList +// --------------------------------------------------------------------------- +// +EXPORT_C void RWsfSession::GetWlanList( TPckgBuf& aPckg, TPtr8& aPtr, TRequestStatus& aStatus ) + { + LOG_ENTERFN("RWsfSession::GetWlanList"); + SendReceive( ESnifferCmdGetWlanInfo, TIpcArgs( &aPckg, &aPtr ), aStatus ); + } + + +// --------------------------------------------------------------------------- +// RWsfSession::MonitorAccessPointL +// --------------------------------------------------------------------------- +// +EXPORT_C void RWsfSession::MonitorAccessPointL( TUint32 aMonitoredIap ) + { + LOG_ENTERFN("RWsfSession::MonitorAccessPointL"); + + TInt err = Send( ESnifferCmdMonitorAp, TIpcArgs( aMonitoredIap )); + LOG_WRITEF( "message[%d] call returned %d", ESnifferCmdMonitorAp, err ); + + User::LeaveIfError( err ); + } + + +// --------------------------------------------------------------------------- +// RWsfSession::RequestScanL +// --------------------------------------------------------------------------- +// +EXPORT_C TBool RWsfSession::RequestScanL() + { + LOG_ENTERFN("RWsfSession::RequestScanL"); + TPckgBuf pckg; + + CWsfActiveWaiter *waiter = CWsfActiveWaiter::NewL(); + CleanupStack::PushL( waiter ); + + SendReceive( ESnifferCmdRequestScan, TIpcArgs( &pckg ), waiter->iStatus ); + waiter->WaitForRequest(); + LOG_WRITEF( "message[%d] call returned %d", + ESnifferCmdRequestScan, + waiter->iStatus.Int() ); + User::LeaveIfError( waiter->iStatus.Int() ); + CleanupStack::PopAndDestroy( waiter ); + return pckg(); + } + + +// --------------------------------------------------------------------------- +// RWsfSession::RequestScan +// --------------------------------------------------------------------------- +// +EXPORT_C void RWsfSession::RequestScan(TPckgBuf& aPckg, TRequestStatus& aStatus ) + { + LOG_ENTERFN("RWsfSession::RequestScan"); + SendReceive( ESnifferCmdRequestScan, TIpcArgs( &aPckg ), aStatus ); + } + + +// --------------------------------------------------------------------------- +// RWsfSession::ConnectWlanBearerL +// --------------------------------------------------------------------------- +// +EXPORT_C TInt RWsfSession::ConnectWlanBearerL( TUint32 aIapId, + TBool aConnectOnly, + TWsfIapPersistence aPersistence ) + { + LOG_ENTERFN( "RWsfSession::ConnectWlanBearerL" ); + LOG_WRITEF( "IAP id = %d", aIapId ); + + // mark the beginning of the connection process + iEventHandler->UnBlockNextConnectedEvent(); + iEventHandler->SetConnecting( ETrue ); + + TInt res( KErrNone ); + TPckgBuf pckg; + + CWsfActiveWaiter *waiter = CWsfActiveWaiter::NewL(); + CleanupStack::PushL( waiter ); + + SendReceive( ESnifferCmdConnect, + TIpcArgs( &pckg, aIapId, aConnectOnly, aPersistence ), + waiter->iStatus ); + + waiter->WaitForRequest(); + LOG_WRITEF( "message[%d] call returned %d", + ESnifferCmdConnect, + waiter->iStatus.Int() ); + User::LeaveIfError( waiter->iStatus.Int() ); + CleanupStack::PopAndDestroy( waiter ); + + res = pckg(); + + if ( res != KErrNone ) + { + // on any error the flag should be cleared + iEventHandler->SetConnecting( EFalse ); + } + else + { + // otherwise we must wait until the connected signal arrives + iConnWaiter->Start(); + } + + if ( iConnectingResult ) + { + // the caller must know if the connecting process was cancelled + res = iConnectingResult; + iConnectingResult = KErrNone; + } + + return res; + } + + +// --------------------------------------------------------------------------- +// RWsfSession::ConnectWlanBearer +// --------------------------------------------------------------------------- +// +EXPORT_C void RWsfSession::ConnectWlanBearer( TPckgBuf& aPckg, + TUint32 aIapId, + TBool aConnectOnly, + TWsfIapPersistence aPersistence, + TRequestStatus& aStatus ) + { + LOG_ENTERFN( "RWsfSession::ConnectWlanBearer" ); + LOG_WRITEF( "IAP id = %d", aIapId ); + + // mark the beginning of the connection process + iEventHandler->UnBlockNextConnectedEvent(); + iEventHandler->SetConnecting( ETrue ); + + SendReceive( ESnifferCmdConnect, + TIpcArgs( &aPckg, aIapId, aConnectOnly, aPersistence ), + aStatus ); + } + + +// --------------------------------------------------------------------------- +// RWsfSession::SetConnectWlanBearerResult +// --------------------------------------------------------------------------- +// +EXPORT_C void RWsfSession::SetConnectWlanBearerResult( TInt aResult ) + { + LOG_ENTERFN( "RWsfSession::SetConnectWlanBearerResult" ); + LOG_WRITEF( "Result = %d", aResult ); + + if ( aResult != KErrNone ) + { + // on any error the flag should be cleared + iEventHandler->SetConnecting( EFalse ); + } + } + + +// --------------------------------------------------------------------------- +// RWsfSession::StopConnectingWait +// --------------------------------------------------------------------------- +// +void RWsfSession::StopConnectingWait() + { + LOG_ENTERFN( "RWsfSession::StopConnectingWait" ); + if ( iConnWaiter->IsStarted() ) + { + iConnWaiter->AsyncStop(); + } + } + + +// --------------------------------------------------------------------------- +// RWsfSession::DisconnectWlanBearerL +// --------------------------------------------------------------------------- +// +EXPORT_C TBool RWsfSession::DisconnectWlanBearerL() + { + LOG_ENTERFN("RWsfSession::DisconnectWlanBearerL"); + TBool res = 0; + TPckgBuf pckg; + + CWsfActiveWaiter *waiter = CWsfActiveWaiter::NewL(); + CleanupStack::PushL( waiter ); + + SendReceive( ESnifferCmdDisconnect, TIpcArgs( &pckg ), waiter->iStatus ); + waiter->WaitForRequest(); + LOG_WRITEF( "message[%d] call returned %d", + ESnifferCmdDisconnect, + waiter->iStatus.Int() ); + User::LeaveIfError( waiter->iStatus.Int() ); + + CleanupStack::PopAndDestroy( waiter ); + + res = pckg(); + return res; + } + + +// --------------------------------------------------------------------------- +// RWsfSession::DisconnectWlanBearer +// --------------------------------------------------------------------------- +// +EXPORT_C void RWsfSession::DisconnectWlanBearer( TPckgBuf& aPckg, TRequestStatus& aStatus ) + { + LOG_ENTERFN("RWsfSession::DisconnectWlanBearer"); + SendReceive( ESnifferCmdDisconnect, TIpcArgs( &aPckg ), aStatus ); + } + + +// --------------------------------------------------------------------------- +// RWsfSession::Close +// --------------------------------------------------------------------------- +// +EXPORT_C void RWsfSession::Close() + { + LOG_ENTERFN("RWsfSession::Close"); + delete iEventHandler; iEventHandler = NULL; + delete iConnWaiter; iConnWaiter = NULL; + + LOG_WRITE( "close session" ); + RSessionBase::Close(); + } + + +// --------------------------------------------------------------------------- +// RWsfSession::DoCancelNotifyEvent +// --------------------------------------------------------------------------- +// +void RWsfSession::DoCancelNotifyEvent() + { + LOG_ENTERFN("RWsfSession::DoCancelNotifyEvent"); + // used only by CWsfEventHandler + TInt err = Send( ESnifferCmdCancelNotifyEvents ); + LOG_WRITEF( "message[%d] call returned %d", + ESnifferCmdCancelNotifyEvents, err ); + } + + +// --------------------------------------------------------------------------- +// RWsfSession::CancelAll +// --------------------------------------------------------------------------- +// +void RWsfSession::CancelAll() + { + LOG_ENTERFN("RWsfSession::CancelAll"); + TInt err = Send( ESnifferCmdCancelAll ); + + LOG_WRITEF( "message[%d] call returned %d", ESnifferCmdCancelAll, err ); + } + + +// --------------------------------------------------------------------------- +// RWsfSession::IsConnectedL +// --------------------------------------------------------------------------- +// +EXPORT_C TBool RWsfSession::IsConnectedL() + { + LOG_ENTERFN("RWsfSession::IsConnectedL"); + TPckgBuf pckg; + + CWsfActiveWaiter *waiter = CWsfActiveWaiter::NewL(); + CleanupStack::PushL( waiter ); + + SendReceive( ESnifferCmdIsConnected, TIpcArgs( &pckg ), waiter->iStatus ); + waiter->WaitForRequest(); + LOG_WRITEF( "message[%d] call returned %d", + ESnifferCmdIsConnected, + waiter->iStatus.Int() ); + User::LeaveIfError( waiter->iStatus.Int() ); + CleanupStack::PopAndDestroy( waiter ); + + return pckg(); + } + + +// --------------------------------------------------------------------------- +// RWsfSession::RecoverFromServerTermination +// --------------------------------------------------------------------------- +// +TBool RWsfSession::RecoverFromServerTermination( + MWsfStateChangeObserver& aObserver ) + { + RSessionBase::Close(); + + TBool ret( EFalse ); + + ret = ( Connect() == KErrNone ); + if ( ret ) + { + TRAPD( err, NotifyEventL( aObserver ) ); + ret = ( err == KErrNone ); + } + + return ret; + } + + +// --------------------------------------------------------------------------- +// RWsfSession::AbortConnectingL +// --------------------------------------------------------------------------- +// +EXPORT_C void RWsfSession::AbortConnectingL() + { + LOG_ENTERFN("RWsfSession::AbortConnectingL"); + + if ( iEventHandler->Connecting() ) + { + iConnectingResult = KErrCancel; + iEventHandler->BlockNextConnectedEvent(); + + TInt err = Send( ESnifferCmdAbortConnecting ); + LOG_WRITEF( "message[%d] call returned %d", + ESnifferCmdAbortConnecting, err ); + + User::LeaveIfError( err ); + StopConnectingWait(); + } + + } + + +// --------------------------------------------------------------------------- +// RWsfSession::AbortScanningL +// --------------------------------------------------------------------------- +// +EXPORT_C void RWsfSession::AbortScanningL() + { + LOG_ENTERFN("RWsfSession::AbortScanningL"); + + TInt err = Send( ESnifferCmdAbortScanning ); + LOG_WRITEF( "message[%d] call returned %d", + ESnifferCmdAbortScanning, err ); + + User::LeaveIfError( err ); + } + + +// --------------------------------------------------------------------------- +// RWsfSession::SetIapPersistenceL +// --------------------------------------------------------------------------- +// +EXPORT_C TBool RWsfSession::SetIapPersistenceL( + TWsfIapPersistence aPersistence ) + { + LOG_ENTERFN("RWsfSession::SetIapPersistenceL"); + TPckgBuf ret( EFalse ); + + CWsfActiveWaiter *waiter = CWsfActiveWaiter::NewL(); + CleanupStack::PushL( waiter ); + + SendReceive( ESnifferCmdSetIapPersistence, TIpcArgs( &ret, aPersistence ), + waiter->iStatus ); + waiter->WaitForRequest(); + LOG_WRITEF( "message[%d] call returned %d", + ESnifferCmdSetIapPersistence, + waiter->iStatus.Int() ); + User::LeaveIfError( waiter->iStatus.Int() ); + CleanupStack::PopAndDestroy( waiter ); + + return ret(); + } + + +// --------------------------------------------------------------------------- +// RWsfSession::ControlDisconnectTimerL +// --------------------------------------------------------------------------- +// +EXPORT_C TBool RWsfSession::ControlDisconnectTimerL( TUint aAdcCommand ) + { + LOG_ENTERFN("RWsfSession::ControlDisconnectTimerL"); + + TPckgBuf ret( EFalse ); + + CWsfActiveWaiter *waiter = CWsfActiveWaiter::NewL(); + CleanupStack::PushL( waiter ); + + SendReceive( ESnifferCmdControlDisconnectTimer, + TIpcArgs( &ret, aAdcCommand ), + waiter->iStatus ); + + waiter->WaitForRequest(); + LOG_WRITEF( "message[%d] call returned %d", + ESnifferCmdControlDisconnectTimer, + waiter->iStatus.Int() ); + User::LeaveIfError( waiter->iStatus.Int() ); + CleanupStack::PopAndDestroy( waiter ); + + return ret(); + } + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 file for project Server +* +*/ + + +#include + + +PRJ_PLATFORMS +DEFAULT + + +PRJ_EXPORTS +../inc/wsfservercommon.h |../../inc/wsfservercommon.h +../inc/wsfcommon.h |../../../../inc/wsfcommon.h + +../rom/wsfserver.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wsfserver.iby) + + +PRJ_MMPFILES +server.mmp + + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/group/server.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/group/server.mmp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 project Server +* +*/ + + +#include +#include + + +TARGET wsfserver.exe +TARGETTYPE exe +UID 0x00000000 0x10281CAB + + +CAPABILITY ReadDeviceData NetworkServices NetworkControl ProtServ \ + ReadUserData WriteDeviceData WriteUserData + +EPOCSTACKSIZE 0x5000 + +// Source files +SOURCEPATH ../src +SOURCE wsfwlanscanner.cpp +SOURCE wsfengine.cpp +SOURCE wsfwlansettingsaccessor.cpp +SOURCE wsfserver.cpp +SOURCE wsfsession.cpp +SOURCE wsfservercloser.cpp +SOURCE wsfwlanbearerconnectionmonitor.cpp +SOURCE wsfactivewaiter.cpp +SOURCE wsfict.cpp + + +// own headers +USERINCLUDE ../inc + +// client-server common headers +USERINCLUDE ../../inc + +// inner API +USERINCLUDE ../../../inc + +// private API +USERINCLUDE ../../../../inc + + +//Macro to /epoc32 headers +MW_LAYER_SYSTEMINCLUDE + + +// Used system libraries +LIBRARY ws32.lib +LIBRARY apgrfx.lib +LIBRARY euser.lib +LIBRARY bafl.lib +LIBRARY estor.lib +LIBRARY ecom.lib +LIBRARY commsdat.lib +LIBRARY commdb.lib +LIBRARY cmmanagerdatabase.lib +LIBRARY cmmanager.lib +LIBRARY ictsclientinterface.lib + +LIBRARY esock.lib +LIBRARY charconv.lib +LIBRARY connmon.lib +LIBRARY wsfwlaninfo.lib +LIBRARY centralrepository.lib +LIBRARY FeatMgr.lib + +DEBUGLIBRARY flogger.lib + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/inc/wsfactivewaiter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/inc/wsfactivewaiter.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfActiveWaiter +* +*/ + + +#ifndef C_WSFACTIVEWAITER_H +#define C_WSFACTIVEWAITER_H + +// EXTERNAL INCLUDES +#include + + +// CLASS DEFINITION +/** + * CWsfActiveWaiter class, + * an active object to replace User::WaitForRequest() + * + * Usage: + * @code + * CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewL(); + * CleanupStack::PushL( waiter ); + * server.AsyncFunction( waiter->iStatus ); + * if ( waiter->WaitForRequest() == KErrNone ) + * { + * // handle success + * } + * else + * { + * // handle failure + * } + * CleanupStack::PopAndDestroy( waiter ); + * @endcode + * + * @lib wsfserver.exe + * @since S60 5.0 + */ +NONSHARABLE_CLASS( CWsfActiveWaiter ): public CActive + { + public: + /** + * Factory function + * @since S60 5.0 + * @return CWsfActiveWaiter instance. + */ + static CWsfActiveWaiter* NewL(); + + /** + * Factory function + * @since S60 5.0 + * @return CWsfActiveWaiter instance. + */ + static CWsfActiveWaiter* NewLC(); + + /** + * Destructor + * @since S60 5.0 + */ + virtual ~CWsfActiveWaiter(); + + protected: + /** + * Constructor + * @since S60 5.0 + */ + CWsfActiveWaiter(); + + /** + * Second-phase constructor. + * @since S60 5.0 + */ + void ConstructL(); + + protected: // from CActive + + /** + * Implements cancellation of an outstanding request. + * @since S60 5.0 + */ + void DoCancel(); + + /** + * Handles an active object's request completion event. + * @since S60 5.0 + */ + void RunL(); + + public: // new methods + /** + * Waits for its TRequestStatus to be completed + * @since S60 5.0 + * @return Error code returned from server after request is completed + */ + TInt WaitForRequest(); + + protected: // data + /** + * Nested waitloop + */ + CActiveSchedulerWait iWait; + }; + +#endif // C_WSFACTIVEWAITER_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/inc/wsfcommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/inc/wsfcommon.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 for common client-server constants and enums +* +*/ + + + +#ifndef WSFCOMMON_H +#define WSFCOMMON_H + +/** +* Possible values for the persistence property of monitored IAPs +*/ +enum TWsfIapPersistence + { + /** + * Default persistence value + */ + EIapDeleted, + + /** + * The IAP won't be deleted at all. + */ + EIapPersistent, + + /** + * There is an owned active connection whose IAP will be invalidated + * when a disconnect event occurs. + */ + EIapExpireOnDisconnect, + + /** + * There is an owned active connection being used by the browser. + * The IAP will be invalidated when a disconnect event occurs. + */ + EIapNestedExpireOnDisconnect, + + /** + * The IAP is invalidated only if the server is forced to terminate. + */ + EIapExpireOnShutdown, + + /** + * The IAP is invalidated when the browser exits or a disconnect occurs. + */ + EIapExpireOnBrowserExit, + + /** + * Transient state to mark the IAP as immediately invalidated + */ + EIapForcedExpiry + + }; + + +/** +* Possible values for the auto-disconnect timer control commands. +* Start/stop and Reset can be combined with usual bitfield operations. +*/ +enum TWsfAutoDisconnectCommand + { + /** + * Stops the timer but does not change its current value + */ + EAdcStopTimer = 0x0000, + + /** + * Starts the timer from its previous value + */ + EAdcStartTimer = 0x0001, + + /** + * Resets the value + */ + EAdcTimerReset = 0x0002 + }; + + + +#endif // WSFCOMMON_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/inc/wsfengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/inc/wsfengine.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,351 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfModel +* +*/ + + + +#ifndef C_WSFENGINE_H +#define C_WSFENGINE_H + +// EXTERNAL INCLUDES +#include +#include +#include + +// INTERNAL INCLUDES +#include "wsfwlanscannerobserver.h" +#include "wsfwlanmonitorobserver.h" +#include "wsfcommon.h" + + +// FORWARD DECLARATIONS +class CWsfWlanScanner; +class MWsfEngineObserver; +class CWsfWlanBearerConnectionMonitor; +class TWsfWlanInfo; +class MWsfServerCloserAdapter; + +// CLASS DEFINITION +/** + * Sniffer engine class. + * This class manages the objects responsible for connection creation, + * closing and monitoring, communication with the WLAN engine etc. + * + * @since S60 5.0 + * @lib wsfserver.exe + */ +NONSHARABLE_CLASS( CWsfEngine ): public CBase, + public MWsfWlanScannerObserver, + public MWsfWlanMonitorObserver + { + public: // Constructors and destructor + /** + * Factory function. + * @since S60 5.0 + * @param aServerCloser Reference to the server closer object. + * Ownership not passed. + * @return Server instance + */ + static CWsfEngine* NewL( MWsfServerCloserAdapter& aServerCloser ); + + /** + * Factory function. + * @since S60 5.0 + * @param aServerCloser Reference to the server closer object. + * Ownership not passed. + * @return Server instance + */ + static CWsfEngine* NewLC( MWsfServerCloserAdapter& aServerCloser ); + + /** + * Destructor + */ + ~CWsfEngine(); + + + private: // Constructors + /** + * Constructor + * @since S60 5.0 + * @param aServerCloser Reference to the server closer object. + * Ownership not passed. + */ + CWsfEngine( MWsfServerCloserAdapter& aServerCloser ); + + /** + * Second-phase constructor. + * @since S60 5.0 + */ + void ConstructL(); + + + public: // New methods + + /** + * Gets the result of complete wlan scan + * @since S60 5.0 + * @return Buffer pointer containing a serialized array of + * wlaninfo items + */ + HBufC8* GetScanResults(); + + /** + * Sets wlan scanning on + * @since S60 5.0 + */ + void EnableScanningL(); + + /** + * Sets wlan scanning off + * @since S60 5.0 + */ + void DisableScanningL(); + + /** + * Returns whether scanning is enabled + * @since S60 5.0 + * @return ETrue if scanning has been enabled, EFalse otherwise + */ + TBool IsScanning(); + + /** + * Checks if there is an active wlan connection and returns connection + * name (SSID) if appropriate. + * @since S60 5.0 + * @return The SSID of connected access point or empty descriptor + * if not connected + */ + HBufC* ConnectedWlanSsidL(); + + /** + * Fills the wlaninfo with the details of the active WLAN connection + * @since S60 5.0 + * @param aWlanInfo The wlaninfo record to be filled + * Ownership not passed. + * @return ETrue if success, EFalse on failure + */ + TBool ConnectedWlanConnectionDetailsL( TWsfWlanInfo& aWlanInfo ); + + /** + * Connects to the given IAP + * @since S60 5.0 + * @param aIapId The IAP to connect to + * @param aConnectOnly ETrue if Connect selected + * @param aPersistence Persistence property of the IAP + * @return KErrNone if successful, otherwise error code + */ + TInt ConnectWlanL( TUint32 aIapId, + TBool aConnectOnly, + TWsfIapPersistence aPersistence ); + + /** + * Disconnects the active WLAN connection + * @since S60 5.0 + * @return ETrue on success, EFalse if there was nothing to disconnect + */ + TBool DisconnectWlan(); + + /** + * Requests a wlan scan + * @since S60 5.0 + * @return ETrue if scanning is restarted + */ + TBool RefreshScanResults(); + + /** + * Requests the server to monitor an access point + * @since S60 5.0 + * @param aApId Access Point to be monitored + */ + void MonitorAccessPointL( TUint32 aApId ); + + /** + * Queries if there is an active WLAN connection. + * @since S60 5.0 + * @return ETrue if there is an active WLAN connection, + * EFalse otherwise. + */ + TBool IsConnected(); + + /** + * Aborts the currently ongoing connecting process + * @since S60 5.0 + */ + void AbortConnectingL(); + + /** + * Aborts the currently ongoing scanning process + * @since S60 5.0 + */ + void AbortScanning(); + + /** + * Sets the persistence property for the currently monitored IAP + * @since S60 5.0 + * @param aPersistence The value of the property + * @return ETrue on success + */ + TBool SetIapPersistenceL( TWsfIapPersistence aPersistence ); + + /** + * Controls the auto-disconnect timer in the server + * for owned connections + * @since S60 5.0 + * @param aAdcCommand Command for the timer, + * see TWsfAutoDisconnectCommand + * @return ETrue if the timer has been started (also if it had been + * started earlier), EFalse if the timer couldn't be started + * (e.g. because there is no owned connection). + */ + TBool ControlDisconnectTimer( TUint aAdcCommand ); + + /** + * Resets the iSuppressIapDeletion flag. + * @since S60 5.0 + */ + void ResetSuppressIapDeletion (); + + + public: // new methods + + /** + * Adds the given observer to the notification list + * @since S60 5.0 + * @param aObserver The observer to add. Ownership not passed. + */ + void AttachL( MWsfEngineObserver* aObserver ); + + /** + * Deletes the given observer from the notification list + * @since S60 5.0 + * @param aObserver The observer to remove. Ownership not passed. + */ + void Detach( MWsfEngineObserver* aObserver ); + + + protected: // from MWsfWlanScannerObserver + + /** + * When the scan cycle has completed this function is called to report + * the completion. + * @since S60 5.0 + */ + void WlanScanCompleteL(); + + /** + * Called when the scan cycle has started + * @since S60 5.0 + */ + void WlanScanStarted(); + + /** + * Called when an error occured while scanning wlan data + * @since S60 5.0 + * @param aError System wide error code + */ + void NotifyError( TInt aError ); + + + protected: // from MWsfWlanMonitorObserver + + /** + * Called when a wlan connection is established + * @since S60 5.0 + * @param aConnectionName WLAN connection name (SSID) + */ + virtual void ConnectionEstablishedL( const TDesC& aConnectionName ); + + /** + * Called when wlan connection has been lost + * @since S60 5.0 + */ + virtual void ConnectionLostL(); + + /** + * Called when the connection process failed for some reason + * @since S60 5.0 + * @param aError System wide error code + */ + virtual void ConnectingFailedL( TInt aError ); + + /** + * Called when the connection no longer needs the IAP it was using + * @since S60 5.0 + */ + virtual void ConnectedIapReleasedL(); + + + private: + + /** + * Tries to delete the corresponding IAP + * @since S60 5.0 + * @param aIapId The IAP to be deleted + */ + void DeleteIapL( TUint32 aIapId ); + + + private: // Data + /** + * Reference to the server closer (not owned) + */ + MWsfServerCloserAdapter& iServerCloser; + + /** + * WLAN scanner object (owned) + */ + CWsfWlanScanner* iScanner; + + /** + * Handle to the commsdat database (owned) + */ + CommsDat::CMDBSession* iDbSession; + + /** + * WLAN connection monitor object (owned) + */ + CWsfWlanBearerConnectionMonitor* iWlanBearerMonitor; + + /** + * Reference counter for scan enabling requests + */ + TInt iEnableScanning; + + /** + * Array of references to the observers of the engine + * (elements not owned) + */ + RPointerArray iObservers; + + /** + * Accesspoint to be monitored + */ + TUint32 iMonitoredIap; + + /** + * Indicates the persistence property of monitored IAP + */ + TWsfIapPersistence iIapPersistence; + + /** + * Indicates whether to postpone IAP deletion + */ + TBool iSuppressIapDeletion; + }; + +#endif // C_WSFENGINE_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/inc/wsfengineobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/inc/wsfengineobserver.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for MWsfEngineObserver +* +*/ + + + +#ifndef M_WSFENGINEOBSERVER_H +#define M_WSFENGINEOBSERVER_H + +// EXTERNAL INCLUDES +#include + + +// CLASS DEFINITION +/* +* Class acts as an interface for the CWsfEngine to be able to call back +* its clients in case of different events. +* +* @since S60 5.0 +*/ +class MWsfEngineObserver + { + public: // Abstract methods + + /** + * Called when the WLAN scanning is finished and results are available + * @since S60 5.0 + */ + virtual void WlanListChangedL() = 0; + + /** + * Called when an error occured in the engine + * @since S60 5.0 + * @param aError System wide error code + */ + virtual void NotifyErrorL( TInt aError ) = 0; + + /** + * Called when the WLAN scanning has been enabled + * @since S60 5.0 + */ + virtual void ScanEnabledL() = 0; + + /** + * Called when the WLAN scanning has been disabled + * @since S60 5.0 + */ + virtual void ScanDisabledL() = 0; + + /** + * Called when a WLAN connection has been established + * @since S60 5.0 + */ + virtual void ConnectedL() = 0; + + /** + * Called when the active WLAN connection has been terminated + * @since S60 5.0 + */ + virtual void DisconnectedL() = 0; + + /** + * Called when an error occured during the connecting process + * @since S60 5.0 + * @param aError System wide error code + */ + virtual void ConnectingFailedL( TInt aError ) = 0; + + }; + +#endif // M_WSFENGINEOBSERVER_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/inc/wsfict.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/inc/wsfict.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,142 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfIct +* +*/ + + + +#ifndef C_WSFICT_H +#define C_WSFICT_H + + +// EXTERNAL INCLUDES +#include +#include + + +// FORWARD DECLARATIONS + + +// CLASS DEFINITION +/** + * Class to monitor and control ICT interface + * + * @lib wsfserver.exe + * @since S60 5.2 + */ +NONSHARABLE_CLASS( CWsfIct ): public CBase, + public MIctsObserver + { + public: // Constructors and destructor + + /** + * Factory function. + * @since S60 5.2 + * @return CWsfIct instance + */ + IMPORT_C static CWsfIct* NewL(); + + /** + * Factory function. + * @since S60 5.2 + * @return CWsfIct instance + */ + IMPORT_C static CWsfIct* NewLC(); + + IMPORT_C ~CWsfIct(); + + private: // Constructors + CWsfIct(); + + /** + * Factory function. + * @since S60 5.2 + */ + void ConstructL(); + + public: // New methods + + /** + * Tests the connected WLAN access point + * @since S60 5.2 + * @param aIapId Id of the connection method + */ + void TestConnectedAccessPointL( TUint aIapId ); + + /** + * Initializes ICT parameters + * @since S60 5.2 + * @param ETrue if ICT needs to be executed + * @param aIapId Id of the connection method + * @param aConnectOnly ETrue if connect only case, + * EFalse if browser is launched after successful connection. + */ + void InitializeIctL( TBool aTestAccessPoint, + TUint aIapId, + TBool aConnectOnly ); + + public: // from MIctsObserver + + /** + * Called by ICTS during/after connectivity test + * @since S60 5.2 + * @param aResult Result code of the connectivity test + * @param aString Parameter to hold auxiliary data + */ + void ConnectivityObserver( TIctsTestResult aResult, const TDesC& aString ); + + + private: // New methods + + /** + * Starts WLAN Login application + * @param aString Contains redirect URL + */ + void LaunchWlanLoginL( const TDesC& aString ); + + /** + * Moves the IAP to internet SNAP + * @param aIapId Id of the connection method + */ + void MoveToInternetSnapL( const TUint32 aIapId ); + + + private: // Data + + /** + * Id of currently connected IAP (if applicable) + */ + TUint iIapId; + + /** + * Network id of currently connected IAP (if applicable) + */ + TUint iNetId; + + /** + * Indicates if "Connect" or "Start Web browsing" is selected. + */ + TBool iConnectOnly; + + /** + * ICT class. Owned. + */ + CIctsClientInterface* iIct; + + }; + +#endif // C_WSFICT_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/inc/wsfserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/inc/wsfserver.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,273 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfServer +* +*/ + + + +#ifndef C_WSFSERVER_H +#define C_WSFSERVER_H + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "wsfservercloseradapter.h" + + +// FORWARD DECLARATIONS +class CWsfEngine; +class CWsfSession; + + +// CLASS DEFINITION +/** +* CWsfServer is the server class that realises the necessary server functions +* +* @since S60 5.0 +* @lib wsfserver.exe +*/ +NONSHARABLE_CLASS( CWsfServer ): public CPolicyServer + { + private: + + /** + * CWsfServerCloser is an auxiliary class that is responsible for + * closing the server when there is no need for it any more + * + * @since S60 5.0 + * @lib wsfserver.exe + */ + NONSHARABLE_CLASS( CWsfServerCloser ): public CTimer, + public MWsfServerCloserAdapter + { + public: + /** + * Factory function. + * @since S60 5.0 + * @return Server closer instance + */ + static CWsfServerCloser* NewL(); + + /** + * Destructor. + */ + ~CWsfServerCloser(); + + public: // from MWsfServerCloserAdapter + + /** + * Sets whether the server closer should wait for the + * termination of the owned connection + * @since S60 5.0 + * @param aWait If ETrue, the server closer will wait. + */ + void WaitForOwnedConnection( TBool aWait ); + + /** + * Sets whether the server closer should wait for the + * termination of the browser + * @since S60 5.0 + * @param aWait If ETrue, the server closer will wait. + */ + void WaitForBrowserExit( TBool aWait ); + + /** + * Sets whether the server closer should wait for the + * clients of the owned connection to detach + * @since S60 5.0 + * @param aWait If ETrue, the server closer will wait. + */ + void WaitForClients( TBool aWait ); + + private: + + /** + * Constructor. + * @since S60 5.0 + */ + CWsfServerCloser(); + + /** + * Second-phase constructor. + * @since S60 5.0 + */ + void ConstructL(); + + + private: // from CActive + + /** + * Handles an active object's request completion event. + * @since S60 5.0 + */ + void RunL(); + + + private: // new methods + /** + * Start the closing timer + */ + void StartClosureWait(); + + private: + /** + * Indicates whether the server should wait for the owned + * connection to terminate. + */ + TBool iWaitForOwnedConnection; + + /** + * Indicates whether the server should wait for the browser + * to exit. + */ + TBool iWaitForBrowserExit; + + /** + * Indicates whether the server should wait for the clients + * of the owned connection to detach. + */ + TBool iWaitForClients; + }; + + public: // Constructors and destructor + /** + * Factory function. + * @since S60 5.0 + * @return Server instance + */ + static CWsfServer* NewLC(); + + /** + * Destructor. + * @since S60 5.0 + */ + ~CWsfServer(); + + private: // Constructors + /** + * Constructor + * @since S60 5.0 + * @param aPriority Active object priority value + */ + CWsfServer( TInt aPriority ); + + /** + * Second-phase constructor. + * @since S60 5.0 + */ + void ConstructL(); + + + private: // from CActive + /** + * Handles a leave occurring in RunL(). + * @since S60 5.0 + * @param aError Leave code + * @return aError + */ + TInt RunError( TInt aError ); + + + private: // from CPolicyServer + + /** + * Performs a custom security check for IPCs marked with + * TSpecialCase::ECustomCheck. + * @since S60 5.0 + * @param aMsg The message to check. + * @param aAction A reference to the action to take if the security + * check fails. + * @param aMissing A reference to the list of security attributes + * missing from the checked process + * @return The result of the security check + * (TCustomResult::EPass/TCustomResult::EFail). + */ + TCustomResult CustomSecurityCheckL( const RMessage2& aMsg, + TInt& aAction, + TSecurityInfo& aMissing ); + + public: // from CServer2 + + /** + * Creates a server-side session object. + * @since S60 5.0 + * @param aVersion The version information supplied by the client. + * @param aMessage Represents the details of the client request that is + * requesting the creation of the session. + * @return A pointer to the newly created server-side session object. + */ + CSession2 *NewSessionL( const TVersion& aVersion, + const RMessage2& /*aMessage*/) const; + + public: + /** + * The entry point for server startup. + * Creates the cleanupstack and continues to RunServerL + * @since S60 5.0 + * @return KErrNone if success, otherwise error code + */ + static TInt RunServer(); + + /** + * Reduce client count and start server shutdown sequence if no client + * sessions are available + * @since S60 5.0 + */ + void ClientRelease(); + + /** + * Increment the client count counter by one + * @since S60 5.0 + */ + void ClientAttach(); + + /** + * Returns pointer to the engine + * @since S60 5.0 + * @return Pointer to the engine object + */ + CWsfEngine* Engine(); + + private: + /** + * Creates active schduler and thread for server and start waiting for + * client requests + * @since S60 5.0 + */ + static void RunServerL(); + + + private: // Data + /** + * Sniffer engine instance (owned) + */ + CWsfEngine *iEngine; + + /** + * Server closer object (owned) + */ + CWsfServerCloser* iCloser; + + /** + * Number of currently attached clients + */ + TInt iClientCount; + + }; + + +#endif // C_WSFSERVER_H + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/inc/wsfservercloseradapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/inc/wsfservercloseradapter.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for MWsfServerCloserAdapter +* +*/ + + + + +#ifndef M_WSFSERVERCLOSERADAPTER_H +#define M_WSFSERVERCLOSERADAPTER_H + +// EXTERNAL INCLUDES +#include + + + +// CLASS DEFINITION +/** +* Class acts as an interface for the Sniffer server closer to let different +* parts of the engine modify the default closing behaviour. Basically, the +* functions set the appropriate semaphore in the server closer. +* +* @since S60 5.0 +*/ +class MWsfServerCloserAdapter + { + public: // Abstract methods + + /** + * Tells the server whether to shut down if there are no clients + * connected to it. + * @since S60 5.0 + * @param aWait If ETrue, the server must wait for the clients to + * disconnect first before closing up. + */ + virtual void WaitForClients( TBool aWait ) = 0; + + /** + * Tells the server whether to shut down while there is an owned + * connection open. + * @since S60 5.0 + * @param aWait If ETrue, the server must wait for the connection to + * terminate first before closing up. + */ + virtual void WaitForOwnedConnection( TBool aWait ) = 0; + + /** + * Tells the server whether to shut down while there is an IAP + * whose deletion is the server's responsibility. + * @since S60 5.0 + * @param aWait If ETrue, the server must wait for the IAP to be + * deleted first before closing up. + */ + virtual void WaitForBrowserExit( TBool aWait ) = 0; + + }; + + +#endif // M_WSFSERVERCLOSERADAPTER_H + +// End of file + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/inc/wsfservercommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/inc/wsfservercommon.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,235 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 for common client-server constants and enums +* +*/ + + + + +#ifndef WSFSERVERCOMMON_H +#define WSFSERVERCOMMON_H + + +#include + +/** +* Published name of the sniffer server +*/ +_LIT( KWlanSnifferServerName, "WlanSnifferServer" ); + +/** +* Filename of the server binary +*/ +_LIT( KWlanSnifferServerExe, "wsfserver.exe" ); + +/** +* Version numbers for the sniffer server +*/ +const TUint KWlanSnifferServerMajor = 1; +const TUint KWlanSnifferServerMinor = 0; +const TUint KWlanSnifferServerBuild = 0; + + +/** +* IPC commands recognised by the sniffer server +*/ +enum TWsfWlanSnifferCmds + { + /** + * Asks for the size of the scan results in bytes + */ + ESnifferCmdWlanDataSize, + + /** + * Asks to be notified of server events + */ + ESnifferCmdNotifyEvents, + + /** + * Asks to cancel notifications + */ + ESnifferCmdCancelNotifyEvents, + + /** + * Asks for the wlan scan results + */ + ESnifferCmdGetWlanInfo, + + /** + * Asks to create a connection + */ + ESnifferCmdConnect, + + /** + * Asks to disconnect the current connection + */ + ESnifferCmdDisconnect, + + /** + * Asks to start scanning for WLAN networks + */ + ESnifferCmdActivateScan, + + /** + * Asks to disable WLAN scanning + */ + ESnifferCmdDisableScan, + + /** + * Asks for the name of the active WLAN connection + */ + ESnifferCmdConnectionName, + + /** + * Asks to cancel every operation + */ + ESnifferCmdCancelAll, + + /** + * Asks explicitly for an immediate scan + */ + ESnifferCmdRequestScan, + + /** + * Asks to monitor the given IAP + */ + ESnifferCmdMonitorAp, + + /** + * Queries the scanning status + */ + ESnifferCmdIsScanEnabled, + + /** + * Queries the connection status + */ + ESnifferCmdIsConnected, + + /** + * Queries the details of the active WLAN connection + */ + ESnifferCmdConnectedDetails, + + /** + * Aborts the ongoing scanning + */ + ESnifferCmdAbortScanning, + + /** + * Aborts the ongoing connection process + */ + ESnifferCmdAbortConnecting, + + /** + * Sets the persistence property of the currently monitored IAP + */ + ESnifferCmdSetIapPersistence, + + /** + * Sets the behaviour of the auto-disconnect timer + */ + ESnifferCmdControlDisconnectTimer + }; + + + +/** +* Structure for passing back the active connection name +*/ +class TWsfQueryConnectedAccount + { + public: + /** + * Maximal length of IAP name that the class should be able to store + */ + static const TInt KWlanNameMaxLength = 50; + + public: + /** + * Indicates whether there was a connection + */ + TBool iConnected; + + /** + * Name of the active WLAN connection + */ + TBuf iConnectedAccountName; + + }; + + +/** +* Events in the server that clients are notified of +*/ +enum TWsfEngineEvent + { + /** + * There is a new scan result available. + */ + EEngineWlanDataChanged, + + /** + * Notifies that scanning has been disabled + */ + EEngineScanDisabled, + + /** + * Notifies that scanning has been enabled + */ + EEngineScanEnabled, + + /** + * Notifies that a WLAN connection has been established + */ + EEngineConnected, + + /** + * Notifies that the active connection was disconnected + */ + EEngineDisconnected, + + /** + * Notifies that an error occured in the server + */ + EEngineError, + + /** + * Notifies that the connecting process failed for some reason + */ + EEngineConnectingFailed + }; + + +/** +* Data structure for client notification +*/ +class TWsfNotifyEventContainer + { + public: + /** + * Server event + */ + TWsfEngineEvent iEvent; + + /** + * Error code + */ + TInt iError; + }; + + + + +#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/inc/wsfsession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/inc/wsfsession.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,323 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfSession +* +*/ + + + +#ifndef C_WSFSESSION_H +#define C_WSFSESSION_H + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "wsfengineobserver.h" +#include "wsfservercommon.h" + + +// FORWARD DECLARATIONS +class CWsfServer; + +// CLASS DEFINITION +/** + * Server-side session class. + * This class is instantiated and used each time a client connects to the + * sniffer server. + * + * @since S60 5.0 + * @lib wsfserver.exe + */ +NONSHARABLE_CLASS( CWsfSession ): public CSession2, + public MWsfEngineObserver + { + public: // Construction and destruction + + /** + * Factory function. + * @since S60 5.0 + * @param aServer Reference to the server object. Ownership not passed. + * @return Session instance + */ + static CWsfSession* NewL( CWsfServer& aServer ); + + /** + * Destructor. + */ + ~CWsfSession(); + + private: + /** + * Constructor + * @since S60 5.0 + * @param aServer Reference to the server object. Ownership not passed. + */ + CWsfSession( CWsfServer& aServer ); + + /** + * Second-phase constructor. + * @since S60 5.0 + */ + void ConstructL(); + + + public: // from CSession2 + /** + * Handles the servicing of a client request that has been passed to + * the server. + * @since S60 5.0 + * @param aMessage The message containing the details of the + * client request + */ + void ServiceL( const RMessage2& aMessage ); + + + public: // new functions + /** + * Handles messages by reading the function id and passing + * the request forward. + * @since S60 5.0 + * @param aMessage The received message containing function and + * descriptors. + */ + void DispatchMessageL( const RMessage2& aMessage ); + + + private: // new functions + /** + * Returns whether wlan scanning is scheduled at the moment + * @since S60 5.0 + * @param aMessage The message to process + * @return ETrue if active or efalse. + */ + TBool ScanActiveL( const RMessage2& aMessage ); + + /** + * Enables the engine scanning + * @since S60 5.0 + */ + void ActivateScanL(); + + /** + * Disables the engine scanning + * @since S60 5.0 + */ + void DisableScanL(); + + /** + * Returns the wlan bearer status + * @since S60 5.0 + * @param aMessage The message to process + */ + void IsConnectedL( const RMessage2& aMessage ); + + /** + * Activates asynchronous request to engine events + * @since S60 5.0 + * @param aMessage The message to process + */ + void RequestNotifyL( const RMessage2& aMessage ); + + /** + * Cancels pending notify request + * @since S60 5.0 + */ + void CancelNotifyEvents(); + + /** + * Cancels all pending tasks + * @since S60 5.0 + */ + void CancelPendingTasks(); + + /** + * Gets the connected wlan connection name + * @since S60 5.0 + * @param aMessage The message to process + */ + void GetConnectedAccountNameL( const RMessage2& aMessage ); + + /** + * Gets the connected wlan's details in a TWsfWlanInfo + * @since S60 5.0 + * @param aMessage The message to process + */ + void GetConnectedDetailsL( const RMessage2& aMessage ); + + /** + * Checks the required buffer size for serialized wlan data + * @since S60 5.0 + * @param aMessage The message to process + */ + void ReplyWlanDataSizeL( const RMessage2& aMessage ); + + /** + * Copies serialized wlan data + * @since S60 5.0 + * @param aMessage The message to process + */ + void WriteWlanDataL( const RMessage2& aMessage ); + + /** + * Passes connect wlan commands to engine + * @since S60 5.0 + * @param aMessage The message to process + */ + void ConnectWlanL( const RMessage2& aMessage ); + + /** + * Passes disconnect wlan commands to engine + * @since S60 5.0 + * @param aMessage The message to process + */ + void DisconnectWlanL( const RMessage2& aMessage ); + + /** + * Request the engine to scan asap + * @since S60 5.0 + * @param aMessage The message to process + */ + void RequestScanL( const RMessage2& aMessage ); + + /** + * Starts to monitor UI defined AP + * @since S60 5.0 + * @param aMessage The message to process + */ + void MonitorApL( const RMessage2& aMessage ); + + /** + * Aborts the currently ongoing connecting process + * @since S60 5.0 + */ + void AbortConnectingL(); + + /** + * Aborts the currently ongoing scanning process + * @since S60 5.0 + */ + void AbortScanning(); + + /** + * Sets the persistence property for the currently monitored IAP + * @param aMessage The message to process + * @since S60 5.0 + */ + void SetIapPersistenceL( const RMessage2& aMessage ); + + /** + * Controls the auto-disconnect timer in the server + * for owned connections + * @since S60 5.0 + * @param aMessage The message to process + */ + void ControlDisconnectTimerL( const RMessage2& aMessage ); + + /** + * Returns whether scanning is enabled + * @since S60 5.0 + * @param aMessage The message to process + */ + void ReplyIsScanningL( const RMessage2& aMessage ); + + + public: // from MWsfEngineObserver + /** + * Called when the WLAN scanning is finished and results are available + * @since S60 5.0 + */ + void WlanListChangedL(); + + /** + * Called when an error occured in the engine + * @since S60 5.0 + * @param aError System wide error code + */ + void NotifyErrorL( TInt aError ); + + /** + * Called when the WLAN scanning has been enabled + * @since S60 5.0 + */ + void ScanEnabledL(); + + /** + * Called when the WLAN scanning has been disabled + * @since S60 5.0 + */ + void ScanDisabledL(); + + /** + * Called when a WLAN connection has been established + * @since S60 5.0 + */ + void ConnectedL(); + + /** + * Called when the active WLAN connection has been terminated + * @since S60 5.0 + */ + void DisconnectedL(); + + /** + * Called when an error occured during the connecting process + * @since S60 5.0 + * @param aError System wide error code + */ + void ConnectingFailedL( TInt aError ); + + + private: // new methods + /** + * Notifies the client of the next server event in the event queue + * @since S60 5.0 + */ + void NotifyClientL(); + + + private: // data + /** + * Reference to the server object (not owned) + */ + CWsfServer& iServer; + + /** + * Indicates if notification has been requested + */ + TBool iRequestNotify; + + /** + * Client message to complete when notifying + */ + RMessage2 iNotifyChangesMessage; + + /** + * Queue of server events + */ + RArray iEventQueue; + + /** + * Indicates whether scanning is enabled + */ + TBool iEnabledScanning; + + /** + * Indicates if an event is being processed + */ + TBool iProcessingEvent; + }; + +#endif // C_WSFSESSION_H + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/inc/wsfwlanbearerconnectionmonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/inc/wsfwlanbearerconnectionmonitor.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,419 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfWlanBearerConnectionMonitor +* +*/ + + + +#ifndef C_WSFWLANBEARERCONNECTIONMONITOR_H +#define C_WSFWLANBEARERCONNECTIONMONITOR_H + + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include "wsfwlaninfo.h" +#include "wsfwlanconnectiondetailsprovider.h" + + +// FORWARD DECLARATIONS +class MWsfWlanMonitorObserver; +class MWsfServerCloserAdapter; +class CWsfIct; + + +// CLASS DEFINITION +/** + * Class to monitor and control all WLAN bearer related events and actions + * + * @since S60 5.0 + * @lib wsfserver.exe + */ +NONSHARABLE_CLASS( CWsfWlanBearerConnectionMonitor ): public CActive, + public MConnectionMonitorObserver, + public MWsfWlanConnectionDetailsProvider + { + private: + /** + * Connecting states when creating an owned connection + */ + enum TWsfConnectingState + { + /** + * Not connected, neither requested + */ + ECsIdle, + + /** + * Requested to connect + */ + ECsNotConnected, + + /** + * Socket server and connection handler opened + */ + ECsSocketOpened, + + /** + * Connection has been established + */ + ECsConnectionCreated, + + /** + * Connection environment fully initialized + */ + ECsConnected + }; + + + public: // Constructors and destructor + /** + * Factory function. + * @since S60 5.0 + * @param aServerCloser Reference to the server closer object. + * Ownership not passed. + * @return Class instance + */ + static CWsfWlanBearerConnectionMonitor* NewL( + MWsfServerCloserAdapter& aServerCloser ); + + /** + * Factory function. + * @since S60 5.0 + * @param aServerCloser Reference to the server closer object. + * Ownership not passed. + * @return Class instance + */ + static CWsfWlanBearerConnectionMonitor* NewLC( + MWsfServerCloserAdapter& aServerCloser ); + + /** + * Destructor. + */ + ~CWsfWlanBearerConnectionMonitor(); + + private: // Constructors + /** + * Constructor + * @since S60 5.0 + * @param aServerCloser Reference to the server closer object. + * Ownership not passed. + */ + CWsfWlanBearerConnectionMonitor( + MWsfServerCloserAdapter& aServerCloser ); + + /** + * Second-phase constructor. + * @since S60 5.0 + */ + void ConstructL(); + + public: // New methods + + /** + * Returns the name of the active wlan connection + * @since S60 5.0 + * @return Connection name or KNullDesC if not connected + */ + const TDesC& GetWlanBearerNameL(); + + /* + * Starts monitoring WLAN events through the given observer + * @since S60 5.0 + * @param aObserver The object to use for monitoring. Ownership + * not passed. + */ + void StartMonitoringL( MWsfWlanMonitorObserver* aObserver ); + + /* + * Stops monitoring WLAN events + * @since S60 5.0 + */ + void StopMonitoring(); + + /* + * Connects to the given IAP + * @since S60 5.0 + * @param aIapId WLAN IAP id to connect to. + * @param aConnectOnly ETrue if Connect selected + * @param aTestAccessPoint ETrue if accesspoint needs testing + * @return KErrNone on success, error code otherwise + */ + TInt ConnectBearer( TUint32 aIapId, + TBool aConnectOnly, + TBool aTestAccessPoint ); + + /* + * Disconnects active connection + * @since S60 5.0 + * @return ETrue if the was something to disconnect otherwise EFalse + */ + TBool DisconnectBearer(); + + /** + * Starts to monitor Access Point + * @since S60 5.0 + * @param aIapId Access point to be monitored + */ + void MonitorAccessPoint( TUint32 aIapId ); + + /** + * Queries if there is an active WLAN connection. + * @since S60 5.0 + * @return ETrue if there is an active WLAN connection, + * EFalse otherwise. + */ + TBool IsConnected(); + + /** + * Aborts the currently ongoing connecting process + * @since S60 5.0 + * @return KErrNone on success, error code otherwise + */ + TInt AbortConnecting(); + + /** + * Controls the auto-disconnect timer in the server + * for owned connections + * @since S60 5.0 + * @param aAdcCommand Command for the timer, + * see TWsfAutoDisconnectCommand + * @return ETrue if the timer has been started (also if it had been + * started earlier), EFalse if the timer couldn't be started + * (e.g. because there is no owned connection). + */ + TBool ControlDisconnectTimer( TUint aAdcCommand ); + + + private: // From CActive + /** + * Implements cancellation of an outstanding request. + * @since S60 5.0 + */ + void DoCancel(); + + /** + * Handles an active object's request completion event. + * @since S60 5.0 + */ + void RunL(); + + /** + * Handles a leave occurring in RunL(). + * @since S60 5.0 + * @param aError Leave code + * @return aError + */ + TInt RunError( TInt aError ); + + + protected: // From MConnectionMonitorObserver + + /** + * Event method is called every time an event occures. + * @since S60 5.0 + * @param aConnMonEvent The event information. + */ + void EventL( const CConnMonEventBase& aConnMonEvent ); + + + public: // from MWsfWlanConnectionDetailsProvider + + /** + * Fills TWsfWlanInfo with the connected wlan's properties + * @since S60 5.0 + * @param aWlanInfo The wlaninfo structure to be filled + * @return ETrue if there is a connection and returned data is valid, + * EFalse otherwise + */ + TBool ConnectedWlanConnectionDetailsL( TWsfWlanInfo* aWlanInfo ); + + + private: // New methods + + /** + * Loops through the list of current connections and searches for one + * with wlan bearer + * @since S60 5.0 + */ + void FindWlanBearerConnectedL(); + + /** + * Checks connection details and retrieves WLAN connection name + * @since S60 5.0 + * @param aConnectionId The connection in question + * @return ETrue on success (WLAN connection was found), + * EFalse otherwise + */ + TBool CheckConnectionDetailsL( TUint aConnectionId ); + + /** + * Shuts down the owned connection + * @since S60 5.0 + */ + void ShutdownOwnedConnectionL(); + + /** + * Cleanup function to release the shutdown mutex if shutdown leaves + * @since S60 5.0 + * @param aPtr Pointer for this class + */ + static void ReleaseShutdownMutex( TAny* aPtr ); + + /** + * Callback for CPeriodic to check the client count and + * start inactivity timer if needed. + * @since S60 5.0 + * @param aPtr Pointer for this class + * @return KErrNone if successful, system-wide error code otherwise. + */ + static TInt CheckClientCount( TAny* aPtr ); + + /** + * Function that does actual processing in checking the client count. + * Called by CheckClientCount(). + * @since S60 5.0 + */ + void CheckClientCountL(); + + + private: // Data + + /** + * Reference to the observer of this class (not owned) + */ + MWsfWlanMonitorObserver* iObserver; + + /** + * Handle to the connection monitor + */ + RConnectionMonitor iMonitor; + + /** + * Name of the currently active WLAN connection + */ + TBuf iWlanNetworkName; + + /** + * Id of the currently active WLAN connection + */ + TInt iConnectionId; + + /** + * Indicates whether connection monitoring is on + */ + TBool iMonitoring; + + /** + * The access point to be monitored + */ + TUint32 iMonitoredAp; + + /** + * Handle to the socket server for making a connection + */ + RSocketServ iSocketServ; + + /** + * Handle to the owned connection + */ + RConnection iConnection; + + /** + * Indicates whether the connection was initiated from within Sniffer + */ + TBool iConnectionOwned; + + /** + * Default connection settings before creating an own connection + */ + TCmDefConnValue iOriginalDefConn; + + /** + * Default connection settings after the owned connection has been + * established + */ + TCmDefConnValue iCurrentDefConn; + + /** + * Periodic polling for connection client count + */ + CPeriodic* iClientPoll; + + /** + * Indicates whether timer-based auto-disconnect is enabled + */ + TBool iAutoDisconnect; + + /** + * Count of clients using the connection + */ + TInt iClientCount; + + /** + * Timer to measure time elapsed without activity + */ + TTime iInactivityStart; + + /** + * Status of currently ongoing connecting process + */ + TWsfConnectingState iConnectingState; + + /** + * IAP id to connect to. Used by the connecting active object. + */ + TUint32 iConnIap; + + /** + * Indicates whether the connection is being aborted + */ + TBool iAborting; + + /** + * Asserts that the shutdown process is not reentered + */ + TBool iShutdownMutex; + + /** + * Asserts that the client counting process is not reentered + */ + TBool iClientCountMutex; + + /** + * Handle to the CmManager + */ + RCmManagerExt iCmMgr; + + /** + * Reference to the server closer (not owned) + */ + MWsfServerCloserAdapter& iServerCloser; + + /** + * Reference to ICT handler + */ + CWsfIct* iIct; + + }; + + +#endif // C_WSFWLANBEARERCONNECTIONMONITOR_H + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/inc/wsfwlanconnectiondetailsprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/inc/wsfwlanconnectiondetailsprovider.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for MWsfWlanConnectionDetailsProvider +* +*/ + + + +#ifndef M_WSFWLANCONNECTIONDETAILSPROVIDER_H +#define M_WSFWLANCONNECTIONDETAILSPROVIDER_H + + +// EXTERNAL INCLUDES +#include + + +// FORWARD DECLARATIONS +class TWsfWlanInfo; + + +// CLASS DEFINITION +/** +* Class acts as an interface to the WLAN bearer monitor to let different +* parts of the engine query the properties of the current WLAN connection. +* +* @since S60 5.0 +*/ +class MWsfWlanConnectionDetailsProvider + { + public: // Abstract methods + + /** + * Fills TWsfWlanInfo with the connected wlan's properties + * @since S60 5.0 + * @param aWlanInfo The wlaninfo structure to be filled + * @return ETrue if there is a connection and returned data is valid, + * EFalse otherwise + */ + virtual TBool ConnectedWlanConnectionDetailsL( + TWsfWlanInfo* aWlanInfo ) = 0; + + /** + * Queries if there is an active WLAN connection. + * @since S60 5.2 + * @return ETrue if there is an active WLAN connection, + * EFalse otherwise. + */ + virtual TBool IsConnected() = 0; + + }; + +#endif // M_WSFWLANCONNECTIONDETAILSPROVIDER_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/inc/wsfwlanmonitorobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/inc/wsfwlanmonitorobserver.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for MWsfWlanMonitorObserver +* +*/ + + + +#ifndef M_WSFWLANMONITOROBSERVER_H +#define M_WSFWLANMONITOROBSERVER_H + + +// EXTERNAL INCLUDES +#include + + +// CLASS DEFINITION +/** + * Abstact interface definition class for wlan connection detection + * @since S60 5.0 + */ +class MWsfWlanMonitorObserver + { + public: // Abstract methods + + /** + * Called when a wlan connection is established + * @since S60 5.0 + * @param aConnectionName WLAN connection name (SSID) + */ + virtual void ConnectionEstablishedL( + const TDesC& aConnectionName ) = 0; + + /** + * Called when wlan connection has been lost + * @since S60 5.0 + */ + virtual void ConnectionLostL() = 0; + + /** + * Called when the connection process failed for some reason + * @since S60 5.0 + * @param aError System wide error code + */ + virtual void ConnectingFailedL( TInt aError ) = 0; + + /** + * Called when the connection no longer needs the IAP it was using + * @since S60 5.0 + */ + virtual void ConnectedIapReleasedL() = 0; + + }; + + +#endif // M_WSFWLANMONITOROBSERVER_H + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/inc/wsfwlanscaninfodefines.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/inc/wsfwlanscaninfodefines.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 for WLAN scaninfo related constants and enums +* +*/ + + + +#ifndef WSFWLANSCANINFODEFINES_H +#define WSFWLANSCANINFODEFINES_H + +/** +* Maximal number of data rate types +*/ +const TUint8 KMaxNumberOfRates = 8; + +/** +* Bit masks for Capability Information field. +* (from \S60\osext\wlan\wlanldd\wlan_common\umac_common\inc\802dot11.h) +*/ +enum TWsf802Dot11CapabilityBitMask + { + E802Dot11CapabilityEssMask = 0x0001, + E802Dot11CapabilityIbssMask = 0x0002, + E802Dot11CapabilityCfPollableMask = 0x0004, + E802Dot11CapabilityCfPollRequestMask= 0x0008, + E802Dot11CapabilityPrivacyMask = 0x0010, + // these little critters are from 802.11b spec + E802Dot11ShortPreambleMask = 0x0020, + E802Dot11PbccMask = 0x0040, + E802Dot11ChannelAgilityMask = 0x0080 + }; + +/** +* Management frame information element IDs. +* (from \S60\osext\wlan\wlanldd\wlan_common\umac_common\inc\802dot11.h) +*/ +enum TWsf802Dot11InformationElementID + { + E802Dot11SsidIE = 0, + E802Dot11SupportedRatesIE = 1, + E802Doi11FhParameterSetIE = 2, + E802Dot11DsParameterSetIE = 3, + E802Dot11CfParameterSetIE = 4, + E802Dot11TimIE = 5, + E802Dot11IbssParameterSetIE = 6, + E802Dot11CountryIE = 7, + E802Dot11HoppingPatternParamIE = 8, + E802Dot11HoppingPatternTableIE = 9, + E802Dot11RequestIE = 10, + + E802Dot11ChallengeTextIE = 16, + // Reserved for challenge text extension 17 - 31 + E802Dot11ErpInformationIE = 42, + E802Dot11HtCapabilitiesIE = 45, + E802Dot11ExtendedRatesIE = 50, + E802Dot11AironetIE = 133, + E802Dot11ApIpAddressIE = 149, + E802Dot11RsnIE = 221 + }; + + +#endif // WSFWLANSCANINFODEFINES_H + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/inc/wsfwlanscanintervalchangeobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/inc/wsfwlanscanintervalchangeobserver.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for MWsfWlanScanIntervalChangeObserver +* +*/ + + +#ifndef M_WSFWLANSCANINTERVALCHANGEOBSERVER_H +#define M_WSFWLANSCANINTERVALCHANGEOBSERVER_H + +// EXTERNAL INCLUDES +#include + +// CLASS DEFINITION +/** +* Class acts as an interface for the class monitoring the background scan +* interval to notify its clients of changes in that property. +* +* @since S60 5.0 +*/ +class MWsfWlanScanIntervalChangeObserver + { + public: // Abstract methods + /** + * Called when the value of the background scan interval or the + * show availability flag has been changed + * @since S60 5.0 + * @param aNewScanInterval The new value for the scan interval + * @param aShowAvailability The new value for the + * Show WLAN availability flag + */ + virtual void WlanScanIntervalChangedL( TUint aNewScanInterval, + TBool aShowAvailability ) = 0; + + }; + +#endif // M_WSFWLANSCANINTERVALCHANGEOBSERVER_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/inc/wsfwlanscanner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/inc/wsfwlanscanner.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,604 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfWlanScanner +* +*/ + + + +#ifndef C_WSFWLANSCANNER_H +#define C_WSFWLANSCANNER_H + +// EXTERNAL INCLUDES +#include +#include +#include +#include + + + +// INTERNAL INCLUDES +#include "wsfwlanscannerobserver.h" +#include "wsfwlanmonitorobserver.h" +#include "wsfwlanscanintervalchangeobserver.h" +#include "wsfwlaninfo.h" + + +const TUint8 TX_RATE_BASIC_MASK = 0x80; + + +/** + * Defines the possible TX rate values. + */ +typedef enum _core_tx_rate_e + { + core_tx_rate_none = 0x00000000, + core_tx_rate_1mbit = 0x00000001, + core_tx_rate_2mbit = 0x00000002, + core_tx_rate_5p5mbit = 0x00000004, + core_tx_rate_6mbit = 0x00000008, + core_tx_rate_9mbit = 0x00000010, + core_tx_rate_11mbit = 0x00000020, + core_tx_rate_12mbit = 0x00000040, + core_tx_rate_18mbit = 0x00000080, + core_tx_rate_22mbit = 0x00000100, + core_tx_rate_24mbit = 0x00000200, + core_tx_rate_33mbit = 0x00000400, + core_tx_rate_36mbit = 0x00000800, + core_tx_rate_48mbit = 0x00001000, + core_tx_rate_54mbit = 0x00002000 + } core_tx_rate_e; + +const TUint32 CORE_TX_RATES_802P11B = + core_tx_rate_1mbit | + core_tx_rate_2mbit | + core_tx_rate_5p5mbit | + core_tx_rate_11mbit; + +const TUint32 CORE_TX_RATES_802P11G = + core_tx_rate_6mbit | + core_tx_rate_9mbit | + core_tx_rate_12mbit | + core_tx_rate_18mbit | + core_tx_rate_22mbit | + core_tx_rate_24mbit | + core_tx_rate_33mbit | + core_tx_rate_36mbit | + core_tx_rate_48mbit | + core_tx_rate_54mbit; + +/** + * Define the possible TX rate value as units of 500kbit/s. + */ +typedef enum _core_tx_rate_value_e + { + core_tx_rate_value_none = 0, + core_tx_rate_value_1mbit = 2, + core_tx_rate_value_2mbit = 4, + core_tx_rate_value_5p5mbit = 11, + core_tx_rate_value_6mbit = 12, + core_tx_rate_value_9mbit = 18, + core_tx_rate_value_11mbit = 22, + core_tx_rate_value_12mbit = 24, + core_tx_rate_value_18mbit = 36, + core_tx_rate_value_22mbit = 44, + core_tx_rate_value_24mbit = 48, + core_tx_rate_value_33mbit = 66, + core_tx_rate_value_36mbit = 72, + core_tx_rate_value_48mbit = 96, + core_tx_rate_value_54mbit = 108, + } _core_tx_rate_value_e; + + +// FORWARD DECLARATIONS +class CWlanMgmtClient; +class CWlanScanInfo; +class CWsfWlanSettingsAccessor; +class CWsfWlanInfoArray; +class TWsfWlanInfo; +class MWsfWlanConnectionDetailsProvider; +class MWsfKnownIapRecognizer; + + +// CLASS DEFINITION +/** + * Class to schedule WLAN scanning and process the resultant data + * + * @since S60 5.0 + * @lib wsfserver.exe + */ +NONSHARABLE_CLASS( CWsfWlanScanner ): public CActive, + public MWlanMgmtNotifications, + public MWsfWlanMonitorObserver, + public MWsfWlanScanIntervalChangeObserver + { + private: // Type definitions + + /** + * States of the scanning process + */ + enum TWsfScanState + { + /** + * Not scanning but scheduled + */ + EIdle, + + /** + * Do broadcast scan + */ + EBroadcastScan, + + /** + * Processing broadcast scan results + */ + EProcessBroadcastScan, + + /** + * Processing direct scan results + */ + EDirectScan, + + /** + * Scanning finished, cleanup and notification + */ + EFinished + }; + + public: // Constructors and destructor + + /** + * Factory function. + * @since S60 5.0 + * @param aDbSession Reference to the database session to use + * @return Class instance + */ + static CWsfWlanScanner* NewL( CommsDat::CMDBSession& aDbSession ); + + /** + * Factory function. + * @since S60 5.0 + * @param aDbSession Reference to the database session to use + * @return Class instance + */ + static CWsfWlanScanner* NewLC( CommsDat::CMDBSession& aDbSession ); + + /** + * Destructor. + */ + ~CWsfWlanScanner(); + + + private: // Constructors + + /** + * Constructor + * @since S60 5.0 + * @param aDbSession Reference to the database session to use + */ + CWsfWlanScanner( CommsDat::CMDBSession& aSession ); + + /** + * Second-phase constructor. + * @since S60 5.0 + */ + void ConstructL(); + + + public: // New methods + /** + * Sets the observer of this class + * @since S60 5.0 + * @param aObserver The observer to be notified of scanning events + */ + void SetObserver( MWsfWlanScannerObserver& aObserver ); + + /** + * Enables scanning for wlans + * @since S60 5.0 + */ + void StartScanningL(); + + /** + * Stops the activation timer and cancels the mgmt client to + * give notifications + * @since S60 5.0 + */ + void StopScanning(); + + /** + * Initiates a new scanning if it was already enabled but was idle. + * @since S60 5.0 + * @return ETrue if scanning was in fact restarted + */ + TBool RestartScanning(); + + /** + * Aborts the scanning process if it was active. However, it does not + * disable scanning + * @since S60 5.0 + */ + void AbortScanning(); + + /** + * Returns the serialized contents of scan results + * @since S60 5.0 + * @return A serialized array of wlaninfo items + */ + HBufC8* ScanResults(); + + /** + * Sets ConnectionDetails provider handle to get data about + * connected wlans + * @since S60 5.0 + * @param aProvider The object to be asked for connection details + */ + void SetConnectionDetailProvider( + MWsfWlanConnectionDetailsProvider& aProvider ); + + + public: // From MWlanMgmtNotifications + /** + * Connection status has changed. + * @since S60 5.0 + * @param aNewState The new connection state + */ + void ConnectionStateChanged( TWlanConnectionMode aNewState ); + + /** + * BSSID has changed (i.e. AP handover). + * @since S60 5.0 + * @param aNewBssid The new BSSID + */ + void BssidChanged( TWlanBssid& aNewBssid ); + + /** + * Connection has been lost. + * @since S60 5.0 + */ + void BssLost(); + + /** + * Connection has been regained. + * @since S60 5.0 + */ + void BssRegained(); + + /** + * New networks have been detected during scan. + * @since S60 5.0 + */ + void NewNetworksDetected(); + + /** + * One or more networks have been lost since the last scan. + * @since S60 5.0 + */ + void OldNetworksLost(); + + /** + * The used transmit power has been changed. + * @since S60 5.0 + * @param aPower The transmit power in mW. + */ + void TransmitPowerChanged( TUint aPower ); + + /** + * Received signal strength level has been changed. + * @since S60 5.0 + * @param aRssClass specifies the current class of the received signal + * @param aRss RSS level in absolute dBm values. + */ + void RssChanged( TWlanRssClass aRssClass, TUint aRss ); + + + private: // New methods + /** + * Processes the results of the broadcast scan + * @since S60 5.0 + */ + void DoScanForNetworksL(); + + /** + * Compares two SSIDs + * @since S60 5.0 + * @param aSsid1 First SSID + * @param aSsid2 Second SSID + * @return ETrue if the SSIDs are the same, EFalse otherwise + */ + static TBool SsidIdentity( const TWlanSsid& aSsid1, + const TWlanSsid& aSsid2 ); + +#ifdef _DEBUG + /** + * Dumps the scan results to the log + * @since S60 5.0 + * @param aArray Array of wlaninfo items added during scanning + */ + static void DumpScanResultsL( CWsfWlanInfoArray* aArray ); +#endif + + /** + * Check if the given SSID implies a hidden WLAN + * @since S60 5.0 + * @param aSsidLength Length of the SSID passed + * @param aSsid SSID as array of bytes + * @return ETrue if the network in question is hidden, EFalse otherwise + */ + TBool IsHiddenSsid( TUint aSsidLength, const TUint8* aSsid ); + + /** + * Parses the scan results for the network name + * @since S60 5.0 + * @param aWlanInfo The wlaninfo to put the results in + * @return ETrue if the network is a hidden one + */ + TBool RefreshNetworkNameL( TWsfWlanInfo& aWlanInfo ); + + /** + * Parses the scan results for the wlan signal stregth + * @since S60 5.0 + * @param aWlanInfo The wlaninfo to put the results in + */ + void RefreshSignalStrength( TWsfWlanInfo& aWlanInfo ); + + /** + * Parses the scan results for the network mode + * @since S60 5.0 + * @param aWlanInfo The wlaninfo to put the results in + */ + void RefreshNetworkMode( TWsfWlanInfo& aWlanInfo ); + + /** + * Parses the scan results for the security mode + * @since S60 5.0 + * @param aWlanInfo The wlaninfo to put the results in + */ + void RefreshSecurityMode( TWsfWlanInfo& aWlanInfo ); + + /** + * Convert the given rate value (500kbit/s per unit) + * to a corresponding enum. + * @since S60 5.2 + * @param aRate Rate value to be converted. + * @return Corresponding rate enum. + */ + core_tx_rate_e ConvertTxRateToTxRateEnum( TUint8 aRate ); + + /** + * Parses the scan results for the technology information + * @since S60 5.2 + * @param aWlanInfo The wlaninfo to put the results in + */ + void RefreshTechnology( TWsfWlanInfo& aWlanInfo ); + + /** + * Prepares for direct scanning + * @since S60 5.0 + */ + void PrepareDirectScan(); + + /** + * Processes the result of the last direct scan + * @since S60 5.0 + */ + void ProcessDirectScanResultL(); + + /** + * Checks iScanArray and replaces SSIDs of known networks + * with their IAP names. + * @param aWlanInfo The wlaninfo to put the results in + * @since S60 5.0 + */ + void ReplaceSsidsWithIapName(TWsfWlanInfo& aWlanInfo); + + /** + * Updates IAPs priority + * @since S60 5.0 + * @param aWlanInfo The wlaninfo to put the results in + */ + void UpdatePriorityL( TWsfWlanInfo& aWlanInfo ); + + /** + * Finds the security mode, network mode from WLAN table + * with their IAP names. + * @param aWlanInfo The wlaninfo to put the results in + * @since S60 5.0 + */ + void GetWlanInfoFromIapL( TWsfWlanInfo& aWlanInfo ); + + /** + * Add connected wlan info to scan results + * @since S60 5.0 + */ + void AddConnectedWLANInfoL(); + + private: // From CActive + /** + * Implements cancellation of an outstanding request. + * @since S60 5.0 + */ + void DoCancel(); + + /** + * Handles an active object's request completion event. + * @since S60 5.0 + */ + void RunL(); + + /** + * Handles a leave occurring in RunL(). + * @since S60 5.0 + * @param aError Leave code + * @return aError + */ + TInt RunError( TInt aError ); + + + public: // from MWsfWlanMonitorObserver + + /** + * Called when a wlan connection is established + * @since S60 5.0 + * @param aConnectionName WLAN connection name (SSID) + */ + void ConnectionEstablishedL( const TDesC& aConnectionName ); + + /** + * Called when wlan connection has been lost + * @since S60 5.0 + */ + void ConnectionLostL(); + + /** + * Called when the connection process failed for some reason + * @since S60 5.0 + * @param aError System wide error code + */ + void ConnectingFailedL( TInt aError ); + + /** + * Called when the connection no longer needs the IAP it was using + * @since S60 5.0 + */ + void ConnectedIapReleasedL(); + + + public: // from MWsfWlanScanIntervalChangeObserver + /** + * Called when the value of the background scan interval or the + * show availability flag has been changed + * @since S60 5.0 + * @param aNewScanInterval The new value for the scan interval + * @param aShowAvailability The new value for the + * Show WLAN availability flag + */ + void WlanScanIntervalChangedL( TUint aNewScanInterval, + TBool aShowAvailability ); + + private: // Data + /** + * Reference to the observer of this class (not owned) + */ + MWsfWlanScannerObserver* iObserver; + + /** + * Reference to the database session to use (not owned) + */ + CommsDat::CMDBSession* iDbSession; + + /** + * Reference to the connection details providing object (not owned) + */ + MWsfWlanConnectionDetailsProvider* iConnectionDetailsProvider; + + /** + * Handle to the WLAN management client (owned) + */ + CWlanMgmtClient* iWlanMgmtClient; + + /** + * Scan info object (owned) + */ + CWlanScanInfo* iScanInfo; + + /** + * WLAN settings monitoring object (owned) + */ + CWsfWlanSettingsAccessor* iWlanSettingsAccessor; + + /** + * The array containing the wlaninfo items found during scanning + * (owned) + */ + CWsfWlanInfoArray* iScanArray; + + /** + * Name of the active connection (owned) + */ + HBufC* iActiveConnectionName; + + /** + * Timer for scheduling WLAN scans + */ + RTimer iTimer; + + /** + * Handle to the CmManager + */ + RCmManagerExt iCmManagerExt; + + /** + * Buffer to store the serialized array of wlaninfo items (owned) + */ + HBufC8* iScanResults; + + /** + * The background scan interval in microseconds + */ + TUint iScanningInterval; + + /** + * Value of Show WLAN availability flag + */ + TBool iShowAvailability; + + /** + * Array of SSIDs that are in CommsDat but have not been found + * by broadcast scan + */ + RArray iDirectScanSsids; + + /** + * Array of IapIDs that are in CommsDat but have not been found + * by broadcast scan + */ + RArray iDirectScanIapIDs; + + /** + * Indicates the scanning state + */ + TWsfScanState iScanState; + + /** + * Connected SSID or IAP name + */ + TBuf8 iConnectedSsidOrIap; + + /** + * Array containing the available IAP IDs and Signal Strengths + */ + RArray iAvailableIaps; + + /** + * Cache lifetime. + * Parameter needed for issuing "get available WLAN IAPs" + * request. + */ + TInt iCacheLifetime; + + /** + * Max Delay. + * Parameter needed for issuing "get available WLAN IAPs" + * request. + */ + TUint iMaxDelay; + + + }; + + +#endif // C_WSFWLANSCANNER_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/inc/wsfwlanscannerobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/inc/wsfwlanscannerobserver.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for MWsfWlanScannerObserver +* +*/ + + + +#ifndef M_WSFWLANSCANNEROBSERVER_H +#define M_WSFWLANSCANNEROBSERVER_H + +// EXTERNAL INCLUDES +#include + + +// CLASS DEFINITION +/** +* Class acts as an interface for the CWsfWlanScanner to be able to call back +* its clients in case of different scanning events. +* +* @since S60 5.0 +*/ +class MWsfWlanScannerObserver + { + public: // Abstract methods + /** + * When the scan cycle has completed this function is called to report + * the completion. + * @since S60 5.0 + */ + virtual void WlanScanCompleteL() = 0; + + /** + * Called when the scan cycle has started + * @since S60 5.0 + */ + virtual void WlanScanStarted() = 0; + + /** + * Called when an error occured while scanning wlan data + * @since S60 5.0 + * @param aError System wide error code + */ + virtual void NotifyError( TInt aError ) = 0; + + }; + +#endif // M_WSFWLANSCANNEROBSERVER_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/inc/wsfwlansettingsaccessor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/inc/wsfwlansettingsaccessor.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,209 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfWlanScanner +* +*/ + + +#ifndef C_WSFWLANSETTINGSACCESSOR_H +#define C_WSFWLANSETTINGSACCESSOR_H + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "wlanmgmtcommon.h" +#include "wlanscaninfo.h" + + +// FORWARD DECLARATIONS +class CCDWlanDeviceSettingsRecord; +class MWsfWlanScanIntervalChangeObserver; + + +// CLASS DEFINITION +/** + * Class to monitor WLAN background scan interval and Show WLAN availability + * flag value + * + * @since S60 5.0 + * @lib wsfserver.exe + */ +NONSHARABLE_CLASS( CWsfWlanSettingsAccessor ): public CActive + { + public: // Constructors and destructor + /** + * Factory function. + * @since S60 5.0 + * @param aDbSession Reference to the database session to use + * @return Class instance + */ + static CWsfWlanSettingsAccessor* NewL( + CommsDat::CMDBSession& aDbSession ); + + /** + * Factory function. + * @since S60 5.0 + * @param aDbSession Reference to the database session to use + * @return Class instance + */ + static CWsfWlanSettingsAccessor* NewLC( + CommsDat::CMDBSession& aDbSession ); + + /** + * Destructor. + */ + ~CWsfWlanSettingsAccessor(); + + + private: // Constructors + /** + * Constructor + * @since S60 5.0 + * @param aDbSession Reference to the database session to use + * @return Class instance + */ + CWsfWlanSettingsAccessor( CommsDat::CMDBSession& aDbSession ); + + /** + * Second-phase constructor. + * @since S60 5.0 + */ + void ConstructL(); + + + public: // new methods + /** + * Returns the value of the scan interval + * @since S60 5.0 + * @return The value of the scan interval in seconds + */ + TUint ScanInterval() const; + + /** + * Returns the value of the show WLAN availability flag + * @since S60 5.0 + * @return The value of the flag + */ + TBool ShowAvailability() const; + + /** + * Requests notification for when the scan interval changes + * @since S60 5.0 + * @param aObserver The observer object to be notified + */ + void RequestNotificationL( + MWsfWlanScanIntervalChangeObserver& aObserver ); + + /** + * Cancels the change notifications + * @since S60 5.0 + */ + void CancelNotifications(); + + + private: // New methods + /** + * Does the actual setting check + * @since S60 5.0 + * @param aBgScanInterval Variable to store the latest background scan + * interval value + * @param aShowAvailability Variable to store the latest Show WLAN + * availability flag value + */ + void DoCheckSettingL( TUint& aBgScanInterval, + TBool& aShowAvailability); + + /** + * Checks if the current bgscaninterval/availability flag is different + * from the previously retrieved value + * @since S60 5.0 + * @return ETrue if the settings has been changed + */ + TBool CheckIfSettingChangedL(); + + /** + * Reissues the request for database notification + * @since S60 5.0 + */ + void IssueNotificationRequestL(); + + + private: // from CActive + /** + * Implements cancellation of an outstanding request. + * @since S60 5.0 + */ + void DoCancel(); + + /** + * Handles an active object's request completion event. + * @since S60 5.0 + */ + void RunL(); + + /** + * Handles a leave occurring in RunL(). + * @since S60 5.0 + * @param aError Leave code + * @return aError + */ + TInt RunError( TInt aError ); + + + private: // Data + /** + * Handle to the database session (not owned) + */ + CommsDat::CMDBSession* iDbSession; + + /** + * Reference to the observer object (not owned) + */ + MWsfWlanScanIntervalChangeObserver* iChangeObserver; + + /** + * Instance of the WLAN settings record (owned) + */ + CCDWlanDeviceSettingsRecord* iWlanSettingsRecord; + + /** + * The last retrieved bgscaninterval value (in seconds) + */ + TUint iScanInterval; + + /** + * Table ID for the WLAN settings table + */ + CommsDat::TMDBElementId iTableId; + + /** + * Hold-up timer to avoid notification bursts + */ + RTimer iTimer; + + /** + * Indicates whether the processing has been activated but got held up + */ + TBool iBeingHeldUp; + + /** + * Indicates whether show wlan availability flag is on + */ + TBool iShowAvailability; + }; + +#endif // C_WSFWLANSETTINGSACCESSOR_H + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/rom/wsfserver.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/rom/wsfserver.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 Server +* +*/ + + + +#ifndef WSFSERVER_IBY +#define WSFSERVER_IBY + +#ifdef __PROTOCOL_WLAN + +REM WlanSnifferServer + +#include + + +file=ABI_DIR\BUILD_DIR\wsfserver.exe PROGRAMS_DIR\wsfserver.exe + +#endif // __PROTOCOL_WLAN + +#endif // WSFSERVER_IBY diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/src/wsfactivewaiter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/src/wsfactivewaiter.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfActiveWaiter +* +*/ + + +// INCLUDE FILES +#include "wsfactivewaiter.h" +#include "wsflogger.h" + + + +// --------------------------------------------------------- +// CWsfActiveWaiter* CWsfActiveWaiter::NewL +// --------------------------------------------------------- +// +CWsfActiveWaiter* CWsfActiveWaiter::NewL() + { + CWsfActiveWaiter* self = NewLC(); + CleanupStack::Pop( self ); + + return self; + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter* CWsfActiveWaiter::NewLC +// --------------------------------------------------------- +// +CWsfActiveWaiter* CWsfActiveWaiter::NewLC() + { + CWsfActiveWaiter* self = new ( ELeave ) CWsfActiveWaiter(); + CleanupStack::PushL( self ); + + return self; + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::CWsfActiveWaiter +// --------------------------------------------------------- +// +CWsfActiveWaiter::CWsfActiveWaiter(): + CActive( CActive::EPriorityStandard ) + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::~CWsfActiveWaiter +// --------------------------------------------------------- +// +CWsfActiveWaiter::~CWsfActiveWaiter() + { + Cancel(); + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::DoCancel +// --------------------------------------------------------- +// +void CWsfActiveWaiter::DoCancel() + { + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::RunL +// --------------------------------------------------------- +// +void CWsfActiveWaiter::RunL() + { + LOG_ENTERFN( "CWsfActiveWaiter::RunL" ); + if ( iWait.IsStarted() ) + { + LOG_WRITE("async call completed, resuming."); + iWait.AsyncStop(); + } + } + +// --------------------------------------------------------- +// CWsfActiveWaiter::WaitForRequest +// --------------------------------------------------------- +// +TInt CWsfActiveWaiter::WaitForRequest() + { + LOG_ENTERFN("CWsfActiveWaiter::WaitForRequest"); + SetActive(); + iWait.Start(); + + return iStatus.Int(); + } + +// End of File + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/src/wsfengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/src/wsfengine.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,749 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfEngine +* +*/ + + + +// EXTERNAL INCLUDES +#include +#include +#include +#include + +// CLASS HEADER +#include "wsfengine.h" + + +// INTERNAL INCLUDES +#include "wsfwlanscanner.h" +#include "wsfwlansettingsaccessor.h" +#include "wsfwlanbearerconnectionmonitor.h" +#include "wsfengineobserver.h" +#include "wsfservercloseradapter.h" +#include "wsfactivewaiter.h" + +#include "wsflogger.h" + + + +// LOCAL DEFINITIONS +using namespace CommsDat; + + +/** +* Maximum number of retries when trying to delete a temporary IAP but +* the connection is locking it +*/ +static const TInt KMaxIapDeletionRetries = 10; + + +/** +* Time to wait betweed two IAP deletion retries, in microseconds +*/ +static const TUint KDelayBetweenDeletionRetries = 500 * 1000; + + + + + +// CONSTRUCTION AND DESTRUCTION + +// ---------------------------------------------------------------------------- +// CWsfEngine::NewL +// ---------------------------------------------------------------------------- +// +CWsfEngine* CWsfEngine::NewL( MWsfServerCloserAdapter& aServerCloser ) + { + CWsfEngine* self = CWsfEngine::NewLC( aServerCloser ); + CleanupStack::Pop( self ); + return self; + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::NewLC +// ---------------------------------------------------------------------------- +// +CWsfEngine* CWsfEngine::NewLC( MWsfServerCloserAdapter& aServerCloser ) + { + CWsfEngine* self = new ( ELeave ) CWsfEngine( aServerCloser ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::~CWsfEngine +// ---------------------------------------------------------------------------- +// +CWsfEngine::~CWsfEngine() + { + LOG_ENTERFN( "CWsfEngine::~CWsfEngine" ); + + delete iWlanBearerMonitor; + delete iScanner; + delete iDbSession; + iObservers.Reset(); + + if ( iMonitoredIap && + ( iIapPersistence == EIapExpireOnDisconnect || + iIapPersistence == EIapNestedExpireOnDisconnect || + iIapPersistence == EIapExpireOnBrowserExit || + iIapPersistence == EIapExpireOnShutdown ) ) + { + TRAP_IGNORE( DeleteIapL( iMonitoredIap ) ); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::CWsfEngine +// ---------------------------------------------------------------------------- +// +CWsfEngine::CWsfEngine( MWsfServerCloserAdapter& aServerCloser ): + iServerCloser( aServerCloser ), + iEnableScanning( 0 ), + iIapPersistence( EIapDeleted ) + { + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::ConstructL +// ---------------------------------------------------------------------------- +// +void CWsfEngine::ConstructL() + { + LOG_CREATE; + LOG_ENTERFN( "CWsfEngine::ConstructL" ); + iDbSession = CMDBSession::NewL( CMDBSession::LatestVersion() ); + iScanner = CWsfWlanScanner::NewL( *iDbSession ); + + iScanner->SetObserver( *this ); + + iWlanBearerMonitor = CWsfWlanBearerConnectionMonitor::NewL( iServerCloser ); + iScanner->SetConnectionDetailProvider( *iWlanBearerMonitor ); + + iWlanBearerMonitor->StartMonitoringL( this ); + + if ( iWlanBearerMonitor->GetWlanBearerNameL() != KNullDesC() ) + { + HBufC* name = ConnectedWlanSsidL(); + CleanupStack::PushL( name ); + iScanner->ConnectionEstablishedL( *name ); + CleanupStack::PopAndDestroy( name ); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::AttachL +// ---------------------------------------------------------------------------- +// +void CWsfEngine::AttachL( MWsfEngineObserver* aObserver ) + { + LOG_ENTERFN( "CWsfEngine::AttachL" ); + + iObservers.AppendL( aObserver ); + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::Detach +// ---------------------------------------------------------------------------- +// +void CWsfEngine::Detach( MWsfEngineObserver* aObserver ) + { + LOG_ENTERFN( "CWsfEngine::Detach" ); + TInt index = iObservers.Find( aObserver ); + if ( index != KErrNotFound ) + { + iObservers.Remove( index ); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::GetScanResults +// ---------------------------------------------------------------------------- +// +HBufC8* CWsfEngine::GetScanResults() + { + LOG_ENTERFN( "CWsfEngine::GetScanResults" ); + return iScanner->ScanResults(); + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::EnableScanningL +// ---------------------------------------------------------------------------- +// +void CWsfEngine::EnableScanningL() + { + LOG_ENTERFN( "CWsfEngine::EnableScanningL" ); + + iEnableScanning++; + LOG_WRITEF( "++iEnableScanning = %d", iEnableScanning ); + + if ( iEnableScanning == 1 ) + { + LOG_WRITE( "CWsfEngine::EnableScanningL - start scanner" ); + if ( !iScanner->IsActive() ) + { + iScanner->StartScanningL(); + } + LOG_WRITE( "CWsfEngine::EnableScanningL start scanner done" ); + for ( TInt i( 0 ); i< iObservers.Count(); ++i ) + { + (iObservers[i])->ScanEnabledL(); + } + } + else + { + // the scanning is already active - stop and reactivate to complete the + // new monitor in sensible time + if ( iScanner->IsActive() ) + { + iScanner->StopScanning(); + } + iScanner->StartScanningL(); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::IsScanning +// ---------------------------------------------------------------------------- +// +TBool CWsfEngine::IsScanning() + { + return iEnableScanning; + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::RefreshScanResults +// ---------------------------------------------------------------------------- +// +TBool CWsfEngine::RefreshScanResults() + { + LOG_ENTERFN( "CWsfEngine::RefreshScanResults" ); + return iScanner->RestartScanning(); + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::MonitorAccessPointL +// ---------------------------------------------------------------------------- +// +void CWsfEngine::MonitorAccessPointL( TUint32 aIapId ) + { + LOG_ENTERFN( "CWsfEngine::MonitorAccessPointL" ); + + iMonitoredIap = aIapId; + + if ( iIapPersistence == EIapExpireOnShutdown ) + { + // web browsing with a temporary IAP + LOG_WRITE( "EIapExpireOnShutdown => EIapExpireOnBrowserExit" ); + SetIapPersistenceL( EIapExpireOnBrowserExit ); + iServerCloser.WaitForBrowserExit( ETrue ); + + // semaphore to keep the order of calls + iSuppressIapDeletion = ETrue; + } + else if ( iIapPersistence == EIapExpireOnDisconnect ) + { + LOG_WRITE( "EIapExpireOnDisconnect => EIapNestedExpireOnDisconnect" ); + SetIapPersistenceL( EIapNestedExpireOnDisconnect ); + } + + + LOG_WRITEF( "iMonitoredIap = %d", iMonitoredIap ); + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::DisableScanningL +// ---------------------------------------------------------------------------- +// +void CWsfEngine::DisableScanningL() + { + LOG_ENTERFN( "CWsfEngine::DisableScanningL" ); + + iEnableScanning--; + LOG_WRITEF( "--iEnableScanning = %d", iEnableScanning ); + + if ( !iEnableScanning ) + { + LOG_WRITE( "CWsfEngine::DisableScanning stop scanner" ); + + iScanner->StopScanning(); + LOG_WRITE( "CWsfEngine::DisableScanning stopped scanner" ); + + for ( TInt i( 0 ); i < iObservers.Count(); ++i ) + { + (iObservers[i])->ScanDisabledL(); + } + } + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::ConnectedWlanSsidL +// ---------------------------------------------------------------------------- +// +HBufC* CWsfEngine::ConnectedWlanSsidL() + { + LOG_ENTERFN( "CWsfEngine::ConnectedWlanIapNameL" ); + return iWlanBearerMonitor->GetWlanBearerNameL().AllocL(); + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::ConnectedWlanConnectionDetailsL +// ---------------------------------------------------------------------------- +// +TBool CWsfEngine::ConnectedWlanConnectionDetailsL( TWsfWlanInfo& aWlanInfo ) + { + LOG_ENTERFN( "CWsfEngine::ConnectedWlanConnectionDetailsL" ); + return iWlanBearerMonitor->ConnectedWlanConnectionDetailsL( &aWlanInfo ); + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::WlanScanCompleteL +// ---------------------------------------------------------------------------- +// +void CWsfEngine::WlanScanCompleteL() + { + LOG_ENTERFN( "CWsfEngine::WlanScanCompleteL" ); + + for ( TInt i( 0 ); i < iObservers.Count(); ++i ) + { + (iObservers[i])->WlanListChangedL(); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::WlanScanStarted +// ---------------------------------------------------------------------------- +// +void CWsfEngine::WlanScanStarted() + { + LOG_ENTERFN( "CWsfEngine::WlanScanStarted" ); + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::NotifyError +// ---------------------------------------------------------------------------- +// +void CWsfEngine::NotifyError( TInt aError ) + { + LOG_ENTERFN( "CWsfEngine::NotifyError" ); + + for ( TInt i( 0 ); i < iObservers.Count(); ++i ) + { + TRAP_IGNORE( (iObservers)[i]->NotifyErrorL( aError ) ); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::ConnectionEstablishedL +// ---------------------------------------------------------------------------- +// +void CWsfEngine::ConnectionEstablishedL( const TDesC& aConnectionName ) + { + LOG_ENTERFN( "CWsfEngine::ConnectionEstablishedL" ); + // set the scanner to check connected accounts + iScanner->ConnectionEstablishedL( aConnectionName ); + + iScanner->RestartScanning(); + + // notify the observers + for ( TInt i( 0 ); i < iObservers.Count(); ++i ) + { + (iObservers)[i]->ConnectedL(); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::ConnectionLostL +// ---------------------------------------------------------------------------- +// +void CWsfEngine::ConnectionLostL() + { + LOG_ENTERFN( "CWsfEngine::ConnectionLostL" ); + + // check temporarity here as well since it is not guaranteed that + // the connection was owned and ConnectedIapReleasedL was called + if ( iSuppressIapDeletion ) + { + // web browsing with a temporary IAP + LOG_WRITE( "IAP deletion suppressed" ); + iSuppressIapDeletion = EFalse; + } + else if ( iMonitoredIap ) + { + if ( iIapPersistence == EIapExpireOnDisconnect || + iIapPersistence == EIapExpireOnBrowserExit ) + { + DeleteIapL( iMonitoredIap ); + iIapPersistence = EIapDeleted; + iMonitoredIap = 0; + } + else if ( iIapPersistence == EIapNestedExpireOnDisconnect ) + { + iIapPersistence = EIapExpireOnBrowserExit; + } + } + + iScanner->ConnectionLostL(); + iScanner->RestartScanning(); + + // notify the observers + for ( TInt i( 0 ); i < iObservers.Count(); ++i ) + { + (iObservers)[i]->DisconnectedL(); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::ConnectingFailedL +// ---------------------------------------------------------------------------- +// +void CWsfEngine::ConnectingFailedL( TInt aError ) + { + LOG_ENTERFN( "CWsfEngine::ConnectingFailedL" ); + + for ( TInt i( 0 ); i < iObservers.Count(); ++i ) + { + (iObservers)[i]->ConnectingFailedL( aError ); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::ConnectedIapReleasedL +// ---------------------------------------------------------------------------- +// +void CWsfEngine::ConnectedIapReleasedL() + { + LOG_ENTERFN( "CWsfEngine::ConnectedIapReleasedL" ); + + // deleting temporary IAP if necessary + if ( !iSuppressIapDeletion && iMonitoredIap ) + { + if ( iIapPersistence == EIapExpireOnDisconnect || + iIapPersistence == EIapExpireOnBrowserExit ) + { + DeleteIapL( iMonitoredIap ); + iIapPersistence = EIapDeleted; + iMonitoredIap = 0; + } + else if ( iIapPersistence == EIapNestedExpireOnDisconnect ) + { + iIapPersistence = EIapExpireOnBrowserExit; + iSuppressIapDeletion = ETrue; + } + } + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::DeleteIapL +// ---------------------------------------------------------------------------- +// +void CWsfEngine::DeleteIapL( TUint32 aIapId ) + { + LOG_ENTERFN( "CWsfEngine::DeleteIapL" ); + + LOG_WRITEF( "deleting temporary IAP id = %d", aIapId ); + RCmManagerExt cmMgr; + cmMgr.OpenLC(); + + RArray cmIds; + CleanupClosePushL( cmIds ); + cmMgr.ConnectionMethodL( cmIds, ETrue, ETrue, EFalse ); + TBool foundFromUncategorized = EFalse; + + for ( TInt k = 0; k < cmIds.Count(); k++ ) + { + RCmConnectionMethodExt cm; + TRAPD( error, cm = cmMgr.ConnectionMethodL( cmIds[k] ) ); + if ( KErrNone == error ) + { + CleanupClosePushL( cm ); + + TUint iapId = cm.GetIntAttributeL( CMManager::ECmIapId ); + if ( iapId == aIapId ) + { + LOG_WRITE( "IAP is uncategorized" ); + foundFromUncategorized = ETrue; + } + CleanupStack::PopAndDestroy( &cm ); + } + } + + CleanupStack::PopAndDestroy( &cmIds ); + + if ( !foundFromUncategorized ) + { + LOG_WRITE( "Not deleting IAP since it is in SNAP" ); + CleanupStack::PopAndDestroy( &cmMgr ); + return; + } + + RCmConnectionMethodExt ictCm = cmMgr.ConnectionMethodL( aIapId ); + CleanupClosePushL( ictCm ); + + CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewLC(); + + RTimer timer; + timer.CreateLocal(); + + // trying to delete the temporary IAP + // sometimes the RConnection is still locking the IAP when + // we want to delete it, so we might have to try a couple of times + TInt counter( KMaxIapDeletionRetries ); + TInt err( KErrNone ); + + while ( counter ) + { + LOG_WRITEF( "trying to delete (#%d)", + KMaxIapDeletionRetries - counter ); + + TRAP( err, ictCm.DeleteL() ); + + if ( !err || err == KErrNotFound ) + { + // if success or the IAP was not found (strange but happens), break + break; + } + + --counter; + if ( err && counter ) + { + LOG_WRITEF( "deletion failed with error = %d", err ); + LOG_WRITE( "RConnection is still locking the IAP, waiting..." ); + + timer.After( waiter->iStatus, TTimeIntervalMicroSeconds32( + KDelayBetweenDeletionRetries ) ); + waiter->WaitForRequest(); + } + } + + + timer.Close(); + CleanupStack::PopAndDestroy( waiter ); + + if ( !err ) + { + LOG_WRITE( "IAP deleted." ); + } + else + { + LOG_WRITE( "IAP couldn't be deleted!" ); + } + + CleanupStack::PopAndDestroy( &ictCm ); + CleanupStack::PopAndDestroy( &cmMgr ); + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::ConnectWlanL +// ---------------------------------------------------------------------------- +// +TInt CWsfEngine::ConnectWlanL( TUint32 aIapId, + TBool aConnectOnly, + TWsfIapPersistence aPersistence ) + { + LOG_ENTERFN( "CWsfEngine::ConnectWlanL" ); + LOG_WRITEF( "iapId = %d, persistence = %d", aIapId, aPersistence ); + + // if we have already been monitoring an IAP (different from the + // new one), clean that one up properly + if ( iMonitoredIap && iIapPersistence == EIapExpireOnBrowserExit ) + { + // user switched back from browser to sniffer and issued connect + if ( iMonitoredIap != aIapId ) + { + // selected network is different, so we must clean up the old one + DeleteIapL( iMonitoredIap ); + iIapPersistence = EIapDeleted; + iMonitoredIap = 0; + } + else if ( iMonitoredIap == aIapId ) + { + // selected networks are the same + aPersistence = EIapNestedExpireOnDisconnect; + } + iSuppressIapDeletion = EFalse; + } + + TInt ret = iWlanBearerMonitor->ConnectBearer( aIapId, + aConnectOnly, + aPersistence != EIapPersistent ); + + if ( !ret ) + { + // successfully initiated connection + LOG_WRITE( "connection init succeded" ); + iMonitoredIap = aIapId; + SetIapPersistenceL( aPersistence ); + } + + return ret; + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::DisconnectWlan +// ---------------------------------------------------------------------------- +// +TBool CWsfEngine::DisconnectWlan() + { + LOG_ENTERFN( "CWsfEngine::DisconnectWlan" ); + return iWlanBearerMonitor->DisconnectBearer(); + } + + +// ---------------------------------------------------------------------------- +// CWsfEngine::IsConnected +// ---------------------------------------------------------------------------- +// +TBool CWsfEngine::IsConnected() + { + return iWlanBearerMonitor->IsConnected(); + } + + +// --------------------------------------------------------------------------- +// CWsfEngine::AbortConnectingL +// --------------------------------------------------------------------------- +// +void CWsfEngine::AbortConnectingL() + { + LOG_ENTERFN("CWsfEngine::AbortConnectingL"); + + TInt result = iWlanBearerMonitor->AbortConnecting(); + + LOG_WRITEF( "abort connection result = %d", result ); + + if ( result == KErrNone && iMonitoredIap ) + { + if ( iIapPersistence == EIapExpireOnDisconnect ) + { + LOG_WRITE( "EIapNestedExpireOnDisconnect => EIapDeleted" ); + DeleteIapL( iMonitoredIap ); + iIapPersistence = EIapDeleted; + iMonitoredIap = 0; + } + else if ( iIapPersistence == EIapNestedExpireOnDisconnect ) + { + LOG_WRITE( "EIapNestedExpireOnDisconnect => " + L"EIapExpireOnBrowserExit" ); + iIapPersistence = EIapExpireOnBrowserExit; + } + } + else if ( result != KErrNone ) + { + LOG_WRITE( "abort connection did not stopped connection" ); + // Try to disconnect via normal disconnect if engine is + // connected and and there is connection id + DisconnectWlan(); + } + } + + +// --------------------------------------------------------------------------- +// CWsfEngine::AbortScanning +// --------------------------------------------------------------------------- +// +void CWsfEngine::AbortScanning() + { + LOG_ENTERFN("CWsfEngine::AbortScanning"); + + iScanner->AbortScanning(); + } + + +// --------------------------------------------------------------------------- +// CWsfEngine::SetIapPersistenceL +// --------------------------------------------------------------------------- +// +TBool CWsfEngine::SetIapPersistenceL( TWsfIapPersistence aPersistence ) + { + LOG_ENTERFN("CWsfEngine::SetIapPersistenceL"); + if ( aPersistence == EIapForcedExpiry ) + { + if ( iMonitoredIap && + ( iIapPersistence == EIapExpireOnBrowserExit || + iIapPersistence == EIapExpireOnShutdown ) ) + { + LOG_WRITE( "forced IAP expiry" ); + DeleteIapL( iMonitoredIap ); + iIapPersistence = EIapDeleted; + iMonitoredIap = 0; + } + else if ( iIapPersistence == EIapNestedExpireOnDisconnect ) + { + LOG_WRITE( "reverting to EIapExpireOnDisconnect" ); + iIapPersistence = EIapExpireOnDisconnect; + } + + iServerCloser.WaitForBrowserExit( EFalse ); + } + else + { + LOG_WRITEF( "persistence = %d", aPersistence ); + iIapPersistence = aPersistence; + } + + return ( iMonitoredIap ); + } + + +// --------------------------------------------------------------------------- +// CWsfEngine::ControlDisconnectTimer +// --------------------------------------------------------------------------- +// +TBool CWsfEngine::ControlDisconnectTimer( TUint aAdcCommand ) + { + LOG_ENTERFN("CWsfEngine::ControlDisconnectTimer"); + + return iWlanBearerMonitor->ControlDisconnectTimer( aAdcCommand ); + } + +// --------------------------------------------------------------------------- +// CWsfEngine::ResetSuppressIapDeletion +// --------------------------------------------------------------------------- +// +void CWsfEngine::ResetSuppressIapDeletion() + { + LOG_ENTERFN( "CWsfEngine::ResetSuppresIapDeletion" ); + + iSuppressIapDeletion = EFalse; + } + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/src/wsfict.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/src/wsfict.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,371 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfIct +* +*/ + + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include + +// CLASS HEADER +#include "wsfict.h" +#include "wsflogger.h" + +// INTERNAL INCLUDES + +using namespace CMManager; + +/** +* UID of Wlan Login application (hsbrowser) +* used when launching WLAN Login application +*/ +static const TInt KBrowserUid = { 0x2000AFCC }; + +/** +* Length of a needed separators +* used when launching WLAN Login application +*/ +const TInt KSeparatorsLength = 4; + + +// ---------------------------------------------------------------------------- +// CWsfIct::NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CWsfIct* CWsfIct::NewL() + { + CWsfIct* self = CWsfIct::NewLC(); + CleanupStack::Pop( self ); + return self; + } + + +// ---------------------------------------------------------------------------- +// CWsfIct::NewLC +// ---------------------------------------------------------------------------- +// +EXPORT_C CWsfIct* CWsfIct::NewLC() + { + CWsfIct* self = new( ELeave ) CWsfIct; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// ---------------------------------------------------------------------------- +// CWsfIct::~CWsfIct +// ---------------------------------------------------------------------------- +// +EXPORT_C CWsfIct::~CWsfIct() + { + LOG_ENTERFN( "CWsfIct::~CWsfIct" ); + if ( iIct ) + { + LOG_WRITE( "ict cancel" ); + TRAP_IGNORE( iIct->CancelStartL() ); + delete iIct; + iIct = NULL; + } + } + + +// ---------------------------------------------------------------------------- +// CWsfIct::CWsfIct +// ---------------------------------------------------------------------------- +// +CWsfIct::CWsfIct(): iConnectOnly( EFalse ) + { + } + + +// ---------------------------------------------------------------------------- +// CWsfIct::ConstructL +// ---------------------------------------------------------------------------- +// +void CWsfIct::ConstructL() + { + } + + +// ---------------------------------------------------------------------------- +// CWsfIct::ConnectivityObserver +// ---------------------------------------------------------------------------- +// +void CWsfIct::ConnectivityObserver( TIctsTestResult aResult, + const TDesC& aString ) + { + LOG_ENTERFN( "CWsfIct::ConnectivityObserver" ); + LOG_WRITEF( "ICTS result: %d", aResult ); + + // check the result + switch ( aResult ) + { + case EConnectionOk: + { + // test succeeded + TRAP_IGNORE( MoveToInternetSnapL( iIapId ) ); + LOG_WRITE( "ICT: EConnectionOk" ); + break; + } + + case EConnectionNotOk: + { + // test was run but it failed + LOG_WRITE( "ICT: EConnectionNotOk" ); + break; + } + case EHttpAuthenticationNeeded: + { + // test was run but HTTP authentication is required + LOG_WRITE( "ICT: EHttpAuthenticationNeeded" ); + if ( iConnectOnly ) + { + // Connect selected. WLAN Login needed. + TRAP_IGNORE( LaunchWlanLoginL(aString) ); + } + break; + } + case ETimeout: + { + LOG_WRITE( "ICT: ETimeout" ); + break; + } + + default: + { + _LIT( KIctPanic, "ICT result" ); + User::Panic( KIctPanic, aResult ); + } + } + } + + +// ----------------------------------------------------------------------------- +// CWsfIct::LaunchWlanLoginL() +// ----------------------------------------------------------------------------- +// +void CWsfIct::LaunchWlanLoginL( const TDesC& aString ) + { + LOG_ENTERFN( "CWsfIct::LaunchWlanLoginL" ); + + // Count IAP Id length + TInt iapIdLength ( 1 ); + TInt iapId = iIapId; + while ( iapId >= 10 ) + { + iapId = iapId/10; + iapIdLength++; + } + + // Count Network Id length + TInt netIdLength ( 1 ); + TInt netId = iNetId; + while ( netId >= 10 ) + { + netId = netId/10; + netIdLength++; + } + + TInt length = aString.Length() + + iapIdLength + + netIdLength + + KSeparatorsLength; + HBufC* param = HBufC::NewLC( length ); + _LIT(tmpString, "%d, %d, %S"); + param->Des().Format( tmpString, + iIapId, + iNetId, + &aString ); + TUid uid( TUid::Uid( KBrowserUid ) ); + TThreadId id; + + RApaLsSession appArcSession; + User::LeaveIfError( appArcSession.Connect() ); + CleanupClosePushL( appArcSession ); + + TInt err = appArcSession.StartDocument( *param, TUid::Uid( KBrowserUid ), id ); + if ( err != KErrNone ) + { + LOG_ENTERFN( "CWsfIct::LaunchWlanLoginL failed" ); + } + CleanupStack::PopAndDestroy( &appArcSession ); + CleanupStack::PopAndDestroy( param ); + } + + +// ---------------------------------------------------------------------------- +// CWsfIct::MoveToInternetSnapL +// ---------------------------------------------------------------------------- +// +void CWsfIct::MoveToInternetSnapL( const TUint32 aIapId ) + { + LOG_ENTERFN( "CWsfIct::MoveToInternetSnapL" ); + RCmManagerExt cmManager; + cmManager.OpenL(); + CleanupClosePushL( cmManager ); + + // Check that is IAP uncategorized + RArray cmIds; + CleanupClosePushL( cmIds ); + cmManager.ConnectionMethodL( cmIds, ETrue, ETrue, EFalse ); + TBool foundFromUncategorized = EFalse; + + for ( TInt k = 0; k < cmIds.Count(); k++ ) + { + RCmConnectionMethodExt cm; + TRAPD( error, cm = cmManager.ConnectionMethodL( cmIds[k] ) ); + if ( KErrNone == error ) + { + CleanupClosePushL( cm ); + + TUint iapId = cm.GetIntAttributeL( CMManager::ECmIapId ); + if ( iapId == aIapId ) + { + LOG_WRITE( "IAP is uncategorized" ); + foundFromUncategorized = ETrue; + } + CleanupStack::PopAndDestroy( &cm ); + } + } + + CleanupStack::PopAndDestroy( &cmIds ); + + if ( !foundFromUncategorized ) + { + LOG_WRITE( "Not moving IAP since it is in SNAP" ); + CleanupStack::PopAndDestroy( &cmManager ); + return; + } + + // 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 ) + { + RCmConnectionMethodExt iap = cmManager.ConnectionMethodL( aIapId ); + CleanupClosePushL( iap ); + LOG_WRITE( "Move Iap to internet destination" ); + destination.AddConnectionMethodL( iap ); + destination.UpdateL(); + CleanupStack::PopAndDestroy( &iap ); + } + CleanupStack::PopAndDestroy( &destination ); + } + CleanupStack::PopAndDestroy( &destinations ); + CleanupStack::PopAndDestroy( &cmManager ); + } + + +// ---------------------------------------------------------------------------- +// CWsfIct::TestConnectedAccessPointL +// ---------------------------------------------------------------------------- +// +void CWsfIct::TestConnectedAccessPointL( TUint aIapId ) + { + LOG_ENTERFN( "CWsfIct::TestConnectedAccessPointL" ); + if ( !aIapId || aIapId != iIapId ) + { + // the wlaninfo must already contain a valid IAP id + LOG_WRITE( "invalid IAP id" ); + return; + } + + if ( iIct ) + { + iIct->CancelStartL(); + delete iIct; + iIct = NULL; + } + + LOG_WRITE( "starting ICT test..." ); + + iIct = CIctsClientInterface::NewL( iIapId, iNetId, *this ); + LOG_WRITE( "ICT created" ); + iIct->StartL(); + LOG_WRITE( "ICT: started" ); + } + + +// ---------------------------------------------------------------------------- +// CWsfIct::InitializeIctL +// ---------------------------------------------------------------------------- +// +void CWsfIct::InitializeIctL( TBool aTestAccessPoint, + TUint aIapId, + TBool aConnectOnly ) + { + LOG_ENTERFN( "CWsfIct::InitializeIct" ); + + LOG_WRITEF( "IAP id = %d aTestAccessPoint = %d aConnectOnly = %d", + aIapId, aTestAccessPoint, aConnectOnly ); + + if ( !aIapId || !aTestAccessPoint ) + { + // the wlaninfo must already contain a valid IAP id + // and check that IAP needs testing + LOG_WRITE( "ICT not initialized" ); + iConnectOnly = EFalse; + iIapId = 0; + iNetId = 0; + return; + } + + // set variables + iConnectOnly = aConnectOnly; + iIapId = aIapId; + + if ( iIct ) + { + iIct->CancelStartL(); + delete iIct; + iIct = NULL; + } + + // get network Id + RCmManagerExt cmManager; + cmManager.OpenL(); + CleanupClosePushL(cmManager); + + RCmConnectionMethodExt cm = cmManager.ConnectionMethodL(iIapId); + CleanupClosePushL(cm); + + iNetId = cm.GetIntAttributeL(CMManager::ECmNetworkId); + + LOG_WRITEF( "Network Id=%d ", iNetId ); + + CleanupStack::PopAndDestroy(&cm); + CleanupStack::PopAndDestroy(&cmManager); + } + +// End of file + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/src/wsfserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/src/wsfserver.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,351 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfServer +* +*/ + + +// CLASS HEADER +#include "wsfserver.h" + +// INTERNAL INCLUDES +#include "wsfengine.h" +#include "wsfsession.h" +#include "wsfservercommon.h" +#include "wsflogger.h" + + +// LOCAL DEFINITIONS +/** +* Number of security ranges +*/ +static const TInt KRangeCount = 1; + + +/** +* Security ranges +*/ +static const TInt KSecurityRanges[KRangeCount] = + { + 0, + }; + + +/** +* Policy for the security ranges +*/ +static const TUint8 KSecurityRangesPolicy[KRangeCount] = + { + CPolicyServer::ECustomCheck + }; + + +/** +* The complete policy structure +*/ +static const CPolicyServer::TPolicy KPolicy = + { + CPolicyServer::EAlwaysPass, + KRangeCount, + KSecurityRanges, + KSecurityRangesPolicy, + NULL, + }; + + +/** +* Secure ID of the Active Idle (ailaunch.exe) +*/ +static _LIT_SECURE_ID( KSidActiveIdle, 0x102750F0 ); + + + +// --------------------------------------------------------------------------- +// CWsfServer::NewLC +// --------------------------------------------------------------------------- +// +CWsfServer* CWsfServer::NewLC() + { + CWsfServer* snifferServer = new (ELeave) CWsfServer( + CActive::EPriorityHigh ); + CleanupStack::PushL( snifferServer ); + snifferServer->ConstructL(); + snifferServer->StartL( KWlanSnifferServerName ); + + return snifferServer; + } + + +// --------------------------------------------------------------------------- +// CWsfServer::NewSessionL +// --------------------------------------------------------------------------- +// +CSession2* CWsfServer::NewSessionL( const TVersion& aVersion, + const RMessage2& /*aMessage*/) const + { + LOG_ENTERFN( "CWsfServer::NewSessionL" ); + // check we're the right version + TVersion v( KWlanSnifferServerMajor, + KWlanSnifferServerMinor, + KWlanSnifferServerBuild ); + + if ( !User::QueryVersionSupported( v, aVersion ) ) + { + User::Leave( KErrNotSupported ); + } + + // make new session + CSession2* newSession = CWsfSession::NewL( + const_cast( *this ) ); + + return newSession; + } + + +// --------------------------------------------------------------------------- +// CWsfServer::CWsfServer +// --------------------------------------------------------------------------- +// +CWsfServer::CWsfServer( TInt aPriority ): + CPolicyServer( aPriority, KPolicy ), + iClientCount( 0 ) + { + } + + +// --------------------------------------------------------------------------- +// CWsfServer::~CWsfServer +// --------------------------------------------------------------------------- +// +CWsfServer::~CWsfServer() + { + delete iCloser; + delete iEngine; + } + + +// --------------------------------------------------------------------------- +// CWsfServer::ConstructL +// --------------------------------------------------------------------------- +// +void CWsfServer::ConstructL() + { + iCloser = CWsfServerCloser::NewL(); + + iEngine = CWsfEngine::NewL( *iCloser ); + + // start the closing up procedure + // so we won't be left running if no clients would appear + iCloser->WaitForClients( EFalse ); + + } + + +// --------------------------------------------------------------------------- +// CWsfServer::ClientRelease +// --------------------------------------------------------------------------- +// +void CWsfServer::ClientRelease() + { + LOG_ENTERFN( "CWsfServer::ClientRelease" ); + --iClientCount; + + // even if there are no clients, we might need to keep the server alive + // to maintain the connection or clean up IAPs properly + if ( !iClientCount ) + { + + // The last client is released. + // Iap deletion must not suppress anymore. Make sure the flag is off. + iEngine->ResetSuppressIapDeletion(); + + // From this point on, the server is kept alive to wait for connection notifications if necessary. + // E.g. browser could be launched by sniffer and WLAN connection still exists after sniffer shut down, + // server waits for connection lost callback and cleans up temporary IAPs when connection is closed. + + // If no connections are available, make sure the the server is NOT kept alive to wait + // browser exit, because the server is not set to monitor those notifications directly. + if( !iEngine->IsConnected() ) + { + iCloser->WaitForBrowserExit( EFalse ); + } + + iCloser->WaitForClients( EFalse ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfServer::ClientAttach +// --------------------------------------------------------------------------- +// +void CWsfServer::ClientAttach() + { + LOG_ENTERFN( "CWsfServer::ClientAttach" ); + iCloser->Cancel(); + ++iClientCount; + + iCloser->WaitForClients( ETrue ); + } + + +// --------------------------------------------------------------------------- +// CWsfServer::Engine +// --------------------------------------------------------------------------- +// +CWsfEngine* CWsfServer::Engine() + { + return iEngine; + } + + +// --------------------------------------------------------------------------- +// CWsfServer::RunServer +// --------------------------------------------------------------------------- +// +TInt CWsfServer::RunServer() + { + CTrapCleanup* cleanup = CTrapCleanup::New(); + TInt ret = KErrNoMemory; + if ( cleanup ) + { + TRAP( ret, CWsfServer::RunServerL() ); + delete cleanup; + } + + if ( ret != KErrNone ) + { + // Signal the client that server creation failed + RProcess::Rendezvous( ret ); + } + + return KErrNone; + } + + +// --------------------------------------------------------------------------- +// CWsfServer::RunServerL +// --------------------------------------------------------------------------- +// +void CWsfServer::RunServerL() + { + // Create and install the active scheduler we need + CActiveScheduler *as = new (ELeave) CActiveScheduler; + CleanupStack::PushL( as ); + CActiveScheduler::Install( as ); + + // Create server + CWsfServer::NewLC(); + + // Initialisation complete, now signal the client + User::LeaveIfError( RThread().RenameMe( KWlanSnifferServerName ) ); + RProcess::Rendezvous( KErrNone ); + + // Ready to run + CActiveScheduler::Start(); + + // Cleanup the server and scheduler + CleanupStack::PopAndDestroy( 2, as ); + } + + +// --------------------------------------------------------------------------- +// CWsfServer::RunError +// --------------------------------------------------------------------------- +// +TInt CWsfServer::RunError( TInt /*aError*/ ) + { + return KErrNone; + } + + +// --------------------------------------------------------------------------- +// CWsfServer::E32Main +// --------------------------------------------------------------------------- +// +TInt E32Main() + { + TInt error( KErrNone ); + error = CWsfServer::RunServer(); + return error; + } + + +// --------------------------------------------------------------------------- +// CWsfServer::CustomSecurityCheckL +// --------------------------------------------------------------------------- +// +CPolicyServer::TCustomResult CWsfServer::CustomSecurityCheckL( + const RMessage2& aMsg, + TInt& /*aAction*/, + TSecurityInfo& /*aMissing*/ ) + { + TCustomResult ret = EFail; + + switch ( aMsg.Function() ) + { + // NULL CAPABILITIES + case ESnifferCmdNotifyEvents: + case ESnifferCmdCancelNotifyEvents: + case ESnifferCmdIsScanEnabled: + case ESnifferCmdCancelAll: + case ESnifferCmdConnectionName: + case ESnifferCmdIsConnected: + case ESnifferCmdMonitorAp: + { + ret = EPass; + break; + } + + // CAPABILITY NEEDED + case ESnifferCmdActivateScan: + case ESnifferCmdDisableScan: + case ESnifferCmdWlanDataSize: + case ESnifferCmdGetWlanInfo: + case ESnifferCmdConnectedDetails: + case ESnifferCmdConnect: + case ESnifferCmdDisconnect: + case ESnifferCmdRequestScan: + case ESnifferCmdAbortScanning: + case ESnifferCmdAbortConnecting: + case ESnifferCmdSetIapPersistence: + case ESnifferCmdControlDisconnectTimer: + { + // if it is called from ailaunch.exe + // disgusting workaround + if ( aMsg.SecureId() == KSidActiveIdle ) + { + ret = EPass; + } + else + { + ret = ( aMsg.HasCapability( ECapabilityNetworkServices ) && + aMsg.HasCapability( ECapabilityNetworkControl ) )? + EPass : EFail; + } + break; + } + + default: + { + ret = EPass; + break; + } + + } + + + return ret; + } + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/src/wsfservercloser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/src/wsfservercloser.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,141 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfServerCloser +* +*/ + + +// CLASS HEADER +#include "wsfserver.h" + + +/** +* Timeout after all closing requirements are met (in microseconds) +*/ +static const TInt KServerClosureWaitTimer = 2 * 1000 * 1000; + + +// --------------------------------------------------------------------------- +// CWsfServer::CWsfServerCloser::NewL +// --------------------------------------------------------------------------- +// +CWsfServer::CWsfServerCloser* CWsfServer::CWsfServerCloser::NewL() + { + CWsfServer::CWsfServerCloser* thisPtr = new (ELeave) CWsfServerCloser(); + CleanupStack::PushL( thisPtr ); + thisPtr->ConstructL(); + CleanupStack::Pop( thisPtr ); + return thisPtr; + } + + +// --------------------------------------------------------------------------- +// CWsfServer::CWsfServerCloser::~CWsfServerCloser +// --------------------------------------------------------------------------- +// +CWsfServer::CWsfServerCloser::~CWsfServerCloser() + { + Cancel(); + } + + +// --------------------------------------------------------------------------- +// CWsfServer::CWsfServerCloser::CWsfServerCloser +// --------------------------------------------------------------------------- +// +CWsfServer::CWsfServerCloser::CWsfServerCloser(): + CTimer( CActive::EPriorityStandard ), + iWaitForOwnedConnection( EFalse ), + iWaitForBrowserExit( EFalse ), + iWaitForClients( EFalse ) + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------------------------- +// CWsfServer::CWsfServerCloser::ConstructL +// --------------------------------------------------------------------------- +// +void CWsfServer::CWsfServerCloser::ConstructL() + { + CTimer::ConstructL(); + } + + +// --------------------------------------------------------------------------- +// CWsfServer::CWsfServerCloser::RunL +// --------------------------------------------------------------------------- +// +void CWsfServer::CWsfServerCloser::RunL() + { + CActiveScheduler::Stop(); + } + + +// --------------------------------------------------------------------------- +// CWsfServer::CWsfServerCloser::StartClosureWait +// --------------------------------------------------------------------------- +// +void CWsfServer::CWsfServerCloser::StartClosureWait() + { + Cancel(); + + if ( !iWaitForClients && !iWaitForBrowserExit && !iWaitForOwnedConnection ) + { + After( TTimeIntervalMicroSeconds32( KServerClosureWaitTimer ) ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfServer::CWsfServerCloser::WaitForClients +// --------------------------------------------------------------------------- +// +void CWsfServer::CWsfServerCloser::WaitForClients( TBool aWait ) + { + iWaitForClients = aWait; + if ( !aWait ) + { + StartClosureWait(); + } + } + +// --------------------------------------------------------------------------- +// CWsfServer::CWsfServerCloser::WaitForOwnedConnection +// --------------------------------------------------------------------------- +// +void CWsfServer::CWsfServerCloser::WaitForOwnedConnection( TBool aWait ) + { + iWaitForOwnedConnection = aWait; + if ( !aWait ) + { + StartClosureWait(); + } + } + + +// --------------------------------------------------------------------------- +// CWsfServer::CWsfServerCloser::WaitForBrowserExit +// --------------------------------------------------------------------------- +// +void CWsfServer::CWsfServerCloser::WaitForBrowserExit( TBool aWait ) + { + iWaitForBrowserExit = aWait; + if ( !aWait ) + { + StartClosureWait(); + } + } + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/src/wsfsession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/src/wsfsession.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,720 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfSession +* +*/ + + +// CLASS HEADER +#include "wsfsession.h" +#include "wsfserver.h" +#include "wsfengine.h" +#include "wsfservercommon.h" +#include "wsfwlaninfo.h" +#include "wsflogger.h" + + +// ---------------------------------------------------------------------------- +// CWsfSession::CWsfSession +// ---------------------------------------------------------------------------- +// +CWsfSession::CWsfSession( CWsfServer& aServer ): + iServer( aServer ), + iRequestNotify( EFalse ), + iEnabledScanning( EFalse ) + { + } + + +// ---------------------------------------------------------------------------- +// CWsfSession::NewL +// ---------------------------------------------------------------------------- +// +CWsfSession* CWsfSession::NewL( CWsfServer& aServer ) + { + CWsfSession* thisPtr = new (ELeave) CWsfSession( aServer ); + CleanupStack::PushL( thisPtr ); + thisPtr->ConstructL(); + CleanupStack::Pop( thisPtr ); + return thisPtr; + } + + +// ---------------------------------------------------------------------------- +// CWsfSession::~CWsfSession +// ---------------------------------------------------------------------------- +// +CWsfSession::~CWsfSession() + { + LOG_ENTERFN( "CWsfSession::~CWsfSession" ); + CancelPendingTasks(); + iServer.Engine()->Detach( this ); + iServer.ClientRelease(); + iEventQueue.Close(); + } + + +// ---------------------------------------------------------------------------- +// CWsfSession::ConstructL +// ---------------------------------------------------------------------------- +// +void CWsfSession::ConstructL() + { + iServer.ClientAttach(); + iServer.Engine()->AttachL( this ); + iEnabledScanning = iServer.Engine()->IsScanning(); + } + + +// ---------------------------------------------------------------------------- +// CWsfSession::ServiceL +// ---------------------------------------------------------------------------- +// +void CWsfSession::ServiceL( const RMessage2& aMessage ) + { + TRAPD( err, DispatchMessageL( aMessage ) ); + if ( err != KErrNone ) + { + LOG_WRITEF( "CWsfSession::ServiceL DispatchMessageL leave error = %d", + err ); + aMessage.Complete( err ); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfSession::DispatchMessageL +// ---------------------------------------------------------------------------- +// +void CWsfSession::DispatchMessageL( const RMessage2& aMessage ) + { + LOG_ENTERFN( "CWsfSession::DispatchMessageL" ); + LOG_WRITEF( "CWsfSession::DispatchMessageL message = %d", + aMessage.Function() ); + + switch ( aMessage.Function() ) + { + case ESnifferCmdWlanDataSize: + { + ReplyWlanDataSizeL( aMessage ); + aMessage.Complete( KErrNone ); + break; + } + + case ESnifferCmdNotifyEvents: + { + RequestNotifyL( aMessage ); + break; + } + + case ESnifferCmdCancelNotifyEvents: + { + CancelNotifyEvents(); + aMessage.Complete( KErrNone ); + break; + } + + case ESnifferCmdGetWlanInfo: + { + WriteWlanDataL( aMessage ); + aMessage.Complete( KErrNone ); + break; + } + + case ESnifferCmdConnect: + { + ConnectWlanL( aMessage ); + aMessage.Complete( KErrNone ); + break; + } + + case ESnifferCmdDisconnect: + { + DisconnectWlanL( aMessage ); + aMessage.Complete( KErrNone ); + break; + } + + case ESnifferCmdActivateScan: + { + ActivateScanL(); + aMessage.Complete( KErrNone ); + break; + } + + case ESnifferCmdDisableScan: + { + DisableScanL(); + aMessage.Complete( KErrNone ); + break; + } + + case ESnifferCmdConnectionName: + { + GetConnectedAccountNameL( aMessage ); + aMessage.Complete( KErrNone ); + break; + } + + case ESnifferCmdCancelAll: + { + CancelPendingTasks(); + aMessage.Complete( KErrNone ); + break; + } + + case ESnifferCmdRequestScan: + { + RequestScanL( aMessage ); + aMessage.Complete( KErrNone ); + break; + } + + case ESnifferCmdMonitorAp: + { + MonitorApL( aMessage ); + aMessage.Complete( KErrNone ); + break; + } + + case ESnifferCmdIsScanEnabled: + { + ReplyIsScanningL(aMessage); + aMessage.Complete( KErrNone ); + break; + } + + case ESnifferCmdIsConnected: + { + IsConnectedL( aMessage ); + aMessage.Complete( KErrNone ); + break; + } + + case ESnifferCmdConnectedDetails: + { + GetConnectedDetailsL( aMessage ); + aMessage.Complete( KErrNone ); + break; + } + + case ESnifferCmdAbortScanning: + { + AbortScanning(); + aMessage.Complete( KErrNone ); + break; + } + + case ESnifferCmdAbortConnecting: + { + AbortConnectingL(); + aMessage.Complete( KErrNone ); + break; + } + + case ESnifferCmdSetIapPersistence: + { + SetIapPersistenceL( aMessage ); + aMessage.Complete( KErrNone ); + break; + } + + case ESnifferCmdControlDisconnectTimer: + { + ControlDisconnectTimerL( aMessage ); + aMessage.Complete( KErrNone ); + break; + } + + + // requests we don't understand at all are a different thing, + // so panic the client here, this function also completes the message + default: + { + _LIT( KWsfServerPanic, "WlanSnifferServer" ); + aMessage.Panic( KWsfServerPanic, 1 ); + } + + } + } + + +// --------------------------------------------------------------------------- +// CWsfSession::RequestNotify +// --------------------------------------------------------------------------- +// +void CWsfSession::RequestNotifyL( const RMessage2& aMessage ) + { + LOG_ENTERFN( "CWsfSession::RequestNotifyL" ); + if ( !iRequestNotify ) + { + LOG_WRITE( "CWsfSession::RequestNotifyL first subscription" ); + // first subscription + iRequestNotify = ETrue; + iEventQueue.Reset(); + } + + // initial value / processing finished + iProcessingEvent = EFalse; + + // store the message to be completed + iNotifyChangesMessage = aMessage; + + // deal with the queue + if ( iEventQueue.Count() ) + { + LOG_WRITE( "CWsfSession::RequestNotifyL queue not empty" ); + NotifyClientL(); + } + } + + +// --------------------------------------------------------------------------- +// CWsfSession::CancelNotifyEvents +// --------------------------------------------------------------------------- +// +void CWsfSession::CancelNotifyEvents() + { + LOG_ENTERFN( "CWsfSession::CancelNotifyEvents" ); + + // interrupt ongoing event handling + iProcessingEvent = EFalse; + if ( !iNotifyChangesMessage.IsNull() ) + { + iNotifyChangesMessage.Complete( KErrCancel ); + } + + // unsubscribe + iRequestNotify = EFalse; + + // drop all waiting events + iEventQueue.Reset(); + } + + +// --------------------------------------------------------------------------- +// CWsfSession::CancelPendingTasks +// --------------------------------------------------------------------------- +// +void CWsfSession::CancelPendingTasks() + { + LOG_ENTERFN( "CWsfSession::CancelPendingTasks" ); + if ( iEnabledScanning ) + { + TRAP_IGNORE( iServer.Engine()->DisableScanningL() ); + } + + CancelNotifyEvents(); + } + + + +// from MWsfEngineObserver + +// --------------------------------------------------------------------------- +// CWsfSession::WlanListChangedL +// --------------------------------------------------------------------------- +// +void CWsfSession::WlanListChangedL() + { + LOG_ENTERFN( "CWsfSession::WlanListChangedL" ); + TWsfNotifyEventContainer event = { EEngineWlanDataChanged, KErrNone }; + iEventQueue.AppendL( event ); + + NotifyClientL(); + } + + +// --------------------------------------------------------------------------- +// CWsfSession::NotifyErrorL +// --------------------------------------------------------------------------- +// +void CWsfSession::NotifyErrorL( TInt aError ) + { + LOG_ENTERFN( "CWsfSession::NotifyErrorL" ); + TWsfNotifyEventContainer event = { EEngineError, aError }; + iEventQueue.AppendL( event ); + + NotifyClientL(); + } + + +// --------------------------------------------------------------------------- +// CWsfSession::ScanEnabledL +// --------------------------------------------------------------------------- +// +void CWsfSession::ScanEnabledL() + { + LOG_ENTERFN( "CWsfSession::ScanEnabledL" ); + iEnabledScanning = ETrue; + TWsfNotifyEventContainer event = { EEngineScanEnabled, KErrNone }; + iEventQueue.AppendL( event ); + + NotifyClientL(); + } + + +// --------------------------------------------------------------------------- +// CWsfSession::ScanDisabledL +// --------------------------------------------------------------------------- +// +void CWsfSession::ScanDisabledL() + { + LOG_ENTERFN( "CWsfSession::ScanDisabledL" ); + iEnabledScanning = EFalse; + TWsfNotifyEventContainer event = { EEngineScanDisabled, KErrNone }; + iEventQueue.AppendL( event ); + + NotifyClientL(); + } + + +// --------------------------------------------------------------------------- +// CWsfSession::ConnectedL +// --------------------------------------------------------------------------- +// +void CWsfSession::ConnectedL() + { + LOG_ENTERFN( "CWsfSession::ConnectedL" ); + TWsfNotifyEventContainer event = { EEngineConnected, KErrNone }; + iEventQueue.AppendL( event ); + + NotifyClientL(); + } + + +// --------------------------------------------------------------------------- +// CWsfSession::DisconnectedL +// --------------------------------------------------------------------------- +// +void CWsfSession::DisconnectedL() + { + LOG_ENTERFN( "CWsfSession::DisconnectedL" ); + TWsfNotifyEventContainer event = { EEngineDisconnected, KErrNone }; + iEventQueue.AppendL( event ); + + NotifyClientL(); + } + + +// --------------------------------------------------------------------------- +// CWsfSession::ConnectingFailedL +// --------------------------------------------------------------------------- +// +void CWsfSession::ConnectingFailedL( TInt aError ) + { + LOG_ENTERFN( "CWsfSession::ConnectingFailedL" ); + TWsfNotifyEventContainer event = { EEngineConnectingFailed, aError }; + iEventQueue.AppendL( event ); + + NotifyClientL(); + } + + +// --------------------------------------------------------------------------- +// CWsfSession::NotifyClientL +// --------------------------------------------------------------------------- +// +void CWsfSession::NotifyClientL() + { + LOG_ENTERFN( "CWsfSession::NotifyClientL" ); + + if ( iRequestNotify && !iProcessingEvent ) + { + LOG_WRITE( "CWsfSession::NotifyClientL notify" ); + TPckgBuf container( iEventQueue[0] ); + + iNotifyChangesMessage.WriteL( 0, container ); + + // remove the item that we have just handed over + iEventQueue.Remove( 0 ); + + iProcessingEvent = ETrue; + iNotifyChangesMessage.Complete( KErrNone ); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfSession::GetConnectedAccountNameL +// ---------------------------------------------------------------------------- +// +void CWsfSession::GetConnectedAccountNameL( const RMessage2& aMessage ) + { + LOG_ENTERFN( "CWsfSession::GetConnectedAccountNameL" ); + HBufC* iapName = iServer.Engine()->ConnectedWlanSsidL(); + CleanupStack::PushL( iapName ); + TPckgBuf package; + + TInt maxLen = package().iConnectedAccountName.MaxLength(); + + if ( iapName->Length() ) + { + if ( iapName->Length() > maxLen ) + { + package().iConnectedAccountName.Copy( iapName->Ptr(), maxLen ); + } + else + { + package().iConnectedAccountName.Copy( *iapName ); + } + package().iConnected = ETrue; + } + else + { + package().iConnected = EFalse; + } + aMessage.WriteL( 0, package ); + CleanupStack::PopAndDestroy( iapName ); + } + + +// ---------------------------------------------------------------------------- +// CWsfSession::GetConnectedDetailsL +// ---------------------------------------------------------------------------- +// +void CWsfSession::GetConnectedDetailsL( const RMessage2& aMessage ) + { + LOG_ENTERFN( "CWsfSession::GetConnectedDetailsL" ); + TPckgBuf package; + TPckgBuf ret( ETrue ); + + if ( !iServer.Engine()->ConnectedWlanConnectionDetailsL( package() ) ) + { + LOG_WRITE( "engine returned false, so wlaninfo is marked as invalid" ); + ret() = EFalse; + } + + aMessage.WriteL( 0, ret ); + aMessage.WriteL( 1, package ); + } + + +// ---------------------------------------------------------------------------- +// CWsfSession::ReplyWlanDataSizeL +// ---------------------------------------------------------------------------- +// +void CWsfSession::ReplyWlanDataSizeL( const RMessage2& aMessage ) + { + LOG_ENTERFN( "CWsfSession::ReplyWlanDataSizeL" ); + const TInt KInvalidLength = 0; + TPckgBuf p( KInvalidLength ); + + HBufC8* results = iServer.Engine()->GetScanResults(); + if ( results ) + { + p() = results->Length(); + } + + aMessage.WriteL( 0, p ); + } + + +// ---------------------------------------------------------------------------- +// CWsfSession::WriteWlanDataL +// ---------------------------------------------------------------------------- +// +void CWsfSession::WriteWlanDataL( const RMessage2& aMessage ) + { + LOG_ENTERFN( "CWsfSession::WriteWlanDataL" ); + TPckgBuf sizeData; + + // don't take the ownership + HBufC8* scanData = iServer.Engine()->GetScanResults(); + + if ( scanData ) + { + LOG_WRITEF( "scanData->Length() = %d aMessage.GetDesMaxLength(1) = %d", + scanData->Length(), aMessage.GetDesMaxLength( 1 ) ); + if ( scanData->Length() > aMessage.GetDesMaxLength( 1 ) ) + { + // the data has changed + // return error to client to alloc more buffer + sizeData() = scanData->Length(); + aMessage.WriteL( 0, sizeData ); + } + else + { + // else we have enough buffer... copy the data + sizeData() = scanData->Length(); + aMessage.WriteL( 0, sizeData ); + aMessage.WriteL( 1, *scanData, 0 ); + } + } + } + + +// ---------------------------------------------------------------------------- +// CWsfSession::ActivateScanL +// ---------------------------------------------------------------------------- +// +void CWsfSession::ActivateScanL() + { + LOG_ENTERFN( "CWsfSession::ActivateScanL" ); + iServer.Engine()->EnableScanningL(); + iEnabledScanning = ETrue; + } + + +// ---------------------------------------------------------------------------- +// CWsfSession::DisableScanL +// ---------------------------------------------------------------------------- +// +void CWsfSession::DisableScanL() + { + LOG_ENTERFN( "CWsfSession::DisableScanL" ); + if ( iEnabledScanning ) + { + iServer.Engine()->DisableScanningL(); + iEnabledScanning = EFalse; + } + } + + +// ---------------------------------------------------------------------------- +// CWsfSession::ConnectWlanL +// ---------------------------------------------------------------------------- +// +void CWsfSession::ConnectWlanL( const RMessage2& aMessage ) + { + LOG_ENTERFN( "CWsfSession::ConnectWlanL" ); + TUint32 iapId( aMessage.Int1() ); + TBool connectOnly( aMessage.Int2() ); + TWsfIapPersistence persistence( TWsfIapPersistence( aMessage.Int3() ) ); + TPckgBuf p( iServer.Engine()->ConnectWlanL( iapId, connectOnly, persistence ) ); + aMessage.WriteL( 0, p ); + } + + +// ---------------------------------------------------------------------------- +// CWsfSession::DisconnectWlanL +// ---------------------------------------------------------------------------- +// +void CWsfSession::DisconnectWlanL( const RMessage2& aMessage ) + { + LOG_ENTERFN( "CWsfSession::DisconnectWlanL" ); + TPckgBuf p( iServer.Engine()->DisconnectWlan() ); + aMessage.WriteL( 0, p ); + } + + +// ---------------------------------------------------------------------------- +// CWsfSession::RequestScanL +// ---------------------------------------------------------------------------- +// +void CWsfSession::RequestScanL( const RMessage2& aMessage ) + { + LOG_ENTERFN( "CWsfSession::RequestScanL" ); + TPckgBuf requestMade( EFalse ); + // check if the client has enabled scanning - if not do not request scans + if ( !iEnabledScanning ) + { + LOG_WRITE( "CWsfSession::RequestScanL error, not scanning" ); + aMessage.WriteL( 0, requestMade ); + return; + } + + requestMade = iServer.Engine()->RefreshScanResults(); + aMessage.WriteL( 0, requestMade ); + } + + +// ---------------------------------------------------------------------------- +// CWsfSession::MonitorApL +// ---------------------------------------------------------------------------- +// +void CWsfSession::MonitorApL( const RMessage2& aMessage ) + { + LOG_ENTERFN( "CWsfSession::MonitorApL" ); + TUint32 accessPoint( (TUint32) aMessage.Int0() ); + iServer.Engine()->MonitorAccessPointL( accessPoint ); + } + + +// ---------------------------------------------------------------------------- +// CWsfSession::ReplyIsScanningL +// ---------------------------------------------------------------------------- +// +void CWsfSession::ReplyIsScanningL( const RMessage2& aMessage ) + { + LOG_ENTERFN( "CWsfSession::ReplyIsScanningL" ); + TPckgBuf p( iServer.Engine()->IsScanning() ); + aMessage.WriteL( 0, p ); + } + + +// ---------------------------------------------------------------------------- +// CWsfSession::IsConnectedL +// ---------------------------------------------------------------------------- +// +void CWsfSession::IsConnectedL( const RMessage2& aMessage ) + { + TBool b = iServer.Engine()->IsConnected(); + TPckgBuf p( b ); + aMessage.WriteL( 0, p ); + } + + +// ---------------------------------------------------------------------------- +// CWsfSession::AbortScanning +// ---------------------------------------------------------------------------- +// +void CWsfSession::AbortScanning() + { + LOG_ENTERFN( "CWsfSession::AbortScanningL" ); + iServer.Engine()->AbortScanning(); + } + + +// ---------------------------------------------------------------------------- +// CWsfSession::AbortConnectingL +// ---------------------------------------------------------------------------- +// +void CWsfSession::AbortConnectingL() + { + LOG_ENTERFN( "CWsfSession::AbortConnectingL" ); + iServer.Engine()->AbortConnectingL(); + } + + +// ---------------------------------------------------------------------------- +// CWsfSession::SetIapPersistenceL +// ---------------------------------------------------------------------------- +// +void CWsfSession::SetIapPersistenceL( const RMessage2& aMessage ) + { + LOG_ENTERFN( "CWsfSession::SetIapPersistenceL" ); + + TWsfIapPersistence persistence( TWsfIapPersistence( aMessage.Int1() ) ); + TPckgBuf ret( iServer.Engine()->SetIapPersistenceL( persistence ) ); + + aMessage.WriteL( 0, ret ); + } + + +// ---------------------------------------------------------------------------- +// CWsfSession::ControlDisconnectTimerL +// ---------------------------------------------------------------------------- +// +void CWsfSession::ControlDisconnectTimerL( const RMessage2& aMessage ) + { + LOG_ENTERFN( "CWsfSession::ControlDisconnectTimerL" ); + + TPckgBuf ret( iServer.Engine()->ControlDisconnectTimer( + TUint( aMessage.Int1() ) ) ); + + aMessage.WriteL( 0, ret ); + } + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/src/wsfwlanbearerconnectionmonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/src/wsfwlanbearerconnectionmonitor.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,1137 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfWlanBearerConnectionMonitor +* +*/ + + + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +// CLASS HEADER +#include "wsfwlanbearerconnectionmonitor.h" + +// INTERNAL INCLUDES +#include "wsfwlanmonitorobserver.h" +#include "wsflogger.h" +#include "wsfactivewaiter.h" +#include "wsfservercloseradapter.h" +#include "wsfcommon.h" +#include "wsfict.h" + + +// LOCAL DEFINITIONS +using namespace CMManager; + + +#ifdef _DEBUG + _LIT( KWlanConnMonPanic, "wsfwlanconnmon" ); + #define __ASSERTD(x) __ASSERT_DEBUG( (x), \ + User::Panic( KWlanConnMonPanic, __LINE__ ) ); +#else + #define __ASSERTD(x) +#endif + + +// LOCAL CONSTANTS +/** +* Connection id referring to a non-existing connection +*/ +static const TInt KNoConnection = -1; + +/** +* Max allowed connection inactivity time in seconds +*/ +static const TUint KMaxConnectionInactivityTime = 60; + + +/** +* Client polling interval in microseconds +*/ +static const TUint KClientPollInterval = 5 * 1000 * 1000; + + +/** +* Number of trivial clients of a connection (Sniffer, AI/CP plugin etc) +*/ +static const TUint KTrivialClientCount = 2; + +/** +* List of UIDs of the trivial clients +*/ +static const TUid KTrivialClientUids[KTrivialClientCount] = + { + { 0x10281CAB }, // Sniffer server (wsfserver.exe) + { 0x101fD9C5 } // DHCP server (dhcpserv.exe) + }; + +/** +* Browser UID +*/ +const TUid KCRUidBrowser = {0x10008D39}; + + + +// CONSTRUCTION AND DESTRUCTION + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::NewL +// --------------------------------------------------------------------------- +// +CWsfWlanBearerConnectionMonitor* CWsfWlanBearerConnectionMonitor::NewL( + MWsfServerCloserAdapter& aServerCloser ) + { + CWsfWlanBearerConnectionMonitor* thisPtr = NewLC( aServerCloser ); + CleanupStack::Pop( thisPtr ); + return thisPtr; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::NewLC +// --------------------------------------------------------------------------- +// +CWsfWlanBearerConnectionMonitor* CWsfWlanBearerConnectionMonitor::NewLC( + MWsfServerCloserAdapter& aServerCloser ) + { + CWsfWlanBearerConnectionMonitor* thisPtr = + new (ELeave) CWsfWlanBearerConnectionMonitor( aServerCloser ); + CleanupStack::PushL( thisPtr ); + thisPtr->ConstructL(); + return thisPtr; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::~CWsfWlanBearerConnectionMonitor +// --------------------------------------------------------------------------- +// +CWsfWlanBearerConnectionMonitor::~CWsfWlanBearerConnectionMonitor() + { + LOG_ENTERFN( "CWsfWlanBearerConnectionMonitor::" + L"~CWsfWlanBearerConnectionMonitor" ); + iMonitor.CancelNotifications(); + iMonitor.Close(); + + Cancel(); + + if ( iConnectionOwned ) + { + // in case Cancel() hasn't done the job + TRAP_IGNORE( ShutdownOwnedConnectionL() ); + } + else if ( iMonitoredAp ) + { + + } + + delete iClientPoll; + + delete iIct; + + iCmMgr.Close(); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::CWsfWlanBearerConnectionMonitor +// --------------------------------------------------------------------------- +// +CWsfWlanBearerConnectionMonitor::CWsfWlanBearerConnectionMonitor( + MWsfServerCloserAdapter& aServerCloser ): + CActive( CActive::EPriorityStandard ), + iConnectionId( KNoConnection ), + iMonitoring( EFalse ), + iConnectingState( ECsIdle ), + iServerCloser( aServerCloser ) + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::ConstructL +// --------------------------------------------------------------------------- +// +void CWsfWlanBearerConnectionMonitor::ConstructL() + { + LOG_ENTERFN( "CWsfWlanBearerConnectionMonitor::ConstructL" ); + iCmMgr.OpenL(); + iMonitor.ConnectL(); + iClientPoll = CPeriodic::NewL( CActive::EPriorityLow ); + iIct = CWsfIct::NewL(); + FindWlanBearerConnectedL(); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::GetWlanBearerNameL +// --------------------------------------------------------------------------- +// +const TDesC& CWsfWlanBearerConnectionMonitor::GetWlanBearerNameL() + { + LOG_ENTERFN( "CWsfWlanBearerConnectionMonitor::GetWlanBearerNameL" ); + if ( iConnectionId == KNoConnection ) + { + LOG_WRITE( "[no connection]" ); + return KNullDesC(); + } + + LOG_WRITEF( "connection name: %S", &iWlanNetworkName ); + return iWlanNetworkName; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::FindWlanBearerConnectedL +// --------------------------------------------------------------------------- +// +void CWsfWlanBearerConnectionMonitor::FindWlanBearerConnectedL() + { + LOG_ENTERFN( "CWsfWlanBearerConnectionMonitor::FindWlanBearerConnectedL" ); + CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewLC(); + TUint connectionNumber( 0 ); + + iMonitor.GetConnectionCount( connectionNumber, waiter->iStatus ); + waiter->WaitForRequest(); + + if ( !waiter->iStatus.Int() ) + { + TBool connectionIDFound = EFalse; + for ( TUint i = 1; i <= connectionNumber; ++i ) + { + TUint connectionId( 0 ); + TUint subConnectionCount( 0 ); + + User::LeaveIfError( iMonitor.GetConnectionInfo( i, connectionId, + subConnectionCount ) ); + if ( CheckConnectionDetailsL( connectionId ) ) + { + LOG_WRITEF( "found connection %d", connectionId ); + connectionIDFound = ETrue; + iConnectionId = connectionId; + break; + } + } + if ( !connectionIDFound ) + { + LOG_WRITE( "Reset connection ID" ); + iConnectionId = KNoConnection; + } + } + else + { + LOG_WRITEF( "GetConnectionCount failed error = %d", + waiter->iStatus.Int() ); + } + + CleanupStack::PopAndDestroy( waiter ); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::EventL +// --------------------------------------------------------------------------- +// +void CWsfWlanBearerConnectionMonitor::EventL( + const CConnMonEventBase& aConnMonEvent ) + { + LOG_ENTERFN( "CWsfWlanBearerConnectionMonitor::EventL" ); + + TConnMonEvent event = TConnMonEvent( aConnMonEvent.EventType() ); + TInt connectionId = aConnMonEvent.ConnectionId(); + + LOG_WRITEF( "event = %d", (TInt)event ); + + switch ( event ) + { + case EConnMonCreateConnection: + { + LOG_WRITEF( "EConnMonCreateConnection id = %d", + connectionId ); + break; + } + + case EConnMonConnectionStatusChange: + { + LOG_WRITEF( "EConnMonConnectionStatusChange id = %d", + connectionId ); + + const CConnMonConnectionStatusChange* statusChangeEvent = + static_cast( + &aConnMonEvent ); + + LOG_WRITEF( "EConnMonConnectionStatusChange status = %d", + statusChangeEvent->ConnectionStatus() ); + + if ( statusChangeEvent->ConnectionStatus() == KConnectionOpen && + !iConnectionOwned ) + { + LOG_WRITE( "connection status: open" ); + TBool wlanEvent( EFalse ); + + wlanEvent = CheckConnectionDetailsL( connectionId ); + if ( wlanEvent ) + { + LOG_WRITEF( "[%S] connected, id = %d", + &iWlanNetworkName, connectionId ); + + // notify observer ... + iConnectionId = connectionId; + iObserver->ConnectionEstablishedL( iWlanNetworkName ); + } + } + break; + } + + case EConnMonDeleteConnection: + { + LOG_WRITEF( "EConnMonDeleteConnection id = %d", connectionId ); + + if ( connectionId == iConnectionId ) + { + if ( iConnectionOwned ) + { + LOG_WRITE( "connection was owned, manual closing" ); + ShutdownOwnedConnectionL(); + } + else + { + LOG_WRITE( "connection was not owned" ); + iWlanNetworkName.Zero(); + iConnectionId = KNoConnection; + + // notify observer + iObserver->ConnectionLostL(); + } + } + break; + } + + default: + { + } + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::CheckConnectionDetailsL +// --------------------------------------------------------------------------- +// +TBool CWsfWlanBearerConnectionMonitor::CheckConnectionDetailsL( + TUint aConnectionId ) + { + LOG_ENTERFN( "CWsfWlanBearerConnectionMonitor::CheckConnectionDetailsL" ); + LOG_WRITEF( "aConnectionId: %d", aConnectionId ); + TConnMonBearerType bearerType( EBearerUnknown ); + + TBool foundWlanBearer( EFalse ); + + // Add only connections with valid id + if ( aConnectionId > 0 ) + { + CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewLC(); + iMonitor.GetIntAttribute( aConnectionId, 0, KBearer, + (TInt&)bearerType, + waiter->iStatus ); + waiter->WaitForRequest(); + LOG_WRITEF( "found bearer: %d", bearerType ); + + if ( waiter->iStatus.Int() == KErrNone ) + { + LOG_WRITE( "status: KErrNone" ); + if ( bearerType == EBearerWLAN ) + { + + iMonitor.GetStringAttribute( aConnectionId, 0, KNetworkName, + iWlanNetworkName, waiter->iStatus ); + waiter->WaitForRequest(); + if ( waiter->iStatus.Int() == KErrNone ) + { + LOG_WRITEF( "WLAN network name: %S", &iWlanNetworkName ); + foundWlanBearer = ETrue; + } + + } + } + else + { + LOG_WRITEF( "status: %d", waiter->iStatus.Int() ); + } + CleanupStack::PopAndDestroy( waiter ); + } + + return foundWlanBearer; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::StartMonitoringL +// --------------------------------------------------------------------------- +// +void CWsfWlanBearerConnectionMonitor::StartMonitoringL( + MWsfWlanMonitorObserver* aObserver ) + { + LOG_ENTERFN( "CWsfWlanBearerConnectionMonitor::StartMonitoringL" ); + __ASSERTD( aObserver ); + + iObserver = aObserver; + if ( !iMonitoring ) + { + iMonitoring = ETrue; + iMonitor.NotifyEventL( *this ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::StopMonitoring +// --------------------------------------------------------------------------- +// +void CWsfWlanBearerConnectionMonitor::StopMonitoring() + { + LOG_ENTERFN( "CWsfWlanBearerConnectionMonitor::StopMonitoring" ); + + if ( iMonitoring ) + { + iMonitoredAp = 0; + iMonitoring = EFalse; + iMonitor.CancelNotifications(); + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::ConnectBearer +// --------------------------------------------------------------------------- +// +TInt CWsfWlanBearerConnectionMonitor::ConnectBearer( TUint32 aIapId, + TBool aConnectOnly, + TBool aTestAccessPoint ) + { + LOG_ENTERFN( "CWsfWlanBearerConnectionMonitor::ConnectBearer" ); + + if ( iConnectionId != KNoConnection || iConnectingState != ECsIdle ) + { + // there is already a connection + LOG_WRITE( "there is already a WLAN connection" ); + return KErrWlanConnAlreadyActive; + } + + // self-completion + if ( iConnectingState == ECsIdle ) + { + LOG_WRITE( "initiating connection process" ); + iConnIap = aIapId; + iConnectingState = ECsNotConnected; + iConnectionOwned = ETrue; + iServerCloser.WaitForOwnedConnection( ETrue ); + + TRAPD( err, iIct->InitializeIctL( aTestAccessPoint, aIapId, + aConnectOnly ) ); + if ( err ) + { + LOG_WRITEF( "Ict initialization failed error = %d", err ); + } + + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + + return KErrNone; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::DisconnectBearer +// --------------------------------------------------------------------------- +// +TBool CWsfWlanBearerConnectionMonitor::DisconnectBearer() + { + LOG_ENTERFN( "CWsfWlanBearerConnectionMonitor::DisconnectBearer" ); + + if ( iConnectionId != KNoConnection ) + { + LOG_WRITEF( "closing connection id = %d", iConnectionId ); + iMonitor.SetBoolAttribute( iConnectionId, 0, KConnectionStop, ETrue ); + } + + return ( iConnectionId != KNoConnection ); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::AbortConnecting +// --------------------------------------------------------------------------- +// +TInt CWsfWlanBearerConnectionMonitor::AbortConnecting() + { + LOG_ENTERFN( "CWsfWlanBearerConnectionMonitor::AbortConnecting" ); + TInt result = KErrGeneral; + + if ( iConnectingState != ECsIdle ) + { + LOG_WRITE( "connection in progress, aborting"); + iAborting = ETrue; + + if ( IsActive() && iConnectingState == ECsSocketOpened ) + { + LOG_WRITE( "forcing connection to stop" ); + result = iConnection.Stop(); + } + } + return result; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::MonitorAccessPoint +// --------------------------------------------------------------------------- +// +void CWsfWlanBearerConnectionMonitor::MonitorAccessPoint( TUint32 aIapId ) + { + LOG_ENTERFN( "CWsfWlanBearerConnectionMonitor::MonitorAccessPoint" ); + iMonitoredAp = aIapId; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::ConnectedWlanConnectionDetailsL +// --------------------------------------------------------------------------- +// +TBool CWsfWlanBearerConnectionMonitor::ConnectedWlanConnectionDetailsL( + TWsfWlanInfo* aWlanInfo ) + { + LOG_ENTERFN( "CWsfWlanBearerConnectionMonitor::" + L"ConnectedWlanConnectionDetailsL" ); + + LOG_WRITEF( "Monitor iConnectingState =%d and iConnectionId = %d", + iConnectingState, iConnectionId ); + + if ( iConnectingState == ECsIdle && iConnectionId == KNoConnection ) + { + // Make sure that we have connection id + FindWlanBearerConnectedL(); + } + + if ( iConnectionId == KNoConnection ) + { + return EFalse; + } + + // get the data's from the monitor add them to aWlanInfo.. + aWlanInfo->iConnectionState = EConnected; + aWlanInfo->iVisibility = 1; + aWlanInfo->iCoverage = 1; + aWlanInfo->iNetworkName = KNullDesC8; + + CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewLC(); + + // security mode + TInt securityAttribute( EWlanConnectionSecurityOpen ); + iMonitor.GetIntAttribute( iConnectionId, 0, KSecurityMode, + securityAttribute, waiter->iStatus ); + waiter->WaitForRequest(); + + if ( waiter->iStatus.Int() != KErrNone ) + { + aWlanInfo->iConnectionState = ENotConnected; + CleanupStack::PopAndDestroy( waiter ); + return EFalse; + } + + switch ( securityAttribute ) + { + case EConnMonSecurityWep: + { + aWlanInfo->iSecurityMode = EWlanSecModeWep; + break; + } + + case EConnMonSecurity802d1x: + { + aWlanInfo->iSecurityMode = EWlanSecMode802_1x; + break; + } + + case EConnMonSecurityWpa: // fall-through + case EConnMonSecurityWpaPsk: + { + aWlanInfo->iSecurityMode = EWlanSecModeWpa; + break; + } + + case EConnMonSecurityOpen: // fall-through + default: + { + aWlanInfo->iSecurityMode = EWlanSecModeOpen; + } + } + LOG_WRITEF( "conn.secmode = %d", aWlanInfo->iSecurityMode ); + + aWlanInfo->SetUsesPreSharedKey( + EConnMonSecurityWpaPsk == securityAttribute ); + + LOG_WRITEF( "conn.usespresharedkey = %d", aWlanInfo->UsesPreSharedKey() ); + + // network mode + TInt networkModeAttribute( 0 ); + + iMonitor.GetIntAttribute( iConnectionId, 0, KNetworkMode, + networkModeAttribute, waiter->iStatus ); + waiter->WaitForRequest(); + + if ( waiter->iStatus.Int() != KErrNone ) + { + aWlanInfo->iConnectionState = ENotConnected; + CleanupStack::PopAndDestroy( waiter ); + return EFalse; + } + + if ( networkModeAttribute == EConnMonAdHoc ) + { + aWlanInfo->iNetMode = EAdhoc; + } + else + { + aWlanInfo->iNetMode = EInfra; + } + + LOG_WRITEF( "conn.netmode = %d", aWlanInfo->iNetMode ); + + // iap id + TUint iapIdAttribute( 0 ); + iMonitor.GetUintAttribute( iConnectionId, 0, KIAPId, + iapIdAttribute, waiter->iStatus ); + waiter->WaitForRequest(); + + if ( waiter->iStatus.Int() != KErrNone ) + { + aWlanInfo->iConnectionState = ENotConnected; + CleanupStack::PopAndDestroy( waiter ); + return EFalse; + } + + aWlanInfo->iIapId = iapIdAttribute; + + LOG_WRITEF( "conn.iap = %d", aWlanInfo->iIapId ); + + // signal strength + TInt signStrengthAttribute( 0 ); + iMonitor.GetIntAttribute( iConnectionId, 0, KSignalStrength, + signStrengthAttribute, waiter->iStatus ); + waiter->WaitForRequest(); + + if ( waiter->iStatus.Int() != KErrNone ) + { + aWlanInfo->iConnectionState = ENotConnected; + CleanupStack::PopAndDestroy( waiter ); + return EFalse; + } + + aWlanInfo->iStrengthLevel = signStrengthAttribute; + LOG_WRITEF( "conn.signalstrength = %d", aWlanInfo->iStrengthLevel ); + + if ( aWlanInfo->iIapId ) + { + LOG_WRITE( "IAP id != 0" ); + + RCmConnectionMethodExt cm = iCmMgr.ConnectionMethodL( aWlanInfo->iIapId ); + CleanupClosePushL( cm ); + HBufC* buf = NULL; + + if ( iCmMgr.EasyWlanIdL() != aWlanInfo->iIapId ) + { + LOG_WRITE( "not EasyWLAN" ); + buf = cm.GetStringAttributeL( ECmName ); + } + else + { + LOG_WRITE("Sniffer:EasyWLAN IAP "); + aWlanInfo->iIapId = 0; + buf = cm.GetStringAttributeL( EWlanUsedSSID ); + } + + if ( buf ) + { + TInt error = CnvUtfConverter::ConvertFromUnicodeToUtf8( + aWlanInfo->iSsid, + *buf ); + if ( error ) + { + LOG_WRITE( "ConvertFromUnicodeToUtf8 failed"); + aWlanInfo->iSsid.Copy( *buf ); + } + delete buf; + } + CleanupStack::PopAndDestroy( &cm ); //cm + } + else + { + LOG_WRITE( "IAP id = 0" ); + } + +#ifdef _DEBUG + // Iap & Ssid logging + HBufC* nameUnicode = aWlanInfo->GetIapNameAsUnicodeLC(); + LOG_WRITEF( "aWlanInfo->iNetworkName: [%S]", nameUnicode ); + CleanupStack::PopAndDestroy( nameUnicode ); + + HBufC* ssidUnicode = aWlanInfo->GetSsidAsUnicodeLC(); + LOG_WRITEF( "aWlanInfo->tmpSsid: [%S]", ssidUnicode ); + CleanupStack::PopAndDestroy( ssidUnicode ); +#endif + + CleanupStack::PopAndDestroy( waiter ); + + return ETrue; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::IsConnected +// --------------------------------------------------------------------------- +// +TBool CWsfWlanBearerConnectionMonitor::IsConnected() + { + return ( iConnectionId != KNoConnection ); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::CheckClientCount +// --------------------------------------------------------------------------- +// +TInt CWsfWlanBearerConnectionMonitor::CheckClientCount( TAny* aPtr ) + { + LOG_ENTERFN( "CWsfWlanBearerConnectionMonitor::CheckClientCount" ); + CWsfWlanBearerConnectionMonitor* self = + static_cast( aPtr ); + TInt err( KErrNone ); + + if ( !self->iClientCountMutex ) + { + // in some rare cases this function is reentered because of the + // active scheduler waits, so we need a mutex + self->iClientCountMutex = ETrue; + + TRAP( err, self->CheckClientCountL() ); + + self->iClientCountMutex = EFalse; + } + + return err; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::CheckClientCountL +// --------------------------------------------------------------------------- +// +void CWsfWlanBearerConnectionMonitor::CheckClientCountL() + { + LOG_ENTERFN( "CWsfWlanBearerConnectionMonitor::CheckClientCountL" ); + + RWsSession wsSession; + if ( KErrNone == wsSession.Connect() ) + { + LOG_WRITE( "Find browser task" ); + TApaTaskList taskList( wsSession ); + TApaTask task = taskList.FindApp( KCRUidBrowser ); + if ( task.Exists() ) + { + LOG_WRITE( "Browser is running - auto disconnect to false" ); + iAutoDisconnect = EFalse; + iInactivityStart.UniversalTime(); + } + else + { + LOG_WRITE( "Browser is not running - auto disconnect to true" ); + iAutoDisconnect = ETrue; + } + wsSession.Close(); + } + else + { + LOG_WRITE( "Session connect failed" ); + } + + if ( iAutoDisconnect ) + { + CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewL(); + + TConnMonClientEnumBuf clientInfo; + + iMonitor.GetPckgAttribute( iConnectionId, 0, + KClientInfo, + clientInfo, + waiter->iStatus ); + waiter->WaitForRequest(); + delete waiter; + + // get the client count + iClientCount = clientInfo().iCount; + + // decrease count by each trivial client (Sniffer server, DHCP etc) + for ( TInt i( 0 ); i < clientInfo().iCount; ++i ) + { + for ( TInt j( 0 ); j < KTrivialClientCount; ++j ) + { + if ( clientInfo().iUid[i] == KTrivialClientUids[j] ) + { + --iClientCount; + LOG_WRITEF( "trivial client [0x%08X] discarded", + clientInfo().iUid[i].iUid ); + break; + } + } + } + + LOG_WRITEF( "iClientCount = %d (trivial clients:%d)", + iClientCount, + clientInfo().iCount - iClientCount ); + + if ( iClientCount ) + { + LOG_WRITE( "reset the inactivity start time to current time" ); + // there are more clients than the default ones -> + // connection is considered active -> + // reset the inactivity start time to current time + iInactivityStart.UniversalTime(); + } + else + { + // there are only trivial clients of the connection + // this means inactivity, so check the time elapsed + LOG_WRITEF( "Connection monitor state = %d", iConnectingState ); + TTime now; + now.UniversalTime(); + + if ( iInactivityStart + TTimeIntervalSeconds( + KMaxConnectionInactivityTime ) <= now ) + { + // inactivity time limit elapsed, connection should be stopped + LOG_WRITE( "inactivity threshold reached, disconnecting..." ); + DisconnectBearer(); + } + + } + + } + + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::ControlDisconnectTimer +// --------------------------------------------------------------------------- +// +TBool CWsfWlanBearerConnectionMonitor::ControlDisconnectTimer( + TUint aAdcCommand ) + { + LOG_ENTERFN("CWsfWlanBearerConnectionMonitor::ControlDisconnectTimer"); + + if ( iConnectionOwned ) + { + if ( aAdcCommand & EAdcTimerReset ) + { + // reset inactivity time + LOG_WRITE( "timer reset" ); + iInactivityStart.UniversalTime(); + } + + if ( aAdcCommand & EAdcStartTimer ) + { + if ( !iAutoDisconnect ) + { + LOG_WRITE( "timer started" ); + iAutoDisconnect = ETrue; + } + else + { + LOG_WRITE( "timer had already been started!" ); + } + } + else + { + iAutoDisconnect = EFalse; + LOG_WRITE( "timer stopped" ); + } + + } + else + { + LOG_WRITE( "connection is not owned!" ); + } + + return iAutoDisconnect; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::ReleaseShutdownMutex +// --------------------------------------------------------------------------- +// +void CWsfWlanBearerConnectionMonitor::ReleaseShutdownMutex( TAny* aPtr ) + { + CWsfWlanBearerConnectionMonitor* self = + static_cast( aPtr ); + self->iShutdownMutex = EFalse; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::ShutdownOwnedConnectionL +// --------------------------------------------------------------------------- +// +void CWsfWlanBearerConnectionMonitor::ShutdownOwnedConnectionL() + { + LOG_ENTERFN( "CWsfWlanBearerConnectionMonitor::ShutdownOwnedConnectionL" ); + + // Make sure that the internal status is reset. + iConnectionId = KNoConnection; + + if ( iShutdownMutex ) + { + return; + } + + // make sure we don't lock ourselves forever + CleanupStack::PushL( TCleanupItem( ReleaseShutdownMutex, this ) ); + iShutdownMutex = ETrue; + + + // roll-back the changes + switch ( iConnectingState ) + { + case ECsConnected: + { + // cancelling the periodic callback + iClientPoll->Cancel(); + } + + case ECsConnectionCreated: // fall-through + { + + } + + case ECsSocketOpened: // fall-through + { + // closing the connection handle + LOG_WRITE( "closing the connection handle" ); + iConnection.Close(); + iSocketServ.Close(); + } + + case ECsNotConnected: // fall-through + { + // nothing to put here + } + + } + + + // reset the state machine + iConnectingState = ECsIdle; + iConnectionOwned = EFalse; + + // tell the engine we have released the IAP + iObserver->ConnectedIapReleasedL(); + + + iServerCloser.WaitForOwnedConnection( EFalse ); + + if ( !iAborting ) + { + // notify observers only if connection creation + // was not aborted + iObserver->ConnectionLostL(); + } + + iAborting = EFalse; + + CleanupStack::PopAndDestroy( 1 ); // ReleaseShutdownMutex() + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::RunL +// --------------------------------------------------------------------------- +// +void CWsfWlanBearerConnectionMonitor::RunL() + { + LOG_ENTERFN( "CWsfWlanBearerConnectionMonitor::RunL" ); + + if ( iAborting ) + { + // if connection creation was aborted, do the cleanup + ShutdownOwnedConnectionL(); + return; + } + + switch ( iConnectingState ) + { + case ECsNotConnected: + { + LOG_WRITE( "" ); + + TInt err( KErrNone ); + err = iSocketServ.Connect(); + + if ( !err ) + { + err = iConnection.Open( iSocketServ ); + } + + if ( err ) + { + // there was an error while connecting + LOG_WRITEF( "connection.Open error = %d", err ); + ShutdownOwnedConnectionL(); + + iObserver->ConnectingFailedL( err ); + break; + } + + TCommDbConnPref connPref; + connPref.SetIapId( iConnIap ); + connPref.SetDialogPreference( ECommDbDialogPrefDoNotPrompt ); + + iConnectingState = ECsSocketOpened; + SetActive(); + iConnection.Start( connPref, iStatus ); + break; + } + + case ECsSocketOpened: + { + LOG_WRITE( "" ); + if ( iStatus.Int() != KErrNone ) + { + // there was an error while connecting + LOG_WRITE( "connection.Start error" ); + ShutdownOwnedConnectionL(); + + iObserver->ConnectingFailedL( iStatus.Int() ); + + break; + } + + LOG_WRITE( "connection.Start OK" ); + + // get the connection id + TRAPD( error, FindWlanBearerConnectedL(); ); + if ( error || iConnectionId == KNoConnection ) + { + // At this point we really need the connection id if it exists + // without connection id server is in very unbalanced state + LOG_WRITEF( "FindWlanBearerConnectedL error=%d", error ); + ShutdownOwnedConnectionL(); + + iObserver->ConnectingFailedL( ( error )? error : KErrGeneral ); + + break; + } + + iConnectingState = ECsConnectionCreated; + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + break; + } + + case ECsConnectionCreated: + { + LOG_WRITE( "" ); + + // start monitoring the iap + MonitorAccessPoint( iConnIap ); + + // reset inactivity time + iInactivityStart.UniversalTime(); + iAutoDisconnect = EFalse; + + iClientPoll->Start( + TTimeIntervalMicroSeconds32( KClientPollInterval ), + TTimeIntervalMicroSeconds32( KClientPollInterval ), + TCallBack( CheckClientCount, this ) ); + + LOG_WRITE( "connection client polling started" ); + + // notify observers of the connection name + iObserver->ConnectionEstablishedL( iWlanNetworkName ); + + TRAPD( err, iIct->TestConnectedAccessPointL( iConnIap ) ); + if ( err ) + { + LOG_WRITEF( "Ict start failed error = %d", err ); + } + + iConnectingState = ECsConnected; + break; + } + + default: + { + } + } + + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::DoCancel +// --------------------------------------------------------------------------- +// +void CWsfWlanBearerConnectionMonitor::DoCancel() + { + LOG_ENTERFN( "CWsfWlanBearerConnectionMonitor::DoCancel" ); + + // we were in the middle of a connection creation process + iAborting = ETrue; + TRAP_IGNORE( ShutdownOwnedConnectionL() ); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanBearerConnectionMonitor::RunError +// --------------------------------------------------------------------------- +// +#ifdef _DEBUG +TInt CWsfWlanBearerConnectionMonitor::RunError( TInt aError ) + { + LOG_ENTERFN( "CWsfWlanBearerConnectionMonitor::RunError" ); + LOG_WRITEF( "error = %d", aError ); +#else +TInt CWsfWlanBearerConnectionMonitor::RunError( TInt /*aError*/ ) + { +#endif + return KErrNone; + } + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/src/wsfwlanscanner.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/src/wsfwlanscanner.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,1960 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfWlanScanner +* +*/ + + + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __WINS__ +#include +#endif + +// CLASS HEADER +#include "wsfwlanscanner.h" + +// INTERNAL INCLUDES +#include "wsfwlaninfoarray.h" +#include "wsfwlanscaninfodefines.h" +#include "wsfwlanconnectiondetailsprovider.h" +#include "wsfwlansettingsaccessor.h" + +#include "wsflogger.h" + +// LOCAL DEFINITIONS +using namespace CMManager; + + +/** +* Microseconds in a second +*/ +static const TInt KMicrosecPerSecond = 1000 * 1000; + + +// CONSTRUCTION AND DESTRUCTION + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::NewL +// --------------------------------------------------------------------------- +// +CWsfWlanScanner* CWsfWlanScanner::NewL( CommsDat::CMDBSession& aDbSession ) + { + CWsfWlanScanner* self = CWsfWlanScanner::NewLC( aDbSession ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::NewLC +// --------------------------------------------------------------------------- +// +CWsfWlanScanner* CWsfWlanScanner::NewLC( CommsDat::CMDBSession& aDbSession ) + { + CWsfWlanScanner* self = new( ELeave ) CWsfWlanScanner( aDbSession ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::~CWsfWlanScanner +// --------------------------------------------------------------------------- +// +CWsfWlanScanner::~CWsfWlanScanner() + { + LOG_ENTERFN( "CWsfWlanScanner::~CWsfWlanScanner" ); + StopScanning(); + Cancel(); + iTimer.Close(); + iCmManagerExt.Close(); + delete iActiveConnectionName; + delete iScanResults; + delete iWlanMgmtClient; + delete iWlanSettingsAccessor; + delete iScanInfo; + delete iScanArray; + iDirectScanSsids.Close(); + iDirectScanIapIDs.Close(); + iAvailableIaps.Close(); + iDbSession = NULL; // not owning + iConnectionDetailsProvider = NULL; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::CWsfWlanScanner +// --------------------------------------------------------------------------- +// +CWsfWlanScanner::CWsfWlanScanner( CommsDat::CMDBSession& aDbSession ): + CActive( EPriorityStandard ), + iDbSession( &aDbSession ), + iScanState( EIdle ) + { + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::ConstructL +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::ConstructL() + { + LOG_ENTERFN( "CWsfWlanScanner::ConstructL" ); + +#ifndef __WINS__ // client is not available on wins + iWlanMgmtClient = CWlanMgmtClient::NewL(); + + iScanInfo = CWlanScanInfo::NewL(); +#endif + + iCmManagerExt.OpenL(); + + iScanArray = CWsfWlanInfoArray::NewL(); + + User::LeaveIfError( iTimer.CreateLocal() ); + iScanResults = KNullDesC8().AllocL(); + + iWlanSettingsAccessor = CWsfWlanSettingsAccessor::NewL( *iDbSession ); + iScanningInterval = iWlanSettingsAccessor->ScanInterval() * + KMicrosecPerSecond; + iShowAvailability = iWlanSettingsAccessor->ShowAvailability(); + + LOG_WRITEF( "initial bgScanInterval = %d sec", + iWlanSettingsAccessor->ScanInterval() ); + LOG_WRITEF( "initial showAvailability = %d", iShowAvailability ); + + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::DoCancel +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::DoCancel() + { + LOG_ENTERFN( "CWsfWlanScanner::DoCancel" ); + iTimer.Cancel(); +#ifndef __WINS__ + iWlanMgmtClient->CancelGetAvailableIaps(); + iWlanMgmtClient->CancelGetScanResults(); +#endif + iScanState = EIdle; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::RunL +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::RunL() + { + LOG_ENTERFN( "CWsfWlanScanner::RunL" ); + + /* + * Scan logic + * 1. Get available IAPs - state = EIdle + * 2. Do broadcast scan - state = EBroadcastScan + * 3. Process broadcast scan results - state = EProcessBroadcastScan + * 4. Do direct scans for remaining known networks + * from step 2. Get available IAPs - state = EDirectScan + * 5. Add connected network - state = EFinished + * 6. Set names and priorities for known networks - state = EFinished + */ + + if ( iScanState == EIdle ) + { + LOG_WRITE( "Get available IAPs scan phase" ); + + // prepare things for direct scans + PrepareDirectScan(); + + // notify clients + if ( iObserver ) + { + iObserver->WlanScanStarted(); + } + +#ifndef __WINS__ + // get available iaps + // (this only shows iaps with security mode matching to scan results + // and also finds hidden wlans for which an iap has been configured) + iAvailableIaps.Reset(); + iWlanMgmtClient->GetAvailableIaps( iCacheLifetime, + iMaxDelay, + EFalse, + iStatus, + iAvailableIaps ); + SetActive(); +#else + // for testing + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); +#endif + iScanState = EBroadcastScan; + } + + else if ( iScanState == EBroadcastScan ) + { + LOG_WRITEF( "GetAvailableIaps returned iStatus=%d", iStatus.Int() ); + if ( iStatus.Int() ) + { + LOG_WRITE( "Error in getting available IAPs - leave" ); + User::Leave( iStatus.Int() ); + } + +#ifdef _DEBUG + for ( TInt i = 0; i < iAvailableIaps.Count(); ++i ) + { + LOG_WRITEF( "iAvailableIaps array index[%d] IapId[%d] rssi[%d]", i, + iAvailableIaps[i].iIapId, iAvailableIaps[i].iRssi ); + } +#endif + +#ifndef __WINS__ + // do broadcast scan + iWlanMgmtClient->GetScanResults( iStatus, *iScanInfo ); + SetActive(); +#else + // for testing + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); +#endif + iScanState = EProcessBroadcastScan; + } + + else if ( iScanState == EProcessBroadcastScan ) + { + // process broadcast scan results + DoScanForNetworksL(); + + // now it's time to initiate direct scan + // for remaining known networks + if ( iDirectScanSsids.Count() ) + { +#ifdef _DEBUG + HBufC* ssid = TWsfWlanInfo::GetSsidAsUnicodeLC( + iDirectScanSsids[0] ); + LOG_WRITEF( "requesting direct scan for [%S]", ssid ); + CleanupStack::PopAndDestroy( ssid ); +#endif + +#ifndef __WINS__ + // run direct scan + iWlanMgmtClient->GetScanResults( iDirectScanSsids[0], + iStatus, *iScanInfo ); + SetActive(); +#else + // for testing + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); +#endif + + iScanState = EDirectScan; + } + else + { + LOG_WRITE( "direct scan skipped" ); + iScanState = EFinished; + } + } + + else if ( iScanState == EDirectScan ) + { + LOG_WRITE( "direct scan results" ); + +#ifndef __WINS__ + ProcessDirectScanResultL(); +#endif + + // delete the processed item (first) + iDirectScanSsids.Remove( 0 ); + iDirectScanIapIDs.Remove( 0 ); + + if ( iDirectScanSsids.Count() ) + { + // repeated direct scans for known networks +#ifdef _DEBUG + HBufC* ssid = TWsfWlanInfo::GetSsidAsUnicodeLC( + iDirectScanSsids[0] ); + LOG_WRITEF( "requesting direct scan for [%S]", ssid ); + CleanupStack::PopAndDestroy( ssid ); +#endif + +#ifndef __WINS__ + // run direct scan + iWlanMgmtClient->GetScanResults( iDirectScanSsids[0], + iStatus, *iScanInfo ); + SetActive(); +#else + // for testing + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); +#endif + } + else + { + // there is nothing more to do + iScanState = EFinished; + } + } + + if ( iScanState == EFinished ) + { + LOG_WRITE( "scanning finished" ); +#ifndef __WINS__ + AddConnectedWLANInfoL(); + + TWsfWlanInfo* info(NULL); + TInt scanArrayCount( iScanArray->Count() ); + + for ( TInt i(0) ; i < scanArrayCount ; i++ ) + { + info = (*iScanArray)[ i ]; + + if( info->iIapId ) + { + TRAPD( error, UpdatePriorityL( *info ) ); + if ( error ) + { + // Ignore error and just continue + LOG_WRITE( "Prio update failed" ); + } + } + + if( info->iIapId && info->iConnectionState != EConnected ) + { + ReplaceSsidsWithIapName( *info ); + } + } +#endif //_WINS_ + + // sort the array + iScanArray->SortArrayL(); + + HBufC8* results = iScanArray->SerializeContentLC(); + CleanupStack::Pop( results ); + delete iScanResults; + iScanResults = results; + +#ifdef _DEBUG + DumpScanResultsL( iScanArray ); +#endif + + // we may let go the scan array contents... + iScanArray->Reset(); + + // notify clients that data is ready + if ( iObserver ) + { + iObserver->WlanScanCompleteL(); + } + + if ( !iShowAvailability ) + { + // reset the timer if we are responsible for scheduling scans + iTimer.Cancel(); + iTimer.After( iStatus, + TTimeIntervalMicroSeconds32( iScanningInterval ) ); + Cancel(); + iCacheLifetime = 0; + iMaxDelay = 0; + SetActive(); + } + + iScanState = EIdle; + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::AddConnectedWLANInfo +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::AddConnectedWLANInfoL() + { + LOG_ENTERFN( "CWsfWlanScanner::AddConnectedWLANInfoL" ); + // Get the possible connection + if ( iConnectionDetailsProvider ) + { + TWlanSsid connectedSsid; + TInt error = iWlanMgmtClient->GetConnectionSsid( connectedSsid ); + + LOG_WRITEF( "GetConnectionSsid returned=%d", error ); + + TBool connected = ( error == KErrNone && connectedSsid.Length() ); + + if ( !connected && !iConnectionDetailsProvider->IsConnected() ) + { + LOG_WRITEF( "Not connected [connected=%d]", connected ); + return; + } + + TWsfWlanInfo* connectedInfo = new (ELeave) TWsfWlanInfo(); + CleanupStack::PushL( connectedInfo ); + + if ( iConnectionDetailsProvider->ConnectedWlanConnectionDetailsL( + connectedInfo) ) + { + TBuf8 connectedSsidOrIap; + connectedSsidOrIap.Copy( connectedInfo->iSsid ); + // ConnectedWlanConnectionDetailsL() may have returned an IAP name instead of SSID. + // make sure that we really have SSID in connectedInfo->iSSID at this phase. + + connectedInfo->iRawSsid.Copy( connectedSsid ); + connectedInfo->iSsid.Copy( connectedSsid ); + connectedInfo->iCoverage = 0; + connectedInfo->iVisibility = 1; + + TBool connectedInfoAppended = EFalse; + + RPointerArray matchArray; + CleanupClosePushL( matchArray ); + + if ( connectedInfo->iIapId ) + { + LOG_WRITEF( "Connected iap [%d]", connectedInfo->iIapId ); + iScanArray->MatchWithIapIDL( connectedInfo->iIapId, + iScanArray->Count(), matchArray ); + + if ( !matchArray.Count() ) + { + LOG_WRITE( "Not found with Iap id" ); + iScanArray->MatchL( connectedInfo->iSsid, + connectedInfo->iSecurityMode, + connectedInfo->iNetMode, + connectedInfo->UsesPreSharedKey(), + iScanArray->Count(), + matchArray ); + } + + } + else + { + LOG_WRITE( "Easy WLAN connection" ); + iScanArray->MatchL( connectedInfo->iSsid, + connectedInfo->iSecurityMode, + connectedInfo->iNetMode, + connectedInfo->UsesPreSharedKey(), + iScanArray->Count(), + matchArray ); + } + + if ( matchArray.Count() ) + { + LOG_WRITE( "Info found" ); + TWsfWlanInfo* temp = matchArray[0]; + temp->iConnectionState = EConnected; + temp->iIapId = connectedInfo->iIapId; + temp->iSsid.Copy( connectedSsidOrIap ); + temp->iNetworkName.Zero(); + } + else + { + LOG_WRITE( "Info not found - append" ); + connectedInfo->iSsid.Copy( connectedSsidOrIap ); + iScanArray->AppendL( connectedInfo ); + connectedInfoAppended = ETrue; + } + + CleanupStack::PopAndDestroy( &matchArray ); + if ( connectedInfoAppended ) + { + CleanupStack::Pop( connectedInfo ); + } + else + { + CleanupStack::PopAndDestroy( connectedInfo ); + } + } + else + { + CleanupStack::PopAndDestroy( connectedInfo ); + } + } + else + { + LOG_WRITE( "No connection details provider" ); + } + } + + +#ifdef _DEBUG +// --------------------------------------------------------------------------- +// CWsfWlanScanner::DumpScanResultsL +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::DumpScanResultsL( CWsfWlanInfoArray* aArray ) + { + LOG_ENTERFN( "CWsfWlanScanner::DumpScanResultsL" ); + _LIT( Kopen, "open" ); + _LIT( Kwep, "wep" ); + _LIT( Kwpa, "wpa" ); + _LIT( Kwpa2, "wpa2" ); + _LIT( K802, "802.1x" ); + _LIT( KWAPI, "WAPI" ); + _LIT( KUnknown, "Unknown" ); + + _LIT( Kpsk, "psk" ); + _LIT( Keap, "eap" ); + _LIT( Khidden, "" ); + + for ( TInt i( 0 ); i < aArray->Count(); ++i ) + { + TWsfWlanInfo* wi( (*aArray)[i] ); + const TDesC* sm( 0 ); + + switch ( wi->iSecurityMode ) + { + case EWlanSecModeOpen: + sm = &Kopen; + break; + case EWlanSecModeWep: + sm = &Kwep; + break; + case EWlanSecModeWpa: + sm = &Kwpa; + break; + case EWlanSecModeWpa2: + sm = &Kwpa2; + break; + case EWlanSecMode802_1x: + sm = &K802; + break; + case EWlanSecModeWAPI: + sm = &KWAPI; + break; + default: + sm = &KUnknown; + break; + } + + const TDesC* psk = wi->UsesPreSharedKey()? &Kpsk: + ( ( wi->iSecurityMode == EWlanSecMode802_1x || + wi->iSecurityMode == EWlanSecModeWpa || + wi->iSecurityMode == EWlanSecModeWpa2 )? + &Keap: &KNullDesC ); + HBufC16 *ssid = TWsfWlanInfo::GetSsidAsUnicodeLC( wi->iSsid ); + + LOG_WRITEF( "[%S] IapId=%d %S %S %S", ssid, wi->iIapId, sm, psk, + wi->iVisibility? &KNullDesC: &Khidden ); + CleanupStack::PopAndDestroy( ssid ); + } + + } +#endif // _DEBUG + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::RunError +// --------------------------------------------------------------------------- +// +TInt CWsfWlanScanner::RunError( TInt aError ) + { + LOG_ENTERFN( "CWsfWlanScanner::RunError" ); + LOG_WRITEF( "error = %d", aError ); + + iScanArray->Reset(); + + if ( iObserver && aError != KErrNotReady ) + { + // KErrNotReady is excluded as it indicates that the WLAN engine + // has not yet set up itself, which we cannot help + iObserver->NotifyError( aError ); + } + + iScanState = EIdle; + + if ( !iShowAvailability ) + { + // the scanning has failed, re-issue the scan timer + iTimer.Cancel(); + iTimer.After( iStatus, + TTimeIntervalMicroSeconds32( iScanningInterval ) ); + iCacheLifetime = 0; + iMaxDelay = 0; + SetActive(); + } + + return KErrNone; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::SetObserver +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::SetObserver( MWsfWlanScannerObserver& aObserver ) + { + iObserver = &aObserver; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::StartScanningL +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::StartScanningL() + { + LOG_ENTERFN( "CWsfWlanScanner::StartScanningL" ); + + if ( iScanState == EIdle && !IsActive() ) + { + LOG_WRITE( "request notifications" ); +#ifndef __WINS__ + iWlanMgmtClient->CancelNotifications(); + iWlanMgmtClient->ActivateNotificationsL( *this ); +#endif + iWlanSettingsAccessor->RequestNotificationL( *this ); + + iScanState = EIdle; + + if ( !iShowAvailability ) + { + // in case show wlan availability is off, carry out a scan now + iCacheLifetime = 0; + iMaxDelay = 0; + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::StartScanningL +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::StopScanning() + { + LOG_ENTERFN( "CWsfWlanScanner::StopScanning" ); + + Cancel(); + +#ifndef __WINS__ + if ( iWlanMgmtClient ) + { + iWlanMgmtClient->CancelNotifications(); + } +#endif + + if ( iWlanSettingsAccessor ) + { + iWlanSettingsAccessor->CancelNotifications(); + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::RestartScanning +// --------------------------------------------------------------------------- +// +TBool CWsfWlanScanner::RestartScanning() + { + LOG_ENTERFN( "CWsfWlanScanner::RestartScanning" ); + + TBool restarted( EFalse ); + LOG_WRITEF( "iScanState = %d isActive = %d iShowAvailability = %d", + iScanState, IsActive(), iShowAvailability ); + + if ( iScanState == EIdle && ( IsActive() || iShowAvailability ) ) + { + // we have been waiting for the timer to complete + // cancel it manually + Cancel(); + iCacheLifetime = 0; + iMaxDelay = 0; + // then complete ourselves + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + restarted = ETrue; + } + + LOG_WRITEF( "restarted = %d", restarted ); + return restarted; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::AbortScanning +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::AbortScanning() + { + LOG_ENTERFN( "CWsfWlanScanner::AbortScanning" ); + + if ( iScanState != EIdle ) + { + // cancel the current scanning + Cancel(); + + if ( !iShowAvailability ) + { + // still, life goes on + iTimer.After( iStatus, TTimeIntervalMicroSeconds32( + iScanningInterval ) ); + iCacheLifetime = 0; + iMaxDelay = 0; + SetActive(); + } + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::ConnectionStateChanged +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::ConnectionStateChanged( + TWlanConnectionMode /*aNewState*/ ) + { + LOG_ENTERFN( "CWsfWlanScanner::ConnectionStateChanged" ); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::BssidChanged +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::BssidChanged( TWlanBssid& /*aNewBSsid*/ ) + { + LOG_ENTERFN( "CWsfWlanScanner::BssidChanged" ); + if ( iScanState == EIdle && !IsActive() ) + { + iCacheLifetime = -1; + iMaxDelay = 0; + // complete ourselves + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::BssLost +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::BssLost() + { + LOG_ENTERFN( "CWsfWlanScanner::BssLost" ); + if ( iScanState == EIdle && !IsActive() ) + { + iCacheLifetime = -1; + iMaxDelay = 0; + // complete ourselves + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::BssRegained +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::BssRegained() + { + LOG_ENTERFN( "CWsfWlanScanner::BssRegained" ); + if ( iScanState == EIdle && !IsActive() ) + { + iCacheLifetime = -1; + iMaxDelay = 0; + // complete ourselves + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::NewNetworksDetected +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::NewNetworksDetected() + { + LOG_ENTERFN( "CWsfWlanScanner::NewNetworksDetected" ); + if ( iScanState == EIdle && !IsActive() ) + { + iCacheLifetime = -1; + iMaxDelay = 0; + // complete ourselves + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::OldNetworksLost +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::OldNetworksLost() + { + LOG_ENTERFN( "CWsfWlanScanner::OldNetworksLost" ); + if ( iScanState == EIdle && !IsActive() ) + { + iCacheLifetime = -1; + iMaxDelay = 0; + // complete ourselves + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::TransmitPowerChanged +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::TransmitPowerChanged( TUint /*aPower*/ ) + { + LOG_ENTERFN( "CWsfWlanScanner::TransmitPowerChanged" ); + if ( iScanState == EIdle && !IsActive() ) + { + iCacheLifetime = -1; + iMaxDelay = 0; + // complete ourselves + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::RssChanged +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::RssChanged( TWlanRssClass /*aRssClass*/, TUint /*aRss*/ ) + { + LOG_ENTERFN( "CWsfWlanScanner::RssChanged" ); + if ( iScanState == EIdle && !IsActive() ) + { + iCacheLifetime = -1; + iMaxDelay = 0; + // complete ourselves + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::PrepareDirectScan +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::PrepareDirectScan() + { + LOG_ENTERFN( "CWsfWlanScanner::PrepareDirectScanL" ); + + // flush the arrays + iDirectScanSsids.Reset(); + iDirectScanIapIDs.Reset(); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::ProcessDirectScanResultL +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::ProcessDirectScanResultL() + { + LOG_ENTERFN( "CWsfWlanScanner::ProcessDirectScanResultL" ); + + for ( iScanInfo->First(); !iScanInfo->IsDone(); iScanInfo->Next() ) + { + RPointerArray matchArray; + CleanupClosePushL(matchArray); + iScanArray->MatchWithIapIDL( iDirectScanIapIDs[0], iScanArray->Count(), matchArray ); + + TInt matchcount = matchArray.Count(); + + if ( matchcount == 0 ) + { + // not found yet +#ifdef _DEBUG + HBufC* ssid = TWsfWlanInfo::GetSsidAsUnicodeLC( iDirectScanSsids[0] ); + LOG_WRITEF( "[%S] found in direct scan", ssid ); + CleanupStack::PopAndDestroy( ssid ); +#endif + } + else + { + LOG_WRITEF( "[%d] iap id is in scanarray", iDirectScanIapIDs[0] ); + for( TInt i(0); i < matchcount; i++ ) + { + //if already found increase coverage + TWsfWlanInfo* temp = matchArray[i]; + ++temp->iCoverage; + RefreshSignalStrength( *temp ); + RefreshTechnology( *temp ); + } + } + // Close() for matchArray + CleanupStack::PopAndDestroy( &matchArray ); + } // for iScanInfo + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::ReplaceSsidsWithIapName +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::ReplaceSsidsWithIapName(TWsfWlanInfo& aWlanInfo) + { + LOG_ENTERFN( "CWsfWlanScanner::ReplaceSsidsWithIapName" ); + if ( aWlanInfo.iNetworkName.Length() ) + { + LOG_WRITE( "Replace ssid" ); + aWlanInfo.iSsid.Copy( aWlanInfo.iNetworkName ); + aWlanInfo.iNetworkName.Zero(); + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::UpdatePriorityL +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::UpdatePriorityL( TWsfWlanInfo& aWlanInfo ) + { + LOG_WRITE( "CWsfWlanScanner::updatePriority" ); + + TUint32 priority( 0 ); + TInt exists( KErrNotFound ); + TInt count( 0 ); + + // search for the destination of it + RArray destinations; + CleanupClosePushL( destinations ); + + LOG_WRITE( "CWsfWlanScanner::updatePriority get all destinations" ); + iCmManagerExt.AllDestinationsL(destinations); + + count = destinations.Count(); + LOG_WRITEF( "destination count %d", count); + + for( TInt i = 0; i < count && exists != KErrNone; i++ ) + { + RCmDestinationExt destination; + destination = iCmManagerExt.DestinationL( destinations[ i ] ); + CleanupClosePushL( destination ); + + LOG_WRITE( "check if connection method belongs to destination" ); + + RCmConnectionMethodExt connectionMethod; + TRAP( exists, + connectionMethod = destination.ConnectionMethodByIDL( + aWlanInfo.iIapId ) ); + + LOG_WRITEF( "exists %d", exists ); + if( exists == KErrNone ) + { + CleanupClosePushL( connectionMethod ); + // correct destination found + priority = destination.PriorityL( connectionMethod ); + aWlanInfo.SetPriority( priority ); + + LOG_WRITEF( "priority %d", priority ); + CleanupStack::PopAndDestroy( &connectionMethod ); + } + CleanupStack::PopAndDestroy( &destination ); + } + CleanupStack::PopAndDestroy( &destinations ); + } + + +#ifndef __WINS__ +// --------------------------------------------------------------------------- +// CWsfWlanScanner::DoScanForNetworksL +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::DoScanForNetworksL() + { + LOG_ENTERFN( "CWsfWlanScanner::DoScanForNetworksL" ); + + // start by making sure the scan array is empty + iScanArray->Reset(); + + LOG_WRITEF( "GetScanResults returned iStatus=%d", iStatus.Int() ); + + if ( iStatus.Int() ) + { + // if the status is not KErrNone, we cannot be sure that iScanInfo + // doesn't cause a crash, so it's better to leave + LOG_WRITE( "Error in getting scan result - leave" ); + User::Leave( iStatus.Int() ); + } + + TInt nElem = 0; + TBool isHidden( EFalse ); + + TInt avIapCount = iAvailableIaps.Count(); + + LOG_WRITEF( "Available iap count %d", avIapCount ); + + for( TInt i(0); i < avIapCount; i++ ) + { + TBool addToArray( ETrue ); + TWsfWlanInfo* availableInfo = new ( ELeave ) TWsfWlanInfo(); + CleanupStack::PushL( availableInfo ); + availableInfo->iIapId = iAvailableIaps[i].iIapId; + TRAPD( error, GetWlanInfoFromIapL( *availableInfo ) ); + + if ( error == KErrNotFound ) + { + LOG_WRITEF( "Iap id = %d does not exist", availableInfo->iIapId ); + addToArray = EFalse; + } + else if ( error ) + { + LOG_WRITEF( "GetWlanInfoFromIapL failed err = %d", error ); + User::Leave( error ); + } + + if( addToArray ) + { + LOG_WRITE( "Add to array" ); + availableInfo->iCoverage = 0; + availableInfo->iVisibility = 1; + availableInfo->iStrengthLevel = iAvailableIaps[i].iRssi; + availableInfo->iTransferRate = 0; + availableInfo->iConnectionState = ENotConnected; + iScanArray->AppendL(availableInfo); + nElem++; + + if ( availableInfo->iIapId ) + { + LOG_WRITEF( "Append available iap[%d] rssi[%d] for direct scan", + availableInfo->iIapId, availableInfo->iStrengthLevel ); + iDirectScanIapIDs.Append( availableInfo->iIapId ); + iDirectScanSsids.Append( availableInfo->iSsid ); + } + + CleanupStack::Pop( availableInfo ); + } + else + { + LOG_WRITE( "Info not added" ); + CleanupStack::PopAndDestroy( availableInfo ); + } + } + +#ifdef _DEBUG + LOG_WRITE( "Dump scan results - available IAPs" ); + DumpScanResultsL( iScanArray ); +#endif + + // Process the scanned results + for( iScanInfo->First(); !iScanInfo->IsDone(); iScanInfo->Next() ) + { + TWsfWlanInfo* wlanInfo = iScanArray->At( nElem ); + if ( !wlanInfo ) + { + wlanInfo = new ( ELeave ) TWsfWlanInfo(); + CleanupStack::PushL( wlanInfo ); + iScanArray->AppendL( wlanInfo ); + CleanupStack::Pop( wlanInfo ); + } + isHidden = RefreshNetworkNameL( *wlanInfo ); + wlanInfo->iVisibility = !isHidden; + wlanInfo->iStrengthLevel = EWlanSignalUnavailable; + wlanInfo->iTransferRate = 0; + wlanInfo->iConnectionState = ENotConnected; + + if( !isHidden ) + { + // not hidden + RefreshNetworkMode( *wlanInfo ); + RefreshSecurityMode( *wlanInfo ); + RefreshTechnology( *wlanInfo ); + + // check if we already have an entry/entries corresponding to a scan result + // (multiple entries for one scan result possible if GetAvailableIaps() + // found several iaps configured for same wlan) + RPointerArray matchArray; + CleanupClosePushL(matchArray); + iScanArray->MatchL( wlanInfo->iSsid, + wlanInfo->iSecurityMode, + wlanInfo->iNetMode, + wlanInfo->UsesPreSharedKey(), + nElem, + matchArray ); + + TInt matchcount = matchArray.Count(); + + // if not found + if( matchcount == 0 ) + { + wlanInfo->iCoverage = 1; + RefreshSignalStrength( *wlanInfo ); + RefreshTechnology( *wlanInfo ); + ++nElem; // new entry, inc index in array + } + else // if found inc coverage and refresh signal strength and rate + { + for( TInt i(0); i < matchcount; i++ ) + { + TWsfWlanInfo* temp = matchArray[i]; + ++temp->iCoverage; + RefreshSignalStrength( *temp ); + RefreshTechnology( *temp ); + + if ( temp->iIapId ) + { + TInt index( KErrNone ); + do { + LOG_WRITE( "Not hidden - Searching from direct scan list.." ); + // remove this item from the direct scan list, if found + index = iDirectScanIapIDs.Find( temp->iIapId ); + if ( index != KErrNotFound ) + { + LOG_WRITEF( "Found - removing iap id [%d]", iDirectScanIapIDs[index] ); + iDirectScanSsids.Remove( index ); + iDirectScanIapIDs.Remove( index ); + } + } while ( index != KErrNotFound ); + } + } + } + CleanupStack::PopAndDestroy(); // results in Close() being called on matchArray + } + } + //get rid of excess items + iScanArray->DeleteFromTail(iScanArray->Count() - nElem); + } + +#else // __WINS__ + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::DoScanForNetworksL +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::DoScanForNetworksL() + { + LOG_ENTERFN( "CWsfWlanScanner::DoScanForNetworksL" ); + + // start by making sure the scan array is empty + iScanArray->Reset(); + + TWsfWlanInfo* wlan0 = new (ELeave) TWsfWlanInfo(); + CleanupStack::PushL( wlan0 ); + wlan0->iConnectionState = EConnected; + wlan0->iIapId = 666; + wlan0->iNetMode = EInfra; + wlan0->iSecurityMode = EWlanSecModeWep; + wlan0->iSsid = _L8("[C]Known WEP"); + wlan0->iStrengthLevel = EWlanSignalStrengthMax; + wlan0->iVisibility = ETrue; + wlan0->iCoverage = 1; + if ( Math::Random() % 2 == 0 ) + { + iScanArray->AppendL( wlan0 ); + } + else + { + delete wlan0; + } + + CleanupStack::Pop( wlan0 ); + + TWsfWlanInfo* wlan1 = new (ELeave) TWsfWlanInfo(); + CleanupStack::PushL( wlan1 ); + wlan1->iConnectionState = ENotConnected; + wlan1->iIapId = 666; + wlan1->iNetMode = EInfra; + wlan1->iSecurityMode = EWlanSecModeOpen; + wlan1->iSsid = _L8("Known open"); + wlan1->iStrengthLevel = EWlanSignalStrengthMin; + wlan1->iVisibility = ETrue; + wlan1->iCoverage = 3; + if ( Math::Random() % 2 == 0 ) + { + iScanArray->AppendL( wlan1 ); + } + else + { + delete wlan1; + } + + CleanupStack::Pop( wlan1 ); + + TWsfWlanInfo* wlan2 = new (ELeave) TWsfWlanInfo(); + CleanupStack::PushL( wlan2 ); + wlan2->iConnectionState = ENotConnected; + wlan2->iIapId = 0; + wlan2->iNetMode = EInfra; + wlan2->iSecurityMode = EWlanSecModeWpa2; + wlan2->iSsid = _L8("Known WPA2 PSK"); + wlan2->iStrengthLevel = EWlanSignalStrengthLow-7; + wlan2->iVisibility = ETrue; + wlan2->iCoverage = 1; + wlan2->SetUsesPreSharedKey( ETrue ); + if ( Math::Random() % 2 == 0 ) + { + iScanArray->AppendL( wlan2 ); + } + else + { + delete wlan2; + } + CleanupStack::Pop( wlan2 ); + + TWsfWlanInfo* wlan3 = new (ELeave) TWsfWlanInfo(); + CleanupStack::PushL( wlan3 ); + wlan3->iConnectionState = ENotConnected; + wlan3->iIapId = 0; + wlan3->iNetMode = EInfra; + wlan3->iSecurityMode = EWlanSecModeOpen; + wlan3->iSsid = _L8("Unknown open"); + wlan3->iStrengthLevel = EWlanSignalStrengthMax; + wlan3->iVisibility = 1; + wlan3->iCoverage = 1; + if ( Math::Random() % 2 == 0 ) + { + iScanArray->AppendL( wlan3 ); + } + else + { + delete wlan3; + } + CleanupStack::Pop( wlan3 ); + + TWsfWlanInfo* wlan4 = new (ELeave) TWsfWlanInfo(); + CleanupStack::PushL( wlan4 ); + wlan4->iConnectionState = ENotConnected; + wlan4->iIapId = 0; + wlan4->iNetMode = EAdhoc; + wlan4->iSecurityMode = EWlanSecModeWpa; + wlan4->iSsid = _L8("Unknown WPA"); + wlan4->iStrengthLevel = EWlanSignalStrengthMin; + wlan4->iVisibility = 1; + wlan4->iCoverage = 1; + wlan2->SetUsesPreSharedKey( ETrue ); + + if ( Math::Random() % 2 == 0 ) + { + iScanArray->AppendL( wlan4 ); + } + else + { + delete wlan4; + } + CleanupStack::Pop( wlan4 ); + + TWsfWlanInfo* wlan5 = new (ELeave) TWsfWlanInfo(); + CleanupStack::PushL( wlan5 ); + wlan5->iConnectionState = ENotConnected; + wlan5->iIapId = 12; + wlan5->iNetMode = EInfra; + wlan5->iSecurityMode = EWlanSecModeOpen; + wlan5->iSsid = _L8("SES"); + wlan5->iStrengthLevel = EWlanSignalStrengthLow-5; + wlan5->iVisibility = 0; + wlan5->iCoverage = 1; + if ( Math::Random() % 2 == 0 ) + { + iScanArray->AppendL( wlan5 ); + } + else + { + delete wlan5; + } + + CleanupStack::Pop( wlan5 ); + + TWsfWlanInfo* wlan6 = new (ELeave) TWsfWlanInfo(); + CleanupStack::PushL( wlan6 ); + wlan6->iConnectionState = ENotConnected; + wlan6->iIapId = 666; + wlan6->iNetMode = EInfra; + wlan6->iSecurityMode = EWlanSecModeWpa; + wlan6->iSsid = _L8("Sunny 22"); + wlan6->iStrengthLevel = EWlanSignalStrengthMin; + wlan6->iVisibility = 1; + wlan6->iCoverage = 2; + if ( Math::Random() % 2 == 0 ) + { + iScanArray->AppendL( wlan6 ); + } + else + { + delete wlan6; + } + CleanupStack::Pop( wlan6 ); + + + wlan5 = new (ELeave) TWsfWlanInfo(); + CleanupStack::PushL( wlan5 ); + wlan5->iConnectionState = ENotConnected; + wlan5->iIapId = 0; + wlan5->iNetMode = EInfra; + wlan5->iSecurityMode = EWlanSecModeOpen; + wlan5->iSsid = _L8("FON_accesspoint"); + wlan5->iStrengthLevel = EWlanSignalStrengthLow-8; + wlan5->iVisibility = 1; + wlan5->iCoverage = 1; + if ( Math::Random() % 2 == 0 ) + { + iScanArray->AppendL( wlan5 ); + } + else + { + delete wlan5; + } + CleanupStack::Pop( wlan5 ); + + + TWsfWlanInfo* wlan7 = new (ELeave) TWsfWlanInfo(); + CleanupStack::PushL( wlan7 ); + wlan7->iConnectionState = ENotConnected; + wlan7->iIapId = 667; + wlan7->iNetMode = EAdhoc; + wlan7->iSecurityMode = EWlanSecModeWpa; + wlan7->iSsid = _L8("Ad-hoc WPA"); + wlan7->iStrengthLevel = EWlanSignalStrengthMax; + wlan7->iVisibility = ETrue; + wlan7->iCoverage = 1; + if ( Math::Random() % 2 == 0 ) + { + iScanArray->AppendL( wlan7 ); + } + else + { + delete wlan7; + } + CleanupStack::Pop( wlan7 ); + + TWsfWlanInfo* wlan8 = new (ELeave) TWsfWlanInfo(); + CleanupStack::PushL( wlan8 ); + wlan8->iConnectionState = ENotConnected; + wlan8->iIapId = 667; + wlan8->iNetMode = EInfra; + wlan8->iSecurityMode = EWlanSecModeOpen; + wlan8->iSsid = _L8("Known pri 1"); + wlan8->iStrengthLevel = EWlanSignalStrengthMax; + wlan8->iVisibility = ETrue; + wlan8->iCoverage = 1; + wlan8->iPriority = 1; + if ( Math::Random() % 2 == 0 ) + { + iScanArray->AppendL( wlan8 ); + } + else + { + delete wlan8; + } + CleanupStack::Pop( wlan8 ); + + TWsfWlanInfo* wlan9 = new (ELeave) TWsfWlanInfo(); + CleanupStack::PushL( wlan9 ); + wlan9->iConnectionState = ENotConnected; + wlan9->iIapId = 668; + wlan9->iNetMode = EInfra; + wlan9->iSecurityMode = EWlanSecModeOpen; + wlan9->iSsid = _L8("Known pri 2"); + wlan9->iStrengthLevel = EWlanSignalStrengthMax; + wlan9->iVisibility = ETrue; + wlan9->iCoverage = 1; + wlan9->iPriority = 2; + if ( Math::Random() % 2 == 0 ) + { + iScanArray->AppendL( wlan9 ); + } + else + { + delete wlan9; + } + CleanupStack::Pop( wlan9 ); + + + } + +#endif // __WINS__ + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::GetWlanInfoFromIapL() +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::GetWlanInfoFromIapL( TWsfWlanInfo& aWlanInfo ) + { + LOG_ENTERFN( "CWsfWlanScanner::GetWlanInfoFromIapL" ); + LOG_WRITEF( "Iap Id = %d", aWlanInfo.iIapId ); + + CCommsDatabase* commsDb = CCommsDatabase::NewL(); + CleanupStack::PushL( commsDb ); + + CCommsDbTableView* commsDbIapTableView = commsDb->OpenViewMatchingUintLC( + TPtrC( IAP ), TPtrC( COMMDB_ID ), aWlanInfo.iIapId ); + User::LeaveIfError( commsDbIapTableView->GotoFirstRecord() ); + + // network name + TBuf iapName; + commsDbIapTableView->ReadTextL( TPtrC( COMMDB_NAME ), iapName); + + TInt error = CnvUtfConverter::ConvertFromUnicodeToUtf8( + aWlanInfo.iNetworkName, + iapName ); + if ( error ) + { + LOG_WRITE( "ConvertFromUnicodeToUtf8 failed"); + aWlanInfo.iNetworkName.Copy( iapName ); + } + + // service Id + TUint32 serviceId(0); + commsDbIapTableView->ReadUintL(TPtrC( IAP_SERVICE), serviceId); + CCommsDbTableView* wlanTableView = commsDb->OpenViewMatchingUintLC( + TPtrC( WLAN_SERVICE), TPtrC( WLAN_SERVICE_ID), serviceId); + User::LeaveIfError(wlanTableView->GotoFirstRecord() ); + + // ssid + wlanTableView->ReadTextL( TPtrC( NU_WLAN_SSID ), aWlanInfo.iSsid ); + aWlanInfo.iRawSsid.Copy( aWlanInfo.iSsid ); + + // security mode + TUint32 secMode(0); + wlanTableView->ReadUintL(TPtrC( WLAN_SECURITY_MODE), secMode); + // Map Wpa2 to Wpa + secMode = ( secMode == EWlanSecModeWpa2 )? EWlanSecModeWpa : secMode; + aWlanInfo.iSecurityMode = static_cast(secMode); + + TUint32 usePsk(0); + TRAP_IGNORE( wlanTableView->ReadUintL(TPtrC( WLAN_ENABLE_WPA_PSK ), + usePsk ) ); + + aWlanInfo.SetUsesPreSharedKey( usePsk ); + + // net mode + TUint32 netMode(0); + wlanTableView->ReadUintL(TPtrC( WLAN_CONNECTION_MODE), netMode); + aWlanInfo.iNetMode = static_cast(netMode); + + CleanupStack::PopAndDestroy(wlanTableView); + CleanupStack::PopAndDestroy(commsDbIapTableView); + CleanupStack::PopAndDestroy(commsDb); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::SsidIdentity +// --------------------------------------------------------------------------- +// +TBool CWsfWlanScanner::SsidIdentity( const TWlanSsid& aSsid1, + const TWlanSsid& aSsid2 ) + { + return !aSsid1.Compare( aSsid2 ); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::RefreshNetworkNameL +// --------------------------------------------------------------------------- +// +TBool CWsfWlanScanner::RefreshNetworkNameL( TWsfWlanInfo& aWlanInfo ) + { + LOG_ENTERFN( "CWsfWlanScanner::RefreshNetworkNameL" ); + + TBool isHidden( EFalse ); + + TUint8 ieLen( 0 ); + const TUint8* ieData; + TBuf8 ssid8; + + TInt ret = iScanInfo->InformationElement( E802Dot11SsidIE, ieLen, + &ieData ); + + if ( ret == KErrNone ) + { + isHidden = IsHiddenSsid( ieLen, ieData ); + + if ( ieLen ) + { + ssid8.Copy( ieData, ieLen ); + aWlanInfo.iSsid.Copy( ssid8 ); + aWlanInfo.iRawSsid.Copy( ssid8 ); + TBuf ssid16; + ssid16.Copy( ssid8 ); + LOG_WRITEF( "SSID: [%S]", &ssid16 ); + } + else + { + LOG_WRITE( "SSID: " ); + } + } + else + { + User::Leave( ret ); + } + + return isHidden; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::IsHiddenSsid +// --------------------------------------------------------------------------- +// +TBool CWsfWlanScanner::IsHiddenSsid( TUint aSsidLength, const TUint8* aSsid ) + { + LOG_ENTERFN( "CWsfWlanScanner::IsHiddenSsid" ); + + + if ( !aSsidLength ) + { + LOG_WRITEF( "result: %d", ETrue ); + return ETrue; + } + + TInt count( 0 ); + for ( TUint i( 0 ); i < aSsidLength; ++i ) + { + count |= aSsid[i]; // in hidden networks characters are: 0x00 + } + + LOG_WRITEF( "result: %d", !count ); + + return !count; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::RefreshSignalStrength +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::RefreshSignalStrength( TWsfWlanInfo& aWlanInfo ) + { + LOG_ENTERFN( "CWsfWlanScanner::RefreshSignalStrength" ); + + TInt rxLevel = iScanInfo->RXLevel(); + + LOG_WRITEF( "rxLevel = %d", rxLevel ); + + // yes, it is < and not >, because smaller value means stronger signal + + if ( rxLevel < aWlanInfo.iStrengthLevel ) + { + LOG_WRITEF( "updating %d to %d", aWlanInfo.iStrengthLevel, rxLevel ); + aWlanInfo.iStrengthLevel = rxLevel; + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::RefreshNetworkMode +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::RefreshNetworkMode( TWsfWlanInfo& aWlanInfo ) + { + LOG_ENTERFN( "CWsfWlanScanner::RefreshNetworkMode" ); + + aWlanInfo.iNetMode = ( iScanInfo->Capability() & + E802Dot11CapabilityEssMask ) ? + EInfra : EAdhoc ; + + LOG_WRITEF( "netmode = %d", TInt( aWlanInfo.iNetMode ) ); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::RefreshSecurityMode +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::RefreshSecurityMode( TWsfWlanInfo& aWlanInfo ) + { + LOG_ENTERFN( "CWsfWlanScanner::RefreshSecurityMode" ); + + TWlanConnectionExtentedSecurityMode extSecMode = iScanInfo->ExtendedSecurityMode(); + + switch ( extSecMode ) + { + case EWlanConnectionExtentedSecurityModeWepOpen: + case EWlanConnectionExtentedSecurityModeWepShared: + { + aWlanInfo.iSecurityMode = EWlanSecModeWep; + break; + } + + case EWlanConnectionExtentedSecurityMode802d1x: + { + aWlanInfo.iSecurityMode = EWlanSecMode802_1x; + break; + } + + case EWlanConnectionExtentedSecurityModeWpa: + case EWlanConnectionExtentedSecurityModeWpa2: + { + aWlanInfo.iSecurityMode = EWlanSecModeWpa; + break; + } + + case EWlanConnectionExtentedSecurityModeWpaPsk: + case EWlanConnectionExtentedSecurityModeWpa2Psk: + { + aWlanInfo.iSecurityMode = EWlanSecModeWpa; + break; + } + + case EWlanConnectionExtentedSecurityModeWapi: + case EWlanConnectionExtentedSecurityModeWapiPsk: + { + aWlanInfo.iSecurityMode = EWlanSecModeWAPI; + break; + } + + case EWlanConnectionExtentedSecurityModeOpen: + default: + { + aWlanInfo.iSecurityMode = EWlanSecModeOpen; + } + } + + aWlanInfo.SetUsesPreSharedKey( + extSecMode == EWlanConnectionExtentedSecurityModeWpa2Psk || + extSecMode == EWlanConnectionExtentedSecurityModeWpaPsk ); + + LOG_WRITEF( "security mode %d (PSK: %d)", + (TInt)aWlanInfo.iSecurityMode, + (TInt)aWlanInfo.UsesPreSharedKey() ); + } + + +// ----------------------------------------------------------------------------- +// CWsfWlanScanner::ConvertTxRateToTxRateEnum +// ----------------------------------------------------------------------------- +// +core_tx_rate_e CWsfWlanScanner::ConvertTxRateToTxRateEnum( TUint8 aRate ) + { + LOG_ENTERFN( "CWsfWlanScanner::ConvertTxRateToTxRateEnum" ); + + switch ( aRate ) + { + case core_tx_rate_value_1mbit: + return core_tx_rate_1mbit; + case core_tx_rate_value_2mbit: + return core_tx_rate_2mbit; + case core_tx_rate_value_5p5mbit: + return core_tx_rate_5p5mbit; + case core_tx_rate_value_6mbit: + return core_tx_rate_6mbit; + case core_tx_rate_value_9mbit: + return core_tx_rate_9mbit; + case core_tx_rate_value_11mbit: + return core_tx_rate_11mbit; + case core_tx_rate_value_12mbit: + return core_tx_rate_12mbit; + case core_tx_rate_value_18mbit: + return core_tx_rate_18mbit; + case core_tx_rate_value_22mbit: + return core_tx_rate_22mbit; + case core_tx_rate_value_24mbit: + return core_tx_rate_24mbit; + case core_tx_rate_value_33mbit: + return core_tx_rate_33mbit; + case core_tx_rate_value_36mbit: + return core_tx_rate_36mbit; + case core_tx_rate_value_48mbit: + return core_tx_rate_48mbit; + case core_tx_rate_value_54mbit: + return core_tx_rate_54mbit; + default: + return core_tx_rate_none; + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::RefreshTechnology +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::RefreshTechnology( TWsfWlanInfo& aWlanInfo ) + { + LOG_ENTERFN( "CWsfWlanScanner::RefreshTechnology" ); + + TUint8 ieLen(0); + const TUint8* ieData; + TUint8 dataRates[KMaxNumberOfRates]; + + if ( iScanInfo->InformationElement( E802Dot11HtCapabilitiesIE, ieLen, + &ieData ) == 0 ) + { + // 802.11n supported + aWlanInfo.iTransferRate = 0x8; + } + else + { + Mem::FillZ( &dataRates[0], sizeof( dataRates ) ); + core_tx_rate_e rate( core_tx_rate_none ); + TUint32 basic_rates( 0 ); + TUint32 supported_rates( 0 ); + + // Supported Rates + iScanInfo->InformationElement( E802Dot11SupportedRatesIE, ieLen, + &ieData ); + + Mem::Copy( dataRates, ieData, ieLen ); + + TUint32 temp_basic_rates( 0 ); + TUint32 temp_supported_rates( 0 ); + + for ( TInt a = 0; a < ieLen; a++ ) + { + rate = ConvertTxRateToTxRateEnum( dataRates[a] + & ~TX_RATE_BASIC_MASK ); + + temp_supported_rates |= rate; + + if ( dataRates[a] & TX_RATE_BASIC_MASK ) + { + /** + * The highest bit is enabled, the rate is both a basic rate + * and a supported rate. + */ + temp_basic_rates |= rate; + } + } + + basic_rates |= temp_basic_rates; + supported_rates |= temp_supported_rates; + + // Extended Supported Rates + Mem::FillZ( &dataRates[0], sizeof( dataRates ) ); + + iScanInfo->InformationElement( E802Dot11ExtendedRatesIE, ieLen, + &ieData ); + + Mem::Copy( dataRates, ieData, ieLen ); + + if ( ieData ) + { + temp_basic_rates = 0; + temp_supported_rates = 0; + + for ( TInt a = 0; a < ieLen; a++ ) + { + rate = ConvertTxRateToTxRateEnum( dataRates[a] + & ~TX_RATE_BASIC_MASK ); + + temp_supported_rates |= rate; + + if ( dataRates[a] & TX_RATE_BASIC_MASK ) + { + /** + * The highest bit is enabled, the rate is both a basic rate + * and a supported rate. + */ + temp_basic_rates |= rate; + } + } + + basic_rates |= temp_basic_rates; + supported_rates |= temp_supported_rates; + } + + aWlanInfo.iTransferRate = 0x4; // 802.11bg + + // AP is 802.11b only if only 802.11b rates + // are advertised as supported rates. + if ( !( supported_rates & ~CORE_TX_RATES_802P11B ) ) + { + aWlanInfo.iTransferRate = 0x1; // 802.11b + } + // AP is 802.11g only if any of the 802.11g rates is a basic rate. + else if ( basic_rates & CORE_TX_RATES_802P11G ) + { + aWlanInfo.iTransferRate = 0x2; // 802.11g + } + } + + LOG_WRITEF( "technology = %d", aWlanInfo.iTransferRate ); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::ConnectionEstablishedL +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::ConnectionEstablishedL( const TDesC& aConnectionName ) + { + LOG_ENTERFN( "CWsfWlanScanner::ConnectionEstablishedL" ); + LOG_WRITEF( "aConnectionName: [%S]", &aConnectionName ); + + HBufC* temp = aConnectionName.AllocL(); + if ( iActiveConnectionName ) + { + delete iActiveConnectionName; + iActiveConnectionName = NULL; + } + iActiveConnectionName = temp; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::ConnectionLostL +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::ConnectionLostL() + { + LOG_ENTERFN( "CWsfWlanScanner::ConnectionLostL" ); + if ( iActiveConnectionName ) + { + delete iActiveConnectionName; + iActiveConnectionName = NULL; + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::ConnectingFailedL +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::ConnectingFailedL( TInt /*aError*/ ) + { + // no implementation required + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::ConnectedIapReleasedL +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::ConnectedIapReleasedL() + { + // no implementation required + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::ScanResults +// --------------------------------------------------------------------------- +// +HBufC8* CWsfWlanScanner::ScanResults() + { + return iScanResults; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::SetConnectionDetailProvider +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::SetConnectionDetailProvider( + MWsfWlanConnectionDetailsProvider& aProvider ) + { + iConnectionDetailsProvider = &aProvider; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::WlanScanIntervalChangedL +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::WlanScanIntervalChangedL( TUint aNewScanInterval, + TBool aShowAvailability ) + { + LOG_ENTERFN( "CWsfWlanScanner::WlanScanIntervalChangedL" ); + LOG_WRITEF( "bgScanInterval = %d sec", aNewScanInterval ); + LOG_WRITEF( "showAvailability = %d", aShowAvailability ); + iScanningInterval = aNewScanInterval * KMicrosecPerSecond; + + if ( iShowAvailability != aShowAvailability ) + { + // background WLAN scanning status changed + iShowAvailability = aShowAvailability; + + if ( iShowAvailability ) + { + // bgscan is now enabled + // no reissuing, we rely on the WLAN engine callbacks + // from now on + LOG_WRITE( "background scan enabled" ); + + if ( iScanState == EIdle && IsActive() ) + { + // reset the timer only if we are not in the middle + // of another scanning + iTimer.Cancel(); + } + } + else + { + // bgscan is now disabled + // reset the timer with the new interval + LOG_WRITE( "background scan disabled" ); + + if ( iScanState == EIdle ) + { + LOG_WRITE( "reissuing timer request" ); + // reset the timer only if we are not in the middle + // of another scanning + // otherwise RunL will take care of the timer + // doCancel resets timer + if ( IsActive() ) + { + Cancel(); + } + iTimer.After( iStatus, TTimeIntervalMicroSeconds32( + iScanningInterval ) ); + iCacheLifetime = 0; + iMaxDelay = 0; + SetActive(); + } + } + } + else if ( !iShowAvailability ) + { + // only the scan interval has changed + LOG_WRITE( "scan interval changed" ); + if ( iScanState == EIdle && IsActive() ) + { + // reset the timer only if we are not in the middle of + // another scanning + // doCancel resets timer + LOG_WRITE( "reissuing timer request" ); + Cancel(); + iTimer.After( iStatus, TTimeIntervalMicroSeconds32( + iScanningInterval ) ); + iCacheLifetime = 0; + iMaxDelay = 0; + SetActive(); + } + } + } + +// End of file + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/server/src/wsfwlansettingsaccessor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/server/src/wsfwlansettingsaccessor.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,350 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfWlanSettingsAccessor +* +*/ + + +// EXTERNAL INCLUDES +#include +#include +#include + +#include +#include +#include + +// CLASS HEADER +#include "wsfwlansettingsaccessor.h" + +// INTERNAL INCLUDES +#include "wsfwlanscanintervalchangeobserver.h" +#include "wsflogger.h" + + +using namespace CommsDat; + +// background scan disabled value +static const TUint KWlanBgScanIntervalNever = 0; + +// background scan automatic scanning value +static const TUint KWlanBgScanIntervalAuto = 0xffffffff; + +// default background scan interval in seconds +static const TUint KWlanBgScanIntervalDefault = 300; + +// hold-up time after first DB notification to prevent bursts (in microseconds) +static const TUint KDbNotificationHoldupTime = 1000 * 1000; + + + +// ---------------------------------------------------------------------------- +// CWsfWlanSettingsAccessor::NewL +// ---------------------------------------------------------------------------- +// +CWsfWlanSettingsAccessor* CWsfWlanSettingsAccessor::NewL( + CMDBSession& aDbSession ) + { + CWsfWlanSettingsAccessor *thisPtr = NewLC( aDbSession ); + CleanupStack::Pop( thisPtr ); + return thisPtr; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSettingsAccessor::NewLC +// ---------------------------------------------------------------------------- +// +CWsfWlanSettingsAccessor* CWsfWlanSettingsAccessor::NewLC( + CMDBSession& aDbSession ) + { + CWsfWlanSettingsAccessor *thisPtr = + new (ELeave) CWsfWlanSettingsAccessor( aDbSession ); + CleanupStack::PushL( thisPtr ); + thisPtr->ConstructL(); + return thisPtr; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSettingsAccessor::CWsfWlanSettingsAccessor +// ---------------------------------------------------------------------------- +// +CWsfWlanSettingsAccessor::CWsfWlanSettingsAccessor( CMDBSession& aDbSession ): + CActive( CActive::EPriorityStandard ), + iDbSession( &aDbSession ), + iBeingHeldUp( EFalse ) + { + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSettingsAccessor::ConstructL +// ---------------------------------------------------------------------------- +// +void CWsfWlanSettingsAccessor::ConstructL() + { + CActiveScheduler::Add( this ); + + // get WLAN table id + TRAP_IGNORE( iTableId = CCDWlanDeviceSettingsRecord::TableIdL( + *iDbSession ) ); + + if ( !iTableId ) + { + iTableId = CCDWlanDeviceSettingsRecord::CreateTableL( *iDbSession ); + } + + iWlanSettingsRecord = new (ELeave) CCDWlanDeviceSettingsRecord( iTableId ); + iWlanSettingsRecord->iWlanDeviceSettingsType = KWlanUserSettings; + + if ( !iWlanSettingsRecord->FindL( *iDbSession ) ) + { + User::Leave( KErrNotFound ); + } + + User::LeaveIfError( iTimer.CreateLocal() ); + + DoCheckSettingL( iScanInterval, iShowAvailability ); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSettingsAccessor::~CWsfWlanSettingsAccessor +// ---------------------------------------------------------------------------- +// +CWsfWlanSettingsAccessor::~CWsfWlanSettingsAccessor() + { + Cancel(); + iTimer.Close(); + iDbSession = NULL; // not owning + iChangeObserver = NULL; // not owning + delete iWlanSettingsRecord; // own + iWlanSettingsRecord = NULL; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSettingsAccessor::ScanInterval +// ---------------------------------------------------------------------------- +// +TUint CWsfWlanSettingsAccessor::ScanInterval() const + { + LOG_ENTERFN( "CWsfWlanSettingsAccessor::ScanInterval" ); + return iScanInterval; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSettingsAccessor::ShowAvailability +// ---------------------------------------------------------------------------- +// +TBool CWsfWlanSettingsAccessor::ShowAvailability() const + { + LOG_ENTERFN( "CWsfWlanSettingsAccessor::ShowAvailability" ); + return iShowAvailability; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSettingsAccessor::RequestNotificationL +// ---------------------------------------------------------------------------- +// +void CWsfWlanSettingsAccessor::RequestNotificationL( + MWsfWlanScanIntervalChangeObserver& aObserver ) + { + LOG_ENTERFN( "CWsfWlanSettingsAccessor::RequestNotificationL" ); + iChangeObserver = &aObserver; + IssueNotificationRequestL(); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSettingsAccessor::IssueNotificationRequestL +// ---------------------------------------------------------------------------- +// +void CWsfWlanSettingsAccessor::IssueNotificationRequestL() + { + LOG_ENTERFN( "CWsfWlanSettingsAccessor::IssueNotificationRequestL" ); + if ( iChangeObserver ) + { + if ( !IsActive() ) + { + LOG_WRITE( "issuing..." ); + User::LeaveIfError( iWlanSettingsRecord->RequestNotification( + *iDbSession, iStatus ) ); + SetActive(); + } + } + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSettingsAccessor::CancelNotifications +// ---------------------------------------------------------------------------- +// +void CWsfWlanSettingsAccessor::CancelNotifications() + { + LOG_ENTERFN( "CWsfWlanSettingsAccessor::CancelNotifications" ); + Cancel(); + iChangeObserver = NULL; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSettingsAccessor::DoCheckSettingL +// ---------------------------------------------------------------------------- +// +void CWsfWlanSettingsAccessor::DoCheckSettingL( TUint& aBgScanInterval, + TBool& aShowAvailability ) + { + LOG_ENTERFN( "CWsfWlanSettingsAccessor::DoCheckSettingL" ); + // open the wlan settings table + + iWlanSettingsRecord->RefreshL( *iDbSession ); + FeatureManager::InitializeLibL(); + + aShowAvailability = ( iWlanSettingsRecord->iBgScanInterval != + KWlanBgScanIntervalNever ); + + // read the common value + if ( iWlanSettingsRecord->iBgScanInterval == KWlanBgScanIntervalNever ) + { + if ( iWlanSettingsRecord->iSavedBgScanInterval == + KWlanBgScanIntervalNever ) + { + TInt defaultScanInterval( KWlanBgScanIntervalDefault ); + + if (FeatureManager::FeatureSupported( KFeatureIdPowerSave )) + { + // Read the default value from CenRep (different in PSM mode) + CRepository* cenrep = CRepository::NewL( + KCRUidWlanDeviceSettingsRegistryId ); + cenrep->Get( KWlanDefaultBGScanInterval, defaultScanInterval ); + delete cenrep; + } + + aBgScanInterval = TUint( defaultScanInterval ); + } + else + { + aBgScanInterval = iWlanSettingsRecord->iSavedBgScanInterval; + } + } + else + { + aBgScanInterval = iWlanSettingsRecord->iBgScanInterval; + } + + // Set scan interval to default value if adaptive scanning value is + // found from db + if (aBgScanInterval == KWlanBgScanIntervalAuto ) + { + TInt defaultScanInterval( KWlanBgScanIntervalDefault ); + aBgScanInterval = TUint( defaultScanInterval ); + } + + FeatureManager::UnInitializeLib(); + LOG_WRITEF( "current bgScanInterval = %d sec", aBgScanInterval ); + LOG_WRITEF( "current showAvailability = %d", aShowAvailability ); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSettingsAccessor::CheckIfSettingChangedL +// ---------------------------------------------------------------------------- +// +TBool CWsfWlanSettingsAccessor::CheckIfSettingChangedL() + { + LOG_ENTERFN( "CWsfWlanSettingsAccessor::CheckIfSettingChangedL" ); + LOG_WRITEF( "previous bgScanInterval = %d", iScanInterval ); + LOG_WRITEF( "previous showAvailability = %d", iShowAvailability ); + TUint newBgsi( 0 ); + TBool newSaf( EFalse ); + + DoCheckSettingL( newBgsi, newSaf ); + + TBool retval( newBgsi != iScanInterval || newSaf != iShowAvailability ); + iScanInterval = newBgsi; + iShowAvailability = newSaf; + + return retval; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSettingsAccessor::RunL +// ---------------------------------------------------------------------------- +// +void CWsfWlanSettingsAccessor::RunL() + { + LOG_ENTERFN( "CWsfWlanSettingsAccessor::RunL" ); + LOG_WRITEF( "iStatus.Int() = %d", iStatus.Int() ); + + // Symbian DB notifiers are triggered by everything that may happen in + // commsdat, so it would be very resource-consuming to check the value on + // each database event + // Workaround: 1-sec delay when first callback is received + + if ( !iBeingHeldUp ) + { + LOG_WRITE( "starting anti-burst delay" ); + iBeingHeldUp = ETrue; + iTimer.After( iStatus, TTimeIntervalMicroSeconds32( + KDbNotificationHoldupTime ) ); + SetActive(); + } + else + { + LOG_WRITE( "checking changes" ); + iBeingHeldUp = EFalse; + if ( CheckIfSettingChangedL() ) + { + LOG_WRITE( "setting changed, notifying observer" ); + iChangeObserver->WlanScanIntervalChangedL( iScanInterval, + iShowAvailability ); + } + + IssueNotificationRequestL(); + } + + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSettingsAccessor::DoCancel +// ---------------------------------------------------------------------------- +// +void CWsfWlanSettingsAccessor::DoCancel() + { + iTimer.Cancel(); + iBeingHeldUp = EFalse; + + if ( iWlanSettingsRecord ) + { + iWlanSettingsRecord->CancelNotification( *iDbSession, iStatus ); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSettingsAccessor::RunError +// ---------------------------------------------------------------------------- +// +TInt CWsfWlanSettingsAccessor::RunError( TInt /*aError*/ ) + { + TRAP_IGNORE( IssueNotificationRequestL() ); + return KErrNone; + } + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 file for project WlanSniffer +* +*/ + + + +#include + +PRJ_PLATFORMS +DEFAULT +// Help exports +#include "../help/group/bld.inf" + + +PRJ_EXPORTS +// export iby file +../rom/wlansniffer.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wlansniffer.iby) + + +PRJ_MMPFILES +// gnumakefile wsficons.mk +// gnumakefile wsficons_aif.mk + + +#include "../aiplugin/group/bld.inf" +#include "../aihelper/group/bld.inf" +#include "../apwizard/group/bld.inf" +#include "../engine/client/group/bld.inf" +#include "../engine/server/group/bld.inf" +#include "../mainapplication/group/bld.inf" +#include "../model/group/bld.inf" +#include "../widget/group/bld.inf" +#include "../wlaninfo/group/bld.inf" +#include "../wlaninfosorting/group/bld.inf" + +PRJ_EXTENSIONS + +START EXTENSION s60/mifconv +OPTION TARGETFILE wsficons.mif +OPTION HEADERFILE wsficons.mbg +OPTION SOURCES -c8,1 qgn_indi_wlan_secure_network_add \ + -c8,1 empty13x13 \ + -c8,1 qgn_indi_wlan_signal_low_add \ + -c8,1 qgn_indi_wlan_signal_med_add \ + -c8,1 qgn_indi_wlan_signal_good_add \ + -c8,1 qgn_prop_cmon_wlan_conn \ + -c8,1 qgn_prop_wlan_bearer \ + -c8,1 qgn_prop_empty \ + -c8,1 qgn_indi_wlan_sniffer_plugin_off \ + -c8,1 qgn_indi_wlan_sniffer_plugin_on \ + -c8,1 qgn_indi_wlan_sniffer_plugin_on_0 \ + -c8,1 qgn_indi_wlan_sniffer_plugin_on_1 \ + -c8,1 qgn_menu_wlan_sniffer +END + +START EXTENSION s60/mifconv +OPTION TARGETFILE wsficons_aif.mif +OPTION SOURCES -c8,1 qgn_menu_wlan_sniffer +END + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/group/wsficons.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/group/wsficons.mk Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,70 @@ +# +# Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: scalable icons makefile for project WlanSniffer +# + + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\Z +else +ZDIR=$(EPOCROOT)epoc32\data\z +endif + +TARGETDIR=$(ZDIR)\RESOURCE\APPS +ICONTARGETFILENAME=$(TARGETDIR)\wsficons.mif + +HEADERDIR=$(EPOCROOT)epoc32\include +HEADERFILENAME=$(HEADERDIR)\wsficons.mbg + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +RESOURCE : + + mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ + /c8,1 qgn_indi_wlan_secure_network_add.svg \ + /c8,1 empty13x13.svg \ + /c8,1 qgn_indi_wlan_signal_low_add.svg \ + /c8,1 qgn_indi_wlan_signal_med_add.svg \ + /c8,1 qgn_indi_wlan_signal_good_add.svg \ + /c8,1 qgn_prop_cmon_wlan_conn.svg \ + /c8,1 qgn_prop_wlan_bearer.svg \ + /c8,1 qgn_prop_empty.svg \ + /c8,1 qgn_indi_wlan_sniffer_plugin_off.svg \ + /c8,1 qgn_indi_wlan_sniffer_plugin_on.svg \ + /c8,1 qgn_indi_wlan_sniffer_plugin_on_0.svg \ + /c8,1 qgn_indi_wlan_sniffer_plugin_on_1.svg \ + /c8,1 qgn_menu_wlan_sniffer.svg + + + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(HEADERFILENAME)&& \ + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/group/wsficons_aif.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/group/wsficons_aif.mk Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,53 @@ +# +# Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: scalable icons makefile for project WlanSniffer +# + + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\Z +else +ZDIR=$(EPOCROOT)epoc32\data\z +endif + + +TARGETDIR=$(ZDIR)\RESOURCE\APPS +ICONTARGETFILENAME=$(TARGETDIR)\wsficons_aif.mif + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +RESOURCE : + mifconv $(ICONTARGETFILENAME) \ + /c8,1 qgn_menu_wlan_sniffer.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/help/data/xhtml.zip Binary file wlanutilities/wlansniffer/help/data/xhtml.zip has changed diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/help/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/help/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,26 @@ +/* +* 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: +* Export help related files. +* +*/ + +#include +PRJ_EXPORTS +:zip ../data/xhtml.zip /epoc32/data/z/resource/ overwrite +:zip ../data/xhtml.zip /epoc32/winscw/c/resource/ overwrite + +../inc/sniffer.hlp.hrh MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/sniffer.hlp.hrh) +../rom/wlansnifferhelps_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(wlansnifferhelps_variant.iby) diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/help/inc/sniffer.hlp.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/help/inc/sniffer.hlp.hrh Wed Sep 01 12:20: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: +* +*/ + +// +// sniffer.hlp.hrh generated by CSXHelp Utilities. +// + +#ifndef __SNIFFER_HLP_HRH__ +#define __SNIFFER_HLP_HRH__ + +_LIT(KSNIFFER_HLP_MAIN, "SNIFFER_HLP_MAIN"); // + +#endif \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/help/rom/wlansnifferhelps_variant.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/help/rom/wlansnifferhelps_variant.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,28 @@ +/* +* 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 Sniffer helps + * +*/ + +#ifndef __WLANSNIFFERHELPS_VARIANT_IBY__ +#define __WLANSNIFFERHELPS_VARIANT_IBY__ + +#if defined(FF_S60_HELPS_IN_USE) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10281CAA\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x10281CAA\contents.zip) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10281CAA\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10281CAA\index.xml) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10281CAA\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10281CAA\keywords.xml) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10281CAA\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10281CAA\meta.xml) +#endif + +#endif \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/inc/wsflogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/inc/wsflogger.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,257 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfModel +* +*/ + +#ifndef WSFLOGGER_H +#define WSFLOGGER_H + + +#ifdef _DEBUG +#define USE_WSFLOGGER +#endif + + +#ifdef USE_WSFLOGGER + +// undef this if you want logs into file +#define WSFLOGGER_LOGGING_METHOD_RDEBUG + +// EXTERNAL INCLUDES +#include +#include + + +// CONSTANTS +_LIT( KLogDir, "Sniffer" ); +_LIT( KLogFile, "Sniffer.txt" ); +_LIT( KLogBanner, "Sniffer 0.1.0" ); +_LIT( KLogEnterFn, "%04x\t% *S-> %S" ); +_LIT( KLogLeaveFn, "%04x\t% *S<- %S" ); +_LIT( KLogExit, "Sniffer: Application exit" ); +_LIT( KLogFormat, "%04x\t% *S%S" ); + + +// CLASS DEFINITION +/** +* Class to log functionentry/exit +* +* Example usage: +* +* @code +* #include "wsflogger.h" +* +* ... +* +* void MyClass::DoIt() +* { +* LOG_ENTERFN( "MyClass::DoIt" ); +* // doing it... +* } +* +* @endcode +* +* Since the macros create instances on the stack, the class is destructed when +* the stack is unwound. Thus, if LOG_ENTERFN was called at the highest level +* within the function then the destructor can detect the exit from the +* function without the need of an explicit "LOG_LEAVEFN" to each exit point. +* +* Note: the destructor is not called if a leave occurs. +* +* @since S60 5.0 +*/ +NONSHARABLE_CLASS( CFunctionEntryExit ): public CBase + { + public: + + /** + * Constructor + * @since S60 5.0 + * @param aFunc Name of the function being entered + */ + CFunctionEntryExit( TRefByValue aFunc ) + { + iFunc.Set( aFunc ); + + RThread thread; + TUint tid = TUint( thread.Id() ) & 0xffff; + +#ifndef WSFLOGGER_LOGGING_METHOD_RDEBUG + RFileLogger::WriteFormat( KLogDir, + KLogFile, + EFileLoggingModeAppend, + KLogEnterFn, + tid, + 4*((tid>>2)&0x3), + &KNullDesC, + &iFunc); +#else + RDebug::Print( KLogEnterFn, tid, + 4*((tid>>2)&0x3), + &KNullDesC, + &iFunc); +#endif + } + + /** + * Destructor + * @since S60 5.0 + */ + ~CFunctionEntryExit() + { + RThread thread; + TUint tid = TUint( thread.Id() ) & 0xffff; + +#ifndef WSFLOGGER_LOGGING_METHOD_RDEBUG + RFileLogger::WriteFormat( KLogDir, + KLogFile, + EFileLoggingModeAppend, + KLogLeaveFn, + tid, + 4*((tid>>2)&0x3), + &KNullDesC, + &iFunc); +#else + RDebug::Print( KLogLeaveFn, + tid, + 4*((tid>>2)&0x3), + &KNullDesC, + &iFunc ); +#endif + } + + public: // data + /** + * Function name + */ + TPtrC iFunc; + }; + + +// LOG MACROS +#ifndef WSFLOGGER_LOGGING_METHOD_RDEBUG +// Create/overwrite the log file +#define LOG_CREATE \ + { \ + TFileName path( _L( "c:\\logs\\" ) ); \ + path.Append( KLogDir ); \ + path.Append( _L( "\\" ) ); \ + RFileLogger::WriteFormat( KLogDir, KLogFile, \ + EFileLoggingModeOverwrite, KLogBanner ); \ + } + + +// Close the log +#define LOG_DELETE \ + RFileLogger::Write( KLogDir, KLogFile, \ + EFileLoggingModeAppend, KLogExit ); \ + + +// Place a function entry/exit watchdog +#define LOG_ENTERFN(a) \ + CFunctionEntryExit entryExit( _L(a) ); + + +// Write a solid string to the log +#define LOG_WRITE(a) \ + { \ + _LIT( temp, a ); \ + RThread thread; \ + TUint tid = TUint( thread.Id() ) & 0xffff; \ + TBuf<5+12+sizeof(L##a)/2-1> buf; \ + buf.Format( KLogFormat, \ + tid, 4*((tid>>2)&0x3), &KNullDesC, &temp ); \ + RFileLogger::Write( KLogDir, KLogFile, \ + EFileLoggingModeAppend, buf ); \ + } + + +// Write a formatted string to the log +#define LOG_WRITEF(a, s...) \ + { \ + _LIT( temp, a ); \ + RThread thread; \ + TUint tid = TUint( thread.Id() ) & 0xffff; \ + TBuf<5+12+sizeof(L##a)/2-1> buf; \ + buf.Format( KLogFormat, \ + tid, 4*((tid>>2)&0x3), &KNullDesC, &temp ); \ + RFileLogger::WriteFormat( KLogDir, KLogFile, \ + EFileLoggingModeAppend, buf, s ); \ + } + +#else // WSFLOGGER_LOGGING_METHOD_RDEBUG + +// Create/overwrite the log file +#define LOG_CREATE \ + RDebug::Print(_L("%S"), &KLogBanner); + + +// Close the log +#define LOG_DELETE \ + RDebug::Print(_L("%S"), &KLogExit); + + +// Place a function entry/exit watchdog +#define LOG_ENTERFN(a) \ + CFunctionEntryExit entryExit( _L(a) ); + + +// Write a solid string to the log +#define LOG_WRITE(a) \ + { \ + _LIT( temp, a ); \ + RThread thread; \ + TUint tid = TUint( thread.Id() ) & 0xffff; \ + TBuf<5+12+sizeof(L##a)/2-1> buf; \ + buf.Format( KLogFormat, \ + tid, 4*((tid>>2)&0x3), &KNullDesC, &temp ); \ + RDebug::Print(buf); \ + } + + +// Write a formatted string to the log +#define LOG_WRITEF(a, s...) \ + { \ + _LIT( temp, a ); \ + RThread thread; \ + TUint tid = TUint( thread.Id() ) & 0xffff; \ + TBuf<5+12+sizeof(L##a)/2-1> buf; \ + buf.Format( KLogFormat, \ + tid, 4*((tid>>2)&0x3), &KNullDesC, &temp ); \ + RDebug::Print( buf, s); \ + } + +#endif // WSFLOGGER_LOGGING_METHOD_RDEBUG + + +#else // _DEBUG + + +#define LOG_CREATE +#define LOG_DELETE +#define LOG_ENTERFN(a) +#define LOG_WRITE(a) +#define LOG_WRITEF(a, s...) + + +#endif // _DEBUG + + + + +#endif // WSFLOGGER_H + + +// End of File diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/data/wlansniffer.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/data/wlansniffer.rss Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,723 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource definitions for project MainApplication + * +*/ + +NAME HELL + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wsfmainapplication.hrh" + +// --------------------------------------------------------- +// +// Define the resource file signature +// This resource should be empty. +// +// --------------------------------------------------------- +// +RESOURCE RSS_SIGNATURE + {} + +// --------------------------------------------------------- +// +// Default Document Name +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_default_document_name + { + buf=""; + } + +// --------------------------------------------------------- +// +// Define default menu and CBA key. +// +// --------------------------------------------------------- +// +RESOURCE EIK_APP_INFO + { + menubar = r_sniffer_menubar; + } + +// --------------------------------------------------------- +// +// r_sniffer_cp_mainview +// Control Panel Mainview +// +// --------------------------------------------------------- +// +RESOURCE CBA r_sniffer_cp_options_back_menu + { + buttons = + { + CBA_BUTTON + { + id=EAknSoftkeyOptions; txt = text_softkey_option; + }, + CBA_BUTTON + { + id=EAknSoftkeyExit; txt = text_softkey_back; + }, + CBA_BUTTON + { + id=EAknSoftkeyContextOptions; txt = text_softkey_option; + } + }; + } + +RESOURCE AVKON_VIEW r_sniffer_cp_mainview + { + menubar = r_sniffer_menubar; + cba = r_sniffer_cp_options_back_menu; + } + +// --------------------------------------------------------- +// +// r_Sniffer_mainview +// Mainview +// +// --------------------------------------------------------- +// +RESOURCE CBA r_sniffer_options_back_menu + { + buttons = + { + CBA_BUTTON + { + id=EAknSoftkeyOptions; txt = text_softkey_option; + }, + CBA_BUTTON + { + id=EAknSoftkeyExit; txt = text_softkey_exit; + }, + CBA_BUTTON + { + id=EAknSoftkeyContextOptions; txt = text_softkey_option; + } + }; + } + +RESOURCE AVKON_VIEW r_sniffer_mainview + { + menubar = r_sniffer_menubar; + cba = r_sniffer_options_back_menu; + } + +// --------------------------------------------------------- +// +// r_Sniffer_menubar +// Menubar for Sniffer example +// +// --------------------------------------------------------- +// +RESOURCE MENU_BAR r_sniffer_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = r_sniffer_menu; + } + }; + } + +// --------------------------------------------------------- +// +// r_Sniffer_menu +// Menu for "Options" +// +// --------------------------------------------------------- +// +RESOURCE MENU_PANE r_sniffer_menu + { + items = + { + MENU_ITEM + { + command = ESnifferCmdStartBrowsing; + txt = qtn_sniffer_opt_start_web_browsing; + flags = EEikMenuItemSpecific; + }, + MENU_ITEM + { + command = ESnifferCmdContinueBrowsing; + txt = qtn_sniffer_opt_continue_web_browsing; + flags = EEikMenuItemSpecific; + }, + MENU_ITEM + { + command = ESnifferCmdConnect; + txt = qtn_sniffer_opt_connect; + flags = EEikMenuItemSpecific; + }, + MENU_ITEM + { + command = ESnifferCmdDisconnect; + txt = qtn_sniffer_opt_disconnect_wlan; + flags = EEikMenuItemSpecific; + }, + MENU_ITEM + { + command = ESnifferCmdRefresh; + txt = qtn_sniffer_opt_refresh; + }, + MENU_ITEM + { + command = ESnifferCmdFilterWlans; + txt = qtn_sniffer_opt_filter_out_wlans; + }, + MENU_ITEM + { + command = ESnifferCmdDetails; + txt = qtn_sniffer_opt_details; + flags = EEikMenuItemSpecific; + }, + MENU_ITEM + { + command = ESnifferCmdSettings; + txt = qtn_sniffer_opt_settings; + }, + MENU_ITEM + { + command = EAknCmdHelp; + txt = qtn_options_help; + }, + MENU_ITEM + { + command = EAknCmdExit; + txt = qtn_options_exit; + } + }; + } + +RESOURCE MENU_BAR r_sniffer_context_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = r_sniffer_context_menu; + } + }; + } + +RESOURCE MENU_PANE r_sniffer_context_menu + { + items = + { + MENU_ITEM + { + command = ESnifferCmdStartBrowsing; + txt = qtn_sniffer_opt_start_web_browsing; + }, + MENU_ITEM + { + command = ESnifferCmdContinueBrowsing; + txt = qtn_sniffer_opt_continue_web_browsing; + }, + MENU_ITEM + { + command = ESnifferCmdConnect; + txt = qtn_sniffer_opt_connect; + }, + MENU_ITEM + { + command = ESnifferCmdDisconnect; + txt = qtn_sniffer_opt_disconnect_wlan; + }, + MENU_ITEM + { + command = ESnifferCmdDetails; + txt = qtn_sniffer_opt_details; + } + }; + } + +// --------------------------------------------------------- +// +// r_sniffer_detailsview +// Details +// +// --------------------------------------------------------- +// +RESOURCE AVKON_VIEW r_sniffer_detailsview + { + menubar = r_sniffer_detailsview_menubar; + cba = R_AVKON_SOFTKEYS_OK_EMPTY; + } + + +// --------------------------------------------------------- +// +// r_sniffer_detailsview_menubar +// +// --------------------------------------------------------- +// +RESOURCE MENU_BAR r_sniffer_detailsview_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = R_AVKON_MENUPANE_EMPTY; + } + }; + } + +//----------------------------------------------------------------------------- +// +// Details view listbox headings resources +// +//----------------------------------------------------------------------------- + +RESOURCE TBUF r_qtn_cmon_heading_conn_name + { + buf = qtn_cmon_heading_conn_name; + } + +RESOURCE TBUF r_qtn_sniffer_heading_wlan_network_name + { + buf = qtn_cmon_heading_wlan_network_name; + } + +RESOURCE TBUF r_qtn_sniffer_heading_wlan_signal_strength + { + buf = qtn_cmon_heading_wlan_signal_strength; + } + +RESOURCE TBUF r_qtn_sniffer_heading_wlan_network_mode + { + buf = qtn_cmon_heading_wlan_network_mode; + } + +RESOURCE TBUF r_qtn_sniffer_heading_wlan_security_mode + { + buf = qtn_cmon_heading_wlan_security_mode; + } + +RESOURCE TBUF r_qtn_sniffer_heading_wlan_nw_ap_amount + { + buf = qtn_cmon_heading_wlan_nw_ap_amount; + } + +RESOURCE TBUF r_qtn_sniffer_heading_wlan_nw_max_rate + { + buf = qtn_cmon_heading_wlan_nw_max_rate; + } + +//----------------------------------------------------------------------------- +// +// Details View signal strength detail definitions +// +//----------------------------------------------------------------------------- + +RESOURCE TBUF r_qtn_sniffer_wlan_signal_strength_low + { + buf = qtn_cmon_wlan_signal_strength_low; + } + +RESOURCE TBUF r_qtn_sniffer_wlan_signal_strength_medium + { + buf = qtn_cmon_wlan_signal_strength_medium; + } + +RESOURCE TBUF r_qtn_sniffer_wlan_signal_strength_strong + { + buf = qtn_cmon_wlan_signal_strength_good; + } + +RESOURCE TBUF r_qtn_sniffer_wlan_signal_strength_no_signal + { + buf = qtn_cmon_wlan_signal_strength_no_signal; + } + +//----------------------------------------------------------------------------- +// +// Details View Wlan mode definitions +// +//----------------------------------------------------------------------------- + +RESOURCE TBUF r_qtn_sniffer_wlan_sett_newtwork_mode_adhoc + { + buf = qtn_cmon_wlan_network_mode_adhoc; + } + +RESOURCE TBUF r_qtn_sniffer_wlan_sett_newtwork_mode_infra + { + buf = qtn_cmon_wlan_network_mode_infra; + } + +//----------------------------------------------------------------------------- +// +// Details View Wlan security definitions +// +//----------------------------------------------------------------------------- + +RESOURCE TBUF r_qtn_sniffer_wlan_sett_security_mode_open + { + buf = qtn_wlan_sett_security_mode_open; + } + +RESOURCE TBUF r_qtn_sniffer_wlan_sett_security_mode_wep + { + buf = qtn_wlan_sett_security_mode_wep; + } + +RESOURCE TBUF r_qtn_sniffer_wlan_sett_security_mode_802_1x + { + buf = qtn_wlan_sett_security_mode_802_1x; + } + +RESOURCE TBUF r_qtn_sniffer_wlan_sett_security_mode_wpa + { + buf = qtn_wlan_sett_security_mode_wpa; + } + +RESOURCE TBUF r_qtn_sniffer_wlan_sett_security_mode_wapi + { + buf = qtn_wlan_sett_security_mode_wapi; + } + +//----------------------------------------------------------------------------- +// +// Details View Wlan security definitions +// +//----------------------------------------------------------------------------- + +RESOURCE TBUF r_qtn_sniffer_wlan_ap_amount_in_range + { + buf = qtn_cmon_wlan_ap_amount_in_range_1; + } + +RESOURCE TBUF r_qtn_sniffer_wlan_ap_amount_in_range_many + { + buf = qtn_cmon_wlan_ap_amount_in_range_many; + } + +//----------------------------------------------------------------------------- +// +// Details View Wlan speed definitions +// +//----------------------------------------------------------------------------- + +RESOURCE TBUF r_qtn_sniffer_wlan_max_data_rate + { + buf = qtn_cmon_wlan_max_data_rate; + } + +//----------------------------------------------------------------------------- +// +// Details View Wlan technology definitions +// +//----------------------------------------------------------------------------- + +RESOURCE TBUF r_qtn_sniffer_wlan_sett_technology_802_11b + { + buf = "802.11b"; + } + +RESOURCE TBUF r_qtn_sniffer_wlan_sett_technology_802_11g + { + buf = "802.11g"; + } + +RESOURCE TBUF r_qtn_sniffer_wlan_sett_technology_802_11bg + { + buf = "802.11b/g"; + } + +RESOURCE TBUF r_qtn_sniffer_wlan_sett_technology_802_11n + { + buf = "802.11n"; + } + +//----------------------------------------------------------------------------- +// +// Connected Details Pop-up heading text: +// +//----------------------------------------------------------------------------- +RESOURCE TBUF r_qtn_wlan_heading_connection_details + { + buf = qtn_wlan_heading_connection_details; + } + +//----------------------------------------------------------------------------- +// +// Connected Details Pop-up item heading texts: +// +//----------------------------------------------------------------------------- +RESOURCE TBUF r_qtn_wlan_item_heading_text_wlan + { + buf = qtn_wlan_item_heading_text_wlan; + } + +RESOURCE TBUF r_qtn_wlan_item_heading_duration + { + buf = qtn_wlan_item_heading_duration; + } + +RESOURCE TBUF r_qtn_wlan_item_heading_transf + { + buf = qtn_wlan_item_heading_transf; + } + +//----------------------------------------------------------------------------- +// +// Connected Details Pop-up item texts: +// +//----------------------------------------------------------------------------- +RESOURCE TBUF r_qtn_wlan_item_kb + { + buf = qtn_wlan_item_kb; + } + +RESOURCE TBUF r_qtn_wlan_item_mb + { + buf = qtn_wlan_item_mb; + } + +//----------------------------------------------------------------------------- +// +// Waitnote +// +//----------------------------------------------------------------------------- + +RESOURCE DIALOG r_waitnote_searching_wlans + { + flags = EAknWaitNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EWaitNoteSearchingWlans; + control = AVKON_NOTE + { + layout = EWaitLayout; + singular_label = qtn_wlan_wait_searching_networks; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; + } + +//----------------------------------------------------------------------------- +// +// Connecting waitnote +// +//----------------------------------------------------------------------------- + +RESOURCE DIALOG r_waitnote_connecting + { + flags = EAknWaitNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EWaitNoteConnecting; + control = AVKON_NOTE + { + layout = EWaitLayout; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; + } + +//----------------------------------------------------------------------------- +// +// Connected Details Dialog +// +//----------------------------------------------------------------------------- +RESOURCE AVKON_LIST_QUERY r_qtn_connected_details_dialog + { + softkeys = R_AVKON_SOFTKEYS_OK_EMPTY__OK; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control = AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSingleHeadingPopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + flags = EAknListBoxDisableItemSpecificMenu | + EAknListBoxViewerFlag; + }; + heading = qtn_wlan_heading_connection_details; + }; + } + }; + } + +//----------------------------------------------------------------------------- +// +// Connected Details Dialog +// +//----------------------------------------------------------------------------- +RESOURCE DIALOG r_restart_browsing_confirmation_query + { + flags=EGeneralQueryFlags; + buttons=R_AVKON_SOFTKEYS_YES_NO__YES; + items= + { + DLG_LINE + { + type=EAknCtQuery; + id = EGeneralQuery; + control= AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + }; + } + }; + } + +RESOURCE TBUF r_qtn_options_exit + { + buf = qtn_options_exit; + } + +RESOURCE TBUF r_qtn_options_help + { + buf = qtn_options_help; + } + +RESOURCE TBUF r_qtn_sniffer_opt_settings + { + buf = qtn_sniffer_opt_settings; + } + +RESOURCE TBUF r_sniffer_opt_define_access_point + { + buf = qtn_sniffer_opt_define_access_point; + } + +RESOURCE TBUF r_qtn_sniffer_opt_details + { + buf = qtn_sniffer_opt_details; + } + +RESOURCE TBUF r_qtn_sniffer_opt_refresh + { + buf = qtn_sniffer_opt_refresh; + } +RESOURCE TBUF r_qtn_sniffer_opt_filter_out_wlans + { + buf = qtn_sniffer_opt_filter_out_wlans; + } +RESOURCE TBUF r_qtn_sniffer_opt_disconnect + { + buf = qtn_sniffer_opt_disconnect_wlan; + } + +RESOURCE TBUF r_qtn_sniffer_opt_start_web_browsing + { + buf = qtn_sniffer_opt_start_web_browsing; + } + +RESOURCE TBUF r_qtn_sniffer_opt_continue_web_browsing + { + buf = qtn_sniffer_opt_continue_web_browsing; + } + +RESOURCE TBUF r_text_softkey_exit + { + buf = text_softkey_exit; + } + +RESOURCE TBUF r_qtn_sniffer_unknown + { + buf = qtn_sniffer_unknown; + } + +RESOURCE TBUF r_qtn_sniffer_known + { + buf = qtn_sniffer_known; + } + +RESOURCE TBUF r_qtn_sniffer_connecting + { + buf = qtn_sniffer_connecting; + } + +RESOURCE TBUF r_qtn_sniffer_connected + { + buf = qtn_sniffer_connected; + } + +RESOURCE TBUF r_qtn_sniffer_hidden_wlan + { + buf = qtn_sniffer_plug_in_hidden_ssid_label; + } + +RESOURCE TBUF r_qtn_wlan_info_no_networks_found + { + buf = qtn_wlan_info_no_networks_found; + } + +RESOURCE TBUF r_qtn_wlan_info_connection_already_active + { + buf = qtn_wlan_info_connection_already_active; + } + +RESOURCE TBUF r_qtn_wlan_wait_searching_networks + { + buf = qtn_wlan_wait_searching_networks; + } + +RESOURCE TBUF r_qtn_sniffer_title + { + buf = qtn_sniffer_title; + } + +RESOURCE TBUF r_qtn_sniffer_navi_one_wlan_nw_available + { + buf = qtn_cmon_navi_one_wlan_nw_available; + } + +RESOURCE TBUF r_qtn_sniffer_navi_many_wlan_nws_available + { + buf = qtn_cmon_navi_many_wlan_nws_available; + } + +//----------------------------------------------------------------------------- + +RESOURCE LOCALISABLE_APP_INFO r_sniffer_localisable_app_info + { + short_caption = qtn_sniffer_title; + caption_and_icon = + CAPTION_AND_ICON_INFO + { + caption = qtn_sniffer_title; + icon_file = "Z:"APP_BITMAP_DIR"\\wsficons_aif.mif"; + }; + } + +// END OF FILE diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/data/wlansniffer_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/data/wlansniffer_reg.rss Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource definitions for project MainApplication +* +*/ + + +//Sniffer application's registration resource file +#include +#include + +#include + +UID2 KUidAppRegistrationResourceFile +UID3 0x10281CAA + +RESOURCE APP_REGISTRATION_INFO + { + app_file="wlansniffer"; + localisable_resource_file = APP_RESOURCE_DIR"\\wlansniffer"; + localisable_resource_id = R_SNIFFER_LOCALISABLE_APP_INFO; + } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 file for project MainApplication +* +*/ + +#include + +PRJ_EXPORTS +// export localised loc file +../loc/wsfmainapplication.loc MW_LAYER_LOC_EXPORT_PATH(wsfmainapplication.loc) + +../rom/wsfmainapplication.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wsfmainapplication.iby) +../rom/wsfmainapplicationresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(wsfmainapplicationresources.iby) + + +PRJ_MMPFILES +mainapplication.mmp + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/group/mainapplication.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/group/mainapplication.mmp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 project MainApplication +* +*/ + +#include +#include + +CAPABILITY ReadDeviceData NetworkServices NetworkControl ProtServ \ + ReadUserData WriteDeviceData WriteUserData SwEvent + +TARGET wlansniffer.exe +TARGETTYPE exe +UID 0x100039CE 0x10281CAA + +EPOCSTACKSIZE 0x5000 + +SOURCEPATH ../src +SOURCE wsfentrypoint.cpp +SOURCE wsfapplication.cpp +SOURCE wsfmainview.cpp +SOURCE wsfappui.cpp +SOURCE wsfdocument.cpp + +SOURCE wsfactivewaiter.cpp +SOURCE wsfmaincontroller.cpp +SOURCE wsfmainviewcontroller.cpp +SOURCE wsfmainviewmodel.cpp +SOURCE wsfmainviewcontainer.cpp + +// Details View Sources +SOURCE wsfdetailsview.cpp +SOURCE wsfdetailscontainer.cpp +SOURCE wsfdetailsviewmodel.cpp +SOURCE wsfdetailsviewcontroller.cpp + +// Connected Details Popup Sources +SOURCE wsfconnecteddetailsdialog.cpp +SOURCE wsfconnecteddetailsmodel.cpp +SOURCE wsfconnecteddetailscontroller.cpp +SOURCE wsfactivetimeupdater.cpp + + +// own headers +USERINCLUDE ../inc + +// inner API +USERINCLUDE ../../inc + +// private API +USERINCLUDE ../../../inc + + +//Macro to /epoc32 headers +APP_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY bafl.lib +LIBRARY eikcore.lib +LIBRARY avkon.lib +LIBRARY eikcoctl.lib +LIBRARY eikctl.lib +LIBRARY egul.lib +LIBRARY aknicon.lib +LIBRARY eikdlg.lib +LIBRARY eikcdlg.lib +LIBRARY FeatMgr.lib +LIBRARY hlplch.lib +LIBRARY ConnMon.lib +LIBRARY aknskins.lib +LIBRARY commonengine.lib +LIBRARY cmmanager.lib +LIBRARY wlansettingsui.lib +LIBRARY charconv.lib +LIBRARY apgrfx.lib +LIBRARY commonui.lib + +LIBRARY wsfwlaninfo.lib +LIBRARY wsfwlaninfosorting.lib +LIBRARY wsfmodel.lib +LIBRARY connectionuiutilities.lib + +// Logger +DEBUGLIBRARY flogger.lib + +START RESOURCE ../data/wlansniffer.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +LANGUAGE_IDS +END + +START RESOURCE ../data/wlansniffer_reg.rss +DEPENDS wlansniffer.rsg +TARGETPATH /private/10003a3f/apps +END + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfactivetimerhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfactivetimerhandler.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for MWsfActiveTimerHandler +* +*/ + +#ifndef M_WSFACTIVETIMERHANDLER_H +#define M_WSFACTIVETIMERHANDLER_H + +/** + * Interface between details view controller and timer for active time update + */ +class MWsfActiveTimerHandler + { + + public: + + /** + * Updates the details view active time + */ + virtual void UpdateActiveTimeL() = 0; + }; + +#endif // M_WSFACTIVETIMERHANDLER_H + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfactivetimeupdater.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfactivetimeupdater.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfActiveTimeUpdater +* +*/ + +#ifndef C_WSFACTIVETIMEUPDATER_H +#define C_WSFACTIVETIMEUPDATER_H + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES + +// FORWARD DECLARATIONS +class MWsfActiveTimerHandler; + + +/** + * Responsible for time updating by using a customizable time interval. + * @since S60 v5.0 + */ +NONSHARABLE_CLASS( CWsfActiveTimeUpdater ) : public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor + * @since S60 5.0 + * @param aActiveTimerHandler interface details views controller + * @return instance of CWsfActiveTimeUpdater class + */ + static CWsfActiveTimeUpdater* NewL( + MWsfActiveTimerHandler* aActiveTimerHandler ); + + + /** + * Two-phased constructor. Leaves the object on CleanupStack + * @since S60 5.0 + * @param aActiveTimerHandler interface details views controller + * @return instance of CWsfActiveTimeUpdater class + */ + static CWsfActiveTimeUpdater* NewLC( + MWsfActiveTimerHandler* aActiveTimerHandler ); + + /** + * Destructor of CWsfActiveTimeUpdater class + * @since S60 5.0 + */ + ~CWsfActiveTimeUpdater(); + + private: // Constructors + + /** + * Default C++ constructor + * @since S60 5.0 + * @param aActiveTimerHandler interface details views controller + */ + CWsfActiveTimeUpdater( MWsfActiveTimerHandler* aActiveTimerHandler ); + + /** + * 2nd phase constructor + * @since S60 5.0 + */ + void ConstructL(); + + public: // New methods + + /** + * Start update timer + * @since S60 5.0 + * @param aUpdateInterval refresh time interval + */ + void Start( TInt aUpdateInterval ); + + /** + * Stop update timer + * @since S60 5.0 + */ + void Stop(); + + /** + * Called from static call back of CPeriodic. + * The actual update process starts here + * @since S60 5.0 + */ + void DoUpdateTimeL(); + + private: // New methods + /** + * Function to called when periodic timer releases + * @since S60 5.0 + * @param aUpdater pointer to this + */ + static TInt UpdateTimeL( TAny* aUpdater ); + + private: + + /** + * Pointer to the Active Timer handler interface + * Own. + */ + MWsfActiveTimerHandler* iActiveTimerHandler; + + /** + * Timer, to refresh the details views + * Own. + */ + CPeriodic* iPeriodic; + }; + +#endif // C_WSFACTIVETIMEUPDATER_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfactivewaiter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfactivewaiter.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,106 @@ +/* +* 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 CWsfActiveWaiter +* +*/ + + + +#ifndef __WSFMAINAPPLICATION_ACTIVE_WAITER_H__ +#define __WSFMAINAPPLICATION_ACTIVE_WAITER_H__ + +// INCLUDES +#include + +/** + * CWsfActiveWaiter class, + * an active object to replace User::WaitForRequest + * + * Usage: + * CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewL(); + * CleanupStack::PushL( waiter ); + * server.AsyncFunction( waiter->iStatus ); + * if ( waiter->WaitForRequest == KErrNone ) + * { + * // handle success + * } + * else + * { + * // handle failure + * } + * CleanupStack::PopAndDestroy( waiter ); + * + */ +NONSHARABLE_CLASS( CWsfActiveWaiter ) : public CActive + { + public: + + /** + * Two-phased constructor + * @since S60 5.0 + * @return instance of CWsfActiveWaiter class + */ + static CWsfActiveWaiter* NewL(); + + /** + * Destructor of CWsfActiveWaiter class + * @since S60 5.0 + */ + virtual ~CWsfActiveWaiter(); + + /** + * Waits for it's TRequestStatus to be completed + * @since S60 5.0 + * @return Error code returned from server after request is + * completed + */ + TInt WaitForRequest(); + + private: + + /** + * 2nd phase constructor + * @since S60 5.0 + */ + void ConstructL(); + + /** + * Default C++ constructor + * @since S60 5.0 + */ + CWsfActiveWaiter(); + + /** + * DoCancel from CActive + * @since S60 5.0 + */ + virtual void DoCancel(); + + /** + * RunL from CActive + * @since S60 5.0 + */ + virtual void RunL(); + + private: + + /** + * Used to make asynchronous call synchronous + */ + CActiveSchedulerWait iWait; + }; + +#endif // __WSFMAINAPPLICATION_ACTIVE_WAITER_H__ + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfapplication.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfapplication.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfApplication +* +*/ + + +#ifndef C_WSFAPPLICATION_H +#define C_WSFAPPLICATION_H + +#include + + +// CLASS DEFINITION +/** +* An instance of CWsfApplication is the application part of the +* AVKON application framework for the Sniffer example application +* +* @since S60 5.0 +* @lib wlansniffer.exe +*/ +NONSHARABLE_CLASS( CWsfApplication ): public CAknApplication + { + public: // from CAknApplication + + /** + * Returns the application DLL UID value + * @since S60 5.0 + * @return The UID of this Application/Dll + */ + TUid AppDllUid() const; + + protected: // from CAknApplication + /** + * Creates a CApaDocument object and return a pointer to it + * @since S60 5.0 + * @return A pointer to the created document + */ + CApaDocument* CreateDocumentL(); + }; + +#endif // C_WSFAPPLICATION_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfappui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfappui.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,292 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfAppUi +* +*/ + +#ifndef C_WSFAPPUI_H +#define C_WSFAPPUI_H + +#include +#include +#include + + +// FORWARD DECLARATIONS +class CWsfMainView; +class MWsfMainUiObserver; +class MWsfMainViewControllerIf; +class MWsfDetailsViewControllerIf; +class CAknWaitDialog; +class CWsfDocument; +class CWsfConnectedDetailsDialog; +class CWsfWlanInfoArray; + +/** + * 'AppUi' class. + * + * @since S60 v5.0 + * @lib wlansniffer.exe + */ +NONSHARABLE_CLASS( CWsfAppUi ): public CAknViewAppUi, + public MProgressDialogCallback + { + public: + + /** + * 2nd phase constructor + * @since S60 5.0 + */ + void ConstructL(); + + /** + * Default C++ constructor + * @since S60 5.0 + */ + CWsfAppUi(); + + /** + * Destructor of CWsfAppUi class + * @since S60 5.0 + */ + ~CWsfAppUi(); + + + public: // from CAknAppUi + /** + * Handle user menu selections + * @since S60 5.0 + * @param aCommand The enumerated code for the option selected + */ + void HandleCommandL( TInt aCommand ); + + /** + * Handles a change to the application's resources + * which are shared across the environment. + * @since S60 5.0 + * @param aType type of resources that have changed. + */ + void HandleResourceChangeL( TInt aType ); + + /** + * Handles changes in keyboard focus when an application switches to, + * or from, the foreground. + * @since S60 5.0 + * @param aForeground ETrue if the application is in the foreground, + * otherwise EFalse. + */ + void HandleForegroundEventL( TBool aForeground ); + + + public: + + /** + * Set an interface to the main controller for the AppUI. + * @since S60 5.0 + * @param aObserver Observer object + */ + void SetUiObserver( MWsfMainUiObserver* aObserver ); + + /** + * Activate the Details View + * @since S60 5.0 + * @param aDetailsViewId View ID of Details View + */ + void ActivateDetailsViewL( TUid aDetailsViewId ); + + /** + * Activate the Main View + * @since S60 5.0 + */ + void ActivateMainViewL(); + + /** + * Create the Main View + * @since S60 5.0 + * @return reference to the Main View's controller + */ + MWsfMainViewControllerIf& MainView(); + + /** + * Create the Details View + * @since S60 5.0 + * @return reference to the Details View's controller + */ + MWsfDetailsViewControllerIf& DetailsView( TInt aDetailsViewType ); + + /** + * Starts the wait note dialog + * @since S60 5.0 + * @param aVisibilityDelayOff set the visibility of the dialog + */ + void StartWaitNoteL( TBool aVisibilityDelayOff ); + + /** + * Dismiss the wait note dialog + * @since S60 5.0 + */ + void HideWaitNoteL(); + + /** + * Displays the Main View's menu bar. + * @since S60 5.0 + */ + void ShowMenuBarL(); + + /** + * Displays "No WLAN found" note. + * @since S60 5.0 + */ + void ShowNoWlansFoundInfoL(); + + /** + * Displays an error note. + * @since S60 5.0 + * @param aResourceId the text of the error note + */ + void ShowErrorNoteL( TInt aResourceId ); + + /** + * Displays a Global error note. + * @since S60 5.0 + * @param aError error ID + */ + void ShowGlobalErrorNoteL( TInt aError ); + + /** + * Returns a pointer to the CWsfDocument + * @since S60 5.0 + * @return pointer to the CWsfDocument + */ + CWsfDocument* Doc(); + + /** + * Returns CWlanSettingsUi is in foreground + * @since S60 5.0 + * @return ETrue if CWlanSettingsUi is in foreground + * EFalse if CWlanSettingsUi is in background + */ + TBool Foreground(); + + /** + * Starts the Connected Details View + * @since S60 5.0 + * @param aWlanArray pointer to the Wlan Info Array + * @param aSelectedWlanSsid string of the selected Wlan SSID + */ + void StartConnectedDetailsL( CWsfWlanInfoArray* aWlanArray, + const TDesC8& aSelectedWlanSsid ); + + /** + * Update content of the Connected Details View + * @since S60 5.0 + * @param aWlanArray pointer to the Wlan Info Array + */ + void UpdateConnectedDetailsL( CWsfWlanInfoArray* aWlanArray ); + + /** + * Returns the value of key event suppression flag + * @since S60 5.0 + * @return ETrue if key events are suppressed + */ + TBool SuppressingKeyEvents() const; + + /** + * Sets the value of key event suppression flag + * @since S60 5.0 + * @param aSuppressing The new value of the flag + */ + void SetSuppressingKeyEvents( TBool aSuppressing ); + + + protected: // from MProgressDialogCallback + + /** + * Callback function for MProgressDialogCallback + * @since S60 5.0 + * @param aButtonId the ID of the button that was activated + */ + void DialogDismissedL( TInt aButtonId ); + + + private: // new methods + + /** + * This function is used for querying whether the application + * is launched in embedded mode or not. + * @return ETrue: The application is launched in embedded mode. + * EFalse: The application is launched in standalone mode. + */ + TBool IsEmbedded() const; + + /** + * Callback for CIdle. + * @since S60 5.0 + * @param aObject pointer to this + * @return zero value means not be called again.(Stops timer) + */ + static TInt AppLaunchCompleteL( TAny* aObject ); + + + private: + + /** + * Reference to UI observer + * Not own. + */ + MWsfMainUiObserver* iObserver; + + /** + * Wait dialog + * Own. + */ + CAknWaitDialog* iWaitDialog; + + /** + * Connected details view dialog + * Own. + */ + CWsfConnectedDetailsDialog* iConnectedDetailsDialog; + + /** + * Used to launch wait dialog when application has been + * fully started and screen has been drawn + * Own. + */ + CIdle* iIdle; + + /* + * Used to check CWlanSettingsUi is in foreground + */ + TBool iForeground; + + /** + * indicates whether the launching has ended + */ + TBool iAppLaunchCompleted; + + /** + * Indicates Featuremanger is initialized or not. + */ + TBool iFeatureManagerInitialized; + + /** + * Indicates whether keypress events are suppressed + */ + TBool iSuppressingKeyEvents; + }; + + +#endif // C_WSFAPPUI_H + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailscontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailscontroller.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for TWsfConnectedDetailsController +* +*/ + +#ifndef T_WSFCONNECTEDDETAILSCONTROLLER_H +#define T_WSFCONNECTEDDETAILSCONTROLLER_H + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "wsfsession.h" +#include "wsfwlaninfo.h" +#include "wsfdetailsviewcontrollerif.h" +#include "wsfactivetimerhandler.h" + +// FORWARD DECLARATIONS +class CWsfConnectedDetailsModel; +class MWsfActiveTimerHandler; +class CWsfConnectedDetailsDialog; + +// CLASS DEFINITION +/** + * Details view controller + * + * @since S60 5.0 + * @lib wlansniffer.exe + */ +class TWsfConnectedDetailsController: public MWsfDetailsViewControllerIf, + public MWsfActiveTimerHandler + { + public: // New methods + + /** + * Dialog setter + * @since S60 5.0 + * @param aDialog Dialog pointer + */ + inline void SetDialog( CWsfConnectedDetailsDialog* aDialog ); + + /** + * Model setter + * @since S60 5.0 + * @param aModel Model pointer + */ + inline void SetModel( CWsfConnectedDetailsModel* aModel ); + + + public: //From MWsfDetailsViewControllerIf + + /** + * Set the Wlan array & selected item from main view to details view + * @since S60 5.0 + * @param aWlanArray - Current Wlan Array + * @param aSelectedWlanSsid - Selected Wlan from Main view + */ + void SetWlanListL( CWsfWlanInfoArray* aWlanArray, + const TDesC8& aSelectedWlanSsid ); + + /** + * Wlan array has been chaged eg. some wlan dropped or new found + * @since S60 5.0 + * @param aWlanArray - Current Wlan Array + */ + void WlanListChangedL( CWsfWlanInfoArray* aWlanArray ); + + /** + * Refresh -> draw current model to view + * @since S60 5.0 + */ + void RefreshL(); + + /** + * Sets partner object + * @since S60 5.0 + * @param aPartner The new partner object + */ + void SetPartner( MWsfDetailsViewPartner& aPartner ); + + + public: // From MWsfActiveTimerHandler + + /** + * Updates the details view active time + * @since S60 5.0 + */ + void UpdateActiveTimeL(); + + + private: // Data + + /** + * Details dialog model (not owned) + */ + CWsfConnectedDetailsModel* iModel; + + /** + * Details dialog (not owned) + */ + CWsfConnectedDetailsDialog* iDialog; + }; + + + +#include "wsfconnecteddetailscontroller.inl" + + + +#endif // T_WSFCONNECTEDDETAILSCONTROLLER_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailscontroller.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailscontroller.inl Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 for TWsfConnectedDetailsController +* +*/ + + + +// INLINE FUNCTIONS + +// --------------------------------------------------------------------------- +// TWsfConnectedDetailsController::SetDialog +// --------------------------------------------------------------------------- +// +void TWsfConnectedDetailsController::SetDialog( + CWsfConnectedDetailsDialog* aDialog ) + { + iDialog = aDialog; + } + +// --------------------------------------------------------------------------- +// void TWsfConnectedDetailsController::SetModel +// --------------------------------------------------------------------------- +// +void TWsfConnectedDetailsController::SetModel( + CWsfConnectedDetailsModel* aModel ) + { + iModel = aModel; + } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailsdialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailsdialog.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfConnectedDetailsDialog +* +*/ + +#ifndef C_WSFCONNECTEDDETAILSDIALOG_H +#define C_WSFCONNECTEDDETAILSDIALOG_H + + +// INCLUDES +#include + +// INTERNAL INCLUDES +#include "wsfconnecteddetailscontroller.h" + +// FORWARD DECLARATIONS +class CWsfConnectedDetailsModel; +class TWsfConnectedDetailsController; +class CWsfActiveTimeUpdater; + + +// CLASS DECLARATION + +/** +* CWsfConnectedDetailsDialog class. +* This class is used to display the Connected Details information +*/ +class CWsfConnectedDetailsDialog : public CAknListQueryDialog + { + public: // Constructors and destructor + + /** + * Two-phase construction. + */ + static CWsfConnectedDetailsDialog* NewL(); + + /** + * Two-phased constructor. + */ + static CWsfConnectedDetailsDialog* NewLC(); + + /** + * Destructor. + */ + virtual ~CWsfConnectedDetailsDialog(); + + private: + + /* + * Second-phase constructor. + */ + void ConstructL(); + + /** + * C++ default constructor. + * @param aSelectionIndexArray The items which are selected within + * the dialogs list box list. + */ + CWsfConnectedDetailsDialog( + CListBoxView::CSelectionIndexArray* aSelectionIndexArray ); + + public: // New functions + + /** + * Refresh the content list box of the dialog + * @param aItemTextArray - items to be show on listbox + */ + void UpdateListBox( MDesCArray* aItemTextArray ); + + /** + * Return controller interface + * @return controller interface + */ + MWsfDetailsViewControllerIf& Controller(); + + + /** + * Set list model of the dialog. + * @param aModel List model of the dialog + */ + void SetListModel( CWsfConnectedDetailsModel* aModel ); + + /** + * Super class method overriden to prevent dialog window to be + * shut down by pressing anywhere in the dialog (only pressing + * the OK button should close the dialog. + * @param aListBox - + * @param TListBoxEvent - + */ + void HandleListBoxEventL( CEikListBox* aListBox, + TListBoxEvent aEventType ); + + private: // from CEikDialog + + /** + * sets the default value to the dialog. + */ + void PreLayoutDynInitL(); + + private: // Data + + /** + * Reference for listbox + * Not own. + */ + CEikListBox* iList; + + /** + * Reference for list box model + * Not own. + */ + CTextListBoxModel* iModel; + + /* + * Connected Details Dilaog Controller + */ + TWsfConnectedDetailsController iController; + + /* + * Reference for the connected details model + * Not own. + */ + CWsfConnectedDetailsModel* iListModel; + + /* + * Reference for the time updater + * Own. + */ + CWsfActiveTimeUpdater* iActiveUpdater; + }; + +#endif // C_WSFCONNECTEDDETAILSDIALOG_H + +// End of File + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailsmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailsmodel.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,235 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfConnectedDetailsModel +* +*/ + + +#ifndef C_WSFCONNECTEDDETAILSMODEL_H +#define C_WSFCONNECTEDDETAILSMODEL_H + +//EXTERNAL INCLUDES +#include +#include +#include + +//INTERNAL INCLUDES + +//FORWARD DECLARATIONS +class CCoeEnv; +class CWsfWlanInfoArray; +class TWsfWlanInfo; + + +/** + * Details view Model + * + * Holds & formats TWsfWlanInfo for list box showable format + * + * @since S60 v5.0 + */ +class CWsfConnectedDetailsModel : public CBase + { + + public: // Constructors and destructor + + /** + * Two-phase construction. + */ + static CWsfConnectedDetailsModel* NewL(); + + /** + * Two-phased construction. + */ + static CWsfConnectedDetailsModel* NewLC(); + + /** + * Destructor. + */ + ~CWsfConnectedDetailsModel(); + + + public: // New methods + + /** + * Finds out the current WLAN connection id + * @since S60 5.0 + */ + void FindWlanConnectionL(); + + /** + * Formats Wlan info for showing + * + * @since S60 v5.0 + * @param aWlanInfo - selected Wlan info + * @param aWlanArray - Wlan info array + * @return formated text array + */ + CDesCArrayFlat* FormatWlanInfoL( TWsfWlanInfo* aWlanInfo, + CWsfWlanInfoArray* aWlanArray ); + + /** + * Refresh current Wlan info for showing + * + * @since S60 v5.0 + * @return refreshed text array + */ + CDesCArrayFlat* RefreshCurrentWlanInfoL(); + + /** + * Creates listbox items from header and value (formatter %S\t%S) + * @since S60 v5.0 + * @param aResourceId - id of loaded header string + * @param aValueText - string containing value data + * @return formated string + */ + HBufC* FormatListBoxItemLC( const TUint aResourceId, + const TDesC& aValueText ) const; + + /** + * Returns WLAN details that has already formatted + * @since S60 v5.0 + * @return Formatted WLAN details + */ + CDesCArrayFlat* GetWlanDetails(); + + /** + * Returns current Wlan Ssid + * @since S60 v5.0 + * @return Ssid + */ + const TDesC8& WlanSsid() const; + + private: + + /** + * C++ default constructor. + */ + CWsfConnectedDetailsModel(); + + /* + * Second-phase constructor. + */ + void ConstructL(); + + // New methods + + private: + /** + * Appends Wlan Ssid to + * iFormattedConnectedWlanInfo + * @since S60 v5.0 + */ + void FormatAndAppendConnectedWlanSsidL(); + + /** + * Appends duration of connection + * to iConnectedFormattedWlanInfo + * @since S60 v5.0 + */ + void FormatAndAppendDurationL(); + + /** + * Appends amount of transferred data + * to iConnectedFormattedWlanInfo + * @since S60 v5.0 + */ + void FormatAndAppendTransferredL(); + + /** + * Formats connection duration + * to string + * @since S60 v5.0 + * @return formated string + */ + HBufC* FormatDurationLC(); + + /** + * Formats amount of transferred + * data to string + * @since S60 v5.0 + * @return formated string + */ + HBufC* FormatTransferredLC(); + + /** + * Calculate number of visible (Not hidden) WLANs + * @since S60 v.5.0 + * @param aArray Array of WLAN passed as reference + * @return Number of visible WLANs + */ + TInt VisibleWlans( CWsfWlanInfoArray& aArray ); + + private: // Data + + /** + * Copy of showed Wlan info + */ + TWsfWlanInfo iWlanInfo; + + /** + * Formater Wlan info + * Own. + */ + CDesCArrayFlat* iFormattedWlanInfo; + + /** + * Time when connection started + */ + TTime iStartTime; + + /** + * True if the connection is still active + */ + TBool iIsConnActive; + + /** + * Duration of the connection + */ + TTimeIntervalMicroSeconds iDuration; + + /** + * Total number of bytes transmitted + */ + TUint iBytesTransmitted; + + /** + * The Connection Monitor + */ + RConnectionMonitor iConnectionMonitor; + + /** + * The Connection ID of the WLAN + */ + TInt iConnectionId; + + /** + * Coe env for loading string from resource + * Ref. + */ + CCoeEnv* iCoeEnv; + + /** + * Reference to Wlan array + * ref. + */ + CWsfWlanInfoArray* iWlanArray; + + /** + * Acts as a mutex for refreshing functions + */ + TBool iRefreshing; + }; + +#endif // C_WSFCONNECTEDDETAILSMODEL_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfdetailscontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailscontainer.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,249 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfDetailsContainer +* +*/ + +#ifndef C_WSFDETAILSCONTAINER_H +#define C_WSFDETAILSCONTAINER_H + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "wsfdetailscontainerif.h" + +// FORWARD DECLARATIONS +class CAknNavigationDecorator; +class CAknNavigationControlContainer; +class MWsfDetailsViewControllerPartner; +class CWsfDetailsViewModel; +class CWsfActiveTimeUpdater; +class MWsfActiveTimerHandler; + +// CLASS DECLARATION +/** +* CWsfDetailsContainer container control class. +* +* @since S60 5.0 +* @lib wlansniffer.exe +*/ +class CWsfDetailsContainer : public CCoeControl, + public MWsfDetailsContainerIf, + public MAknNaviDecoratorObserver + + { + public: // Constructors and destructor + + /** + * Two-phased constructor + * @since S60 5.0 + * @param aRect gives the correct TRect for construction. + * @param aController reference for the MWsfActiveTimerHandler + * @return instance of CWsfDetailsContainer class + */ + static CWsfDetailsContainer* NewL( + const TRect& aRect, + MWsfActiveTimerHandler& aController ); + + /** + * Two-phased constructor. Leaves the object on CleanupStack + * @since S60 5.0 + * @param aRect gives the correct TRect for construction. + * @param aController reference for the MWsfActiveTimerHandler + * @return instance of CWsfDetailsContainer class + */ + static CWsfDetailsContainer* NewLC( + const TRect& aRect, + MWsfActiveTimerHandler& aController ); + + /** + * Destructor of CWsfDetailsContainer class + * @since S60 5.0 + */ + ~CWsfDetailsContainer(); + + private: // Constructors and destructor + + /** + * Default C++ constructor + * @since S60 5.0 + */ + CWsfDetailsContainer(); + + /** + * 2nd phase constructor + * @since S60 5.0 + * @param aRect gives the correct TRect for construction. + * @param aController reference for the MWsfActiveTimerHandler + */ + void ConstructL( const TRect& aRect, + MWsfActiveTimerHandler& aController ); + + public: // New functions + + /** + * Set partner interface to container + * @param aPartner - partner interface + */ + void SetPartner( MWsfDetailsViewControllerPartner& aPartner ); + + /** + * Set Model to container + * @param aModel + */ + void SetDetailsModel( CWsfDetailsViewModel* aModel ); + + public: // from CCoeControl + + /** + * Handles key events. + * @since S60 5.0 + * @param aKeyEvent The key event + * @param aType The type of key event: EEventKey, EEventKeyUp or + * EEventKeyDown + * @return Indicates whether or not the key event was used + * by this control + */ + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ); + + /** + * Gets an indexed component of a compound control + * @since S60 5.0 + * @param aIndex The index of the control + * @return The component control with an index of aIndex + */ + CCoeControl* ComponentControl( TInt aIndex ) const; + + /** + * Handles a change to the control's resources. + * @since S60 5.0 + * @param aType A message UID value + */ + void HandleResourceChange( TInt aType ); + + + public: // From MWsfDetailsContainerIf + + /** + * Refresh the content of Navi pane and + * Push it to stack. + * @since S60 5.0 + * @param aPaneText Text to be show on pane + */ + void UpdateNaviPaneL( const TDesC& aPaneText ); + + /** + * Refresh the content list box + * @since S60 5.0 + * @param aItemTextArray Items to be show on listbox + */ + void UpdateListBoxL( MDesCArray* aItemTextArray ); + + + private: // Methods from CoeControl + + /** + * Responds to changes to the size and position of + * the contents of this control. + * @since S60 5.0 + */ + void SizeChanged(); + + /** + * Gets the number of controls contained in a compound control. + * @since S60 5.0 + * @return The number of component controls contained by this control + */ + TInt CountComponentControls() const; + + /** + * Responds to a change in focus + * @since S60 5.0 + * @param aDrawNow Contains the value that was passed to it + * by SetFocus(). + */ + void FocusChanged( TDrawNow aDrawNow ); + + + private: // From MAknNaviDecoratorObserver + + /** + * Handles events in the navipane + * @since S60 5.0 + * @param aEventID The id of the event + */ + void HandleNaviDecoratorEventL( TInt aEventID ); + + + private: // New methods + + /** + * Gets the title panes. + * @since S60 5.0 + */ + void GetPanesL(); + + /** + * Pop the NaviPane from stack. + * @since S60 5.0 + */ + void PopNaviPane(); + + + private: // data + + /** + * Listbox contains details a connection + * Own. + */ + CAknSingleHeadingStyleListBox* iListBox; + + /** + * Partner reference + * Ref. + */ + MWsfDetailsViewControllerPartner* iPartner; + + /** + * For NaviPane. + * Own. + */ + CAknNavigationDecorator* iNaviDecorator; + + /** + * For NaviPane. + * Ref. + */ + CAknNavigationControlContainer* iNaviPane; + + /** + * For CWsfDetailsViewModel. + * Ref. + */ + CWsfDetailsViewModel* iDetailsModel; + + /** + * For CWsfActiveTimeUpdater. + * Own. + */ + CWsfActiveTimeUpdater* iActiveUpdater; + }; + +#endif // C_WSFDETAILSCONTAINER_H + +// End of File + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfdetailscontainerif.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailscontainerif.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for MWsfDetailsContainerIf +* +*/ + +#ifndef M_WSFDETAILSCONTAINERIF_H +#define M_WSFDETAILSCONTAINERIF_H + +// EXTERNAL INCLUDES +#include + +// FORWARD DECLARATIONS +class MDesCArray; + +// CLASS DEFINITION +/** + * An interface to the Details view’s container for updating + * its listbox or navigation pane. + * @since S60 v5.0 + */ +class MWsfDetailsContainerIf + { + public: // Abstract methods + + /* + * Refresh the content list box. + * @param aItemTextArray - items to be show on listbox + */ + virtual void UpdateListBoxL( MDesCArray* aItemTextArray ) = 0; + + /** + * Refresh the content of Navi pane. + * @param aPaneText - text to be show on pane + */ + virtual void UpdateNaviPaneL( const TDesC& aPaneText ) = 0; + + }; + +#endif // M_WSFDETAILSCONTAINERIF_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsview.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,165 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfDetailsView +* +*/ + +#ifndef C_WSFDETAILSVIEW_H +#define C_WSFDETAILSVIEW_H + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "wsfdetailsviewcontrollerif.h" +#include "wsfdetailsviewcontroller.h" + +// FORWARD DECLARATIONS +class CWsfDetailsContainer; +class MDetailsViewPartner; +class CWsfDetailsViewModel; +class TWsfDetailsViewController; + +// CLASS DECLARATION +/** +* CWsfDetailsView view class. +*/ +class CWsfDetailsView : public CAknView, + public MEikListBoxObserver + { + + public: + + // Constructors and destructor + /** + * Two-phased constructor + * @since S60 5.0 + * @return instance of CWsfDetailsView class + */ + static CWsfDetailsView* NewL(); + + /** + * Two-phased constructor. Leaves the object on CleanupStack + * @since S60 5.0 + * @return instance of CWsfDetailsView class + */ + static CWsfDetailsView* NewLC(); + + /** + * Destructor of CWsfDetailsView class + * @since S60 5.0 + */ + ~CWsfDetailsView(); + + // Methods from CAknView + + /** + * Returns views id. + * @since S60 5.0 + * @return id for this view. + */ + TUid Id() const; + + /** + * Command handling function. + * @since S60 5.0 + * @param aCommand ID of the command to respond to. + */ + void HandleCommandL( TInt aCommand ); + + + // Methods from MEikListBoxObserver + + /** + * From MEikListBoxObserver. + * Handles listbox events. + * @since S60 5.0 + * @param aListBox listbox pointer. + * @param aEventType event type. + */ + void HandleListBoxEventL( CEikListBox* aListBox, + TListBoxEvent aEventType ); + + // New methods + + /** + * Return controller interface + * @since S60 5.0 + * @return controiller interface + */ + MWsfDetailsViewControllerIf& Controller(); + + + protected: + + // Functions from CAknView + + /** + * From CAknView. + * Called when view is activated. + * @since S60 5.0 + * @param aPrevViewId previous view id. + * @param aCustomMessageId custom message id. + * @param aCustomMessage custom message content. + */ + void DoActivateL( const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage ); + + /** + * From CAknView. + * Called when view is deactivated. + */ + void DoDeactivate(); + + private: // Constructors and destructor + + /** + * Default C++ constructor + * @since S60 5.0 + */ + CWsfDetailsView(); + + /** + * 2nd phase constructor + * @since S60 5.0 + */ + void ConstructL(); + + private: // Data + + /** + * Details view container + * Own. + */ + CWsfDetailsContainer* iContainer; + + /** + * Controller of Details view + * Own. + */ + TWsfDetailsViewController iController; + + /** + * Details view Model + * Own. + */ + CWsfDetailsViewModel* iModel; + + }; + +#endif // C_WSFDETAILSVIEW_H + +// End of File diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewcontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewcontroller.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,151 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for TWsfDetailsViewController +* +*/ + +#ifndef T_WSFDETAILSVIEWCONTROLLER_H +#define T_WSFDETAILSVIEWCONTROLLER_H + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "wsfsession.h" +#include "wsfwlaninfo.h" +#include "wsfdetailsviewcontrollerif.h" +#include "wsfdetailsviewcontrollerpartner.h" +#include "wsfactivetimerhandler.h" + +// FORWARD DECLARATIONS +class CWsfDetailsViewModel; +class MWsfDetailsContainerIf; +class MWsfDetailsViewPartner; +class MWsfActiveTimerHandler; + +// CLASS DEFINITION +/** + * Details view controller + * + * @since S60 5.0 + * @lib wlansniffer.exe + */ +class TWsfDetailsViewController : public MWsfDetailsViewControllerIf, + public MWsfDetailsViewControllerPartner, + public MWsfActiveTimerHandler + { + public: // New methods + + /** + * Model setter + * @since S60 5.0 + * @param aModel Model pointer + */ + void SetModel( CWsfDetailsViewModel* aModel ); + + /** + * container setter + * @since S60 5.0 + * @param aContainer Container pointer + */ + void SetContainer( MWsfDetailsContainerIf* aContainer ); + + + public: //From MWsfDetailsViewControllerIf + /** + * Set the Wlan array & selected item from main view to details view + * @since S60 5.0 + * @param aWlanArray Current Wlan Array + * @param aSelectedWlanSsid Selected Wlan from Main view + */ + void SetWlanListL( CWsfWlanInfoArray* aWlanArray, + const TDesC8& aSelectedWlanSsid ); + + /** + * Wlan array has been chaged eg. some wlan dropped or new found + * @since S60 5.0 + * @param aWlanArray Current Wlan Array + */ + void WlanListChangedL( CWsfWlanInfoArray* aWlanArray ); + + /** + * Refresh -> draw current model to view + * @since S60 5.0 + */ + void RefreshL(); + + /** + * Sets partner object + * @since S60 5.0 + * @param aPartner The new partner object + */ + void SetPartner( MWsfDetailsViewPartner& aPartner ); + + + public: //Method from MWsfDetailsViewControllerPartner + + /** + * Handles left key presses + * @since S60 5.0 + */ + void HandleLeftKeyPressedL(); + + /** + * Handles right key presses + * @since S60 5.0 + */ + void HandleRightKeyPressedL(); + + /** + * Handles selection key presses + * @since S60 5.0 + */ + void HandleSelectionKeyPressedL(); + + + public: // From MWsfActiveTimerHandler + + /** + * Updates the details view active time + * @since S60 5.0 + */ + void UpdateActiveTimeL(); + + + private: // New methods + + /** + * Handles pane text update on container + * @since S60 5.0 + */ + void HandlePaneTextUpdateL(); + + + private: // Data + + //Ref: details view model + CWsfDetailsViewModel* iModel; + + //Ref: details view container + MWsfDetailsContainerIf* iContainer; + + //Ref: Details view partner + MWsfDetailsViewPartner* iPartner; + + }; + +#endif // T_WSFDETAILSVIEWCONTROLLER_H + +// End of file + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewcontrollerif.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewcontrollerif.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for MWsfDetailsViewControllerIf +* +*/ + +#ifndef M_WSFDETAILSVIEWCONTROLLERIF_H +#define M_WSFDETAILSVIEWCONTROLLERIF_H + +// INCLUDES +#include + + +//FORWARD DECLARATIONS +class CWsfWlanInfoArray; +class MWsfDetailsViewPartner; + +/** + * Interface between app level controller and details view controller + */ +class MWsfDetailsViewControllerIf + { + + public: + + /** + * Set the Wlan array & selected item from main view to details view + * @since S60 5.0 + * @param aWlanArray Current Wlan Array + * @param aSelectedWlanSsid Selected Wlan from Main view + */ + virtual void SetWlanListL( CWsfWlanInfoArray* aWlanArray, + const TDesC8& aSelectedWlanSsid ) = 0; + + /** + * Wlan array has been chaged eg. some wlan dropped or new found + * @since S60 5.0 + * @param aWlanArray Current Wlan Array + */ + virtual void WlanListChangedL( CWsfWlanInfoArray* aWlanArray ) = 0; + + /** + * Refresh -> draw current model to view + * @since S60 5.0 + */ + virtual void RefreshL() = 0; + + /** + * Sets partner object + * @since S60 5.0 + * @param aPartner The current partner object + */ + virtual void SetPartner( MWsfDetailsViewPartner& aPartner ) = 0; + + }; + + +#endif // M_WSFDETAILSVIEWCONTROLLERIF_H + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewcontrollerpartner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewcontrollerpartner.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for MWsfDetailsViewControllerPartner +* +*/ + +#ifndef M_WSFDETAILSVIEWCONTROLLERPARTNER_H +#define M_WSFDETAILSVIEWCONTROLLERPARTNER_H + +/** + * An interface to the main controller for the Details view controller. + * + * @since S60 v5.0 + */ +class MWsfDetailsViewControllerPartner + { + public: + + /** + * Handles left key presses + * @since S60 5.0 + */ + virtual void HandleLeftKeyPressedL() = 0; + + /** + * Handles right key presses + * @since S60 5.0 + */ + virtual void HandleRightKeyPressedL() = 0; + + /** + * Handles selection key presses + * @since S60 5.0 + */ + virtual void HandleSelectionKeyPressedL() = 0; + + }; + +#endif // M_WSFDETAILSVIEWCONTROLLERPARTNER_H + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewmodel.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,282 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfDetailsViewModel +* +*/ + +#ifndef C_WSFDETAILSVIEWMODEL_H +#define C_WSFDETAILSVIEWMODEL_H + +//EXTERNAL INCLUDES +#include +#include + + +//INTERNAL INCLUDES +#include "wsfwlaninfo.h" + + +//FORWARD DECLARATIONS +class CCoeEnv; +class CWsfWlanInfoArray; + + +/** + * Details view Model + * + * Holds & formats TWlanInfo for list box showable format + * + * @lib Sniffer.app + * @since S60 v5.0 + */ +NONSHARABLE_CLASS( CWsfDetailsViewModel ): public CBase + { + + public: + + // Constructors and the C++ destructor + /** + * Two-phased constructor + * @since S60 5.0 + * @return instance of CWsfDetailsViewModel class + */ + IMPORT_C static CWsfDetailsViewModel* NewL(); + + /** + * Two-phased constructor. Leaves the object on CleanupStack + * @since S60 5.0 + * @return instance of CWsfDetailsViewModel class + */ + IMPORT_C static CWsfDetailsViewModel* NewLC(); + + /** + * Destructor of CWsfDetailsViewModel class + * @since S60 5.0 + */ + ~CWsfDetailsViewModel(); + + + // New methods + + /** + * Formats Wlan info for showing + * + * @since S60 v5.0 + * @param iWlanInfo - selected Wlan info + * @param aWlanArray - Wlan info array + * @return formated text array + */ + CDesCArrayFlat* FormatWlanInfoL( TWsfWlanInfo* aWlanInfo, + CWsfWlanInfoArray* aWlanArray ); + + /** + * Formats next Wlan info from array + * + * @since S60 v5.0 + * @return formated text array + */ + CDesCArrayFlat* FormatNextWlanInfoL(); + + /** + * Formats previous Wlan info from array + * + * @since S60 v5.0 + * @return formated text array + */ + CDesCArrayFlat* FormatPreviousWlanInfoL(); + + /** + * Formats text for pane to show + * + * @since S60 v5.0 + * @return formated text array + */ + HBufC* FormatPaneTextLC(); + + /** + * Formats Left Scroll Button for pane to show + * + * @return boolen (EFalse show the arrow, ETrue hide it) + */ + TBool FormatLeftScrollButton(); + + /** + * Formats Right Scroll Button for pane to show + * + * @return boolen (EFalse show the arrow, ETrue hide it) + */ + TBool FormatRightScrollButton(); + + /** + * Returns WLAN details that has already formatted + * @since S60 v5.0 + * @return Formatted WLAN details + */ + CDesCArrayFlat* GetWlanDetails(); + + /** + * Returns current Wlan Ssid + * @since S60 v5.0 + * @return Ssid + */ + const TDesC8& WlanSsid() const; + + private: + + // Constructors and the C++ destructor + + /** + * Default C++ constructor + * @since S60 5.0 + */ + CWsfDetailsViewModel(); + + /** + * 2nd phase constructor + * @since S60 5.0 + */ + void ConstructL(); + + // New methods + + /** + * Creates listbox items from header and value (formatter %S\t%S) + * @since S60 v5.0 + * @param aResourceId - id of loaded header string + * @param aValueText - string containing value data + * @return formated string + */ + HBufC* FormatListBoxItemLC( const TUint aResourceId, + const TDesC& aValueText ) const; + + /** + * Appends Wlan IAP Name to iFormattedWlanInfo + * @since S60 v5.0 + */ + void FormatAndAppenWlanIapNameL(); + + /** + * Appends Wlan Ssid to iFormattedWlanInfo + * @since S60 v5.0 + */ + void FormatAndAppenWlanSsidL(); + + /** + * Appends singnal strength to iFormattedWlanInfo + * @since S60 v5.0 + */ + void FormatAndAppenSingnalL(); + + /** + * Appends wlan mode to iFormattedWlanInfo + * @since S60 v5.0 + */ + void FormatAndAppenModeL(); + + /** + * Appends wlan security to iFormattedWlanInfo + * @since S60 v5.0 + */ + void FormatAndAppenSecurityL(); + + /** + * Appends wlan coverage to iFormattedWlanInfo + * @since S60 v5.0 + */ + void FormatAndAppenCoverageL(); + + /** + * Appends wlan speed to iFormattedWlanInfo + * @since S60 v5.0 + */ + void FormatAndAppenSpeedL(); + + /** + * Formats signal strenth to string + * @since S60 v5.0 + * @return formated string + */ + HBufC* FormatSingnalStrenghtLC(); + + /** + * Formats wlan mode to string + * @since S60 v5.0 + * @return formated string + */ + HBufC* FormatModeLC(); + + /** + * Formats wlan security to string + * @since S60 v5.0 + * @return formated string + */ + HBufC* FormatSecurityLC(); + + /** + * Formats wlan coverage to string + * @since S60 v5.0 + * @return formated string + */ + HBufC* FormatCoverageLC(); + + /** + * Formats wlan technology to string + * @since S60 v5.2 + * @return formated string + */ + HBufC* FormatTechnologyLC(); + + /** + * Calculate number of visible (Not hidden) WLANs + * @since S60 v.3.0 + * @param aArray Array of WLAN passed as reference + * @return Number of visible WLANs + */ + TInt VisibleWlans( CWsfWlanInfoArray& aArray ); + + private: // data + + /** + * Copy of showed Wlan info + * Own. + */ + TWsfWlanInfo iWlanInfo; + + /** + * Formater Wlan info + * Own. + */ + CDesCArrayFlat* iFormattedWlanInfo; + + /** + * Current List index; + * Own. + */ + TInt iIndex; + + /** + * Coe env for loading string from resource + * Ref. + */ + CCoeEnv* iCoeEnv; + + /** + * Reference to Wlan array + * ref. + */ + CWsfWlanInfoArray* iWlanArray; + + }; + +#endif // C_WSFDETAILSVIEWMODEL_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewpartner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewpartner.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for MWsfDetailsViewPartner +* +*/ + +#ifndef M_WSFDETAILSVIEWPARTNER_H +#define M_WSFDETAILSVIEWPARTNER_H + +// EXTERNAL INCLUDES +#include + +// CLASS DEFINITION +/** + * Details view's controller notifies application level controller + * throught this interface + * @since S60 5.0 + */ +class MWsfDetailsViewPartner + { + public: // Abstract methods + + /** + * Detailsview requests to close view + * @since S60 5.0 + */ + virtual void CloseDetailsViewL() = 0; + + /** + * Refresh scanning + */ + virtual void DetailsScanL() = 0; + }; + +#endif // M_WSFDETAILSVIEWPARTNER_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfdocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfdocument.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfDocument +* +*/ + +#ifndef C_WSFDOCUMENT_H +#define C_WSFDOCUMENT_H + +//External includes +#include + +//Internal includes +#include "wsfmaincontroller.h" + + +// Forward references +class CWsfAppUi; +class CEikApplication; +class CWsfModel; +class CWsfWlanInfoArrayVisitor; + + +/** + * The document class of the Symbian OS application’s architecture. + * + * @since S60 v5.0 + * @lib wlansniffer.exe + */ +NONSHARABLE_CLASS( CWsfDocument ) : public CAknDocument + { + public: + + /** + * Two-phased constructor + * @since S60 5.0 + * @param aApp application creating this document + * @return a pointer to the created instance of CWsfDocument + */ + static CWsfDocument* NewL( CEikApplication& aApp ); + + /** + * Two-phased constructor. Leaves the object on CleanupStack + * @since S60 5.0 + * @param aApp application creating this document + * @return a pointer to the created instance of CWsfDocument + */ + static CWsfDocument* NewLC( CEikApplication& aApp ); + + /** + * Destructor of CWsfDocument class + * @since S60 5.0 + */ + ~CWsfDocument(); + + public: + + /** + * The handle for iWlanInfoBranding + * (reference for CWsfWlanInfoArrayVisitor) + * @since S60 5.0 + * @return reference for CWsfWlanInfoArrayVisitor + */ + inline CWsfWlanInfoArrayVisitor& WlanInfoBranding() const; + + /** + * Returns a reference for the model (CWsfModel) + * @since S60 5.0 + * @return reference to CWsfModel + */ + inline CWsfModel& Model() const; + + public: // from CAknDocument + + /** + * From CAknDocument. + * Function to create the AppUi. + * + * @since S60 v5.0 + * @return the created AppUi instance + */ + CEikAppUi* CreateAppUiL(); + + + private: + + /** + * 2nd phase constructor + * @since S60 5.0 + */ + void ConstructL(); + + /** + * Default C++ constructor + * @since S60 5.0 + * @param aApp application creating this document + */ + CWsfDocument( CEikApplication& aApp ); + + private: + + /** + * Main Controller + */ + TWsfMainController iMainController; + + /** + * Model + * Own. + */ + CWsfModel* iModel; + + /** + * WlanInfoArrayVisitor + * Own. + */ + CWsfWlanInfoArrayVisitor *iWlanInfoBranding; + }; + + +#include "wsfdocument.inl" + + +#endif // C_WSFDOCUMENT_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfdocument.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfdocument.inl Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 for CWsfDocument +* +*/ + + + +// INLINE FUNCTIONS + +// --------------------------------------------------------------------------- +// CWsfDocument::Model +// --------------------------------------------------------------------------- +// +inline CWsfModel& CWsfDocument::Model() const + { + return *iModel; + } + + +// --------------------------------------------------------------------------- +// CWsfDocument::WlanInfoBranding +// --------------------------------------------------------------------------- +// +inline CWsfWlanInfoArrayVisitor& CWsfDocument::WlanInfoBranding() const + { + return *iWlanInfoBranding; + } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfmainapplication.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmainapplication.hrh Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource headers for project MainApplication +* +*/ + +#ifndef WSFMAINAPPLICATION_HRH +#define WSFMAINAPPLICATION_HRH + +/** Sniffer enumerate command codes */ +enum TWsfSnifferIds + { + ESnifferCmdStartBrowsing = 5000, + ESnifferCmdContinueBrowsing, + ESnifferCmdConnect, + ESnifferCmdDisconnect, + ESnifferCmdRefresh, + ESnifferCmdFilterWlans, + ESnifferCmdDetails, + ESnifferCmdSettings, + ESnifferCmdShowWlans + }; + +/** Dialog IDs */ +enum TWsfDialogIds + { + EWaitNoteSearchingWlans = 6000, + EWaitNoteConnecting + }; + +/** View IDs */ +enum TWsfViewIds + { + EMainViewId = 0x1000, + EDetailsViewId = 0x1001, + EConnectedDetailsViewId = 0x1002 + }; + + +#endif // WSFMAINAPPLICATION_HRH diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfmaincontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmaincontroller.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,332 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for TWsfMainController +* +*/ + +#ifndef T_WSFMAINCONTROLLER_H +#define T_WSFMAINCONTROLLER_H + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "wsfmainuiobserver.h" +#include "wsfmodelobserver.h" +#include "wsfmainviewpartner.h" +#include "wsfstatechangeobserver.h" +#include "wsfdetailsviewpartner.h" +#include "wsfwlaninfo.h" + + + +// FORWARD DECLARATIONS +class CWsfAppUi; +class CWsfModel; +class MWsfMainViewControllerIf; +class MWsfDetailsViewControllerIf; +class CWsfWlanInfoArray; +class CWsfWlanInfoArrayVisitor; + +// CLASS DEFINITION +/** + * The main control class of the component. It is responsible for all + * the WLAN related functionalities. + * @since S60 v5.0 + */ +class TWsfMainController: public MWsfMainUiObserver, + public MWsfModelObserver, + public MWsfMainViewPartner, + public MWsfDetailsViewPartner, + public MWsfStateChangeObserver + { + public: // New methods + + /** + * PreInitialization for this class + * @since S60 5.0 + * @param aAppUi reference for the AppUI + * @param aModel reference for the Model + * @param aWlanInfoBranding reference for the WlanInfoArrayVisitor + */ + void Initialize( CWsfAppUi& aAppUi, + CWsfModel& aModel, + CWsfWlanInfoArrayVisitor& aWlanInfoBranding ); + + /** + * Updating the active View + * @since S60 5.0 + */ + void UpdateViewL(); + + /** + * Updating the active View + * @since S60 5.0 + * @param aInfoArray - Current Wlan Array + */ + void UpdateViewL( CWsfWlanInfoArray* aInfoArray ); + + public: //From MWsfMainUiObserver + + /** + * Activate (Switch back to) the Main View + * @since S60 5.0 + */ + void ShowWlanListL(); + + /** + * Incialize Main View + * @since S60 5.0 + */ + void MainViewCreatedL(); + + /** + * Sarts the Borwser + * @since S60 5.0 + */ + void StartBrowsingL(); + + /** + * Continues browsing (browser launched if needed) + * @since S60 5.0 + */ + void ContinueBrowsingL(); + + /** + * Connect to an IAP and create a WLAN connection + * @since S60 5.0 + */ + void ConnectL(); + + /** + * Disconnect a connection + * @since S60 5.0 + */ + void DisconnectL(); + + /** + * Start a refresh scanning + * @since S60 5.0 + */ + void RefreshL(); + + /** + * Start to display the diteils view of the selected connection + * @since S60 5.0 + */ + void ShowDetailsL(); + + /** + * Create an Access Point + * @since S60 5.0 + */ + void CreateAccessPointL(); + + /** + * Used in AppUi side to check if the + * wait dialog should be shown + * @since S60 5.0 + * @return ETrue if first refreshing + */ + TBool EngineRefreshing(); + + /** + * Callback function, when the Sniffer started + * @since S60 5.0 + */ + void AppLaunchCompleteL(); + + /** + * Enable Scanning + * @since S60 5.0 + */ + void AppSwitchedForegroundL(); + + /** + * Disable Scanning + * @since S60 5.0 + */ + void AppSwitchedBackgroundL(); + + /** + * Displays the "Filter out Wlan" dialog + * @since S60 5.0 + */ + void EditBlackListItemsL(); + + + public: //From MWsfModelObserver + + /** + * Called if the launch has been completed successfully + * @since S60 5.0 + */ + void BrowserLaunchCompleteL(); + + /** + * Called if the browser launch failed for some reason + * @since S60 5.0 + * @param aError error code + */ + void BrowserLaunchFailed( TInt aError ); + + /** + * Called when the previously launched browser exits + * @since S60 5.0 + */ + void BrowserExitL(); + + /** + * Notification that connection is going to be created + * @since S60 5.0 + * @param aIapId The IAP id of the connection being created + */ + void ConnectingL( TUint32 aIapId ); + + /** + * Notification that the connection creation process ended + * @since S60 5.0 + * @param aResult The result of the connection creation + */ + void ConnectingFinishedL( TInt aResult ); + + + public: //From MWsfMainViewPartner + + /** + * Mainview request to show manubar + * @since S60 5.0 + */ + void ShowMenuBarL(); + + public: //From MWsfDetailsViewPartner + + /** + * Detailsview requests to close view + * @since S60 5.0 + */ + void CloseDetailsViewL(); + + /** + * Refresh scanning + */ + void DetailsScanL(); + + public: // From MWsfStateChangeObserver + + /** + * The current wlan data has changed and it is ready to be retrieved + * @since S60 5.0 + */ + void WlanListChangedL(); + + /** + * Engine error occured + * @since S60 5.0 + * @param aError System wide error code + */ + void NotifyEngineError( TInt aError ); + + /** + * Scanning has been disabled + * @since S60 5.0 + */ + void ScanDisabledL(); + + /** + * Scanning has been enabled + * @since S60 5.0 + */ + void ScanEnabledL(); + + /** + * A WLAN connection has been established + * @since S60 5.0 + */ + void WlanConnectionActivatedL(); + + /** + * A WLAN connection has been closed + * @since S60 5.0 + */ + void WlanConnectionClosedL(); + + /** + * Connection creation process finished + * @since S60 5.2 + * @param aError System wide error code + */ + void ConnectionCreationProcessFinishedL( TInt aError ); + + private: + + /** + * Cleanup function to release the key events suppressing + * @since S60 5.0 + * @param aPtr Pointer for this class + */ + static void ReleaseSuppressingKeyEvents( TAny* aPtr ); + + /** + * Cleanup function to restore refresh state + * @since S60 5.2 + * @param aPtr Pointer for this class + */ + static void RestoreRefreshState( TAny* aPtr ); + + /** + * Updates iap id to wlan list + * @since S60 5.2 + * @param aInfo reference of TWsfWlanInfo class + */ + void UpdateIapIdToInfoArrayL( TWsfWlanInfo & aInfo ); + + private: // Data + + /** + * Reference to AppUi + */ + CWsfAppUi* iAppUi; + + /** + * Reference to Model + */ + CWsfModel* iModel; + + /** + * Reference to Main View + */ + MWsfMainViewControllerIf* iMainView; + + /** + * Reference to WlanInfoArrayVisitor + */ + CWsfWlanInfoArrayVisitor* iWlanInfoBranding; + + /** + * Reference to Deatils View + */ + MWsfDetailsViewControllerIf* iDetailsView; + + /** + * Reference to WlanInfoArray + */ + CWsfWlanInfoArray* iInfoArray; + + }; + + +#endif // T_WSFMAINCONTROLLER_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfmainuiobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmainuiobserver.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,118 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for MWsfMainUiObserver +* +*/ + +#ifndef M_WSFMAINUIOBSERVER_H +#define M_WSFMAINUIOBSERVER_H + +// EXTERNAL INCLUDES +#include + + +// CLASS DEFINITION +/** + * An interface to the main controller for the AppUI. + * + * @since S60 v5.0 + */ +class MWsfMainUiObserver + { + public: // Abstract methods + + /** + * Called when the main view has been created. + * @since S60 5.0 + */ + virtual void MainViewCreatedL() = 0; + + /** + * Brings the main wlan list to the foreground + * @since S60 5.0 + */ + virtual void ShowWlanListL() = 0; + + /** + * Issues a refresh on the wlan list + * @since S60 5.0 + */ + virtual void RefreshL() = 0; + + /** + * Invokes the details view + * @since S60 5.0 + */ + virtual void ShowDetailsL() = 0; + + /** + * Starts the browser with the currently selected wlan + * @since S60 5.0 + */ + virtual void StartBrowsingL() = 0; + + /** + * Continues browsing with the currently selected wlan + * @since S60 5.0 + */ + virtual void ContinueBrowsingL() = 0; + + /** + * Connects to the currently selected wlan + * @since S60 5.0 + */ + virtual void ConnectL() = 0; + + /** + * Disconnects the currently selected wlan + * @since S60 5.0 + */ + virtual void DisconnectL() = 0; + + /** + * Called when the application has completely started + * @since S60 5.0 + */ + virtual void AppLaunchCompleteL() = 0; + + /** + * Called when the application is brought to the foreground + * @since S60 5.0 + */ + virtual void AppSwitchedForegroundL() = 0; + + /** + * Called when the application is sent to the background + * @since S60 5.0 + */ + virtual void AppSwitchedBackgroundL() = 0; + + /** + * Invokes the wlan list filtering dialog + * @since S60 5.0 + */ + virtual void EditBlackListItemsL() = 0; + + /** + * Queries whether the engine is refreshing + * @since S60 5.0 + * @return ETrue if the engine is refreshing, EFalse otherwise + */ + virtual TBool EngineRefreshing() = 0; + + }; + +#endif // M_WSFMAINUIOBSERVER_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfmainview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmainview.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,210 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfMainView +* +*/ + +#ifndef C_WSFMAINVIEW_H +#define C_WSFMAINVIEW_H + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "wsfmainviewcontroller.h" + +// FORWARD DECLARATIONS +class CWsfMainViewContainer; +class CWsfMainViewModel; + + + +// CLASS DEFINITION +/** + * The view class of the Main view. + * @since S60 5.0 + */ +NONSHARABLE_CLASS( CWsfMainView ): public CAknView, + public MEikListBoxObserver + { + public: + + /** + * Two-phased constructor + * @since S60 5.0 + * @param aIsEmbedded check application started + * as an embedded application + * @return instance of CWsfMainView class + */ + static CWsfMainView* NewL( TBool aIsEmbedded ); + + /** + * Two-phased constructor. Leaves the object on CleanupStack + * @since S60 5.0 + * @param aIsEmbedded check application started + * as an embedded application + * @return instance of CWsfMainView class + */ + static CWsfMainView* NewLC( TBool aIsEmbedded ); + + + /** + * Destructor of CWsfMainView class + * @since S60 5.0 + */ + ~CWsfMainView(); + + private: + + /** + * 2nd phase constructor + * @since S60 5.0 + */ + void ConstructL( TBool aIsEmbedded ); + + /** + * Default C++ constructor + * @since S60 5.0 + */ + CWsfMainView(); + + + public: //From CAknView + + /** + * From CAknView returns Uid of View + * @since S60 5.0 + * @return TUid uid of the view + */ + TUid Id() const; + + /** + * From MEikMenuObserver delegate commands from the menu + * @since S60 5.0 + * @param aCommand a command emitted by the menu + */ + void HandleCommandL( TInt aCommand ); + + /** + * From CAknView reaction if size change + * @since S60 5.0 + */ + void HandleClientRectChange(); + + + private: //From CAknView + + /** + * From CAknView activate the view + * @since S60 5.0 + * @param aPrevViewId + * @param aCustomMessageId + * @param aCustomMessage + */ + void DoActivateL( const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage ); + + /** + * From CAknView deactivate the view (free resources) + * @since S60 5.0 + */ + void DoDeactivate(); + + private: // from MEikMenuObserver + + /** + * From MEikCommandObserver + * Control the menu pane commands + * @since S60 5.0 + * @param aResourceId resource id of the menu pane to be modified + * @param aMenuPane pointer to menu pane to be modified + */ + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + + protected: + /** + * From MEikListBoxObserver. + * Handles listbox events. + * @since S60 5.0 + * @param aListBox listbox pointer. + * @param aEventType event type. + */ + void HandleListBoxEventL( CEikListBox* aListBox, + TListBoxEvent aEventType ); + + public: //New functions + + /** + * Return controller interface + * @since S60 5.0 + * @return controiller interface + */ + MWsfMainViewControllerIf& Controller(); + + /** + * Sets the iSelectionKey True + * @since S60 5.0 + */ + void SelectionKeyPressed(); + + /** + * Checks if Browser is using the active WLAN connection + */ + void UpdateBrowserUsageInfoL(); + + private: //New functions + + /** + * Check if the Browser application is already running and + * using the selected connection. + * @since S60 5.0 + * @return IapId that browser is using + */ + TInt BrowserIapIdL(); + + private: + + /** + * Main view's controller + */ + TWsfMainViewController iController; + + /** + * Main view's container + * Own. + */ + CWsfMainViewContainer* iContainer; + + /** + * Main view's model + * Own. + */ + CWsfMainViewModel* iModel; + + /** + * Indicates FSelectionKey is pressed or not. + */ + TBool iSelectionKey; + + /** + * IapId that browser is using + */ + TInt iBrowserIapId; + + }; + + +#endif // C_WSFMAINVIEW_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontainer.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,325 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfMainViewContainer +* +*/ + +#ifndef C_WSFMAINVIEWCONTAINER_H +#define C_WSFMAINVIEWCONTAINER_H + +// EXTERNAL INCLUDES +#include +#include +#include + +// FORWARD DECLARATIONS +class CAknDoubleGraphicStyleListBox; +class MWsfMainViewControllerPartner; +class CAknNavigationDecorator; +class CAknNavigationControlContainer; +class CWsfMainView; + +// CLASS DEFINITION +/** + * The container of the Main view. + * @since S60 v5.0 + */ +class CWsfMainViewContainer : public CCoeControl + { + public: // Constructors and destructor + + /** + * Two-phased constructor + * @since S60 5.0 + * @param aRect gives the correct TRect for construction. + * @return instance of CWsfMainViewContainer class + */ + static CWsfMainViewContainer* NewL( const TRect& aRect, + CWsfMainView* aParentView ); + + /** + * Two-phased constructor. Leaves the object on CleanupStack + * @since S60 5.0 + * @param aRect gives the correct TRect for construction. + * @return instance of CWsfMainViewContainer class + */ + static CWsfMainViewContainer* NewLC( const TRect& aRect, + CWsfMainView* aParentView ); + + /** + * Destructor of CWsfMainViewContainer class + * @since S60 5.0 + */ + ~CWsfMainViewContainer(); + + private: // Constructors + + /** + * Default C++ constructor + * @since S60 5.0 + */ + CWsfMainViewContainer(); + + /** + * 2nd phase constructor + * @since S60 5.0 + * @param aRect gives the correct TRect for construction. + */ + void ConstructL( const TRect& aRect, CWsfMainView* aParentView ); + + public: // New methods + + /** + * Update the contents of control + * Set the focus on aCurrentImte + * @param aItemTextArray text of the current item + * @param aCurrentItem index of the current item + */ + void UpdateHotSpotsL( MDesCArray* aItemTextArray, + TInt aCurrentItem ); + + /** + * Gives back the index of the selected item + * @return the index of the selected item + */ + TInt SelectedItem(); + + /** + * Set partner interface to container + * @param aPartner - partner interface + */ + void SetPartner( MWsfMainViewControllerPartner& aPartner ); + + /** + * Refresh the content of Navi pane and + * Push it to stack. + * @param aPaneText - text to be show on pane + */ + void UpdateNaviPaneL( const TDesC& aPaneText ); + + /** + * Returns pointer to the listbox. + * @return pointer to the listbox. + */ + CAknDoubleGraphicStyleListBox* ListBox() const; + + protected: // Functions from CoeControl + + /** + * From CCoeControl. + * Responds to changes to the size and position of the contents + * of this control. + */ + void SizeChanged(); + + /** + * From CCoeControl. + * Gets the number of controls contained in a compound control. + * @return the number of controls this component contains. + */ + TInt CountComponentControls() const; + + /** + * From CCoeControl. + * Gets an indexed component of a compound control. + * @return The required component control. + */ + CCoeControl* ComponentControl( TInt aIndex ) const; + + /** + * From CCoeControl. + * Handles key events. + * @param aKeyEvent key event. + * @param aType type of key event. + */ + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ); + + /** + * From CCoeControl, + * used for sclable ui and landscape support. + * Handles a change to the control's resources. + * @param aType type of change. + */ + void HandleResourceChange( TInt aType ); + + /** + * From CCoeControl. + * Returns the help context + * @param aContext the returned help context + */ + void GetHelpContext( TCoeHelpContext& aContext ) const; + + + private: // New methods + + /** + * Create the iconarray. Derived classes please don't forget that the + * 0th icon must be the markable listbox's mark icon. + * @return The created iconarray. Owner is the caller. + */ + CAknIconArray* LoadGraphicsL(); + + /** + * Creates a new icon of desired type. + * @param aIconId UID Icon type UID of the icon to be created. + * @return Pointer of the icon. + */ + CGulIcon* LoadIconLC( TInt aIconId ); + + /** + * Creates a new icon of desired type. + * @param aIconId UID Icon type UID of the icon to be created. + * @return Pointer of the icon. + */ + CGulIcon* LoadBlackIconLC( TInt aIconId ); + + /** + * Creates a new icon of desired type. + * @param aAknItemId An Akvon skin item ID of the graphical item + * (e.g. an icon) to load. + * @param aIconId UID Icon type UID of the icon to be created. + * @return Pointer of the icon. + */ + CGulIcon* LoadSkinnableIconLC( const TAknsItemID aAknItemId, + const TInt aIconId ); + + /** + * Creates a new icon of desired type. + * @param aAknItemId An Akvon skin item ID of the graphical item + * (e.g. an icon) to load. + * @param aIconId UID Icon type UID of the icon to be created. + * @return Pointer of the icon. + */ + CGulIcon* LoadSkinnableBlackIconLC( const TAknsItemID aAknItemId, + const TInt aIconId ); + + /** + * CleanUp for NaviPane + */ + void PopNaviPane(); + + /** + * Get the Navipane from the framework + */ + void GetPanesL(); + + /** + * Set the icons for the ListBox + */ + void SetListboxIconsL(); + + /** + * Cleanup function for a flat pointer array + * @since S60 5.0 + * @param aArray The array whose elements are to be cleaned up + */ + static void CleanUpResetAndDestroy( TAny* aArray ); + + /* + * Parses the string into ui component data + * @param aString - a string into ui + * @return - TBool - ETrue if connecting is found + */ + TBool ParseStringForAnimationL( TDes& aString ); + + /** + * Set connecting status on. + */ + void StartConnectingAnimationL(); + + /** + * Set connecting status off. + */ + void StopConnectingAnimation(); + + /** + * Steps the connecting animation + * @param ptr Pointer to an instance of this class + */ + static TInt DoConnectingAnimationStepL( TAny* ptr ); + + /** + * Steps the connecting animation + */ + void DoConnectingAnimationStepL(); + + /** + * Initialize the connecting animation + */ + void InitializeConnectingAnimation(); + + /* + * Step the animation + */ + void AnimateConnecting(); + + private: // Data + + /* + * Pointer to the listbox + */ + CAknDoubleGraphicStyleListBox* iListBox; + + /** + * Partner reference + * Ref. + */ + MWsfMainViewControllerPartner* iPartner; + + /** + * NaviDecorator pointer for NaviPane. + * Own. + */ + CAknNavigationDecorator* iNaviDecorator; + + /** + * NaviDecorator's default control pointer For NaviPane. + * Ref. + */ + CAknNavigationControlContainer* iNaviPane; + + /** + * List of animation states of connecting icon + */ + TFixedArray iConnectingIcons; + + /** + * The connecting animation frame index + */ + TInt iConnectingIndex; + + /** + * The periodic that steps the animation + */ + CPeriodic* iAnimationPeriodic; + + /** + * Constants for 'Connecting' text + * Own. + */ + HBufC* iStatusConnecting; + + /** + * Reference to the parent view + */ + CWsfMainView* iParentView; + + }; + + + +#endif // C_WSFMAINVIEWCONTAINER_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontroller.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,166 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for TWsfMainViewController +* +*/ + +#ifndef T_WSFMAINVIEWCONTROLLER_H +#define T_WSFMAINVIEWCONTROLLER_H + +// EXTERNAL INCLUDES +#include + + +// INTERNAL INCLUDES +#include "wsfsession.h" +#include "wsfwlaninfo.h" +#include "wsfmainviewcontrollerif.h" +#include "wsfmainviewpartner.h" +#include "wsfmainviewcontrollerpartner.h" + + +// FORWARD DECLARATIONS +class CWsfMainViewModel; +class CWsfMainViewContainer; +class CWsfWlanInfoArray; +class MWsfMainViewPartner; + +// CLASS DEFINITION +/** + * TWsfMainViewController acts as a view level controller + * @since S60 5.0 + */ +class TWsfMainViewController : public MWsfMainViewControllerIf, + public MWsfMainViewControllerPartner + { + + public: // New methods + + + /** + * Set view level model + * @since S60 5.0 + * @param aModel - model pointer + */ + void SetModel( CWsfMainViewModel* aModel ); + + /** + * Set view level view + * @param aContainer - container pointer + */ + void SetContainer( CWsfMainViewContainer* aContainer ); + + /** + * Updates available WLAN list to the display + * @param aWlanList - Current Wlan Array + */ + void UpdateHotSpotsL( CWsfWlanInfoArray* aWlanList ); + + /** + * Updates the local copy of the selected wlaninfo + * @since S60 5.0 + */ + void UpdateSelectedItemL(); + + + public: //From MWsfMainViewControllerIf + + /** + * Updates WLAN list with values passed as parameter + * @param aWlanArray list of WLAN + * @since S60 5.0 + */ + void UpdateWlanListL( CWsfWlanInfoArray* aWlanArray ); + + /** + * Updates WLAN list with values passed as parameter + * when the main view is on the background + * @param aWlanArray list of WLAN + * @since S60 5.2 + */ + void UpdateWlanListInBackgroundL ( CWsfWlanInfoArray* aWlanArray ); + + /** + * Request to refresh the mainview + * @since S60 5.0 + */ + void RefreshL(); + + /** + * Request to refresh the mainview + * @return Details of selected WLAN + * @since S60 5.0 + */ + TWsfWlanInfo* SelectedItem(); + + /** + * Sets partner object + * @aPartner The partner + * @since S60 5.0 + */ + void SetPartner( MWsfMainViewPartner& aPartner ); + + + public: //MWsfMainViewControllerPartner + + /** + * Handles up key presses + * @since S60 5.0 + */ + void HandleUpKeyPressedL(); + + /** + * Handles down key presses + * @since S60 5.0 + */ + void HandleDownKeyPressedL(); + + /** + * Handles selection key presses + * @since S60 5.0 + */ + void HandleSelectionKeyPressedL(); + + private: + + /** + * Updated navipane + */ + void UpdateNaviPaneL(); + + + private: // Data + + //Ref: View level model + CWsfMainViewModel* iModel; + + //Ref: View level view + CWsfMainViewContainer* iContainer; + + //Ref: Partner + MWsfMainViewPartner* iPartner; + + // Temporary storage for the current wlaninfo + TWsfWlanInfo iSelectedItem; + + // Indicates whether a real wlaninfo is selected + TBool iValidItem; + }; + +// INLINE FUNCTIONS + +#endif // T_WSFMAINVIEWCONTROLLER_H + +// End of file + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontrollerif.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontrollerif.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for MWsfMainViewControllerIf +* +*/ + +#ifndef M_WSFMAINVIEWCONTROLLERIF_H +#define M_WSFMAINVIEWCONTROLLERIF_H + + +#include + +//Forward declarations +class CWsfWlanInfoArray; +class TWsfWlanInfo; +class MWsfMainViewPartner; + +/** + * Mainview controlling interface (Internal) + * + * @lib Sniffer.exe + * @since S60 v5.0 + */ +class MWsfMainViewControllerIf + { + public: + + /** + * Updates WLAN list with values passed as parameter + * @param aWlanArray list of WLAN + * @since S60 5.0 + */ + virtual void UpdateWlanListL( CWsfWlanInfoArray* aWlanArray ) = 0; + + /** + * Updates WLAN list with values passed as parameter + * when the main view is in the background + * @param aWlanArray list of WLAN + * @since S60 5.2 + */ + virtual void UpdateWlanListInBackgroundL( + CWsfWlanInfoArray* aWlanArray ) = 0; + + /** + * Request to refresh the mainview + * @since S60 5.0 + */ + virtual void RefreshL( ) = 0; + + /** + * Request to refresh the mainview + * @return Details of selected WLAN + * @since S60 5.0 + */ + virtual TWsfWlanInfo* SelectedItem() = 0; + + /** + * Sets partner object + * @aPartner The partner + * @since S60 5.0 + */ + virtual void SetPartner( MWsfMainViewPartner& aPartner ) = 0; + }; + + +#endif // M_WSFMAINVIEWCONTROLLERIF_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontrollerpartner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontrollerpartner.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for MWsfMainViewControllerPartner +* +*/ + +#ifndef M_WSFMAINVIEWCONTROLLERPARTNER_H +#define M_WSFMAINVIEWCONTROLLERPARTNER_H + +/** + * An interface to the Main view controller for the Main view container. + * @since S60 v5.0 + */ +class MWsfMainViewControllerPartner + { + public: + + /** + * Handles up key presses + * @since S60 5.0 + */ + virtual void HandleUpKeyPressedL() = 0; + + /** + * Handles down key presses + * @since S60 5.0 + */ + virtual void HandleDownKeyPressedL() = 0; + + /** + * Handles selection key presses + * @since S60 5.0 + */ + virtual void HandleSelectionKeyPressedL() = 0; + }; + +#endif // M_WSFMAINVIEWCONTROLLERPARTNER_H + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewinternals.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewinternals.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MainView internals +* +*/ + +#ifndef WSFMAINVIEWINTERNALS_H +#define WSFMAINVIEWINTERNALS_H + +//Constants +/** Icon ID constants */ + +//Animation Icons +const TInt KWlanOnIcon = 0; +const TInt KWlanOnIcon_0 = 1; +const TInt KWlanOnIcon_1 = 2; + +const TInt KSecureNetworkIcon = 3; +const TInt KNoSignalIcon = 4; +const TInt KPoorSignal = 5; +const TInt KAverageSignal = 6; +const TInt KExcelentSignal = 7; +const TInt KConnectedNWIcon = 8; +const TInt KKnownNWIcon = 9; +const TInt KTransparentIcon = 10; + +#endif // WSFMAINVIEWINTERNALS_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewmodel.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,190 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfMainViewModel +* +*/ + +#ifndef C_WSFMAINVIEWMODEL_H +#define C_WSFMAINVIEWMODEL_H + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include "wsfwlaninfo.h" + + + +// FORWARD DECLARATIONS +class CWsfWlanInfoArray; +class CCoeEnv; + +// CLASS DEFINITION +/** + * View (Main view) level model. + * + * @since S60 5.0 + * @lib wlansniffer.exe + */ +NONSHARABLE_CLASS( CWsfMainViewModel ): public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor + * @since S60 5.0 + * @return instance of CWsfMainViewModel class + */ + static CWsfMainViewModel* NewL(); + + /** + * Two-phased constructor. Leaves the object on CleanupStack + * @since S60 5.0 + * @return instance of CWsfMainViewModel class + */ + static CWsfMainViewModel* NewLC(); + + /** + * Destructor of CWsfMainViewModel class + * @since S60 5.0 + */ + ~CWsfMainViewModel(); + + private: // Constructors + + /** + * Default C++ constructor + * @since S60 5.0 + */ + CWsfMainViewModel(); + + /** + * 2nd phase constructor + * @since S60 5.0 + */ + void ConstructL(); + + public: // New methods + + /** + * Creates array for the listbox. + * @param Array of WLAN that will be formatted. + */ + void FormatWlanListL( CWsfWlanInfoArray* aWlanList ); + + /* + * Returns WLAN list that has already formatted + * @return Formatted WLAN list + */ + CDesCArrayFlat* GetWlanList(); + + /** + * + * @return non-formatted WLAN list + */ + CWsfWlanInfoArray* GetInfoArray(); + + /** + * Store Ssid of selected WLAN + * Get ownership of parameter + * @param aSsid WLAN name + */ + void SetSelectedWlan( HBufC8* aSsid ); + + /** + * Return Ssid of selected WLAN + * @return WLAN name + */ + const TDesC8& SelectedWlan(); + + /** + * Stored current listbox index + * @param aIndex Listbox iden + */ + void SetSelectedIndex( TInt aIndex ); + + /** + * Return stored index listbox + * @return Previously stored listbox index + */ + TInt SelectedIndex(); + + /** + * Returns navipane text + * @return Navipane text + */ + HBufC* FormatNaviPaneLC(); + + private: // New methods + + /** + * Format the Hidden WLANs for the listbox.(text and icon) + * @since S60 v5.0 + * @param aWlan - Reference to wlaninfo + * @param aItem - Listbox item + */ + void FormatHiddenWlanItemL( TWsfWlanInfo& aWlan, TDes& aItem ); + + /** + * Format the WlanInfo (visible networks) items for the + * listbox.(text and icon) + * @since S60 v5.0 + * @param aWlan - reference to wlaninfo + * @param aItem - listbox item + */ + void FormatVisibleWlanItemL( TWsfWlanInfo& aWlan, TDes& aItem ); + + private: // Data + + /** + * The wlaninfo array we are currently working on. + * Not Own. (Ref.) + */ + CWsfWlanInfoArray* iWlanInfoArray; + + /** + * Coe env for loading string from resource + * Not Own. (Ref.) + */ + CCoeEnv* iCoeEnv; + + /** + * List that contains the WLAN items + * Own. + */ + CDesCArrayFlat* iFormattedWlanList; + + /** + * Store name of focused WLAN + * Own. + */ + HBufC8* iSelectedWlan; + + /** + * Index of the selected listbox item. + */ + TInt iListboxIndex; + + /** + * It contains the number of the Visible WLANs + */ + TUint iVisibleWlans; + }; + + + +#endif // C_WSFMAINVIEWMODEL_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewpartner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewpartner.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for MWsfMainViewPartner + * +*/ + +#ifndef M_WSFMAINVIEWPARTNER_H +#define M_WSFMAINVIEWPARTNER_H + +/** + * An interface to the Main view controller for the Main view container + * @since S60 5.0 + */ +class MWsfMainViewPartner + { + public: + + /** + * Mainview request to show manubar + * @since S60 5.0 + */ + virtual void ShowMenuBarL() = 0; + }; + +#endif // M_WSFMAINVIEWPARTNER_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/loc/wsfmainapplication.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/loc/wsfmainapplication.loc Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,415 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 strings for project Wlan Sniffer +* +*/ + + + +// LOCALISATION STRINGS + +//------------------------------------------------------------------------------ +// Connected Details Pop-up heading texts * +//------------------------------------------------------------------------------ +//d: Heading text for Connected Details Pop-up +//l: heading_pane_t1 +//r:3.0 +// +#define qtn_wlan_heading_connection_details "Connection details:" + +//------------------------------------------------------------------------------ +// Connected Details Pop-up item heading texts * +//------------------------------------------------------------------------------ +//d:The name of the connected WLAN network (Ssid) +//d:%U is a name of a connected WLAN. +//l:list_single_heading_pane_t2_cp2 +//r:3.0 +// +#define qtn_wlan_item_heading_text_wlan "WLAN" + +//d:The duration of connection of the WLAN (Active time) +//d:%N is a duration time in format hh.mm.ss +//l:list_single_heading_pane_t2_cp2 +//r:3.0 +// +#define qtn_wlan_item_heading_duration "Duration" + +//d:The amount of the transferred data +//l:list_single_heading_pane_t2_cp2 +//r:3.0 +// +#define qtn_wlan_item_heading_transf "Transfd." + +//------------------------------------------------------------------------------ +// Connected Details Pop-up item texts * +//------------------------------------------------------------------------------ + +//d:The amount of the transferred data +//d:%U is an amount of transferred data e.g. "250 kB" +//l:list_single_heading_pane_t1_cp2 +//r:3.0 +// +#define qtn_wlan_item_kb "%U kB" + +//d:The amount of the transferred data +//d:%U is an amount of transferred data e.g. "250MB" +//l:list_single_heading_pane_t1_cp2 +//r:3.0 +// +#define qtn_wlan_item_mb "%U MB" + + +//----------------------------------------------------------------------------- +// Main View * +//----------------------------------------------------------------------------- + +//d:Navi pane text in Available WLAN networks main view, if only one network is available. +//d:copied from S60: qtn_cmon_navi_one_wlan_nw_available +//l:navi_navi_text_pane_t1 +//r:3.0 +// +#define qtn_cmon_navi_one_wlan_nw_available "1 network available" + + +//d:Navi pane text in Available WLAN networks main view, if more than one network is available +//d:(%N is the amount of networks). +//d:copied from S60: qtn_cmon_navi_many_wlan_nws_available +//l:navi_navi_text_pane_t1 +//r:3.0 +// +#define qtn_cmon_navi_many_wlan_nws_available "%N networks available" + + +//d: Menu item to disconnect WLAN network +//l: list_single_pane_t1_cp2 +//r:3.0 +// +#define qtn_sniffer_opt_disconnect_wlan "Disconnect WLAN" + + +//d: Menu item of WLAN Sniffer’s main view options menu +//d: The command is used to open WLAN settings view +//l: list_single_pane_t1_cp2 +//r:3.0 +// +#define qtn_sniffer_opt_settings "Settings" + + +//d: Menu item of WLAN Sniffer’s main view options menu +//d: The command is used to define new access point for the selected WLAN +//l: list_single_pane_t1_cp2 +//r:3.0 +// +#define qtn_sniffer_opt_define_access_point "Define access point" + +//d: Menu item of WLAN Sniffer’s main view options menu +//d: The command is used to edit access point for the selected WLAN +//l: list_single_pane_t1_cp2 +//r:3.0 +// +#define qtn_sniffer_opt_edit_access_point "Edit access point" + +//d: Menu item of WLAN Sniffer’s main view options menu +//d: The command is used to view details of WLAN networks +//l: list_single_pane_t1_cp2 +//r:3.0 +// +#define qtn_sniffer_opt_details "Details" + +//d: Menu item of WLAN Sniffer’s main view options menu +//d: The command is used to refresh list of WLAN hotspots +//l: list_single_pane_t1_cp2 +//r:3.0 +// +#define qtn_sniffer_opt_refresh "Refresh" + + +//d: Menu item. +//d: The command is used to connect WLAN using selected IAP +//l: list_single_pane_t1_cp2 +//r:3.0 +// +#define qtn_sniffer_opt_connect "Connect" + +//d: Menu item of WLAN Sniffer’s main view options menu +//d: The command is used to start web browser +//l: list_single_pane_t1_cp2 +//r:3.0 +// +#define qtn_sniffer_opt_start_web_browsing "Start Web browsing" + + +//d: Menu item of WLAN Sniffer’s main view options menu +//d: The command is used to continue web browsing with selected IAP +//l: list_single_pane_t1_cp2 +//r:3.0 +#define qtn_sniffer_opt_continue_web_browsing "Continue Web browsing" + +//d: Text for unknown WLAN network +//l:list_double_graphic_pane_t2 +//r:3.0 +// +#define qtn_sniffer_unknown "Unknown" + + +//d: Text for known WLAN network +//l:list_double_graphic_pane_t2 +//r:3.0 +// +#define qtn_sniffer_known "Known" + + +//d: Text for a network that a connection is being established +//l:list_double_graphic_pane_t2 +//r:5.2 +// +#define qtn_sniffer_connecting "Connecting" + + +//d: Text for connected WLAN network +//l:list_double_graphic_pane_t2 +//r:3.0 +// +#define qtn_sniffer_connected "Connected" + + +// d:label text for hidden ssid at select wlan network dialog list +// d:(one row) +// l:list_double_graphic_pane_t1 +#define qtn_sniffer_plug_in_hidden_ssid_label "Other (hidden netw.)" + +//d: Application title +//l: title_pane_t2/opt9 +//r:3.0 +// +#define qtn_sniffer_title "WLAN" + +//d: If no WLAN network have been found, The information note is displayed. +//l: popup_note_window +//r:3.0 +// +#define qtn_wlan_info_no_networks_found "No WLAN networks found" + +//d: This error note is displayed if the user wants to connect but +//d: there is already an active WLAN connection. +//l: popup_note_window/opt1 +//r:3.0 +// +#define qtn_wlan_info_connection_already_active "A WLAN connection is already active. Close connection and try again." + + +//d:The main view is empty and the application starts to search available WLAN +//d:networks. During scanning a wait note Searching WLAN networks... +//l:popup_note_wait_window +//r:3.0 +// +#define qtn_wlan_wait_searching_networks "Searching WLAN networks" + +//d: This confirmation query is displayed if the user selected Start web browsing +//d: on a WLAN network but the browser is already running and using +//d: a different connection. +//l: popup_note_window +//r:3.0 +// +#define qtn_sniffer_quest_restart_browsing_with_wlan "Web application needs to be restarted for WLAN usage. Continue?" + + +//d: Menu item of WLAN Sniffer’s main view options menu +//d: The command is used to set/edit wlans which are blocked away +//l: list_single_pane_t1_cp2 +//r:3.0 +#define qtn_sniffer_opt_filter_out_wlans "Filter out networks" + +//d: Title of Filter out wlans list +//l: heading_pane_t1 +//r:3.0 +// +#define qtn_note_title_filter_out_wlans "Hide selected networks:" + + + + +//------------------------------------------------------------------------------ +// Details view texts (specified in Networking spec) * +//------------------------------------------------------------------------------ + + +//d:Navi pane text in Available WLAN networks details view. +//d:The navi pane displays the “serial number” (%0N) of the +//d:network in question and the total amount of the connections +//d:(%1N) using the navigation text component: %0N/%1N +//l:navi_navi_text_pane_t1 +//w: +//r:3.0 +// +#define qtn_cmon_navi_nof_wlan_network "%0N/%1N" + +//d:The name of the WLAN IAP +//l:list_single_heading_pane_t2 +//w: +//r:5.0 +// +#define qtn_cmon_heading_conn_name "Name" + +//d: WLAN network name (SSID) detail of the network +//l:list_single_heading_pane_t2 +//w: +//r:3.0 +// +#define qtn_cmon_heading_wlan_network_name "Network" + +//d: WLAN network signal strength detail of the network +//l:list_single_heading_pane_t2 +//w: +//r:3.0 +// +#define qtn_cmon_heading_wlan_signal_strength "Signal" + +//d: WLAN network mode detail of the network +//l:list_single_heading_pane_t2 +//w: +//r:3.0 +// +#define qtn_cmon_heading_wlan_network_mode "Mode" + +//d:WLAN network Security mode used by the WLAN network detail of the network +//l:list_single_heading_pane_t2 +//w: +//r:3.0 +// +#define qtn_cmon_heading_wlan_security_mode "Security" + +//d:WLAN network Amount of physical WLAN access points detail of the network +//l:list_single_heading_pane_t2 +//w: +//r:3.0 +// +#define qtn_cmon_heading_wlan_nw_ap_amount "Coverage" + +//d:WLAN network Maximum data rate detail of the network +//l:list_single_heading_pane_t2 +//w: +//r:3.0 +// +#define qtn_cmon_heading_wlan_nw_max_rate "Max. rate" + +//d:WLAN network Amount of physical WLAN access points (AP) in range, if a single AP is in range +//l:list_single_heading_pane_t1 +//w: +//r:3.0 +// +#define qtn_cmon_wlan_ap_amount_in_range_1 "1 access point" + +//d:WLAN network Amount of physical WLAN access points (AP) in range, if multiple APs in range (%N is the amount) +//l:list_single_heading_pane_t1 +//w: +//r:3.0 +// +#define qtn_cmon_wlan_ap_amount_in_range_many "%N access points" + +//d:WLAN network Maximum data rate in network (of best AP in range) +//d:in megabits per secondin +//l:list_single_heading_pane_t1 +//w: +//r:3.0 +// +#define qtn_cmon_wlan_max_data_rate "%U Mbit/s" + +//d:In details view, if a certain detail becomes unavailable this string is displayed +//l:list_single_heading_pane_t1 +//w: +//r:3.0 +// +#define qtn_cmon_parameter_unavailable "(unavailable)" + +//d: WLAN network signal strength text if the network in question becomes unavailable while +//d:in details view, +//l:list_single_heading_pane_t1 +//w: +//r:3.0 +// +#define qtn_cmon_wlan_signal_strength_no_signal "No signal" + +//d: WLAN network signal strength value text +//l:list_single_heading_pane_t1 +//w: +//r:3.0 +// +#define qtn_cmon_wlan_signal_strength_low "Low (%N%)" + +//d: WLAN network signal strength value text +//l:list_single_heading_pane_t1 +//w: +//r:3.0 +// +#define qtn_cmon_wlan_signal_strength_medium "Medium (%N%)" + +//d: WLAN network signal strength value text +//l:list_single_heading_pane_t1 +//w: +//r:3.0 +// +#define qtn_cmon_wlan_signal_strength_good "Good (%N%)" + +//d: WLAN network security mode value text +//l:list_single_heading_pane_t1 +//w: +//r:3.1 +// +#define qtn_wlan_sett_security_mode_open "Open network" + +//d: WLAN network security mode value text, this is the abbrevation of a kind of security mode +//l:list_single_heading_pane_t1 +//w: +//r:3.1 +// +#define qtn_wlan_sett_security_mode_wep "WEP" + +//d: WLAN network security mode value text, this is the abbrevation of a kind of security mode +//l:list_single_heading_pane_t1 +//w: +//r:3.1 +// +#define qtn_wlan_sett_security_mode_802_1x "802.1x" + +//d: WLAN network security mode value text, this is the abbrevation of a kind of security mode +//l:list_single_heading_pane_t1 +//w: +//r:3.1 +// +#define qtn_wlan_sett_security_mode_wpa "WPA/WPA2" + +//d: WLAN network security mode value text, this is the abbrevation of a kind of security mode +//l:list_single_heading_pane_t1 +//w: +//r:5.2 +// +#define qtn_wlan_sett_security_mode_wapi "WAPI" + +//d: WLAN network network mode: with AP +//l:list_single_heading_pane_t1 +//w: +//r:3.1 +// +#define qtn_cmon_wlan_network_mode_infra "Infrastructure" + +//d: WLAN network network mode: without AP +//l:list_single_heading_pane_t1 +//w: +//r:3.1 +// +#define qtn_cmon_wlan_network_mode_adhoc "Ad-hoc" + + +// End of File diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/rom/wsfmainapplication.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/rom/wsfmainapplication.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 Wlan Sniffer +* +*/ + +#ifndef WSFMAINAPPLICATION_IBY +#define WSFMAINAPPLICATION_IBY + +#ifdef __PROTOCOL_WLAN + +REM WlanSnifferApplication + +#include + +S60_APP_AIF_RSC(wlansniffer) + +S60_APP_EXE(wlansniffer) + +#endif //__PROTOCOL_WLAN + +#endif // WSFMAINAPPLICATION_IBY diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/rom/wsfmainapplicationresources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/rom/wsfmainapplicationresources.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 Wlan Sniffer +* +*/ + +#ifndef WSFMAINAPPLICATIONRESOURCES_IBY +#define WSFMAINAPPLICATIONRESOURCES_IBY + +#ifdef __PROTOCOL_WLAN + +REM WlanSnifferApplicationResources + +#include + +S60_APP_RESOURCE(wlansniffer) + +#endif // __PROTOCOL_WLAN + +#endif // WSFMAINAPPLICATIONRESOURCES_IBY diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/src/wsfactivetimeupdater.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfactivetimeupdater.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,139 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfActiveTimeUpdater. +* +*/ + + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "wsfactivetimeupdater.h" +#include "wsfactivetimerhandler.h" + +#include "wsflogger.h" + +// CONSTANTS + +// CONSTRUCTION AND DESTRUCTION +// --------------------------------------------------------------------------- +// CWsfActiveTimeUpdater::NewL +// --------------------------------------------------------------------------- +// +CWsfActiveTimeUpdater* CWsfActiveTimeUpdater::NewL( + MWsfActiveTimerHandler* aActiveTimerHandler ) + { + LOG_ENTERFN( "CWsfActiveTimeUpdater::NewL" ); + CWsfActiveTimeUpdater* thisPtr = NewLC( aActiveTimerHandler ); + CleanupStack::Pop( thisPtr ); + return thisPtr; + } + +// --------------------------------------------------------------------------- +// CWsfActiveTimeUpdater::NewLC +// --------------------------------------------------------------------------- +// +CWsfActiveTimeUpdater* CWsfActiveTimeUpdater::NewLC( + MWsfActiveTimerHandler* aActiveTimerHandler ) + { + LOG_ENTERFN( "CWsfActiveTimeUpdater::NewLC" ); + CWsfActiveTimeUpdater* thisPtr = + new ( ELeave ) CWsfActiveTimeUpdater( aActiveTimerHandler ); + CleanupStack::PushL( thisPtr ); + thisPtr->ConstructL(); + return thisPtr; + } + +// --------------------------------------------------------------------------- +// CWsfActiveTimeUpdater::~CWsfActiveTimeUpdater +// --------------------------------------------------------------------------- +// +CWsfActiveTimeUpdater::~CWsfActiveTimeUpdater() + { + LOG_ENTERFN( "CWsfActiveTimeUpdater::~CWsfActiveTimeUpdater" ); + if( iPeriodic ) + { + iPeriodic->Cancel(); + } + delete iPeriodic; + } + +// --------------------------------------------------------------------------- +// CWsfActiveTimeUpdater::CWsfActiveTimeUpdater +// --------------------------------------------------------------------------- +// +CWsfActiveTimeUpdater::CWsfActiveTimeUpdater( + MWsfActiveTimerHandler* aActiveTimerHandler ) + : iActiveTimerHandler( aActiveTimerHandler ) + { + } + +// --------------------------------------------------------------------------- +// CWsfActiveTimeUpdater::ConstructL +// --------------------------------------------------------------------------- +// +void CWsfActiveTimeUpdater::ConstructL() + { + LOG_ENTERFN( "CWsfActiveTimeUpdater::ConstructL" ); + iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard ); + } + +// METHODS +// --------------------------------------------------------------------------- +// CWsfActiveTimeUpdater::Start +// --------------------------------------------------------------------------- +// +void CWsfActiveTimeUpdater::Start( TInt aUpdateInterval ) + { + LOG_ENTERFN( "CWsfActiveTimeUpdater::Start" ); + // Start periodic timer + iPeriodic->Start( TTimeIntervalMicroSeconds32( 0 ), + TTimeIntervalMicroSeconds32( aUpdateInterval ), + TCallBack( UpdateTimeL, this ) ); + } + +// --------------------------------------------------------------------------- +// CWsfActiveTimeUpdater::Stop +// --------------------------------------------------------------------------- +// +void CWsfActiveTimeUpdater::Stop() + { + LOG_ENTERFN( "CWsfActiveTimeUpdater::Stop" ); + // Cancel the timer request + iPeriodic->Cancel(); + } + +// --------------------------------------------------------------------------- +// CWsfActiveTimeUpdater::DoUpdateTimeL +// --------------------------------------------------------------------------- +// +void CWsfActiveTimeUpdater::DoUpdateTimeL() + { + LOG_ENTERFN( "CWsfActiveTimeUpdater::DoUpdateTimeL" ); + iActiveTimerHandler->UpdateActiveTimeL(); + } + +// --------------------------------------------------------------------------- +// CWsfActiveTimeUpdater::UpdateTimeL +// --------------------------------------------------------------------------- +// +TInt CWsfActiveTimeUpdater::UpdateTimeL( TAny* aUpdater ) + { + LOG_ENTERFN( "CWsfActiveTimeUpdater::UpdateTimeL" ); + static_cast( aUpdater )->DoUpdateTimeL(); + return 0; + } + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/src/wsfactivewaiter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfactivewaiter.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,110 @@ +/* +* 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 CWsfActiveWaiter. +* +*/ + + +// INCLUDE FILES +#include "wsfactivewaiter.h" +#include "wsflogger.h" + + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CWsfActiveWaiter* CWsfActiveWaiter::NewL() +// --------------------------------------------------------- +// +CWsfActiveWaiter* CWsfActiveWaiter::NewL( ) + { + LOG_ENTERFN("CWsfActiveWaiter::NewL"); + CWsfActiveWaiter* self = + new ( ELeave ) CWsfActiveWaiter( ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// --------------------------------------------------------- +// CWsfActiveWaiter::ConstructL() +// --------------------------------------------------------- +// +void CWsfActiveWaiter::ConstructL() + { + LOG_ENTERFN("CWsfActiveWaiter::ConstructL"); + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::CWsfActiveWaiter() +// --------------------------------------------------------- +// +CWsfActiveWaiter::CWsfActiveWaiter() +: CActive( EPriorityNormal ) + { + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::~CWsfActiveWaiter() +// --------------------------------------------------------- +// +CWsfActiveWaiter::~CWsfActiveWaiter() + { + Cancel(); + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::DoCancel() +// --------------------------------------------------------- +// +void CWsfActiveWaiter::DoCancel() + { + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::RunL() +// --------------------------------------------------------- +// +void CWsfActiveWaiter::RunL() + { + LOG_ENTERFN( "CWsfActiveWaiter::RunL" ); + if ( iWait.IsStarted() ) + { + LOG_WRITE("async call completed, resuming."); + iWait.AsyncStop(); + } + } + +// --------------------------------------------------------- +// CWsfActiveWaiter::WaitForRequest() +// --------------------------------------------------------- +// +TInt CWsfActiveWaiter::WaitForRequest() + { + LOG_ENTERFN("CWsfActiveWaiter::WaitForRequest"); + SetActive(); + iWait.Start(); + + return iStatus.Int(); + } +// End of File + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/src/wsfapplication.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfapplication.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfApplication. +* +*/ + + +#include "wsfdocument.h" +#include "wsfapplication.h" + +// UID for the application, this should correspond +// to the uid defined in the mmp file +static const TUid KUidSnifferApp = {0x10281CAA}; + +// --------------------------------------------------------- +// CWsfApplication::CreateDocumentL() +// --------------------------------------------------------- +// +CApaDocument* CWsfApplication::CreateDocumentL() + { + // Create an Sniffer document, and return a pointer to it + CApaDocument* document = CWsfDocument::NewL( *this ); + return document; + } + +// --------------------------------------------------------- +// CWsfApplication::AppDllUid() +// --------------------------------------------------------- +// +TUid CWsfApplication::AppDllUid() const + { + // Return the UID for the Sniffer application + return KUidSnifferApp; + } + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/src/wsfappui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfappui.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,553 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfAppUi. +* +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wlansettingsui.h" +#include "wsfappui.h" +#include "wsfmainview.h" +#include "wsfdetailsview.h" +#include "wsfmainviewcontrollerif.h" +#include "wsfdetailsviewcontrollerif.h" +#include "wsfmainuiobserver.h" +#include "wsfmainapplication.hrh" +#include "wsfdocument.h" +#include "wsfconnecteddetailsdialog.h" +#include "wsfconnecteddetailsmodel.h" +#include "wsfmodel.h" +#include "wsflogger.h" + +// LOCAL DEFINITIONS +#ifdef _DEBUG + _LIT( KAppUi, "CWsfAppUi" ); + #define _ASSERTD( cond ) __ASSERT_DEBUG( (cond), \ + User::Panic( KAppUi, __LINE__) ) +#else + #define _ASSERTD( cond ) {} +#endif //_DEBUG + +// --------------------------------------------------------------------------- +// CWsfAppUi::ConstructL +// --------------------------------------------------------------------------- +// +void CWsfAppUi::ConstructL() + { + LOG_CREATE; + LOG_WRITE( "Constructing Wlan Sniffer" ); + LOG_ENTERFN( "CWsfAppUi::ConstructL" ); + + BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible ); + + // Initialize feature manager + FeatureManager::InitializeLibL(); + iFeatureManagerInitialized = ETrue; + + iIdle = CIdle::NewL( CActive::EPriorityIdle ); + + // check if the app. launched in embedded mode + TBool isEmbeddedApp = IsEmbedded(); + LOG_WRITEF( "IsEmbedded(): %d", isEmbeddedApp ); + + //Create mainview + LOG_WRITE( "Creating main view" ); + CWsfMainView* mainView = CWsfMainView::NewLC( isEmbeddedApp ); + LOG_WRITE( "Adding main view" ); + AddViewL( mainView ); // transfer ownership to CAknViewAppUi + CleanupStack::Pop( mainView ); + LOG_WRITE( "main view creating done" ); + SetDefaultViewL( *mainView ); + iObserver->MainViewCreatedL(); + + //Create details view (not connected) + LOG_WRITE( "Create details view (not connected)" ); + CWsfDetailsView* detailsView = CWsfDetailsView::NewLC(); + LOG_WRITE( "Adding details view (not connected)" ); + AddViewL( detailsView ); // transfer ownership to CAknViewAppUi + CleanupStack::Pop( detailsView ); + LOG_WRITE( "details view (not connected) creating done" ); + + ActivateMainViewL(); + + iIdle->Start( TCallBack( AppLaunchCompleteL, this ) ); + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::CWsfAppUi +// --------------------------------------------------------------------------- +// +CWsfAppUi::CWsfAppUi(): + iConnectedDetailsDialog( NULL ), + iForeground( ETrue ), + iFeatureManagerInitialized( EFalse ) + { + // no implementation required + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::~CWsfAppUi +// --------------------------------------------------------------------------- +// +CWsfAppUi::~CWsfAppUi() + { + if ( iWaitDialog ) + { + iWaitDialog->SetCallback( NULL ); + TRAP_IGNORE( iWaitDialog->ProcessFinishedL() ); + } + + if ( iFeatureManagerInitialized ) + { + FeatureManager::UnInitializeLib(); + } + + delete iIdle; + delete iConnectedDetailsDialog; + LOG_WRITE( "CWsfAppUi::~CWsfAppUi" ); + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::HandleCommandL +// --------------------------------------------------------------------------- +// +void CWsfAppUi::HandleCommandL( TInt aCommand ) + { + LOG_ENTERFN( "CWsfAppUi::HandleCommandL" ); + switch ( aCommand ) + { + case EEikCmdExit: + case EAknCmdExit: + case EAknSoftkeyExit: + { + if ( iAppLaunchCompleted ) + { + Exit(); + } + break; + } + + case ESnifferCmdStartBrowsing: + { + iObserver->StartBrowsingL(); + break; + } + + case ESnifferCmdContinueBrowsing: + { + iObserver->ContinueBrowsingL(); + break; + } + + case ESnifferCmdShowWlans: + { + iObserver->ShowWlanListL(); + break; + } + + case ESnifferCmdConnect: + { + iObserver->ConnectL(); + break; + } + case ESnifferCmdDisconnect: + { + iObserver->DisconnectL(); + break; + } + case ESnifferCmdRefresh: + { + iObserver->RefreshL(); + break; + } + case ESnifferCmdDetails: + { + iObserver->ShowDetailsL(); + break; + } + case ESnifferCmdFilterWlans: + { + iObserver->EditBlackListItemsL(); + break; + } + case ESnifferCmdSettings: + { + // launch settings dialog + CWlanSettingsUi* wlanSettings = + CWlanSettingsUi::NewL( *iEikonEnv ); + CleanupStack::PushL( wlanSettings ); + iForeground = EFalse; + wlanSettings->RunSettingsL(); + iForeground = ETrue; + CleanupStack::PopAndDestroy( wlanSettings ); + break; + } + case EAknCmdHelp: + { + if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) + { + HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), + AppHelpContextL() ); + } + break; + } + + default: + { + break; + } + } + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::SetUiObserver +// --------------------------------------------------------------------------- +// +void CWsfAppUi::SetUiObserver( MWsfMainUiObserver* aObserver ) + { + iObserver = aObserver; + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::HandleResourceChangeL +// --------------------------------------------------------------------------- +// +void CWsfAppUi::HandleResourceChangeL( TInt aType ) + { + CAknAppUi::HandleResourceChangeL( aType ); + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::HandleForegroundEventL +// --------------------------------------------------------------------------- +// +void CWsfAppUi::HandleForegroundEventL( TBool aForeground ) + { + LOG_ENTERFN( "CWsfAppUi::HandleForegroundEventL" ); + //Application switched to foreground. + if ( aForeground ) + { + CWsfMainView* mainView = static_cast( + View( TUid::Uid( EMainViewId ) ) ); + if ( mainView ) + { + TRAPD( err, mainView->UpdateBrowserUsageInfoL() ); + if ( err ) + { + LOG_WRITEF( "Browser iap usage update failed - err=%d", err ); + } + } + + if ( iObserver ) + { + iObserver->AppSwitchedForegroundL(); + } + } + else + { + if ( iObserver ) + { + iObserver->AppSwitchedBackgroundL(); + } + + } + + CAknViewAppUi::HandleForegroundEventL( aForeground ); + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::ActivateDetailsViewL +// --------------------------------------------------------------------------- +// +void CWsfAppUi::ActivateDetailsViewL( TUid aDetailsViewId ) + { + ActivateLocalViewL( aDetailsViewId ); + LOG_WRITE( "CWsfAppUi::ActivateDetailsViewL" ); + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::ActivateMainViewL +// --------------------------------------------------------------------------- +// +void CWsfAppUi::ActivateMainViewL() + { + ActivateLocalViewL( TUid::Uid( EMainViewId ) ); + LOG_WRITE( "CWsfAppUi::ActivateMainViewL" ); + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::MainView +// --------------------------------------------------------------------------- +// +MWsfMainViewControllerIf& CWsfAppUi::MainView() + { + CWsfMainView* mainView = static_cast( + View( TUid::Uid( EMainViewId ) ) ); + return mainView->Controller(); + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::DetailsView +// --------------------------------------------------------------------------- +// +MWsfDetailsViewControllerIf& CWsfAppUi::DetailsView( TInt aDetailsViewType ) + { + CWsfDetailsView* detailsView = static_cast( + View( TUid::Uid( aDetailsViewType ) ) ); + return detailsView->Controller(); + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::StartWaitNoteL +// --------------------------------------------------------------------------- +// +void CWsfAppUi::StartWaitNoteL( TBool aVisibilityDelayOff ) + { + LOG_ENTERFN( "CWsfAppUi::StartWaitNoteL" ); + // wait dialog shown only if engine updating + // the wlan list + if( iObserver->EngineRefreshing() ) + { + iWaitDialog = new (ELeave) CAknWaitDialog( + reinterpret_cast( &iWaitDialog ), + aVisibilityDelayOff ); + iWaitDialog->SetCallback( this ); + iWaitDialog->ExecuteLD( R_WAITNOTE_SEARCHING_WLANS ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::HideWaitNoteL +// --------------------------------------------------------------------------- +// +void CWsfAppUi::HideWaitNoteL() + { + LOG_ENTERFN( "CWsfAppUi::HideWaitNoteL" ); + if ( iWaitDialog ) + { + iWaitDialog->ProcessFinishedL(); + iWaitDialog = NULL; + } + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::DialogDismissedL +// --------------------------------------------------------------------------- +// +void CWsfAppUi::DialogDismissedL( TInt aButtonId ) + { + LOG_ENTERFN( "CWsfAppUi::DialogDismissedL" ); + iWaitDialog = NULL; + + if ( aButtonId == EEikBidCancel ) + { + // dialog was cancelled by the user + + if ( Doc()->Model().IsConnecting() ) + { + // connecting wait note was active + LOG_WRITE( "cancelling 'connecting' wait note" ); + Doc()->Model().AbortConnectingL(); + Doc()->Model().SetConnecting( EFalse ); + } + else + { + // searching for wlan wait note was active + LOG_WRITE( "cancelling 'searching for wlan' wait note" ); + Doc()->Model().AbortScanningL(); + Doc()->Model().SetRefreshState( EFalse ); + } + } + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::ShowMenuBarL +// --------------------------------------------------------------------------- +// +void CWsfAppUi::ShowMenuBarL() + { + CWsfMainView* mainview = static_cast( iView ); + mainview->SelectionKeyPressed(); + iView->MenuBar()->TryDisplayMenuBarL(); + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::ShowNoWlansFoundInfoL +// --------------------------------------------------------------------------- +// +void CWsfAppUi::ShowNoWlansFoundInfoL() + { + LOG_ENTERFN( "CWsfAppUi::ShowNoWlansFoundInfoL" ); + + CConnectionUiUtilities* connUiUtils = CConnectionUiUtilities::NewL(); + connUiUtils->NoWLANNetworksAvailableNote(); + delete connUiUtils; + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::ShowErrorNoteL +// --------------------------------------------------------------------------- +// +void CWsfAppUi::ShowErrorNoteL( TInt aResourceId ) + { + LOG_ENTERFN( "CWsfAppUi::ShowErrorNoteL" ); + HBufC* txt = StringLoader::LoadLC( aResourceId ); + + CAknErrorNote* errorNote = new (ELeave) CAknErrorNote; + errorNote->ExecuteLD( *txt ); + + CleanupStack::PopAndDestroy( txt ); + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::ShowGlobalErrorNoteL +// --------------------------------------------------------------------------- +// +void CWsfAppUi::ShowGlobalErrorNoteL( TInt aError ) + { + LOG_ENTERFN( "CWsfAppUi::ShowGlobalErrorNoteL" ); + CErrorUI* errorUi = CErrorUI::NewLC( *CCoeEnv::Static() ); + errorUi->ShowGlobalErrorNoteL( aError ); + CleanupStack::PopAndDestroy( errorUi ); + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::AppLaunchCompleteL +// --------------------------------------------------------------------------- +// +TInt CWsfAppUi::AppLaunchCompleteL( TAny* aObject ) + { + LOG_ENTERFN( "CWsfAppUi::AppLaunchCompleteL" ); + _ASSERTD( aObject ); + CWsfAppUi* appUi = static_cast( aObject ); + appUi->iAppLaunchCompleted = ETrue; + appUi->StartWaitNoteL( EFalse ); + return 0; // Return false (zero) value not be called again. (Stops timer) + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::IsEmbedded +// --------------------------------------------------------------------------- +// +TBool CWsfAppUi::IsEmbedded() const + { + LOG_ENTERFN( "CWsfAppUi::IsEmbedded" ); + return iEikonEnv->StartedAsServerApp(); + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::Doc +// --------------------------------------------------------------------------- +// +CWsfDocument* CWsfAppUi::Doc() + { + return static_cast( Document() ); + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::Foreground +// --------------------------------------------------------------------------- +// +TBool CWsfAppUi::Foreground() + { + return iForeground; + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::StartConnectedDetailsL +// --------------------------------------------------------------------------- +// +void CWsfAppUi::StartConnectedDetailsL( CWsfWlanInfoArray* aWlanArray, + const TDesC8& aSelectedWlanSsid ) + { + LOG_ENTERFN( "CWsfAppUi::StartConnectedDetailsL" ); + CWsfConnectedDetailsModel* model = CWsfConnectedDetailsModel::NewLC(); + iConnectedDetailsDialog = CWsfConnectedDetailsDialog::NewL(); + iConnectedDetailsDialog->SetListModel(model); + iConnectedDetailsDialog->Controller().SetWlanListL( aWlanArray, + aSelectedWlanSsid ); + iConnectedDetailsDialog->ExecuteLD( R_QTN_CONNECTED_DETAILS_DIALOG ); + iConnectedDetailsDialog = NULL; + CleanupStack::PopAndDestroy(model); + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::UpdateConnectedDetailsL +// --------------------------------------------------------------------------- +// +void CWsfAppUi::UpdateConnectedDetailsL( CWsfWlanInfoArray* aWlanArray ) + { + LOG_ENTERFN( "CWsfAppUi::UpdateConnectedDetailsL" ); + if ( iConnectedDetailsDialog != NULL ) + { + iConnectedDetailsDialog->Controller().WlanListChangedL( aWlanArray ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::SuppressingKeyEvents +// --------------------------------------------------------------------------- +// +TBool CWsfAppUi::SuppressingKeyEvents() const + { + return iSuppressingKeyEvents; + } + + +// --------------------------------------------------------------------------- +// CWsfAppUi::SetSuppressingKeyEvents +// --------------------------------------------------------------------------- +// +void CWsfAppUi::SetSuppressingKeyEvents( TBool aSuppressing ) + { + iSuppressingKeyEvents = aSuppressing; + } + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/src/wsfconnecteddetailscontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfconnecteddetailscontroller.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 TWsfConnectedDetailsController. +* +*/ + + +// CLASS HEADER +#include "wsfconnecteddetailscontroller.h" + +// EXTERNAL INCLUDES + +// INTERNAL INCLUDES +#include "wsfconnecteddetailsmodel.h" +#include "wsfwlaninfo.h" +#include "wsfwlaninfoarray.h" +#include "wsfconnecteddetailsdialog.h" + +#include "wsflogger.h" + + +// LOCAL DEFINITIONS +#ifdef _DEBUG + _LIT( KDetailsViewControllerPanic, "TWsfConnectedDetailsController" ); + #define _ASSERTD( cond ) __ASSERT_DEBUG( (cond), \ + User::Panic( KDetailsViewControllerPanic, __LINE__) ) +#else + #define _ASSERTD( cond ) {} +#endif //_DEBUG + + + + +// --------------------------------------------------------------------------- +// void TWsfConnectedDetailsController::SetWlanListL +// --------------------------------------------------------------------------- +// +void TWsfConnectedDetailsController::SetWlanListL( + CWsfWlanInfoArray* aWlanArray, + const TDesC8& aSelectedWlanSsid ) + { + LOG_ENTERFN( "TWsfConnectedDetailsController::SetWlanListL" ); + _ASSERTD( aWlanArray ); + + //Get selected Wlan info + TWsfWlanInfo* info = aWlanArray->Match( aSelectedWlanSsid, + aWlanArray->Count() ); + + CDesCArray* formattedList = NULL; + + // if view active && and something to show + if ( iDialog && iModel) + { + // Update model + formattedList = iModel->FormatWlanInfoL( info, aWlanArray ); + + //Draw view + iDialog->UpdateListBox( formattedList ); + } + } + +// --------------------------------------------------------------------------- +// void TWsfConnectedDetailsController::WlanListChangedL +// --------------------------------------------------------------------------- +// +void TWsfConnectedDetailsController::WlanListChangedL( + CWsfWlanInfoArray* aWlanArray ) + { + LOG_ENTERFN( "TWsfConnectedDetailsController::WlanListChangedL" ); + _ASSERTD( aWlanArray ); + + //If view active + if ( iDialog && iModel ) + { + //Get selected Wlan info + TWsfWlanInfo* info = aWlanArray->Match( iModel->WlanSsid(), + aWlanArray->Count() ); + + CDesCArray* formattedList = NULL; + + //Current info found from new list + // Update model + formattedList = iModel->FormatWlanInfoL( info, aWlanArray ); + + //Draw view + iDialog->UpdateListBox( formattedList ); + } + } + +// --------------------------------------------------------------------------- +// void TWsfConnectedDetailsController::RefreshL +// --------------------------------------------------------------------------- +// +void TWsfConnectedDetailsController::RefreshL() + { + LOG_ENTERFN( "TWsfConnectedDetailsController::RefreshL" ); + + if ( iDialog && iModel) + { + CDesCArray* formattedDetails = iModel->GetWlanDetails(); + + iDialog->UpdateListBox( formattedDetails ); + } + } + +// --------------------------------------------------------------------------- +// void TWsfConnectedDetailsController::UpdateActiveTimeL +// --------------------------------------------------------------------------- +// +void TWsfConnectedDetailsController::UpdateActiveTimeL() + { + LOG_ENTERFN( "TWsfConnectedDetailsController::UpdateActiveTimeL" ); + if (iModel) + { + iModel->RefreshCurrentWlanInfoL(); + RefreshL(); + } + } + +void TWsfConnectedDetailsController::SetPartner( + MWsfDetailsViewPartner& /*aPartner*/ ) + { + } + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/src/wsfconnecteddetailsdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfconnecteddetailsdialog.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,182 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfConnectedDetailsDialog. +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include "wsfconnecteddetailsdialog.h" +#include "wsfconnecteddetailsmodel.h" +#include "wsfconnecteddetailscontroller.h" +#include "wsfactivetimeupdater.h" + +#include "wsflogger.h" + +// CONSTANTS +LOCAL_D const TInt KUpdateInterval = 1000000; // in micro seconds (1 sec) + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsDialog::ConstructL +// --------------------------------------------------------------------------- +// +void CWsfConnectedDetailsDialog::ConstructL() + { + LOG_ENTERFN( "CWsfConnectedDetailsDialog::ConstructL" ); + iController.SetDialog( this ); + // Create and start Active Object 'Active Updater' + iActiveUpdater = CWsfActiveTimeUpdater::NewL( &iController ); + iActiveUpdater->Start( KUpdateInterval ); + } + + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsDialog::NewL +// --------------------------------------------------------------------------- +// +CWsfConnectedDetailsDialog* CWsfConnectedDetailsDialog::NewL() + { + LOG_ENTERFN( "CWsfConnectedDetailsDialog::NewL" ); + CWsfConnectedDetailsDialog* self = CWsfConnectedDetailsDialog::NewLC(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsDialog::NewLC +// --------------------------------------------------------------------------- +// +CWsfConnectedDetailsDialog* CWsfConnectedDetailsDialog::NewLC() + { + LOG_ENTERFN( "CWsfConnectedDetailsDialog::NewLC" ); + CWsfConnectedDetailsDialog* self = + new( ELeave ) CWsfConnectedDetailsDialog( NULL ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsDialog::CWsfConnectedDetailsDialog +// --------------------------------------------------------------------------- +// +CWsfConnectedDetailsDialog::CWsfConnectedDetailsDialog( + CListBoxView::CSelectionIndexArray* aSelectionIndexArray ) + : CAknListQueryDialog( aSelectionIndexArray ), + iList( NULL ), + iModel( NULL ) + { + } + + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsDialog::~CWsfConnectedDetailsDialog +// --------------------------------------------------------------------------- +// +CWsfConnectedDetailsDialog::~CWsfConnectedDetailsDialog() + { + LOG_ENTERFN( "CWsfConnectedDetailsDialog::~CWsfConnectedDetailsDialog" ); + iController.SetModel(NULL); + iController.SetDialog(NULL); + if( iActiveUpdater ) + { + iActiveUpdater->Stop(); + } + delete iActiveUpdater; + // iListModel is deleted in WSFAppui::StartConnectedDetailsL + } + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsDialog::SetListModel +// --------------------------------------------------------------------------- +// +void CWsfConnectedDetailsDialog::SetListModel( CWsfConnectedDetailsModel* aModel) + { + LOG_ENTERFN( "CWsfConnectedDetailsDialog::SetListModel" ); + iListModel = aModel; + iController.SetModel(iListModel); + } + + +// --------------------------------------------------------- +// CWsfConnectedDetailsDialog::PreLayoutDynInitL +// called by framework before dialog is shown +// --------------------------------------------------------- +// +void CWsfConnectedDetailsDialog::PreLayoutDynInitL() + { + LOG_ENTERFN( "CWsfConnectedDetailsDialog::PreLayoutDynInitL" ); + // parent creates the private listbox + CAknListQueryDialog::PreLayoutDynInitL(); + // and now we get access to it... + CAknListQueryControl *control = + ( CAknListQueryControl* )Control( EListQueryControl ); + iList = control->Listbox(); + iModel = ( CTextListBoxModel* )iList->Model(); + + // 1st Refresh of the listbox + iController.RefreshL(); + ActivateL(); + } + +// --------------------------------------------------------- +// CWsfConnectedDetailsContainer::UpdateListBox +// --------------------------------------------------------- +// +void CWsfConnectedDetailsDialog::UpdateListBox( MDesCArray* aItemTextArray ) + { + LOG_ENTERFN( "CWsfConnectedDetailsDialog::UpdateListBox" ); + for( TInt i = 0; i < aItemTextArray->MdcaCount(); i++) + { + TPtrC temp = aItemTextArray->MdcaPoint( i ); + TBuf<100> tempElement = temp; + LOG_WRITEF( "aItemTextArray[0]: %S", &tempElement ); + } + + if ( iList && aItemTextArray->MdcaCount() ) + { + iModel->SetItemTextArray( aItemTextArray ); + iModel->SetOwnershipType( ELbmDoesNotOwnItemArray ); + DrawNow(); + } + } + +// --------------------------------------------------------- +// CWsfConnectedDetailsContainer::Controller +// --------------------------------------------------------- +// +MWsfDetailsViewControllerIf& CWsfConnectedDetailsDialog::Controller() + { + return iController; + } + +// --------------------------------------------------------- +// CWsfConnectedDetailsDialog::HandleListBoxEventL +// --------------------------------------------------------- +// +void CWsfConnectedDetailsDialog::HandleListBoxEventL( CEikListBox* /*aListBox*/, + TListBoxEvent /*aEventType*/ ) + { + } + +// End of File diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/src/wsfconnecteddetailsmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfconnecteddetailsmodel.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,573 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Details view Model +* +*/ + + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include "wsfwlaninfo.h" +#include "wsfconnecteddetailsmodel.h" +#include "wsfwlaninfoarray.h" +#include "wsfactivewaiter.h" +#include "wsflogger.h" + + +// LOCAL DEFINITIONS +#ifdef _DEBUG + _LIT( KDetailsViewModelPanic, "CWsfConnectedDetailsModel" ); + #define _ASSERTD( cond ) __ASSERT_DEBUG( (cond), \ + User::Panic( KDetailsViewModelPanic, __LINE__) ) +#else + #define _ASSERTD( cond ) {} +#endif //_DEBUG + +// the size of the Details Listbox's array +const TInt KWlanInfoGranularity = 3; + +// Listbox element format string +_LIT( KListItemFormat, "%S\t%S" ); + +// invalid connection id +const TInt KInvalidConnectionId = 0; + + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsModel::CWsfConnectedDetailsModel +// --------------------------------------------------------------------------- +// +CWsfConnectedDetailsModel::CWsfConnectedDetailsModel(): + iIsConnActive( EFalse ), + iConnectionId( KInvalidConnectionId ), + iCoeEnv( CCoeEnv::Static() ) + { + } + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsModel::ConstructL +// --------------------------------------------------------------------------- +// +void CWsfConnectedDetailsModel::ConstructL() + { + LOG_ENTERFN( "CWsfConnectedDetailsModel::ConstructL" ); + iFormattedWlanInfo = new (ELeave) CDesCArrayFlat( KWlanInfoGranularity ); + iConnectionMonitor.ConnectL(); + FindWlanConnectionL(); + } + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsModel::NewL +// --------------------------------------------------------------------------- +// +CWsfConnectedDetailsModel* CWsfConnectedDetailsModel::NewL() + { + LOG_ENTERFN( "CWsfConnectedDetailsModel::NewL" ); + CWsfConnectedDetailsModel* self = CWsfConnectedDetailsModel::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsModel::NewLC +// --------------------------------------------------------------------------- +// +CWsfConnectedDetailsModel* CWsfConnectedDetailsModel::NewLC() + { + LOG_ENTERFN( "CWsfConnectedDetailsModel::NewLC" ); + CWsfConnectedDetailsModel* self = new( ELeave ) CWsfConnectedDetailsModel; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsModel::~CWsfConnectedDetailsModel +// --------------------------------------------------------------------------- +// +CWsfConnectedDetailsModel::~CWsfConnectedDetailsModel() + { + LOG_ENTERFN( + "CWsfConnectedDetailsModel::~CWsfConnectedDetailsModel" ); + iConnectionMonitor.CancelAsyncRequest(EConnMonGetUintAttribute); + iConnectionMonitor.CancelAsyncRequest(EConnMonGetIntAttribute); + iConnectionMonitor.Close(); + delete iFormattedWlanInfo; + } + + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsModel::FindWlanConnectionL +// --------------------------------------------------------------------------- +// +void CWsfConnectedDetailsModel::FindWlanConnectionL() + { + LOG_ENTERFN( "CWsfConnectedDetailsModel::FindWlanConnectionL" ); + +#ifndef __WINS__ + // first call, need to get the connection parameters + iConnectionId = KInvalidConnectionId; + TUint connectionCount( 0 ); + + CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewL(); + iConnectionMonitor.GetConnectionCount( connectionCount, waiter->iStatus ); + waiter->WaitForRequest(); + + if ( waiter->iStatus.Int() == KErrNone ) + { + LOG_WRITEF( "connectionCount = %d", connectionCount ); + // find the connection with WLAN bearer + // that will be the selected WLAN + for ( TUint i = 1; i <= connectionCount; ++i ) + { + TUint connectionId( KInvalidConnectionId ); + TUint subConnectionCount( 0 ); + TConnMonBearerType bearerType( EBearerUnknown ); + + iConnectionMonitor.GetConnectionInfo( i, + connectionId, + subConnectionCount ); + iConnectionMonitor.GetIntAttribute( connectionId, + 0, + KBearer, + ( TInt& )bearerType, + waiter->iStatus ); + waiter->WaitForRequest(); + + if ( waiter->iStatus.Int() == KErrNone && + bearerType == EBearerWLAN ) + { + LOG_WRITEF( "found connection id = %d", connectionId ); + iConnectionId = connectionId; + break; + } + } + } + + if ( iConnectionId != KInvalidConnectionId ) + { + iIsConnActive = ETrue; + + // now we have the connectiond ID, ask the start time + LOG_WRITE( "querying start time..." ); + + TConnMonTimeBuf timeBuf; + iConnectionMonitor.GetPckgAttribute( iConnectionId, 0, KStartTime, + timeBuf, waiter->iStatus ); + waiter->WaitForRequest(); + + if ( waiter->iStatus.Int() == KErrNone ) + { + iStartTime = timeBuf(); + } + } + + delete waiter; + +#else // __WINS__ + + // for testing + iStartTime.UniversalTime(); + iIsConnActive = ETrue; + +#endif // __WINS__ + + } + + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsModel::FormatWlanInfoL +// --------------------------------------------------------------------------- +// +CDesCArrayFlat* CWsfConnectedDetailsModel::FormatWlanInfoL( + TWsfWlanInfo* aWlanInfo, + CWsfWlanInfoArray* aWlanArray ) + { + LOG_ENTERFN( "CWsfConnectedDetailsModel::FormatWlanInfoL" ); + _ASSERTD( aWlanArray ); + + // While the system loads the dialog and the connection lost that could + // cause problems eg.: "No data" displayed + if ( !aWlanInfo || !VisibleWlans( *aWlanArray ) ) + { + // bad wlan info or no visible wlans + return iFormattedWlanInfo; + } + + iWlanInfo = *aWlanInfo; + iWlanArray = aWlanArray; + + RefreshCurrentWlanInfoL(); + + + return GetWlanDetails(); + } + + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsModel::RefreshCurrentWlanInfoL +// --------------------------------------------------------------------------- +// +CDesCArrayFlat* CWsfConnectedDetailsModel::RefreshCurrentWlanInfoL() + { + LOG_ENTERFN( "CWsfConnectedDetailsModel::RefreshCurrentWlanInfoL" ); + LOG_WRITEF( "iIsConnActive: %d", iIsConnActive ); + _ASSERTD( iWlanArray ); + if ( iRefreshing ) + { + return iFormattedWlanInfo; + } + + // mutual exclusion + iRefreshing = ETrue; + +#ifndef __WINS__ + if ( iIsConnActive ) + { + LOG_WRITEF( "RefreshCurrentWlanInfoL - iConnectionId: %d", + iConnectionId ); + + CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewL(); + TInt connStat( 0 ); + iConnectionMonitor.GetIntAttribute( iConnectionId, + 0, + KConnectionStatus, + connStat, + waiter->iStatus ); + waiter->WaitForRequest(); + + LOG_WRITEF( "connStat: %d", connStat ); + LOG_WRITEF( "status.Int(): %d", waiter->iStatus.Int() ); + + if ( waiter->iStatus.Int() != KErrNone ) + { + delete waiter; + iRefreshing = EFalse; + return iFormattedWlanInfo; + } + + delete waiter; + + // set the connection status + LOG_WRITEF( "connStat: %d", connStat ); + if ( ( connStat == KLinkLayerOpen ) || + ( connStat == KConnectionOpen ) ) + { + iIsConnActive = ETrue; + } + else + { + iIsConnActive = EFalse; + } + } + +#endif // __WINS__ + + iFormattedWlanInfo->Reset(); + + // create array of connected WLAN data + FormatAndAppendConnectedWlanSsidL(); + FormatAndAppendDurationL(); + FormatAndAppendTransferredL(); + + iRefreshing = EFalse; + + return GetWlanDetails(); + } + + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsModel::GetWlanDetails +// --------------------------------------------------------------------------- +// +CDesCArrayFlat* CWsfConnectedDetailsModel::GetWlanDetails() + { + LOG_ENTERFN( "CWsfConnectedDetailsModel::GetWlanDetails" ); +#ifdef _DEBUG + const TInt KThatLongBufferWillMakeDo = 100; + for( TInt i = 0; i < iFormattedWlanInfo->MdcaCount(); i++) + { + TPtrC temp = iFormattedWlanInfo->MdcaPoint( i ); + TBuf tempElement = temp; + LOG_WRITEF( "iFormattedWlanInfo: %S", &tempElement ); + } +#endif + + return iFormattedWlanInfo; + } + + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsModel::WlanSsid +// --------------------------------------------------------------------------- +// +const TDesC8& CWsfConnectedDetailsModel::WlanSsid() const + { + return iWlanInfo.iSsid; + } + + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsModel::FormatListBoxItemLC +// --------------------------------------------------------------------------- +// +HBufC* CWsfConnectedDetailsModel::FormatListBoxItemLC( + const TUint aResourceId, + const TDesC& aValueText ) const + { + LOG_ENTERFN( "CWsfConnectedDetailsModel::FormatListBoxItemLC" ); + // hold the column name on list item + HBufC* columnName = NULL; + + if ( aResourceId ) + { + columnName = StringLoader::LoadLC( aResourceId ); + } + else + { + columnName = KNullDesC().AllocLC(); + } + + + // Holds the list box item + HBufC* listBoxItem = HBufC::NewL( KListItemFormat().Length()+ + columnName->Length() + + aValueText.Length() ); + + // For formating needs + TPtr listBoxItemPrt = listBoxItem->Des(); + + // Format string ( KListItemFormat = %S\t%S ) + listBoxItemPrt.Format( KListItemFormat, columnName, &aValueText ); + CleanupStack::PopAndDestroy( columnName ); + CleanupStack::PushL( listBoxItem ); + return listBoxItem; + } + + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsModel::FormatAndAppendConnectedWlanSsidL +// --------------------------------------------------------------------------- +// +void CWsfConnectedDetailsModel::FormatAndAppendConnectedWlanSsidL() + { + LOG_ENTERFN( + "CWsfConnectedDetailsModel::FormatAndAppendConnectedWlanSsidL" ); + HBufC* wlanName( NULL ); + + if ( iWlanInfo.iNetworkName.Length() ) // If there is IAP + { + wlanName = iWlanInfo.GetIapNameAsUnicodeLC(); + } + else // If there no IAP + { + wlanName = iWlanInfo.GetSsidAsUnicodeLC(); + } + + HBufC* listBoxItem = FormatListBoxItemLC( + R_QTN_WLAN_ITEM_HEADING_TEXT_WLAN, + *wlanName ); + + iFormattedWlanInfo->AppendL( *listBoxItem ); + CleanupStack::PopAndDestroy( listBoxItem ); + CleanupStack::PopAndDestroy( wlanName ); + } + + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsModel::FormatAndAppendDurationL +// --------------------------------------------------------------------------- +// +void CWsfConnectedDetailsModel::FormatAndAppendDurationL() + { + LOG_ENTERFN( "CWsfConnectedDetailsModel::FormatAndAppendDurationL" ); + HBufC* duration = FormatDurationLC(); + HBufC* listBoxItem = FormatListBoxItemLC( + R_QTN_WLAN_ITEM_HEADING_DURATION, + *duration ); + + iFormattedWlanInfo->AppendL( *listBoxItem ); + CleanupStack::PopAndDestroy( listBoxItem ); + CleanupStack::PopAndDestroy( duration ); + } + + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsModel::FormatAndAppendTransferredL +// --------------------------------------------------------------------------- +// +void CWsfConnectedDetailsModel::FormatAndAppendTransferredL() + { + LOG_ENTERFN( + "CWsfConnectedDetailsModel::FormatAndAppendTransferredL" ); + HBufC* transferredData = FormatTransferredLC(); + HBufC* listBoxItem = FormatListBoxItemLC( R_QTN_WLAN_ITEM_HEADING_TRANSF, + *transferredData ); + + iFormattedWlanInfo->AppendL( *listBoxItem ); + CleanupStack::PopAndDestroy( listBoxItem ); + CleanupStack::PopAndDestroy( transferredData ); + } + + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsModel::FormatDurationLC +// --------------------------------------------------------------------------- +// +HBufC* CWsfConnectedDetailsModel::FormatDurationLC() + { + LOG_ENTERFN( "CWsfConnectedDetailsModel::FormatDurationLC" ); + const TUint KTimeStringLength = 64; + + if ( iIsConnActive ) + { + // if connection is still active, update the duration + TTime now; + now.UniversalTime(); + iDuration = now.MicroSecondsFrom( iStartTime ); + } + + HBufC* timeString = HBufC::NewLC( KTimeStringLength ); + TPtr16 tempBuf( timeString->Des() ); + + HBufC* temp = StringLoader::LoadLC( R_QTN_TIME_DURAT_LONG_WITH_ZERO ); + + TTime activeTime( iDuration.Int64() ); + activeTime.FormatL( tempBuf, *temp ); + CleanupStack::PopAndDestroy( temp ); + + TPtr timePtr = timeString->Des(); + AknTextUtils::DisplayTextLanguageSpecificNumberConversion( timePtr ); + + return timeString; + } + + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsModel::FormatTransferredLC +// --------------------------------------------------------------------------- +// +HBufC* CWsfConnectedDetailsModel::FormatTransferredLC() + { + LOG_ENTERFN( "CWsfConnectedDetailsModel::FormatTransferredLC" ); + +#ifndef __WINS__ + CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewL(); + + TUint uplink( 0 ); + TUint downlink( 0 ); + + if ( iIsConnActive && iConnectionId != KInvalidConnectionId ) + { + // if connection is still active, update the transmitted bytes + iConnectionMonitor.GetUintAttribute( iConnectionId, 0, KUplinkData, + uplink, waiter->iStatus ); + waiter->WaitForRequest(); + } + + if ( waiter->iStatus.Int() == KErrNone + && iIsConnActive + && iConnectionId != KInvalidConnectionId ) + { + iConnectionMonitor.GetUintAttribute( iConnectionId, 0, KDownlinkData, + downlink, waiter->iStatus ); + waiter->WaitForRequest(); + + } + + iBytesTransmitted = uplink + downlink; + delete waiter; + +#endif + + const TUint KTransferredBytesFormatBuf = 16; + const TUint KTransferredBytesWidth = 10; + const TUint KTransferredBytesDecimalPlaces = 2; + const TUint KKiloByte = 1024; + TUint resId; + + TBuf buf; + + TReal denom( KKiloByte ); + + if ( iBytesTransmitted < KKiloByte*KKiloByte ) + { + denom = KKiloByte; + resId = R_QTN_WLAN_ITEM_KB; + } + else + { + denom = KKiloByte*KKiloByte; + resId = R_QTN_WLAN_ITEM_MB; + } + + TReal value = TReal( iBytesTransmitted ) / denom; + + TRealFormat realFormat( KTransferredBytesWidth, + KTransferredBytesDecimalPlaces ); + + HBufC* number = HBufC::NewLC( KTransferredBytesWidth ); + number->Des().Num( value, realFormat ); + + _LIT( KUdFormatLarge, "%S" ); + buf.Format( KUdFormatLarge, number ); + CleanupStack::PopAndDestroy( number ); + + HBufC* loadedTxt = StringLoader::LoadLC( resId, buf, iCoeEnv ); + + + // Convert digits + TPtr loadTextPtr( loadedTxt->Des() ); + AknTextUtils::DisplayTextLanguageSpecificNumberConversion( loadTextPtr ); + + return loadedTxt; + } + + +// --------------------------------------------------------------------------- +// CWsfConnectedDetailsModel::VisibleWlans +// --------------------------------------------------------------------------- +// +TInt CWsfConnectedDetailsModel::VisibleWlans( CWsfWlanInfoArray& aArray ) + { + LOG_ENTERFN( "CWsfConnectedDetailsModel::VisibleWlans" ); + TInt i = 0; + TBool hiddenFound = EFalse; + TWsfWlanInfo* wlanInfo; + while ( i < aArray.Count() && !hiddenFound ) + { + wlanInfo = aArray[i]; + if ( wlanInfo->Hidden() && !wlanInfo->Known() ) + { + hiddenFound = ETrue; + } + else + { + ++i; + } + } + return i; + } + +// END OF FILE + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/src/wsfdetailscontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfdetailscontainer.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,388 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfDetailsContainer. +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include +#include "wsfdetailscontainer.h" +#include "wsfdetailsviewcontrollerpartner.h" +#include "wsfappui.h" +#include "wsfdetailsviewmodel.h" +#include "wsfactivetimeupdater.h" + +#include "wsflogger.h" + +// CONSTANTS +LOCAL_D const TInt KUpdateInterval = 10000000; // in micro seconds (10 sec) + + +// ======== MEMBER FUNCTIONS ======== +// --------------------------------------------------------- +// CCSnifferDetailsContainer::NewL() +// --------------------------------------------------------- +// +CWsfDetailsContainer* CWsfDetailsContainer::NewL( + const TRect& aRect, + MWsfActiveTimerHandler& aController ) + { + LOG_ENTERFN( "CWsfDetailsContainer::NewL" ); + CWsfDetailsContainer* self = CWsfDetailsContainer::NewLC( aRect, + aController ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------- +// CCSnifferDetailsContainer::NewLC() +// --------------------------------------------------------- +// +CWsfDetailsContainer* CWsfDetailsContainer::NewLC( + const TRect& aRect, + MWsfActiveTimerHandler& aController ) + { + LOG_ENTERFN( "CWsfDetailsContainer::NewLC" ); + CWsfDetailsContainer* self = new( ELeave ) CWsfDetailsContainer; + CleanupStack::PushL( self ); + self->ConstructL( aRect, aController ); + return self; + } + +// --------------------------------------------------------- +// CWsfDetailsContainer::~CCSnifferDetailsContainer +// --------------------------------------------------------- +// +CWsfDetailsContainer::~CWsfDetailsContainer() + { + LOG_ENTERFN( "CWsfDetailsContainer::~CWsfDetailsContainer" ); + PopNaviPane(); + delete iListBox; + delete iNaviDecorator; + + if( iActiveUpdater ) + { + iActiveUpdater->Stop(); + } + delete iActiveUpdater; + } + +// --------------------------------------------------------- +// CCSnifferDetailsContainer::ConstructL() +// --------------------------------------------------------- +// +void CWsfDetailsContainer::ConstructL( const TRect& aRect, + MWsfActiveTimerHandler& aController ) + { + LOG_ENTERFN( "CWsfDetailsContainer::ConstructL" ); + CreateWindowL(); + + iListBox = new( ELeave ) CAknSingleHeadingStyleListBox; + iListBox->SetContainerWindowL( *this ); + TInt flags = 0; + flags |= EAknListBoxViewerFlags | EAknListBoxDisableItemSpecificMenu; + iListBox->ConstructL( this, flags ); + iListBox->CreateScrollBarFrameL( ETrue ); + iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( + CEikScrollBarFrame::EOff, + CEikScrollBarFrame::EAuto ); + + iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray ); + + SetRect( aRect ); + + // Create and start Active Object 'Active Updater' + iActiveUpdater = CWsfActiveTimeUpdater::NewL( &aController ); + iActiveUpdater->Start( KUpdateInterval ); + + ActivateL(); + } + + +// --------------------------------------------------------- +// CWsfDetailsContainer::CConnectionMonitorUiContainer +// --------------------------------------------------------- +// +CWsfDetailsContainer::CWsfDetailsContainer() : iDetailsModel( NULL ) + { + } + +// --------------------------------------------------------- +// CWsfDetailsContainer::CConnectionMonitorUiContainer +// --------------------------------------------------------- +// +void CWsfDetailsContainer::SetDetailsModel( CWsfDetailsViewModel* aModel ) + { + iDetailsModel = aModel; + } + +// --------------------------------------------------------- +// CWsfDetailsContainer::SizeChanged() +// --------------------------------------------------------- +// +void CWsfDetailsContainer::SizeChanged() + { + iListBox->SetRect( Rect() ); + } + +// --------------------------------------------------------- +// CWsfDetailsContainer::CountComponentControls() +// --------------------------------------------------------- +// +TInt CWsfDetailsContainer::CountComponentControls() const + { + return 1; // return nbr of controls inside this container + } + +// --------------------------------------------------------- +// CWsfDetailsContainer::ComponentControl() +// --------------------------------------------------------- +// +CCoeControl* CWsfDetailsContainer::ComponentControl( TInt aIndex ) const + { + LOG_ENTERFN( "CWsfDetailsContainer::ComponentControl" ); + switch ( aIndex ) + { + case 0: + return iListBox; + default: + return NULL; + } + } + +// --------------------------------------------------------- +// CWsfDetailsContainer::OfferKeyEventL +// --------------------------------------------------------- +// +TKeyResponse CWsfDetailsContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ) + { + LOG_ENTERFN( "CWsfDetailsContainer::OfferKeyEventL" ); + TKeyResponse result = EKeyWasNotConsumed; + + if ( aType == EEventKey || aType == EEventKeyDown ) + { + result = iListBox->OfferKeyEventL( aKeyEvent, aType ); + + if ( aKeyEvent.iCode == EKeyLeftArrow ) + { + if ( iPartner ) + { + iPartner->HandleLeftKeyPressedL(); + result = EKeyWasConsumed; + } + } + else if ( aKeyEvent.iCode == EKeyRightArrow ) + { + if ( iPartner ) + { + iPartner->HandleRightKeyPressedL(); + result = EKeyWasConsumed; + } + } + else if ( aKeyEvent.iCode == EKeyOK ) + { + if ( iPartner ) + { + iPartner->HandleSelectionKeyPressedL(); + } + } + } + + return result; + } + +// --------------------------------------------------------- +// CWsfDetailsContainer::GetPanesL +// --------------------------------------------------------- +// +void CWsfDetailsContainer::GetPanesL() + { + LOG_ENTERFN( "CWsfDetailsContainer::GetPanesL" ); + if( !iNaviPane ) + { + CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); + + iNaviPane = static_cast( + statusPane->ControlL( + TUid::Uid(EEikStatusPaneUidNavi ) ) ); + } + } + +// --------------------------------------------------------- +// CWsfDetailsContainer::UpdateNaviPaneL +// --------------------------------------------------------- +// +void CWsfDetailsContainer::UpdateNaviPaneL( const TDesC& aPaneText ) + { + LOG_ENTERFN( "CWsfDetailsContainer::UpdateNaviPaneL" ); + LOG_WRITEF("UpdateNaviPaneL - aPaneTest: %S", &aPaneText ); + if ( !( ( CWsfAppUi *)( iEikonEnv->AppUi() ) )->Foreground() ) + { + return; + } + + GetPanesL(); + + if ( !iNaviDecorator ) + { + delete iNaviDecorator; + iNaviDecorator = NULL; + if( iNaviPane ) + { + iNaviDecorator = iNaviPane->CreateNavigationLabelL( aPaneText ); + iNaviPane->PushL( *iNaviDecorator ); + } + } + else + { + CAknNaviLabel* naviLabel = static_cast( + iNaviDecorator->DecoratedControl() ); + naviLabel->SetTextL( aPaneText ); + // make sure at top and redraw + iNaviPane->PushL( *iNaviDecorator ); + } + + if ( iNaviDecorator ) + { + // Set the Observer of the NaviDecorator + iNaviDecorator->SetNaviDecoratorObserver( this ); + // Show or hide the left and right arrow button + iNaviDecorator->SetScrollButtonDimmed( + CAknNavigationDecorator::ELeftButton, + iDetailsModel->FormatLeftScrollButton() ); + iNaviDecorator->SetScrollButtonDimmed( + CAknNavigationDecorator::ERightButton, + iDetailsModel->FormatRightScrollButton() ); + // Set the visibility of the buttons + iNaviDecorator->MakeScrollButtonVisible( ETrue ); + } + } + +// --------------------------------------------------------- +// CWsfDetailsContainer::UpdateListBoxL +// --------------------------------------------------------- +// +void CWsfDetailsContainer::UpdateListBoxL( MDesCArray* aItemTextArray ) + { + LOG_ENTERFN( "CWsfDetailsContainer::UpdateListBoxL" ); + for( TInt i = 0; i < aItemTextArray->MdcaCount(); i++) + { + TPtrC temp = aItemTextArray->MdcaPoint( i ); + TBuf<100> tempElement = temp; + LOG_WRITEF( "aItemTextArray: %S", &tempElement ); + } + + iListBox->Reset(); + iListBox->Model()->SetItemTextArray( aItemTextArray ); + iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + iListBox->HandleItemAdditionL(); + } + +// --------------------------------------------------------- +// CWsfDetailsContainer::SetPartner +// --------------------------------------------------------- +// +void CWsfDetailsContainer::SetPartner( + MWsfDetailsViewControllerPartner& aPartner ) + { + iPartner = &aPartner; + } + +// --------------------------------------------------------- +// CWsfDetailsContainer::PopNaviPane +// --------------------------------------------------------- +// +void CWsfDetailsContainer::PopNaviPane() + { + LOG_ENTERFN( "CWsfDetailsContainer::PopNaviPane" ); + if ( iNaviPane && iNaviDecorator ) + { + iNaviPane->Pop( iNaviDecorator ); + delete iNaviDecorator; + iNaviDecorator = NULL; + } + } + + +// --------------------------------------------------------- +// CCSnifferDetailsContainer::HandleResourceChange +// --------------------------------------------------------- +// +void CWsfDetailsContainer::HandleResourceChange( TInt aType ) + { + LOG_ENTERFN( "CWsfDetailsContainer::HandleResourceChange" ); + CCoeControl::HandleResourceChange( aType ); + if( aType == KEikDynamicLayoutVariantSwitch ) + { + TRect mainPaneRect; + AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, + mainPaneRect ); + SetRect( mainPaneRect ); + DrawNow(); + } + } + +// --------------------------------------------------------- +// CWsfDetailsContainer::FocusChanged +// --------------------------------------------------------- +// +void CWsfDetailsContainer::FocusChanged( TDrawNow aDrawNow ) + { + LOG_ENTERFN( "CWsfDetailsContainer::FocusChanged" ); + CCoeControl::FocusChanged( aDrawNow ); + if( iListBox ) + { + iListBox->SetFocus( IsFocused() ); + } + } + +// -------------------------------------------------------------------------- +// CWsfDetailsContainer::HandleNaviDecoratorEventL +// -------------------------------------------------------------------------- +// +void CWsfDetailsContainer::HandleNaviDecoratorEventL( TInt aEventID ) + { + LOG_ENTERFN( "CWsfDetailsContainer::HandleNaviDecoratorEventL" ); + if ( AknLayoutUtils::PenEnabled() ) + { + switch ( aEventID ) + { + case EAknNaviDecoratorEventRightTabArrow: + { + if( iPartner && !iDetailsModel->FormatRightScrollButton() ) + { + iPartner->HandleRightKeyPressedL(); + } + break; + } + case EAknNaviDecoratorEventLeftTabArrow: + { + if( iPartner && !iDetailsModel->FormatLeftScrollButton() ) + { + iPartner->HandleLeftKeyPressedL(); + } + break; + } + default: + return; + } + } + } + +// End of File + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/src/wsfdetailsview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfdetailsview.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,183 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: view class +* +* +*/ + + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "wsfdetailsview.h" +#include "wsfdetailscontainer.h" +#include "wsfdetailsviewmodel.h" +#include "wsfmainapplication.hrh" +#include "wsfappui.h" +#include "wsfdetailscontainerif.h" + +#include "wsflogger.h" + + + +// ================= MEMBER FUNCTIONS ======================= + + +// --------------------------------------------------------- +// CWsfDetailsView* CWsfDetailsView::NewL() +// --------------------------------------------------------- +// +CWsfDetailsView* CWsfDetailsView::NewL() + { + LOG_ENTERFN( "CWsfDetailsView::NewL" ); + CWsfDetailsView* self = CWsfDetailsView::NewLC(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------- +// CWsfDetailsView* CWsfDetailsView::NewLC() +// --------------------------------------------------------- +// +CWsfDetailsView* CWsfDetailsView::NewLC() + { + LOG_ENTERFN( "CWsfDetailsView::NewLC" ); + CWsfDetailsView* self = new (ELeave) CWsfDetailsView(); + CleanupStack::PushL(self); + self->ConstructL( ); + return self; + } + + +// --------------------------------------------------------- +// CWsfDetailsView::CWsfDetailsView() +// --------------------------------------------------------- +// +CWsfDetailsView::CWsfDetailsView() : CAknView() + { + } + +// --------------------------------------------------------- +// CWsfDetailsView::ConstructL() +// --------------------------------------------------------- +// +void CWsfDetailsView::ConstructL() + { + LOG_ENTERFN( "CWsfDetailsView::ConstructL" ); + BaseConstructL( R_SNIFFER_DETAILSVIEW ); + iModel = CWsfDetailsViewModel::NewL(); + iController.SetModel( iModel ); + } + +// --------------------------------------------------------- +// CWsfDetailsView::~CWsfDetailsView() +// --------------------------------------------------------- +// +CWsfDetailsView::~CWsfDetailsView() + { + LOG_ENTERFN( "CWsfDetailsView::~CWsfDetailsView" ); + delete iContainer; + delete iModel; + } + +// --------------------------------------------------------- +// CWsfDetailsView::Id() +// --------------------------------------------------------- +// +TUid CWsfDetailsView::Id() const + { + return TUid::Uid( EDetailsViewId ); + } + +// --------------------------------------------------------- +// CWsfDetailsView::HandleCommandL() +// --------------------------------------------------------- +// +void CWsfDetailsView::HandleCommandL( TInt aCommand ) + { + LOG_ENTERFN( "CWsfDetailsView::HandleCommandL" ); + switch ( aCommand ) + { + case EAknSoftkeyOk: + { + iController.HandleSelectionKeyPressedL(); + AppUi()->HandleCommandL( ESnifferCmdShowWlans ); + break; + } + default: + { + AppUi()->HandleCommandL( aCommand ); + break; + } + } + } + +// --------------------------------------------------------- +// CWsfDetailsView::Controller +// --------------------------------------------------------- +// +MWsfDetailsViewControllerIf& CWsfDetailsView::Controller() + { + return iController; + } + +// --------------------------------------------------------- +// CWsfDetailsView::DoActivateL() +// --------------------------------------------------------- +// +void CWsfDetailsView::DoActivateL( const TVwsViewId& /*aPrevViewId*/, + TUid /*aCustomMessageId*/, + const TDesC8& /*aCustomMessage*/ ) + { + LOG_ENTERFN( "CWsfDetailsView::DoActivateL" ); + if( !iContainer ) + { + iContainer = CWsfDetailsContainer::NewL( ClientRect(), + iController ); + iContainer->SetMopParent( this ); + AppUi()->AddToViewStackL( *this, iContainer ); + iContainer->SetPartner( iController ); + iContainer->SetDetailsModel( iModel ); + iContainer->MakeVisible( ETrue ); + iController.SetContainer( iContainer ); + iController.RefreshL(); + } + } + +// --------------------------------------------------------- +// CWsfDetailsView::DoDeactivate +// --------------------------------------------------------- +// +void CWsfDetailsView::DoDeactivate() + { + LOG_ENTERFN( "CWsfDetailsView::DoDeactivate" ); + AppUi()->RemoveFromViewStack( *this, iContainer ); + iContainer->MakeVisible( EFalse ); + delete iContainer; + iContainer = NULL; + iController.SetContainer( NULL ); + } + +// --------------------------------------------------------- +// CWsfDetailsView::HandleListBoxEventL +// --------------------------------------------------------- +// +void CWsfDetailsView::HandleListBoxEventL( CEikListBox* /*aListBox*/, + TListBoxEvent /*aEventType*/ ) + { + } + +// End of File diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/src/wsfdetailsviewcontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfdetailsviewcontroller.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,245 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 TWsfDetailsViewController. +* +*/ + +// CLASS HEADER +#include "wsfdetailsviewcontroller.h" + +// EXTERNAL INCLUDES + +// INTERNAL INCLUDES +#include "wsfdetailscontainer.h" +#include "wsfdetailsviewmodel.h" +#include "wsfdetailsviewpartner.h" +#include "wsfwlaninfo.h" +#include "wsfwlaninfoarray.h" + +#include "wsflogger.h" + +// LOCAL DEFINITIONS +#ifdef _DEBUG + _LIT( KDetailsViewControllerPanic, "TWsfDetailsViewController" ); + #define _ASSERTD( cond ) __ASSERT_DEBUG( (cond), \ + User::Panic( KDetailsViewControllerPanic, __LINE__) ) +#else + #define _ASSERTD( cond ) {} +#endif //_DEBUG + +// --------------------------------------------------------------------------- +// TWsfDetailsViewController::SetModel +// --------------------------------------------------------------------------- +// +void TWsfDetailsViewController::SetModel( CWsfDetailsViewModel* aModel ) + { + iModel = aModel; + } + +// --------------------------------------------------------------------------- +// TWsfDetailsViewController::SetContainer +// --------------------------------------------------------------------------- +// +void TWsfDetailsViewController::SetContainer( + MWsfDetailsContainerIf* aContainer ) + { + iContainer = aContainer; + } + +// --------------------------------------------------------------------------- +// TWsfDetailsViewController::SetWlanListL +// --------------------------------------------------------------------------- +// +void TWsfDetailsViewController::SetWlanListL( + CWsfWlanInfoArray* aWlanArray, + const TDesC8& aSelectedWlanSsid ) + { + LOG_ENTERFN( "TWsfDetailsViewController::SetWlanListL" ); + _ASSERTD( aWlanArray ); + + //Get selected Wlan info + TWsfWlanInfo* info = aWlanArray->Match( aSelectedWlanSsid, + aWlanArray->Count() ); + + CDesCArray* formattadList = NULL; + + // If wlan info found + if( info ) + { + // Update model + formattadList = iModel->FormatWlanInfoL( info, aWlanArray ); + } + + // if view active && and something to show + if( iContainer && formattadList ) + { + //Draw view + iContainer->UpdateListBoxL( formattadList ); + } + + HandlePaneTextUpdateL(); + } + +// --------------------------------------------------------------------------- +// TWsfDetailsViewController::WlanListChangedL +// --------------------------------------------------------------------------- +// +void TWsfDetailsViewController::WlanListChangedL( + CWsfWlanInfoArray* aWlanArray ) + { + LOG_ENTERFN( "TWsfDetailsViewController::WlanListChangedL" ); + _ASSERTD( aWlanArray ); + + _ASSERTD( iModel ); + + //Get selected Wlan info + TWsfWlanInfo* info = aWlanArray->Match( iModel->WlanSsid(), + aWlanArray->Count() ); + //If view active + if( iContainer ) + { + CDesCArray* formattadList = NULL; + + //Current info found from new list + if( info ) + { + // Update model + formattadList = iModel->FormatWlanInfoL( info, aWlanArray ); + HandlePaneTextUpdateL(); + } + + // Current Wlan has been dropped + else + { + // Update model get no signal list and dont update pane text + formattadList = iModel->FormatWlanInfoL( NULL, aWlanArray ); + } + + //Draw view + iContainer->UpdateListBoxL( formattadList ); + HandlePaneTextUpdateL(); + } + } + +// --------------------------------------------------------------------------- +// TWsfDetailsViewController::RefreshL +// --------------------------------------------------------------------------- +// +void TWsfDetailsViewController::RefreshL( ) + { + LOG_ENTERFN( "TWsfDetailsViewController::RefreshL" ); + _ASSERTD( iModel ); + + if ( iContainer ) + { + CDesCArray* formattedDetails = iModel->GetWlanDetails(); + iContainer->UpdateListBoxL( formattedDetails ); + HandlePaneTextUpdateL(); + } + } + +// --------------------------------------------------------------------------- +// TWsfDetailsViewController::SetPartner +// --------------------------------------------------------------------------- +// + void TWsfDetailsViewController::SetPartner( MWsfDetailsViewPartner& aPartner ) + { + iPartner = &aPartner; + } + + + // --------------------------------------------------------------------------- + // TWsfDetailsViewController::HandleLeftKeyPressedL + // --------------------------------------------------------------------------- + // +void TWsfDetailsViewController::HandleLeftKeyPressedL() + { + LOG_ENTERFN( "TWsfDetailsViewController::HandleLeftKeyPressedL" ); + _ASSERTD( iModel ); + + if( iContainer ) + { + CDesCArray* formattadList = iModel->FormatPreviousWlanInfoL(); + iContainer->UpdateListBoxL( formattadList ); + HandlePaneTextUpdateL(); + } + } + +// --------------------------------------------------------------------------- +// TWsfDetailsViewController::HandleRightKeyPressedL +// --------------------------------------------------------------------------- +// +void TWsfDetailsViewController::HandleRightKeyPressedL() + { + LOG_ENTERFN( "TWsfDetailsViewController::HandleRightKeyPressedL" ); + _ASSERTD( iModel ); + + if( iContainer ) + { + CDesCArray* formattadList = iModel->FormatNextWlanInfoL(); + iContainer->UpdateListBoxL( formattadList ); + HandlePaneTextUpdateL(); + } + } + +// --------------------------------------------------------------------------- +// TWsfDetailsViewController::HandleSelectionKeyPressedL +// --------------------------------------------------------------------------- +// +void TWsfDetailsViewController::HandleSelectionKeyPressedL() + { + LOG_ENTERFN( "TWsfDetailsViewController::HandleSelectionKeyPressedL" ); + if ( iPartner ) + { + iPartner->CloseDetailsViewL(); + } + } + +// --------------------------------------------------------------------------- +// TWsfDetailsViewController::HandlePaneTextUpdateL +// --------------------------------------------------------------------------- +// +void TWsfDetailsViewController::HandlePaneTextUpdateL() + { + LOG_ENTERFN( "TWsfDetailsViewController::HandlePaneTextUpdateL" ); + _ASSERTD( iModel ); + + if( iContainer ) + { + HBufC* paneText = iModel->FormatPaneTextLC(); + TPtr temp( paneText->Des() ); + AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp ); + iContainer->UpdateNaviPaneL( *paneText ); + CleanupStack::PopAndDestroy( paneText ); + } + } + +// --------------------------------------------------------------------------- +// void TWsfDetailsViewController::UpdateActiveTimeL +// --------------------------------------------------------------------------- +// +void TWsfDetailsViewController::UpdateActiveTimeL() + { + LOG_ENTERFN( "TWsfDetailsViewController::UpdateActiveTimeL" ); + if ( iPartner ) + { + iPartner->DetailsScanL(); + } + } + +// End of file + + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/src/wsfdetailsviewmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfdetailsviewmodel.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,721 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfDetailsViewModel. +* +*/ + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include "wsfwlaninfo.h" +#include "wsfdetailsviewmodel.h" +#include "wsfwlaninfoarray.h" +#include "wsflogger.h" + +// LOCAL DEFINITIONS +using namespace CMManager; + +#ifdef _DEBUG + _LIT( KDetailsViewModelPanic, "CWsfDetailsViewModel" ); + #define _ASSERTD( cond ) __ASSERT_DEBUG( (cond), \ + User::Panic( KDetailsViewModelPanic, __LINE__) ) +#else + #define _ASSERTD( cond ) {} +#endif //_DEBUG + +// the size of the Details Listbox's array +const TInt KWlanInfoGranularity = 8; +// the size of the numbers in the NaviPane +const TInt KNumberLegth = 5; +// Listbox elements format string +_LIT( KListItemFormat, "%S\t%S" ); +// NaviPane elements format string +_LIT( KPaneFormater, "%i/%i" ); + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::CWsfDetailsViewModel() +// --------------------------------------------------------------------------- +// +CWsfDetailsViewModel::CWsfDetailsViewModel():iCoeEnv( CCoeEnv::Static() ) + { + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::ConstructL() +// --------------------------------------------------------------------------- +// +void CWsfDetailsViewModel::ConstructL() + { + LOG_ENTERFN( "CWsfDetailsViewModel::ConstructL" ); + iFormattedWlanInfo = new (ELeave) CDesCArrayFlat( KWlanInfoGranularity ); + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CWsfDetailsViewModel* CWsfDetailsViewModel::NewL() + { + LOG_ENTERFN( "CWsfDetailsViewModel::NewL" ); + CWsfDetailsViewModel* self = CWsfDetailsViewModel::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CWsfDetailsViewModel* CWsfDetailsViewModel::NewLC() + { + LOG_ENTERFN( "CWsfDetailsViewModel::NewLC" ); + CWsfDetailsViewModel* self = new( ELeave ) CWsfDetailsViewModel; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::~CWsfDetailsViewModel() +// --------------------------------------------------------------------------- +// +CWsfDetailsViewModel::~CWsfDetailsViewModel() + { + LOG_ENTERFN( "CWsfDetailsViewModel::~CWsfDetailsViewModel" ); + delete iFormattedWlanInfo; + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::FormatWlanInfoL() +// --------------------------------------------------------------------------- +// +CDesCArrayFlat* CWsfDetailsViewModel::FormatWlanInfoL( + TWsfWlanInfo* aWlanInfo, + CWsfWlanInfoArray* aWlanArray ) + { + LOG_ENTERFN( "CWsfDetailsViewModel::FormatWlanInfoL" ); + _ASSERTD( aWlanArray ); + + for( TInt i = 0; i < iFormattedWlanInfo->MdcaCount(); i++) + { + TPtrC temp = iFormattedWlanInfo->MdcaPoint( i ); + TBuf<100> tempElement = temp; + LOG_WRITEF( "(1)iFormattedWlanInfo: %S", &tempElement ); + } + + iWlanArray = aWlanArray; + iFormattedWlanInfo->Reset(); + + TInt visibleWlans = VisibleWlans( *iWlanArray ); + if ( aWlanInfo && visibleWlans ) + { + iWlanInfo = *aWlanInfo; + TWsfWlanInfo* temp = iWlanArray->Match( aWlanInfo->iSsid, + visibleWlans ); + if ( temp ) + { + iIndex = iWlanArray->GetArrayIndex( temp ); + } + else + { + iIndex = iWlanArray->GetArrayIndex( &iWlanInfo ); + } + + // create array of not-connected WLAN data + FormatAndAppenWlanIapNameL(); + FormatAndAppenWlanSsidL(); + FormatAndAppenSingnalL(); + FormatAndAppenModeL(); + FormatAndAppenSecurityL(); + FormatAndAppenCoverageL(); + FormatAndAppenSpeedL(); + } + else if ( !aWlanInfo )// Current Wlan info has no signal + { + iWlanInfo.iStrengthLevel = EWlanSignalUnavailable; + FormatAndAppenWlanIapNameL(); + FormatAndAppenWlanSsidL(); + FormatAndAppenSingnalL(); + } + + for( TInt i = 0; i < iFormattedWlanInfo->MdcaCount(); i++) + { + TPtrC temp = iFormattedWlanInfo->MdcaPoint( i ); + TBuf<100> tempElement = temp; + LOG_WRITEF( "(2)iFormattedWlanInfo: %S", &tempElement ); + } + + return iFormattedWlanInfo; + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::FormatNextWlanInfoL() +// --------------------------------------------------------------------------- +// + +CDesCArrayFlat* CWsfDetailsViewModel::FormatNextWlanInfoL() + { + LOG_ENTERFN( "CWsfDetailsViewModel::FormatNextWlanInfoL" ); + _ASSERTD( iWlanArray ); + + TInt visibleWlans = VisibleWlans( *iWlanArray ); + + if( iIndex < visibleWlans - 1 ) + { + iFormattedWlanInfo->Reset(); + iIndex++; + + if( iIndex >= visibleWlans - 1 ) + { + // Set the index to point to the last visible in the array. + iIndex = visibleWlans - 1; + } + else if ( iWlanInfo.SignalStrength() == ENoSignal ) + { + iIndex = 0; + } + + // (Array bounds check is done in the first if sentence.) + iWlanInfo = *(iWlanArray->At( iIndex ) ); + FormatAndAppenWlanIapNameL(); + FormatAndAppenWlanSsidL(); + FormatAndAppenSingnalL(); + FormatAndAppenModeL(); + FormatAndAppenSecurityL(); + FormatAndAppenCoverageL(); + FormatAndAppenSpeedL(); + } + + return iFormattedWlanInfo; + } + + + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::FormatPreviousWlanInfoL() +// --------------------------------------------------------------------------- +// + +CDesCArrayFlat* CWsfDetailsViewModel::FormatPreviousWlanInfoL() + { + LOG_ENTERFN( "CWsfDetailsViewModel::FormatPreviousWlanInfoL" ); + _ASSERTD( iWlanArray ); + + if( VisibleWlans( *iWlanArray ) ) + { + iFormattedWlanInfo->Reset(); + iIndex--; + + if ( iIndex < 0 || iWlanInfo.SignalStrength() == ENoSignal ) + { + iIndex = 0; + } + + // Just in case the iIndex would somehow point out of iWlanArray... + if( iIndex >= (TInt)iWlanArray->Count() ) + { + iIndex = 0; + } + iWlanInfo = *(iWlanArray->At( iIndex ) ); + FormatAndAppenWlanIapNameL(); + FormatAndAppenWlanSsidL(); + FormatAndAppenSingnalL(); + FormatAndAppenModeL(); + FormatAndAppenSecurityL(); + FormatAndAppenCoverageL(); + FormatAndAppenSpeedL(); + } + return iFormattedWlanInfo; + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::FormatPaneTextLC() +// --------------------------------------------------------------------------- +// +HBufC* CWsfDetailsViewModel::FormatPaneTextLC() + { + LOG_ENTERFN( "CWsfDetailsViewModel::FormatPaneTextLC" ); + + HBufC* paneText = NULL; + + if ( iWlanInfo.SignalStrength() == ENoSignal ) + { + paneText = KNullDesC().AllocLC(); + } + else + { + TInt visibleWlans = VisibleWlans( *iWlanArray ); + if( visibleWlans ) + { + paneText = HBufC::NewLC( KPaneFormater().Length() + + KNumberLegth + + KNumberLegth ); + + TPtr paneTextPrt = paneText->Des(); + + // Format string ( KListItemFormat = %i/%i ) + paneTextPrt.Format( KPaneFormater, + iIndex + 1, + visibleWlans ); + } + else + { + paneText = KNullDesC().AllocLC(); + } + } + + return paneText; + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::FormatLeftScrollButton() +// --------------------------------------------------------------------------- +// +TBool CWsfDetailsViewModel::FormatLeftScrollButton() + { + LOG_ENTERFN( "CWsfDetailsViewModel::FormatLeftScrollButton" ); + TBool leftButton( EFalse ); + + if ( iIndex == 0 ) + { + leftButton = ETrue; + } + + return leftButton; + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::FormatRightScrollButton() +// --------------------------------------------------------------------------- +// +TBool CWsfDetailsViewModel::FormatRightScrollButton() + { + LOG_ENTERFN( "CWsfDetailsViewModel::FormatRightScrollButton" ); + TBool rightButton( EFalse ); + TInt count = iWlanArray->Count(); + + if ( iIndex + 1 >= count ) + { + rightButton = ETrue; + } + + return rightButton; + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::GetWlanDetails() +// --------------------------------------------------------------------------- +// +CDesCArrayFlat* CWsfDetailsViewModel::GetWlanDetails() + { + return iFormattedWlanInfo; + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::WlanSsid() +// --------------------------------------------------------------------------- +// +const TDesC8& CWsfDetailsViewModel::WlanSsid() const + { + return iWlanInfo.iSsid; + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::FormatListBoxItemLC +// --------------------------------------------------------------------------- +// +HBufC* CWsfDetailsViewModel::FormatListBoxItemLC( + const TUint aResourceId, + const TDesC& aValueText ) const + { + LOG_ENTERFN( "CWsfDetailsViewModel::FormatListBoxItemLC" ); + // hold the column name on list item + HBufC* columnName = NULL; + + if ( aResourceId ) + { + columnName = StringLoader::LoadLC( aResourceId ); + } + else + { + columnName = KNullDesC().AllocLC(); + } + + + // Holds the list box item + HBufC* listBoxItem = HBufC::NewL( KListItemFormat().Length()+ + columnName->Length() + + aValueText.Length() ); + + // For formating needs + TPtr listBoxItemPrt = listBoxItem->Des(); + + // Format string ( KListItemFormat = %S\t%S ) + listBoxItemPrt.Format( KListItemFormat, columnName, &aValueText ); + CleanupStack::PopAndDestroy( columnName ); + CleanupStack::PushL( listBoxItem ); + return listBoxItem; + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::FormatAndAppenWlanIapNameL() +// --------------------------------------------------------------------------- +// +void CWsfDetailsViewModel::FormatAndAppenWlanIapNameL() + { + LOG_ENTERFN( "CWsfDetailsViewModel::FormatAndAppenWlanIapNameL" ); + if ( iWlanInfo.iNetworkName.Length() ) + { + HBufC* wlanIapName = iWlanInfo.GetIapNameAsUnicodeLC(); + HBufC* listBoxItem = FormatListBoxItemLC( + R_QTN_CMON_HEADING_CONN_NAME, + *wlanIapName ); + + iFormattedWlanInfo->AppendL( *listBoxItem ); + CleanupStack::PopAndDestroy( listBoxItem ); + CleanupStack::PopAndDestroy( wlanIapName ); + } + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::FormatAndAppenWlanSsidL() +// --------------------------------------------------------------------------- +// +void CWsfDetailsViewModel::FormatAndAppenWlanSsidL() + { + LOG_ENTERFN( "CWsfDetailsViewModel::FormatAndAppenWlanSsidL" ); + HBufC* wlanSsid = iWlanInfo.GetSsidAsUnicodeLC(); + HBufC* listBoxItem = FormatListBoxItemLC( + R_QTN_SNIFFER_HEADING_WLAN_NETWORK_NAME, + *wlanSsid ); + + iFormattedWlanInfo->AppendL( *listBoxItem ); + CleanupStack::PopAndDestroy( listBoxItem ); + CleanupStack::PopAndDestroy( wlanSsid ); + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::FormatAndAppenSingnalL() +// --------------------------------------------------------------------------- +// +void CWsfDetailsViewModel::FormatAndAppenSingnalL() + { + LOG_ENTERFN( "CWsfDetailsViewModel::FormatAndAppenSingnalL" ); + HBufC* singnalStrength = FormatSingnalStrenghtLC(); + HBufC* listBoxItem = FormatListBoxItemLC( + R_QTN_SNIFFER_HEADING_WLAN_SIGNAL_STRENGTH, + *singnalStrength ); + + iFormattedWlanInfo->AppendL( *listBoxItem ); + CleanupStack::PopAndDestroy( listBoxItem ); + CleanupStack::PopAndDestroy( singnalStrength ); + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::FormatAndAppenModeL() +// --------------------------------------------------------------------------- +// +void CWsfDetailsViewModel::FormatAndAppenModeL() + { + LOG_ENTERFN( "CWsfDetailsViewModel::FormatAndAppenModeL" ); + HBufC* mode = FormatModeLC(); + HBufC* listBoxItem = FormatListBoxItemLC( + R_QTN_SNIFFER_HEADING_WLAN_NETWORK_MODE, + *mode ); + + iFormattedWlanInfo->AppendL( *listBoxItem ); + CleanupStack::PopAndDestroy( listBoxItem ); + CleanupStack::PopAndDestroy( mode ); + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::FormatAndAppenSecurityL() +// --------------------------------------------------------------------------- +// +void CWsfDetailsViewModel::FormatAndAppenSecurityL() + { + LOG_ENTERFN( "CWsfDetailsViewModel::FormatAndAppenSecurityL" ); + HBufC* security = FormatSecurityLC(); + HBufC* listBoxItem = FormatListBoxItemLC( + R_QTN_SNIFFER_HEADING_WLAN_SECURITY_MODE, + *security ); + + iFormattedWlanInfo->AppendL( *listBoxItem ); + CleanupStack::PopAndDestroy( listBoxItem ); + CleanupStack::PopAndDestroy( security ); + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::FormatAndAppenCoverageL() +// --------------------------------------------------------------------------- +// +void CWsfDetailsViewModel::FormatAndAppenCoverageL() + { + LOG_ENTERFN( "CWsfDetailsViewModel::FormatAndAppenCoverageL" ); + HBufC* coverage = FormatCoverageLC(); + HBufC* listBoxItem = FormatListBoxItemLC( + R_QTN_SNIFFER_HEADING_WLAN_NW_AP_AMOUNT, + *coverage ); + + iFormattedWlanInfo->AppendL( *listBoxItem ); + CleanupStack::PopAndDestroy( listBoxItem ); + CleanupStack::PopAndDestroy( coverage ); + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::FormatAndAppenSpeedL() +// --------------------------------------------------------------------------- +// +void CWsfDetailsViewModel::FormatAndAppenSpeedL() + { + LOG_ENTERFN( "CWsfDetailsViewModel::FormatAndAppenSpeedL" ); + HBufC* speed = FormatTechnologyLC(); + HBufC* listBoxItem = FormatListBoxItemLC( + R_QTN_SNIFFER_HEADING_WLAN_NW_MAX_RATE, + *speed ); + + iFormattedWlanInfo->AppendL( *listBoxItem ); + CleanupStack::PopAndDestroy( listBoxItem ); + CleanupStack::PopAndDestroy( speed ); + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::FormatSingnalStrenghtLC() +// --------------------------------------------------------------------------- +// +HBufC* CWsfDetailsViewModel::FormatSingnalStrenghtLC() + { + LOG_ENTERFN( "CWsfDetailsViewModel::FormatSingnalStrenghtLC" ); + // Holds the showed signal strenth string + HBufC* singnalStrengthString = NULL; + + // Get string + switch( iWlanInfo.SignalStrength() ) + { + case ENoSignal: + { + singnalStrengthString = StringLoader::LoadLC( + R_QTN_SNIFFER_WLAN_SIGNAL_STRENGTH_NO_SIGNAL, iCoeEnv ); + break; + } + case EPoor: + { + singnalStrengthString = StringLoader::LoadLC ( + R_QTN_SNIFFER_WLAN_SIGNAL_STRENGTH_LOW, + iWlanInfo.SignalStrengthPercentage(), + iCoeEnv ); + break; + } + case EAverage: + { + singnalStrengthString = StringLoader::LoadLC ( + R_QTN_SNIFFER_WLAN_SIGNAL_STRENGTH_MEDIUM, + iWlanInfo.SignalStrengthPercentage(), + iCoeEnv ); + break; + } + case EExcelent: + { + singnalStrengthString = StringLoader::LoadLC ( + R_QTN_SNIFFER_WLAN_SIGNAL_STRENGTH_STRONG, + iWlanInfo.SignalStrengthPercentage(), + iCoeEnv ); + break; + } + default: + { + return KNullDesC().AllocLC(); + } + + } + return singnalStrengthString; + } + +// --------------------------------------------------------- +// CWsfDetailsViewModel::FormatModeLC +// --------------------------------------------------------- +// +HBufC* CWsfDetailsViewModel::FormatModeLC() + { + LOG_ENTERFN( "CWsfDetailsViewModel::FormatModeLC" ); + TInt resourceId(0); + + switch( iWlanInfo.iNetMode ) + { + case EAdhoc: + { + resourceId = R_QTN_SNIFFER_WLAN_SETT_NEWTWORK_MODE_ADHOC; + break; + } + + case EInfra: + { + resourceId = R_QTN_SNIFFER_WLAN_SETT_NEWTWORK_MODE_INFRA; + break; + } + default: + { + return KNullDesC().AllocLC(); + } + + } + + return StringLoader::LoadLC( resourceId ); + } + +// --------------------------------------------------------- +// CWsfDetailsViewModel::FormatSecurityLC +// --------------------------------------------------------- +// +HBufC* CWsfDetailsViewModel::FormatSecurityLC() + { + LOG_ENTERFN( "CWsfDetailsViewModel::FormatSecurityLC" ); + TInt resourceId(0); + + switch( iWlanInfo.iSecurityMode ) + { + + case EWlanSecModeOpen: + { + resourceId = R_QTN_SNIFFER_WLAN_SETT_SECURITY_MODE_OPEN; + break; + } + case EWlanSecModeWep: + { + resourceId = R_QTN_SNIFFER_WLAN_SETT_SECURITY_MODE_WEP; + break; + } + case EWlanSecMode802_1x: + { + resourceId = R_QTN_SNIFFER_WLAN_SETT_SECURITY_MODE_802_1X; + break; + } + case EWlanSecModeWpa: + case EWlanSecModeWpa2: + { + resourceId = R_QTN_SNIFFER_WLAN_SETT_SECURITY_MODE_WPA; + break; + } + case EWlanSecModeWAPI: + { + resourceId = R_QTN_SNIFFER_WLAN_SETT_SECURITY_MODE_WAPI; + break; + } + default: + { + return KNullDesC().AllocLC(); + } + } + + return StringLoader::LoadLC( resourceId ); + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::FormatCoverageLC +// --------------------------------------------------------------------------- +// +HBufC* CWsfDetailsViewModel::FormatCoverageLC() + { + LOG_ENTERFN( "CWsfDetailsViewModel::FormatCoverageLC" ); + if ( iWlanInfo.iCoverage == 1) + { + return StringLoader::LoadLC( + R_QTN_SNIFFER_WLAN_AP_AMOUNT_IN_RANGE, iCoeEnv ); + } + else + { + return StringLoader::LoadLC( + R_QTN_SNIFFER_WLAN_AP_AMOUNT_IN_RANGE_MANY, + iWlanInfo.iCoverage, iCoeEnv ); + } + } + +// --------------------------------------------------------- +// CWsfDetailsViewModel::FormatTechnologyLC +// --------------------------------------------------------- +// +HBufC* CWsfDetailsViewModel::FormatTechnologyLC() + { + LOG_ENTERFN( "CWsfDetailsViewModel::FormatTechnologyLC" ); + TInt resourceId( 0 ); + + switch( iWlanInfo.iTransferRate ) + { + + case 1: + { + resourceId = R_QTN_SNIFFER_WLAN_SETT_TECHNOLOGY_802_11B; + break; + } + case 2: + { + resourceId = R_QTN_SNIFFER_WLAN_SETT_TECHNOLOGY_802_11G; + break; + } + case 4: + { + resourceId = R_QTN_SNIFFER_WLAN_SETT_TECHNOLOGY_802_11BG; + break; + } + case 8: + { + resourceId = R_QTN_SNIFFER_WLAN_SETT_TECHNOLOGY_802_11N; + break; + } + default: + { + return KNullDesC().AllocLC(); + } + } + + return StringLoader::LoadLC( resourceId ); + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::VisibleWlans +// --------------------------------------------------------------------------- +// +TInt CWsfDetailsViewModel::VisibleWlans( CWsfWlanInfoArray& aArray ) + { + LOG_ENTERFN( "CWsfDetailsViewModel::VisibleWlans" ); + TUint i = 0; + TWsfWlanInfo* wlanInfo; + LOG_WRITEF( "Number of Wlans: %d", aArray.Count() ); + // The hidden WLAN should be in the end of the aArray. + while ( i < aArray.Count() ) + { + wlanInfo = aArray[i]; + if ( wlanInfo->Hidden() && !wlanInfo->Known() ) + { + break; // Hidden was found. Break to exit the while-loop. + } + ++i; + } + + LOG_WRITEF( "VisibleWlans: %d", i ); + return i; + } + +// END OF FILE + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/src/wsfdocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfdocument.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfDocument. +* +*/ + +#include +#include "wsfappui.h" +#include "wsfdocument.h" +#include "wsfwlaninfoarrayvisitor.h" + +#include "wsfmodel.h" + + +// --------------------------------------------------------------------------- +// CCWsfDocument::NewL +// --------------------------------------------------------------------------- +// +CWsfDocument* CWsfDocument::NewL( CEikApplication& aApp ) + { + CWsfDocument* self = NewLC( aApp ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CCWsfDocument::NewLC +// --------------------------------------------------------------------------- +// +CWsfDocument* CWsfDocument::NewLC( CEikApplication& aApp ) + { + CWsfDocument* self = new ( ELeave ) CWsfDocument( aApp ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CCWsfDocument::ConstructL +// --------------------------------------------------------------------------- +// +void CWsfDocument::ConstructL() + { + iModel = CWsfModel::NewL( iMainController, EFalse ); + iModel->SetEngineObserver( &iMainController ); + iWlanInfoBranding = CWsfWlanInfoArrayVisitor::NewL( EFalse ); + iWlanInfoBranding->LoadFilterDefinitionsL(); + } + +// --------------------------------------------------------------------------- +// CCWsfDocument::CWsfDocument +// --------------------------------------------------------------------------- +// +CWsfDocument::CWsfDocument( CEikApplication& aApp ) : CAknDocument( aApp ) + { + // no implementation required + } + +// --------------------------------------------------------------------------- +// CCWsfDocument::~CWsfDocument +// --------------------------------------------------------------------------- +// +CWsfDocument::~CWsfDocument() + { + delete iWlanInfoBranding; + delete iModel; + } + +// --------------------------------------------------------------------------- +// CCWsfDocument::CreateAppUiL +// --------------------------------------------------------------------------- +// +CEikAppUi* CWsfDocument::CreateAppUiL() + { + // Create the application user interface, and return a pointer to it, + // the framework takes ownership of this object + CWsfAppUi* appUi = new ( ELeave ) CWsfAppUi; + appUi->SetUiObserver( &iMainController ); + + // Give references to main controller. + iMainController.Initialize( *appUi, *iModel, *iWlanInfoBranding ); + + return appUi; + } + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/src/wsfentrypoint.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfentrypoint.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 E32Main. +* +*/ + +#include +#include "wsfapplication.h" + + +// --------------------------------------------------------------------------- +// NewApplication +// Create an application, and return a pointer to it +// --------------------------------------------------------------------------- +// +CApaApplication* NewApplication() + { + return new CWsfApplication; + } + +// --------------------------------------------------------------------------- +// E32Main +// --------------------------------------------------------------------------- +// +TInt E32Main() + { + return EikStart::RunApplication( NewApplication ); + } + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/src/wsfmaincontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfmaincontroller.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,921 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 TWsfMainController. +* +*/ + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include + +#include + +// CLASS HEADER +#include "wsfmaincontroller.h" + +// INTERNAL INCLUDES +#include "wsfmodel.h" +#include "wsfwlaninfo.h" +#include "wsfwlaninfoarray.h" +#include "wsfappui.h" +#include "wsfmainviewcontrollerif.h" +#include "wsfdetailsviewcontrollerif.h" +#include "wsfmainapplication.hrh" +#include "wsfwlaninfoarrayvisitor.h" + +#include "wsflogger.h" + +// LOCAL DEFINITIONS +#ifdef _DEBUG + _LIT( KMainControllerPanic, "TWsfMainController" ); + #define _ASSERTD( cond ) __ASSERT_DEBUG( (cond), \ + User::Panic( KMainControllerPanic, __LINE__) ) +#else + #define _ASSERTD( cond ) {} +#endif //_DEBUG + +// --------------------------------------------------------------------------- +// TWsfMainController::Initialize +// --------------------------------------------------------------------------- +// +void TWsfMainController::Initialize( + CWsfAppUi& aAppUi, + CWsfModel& aModel, + CWsfWlanInfoArrayVisitor &aWlanInfoBranding ) + { + iAppUi = &aAppUi; + iModel = &aModel; + iWlanInfoBranding = &aWlanInfoBranding; + iModel->SetConnecting( EFalse ); + } + +// --------------------------------------------------------------------------- +// TWsfMainController::UpdateViewL +// --------------------------------------------------------------------------- +// +void TWsfMainController::UpdateViewL() + { + LOG_ENTERFN( "TWsfMainController::UpdateViewL" ); + CWsfWlanInfoArray* array = iModel->GetWlanListL(); + array->SortArrayL( *iWlanInfoBranding ); + + LOG_WRITEF( "ActiveViewL: %x", iModel->ActiveViewL().iUid ); + switch ( iModel->ActiveViewL().iUid ) + { + case EMainViewId: + { + _ASSERTD( iMainView ); + iMainView->UpdateWlanListL( array ); + break; + } + + case EDetailsViewId: + { + _ASSERTD( iDetailsView ); + iMainView->UpdateWlanListInBackgroundL( array ); + iDetailsView->WlanListChangedL( array ); + break; + } + case EConnectedDetailsViewId: + { + iMainView->UpdateWlanListL( array ); + iAppUi->UpdateConnectedDetailsL( array ); + break; + } + default: + { + // Invalid view ID, make panic. + _ASSERTD( 0 ); + break; + } + } + } + +// --------------------------------------------------------------------------- +// TWsfMainController::UpdateViewL +// --------------------------------------------------------------------------- +// +void TWsfMainController::UpdateViewL( CWsfWlanInfoArray* aInfoArray ) + { + LOG_ENTERFN( "TWsfMainController::UpdateViewL( aInfoArray ) " ); + LOG_WRITEF( "ActiveViewL: %x", iModel->ActiveViewL().iUid ); + switch ( iModel->ActiveViewL().iUid ) + { + case EMainViewId: + { + iMainView->UpdateWlanListL( aInfoArray ); + break; + } + + case EDetailsViewId: + { + iDetailsView->WlanListChangedL( aInfoArray ); + break; + } + case EConnectedDetailsViewId: + { + iMainView->UpdateWlanListL( aInfoArray ); + iAppUi->UpdateConnectedDetailsL( aInfoArray ); + break; + } + default: + { + // Invalid view ID, make panic. + _ASSERTD( 0 ); + break; + } + } + } + +// Events from AppUi + +// --------------------------------------------------------------------------- +// TWsfMainController::ShowWlanListL +// --------------------------------------------------------------------------- +// +void TWsfMainController::ShowWlanListL() + { + LOG_ENTERFN( "TWsfMainController::ShowWlanListL" ); + _ASSERTD( iAppUi ); + _ASSERTD( iModel ); + + iModel->SetActiveViewL( EMainViewId ); + iAppUi->ActivateMainViewL(); + } + +// --------------------------------------------------------------------------- +// TWsfMainController::ShowDetailsL +// --------------------------------------------------------------------------- +// +void TWsfMainController::ShowDetailsL() + { + LOG_ENTERFN( "TWsfMainController::ShowDetailsL" ); + _ASSERTD( iAppUi ); + _ASSERTD( iModel ); + _ASSERTD( iModel->ActiveViewL().iUid != EDetailsViewId ); + + TWsfWlanInfo* selectedWlan = iMainView->SelectedItem(); + + if ( selectedWlan ) + { + TBool connected = selectedWlan->Connected(); + + if( connected ) // Connected Details View - Replaced with dialog + { + // Work around - Emulated view + iModel->SetActiveViewL( EConnectedDetailsViewId ); + // Holds selected wlan Ssid + HBufC8* ssid = selectedWlan->GetSsidAsUtf8LC(); + + // Holds current wlan array + if ( !iInfoArray ) + { + iInfoArray = iModel->GetWlanListL(); + iInfoArray->SortArrayL( *iWlanInfoBranding ); + } + // Start and execute the Connected Details dialog + // Set array and Ssid to detail view + iAppUi->StartConnectedDetailsL( iInfoArray, *ssid ); + CleanupStack::PopAndDestroy( ssid ); + + // After the dismissal of the Connected Details dialog, + // change back to the main view + ShowWlanListL(); + } + else + { + iDetailsView = &( iAppUi->DetailsView( EDetailsViewId ) ); + iModel->SetActiveViewL( EDetailsViewId ); + iDetailsView->SetPartner( *this ); + + // Holds selected wlan Ssid + HBufC8* ssid = selectedWlan->GetSsidAsUtf8LC(); + + // Holds current wlan array + if ( !iInfoArray ) + { + iInfoArray = iModel->GetWlanListL(); + iInfoArray->SortArrayL( *iWlanInfoBranding ); + } + //Set array and Ssid to detail view + iDetailsView->SetWlanListL( iInfoArray, *ssid ); + + CleanupStack::PopAndDestroy( ssid ); + + iAppUi->ActivateDetailsViewL( iModel->ActiveViewL() ); + } + } + } + +// --------------------------------------------------------------------------- +// TWsfMainController::MainViewCreatedL +// --------------------------------------------------------------------------- +// +void TWsfMainController::MainViewCreatedL() + { + LOG_ENTERFN( "TWsfMainController::MainViewCreatedL" ); + iMainView = &( iAppUi->MainView() ); + iMainView->SetPartner( *this ); + iModel->SetActiveViewL( EMainViewId ); + + if ( !iModel->Refreshing() ) + { + iModel->SetRefreshState( ETrue ); + } + } + +// --------------------------------------------------------------------------- +// TWsfMainController::WlanListChangedL +// --------------------------------------------------------------------------- +// +void TWsfMainController::WlanListChangedL() + { + LOG_ENTERFN( "TWsfMainController::WlanListChangedL" ); + + if ( iModel->IsConnecting() ) + { + LOG_WRITE( "We are connecting just return from here" ); + return; + } + + if ( iModel->Refreshing() ) + { + // Make sure if leave occures that we don't block ourselves for retry + CleanupStack::PushL( TCleanupItem( RestoreRefreshState, this ) ); + iModel->SetRefreshState( EFalse ); + if ( iAppUi ) + { + iAppUi->HideWaitNoteL(); + iInfoArray = iModel->GetWlanListL(); + if ( !iInfoArray->Count() ) + { + iAppUi->ShowNoWlansFoundInfoL(); + } + UpdateViewL(); + } + // pop cleanup item RestoreRefreshState + CleanupStack::Pop(); + } + } + +// --------------------------------------------------------------------------- +// TWsfMainController::NotifyEngineError +// --------------------------------------------------------------------------- +// +void TWsfMainController::NotifyEngineError( TInt aError ) + { + LOG_ENTERFN( "TWsfMainController::NotifyEngineError" ); + switch ( aError ) + { + case KErrServerTerminated: + { + break; + } + + default: + { + TRAP_IGNORE( iAppUi->ShowGlobalErrorNoteL( aError ) ); + } + } + } + +// --------------------------------------------------------------------------- +// TWsfMainController::ScanDisabledL +// --------------------------------------------------------------------------- +// +void TWsfMainController::ScanDisabledL() + { + // no implementation required + } + +// --------------------------------------------------------------------------- +// TWsfMainController::ScanEnabledL +// --------------------------------------------------------------------------- +// +void TWsfMainController::ScanEnabledL() + { + // no implementation required + } + +// --------------------------------------------------------------------------- +// TWsfMainController::WlanConnectionActivatedL +// --------------------------------------------------------------------------- +// +void TWsfMainController::WlanConnectionActivatedL() + { + LOG_ENTERFN( "TWsfMainController::WlanConnectionActivatedL" ); + + // update the model and refresh ui + if ( iInfoArray ) + { + TBool found = EFalse; + TWsfWlanInfo info; + iModel->GetConnectedWlanDetailsL( info ); + if ( info.iIapId ) + { + // find the entry for iapid + // mark it connected - sort the array and refresh + TWsfWlanInfo* temp = iInfoArray->Match( info.iIapId, + iInfoArray->Count() ); + if ( temp ) + { + found = ETrue; + temp->iConnectionState = EConnected; + iInfoArray->SortArrayL(); + UpdateViewL( iInfoArray ); + } + } + + if ( !found ) + { + // find the entry + // mark it connected - sort the array and refresh + TWsfWlanInfo* temp = iInfoArray->Match( info.iSsid, + iInfoArray->Count() ); + if ( temp ) + { + temp->iConnectionState = EConnected; + temp->iIapId = info.iIapId; + iInfoArray->SortArrayL(); + UpdateViewL( iInfoArray ); + } + } + } + + //Update icon + iModel->RefreshScanL(); + } + +// --------------------------------------------------------------------------- +// TWsfMainController::WlanConnectionClosedL +// --------------------------------------------------------------------------- +// +void TWsfMainController::WlanConnectionClosedL() + { + LOG_ENTERFN( "TWsfMainController::WlanConnectionClosedL" ); + // update the model and refresh ui + if ( iInfoArray ) + { + // check if the array has any items + if ( iInfoArray->Count() ) + { + TWsfWlanInfo* firstItem = iInfoArray->At( 0 ); + if ( firstItem && ( firstItem->Connected() || + firstItem->iConnectionState == EConnecting ) ) + { + LOG_WRITEF( "info state = %d", firstItem->iConnectionState ); + firstItem->iConnectionState = ENotConnected; + TRAPD( error, iModel->CheckIsIapIdValidL( firstItem->iIapId ) ); + if ( error ) + { + LOG_WRITEF( "Iap Id is not valid - error=%d", error ); + if ( firstItem->iRawSsid.Length() ) + { + firstItem->iSsid.Copy( firstItem->iRawSsid ); + } + firstItem->iIapId = 0; + } + iInfoArray->SortArrayL(); + UpdateViewL( iInfoArray ); + } + } + } + + // Abort current scan if exists so that we get + // newest scan results propagated to ui + iModel->AbortScanningL(); + iModel->RefreshScanL(); + } + +// --------------------------------------------------------------------------- +// TWsfMainController::ConnectingFinishedL +// --------------------------------------------------------------------------- +// +void TWsfMainController::ConnectionCreationProcessFinishedL( TInt /*aResult*/ ) + { + // no implementation required + } + +// --------------------------------------------------------------------------- +// TWsfMainController::ShowMenuBarL +// --------------------------------------------------------------------------- +// +void TWsfMainController::ShowMenuBarL() + { + LOG_ENTERFN( "TWsfMainController::ShowMenuBarL" ); + iAppUi->ShowMenuBarL(); + } + +// --------------------------- Events from the details view ------------------ + +// --------------------------------------------------------------------------- +// TWsfMainController::CloseDetailsViewL +// --------------------------------------------------------------------------- +// +void TWsfMainController::CloseDetailsViewL() + { + LOG_ENTERFN( "TWsfMainController::CloseDetailsViewL" ); + ShowWlanListL(); + // After the Details View closed the mainview's + // WlanList will be refreshed. + iModel->RefreshScanL(); + } + +// ------------------------------- Menu press handler ------------------------ + + +// ---------------------------------------------------------------------------- +// TWsfMainController::StartBrowsingL +// ---------------------------------------------------------------------------- +// +void TWsfMainController::StartBrowsingL() + { + LOG_ENTERFN( "TWsfMainController::StartBrowsingL" ); + if ( iAppUi->SuppressingKeyEvents() || iModel->IsConnectedL() && + ( !iMainView->SelectedItem() || + !iMainView->SelectedItem()->Connected() ) ) + { + iAppUi->ShowErrorNoteL( R_QTN_WLAN_INFO_CONNECTION_ALREADY_ACTIVE ); + return; + } + + // make sure we don't suppress our key events forever + CleanupStack::PushL( TCleanupItem( ReleaseSuppressingKeyEvents, this ) ); + iAppUi->SetSuppressingKeyEvents( ETrue ); + + TWsfWlanInfo* selectedItem = iMainView->SelectedItem(); + TWsfWlanInfo info; + + if ( selectedItem ) + { + info = *selectedItem; + } + + // Prevent connections to ad-hoc + WPA + if ( info.iNetMode == CMManager::EAdhoc + && info.iSecurityMode == CMManager::EWlanSecModeWpa ) + { + iAppUi->ShowGlobalErrorNoteL( KErrNotSupported ); + CleanupStack::PopAndDestroy(); + return; + } + + TInt result( KErrNone ); + + TWsfIapPersistence persistence = EIapPersistent; + + if ( !info.Known() && !info.Connected() ) + { + // if not known yet, create an IAP + if ( iModel->CreateAccessPointL( info, EFalse ) ) + { + persistence = EIapExpireOnDisconnect; + // update iapID to list + UpdateIapIdToInfoArrayL( info ); + } + else + { + result = KErrGeneral; + } + } + + if ( info.iIapId && !info.Connected() ) + { + // hopefully we have a valid IAP id inside + result = iModel->ConnectL( info.iIapId, EFalse, persistence ); + } + else if ( !info.Connected() ) + { + result = KErrGeneral; + } + + // pop cleanup item ReleaseSuppressingKeyEvents + CleanupStack::Pop(); + iAppUi->SetSuppressingKeyEvents( EFalse ); + + if ( !result ) + { + TUint32 passedIap( info.iIapId ); + + if ( info.Connected() && !passedIap ) + { + // in case we have an EasyWLAN here + RCmManagerExt cmmanager; + cmmanager.OpenLC(); + + passedIap = cmmanager.EasyWlanIdL(); + + CleanupStack::PopAndDestroy( &cmmanager ); + } + + // launch the browser + iModel->LaunchBrowserL( passedIap ); + } + else if ( result == KErrCancel ) + { + // connection creation was cancelled, refresh the view + iModel->RefreshScanL(); + } + + } + + +// ---------------------------------------------------------------------------- +// TWsfMainController::ConnectL +// ---------------------------------------------------------------------------- +// +void TWsfMainController::ConnectL() + { + LOG_ENTERFN( "TWsfMainController::ConnectL" ); + if ( iAppUi->SuppressingKeyEvents() || iModel->IsConnectedL() ) + { + iAppUi->ShowErrorNoteL( R_QTN_WLAN_INFO_CONNECTION_ALREADY_ACTIVE ); + return; + } + + // make sure we don't suppress our key events forever + CleanupStack::PushL( TCleanupItem( ReleaseSuppressingKeyEvents, this ) ); + iAppUi->SetSuppressingKeyEvents( ETrue ); + + TWsfWlanInfo* selectedItem = iMainView->SelectedItem(); + TWsfWlanInfo info; + + if ( selectedItem ) + { + info = *selectedItem; + } + + // Prevent connections to ad-hoc + WPA + if ( info.iNetMode == CMManager::EAdhoc + && info.iSecurityMode == CMManager::EWlanSecModeWpa ) + { + iAppUi->ShowGlobalErrorNoteL( KErrNotSupported ); + CleanupStack::PopAndDestroy(); + return; + } + + TWsfIapPersistence persistence = EIapPersistent; + + if ( !info.Known() ) + { + // a new access point needs to be created + if ( iModel->CreateAccessPointL( info, EFalse ) ) + { + persistence = EIapExpireOnDisconnect; + // update iapID to list + UpdateIapIdToInfoArrayL( info ); + } + } + + if ( info.iIapId ) + { + // hopefully we have a valid IAP id inside + iModel->ConnectL( info.iIapId, ETrue, persistence ); + } + + // pop cleanup item ReleaseSuppressingKeyEvents + CleanupStack::Pop(); + iAppUi->SetSuppressingKeyEvents( EFalse ); + + } + +// --------------------------------------------------------------------------- +// TWsfMainController::UpdateIapIdToInfoArrayL +// --------------------------------------------------------------------------- +// +void TWsfMainController::UpdateIapIdToInfoArrayL( TWsfWlanInfo& aInfo ) + { + LOG_ENTERFN( "TWsfMainController::UpdateIapIdToInfoArrayL" ); + TWsfWlanInfo* temp = iInfoArray->Match( aInfo.iSsid, iInfoArray->Count() ); + if ( temp && !aInfo.Hidden() ) + { + LOG_WRITE( "Info found" ); + + // Check that there aren't any IAPs with same id + TWsfWlanInfo* wlanInfoWithSameIapId = iInfoArray->Match( aInfo.iIapId, + iInfoArray->Count() ); + if ( wlanInfoWithSameIapId ) + { + // info with same id found set its iap id to zero + LOG_WRITE( "info with same id found" ); + wlanInfoWithSameIapId->iIapId = 0; + } + + temp->iIapId = aInfo.iIapId; + + if ( aInfo.iNetworkName.Length() ) + { + // Replace ssid as well since scanner does this same thing + temp->iSsid.Copy( aInfo.iNetworkName ); + } + } + else + { + LOG_WRITE( "Info not found" ); + TWsfWlanInfo* createdInfo = new (ELeave) TWsfWlanInfo( aInfo ); + createdInfo->iVisibility = ETrue; + createdInfo->iStrengthLevel = EWlanSignalStrengthMax; + iInfoArray->AppendL( createdInfo ); + } + } + +// --------------------------------------------------------------------------- +// TWsfMainController::DisconnectL +// --------------------------------------------------------------------------- +// +void TWsfMainController::DisconnectL() + { + LOG_ENTERFN( "TWsfMainController::DisconnectL" ); + if ( iModel->IsConnecting() ) + { + LOG_WRITE( "Abort connecting" ); + iModel->AbortConnectingL(); + } + else + { + LOG_WRITE( "Disconnect" ); + iModel->DisconnectL(); + } + } + +// --------------------------------------------------------------------------- +// TWsfMainController::RefreshL +// --------------------------------------------------------------------------- +// +void TWsfMainController::RefreshL() + { + LOG_ENTERFN( "TWsfMainController::RefreshL" ); + TBool refreshing = iModel->RefreshScanL(); + if ( refreshing ) + { + iAppUi->StartWaitNoteL( ETrue ); + } + } + +// --------------------------------------------------------------------------- +// TWsfMainController::ContinueBrowsingL +// --------------------------------------------------------------------------- +// +void TWsfMainController::ContinueBrowsingL() + { + LOG_ENTERFN( "TWsfMainController::ContinueBrowsingL" ); + // pass selected WLAN info to engine + TWsfWlanInfo *selectedItem = iMainView->SelectedItem(); + + if ( selectedItem ) + { + // Prevent connections to ad-hoc + WPA + if ( selectedItem->iNetMode == CMManager::EAdhoc + && selectedItem->iSecurityMode == CMManager::EWlanSecModeWpa ) + { + iAppUi->ShowGlobalErrorNoteL( KErrNotSupported ); + return; + } + + TUint iapId = selectedItem->iIapId; + iModel->ContinueBrowsingL( iapId ); + } + } + +// --------------------------------------------------------------------------- +// TWsfMainController::EngineRefreshing +// --------------------------------------------------------------------------- +// +TBool TWsfMainController::EngineRefreshing() + { + LOG_ENTERFN( "TWsfMainController::EngineRefreshing" ); + _ASSERTD( iModel ); + return iModel->Refreshing(); + } + +// --------------------------------------------------------------------------- +// TWsfMainController::AppLaunchCompleteL +// --------------------------------------------------------------------------- +// +void TWsfMainController::AppLaunchCompleteL() + { + LOG_ENTERFN( "TWsfMainController::AppLaunchCompleteL" ); + iAppUi->StartWaitNoteL( EFalse ); + iModel->EnableScanL(); + } + +// --------------------------------------------------------------------------- +// TWsfMainController::AppSwitchedForegroundL +// --------------------------------------------------------------------------- +// +void TWsfMainController::AppSwitchedForegroundL() + { + LOG_ENTERFN( "TWsfMainController::AppSwitchedForegroundL" ); + + //turn on scanning for our point of view + iModel->EnableScanL(); + + if ( !iModel->IsConnecting() ) + { + LOG_WRITE( "Scan now" ); + TBool scan = iModel->RefreshScanL(); + if( !scan ) + { + LOG_WRITE( "Set refresh state to true" ); + //if the refresh call was called when the server was + //actually making a scan then the refresh state of the + //model is turned to false, but in this case the scanning + //wait note will stuck on the screen, That's why the + //refresh state must be turned to true + iModel->SetRefreshState( ETrue ); + } + } + } + +// --------------------------------------------------------------------------- +// TWsfMainController::AppSwitchedBackgroundL +// --------------------------------------------------------------------------- +// +void TWsfMainController::AppSwitchedBackgroundL() + { + LOG_ENTERFN( "TWsfMainController::AppSwitchedBackgroundL" ); + iModel->DisableScanL(); + } + + +// --------------------------------------------------------------------------- +// TWsfMainController::BrowserLaunchCompleteL +// --------------------------------------------------------------------------- +// +void TWsfMainController::BrowserLaunchCompleteL() + { + LOG_ENTERFN( "TWsfMainController::BrowserLaunchCompleteL" ); + // no implementation required + } + + +// --------------------------------------------------------------------------- +// TWsfMainController::BrowserExitL +// --------------------------------------------------------------------------- +// +void TWsfMainController::BrowserExitL() + { + LOG_ENTERFN( "TWsfMainController::BrowserExitL" ); + iModel->AbortScanningL(); + iModel->RefreshScanL(); + } + + +// --------------------------------------------------------------------------- +// TWsfMainController::BrowserLaunchFailed +// --------------------------------------------------------------------------- +// +void TWsfMainController::BrowserLaunchFailed( TInt aError ) + { + LOG_ENTERFN( "TWsfMainController::BrowserLaunchFailed" ); + LOG_WRITEF( "error = %d", aError ); + switch ( aError ) + { + case KErrCancel: + { + // user pressed cancel to connection creation + break; + } + + default: + { + break; + } + } + } + +// --------------------------------------------------------------------------- +// TWsfMainController::ConnectingL +// --------------------------------------------------------------------------- +// +void TWsfMainController::ConnectingL( TUint32 aIapId ) + { + LOG_ENTERFN( "TWsfMainController::ConnectingL" ); + iModel->SetConnecting( ETrue ); + + // update the model and refresh ui + if ( iInfoArray ) + { + LOG_WRITEF( "Match array with iapID = %d", aIapId ); + // find the entry for aIapId + // mark it connecting - sort the array and refresh + TWsfWlanInfo* temp = iInfoArray->Match( aIapId, iInfoArray->Count() ); + if ( temp ) + { + LOG_WRITEF( "Info found iapID = %d", aIapId ); + temp->iConnectionState = EConnecting; + iInfoArray->SortArrayL(); + UpdateViewL( iInfoArray ); + } + } + } + + +// --------------------------------------------------------------------------- +// TWsfMainController::ConnectingFinishedL +// --------------------------------------------------------------------------- +// +void TWsfMainController::ConnectingFinishedL( TInt aResult ) + { + LOG_ENTERFN( "TWsfMainController::ConnectingFinishedL" ); + if ( iModel->IsConnecting() ) + { + iModel->SetConnecting( EFalse ); + iModel->SetRefreshState( ETrue ); + iAppUi->HideWaitNoteL(); + } + + if ( aResult != KErrNone && aResult != KErrCancel ) + { + LOG_WRITEF( "Connection failed with error=%d", aResult ); + if ( iInfoArray && iInfoArray->Count() && + iInfoArray->At(0)->iConnectionState == EConnecting ) + { + iInfoArray->At(0)->iConnectionState = ENotConnected; + TRAPD( error, iModel->CheckIsIapIdValidL( + iInfoArray->At(0)->iIapId ) ); + if ( error ) + { + LOG_WRITEF( "Iap Id %d is not valid - error=%d", + iInfoArray->At(0)->iIapId, error ); + + if ( iInfoArray->At(0)->iRawSsid.Length() ) + { + iInfoArray->At(0)->iSsid.Copy( + iInfoArray->At(0)->iRawSsid ); + } + + iInfoArray->At(0)->iIapId = 0; + } + iInfoArray->SortArrayL(); + UpdateViewL( iInfoArray ); + iModel->AbortScanningL(); + iModel->RefreshScanL(); + } + } + } + + +// --------------------------------------------------------------------------- +// TWsfMainController::EditBlackListItemsL +// --------------------------------------------------------------------------- +// +void TWsfMainController::EditBlackListItemsL() + { + LOG_ENTERFN( "TWsfMainController::EditBlackListItemsL" ); + _ASSERTD( iWlanInfoBranding ); + iWlanInfoBranding->EditBlackListL( *iInfoArray ); + iModel->RefreshScanL(); + } + +// --------------------------------------------------------------------------- +// TWsfMainController::DetailsScanL +// --------------------------------------------------------------------------- +// +void TWsfMainController::DetailsScanL() + { + LOG_ENTERFN( "TWsfMainController::DetailsScanL" ); + iModel->RefreshScanL(); + } + +// --------------------------------------------------------------------------- +// TWsfMainController::ReleaseSuppressingKeyEvents +// --------------------------------------------------------------------------- +// +void TWsfMainController::ReleaseSuppressingKeyEvents( TAny* aPtr ) + { + TWsfMainController* self = + static_cast( aPtr ); + self->iAppUi->SetSuppressingKeyEvents( EFalse ); + self->iModel->SetConnecting( EFalse ); + TRAP_IGNORE( self->iModel->RefreshScanL() ); + } + +// --------------------------------------------------------------------------- +// TWsfMainController::RestoreRefreshState +// --------------------------------------------------------------------------- +// +void TWsfMainController::RestoreRefreshState( TAny* aPtr ) + { + TWsfMainController* self = + static_cast( aPtr ); + LOG_WRITE( "Restore refresh state") + self->iModel->SetRefreshState( ETrue ); + } + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/src/wsfmainview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfmainview.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,551 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfMainView. +* +*/ + +//External Includes +#include +#include +#include +#include +#include +#include +#include + +//Internal Includes +#include "wsfdocument.h" +#include "wsfwlaninfoarrayvisitor.h" +#include "wsfwlaninfoarray.h" +#include "wsfmainview.h" +#include "wsfmainviewmodel.h" +#include "wsfmainviewcontainer.h" +#include "wsfmainapplication.hrh" +#include "wsfactivewaiter.h" +#include "wsfappui.h" +#include "wsfmodel.h" + +#include "wsflogger.h" + + +// Standard construction sequence + +// --------------------------------------------------------------------------- +// CWsfMainView::NewL +// --------------------------------------------------------------------------- +// +CWsfMainView* CWsfMainView::NewL( TBool aIsEmbedded ) + { + LOG_ENTERFN( "CWsfMainView::NewL" ); + CWsfMainView* self = CWsfMainView::NewLC( aIsEmbedded ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CWsfMainView::NewLC +// --------------------------------------------------------------------------- +// +CWsfMainView* CWsfMainView::NewLC( TBool aIsEmbedded ) + { + LOG_ENTERFN( "CWsfMainView::NewLC" ); + CWsfMainView* self = new ( ELeave ) CWsfMainView; + CleanupStack::PushL( self ); + self->ConstructL( aIsEmbedded ); + return self; + } + + +// --------------------------------------------------------------------------- +// CWsfMainView::CWsfMainView +// --------------------------------------------------------------------------- +// +CWsfMainView::CWsfMainView(): iBrowserIapId( KErrNotFound ) + { + // no implementation required + } + + +// --------------------------------------------------------------------------- +// CWsfMainView::~CWsfMainView +// --------------------------------------------------------------------------- +// +CWsfMainView::~CWsfMainView() + { + LOG_ENTERFN( "CWsfMainView::~CWsfMainView" ); + if ( iContainer ) + { + AppUi()->RemoveFromViewStack( *this, iContainer ); + } + + delete iContainer; + delete iModel; + } + + +// --------------------------------------------------------------------------- +// CWsfMainView::ConstructL +// --------------------------------------------------------------------------- +// +void CWsfMainView::ConstructL( TBool aIsEmbedded ) + { + LOG_ENTERFN( "CWsfMainView::ConstructL" ); + TInt actView( NULL ); + + if ( aIsEmbedded ) // started from CP + { + actView = R_SNIFFER_CP_MAINVIEW; + } + else + { + actView = R_SNIFFER_MAINVIEW; + } + + BaseConstructL( actView ); + iModel = CWsfMainViewModel::NewL(); + iController.SetModel( iModel ); + } + + +// --------------------------------------------------------------------------- +// CWsfMainView::Id +// --------------------------------------------------------------------------- +// +TUid CWsfMainView::Id() const + { + return TUid::Uid( EMainViewId ); + } + + +// --------------------------------------------------------------------------- +// CWsfMainView::HandleCommandL +// --------------------------------------------------------------------------- +// +void CWsfMainView::HandleCommandL( TInt aCommand ) + { + switch ( aCommand ) + { + case EAknSoftkeyOk: + { + break; + } + case EAknSoftkeyBack: + { + AppUi()->HandleCommandL( EAknCmdExit ); + break; + } + case EAknSoftkeyContextOptions: + { + LOG_WRITE( "CWsfMainView::HandleCommandL, Options" ); + MenuBar()->SetMenuTitleResourceId( R_SNIFFER_CONTEXT_MENUBAR ); + MenuBar()->SetMenuType( CEikMenuBar::EMenuContext ); + MenuBar()->TryDisplayMenuBarL(); + MenuBar()->SetMenuTitleResourceId( R_SNIFFER_MENUBAR ); + MenuBar()->SetMenuType( CEikMenuBar::EMenuOptions ); + break; + } + default: + { + AppUi()->HandleCommandL( aCommand ); + break; + } + } + } + + +// --------------------------------------------------------------------------- +// CWsfMainView::DoActivateL +// --------------------------------------------------------------------------- +// +void CWsfMainView::DoActivateL( const TVwsViewId& /*aPrevViewId*/, + TUid /*aCustomMessageId*/, + const TDesC8& /*aCustomMessage*/) + { + LOG_ENTERFN( "CWsfMainView::DoActivateL" ); + if ( !iContainer ) + { + iContainer = CWsfMainViewContainer::NewL( ClientRect(), this ); + // set icons array to list + iContainer->SetMopParent( this ); + iContainer->SetPartner( iController ); + iContainer->ListBox()->SetListBoxObserver( this ); + AppUi()->AddToViewStackL( *this, iContainer ); + iController.SetContainer( iContainer ); + } + + iContainer->MakeVisible( ETrue ); + iController.RefreshL(); + MenuBar()->SetContextMenuTitleResourceId( R_SNIFFER_CONTEXT_MENUBAR ); + } + + +// --------------------------------------------------------------------------- +// CWsfMainView::DoDeactivate +// --------------------------------------------------------------------------- +// +void CWsfMainView::DoDeactivate() + { + LOG_ENTERFN( "CWsfMainView::DoDeactivate" ); + if ( iContainer ) + { + AppUi()->RemoveFromViewStack( *this, iContainer ); + iController.SetContainer( NULL ); + delete iContainer; + iContainer = NULL; + } + } + + +// --------------------------------------------------------------------------- +// CWsfMainView::Controller +// --------------------------------------------------------------------------- +// +MWsfMainViewControllerIf& CWsfMainView::Controller() + { + return iController; + } + + +// --------------------------------------------------------------------------- +// CWsfMainView::DynInitMenuPaneL +// --------------------------------------------------------------------------- +// +void CWsfMainView::DynInitMenuPaneL( TInt aResourceId, + CEikMenuPane* aMenuPane ) + { + LOG_ENTERFN( "CWsfMainView::DynInitMenuPaneL" ); + LOG_WRITEF( "resource id = %d", aResourceId ); + iController.UpdateSelectedItemL(); + + if ( aResourceId == R_SNIFFER_MENU ) + { + LOG_WRITE( "CWsfMainView::DynInitMenuPaneL, R_SNIFFER_MENU" ); + const CWsfDocument* doc = static_cast( + AppUi()->Document() ); + TBool blacklistEmpty( !doc->WlanInfoBranding().BlackListItemCount() ); + TWsfWlanInfo *selectedItem = iController.SelectedItem(); + CWsfWlanInfoArray *infoArray = iModel->GetInfoArray(); + + TBool connecting( doc->Model().IsConnecting() ); + + if ( !selectedItem ) + { + // no real items available, but hidden item is present + aMenuPane->SetItemDimmed( ESnifferCmdStartBrowsing, EFalse ); + aMenuPane->SetItemDimmed( ESnifferCmdContinueBrowsing, ETrue ); + aMenuPane->SetItemDimmed( ESnifferCmdConnect, EFalse ); + aMenuPane->SetItemDimmed( ESnifferCmdDisconnect, ETrue ); + aMenuPane->SetItemDimmed( ESnifferCmdRefresh, connecting ); + + // dim filtering if connecting or there are no WLAN networks + // in coverage or there is only one network which is connected, + // and the filtering list does not contain any networks marked + // to be filtered out. + aMenuPane->SetItemDimmed( ESnifferCmdFilterWlans, + connecting || + !infoArray || + ( blacklistEmpty && + ( !infoArray->Count() || + ( infoArray->Count() == 1 && + (*infoArray)[0]->Connected() ) ) ) ); + aMenuPane->SetItemDimmed( ESnifferCmdDetails, ETrue ); + aMenuPane->SetItemDimmed( ESnifferCmdSettings, connecting ); + return; + } + + TBool connected( selectedItem->Connected() ); + TBool connectedAndUsed( EFalse ); + if ( connected && iBrowserIapId == selectedItem->iIapId ) + { + connectedAndUsed = ETrue; + } + TBool known( selectedItem->Known() ); + + TBool selectedItemConnecting ( + selectedItem->ConnectionStatus() == EConnecting ); + + LOG_WRITEF( "connectedAndUsed = %d", connectedAndUsed ); + LOG_WRITEF( "connected = %d", connected ); + LOG_WRITEF( "known = %d", known ); + LOG_WRITEF( "selectedItemConnecting = %d", selectedItemConnecting ); + LOG_WRITEF( "connecting = %d", connecting ); + + aMenuPane->SetItemDimmed( ESnifferCmdStartBrowsing, + connectedAndUsed || selectedItemConnecting ); + aMenuPane->SetItemDimmed( ESnifferCmdContinueBrowsing, + !connectedAndUsed || selectedItemConnecting ); + + aMenuPane->SetItemDimmed( ESnifferCmdConnect, + connected || selectedItemConnecting ); + + aMenuPane->SetItemDimmed( ESnifferCmdDisconnect, + !connected && !selectedItemConnecting); + + aMenuPane->SetItemDimmed( ESnifferCmdRefresh, connecting ); + + // dim filtering if connecting or there are no WLAN networks + // in coverage or there is only one network which is connected, + // and the filtering list does not contain any networks marked + // to be filtered out. + aMenuPane->SetItemDimmed( ESnifferCmdFilterWlans, + connecting || + !infoArray || + ( blacklistEmpty && + ( !infoArray->Count() || + ( infoArray->Count() == 1 && + (*infoArray)[0]->Connected() ) ) ) ); + + aMenuPane->SetItemDimmed( ESnifferCmdDetails, + connecting || + selectedItem->Hidden() && !known ); + aMenuPane->SetItemDimmed( ESnifferCmdSettings, connecting ); + } + else if ( aResourceId == R_SNIFFER_CONTEXT_MENU ) + { + LOG_WRITE( "CWsfMainView::DynInitMenuPaneL, R_SNIFFER_CONTEXT_MENU" ); + TWsfWlanInfo *selectedItem = iController.SelectedItem(); + + // there must be always at least one item: "Other (unlisted)..." + TBool connectedAndUsed( EFalse ); + TBool connected( EFalse ); + TBool known( EFalse ); + TBool hidden( ETrue ); + + const CWsfDocument* doc = static_cast( + AppUi()->Document() ); + + TBool connecting( doc->Model().IsConnecting() ); + TBool selectedItemConnecting( EFalse ); + + + if ( selectedItem ) + { + // workaround: even if the model reports no elements, we know that + // the hidden item must always be there + connected = selectedItem->Connected(); + if ( connected && iBrowserIapId == selectedItem->iIapId ) + { + connectedAndUsed = ETrue; + } + known = selectedItem->Known(); + hidden = selectedItem->Hidden(); + selectedItemConnecting = + ( selectedItem->ConnectionStatus() == EConnecting ); + } + + LOG_WRITEF( "connectedAndUsed = %d", connectedAndUsed ); + LOG_WRITEF( "connected = %d", connected ); + LOG_WRITEF( "known = %d", known ); + LOG_WRITEF( "selectedItemConnecting = %d", selectedItemConnecting ); + LOG_WRITEF( "connecting = %d", connecting ); + + + aMenuPane->SetItemDimmed( ESnifferCmdStartBrowsing, + connectedAndUsed || selectedItemConnecting ); + aMenuPane->SetItemDimmed( ESnifferCmdContinueBrowsing, + !connectedAndUsed || selectedItemConnecting ); + + aMenuPane->SetItemDimmed( ESnifferCmdConnect, + connected || selectedItemConnecting ); + aMenuPane->SetItemDimmed( ESnifferCmdDisconnect, + !connected && !selectedItemConnecting ); + aMenuPane->SetItemDimmed( ESnifferCmdDetails, + connecting || hidden && !known ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfMainView::HandleListBoxEventL +// --------------------------------------------------------------------------- +// +void CWsfMainView::HandleListBoxEventL( CEikListBox* /*aListBox*/, + TListBoxEvent aEventType ) + { + LOG_ENTERFN( "CWsfMainView::HandleListBoxEventL" ); + LOG_WRITEF( "aEventType = %d", aEventType ); + switch ( aEventType ) + { + case EEventEnterKeyPressed: + case EEventItemSingleClicked: + { + HandleCommandL( EAknSoftkeyContextOptions ); + } + break; + default: + break; + } + } + + +// --------------------------------------------------------------------------- +// CWsfMainView::SelectionKeyPressed +// --------------------------------------------------------------------------- +// +void CWsfMainView::SelectionKeyPressed() + { + iSelectionKey = ETrue; + } + +// --------------------------------------------------------------------------- +// CWsfMainView::UpdateBrowserUsageInfoL +// --------------------------------------------------------------------------- +// +void CWsfMainView::UpdateBrowserUsageInfoL() + { + LOG_ENTERFN( "CWsfMainView::UpdateBrowserUsageInfoL" ); + iBrowserIapId = BrowserIapIdL(); + } + + +// --------------------------------------------------------------------------- +// CWsfMainView::BrowserIapIdL +// --------------------------------------------------------------------------- +// +TInt CWsfMainView::BrowserIapIdL() + { + LOG_ENTERFN( "CWsfMainView::BrowserIapIdL" ); + + const TInt KBrowserUid = 0x10008D39; + TUid id( TUid::Uid( KBrowserUid ) ); + + // Check if the Browser application is already running. + TApaTaskList taskList( iEikonEnv->WsSession() ); + TApaTask task = taskList.FindApp( id ); + TInt browserIapId( KErrNotFound ); + +#ifndef __WINS__ + + if ( task.Exists() ) + { + LOG_WRITE( "The Browser is running." ); + // The Browser is already running. + TWsfWlanInfo* firstItem = NULL; + + CWsfWlanInfoArray *infoArray = iModel->GetInfoArray(); + if ( infoArray ) + { + firstItem = infoArray->At( 0 ); + } + + TBool connected( EFalse ); + if( firstItem ) + { + // first item always holds the connected network + connected = firstItem->Connected(); + } + LOG_WRITEF("Selected network Connected? %d", connected); + + if ( connected ) + { + RConnectionMonitor connectionMonitor; + connectionMonitor.ConnectL(); + CleanupClosePushL( connectionMonitor ); + // We have to check if the Browser using the selected + // connection. + // We have get the connectiond ID first. + CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewL(); + CleanupStack::PushL( waiter ); + + // first call, need to get the connection parameters + TUint connectionCount( 0 ); + + connectionMonitor.GetConnectionCount( connectionCount, + waiter->iStatus ); + waiter->WaitForRequest(); + + // find the connection with WLAN bearer + // that will be the selected WLAN + TUint connectionId( 0 ); + for ( TUint i = 1; i <= connectionCount; ++i ) + { + TUint tmpConnectionId( 0 ); + TUint subConnectionCount( 0 ); + TConnMonBearerType bearerType( EBearerUnknown ); + + connectionMonitor.GetConnectionInfo( i, + tmpConnectionId, + subConnectionCount ); + connectionMonitor.GetIntAttribute( tmpConnectionId, + 0, + KBearer, + ( TInt& )bearerType, + waiter->iStatus ); + waiter->WaitForRequest(); + if( bearerType == EBearerWLAN ) + { + connectionId = tmpConnectionId; + break; + } + } + // Now we have the connectiond ID. + LOG_WRITEF( "connectionId: %d", connectionId ); + + TConnMonClientEnumBuf clientBuf; + + connectionMonitor.GetPckgAttribute( connectionId, + 0, + KClientInfo, + clientBuf, + waiter->iStatus ); + waiter->WaitForRequest(); + TInt count( 0 ); + if ( !waiter->iStatus.Int() ) + { + count = clientBuf().iCount; + } + + RApaLsSession appSess; + TApaAppInfo appInfo; + + // The connection could be shared by several applications + User::LeaveIfError( appSess.Connect() ); + // No need for CleanupClosePushL(appSess) cause nothing leaves. + + for ( TInt i = 0; i < count; i++ ) + { + appInfo.iCaption.Zero(); + TInt result = appSess.GetAppInfo( appInfo, + clientBuf().iUid[i] ); + + LOG_WRITEF( "result: %d", result ); + LOG_WRITEF( "iClientInfo.iUid[i].iUid: %x", + clientBuf().iUid[i].iUid ); + + if ( clientBuf().iUid[i].iUid == KBrowserUid ) + { + browserIapId = firstItem->iIapId; + } + } + appSess.Close(); + + CleanupStack::PopAndDestroy( waiter ); + CleanupStack::PopAndDestroy( &connectionMonitor ); + } + } + else + { + LOG_WRITE( "No Browser running." ); + } + +#endif // __WINS__ + + LOG_WRITEF( "browserIapId: %d", browserIapId ); + return browserIapId; + } + + + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/src/wsfmainviewcontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfmainviewcontainer.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,811 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfMainViewContainer. +* +*/ + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +// INTERNAL INCLUDES +#include "wsfmainviewcontainer.h" +#include "wsfmainviewinternals.h" +#include "wsfmainviewcontrollerpartner.h" +#include "wsfdocument.h" +#include "wsfwlaninfoarrayvisitor.h" +#include "wsfappui.h" +#include "wsfmainview.h" +#include + +#include "wsflogger.h" + + + +// LOCAL DEFINITIONS +const TUint KIconListGranularity = 12; // Default size of the icons list +// path of the app's iconfile +_LIT( KIconFileName, "\\resource\\apps\\wsficons.mif" ); + +const TInt KConnectingStepTime = 200 * 1000; + +_LIT( KFormat1Icon, "%d" ); + + +// CONSTRUCTION AND DESTRUCTION +// --------------------------------------------------------- +// CWsfMainViewContainer::NewL +// --------------------------------------------------------- +// +CWsfMainViewContainer* CWsfMainViewContainer::NewL( const TRect& aRect, + CWsfMainView* aParentView ) + { + LOG_ENTERFN( "CWsfMainViewContainer::NewL" ); + CWsfMainViewContainer* self = + CWsfMainViewContainer::NewLC( aRect, aParentView ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------- +// CWsfMainViewContainer::NewLC +// --------------------------------------------------------- +// +CWsfMainViewContainer* CWsfMainViewContainer::NewLC( const TRect& aRect, + CWsfMainView* aParentView ) + { + LOG_ENTERFN( "CWsfMainViewContainer::NewLC" ); + CWsfMainViewContainer* self = new( ELeave ) CWsfMainViewContainer; + CleanupStack::PushL( self ); + self->ConstructL( aRect, aParentView ); + return self; + } + +// --------------------------------------------------------- +// CWsfMainViewContainer::~CWsfMainViewContainer +// --------------------------------------------------------- +// +CWsfMainViewContainer::~CWsfMainViewContainer() + { + LOG_ENTERFN( "CWsfMainViewContainer::~CWsfMainViewContainer" ); + + StopConnectingAnimation(); + + PopNaviPane(); + + if ( iStatusConnecting ) + { + delete iStatusConnecting; + } + + delete iListBox; + delete iNaviDecorator; + } + +// --------------------------------------------------------- +// CWsfMainViewContainer::CWsfMainViewContainer +// --------------------------------------------------------- +// +CWsfMainViewContainer::CWsfMainViewContainer() + { + } + +// --------------------------------------------------------- +// CWsfMainViewContainer::ConstructL +// --------------------------------------------------------- +// +void CWsfMainViewContainer::ConstructL( const TRect& aRect, + CWsfMainView* aParentView ) + { + LOG_ENTERFN( "CWsfMainViewContainer::ConstructL" ); + CreateWindowL(); + + iParentView = aParentView; + + iListBox = new( ELeave ) CAknDoubleGraphicStyleListBox(); + TInt flags( EAknGenericListBoxFlags ); + iListBox->SetMopParent(this); // + iListBox->ConstructL( this, flags ); + iListBox->SetContainerWindowL(*this); + + iListBox->SetFocus(ETrue); + + iListBox->CreateScrollBarFrameL( ETrue ); + iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( + CEikScrollBarFrame::EOff, + CEikScrollBarFrame::EAuto ); + + SetListboxIconsL(); + + iConnectingIcons[0] = KWlanOnIcon_0; + iConnectingIcons[1] = KWlanOnIcon_1; + iConnectingIcons[2] = KWlanOnIcon; + iConnectingIcons[3] = KWlanOnIcon_1; + + SetRect( aRect ); + iListBox->SetRect( Rect() ); + ActivateL(); + } + +// --------------------------------------------------------- +// CWsfMainViewContainer::SizeChanged +// --------------------------------------------------------- +// +void CWsfMainViewContainer::SizeChanged() + { + iListBox->SetRect( Rect() ); + } + +// --------------------------------------------------------- +// CWsfMainViewContainer::CountComponentControls +// --------------------------------------------------------- +// +TInt CWsfMainViewContainer::CountComponentControls() const + { + return 1;// return number of controls inside this container + } + +// --------------------------------------------------------- +// CWsfMainViewContainer::ComponentControl +// --------------------------------------------------------- +// +CCoeControl* CWsfMainViewContainer::ComponentControl(TInt aIndex) const + { + CCoeControl* object = NULL; + switch ( aIndex ) + { + case 0: + object = iListBox; + break; + default: + object = NULL; + } + return object; + } + +// --------------------------------------------------------- +// CWsfMainViewContainer::OfferKeyEventL +// --------------------------------------------------------- +// +TKeyResponse CWsfMainViewContainer::OfferKeyEventL( + const TKeyEvent& aKeyEvent, + TEventCode aType ) + { + LOG_ENTERFN( "CWsfMainViewContainer::OfferKeyEventL" ); + CWsfAppUi* appui = static_cast( iEikonEnv->AppUi() ); + + if ( appui->SuppressingKeyEvents() ) + { + return EKeyWasConsumed; + } + + TKeyResponse result( EKeyWasNotConsumed ); + if ( aType == EEventKey || aType == EEventKeyDown ) + { + TInt index = iListBox->CurrentItemIndex(); + if( ( aKeyEvent.iCode == EKeyBackspace ) && ( index != -1 ) ) + { + result = EKeyWasConsumed; + } + else + { + result = iListBox->OfferKeyEventL( aKeyEvent, aType ); + + if( aKeyEvent.iCode == EKeyUpArrow ) + { + if( iPartner ) + { + iPartner->HandleUpKeyPressedL(); + } + } + else if( aKeyEvent.iCode == EKeyDownArrow ) + { + if( iPartner ) + { + iPartner->HandleDownKeyPressedL(); + } + } + else if( aKeyEvent.iCode == EKeyOK ) + { + if( iPartner ) + { + iPartner->HandleSelectionKeyPressedL(); + } + } + } + } + return result; + } + +// --------------------------------------------------------- +// CWsfMainViewContainer::LoadGraphicsL +// --------------------------------------------------------- +// +CAknIconArray* CWsfMainViewContainer::LoadGraphicsL() + { + LOG_ENTERFN( "CWsfMainViewContainer::LoadGraphicsL" ); + CAknIconArray* icons = new(ELeave) CAknIconArray( KIconListGranularity ); + CleanupStack::PushL( TCleanupItem( CleanUpResetAndDestroy,icons) ); + + + //KWlanOnIcon + icons->InsertL( KWlanOnIcon, + LoadSkinnableIconLC( KAknsIIDQgnIndiWlanSnifferPluginOn, + EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on) ); + CleanupStack::Pop(); /*icon*/ + + //KWlanOnIcon_0 + icons->InsertL( KWlanOnIcon_0, + LoadSkinnableIconLC( KAknsIIDQgnIndiWlanSnifferPluginOn0, + EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on_0) ); + CleanupStack::Pop(); /*icon*/ + + //KWlanOnIcon_0 + icons->InsertL( KWlanOnIcon_1, + LoadSkinnableIconLC( KAknsIIDQgnIndiWlanSnifferPluginOn1, + EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on_1) ); + CleanupStack::Pop(); /*icon*/ + + //ESecureNetworkIcon + icons->InsertL( KSecureNetworkIcon, LoadSkinnableBlackIconLC( + KAknsIIDQgnIndiWlanSecureNetworkAdd, + EMbmWsficonsQgn_indi_wlan_secure_network_add) ); + + CleanupStack::Pop(); /*icon*/ + + //ENoSignalIcon + icons->InsertL( KNoSignalIcon, LoadIconLC( + EMbmWsficonsEmpty13x13) ); + CleanupStack::Pop(); /*icon*/ + + //EPoorSignal + icons->InsertL( KPoorSignal, LoadSkinnableBlackIconLC( + KAknsIIDQgnIndiWlanSignalLowAdd, + EMbmWsficonsQgn_indi_wlan_signal_low_add) ); + + CleanupStack::Pop(); /*icon*/ + + //EAverageSignal + icons->InsertL( KAverageSignal, LoadSkinnableBlackIconLC( + KAknsIIDQgnIndiWlanSignalMedAdd, + EMbmWsficonsQgn_indi_wlan_signal_med_add) ); + CleanupStack::Pop(); /*icon*/ + + //EExcelentSignal + icons->InsertL( KExcelentSignal, LoadSkinnableBlackIconLC( + KAknsIIDQgnIndiWlanSignalGoodAdd , + EMbmWsficonsQgn_indi_wlan_signal_good_add) ); + CleanupStack::Pop(); /*icon*/ + + //EConnectedNWIcon + icons->InsertL( KConnectedNWIcon, + LoadSkinnableIconLC( KAknsIIDQgnPropCmonWlanConn, + EMbmWsficonsQgn_prop_cmon_wlan_conn) ); + + CleanupStack::Pop(); /*icon*/ + + //EKnownNWIcon + icons->InsertL( KKnownNWIcon, LoadSkinnableIconLC( + KAknsIIDQgnPropWlanBearer, + EMbmWsficonsQgn_prop_wlan_bearer) ); + CleanupStack::Pop(); /*icon*/ + + //ETransparentIcon + icons->InsertL( KTransparentIcon, LoadIconLC( + EMbmWsficonsQgn_prop_empty) ); + CleanupStack::Pop(); /*icon*/ + + CleanupStack::Pop( icons ); + return icons; + } + + + +// --------------------------------------------------------- +// CWsfMainViewContainer::CleanUpResetAndDestroy +// --------------------------------------------------------- +// +void CWsfMainViewContainer::CleanUpResetAndDestroy( TAny* aArray ) + { + if ( aArray ) + { + CArrayPtrFlat* array = static_cast*>( + aArray ); + array->ResetAndDestroy(); + delete array; + } + } + + +// --------------------------------------------------------- +// CWsfMainViewContainer::LoadIconLC +// --------------------------------------------------------- +// +CGulIcon* CWsfMainViewContainer::LoadIconLC( TInt aIconId) + { + LOG_ENTERFN( "CWsfMainViewContainer::LoadIconLC" ); + CGulIcon* icon = CGulIcon::NewLC(); + CFbsBitmap* bitmap; + CFbsBitmap* mask; + + // Creates bitmap an icon. + AknIconUtils::CreateIconL( bitmap, + mask, + KIconFileName, + aIconId, + aIconId + 1 ); + + icon->SetBitmap( bitmap ); + icon->SetMask( mask ); + return icon; + } + +// --------------------------------------------------------- +// CWsfMainViewContainer::LoadBlackIconLC +// --------------------------------------------------------- +// +CGulIcon* CWsfMainViewContainer::LoadBlackIconLC( TInt aIconId ) + { + LOG_ENTERFN( "CWsfMainViewContainer::LoadBlackIconLC" ); + CGulIcon* icon = CGulIcon::NewLC(); + CFbsBitmap* bitmap; + CFbsBitmap* mask; + + // Creates bitmap an icon. + + AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(), + KAknsIIDNone, + KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13, + bitmap, + mask, + KIconFileName, + aIconId, + aIconId+1, + KRgbBlack ); + + + + icon->SetBitmap( bitmap ); + icon->SetMask( mask ); + return icon; + } + +// --------------------------------------------------------- +// CWsfMainViewContainer::LoadSkinnableIconLC +// --------------------------------------------------------- +// +CGulIcon* CWsfMainViewContainer::LoadSkinnableIconLC( + const TAknsItemID aAknItemId, + const TInt aIconId ) + { + CGulIcon* icon = CGulIcon::NewLC(); + CFbsBitmap* bitmap; + CFbsBitmap* mask; + + // Creates bitmap an icon. + + AknsUtils::CreateIconL( AknsUtils::SkinInstance(), + aAknItemId, + bitmap, + mask, + KIconFileName, + aIconId, + aIconId+1 ); + + icon->SetBitmap( bitmap ); + icon->SetMask( mask ); + return icon; + } + +// --------------------------------------------------------- +// CWsfMainViewContainer::LoadSkinnableBlackIconLC +// --------------------------------------------------------- +// +CGulIcon* CWsfMainViewContainer::LoadSkinnableBlackIconLC( + const TAknsItemID aAknItemId, + const TInt aIconId ) + { + CGulIcon* icon = CGulIcon::NewLC(); + CFbsBitmap* bitmap; + CFbsBitmap* mask; + + // Creates bitmap an icon. + + AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(), + aAknItemId, + KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13, + bitmap, + mask, + KIconFileName, + aIconId, + aIconId+1, + KRgbBlack ); + + icon->SetBitmap( bitmap ); + icon->SetMask( mask ); + return icon; + } + + + +// --------------------------------------------------------- +// CWsfMainViewContainer::UpdateHotSpotsL +// --------------------------------------------------------- +// +void CWsfMainViewContainer::UpdateHotSpotsL( MDesCArray* aItemTextArray, + TInt aCurrentItem ) + { + LOG_ENTERFN( "CWsfMainViewContainer::UpdateHotSpotsL" ); + StopConnectingAnimation(); + iListBox->Reset(); + iListBox->Model()->SetItemTextArray( aItemTextArray ); + iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + iListBox->HandleItemAdditionL(); + + if ( aItemTextArray->MdcaCount() ) + { + TInt lastIndex = aItemTextArray->MdcaCount() -1; + if ( aCurrentItem <= lastIndex ) + { + iListBox->SetCurrentItemIndex( aCurrentItem ); + } + else //( aCurrentItem > lastIndex ) + { + iListBox->SetCurrentItemIndex( lastIndex ); + } + TPtrC itemtext = iListBox->Model()->ItemText(0); + HBufC* text = itemtext.AllocLC(); + TPtr buffer = text->Des(); + if ( ParseStringForAnimationL( buffer ) ) + { + //Get the list box items model. + MDesCArray* listArray = iListBox->Model()->ItemTextArray(); + CDesCArray* itemArray = static_cast(listArray); + itemArray->Delete(0,1); + itemArray->InsertL(0,buffer); + LOG_WRITE("Connecting status found"); + StartConnectingAnimationL(); + } + CleanupStack::PopAndDestroy(text); + } + + iParentView->UpdateBrowserUsageInfoL(); + + iListBox->DrawDeferred(); + } + + +// -------------------------------------------------------------------------- +// CWsfAiView::ParseStringForAnimationL() +// -------------------------------------------------------------------------- +// +TBool CWsfMainViewContainer::ParseStringForAnimationL( TDes& aString ) + { + LOG_ENTERFN( "CWsfMainViewContainer::ParseStringForAnimationL" ); + TBool found = EFalse; + // start looking for '\t' digits and parse + // the icon identifiers and label text + + // L"\tOther (hidden netw.)" + // L"6\tAd-hoc WPA\tConnecting\t4\t0" - this we are trying to find + + TChar delimiter('\t'); + TInt firstTabPos = aString.Locate( delimiter ); + TInt secondTabPos = aString.Mid( + firstTabPos +1 ).Locate( + delimiter ) + firstTabPos + 1; + TInt thirdTabPos = aString.Mid( + secondTabPos +1 ).Locate( + delimiter ) + secondTabPos + 1; + + // ok we have the tab positions read the values... + TInt firstIcon; + if ( firstTabPos ) + { + TLex( aString.Mid( 0, firstTabPos )).Val( (TInt&)firstIcon ); + LOG_WRITEF( "First Icon %d", firstIcon ); + } + + if ( secondTabPos && thirdTabPos ) + { + HBufC * foundString = aString.Mid( secondTabPos+1, + thirdTabPos-secondTabPos-1 ).AllocLC(); + + if ( !iStatusConnecting ) + { + iStatusConnecting = StringLoader::LoadL( + R_QTN_SNIFFER_CONNECTING ); + } + + if ( !foundString->Compare( iStatusConnecting->Des() ) ) + { + HBufC* item = HBufC::NewLC( KFormat1Icon().Length() ); + item->Des().Format( KFormat1Icon, iConnectingIcons[iConnectingIndex] ); + LOG_WRITEF( "Replace Icon %d", iConnectingIcons[iConnectingIndex] ); + + aString.Replace(0, firstTabPos, item->Des() ); + found = ETrue; + CleanupStack::PopAndDestroy( item ); + } + CleanupStack::PopAndDestroy( foundString ); + } + + return found; + } + + +// -------------------------------------------------------------------------- +// CWsfMainViewContainer::StartConnectingAnimationL +// -------------------------------------------------------------------------- +// +void CWsfMainViewContainer::StartConnectingAnimationL() + { + LOG_ENTERFN( "CWsfMainViewContainer::StartConnectingAnimationL" ); + + if ( iAnimationPeriodic ) + { + iAnimationPeriodic->Cancel(); + delete iAnimationPeriodic; + iAnimationPeriodic = NULL; + } + + InitializeConnectingAnimation(); + iAnimationPeriodic = CPeriodic::NewL( + CActive::EPriorityLow ); + + iAnimationPeriodic->Start( + TTimeIntervalMicroSeconds32( KConnectingStepTime ), + TTimeIntervalMicroSeconds32( KConnectingStepTime ), + TCallBack( + CWsfMainViewContainer::DoConnectingAnimationStepL, + this + ) ); + } + + +// -------------------------------------------------------------------------- +// CWsfMainViewContainer::StopConnectingAnimation +// -------------------------------------------------------------------------- +// +void CWsfMainViewContainer::StopConnectingAnimation() + { + LOG_ENTERFN( "CWsfMainViewContainer::StopConnectingAnimation" ); + + if ( iAnimationPeriodic ) + { + iAnimationPeriodic->Cancel(); + delete iAnimationPeriodic; + iAnimationPeriodic = NULL; + } + } + + +// --------------------------------------------------------------------------- +// CWsfAiPlugin::DoConnectingAnimationStepL +// --------------------------------------------------------------------------- +// +TInt CWsfMainViewContainer::DoConnectingAnimationStepL( TAny* ptr ) + { + LOG_ENTERFN( "CWsfMainViewContainer::DoConnectingAnimationStepL" ); + static_cast( ptr )->DoConnectingAnimationStepL(); + return ETrue; + } + +// --------------------------------------------------------------------------- +// CWsfAiPlugin::DoConnectingAnimationStepL +// --------------------------------------------------------------------------- +// +void CWsfMainViewContainer::DoConnectingAnimationStepL() + { + LOG_ENTERFN( "CWsfMainViewContainer::DoConnectingAnimationStepL" ); + AnimateConnecting(); + if ( iListBox->Model()->ItemTextArray()->MdcaCount() ) + { + TPtrC itemtext = iListBox->Model()->ItemText(0); + HBufC* text = itemtext.AllocLC(); + TPtr buffer = text->Des(); + if ( ParseStringForAnimationL( buffer )) + { + //Get the list box items model. + MDesCArray* listArray = iListBox->Model()->ItemTextArray(); + CDesCArray* itemArray = static_cast(listArray); + itemArray->Delete(0,1); + itemArray->InsertL(0,buffer); + iListBox->HandleItemAdditionL(); + iListBox->DrawDeferred(); + LOG_WRITE("Connecting status found"); + } + else + { + StopConnectingAnimation(); + } + CleanupStack::PopAndDestroy( text ); + } + } + + +// -------------------------------------------------------------------------- +// CWsfAiModel::InitializeRefreshAnimation +// -------------------------------------------------------------------------- +// +void CWsfMainViewContainer::InitializeConnectingAnimation() + { + LOG_ENTERFN( "CWsfMainViewContainer::InitializeConnectingAnimation" ); + iConnectingIndex = 0; + } + + +// -------------------------------------------------------------------------- +// CWsfAiModel::AnimateConnecting +// -------------------------------------------------------------------------- +// +void CWsfMainViewContainer::AnimateConnecting() + { + LOG_ENTERFN( "CWsfMainViewContainer::AnimateConnecting" ); + ++iConnectingIndex %= iConnectingIcons.Count(); + } + + +// --------------------------------------------------------- +// CWsfMainViewContainer::SelectedItem +// --------------------------------------------------------- +// +TInt CWsfMainViewContainer::SelectedItem() + { + return iListBox->CurrentItemIndex(); + } + +// --------------------------------------------------------- +// CWsfMainViewContainer::HandleResourceChange +// --------------------------------------------------------- +// +void CWsfMainViewContainer::HandleResourceChange( TInt aType ) + { + LOG_ENTERFN( "CWsfMainViewContainer::HandleResourceChange" ); + CCoeControl::HandleResourceChange( aType ); + + if ( aType == KAknsMessageSkinChange ) + { + TRAP_IGNORE( SetListboxIconsL() ); + SizeChanged(); + } + + if( aType == KEikDynamicLayoutVariantSwitch ) + { + TRect mainPaneRect; + AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, + mainPaneRect ); + SetRect( mainPaneRect ); + DrawNow(); + } + } + +// --------------------------------------------------------- +// CWsfMainViewContainer::SetPartner +// --------------------------------------------------------- +// +void CWsfMainViewContainer::SetPartner( + MWsfMainViewControllerPartner& aPartner ) + { + iPartner = &aPartner; + } + +// --------------------------------------------------------- +// CWsfMainViewContainer::UpdateNaviPaneL +// --------------------------------------------------------- +// +void CWsfMainViewContainer::UpdateNaviPaneL( const TDesC& aPaneText ) + { + LOG_ENTERFN( "CWsfMainViewContainer::UpdateNaviPaneL" ); + if ( !( ( CWsfAppUi *)( iEikonEnv->AppUi() ) )->Foreground() ) + { + return; + } + + GetPanesL(); + + if ( iNaviDecorator ) + { + PopNaviPane(); + } + + iNaviDecorator = iNaviPane->CreateNavigationLabelL( aPaneText ); + iNaviDecorator->MakeScrollButtonVisible( ETrue ); + iNaviPane->PushL( *iNaviDecorator ); + } + +// --------------------------------------------------------- +// CWsfMainViewContainer::ListBox +// --------------------------------------------------------- +// +CAknDoubleGraphicStyleListBox* CWsfMainViewContainer::ListBox() const + { + return iListBox; + } + +// --------------------------------------------------------- +// CWsfMainViewContainer::PopNaviPane +// --------------------------------------------------------- +// +void CWsfMainViewContainer::PopNaviPane() + { + LOG_ENTERFN( "CWsfMainViewContainer::PopNaviPane" ); + if ( iNaviPane && iNaviDecorator ) + { + iNaviPane->Pop( iNaviDecorator ); + delete iNaviDecorator; + iNaviDecorator = NULL; + } + } + +// --------------------------------------------------------- +// CWsfMainViewContainer::GetPanesL +// --------------------------------------------------------- +// +void CWsfMainViewContainer::GetPanesL() + { + LOG_ENTERFN( "CWsfMainViewContainer::GetPanesL" ); + if( !iNaviPane ) + { + CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); + + iNaviPane = static_cast( + statusPane->ControlL( + TUid::Uid(EEikStatusPaneUidNavi ) ) ); + } + } + +// --------------------------------------------------------- +// CWsfMainViewContainer::SetListboxIconsL +// --------------------------------------------------------- +// +void CWsfMainViewContainer::SetListboxIconsL() + { + LOG_ENTERFN( "CWsfMainViewContainer::SetListboxIconsL" ); + CAknIconArray* icons = LoadGraphicsL(); + + CWsfDocument* doc = static_cast + ( iEikonEnv->EikAppUi()->Document() ); + + doc->WlanInfoBranding().AppendBrandingIconsL( *icons ); + + iListBox->ItemDrawer()->ColumnData()->SetIconArray( icons ); + + } + +// --------------------------------------------------------- +// CWsfMainViewContainer::GetHelpContext +// --------------------------------------------------------- +// +void CWsfMainViewContainer::GetHelpContext( TCoeHelpContext& aContext) const + { + aContext.iMajor = TUid::Uid( 0x10281CAA ); + aContext.iContext = KSNIFFER_HLP_MAIN; + } + + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/src/wsfmainviewcontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfmainviewcontroller.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,238 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 TWsfMainViewController. +* +*/ + +// INTERNAL INCLUDES +#include "wsfmainviewcontroller.h" +#include "wsfmainviewmodel.h" +#include "wsfmainviewcontainer.h" +#include "wsfwlaninfo.h" +#include "wsfwlaninfoarray.h" + +#include "wsflogger.h" + + +// LOCAL DEFINITIONS +#ifdef _DEBUG + _LIT( KMainViewControllerPanic, "TWsfMainViewController" ); + #define _ASSERTD( cond ) __ASSERT_DEBUG( (cond), \ + User::Panic( KMainViewControllerPanic, __LINE__) ) +#else + #define _ASSERTD( cond ) {} +#endif //_DEBUG + + +// --------------------------------------------------------------------------- +// TWsfMainViewController::SetModel +// --------------------------------------------------------------------------- +// +void TWsfMainViewController::SetModel( CWsfMainViewModel* aModel ) + { + iModel = aModel; + iValidItem = EFalse; + } + + +// --------------------------------------------------------------------------- +// TWsfMainViewController::SetContainer +// --------------------------------------------------------------------------- +// +void TWsfMainViewController::SetContainer( CWsfMainViewContainer* aContainer ) + { + iContainer = aContainer; + } + + +// --------------------------------------------------------------------------- +// TWsfMainViewController::UpdateHotSpotsL +// --------------------------------------------------------------------------- +// +void TWsfMainViewController::UpdateHotSpotsL( CWsfWlanInfoArray* aWlanList ) + { + LOG_ENTERFN( "TWsfMainViewController::UpdateHotSpotsL" ); + // Format WLAN list which was passed as a parameter + iModel->FormatWlanListL( aWlanList ); + CDesCArray* formattedList = iModel->GetWlanList(); + + if ( iContainer ) + { + // If some WLAN was already selected, don't lose the focus + // By default show the first item (index == 0) + TInt index = 0; + TWsfWlanInfo* wlanInfo = aWlanList->Match( iModel->SelectedWlan(), + aWlanList->Count() ); + if ( wlanInfo ) + { + index = aWlanList->GetArrayIndex( wlanInfo ); + } + iContainer->UpdateHotSpotsL( formattedList, index ); + } + } + + +// --------------------------------------------------------------------------- +// TWsfMainViewController::UpdateNaviPaneL +// --------------------------------------------------------------------------- +// +void TWsfMainViewController::UpdateNaviPaneL() + { + LOG_ENTERFN( "TWsfMainViewController::UpdateNaviPaneL" ); + HBufC* naviText = iModel->FormatNaviPaneLC(); + iContainer->UpdateNaviPaneL( *naviText ); + CleanupStack::PopAndDestroy( naviText ); + } + + +// --------------------------------------------------------------------------- +// TWsfMainViewController::UpdateWlanListL +// --------------------------------------------------------------------------- +// +void TWsfMainViewController::UpdateWlanListL( CWsfWlanInfoArray* aWlanArray ) + { + LOG_ENTERFN( "TWsfMainViewController::UpdateWlanListL" ); + UpdateHotSpotsL( aWlanArray ); + UpdateNaviPaneL(); + } + +// --------------------------------------------------------------------------- +// TWsfMainViewController::UpdateWlanListInBackgroundL +// --------------------------------------------------------------------------- +// +void TWsfMainViewController::UpdateWlanListInBackgroundL( + CWsfWlanInfoArray* aWlanArray ) + { + LOG_ENTERFN( "TWsfMainViewController::UpdateWlanListInBackgroundL" ); + iModel->FormatWlanListL( aWlanArray ); + } + +// --------------------------------------------------------------------------- +// TWsfMainViewController::RefreshL +// --------------------------------------------------------------------------- +// +void TWsfMainViewController::RefreshL() + { + LOG_ENTERFN( "TWsfMainViewController::RefreshL" ); + CDesCArray* formattedList = iModel->GetWlanList(); + iContainer->UpdateHotSpotsL( formattedList, iModel->SelectedIndex() ); + UpdateNaviPaneL(); + } + + +// --------------------------------------------------------------------------- +// TWsfMainViewController::SelectedItem +// --------------------------------------------------------------------------- +// +TWsfWlanInfo* TWsfMainViewController::SelectedItem() + { + LOG_ENTERFN( "TWsfMainViewController::SelectedItem" ); + + return iValidItem? &iSelectedItem: NULL; + } + + +// --------------------------------------------------------------------------- +// TWsfMainViewController::SetPartner +// --------------------------------------------------------------------------- +// +void TWsfMainViewController::SetPartner( MWsfMainViewPartner& aPartner ) + { + iPartner = &aPartner; + } + + +// --------------------------------------------------------------------------- +// TWsfMainViewController::UpdateSelectedItemL +// --------------------------------------------------------------------------- +// +void TWsfMainViewController::UpdateSelectedItemL() + { + LOG_ENTERFN( "TWsfMainViewController::UpdateSelectedItemL" ); + + _ASSERTD( iModel && iContainer ); + + TInt selectedItem = iContainer->SelectedItem(); + CWsfWlanInfoArray* array = iModel->GetInfoArray(); + if ( array ) + { + TWsfWlanInfo* item = NULL; + if ( selectedItem < array->Count() ) + { + item = array->At( selectedItem ); + } + + if ( item ) + { + iSelectedItem = *item; + iValidItem = ETrue; + } + else + { + iValidItem = EFalse; + } + } + + // Store name of focused WLAN + if ( iValidItem ) + { + HBufC8* ssid = iSelectedItem.GetSsidAsUtf8LC(); + iModel->SetSelectedWlan( ssid ); + CleanupStack::Pop( ssid ); + } + + } + + +// --------------------------------------------------------------------------- +// TWsfMainViewController::HandleUpKeyPressedL +// --------------------------------------------------------------------------- +// +void TWsfMainViewController::HandleUpKeyPressedL() + { + LOG_ENTERFN( "TWsfMainViewController::HandleUpKeyPressedL" ); + _ASSERTD( iModel ); + + // Store just listbox index. Needed + iModel->SetSelectedIndex( iContainer->SelectedItem() ); + } + + +// --------------------------------------------------------------------------- +// TWsfMainViewController::HandleDownKeyPressedL +// --------------------------------------------------------------------------- +// +void TWsfMainViewController::HandleDownKeyPressedL() + { + LOG_ENTERFN( "TWsfMainViewController::HandleDownKeyPressedL" ); + _ASSERTD( iModel ); + + iModel->SetSelectedIndex( iContainer->SelectedItem() ); + } + + +// --------------------------------------------------------------------------- +// TWsfMainViewController::HandleSelectionKeyPressedL +// --------------------------------------------------------------------------- +// +void TWsfMainViewController::HandleSelectionKeyPressedL() + { + LOG_ENTERFN( "TWsfMainViewController::HandleSelectionKeyPressedL" ); + _ASSERTD( iPartner ); + + iPartner->ShowMenuBarL(); + } + +// End of file + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/mainapplication/src/wsfmainviewmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfmainviewmodel.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,376 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfMainViewModel. +* +*/ + +// EXTERNAL INCLUDES +#include +#include +#include +#include + +// CLASS HEADER +#include "wsfmainviewmodel.h" + +// INTERNAL INCLUDES +#include "wsfwlaninfo.h" +#include "wsfwlaninfoarray.h" +#include "wsfmainviewinternals.h" + +#include "wsflogger.h" + + +// LOCAL DEFINITIONS + +// Listbox item format for open networks +_LIT( KVisibleItemFormat1Icon, "%d\t%S\t%S\t%d" ); + +// Listbox item format for secured networks +_LIT( KVisibleItemFormat2Icons, "%d\t%S\t%S\t%d\t%d" ); + +// Listbox item format for "Other (unlisted)" item +_LIT( KHiddenItemFormat, "\t%S" ); + +// Maximal length of listbox item strings +const TInt KListBoxItemMaxLength = 128; + +// Listbox granularity +const TUint KWlanListGranularity = 4; + + + +// CONSTRUCTION AND DESTRUCTION +// --------------------------------------------------------------------------- +// CWsfMainViewModel::NewL +// --------------------------------------------------------------------------- +// +CWsfMainViewModel* CWsfMainViewModel::NewL() + { + LOG_ENTERFN( "CWsfMainViewModel::NewL" ); + CWsfMainViewModel* self = CWsfMainViewModel::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CWsfMainViewModel::NewLC +// --------------------------------------------------------------------------- +// +CWsfMainViewModel* CWsfMainViewModel::NewLC() + { + LOG_ENTERFN( "CWsfMainViewModel::NewLC" ); + CWsfMainViewModel* self = new( ELeave ) CWsfMainViewModel; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CWsfMainViewModel::~CWsfMainViewModel +// --------------------------------------------------------------------------- +// +CWsfMainViewModel::~CWsfMainViewModel() + { + LOG_ENTERFN( "CWsfMainViewModel::~CWsfMainViewModel" ); + delete iFormattedWlanList; + delete iSelectedWlan; + } + +// --------------------------------------------------------------------------- +// CWsfMainViewModel::CWsfMainViewModel +// --------------------------------------------------------------------------- +// +CWsfMainViewModel::CWsfMainViewModel(): iCoeEnv( CCoeEnv::Static() ) + { + } + +// --------------------------------------------------------------------------- +// CWsfMainViewModel::ConstructL +// --------------------------------------------------------------------------- +// +void CWsfMainViewModel::ConstructL() + { + LOG_ENTERFN( "CWsfMainViewModel::ConstructL" ); + iFormattedWlanList = new (ELeave) CDesCArrayFlat( KWlanListGranularity ); + iSelectedWlan = KNullDesC8().AllocL(); + + // add the hidden wlan item to the list by default + TWsfWlanInfo dummy; + HBufC* hidden = HBufC::NewLC( KListBoxItemMaxLength ); + TPtr ptr( hidden->Des() ); + + FormatHiddenWlanItemL( dummy, ptr ); + iFormattedWlanList->AppendL( *hidden ); + + CleanupStack::PopAndDestroy( hidden ); + } + +// --------------------------------------------------------------------------- +// CWsfMainViewModel::GetWlanList +// --------------------------------------------------------------------------- +// +CDesCArrayFlat* CWsfMainViewModel::GetWlanList() + { + return iFormattedWlanList; + } + +// --------------------------------------------------------------------------- +// CWsfMainViewModel::GetInfoArray +// --------------------------------------------------------------------------- +// +CWsfWlanInfoArray* CWsfMainViewModel::GetInfoArray() + { + return iWlanInfoArray; + } + +// --------------------------------------------------------------------------- +// CWsfMainViewModel::SetSelectedWlan +// --------------------------------------------------------------------------- +// +void CWsfMainViewModel::SetSelectedWlan( HBufC8* aSsid ) + { + delete iSelectedWlan; + iSelectedWlan = aSsid; + } + +// --------------------------------------------------------------------------- +// CWsfMainViewModel::SelectedWlan +// --------------------------------------------------------------------------- +// +const TDesC8& CWsfMainViewModel::SelectedWlan() + { + return *iSelectedWlan; + } + +// --------------------------------------------------------------------------- +// CWsfMainViewModel::SetSelectedIndex +// --------------------------------------------------------------------------- +// +void CWsfMainViewModel::SetSelectedIndex( TInt aIndex ) + { + iListboxIndex = aIndex; + } + +// --------------------------------------------------------------------------- +// CWsfMainViewModel::SelectedIndex +// --------------------------------------------------------------------------- +// +TInt CWsfMainViewModel::SelectedIndex() + { + return iListboxIndex; + } + +// --------------------------------------------------------------------------- +// CWsfMainViewModel::FormatNaviPaneLC +// --------------------------------------------------------------------------- +// +HBufC* CWsfMainViewModel::FormatNaviPaneLC() + { + LOG_ENTERFN( "CWsfMainViewModel::FormatNaviPaneLC" ); + HBufC* textOfNaviPane = NULL; + + if ( !iVisibleWlans ) + { + textOfNaviPane = KNullDesC().AllocLC(); + } + + else if ( iVisibleWlans == 1 ) + { + textOfNaviPane = StringLoader::LoadLC( + R_QTN_SNIFFER_NAVI_ONE_WLAN_NW_AVAILABLE, iCoeEnv ); + } + else + { + textOfNaviPane = StringLoader::LoadLC( + R_QTN_SNIFFER_NAVI_MANY_WLAN_NWS_AVAILABLE, + iVisibleWlans, + iCoeEnv ); + } + return textOfNaviPane; + } + +// --------------------------------------------------------------------------- +// CWsfMainViewModel::FormatWlanListL +// --------------------------------------------------------------------------- +// +void CWsfMainViewModel::FormatWlanListL( CWsfWlanInfoArray* aWlanList ) + { + LOG_ENTERFN( "CWsfMainViewModel::FormatWlanListL" ); + //Function expects that items in list are already in proper order + iVisibleWlans = 0; + iWlanInfoArray = aWlanList; + iFormattedWlanList->Reset(); + HBufC* item = HBufC::NewLC( KListBoxItemMaxLength ); + TPtr ptr( item->Des() ); + for (TInt i = 0; i < aWlanList->Count(); ++i ) + { + TWsfWlanInfo* wlanInfo = aWlanList->At( i ); + + // Hidden WLAN item is appended later for unknown hidden networks + if ( wlanInfo->Hidden() && !wlanInfo->iIapId ) + { + continue; + } + else + { + ++iVisibleWlans; + } + + // known hidden wlans are also "visible" + ptr.Zero(); + FormatVisibleWlanItemL( *wlanInfo, ptr ); + iFormattedWlanList->AppendL( ptr ); + } + + // now add "Other (unlisted)..." for hidden networks (always visible) + // make up a dummy wlaninfo + TWsfWlanInfo dummy; + + ptr.Zero(); + FormatHiddenWlanItemL( dummy, ptr ); + iFormattedWlanList->AppendL( ptr ); + + CleanupStack::PopAndDestroy ( item ); + } + +// --------------------------------------------------------------------------- +// CWsfMainViewModel::FormatHiddenWlanItemL +// --------------------------------------------------------------------------- +// +void CWsfMainViewModel::FormatHiddenWlanItemL( TWsfWlanInfo& /*aWlan*/, + TDes& aItem ) + { + LOG_ENTERFN( "CWsfMainViewModel::FormatHiddenWlanItemL" ); + HBufC* primaryText = StringLoader::LoadLC( R_QTN_SNIFFER_HIDDEN_WLAN ); + + // Only Hidden WLAN text is shown. + // All icons are transparent + aItem.Format( KHiddenItemFormat, primaryText ); + + CleanupStack::PopAndDestroy( primaryText ); + } + +// --------------------------------------------------------------------------- +// CWsfMainViewModel::FormatVisibleWlanItemL +// --------------------------------------------------------------------------- +// +void CWsfMainViewModel::FormatVisibleWlanItemL( TWsfWlanInfo& aWlan, + TDes& aItem ) + { + LOG_ENTERFN( "CWsfMainViewModel::FormatVisibleWlanItemL" ); + // Icon in first column is transparent by default + // Known / Connected / None + TInt column1Icon = KTransparentIcon; // qgn_transparent.svg + + if ( aWlan.BrandId() ) + { + column1Icon = KTransparentIcon + aWlan.BrandId(); + } + else if ( aWlan.Connected() ) + { + column1Icon = KConnectedNWIcon; // qgn_prop_cmon_wlan_conn.svg + } + else if ( aWlan.Known() ) + { + column1Icon = KKnownNWIcon; // qgn_prop_wlan_bearer.svg + } + + //Ssid as primary text + HBufC* primaryText( NULL ); + + if ( aWlan.iNetworkName.Length() ) // If there is IAP + { + primaryText = aWlan.GetIapNameAsUnicodeLC(); + } + else // If there no IAP + { + primaryText = aWlan.GetSsidAsUnicodeLC(); + } + + //Secondary Text, "Known" if IAP is already defined. Else "Unknown" + TInt resId = R_QTN_SNIFFER_UNKNOWN; + if ( aWlan.ConnectionStatus() == EConnected ) + { + resId = R_QTN_SNIFFER_CONNECTED; + } + else if ( aWlan.ConnectionStatus() == EConnecting ) + { + resId = R_QTN_SNIFFER_CONNECTING; + } + else if ( aWlan.Known() ) + { + resId = R_QTN_SNIFFER_KNOWN; + } + + HBufC* secondaryText = StringLoader::LoadLC( resId ); + + + //Column 3 + //Show secure icon if network is secure. By default show transparant icon. + TInt column4Icon = aWlan.Secure() ? KSecureNetworkIcon : KTransparentIcon; + + + // Signal strenght for column 4 + // No signal icon is set by default + TInt column3Icon = KNoSignalIcon; //qgn_transparent.svg + + switch ( aWlan.SignalStrength() ) + { + case EPoor: + { + column3Icon = KPoorSignal; //qgn_indi_wlan_signal_low_add.svg + break; + } + case EAverage: + { + column3Icon = KAverageSignal; //qgn_indi_wlan_signal_med_add.svg + break; + } + case EExcelent: + { + column3Icon = KExcelentSignal; //qgn_indi_wlan_signal_good_add.svg + break; + } + + case ENoSignal: + default: + { + column3Icon = KNoSignalIcon; //qgn_indi_wlan_signal_no_wlan.svg + break; + } + } + + if ( column4Icon == KTransparentIcon ) + { + aItem.Format( KVisibleItemFormat1Icon, column1Icon, + primaryText, + secondaryText, + column3Icon ); + } + else + { + aItem.Format( KVisibleItemFormat2Icons, column1Icon, + primaryText, + secondaryText, + column3Icon, + column4Icon ); + } + + CleanupStack::PopAndDestroy( secondaryText ); + CleanupStack::PopAndDestroy( primaryText ); + } + +// End of file + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/model/bwins/wsfmodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/bwins/wsfmodelu.def Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,41 @@ +EXPORTS + ?ObservedWlan@CWsfModel@@QAEABVTDesC8@@XZ @ 1 NONAME ; class TDesC8 const & CWsfModel::ObservedWlan(void) + ?NewL@CWsfAppLauncher@@SAPAV1@XZ @ 2 NONAME ; class CWsfAppLauncher * CWsfAppLauncher::NewL(void) + ?EnableScanL@CWsfModel@@QAEHXZ @ 3 NONAME ; int CWsfModel::EnableScanL(void) + ?ActiveViewL@CWsfModel@@QAE?AVTUid@@XZ @ 4 NONAME ; class TUid CWsfModel::ActiveViewL(void) + ?AbortConnectingL@CWsfModel@@QAEXXZ @ 5 NONAME ; void CWsfModel::AbortConnectingL(void) + ?ContinueBrowsingL@CWsfModel@@QAEXXZ @ 6 NONAME ; void CWsfModel::ContinueBrowsingL(void) + ?GetConnectedWlanDetails@CWsfModel@@QAEXAAV?$TPckgBuf@H@@AAVTWsfWlanInfo@@AAVTRequestStatus@@@Z @ 7 NONAME ; void CWsfModel::GetConnectedWlanDetails(class TPckgBuf &, class TWsfWlanInfo &, class TRequestStatus &) + ?SetRefreshState@CWsfModel@@QAEXH@Z @ 8 NONAME ; void CWsfModel::SetRefreshState(int) + ?RefreshScan@CWsfModel@@QAEXAAV?$TPckgBuf@H@@AAVTRequestStatus@@@Z @ 9 NONAME ; void CWsfModel::RefreshScan(class TPckgBuf &, class TRequestStatus &) + ?SetEngineObserver@CWsfModel@@QAEXPAVMWsfModelObserver@@@Z @ 10 NONAME ; void CWsfModel::SetEngineObserver(class MWsfModelObserver *) + ?CheckIsIapIdValidL@CWsfModel@@QBEXI@Z @ 11 NONAME ; void CWsfModel::CheckIsIapIdValidL(unsigned int) const + ?ConnectL@CWsfModel@@QAEXAAV?$TPckgBuf@H@@KHW4TWsfIapPersistence@@AAVTRequestStatus@@@Z @ 12 NONAME ; void CWsfModel::ConnectL(class TPckgBuf &, unsigned long, int, enum TWsfIapPersistence, class TRequestStatus &) + ?SetActiveViewL@CWsfModel@@QAEXH@Z @ 13 NONAME ; void CWsfModel::SetActiveViewL(int) + ?NewLC@CWsfModel@@SAPAV1@AAVMWsfStateChangeObserver@@H@Z @ 14 NONAME ; class CWsfModel * CWsfModel::NewLC(class MWsfStateChangeObserver &, int) + ?IsScanEnabledL@CWsfModel@@QAEHXZ @ 15 NONAME ; int CWsfModel::IsScanEnabledL(void) + ?SetConnectResultL@CWsfModel@@QAEXHI@Z @ 16 NONAME ; void CWsfModel::SetConnectResultL(int, unsigned int) + ?AbortScanningL@CWsfModel@@QAEXXZ @ 17 NONAME ; void CWsfModel::AbortScanningL(void) + ?CancelNotifyEvents@CWsfModel@@QAEXXZ @ 18 NONAME ; void CWsfModel::CancelNotifyEvents(void) + ??1CWsfModel@@UAE@XZ @ 19 NONAME ; CWsfModel::~CWsfModel(void) + ?GetWlanListL@CWsfModel@@QAEPAVCWsfWlanInfoArray@@XZ @ 20 NONAME ; class CWsfWlanInfoArray * CWsfModel::GetWlanListL(void) + ?DisableScanL@CWsfModel@@QAEHXZ @ 21 NONAME ; int CWsfModel::DisableScanL(void) + ?GetConnectedWlanDetailsL@CWsfModel@@QAEHAAVTWsfWlanInfo@@@Z @ 22 NONAME ; int CWsfModel::GetConnectedWlanDetailsL(class TWsfWlanInfo &) + ?GetWlanListSize@CWsfModel@@QAEXAAV?$TPckgBuf@I@@AAVTRequestStatus@@@Z @ 23 NONAME ; void CWsfModel::GetWlanListSize(class TPckgBuf &, class TRequestStatus &) + ?NewL@CWsfModel@@SAPAV1@AAVMWsfStateChangeObserver@@H@Z @ 24 NONAME ; class CWsfModel * CWsfModel::NewL(class MWsfStateChangeObserver &, int) + ?Refreshing@CWsfModel@@QAEHXZ @ 25 NONAME ; int CWsfModel::Refreshing(void) + ?ContinueBrowsingL@CWsfModel@@QAEXK@Z @ 26 NONAME ; void CWsfModel::ContinueBrowsingL(unsigned long) + ?DisconnectL@CWsfModel@@QAEXXZ @ 27 NONAME ; void CWsfModel::DisconnectL(void) + ?IsConnectedL@CWsfModel@@QAEHXZ @ 28 NONAME ; int CWsfModel::IsConnectedL(void) + ?CreateAccessPointL@CWsfModel@@QAEHAAVTWsfWlanInfo@@H@Z @ 29 NONAME ; int CWsfModel::CreateAccessPointL(class TWsfWlanInfo &, int) + ?NewLC@CWsfAppLauncher@@SAPAV1@XZ @ 30 NONAME ; class CWsfAppLauncher * CWsfAppLauncher::NewLC(void) + ?RequestNotifyEventsL@CWsfModel@@QAEXAAVMWsfStateChangeObserver@@@Z @ 31 NONAME ; void CWsfModel::RequestNotifyEventsL(class MWsfStateChangeObserver &) + ?GetWlanList@CWsfModel@@QAEXAAV?$TPckgBuf@I@@AAVTPtr8@@AAVTRequestStatus@@@Z @ 32 NONAME ; void CWsfModel::GetWlanList(class TPckgBuf &, class TPtr8 &, class TRequestStatus &) + ?LaunchBrowserL@CWsfModel@@UAEXK@Z @ 33 NONAME ; void CWsfModel::LaunchBrowserL(unsigned long) + ?LaunchHelperApplicationL@CWsfModel@@QAEXAAVTWsfWlanInfo@@@Z @ 34 NONAME ; void CWsfModel::LaunchHelperApplicationL(class TWsfWlanInfo &) + ?RefreshScanL@CWsfModel@@QAEHXZ @ 35 NONAME ; int CWsfModel::RefreshScanL(void) + ?Disconnect@CWsfModel@@QAEXAAV?$TPckgBuf@H@@AAVTRequestStatus@@@Z @ 36 NONAME ; void CWsfModel::Disconnect(class TPckgBuf &, class TRequestStatus &) + ?SetObservedWlanL@CWsfModel@@QAEXABVTDesC8@@@Z @ 37 NONAME ; void CWsfModel::SetObservedWlanL(class TDesC8 const &) + ?CloseHelperApplication@CWsfModel@@QAEHXZ @ 38 NONAME ; int CWsfModel::CloseHelperApplication(void) + ?ConnectL@CWsfModel@@QAEHKHW4TWsfIapPersistence@@@Z @ 39 NONAME ; int CWsfModel::ConnectL(unsigned long, int, enum TWsfIapPersistence) + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/model/eabi/wsfmodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/eabi/wsfmodelu.def Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,44 @@ +EXPORTS + _ZN15CWsfAppLauncher4NewLEv @ 1 NONAME + _ZN15CWsfAppLauncher5NewLCEv @ 2 NONAME + _ZN9CWsfModel10DisconnectER8TPckgBufIiER14TRequestStatus @ 3 NONAME + _ZN9CWsfModel10RefreshingEv @ 4 NONAME + _ZN9CWsfModel11ActiveViewLEv @ 5 NONAME + _ZN9CWsfModel11DisconnectLEv @ 6 NONAME + _ZN9CWsfModel11EnableScanLEv @ 7 NONAME + _ZN9CWsfModel11GetWlanListER8TPckgBufIjER5TPtr8R14TRequestStatus @ 8 NONAME + _ZN9CWsfModel11RefreshScanER8TPckgBufIiER14TRequestStatus @ 9 NONAME + _ZN9CWsfModel12DisableScanLEv @ 10 NONAME + _ZN9CWsfModel12GetWlanListLEv @ 11 NONAME + _ZN9CWsfModel12IsConnectedLEv @ 12 NONAME + _ZN9CWsfModel12ObservedWlanEv @ 13 NONAME + _ZN9CWsfModel12RefreshScanLEv @ 14 NONAME + _ZN9CWsfModel14AbortScanningLEv @ 15 NONAME + _ZN9CWsfModel14IsScanEnabledLEv @ 16 NONAME + _ZN9CWsfModel14LaunchBrowserLEm @ 17 NONAME + _ZN9CWsfModel14SetActiveViewLEi @ 18 NONAME + _ZN9CWsfModel15GetWlanListSizeER8TPckgBufIjER14TRequestStatus @ 19 NONAME + _ZN9CWsfModel15SetRefreshStateEi @ 20 NONAME + _ZN9CWsfModel16AbortConnectingLEv @ 21 NONAME + _ZN9CWsfModel16SetObservedWlanLERK6TDesC8 @ 22 NONAME + _ZN9CWsfModel17ContinueBrowsingLEm @ 23 NONAME + _ZN9CWsfModel17ContinueBrowsingLEv @ 24 NONAME + _ZN9CWsfModel17SetConnectResultLEij @ 25 NONAME + _ZN9CWsfModel17SetEngineObserverEP17MWsfModelObserver @ 26 NONAME + _ZN9CWsfModel18CancelNotifyEventsEv @ 27 NONAME + _ZN9CWsfModel18CreateAccessPointLER12TWsfWlanInfoi @ 28 NONAME + _ZN9CWsfModel20RequestNotifyEventsLER23MWsfStateChangeObserver @ 29 NONAME + _ZN9CWsfModel22CloseHelperApplicationEv @ 30 NONAME + _ZN9CWsfModel23GetConnectedWlanDetailsER8TPckgBufIiER12TWsfWlanInfoR14TRequestStatus @ 31 NONAME + _ZN9CWsfModel24GetConnectedWlanDetailsLER12TWsfWlanInfo @ 32 NONAME + _ZN9CWsfModel24LaunchHelperApplicationLER12TWsfWlanInfo @ 33 NONAME + _ZN9CWsfModel4NewLER23MWsfStateChangeObserveri @ 34 NONAME + _ZN9CWsfModel5NewLCER23MWsfStateChangeObserveri @ 35 NONAME + _ZN9CWsfModel8ConnectLER8TPckgBufIiEmi18TWsfIapPersistenceR14TRequestStatus @ 36 NONAME + _ZN9CWsfModel8ConnectLEmi18TWsfIapPersistence @ 37 NONAME + _ZN9CWsfModelD0Ev @ 38 NONAME + _ZN9CWsfModelD1Ev @ 39 NONAME + _ZN9CWsfModelD2Ev @ 40 NONAME + _ZNK9CWsfModel18CheckIsIapIdValidLEj @ 41 NONAME + _ZThn12_N9CWsfModel14LaunchBrowserLEm @ 42 NONAME + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/model/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 file for project Model +* +*/ + + + +#include + + +PRJ_PLATFORMS +DEFAULT + + +PRJ_EXPORTS +// private API +../inc/wsfmodel.h |../../../inc/wsfmodel.h +../inc/wsfmodel.inl |../../../inc/wsfmodel.inl +../inc/wsfbrowserlaunchobserver.h |../../../inc/wsfbrowserlaunchobserver.h +../inc/wsfbrowserlaunchadapter.h |../../../inc/wsfbrowserlaunchadapter.h +../inc/wsfscreensaverstateobserver.h |../../../inc/wsfscreensaverstateobserver.h + +// inner API +../inc/wsfmodelobserver.h |../../inc/wsfmodelobserver.h + +../rom/wsfmodel.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wsfmodel.iby) + + +PRJ_MMPFILES +model.mmp + + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/model/group/model.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/group/model.mmp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 project Model +* +*/ + + + +#include +#include + + +TARGET wsfmodel.dll +TARGETTYPE dll + +UID 0x1000008e 0x2000CF31 + +CAPABILITY CAP_GENERAL_DLL + + +// Source files +SOURCEPATH ../src + +SOURCE wsfmodel.cpp +SOURCE wsfscreensaverwatcher.cpp +SOURCE wsfapplauncher.cpp +SOURCE wsfactivewaiter.cpp + + + +// own headers +USERINCLUDE ../inc + +// inner API +USERINCLUDE ../../inc + +// private API +USERINCLUDE ../../../inc + + +//Macro to /epoc32 headers +// MW_LAYER... not enough because of +APP_LAYER_SYSTEMINCLUDE + + + +// Used system libraries +LIBRARY euser.lib +LIBRARY bafl.lib +LIBRARY apgrfx.lib +LIBRARY cone.lib +LIBRARY ws32.lib +LIBRARY centralrepository.lib +LIBRARY cmmanager.lib +LIBRARY cmmanagerdatabase.lib +LIBRARY sysutil.lib +LIBRARY efsrv.lib + +LIBRARY wsfwlaninfo.lib +LIBRARY wsfclient.lib +LIBRARY wsfapwizard.lib + +DEBUGLIBRARY flogger.lib + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/model/inc/wsfactivewaiter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/inc/wsfactivewaiter.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,94 @@ +/* +* 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 CWsfActiveWaiter +* +*/ + + + +#ifndef __WSFSERVER_ACTIVE_WAITER_H__ +#define __WSFSERVER_ACTIVE_WAITER_H__ + +// INCLUDES +#include + +/** + * CWsfActiveWaiter class, + * an active object to replace User::WaitForRequest + * + * Usage: + * CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewL(); + * CleanupStack::PushL( waiter ); + * server.AsyncFunction( waiter->iStatus ); + * if ( waiter->WaitForRequest == KErrNone ) + * { + * // handle success + * } + * else + * { + * // handle failure + * } + * CleanupStack::PopAndDestroy( waiter ); + * + */ +NONSHARABLE_CLASS( CWsfActiveWaiter ) : public CActive + { + public: + /** + * NewL function + * @param aPlugin a pointer to notifier plugin + */ + static CWsfActiveWaiter* NewL( ); + + /** + * Destructor + */ + virtual ~CWsfActiveWaiter(); + + /** + * Waits for it's TRequestStatus to be completed + * @return Error code returned from server after request is + * completed + */ + TInt WaitForRequest( ); + + protected: + /** + * ConstructL + */ + void ConstructL(); + + /** + * Constructor + * @param aPlugin a pointer to notifier plugin + */ + CWsfActiveWaiter(); + + /** + * DoCancel from CActive + */ + virtual void DoCancel(); + + /** + * RunL from CActive + */ + virtual void RunL(); + + protected: + CActiveSchedulerWait iWait; + }; + +#endif // __WSFSERVER_ACTIVE_WAITER_H__ + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/model/inc/wsfapplauncher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/inc/wsfapplauncher.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,277 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfAppLauncher +* +*/ + + + + +#ifndef C_WSFAPPLAUNCHER_H +#define C_WSFAPPLAUNCHER_H + +#include +#include + +class MWsfBrowserLaunchObserver; +class CRepository; + + +/** +* Browser launching states +*/ +enum TWsfLaunchState + { + EIdle, + EShuttingDown, + EStartingUp, + ECompleted, + EFinished + }; + + + +// CLASS DEFINITION +/** + * Class to manage browser launching and closure. + * + * @lib wsfmodel.lib + * @since S60 5.0 + */ +NONSHARABLE_CLASS( CWsfAppLauncher ): public CActive + { + public: // Constuctors and destructors + + /** + * Factory function. + * @since S60 5.0 + * @return Class instance + */ + IMPORT_C static CWsfAppLauncher* NewL(); + + /** + * Factory function. + * @since S60 5.0 + * @return Class instance + */ + IMPORT_C static CWsfAppLauncher* NewLC(); + + /** + * Destructor + * @since S60 5.0 + */ + virtual ~CWsfAppLauncher(); + + + private: //Constuctors + + /** + * Constructor + * @since S60 5.0 + */ + CWsfAppLauncher(); + + /** + * Second-phase constructor + * @since S60 5.0 + */ + void ConstructL(); + + + public: //New public functions + + /** + * Launches Browser application asynchronously using selected iap + * @since S60 5.0 + * @param aObserver Observer to be notified about launch completion + * @param aIapId IAP id passed as a parameter + */ + void LaunchBrowserL( MWsfBrowserLaunchObserver& aObserver, + TUint aIapId ); + + /** + * Launches Browser application asynchronously using selected iap and + * user defined URL + * @since S60 5.0 + * @param aObserver Observer to be notified about launch completion + * @param aIapId IAP id passed as a parameter + * @param aURL User defined WWW address to be used as start-up page + */ + void LaunchBrowserL( MWsfBrowserLaunchObserver& aObserver, + TUint aIapId, + const TDesC& aURL ); + + /** + * Switches Browser application to foreground + * @since S60 5.0 + */ + void ContinueBrowsingL(); + + /** + * Switches Browser application to foreground + * @since S60 5.0 + * @param aObserver Observer to be notified about launch completion + * @param aIapId IAP id passed as a parameter + */ + void ContinueBrowsingL( MWsfBrowserLaunchObserver& aObserver, + TUint aIapId ); + + /** + * Query launching state + * @since S60 5.0 + * @return Lauching state + */ + TWsfLaunchState Launching(); + + + /** + * Returns the IAP which was last passed to the browser + * @since S60 5.0 + * @return The IAP id passed to the browser. + */ + TUint32 BrowserIap() const; + + + private: // New private functions + + /** + * Kills browser application if the one is already lauched + * @since S60 5.0 + * @return ETrue if browser was killed, EFalse otherwise + */ + TBool KillBrowserIfAlreadyExists(); + + /** + * Launches the browser asynchronously. + * @since S60 5.0 + */ + void DoLaunchBrowserL(); + + /** + * Checks if Browser exists + * @since S60 5.0 + * @return ETrue if the browser exists + */ + TBool BrowserExists(); + + /** + * Checks what the default homepage is (URL) + * @since S60 5.0 + * @param aHomePageURL URL of the default homepage + * @return KErrNone if successful, KErrNotFound if HomePage is + * not defined + */ + TInt BrowserHomepage( TDes& aHomePageURL ); + + + private: // From CActive + + /** + * Implements cancellation of an outstanding request. + * @since S60 5.0 + */ + void DoCancel(); + + /** + * Handles an active object's request completion event. + * @since S60 5.0 + */ + void RunL(); + + /** + * Handles a leave occurring in RunL(). + * @since S60 5.0 + * @param aError Leave code + * @return aError + */ + TInt RunError( TInt aError ); + + + private: // data + + /** + * Observer to be notified about launch completion. Not owned. + */ + MWsfBrowserLaunchObserver* iObserver; + + /** + * Window session + */ + RWsSession iWsSession; + + /** + * IAP id to use + */ + TUint iIapId; + + /** + * State of browser launching + */ + TWsfLaunchState iLaunchState; + + /** + * Indicates whether to launch bookmarks page + * (if homepage is not set) + */ + TBool iLaunchBookMarks; + + /** + * Browser app's UID + */ + TUid iBrowserUid; + + /** + * Key number for browser's default homepage + */ + TUint iHomepageKey; + + /** + * Handle to a repository. Owned. + */ + CRepository* iRepository; + + /** + * URL of the homepage. Owned. + */ + HBufC* iURL; + + /** + * Timer to wait for browser startup etc. + */ + RTimer iTimer; + + /** + * Browser's cenrep key number for the homepage + */ + TUint iBrowserHomePageKey; + + /** + * Browser's cenrep key number for the starting page + */ + TUint iBrowserStartingPageKey; + + /** + * The id of the broser thread + */ + TThreadId iThreadId; + + /** + * The browser thread + */ + RThread iThread; + }; + + +#endif // C_WSFAPPLAUNCHER_H + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/model/inc/wsfbrowserlaunchadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/inc/wsfbrowserlaunchadapter.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for MWsfBrowserLaunchAdapter +* +*/ + + + + + +#ifndef M_WSFBROWSERLAUNCHADAPTER_H +#define M_WSFBROWSERLAUNCHADAPTER_H + + +// CLASS DEFINITION +/** + * Interface class to manage browser launching + * + * @since S60 5.0 + */ +class MWsfBrowserLaunchAdapter + { + + public: + /** + * Implementing class should launch the browser with the give IAP id + * @since S60 5.0 + * @param aIapId The IAP id to connect with + */ + virtual void LaunchBrowserL( TUint32 aIapId ) = 0; + + + }; + + +#endif // M_WSFBROWSERLAUNCHADAPTER_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/model/inc/wsfbrowserlaunchobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/inc/wsfbrowserlaunchobserver.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for MWsfBrowserLaunchObserver +* +*/ + + + + +#ifndef M_WSFBROWSERLAUNCHOBSERVER_H +#define M_WSFBROWSERLAUNCHOBSERVER_H + + + +// CLASS DEFINITION +/** + * Interface class to get notified about browser launch results + * + * @since S60 5.0 + */ +class MWsfBrowserLaunchObserver + { + + public: + /** + * Called if the browser launch failed for some reason + * @since S60 5.0 + * @param aError System-wide error code + */ + virtual void BrowserLaunchFailed( TInt aError ) = 0; + + /** + * Called if the launch has been completed successfully + * @since S60 5.0 + */ + virtual void BrowserLaunchCompleteL() = 0; + + /** + * Called when the previously launched browser exits + * @since S60 5.0 + */ + virtual void BrowserExitL() = 0; + + }; + + +#endif // M_WSFBROWSERLAUNCHOBSERVER_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/model/inc/wsfmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/inc/wsfmodel.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,507 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfModel +* +*/ + + + +#ifndef C_WSFMODEL_H +#define C_WSFMODEL_H + + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "wsfsession.h" +#include "wsfbrowserlaunchobserver.h" +#include "wsfscreensaverstateobserver.h" +#include "wsfbrowserlaunchadapter.h" +#include "wsfwlaninfo.h" + + +// FORWARD DECLARATIONS +class CWsfAppLauncher; +class MWsfModelObserver; +class CWsfWlanInfoArray; +class MWsfStateChangeObserver; +class CEikonEnv; +class CWsfScreenSaverWatcher; +class CWsfAsyncOperationQueue; + + +// CLASS DEFINITION +/** + * Class acts as an application level model and is also entry point to the + * application engine which is implemented as server + * + * @lib wsfmodel.lib + * @since S60 5.0 + */ +NONSHARABLE_CLASS( CWsfModel ): public CBase, + public MWsfBrowserLaunchObserver, + public MWsfScreenSaverStateObserver, + public MWsfBrowserLaunchAdapter + { + public: // Constructors and destructor + + /** + * Factory function. + * @since S60 5.0 + * @param aObserver The object to notify about server events + * @param aScreenSaverAware Whether to react to screensaver events + * @return Model instance + */ + IMPORT_C static CWsfModel* NewL( MWsfStateChangeObserver& aObserver, + const TBool aScreenSaverAware ); + + /** + * Factory function. + * @since S60 5.0 + * @param aObserver The object to notify about server events + * @param aScreenSaverAware Whether to react to screensaver events + * @return Model instance + */ + IMPORT_C static CWsfModel* NewLC( MWsfStateChangeObserver& aObserver, + const TBool aScreenSaverAware ); + + IMPORT_C ~CWsfModel(); + + private: // Constructors + CWsfModel(); + + /** + * Factory function. + * @since S60 5.0 + * @param aObserver The object to notify about server events + * @param aScreenSaverAware Whether to react to screensaver events + */ + void ConstructL( MWsfStateChangeObserver& aObserver, + const TBool aScreenSaverAware ); + + public: // New methods + + /** + * Attach model observer + * @since S60 5.0 + * @param aObserver Pointer to the model observer + */ + IMPORT_C void SetEngineObserver( MWsfModelObserver* aObserver ); + + /** + * Return the latest list of found WLANs. Ownership not passed. + * @since S60 5.0 + * @return Array of WLANs + */ + IMPORT_C CWsfWlanInfoArray* GetWlanListL(); + + /** + * Asyncronous request to the server to return wlan list size + * @since S60 5.2 + * @param aPckg request result + * @param aStatus The request status object used to contain + * the completion status of the request. + */ + IMPORT_C void GetWlanListSize( TPckgBuf& aPckg, + TRequestStatus& aStatus ); + + /** + * Asyncronous request to the server to return wlan list + * @since S60 5.2 + * @param aPckg request result + * @param aPtr wlan list + * @param aStatus The request status object used to contain + * the completion status of the request. + */ + IMPORT_C void GetWlanList( TPckgBuf& aPckg, TPtr8& aPtr, + TRequestStatus& aStatus ); + + /** + * Store active views UID + * @since S60 5.0 + * @param aActiveViewId Active view's UID + */ + IMPORT_C void SetActiveViewL( TInt aActiveViewId ); + + /** + * Get UID of the active view + * @since S60 5.0 + * @return UID of active view + */ + IMPORT_C TUid ActiveViewL(); + + /** + * Store SSID of active WLAN + * @since S60 5.0 + * @param aSsid WLAN's name (SSID) + */ + IMPORT_C void SetObservedWlanL( const TDesC8& aSsid ); + + /** + * Get SSID of active WLAN + * @since S60 5.0 + * @return Active WLAN's name (SSID) + */ + IMPORT_C const TDesC8& ObservedWlan(); + + /** + * Connects to the given WLAN IAP + * @since S60 5.0 + * @param aIapId WLAN IAP id to connect to. + * @param aConnectOnly ETrue if Connect selected + * @param aPersistence The value of the persistence property + */ + IMPORT_C int ConnectL( TUint32 aIapId, + TBool aConnectOnly, + TWsfIapPersistence aPersistence ); + + /** + * Asyncronous request to the server to connect to the given WLAN IAP + * @since S60 5.2 + * @param aPckg request result + * @param aIapId WLAN IAP id to connect to. + * @param aConnectOnly ETrue if Connect selected + * @param aPersistence The value of the persistence property + * @param aStatus The request status object used to contain + * the completion status of the request. + */ + IMPORT_C void ConnectL( TPckgBuf& aPckg, TUint32 aIapId, + TBool aConnectOnly, + TWsfIapPersistence aPersistence, + TRequestStatus& aStatus ); + + /** + * Sets connection result + * @since S60 5.2 + * @param aResult connection result + * @param aIapId WLAN IAP + */ + IMPORT_C void SetConnectResultL( TInt aResult, TUint aIapId ); + + /** + * Disconnects WLAN + * @since S60 5.0 + */ + IMPORT_C void DisconnectL(); + + /** + * Asyncronous request to the server to disconnect + * @since S60 5.2 + * @param aPckg request result + * @param aStatus The request status object used to contain + * the completion status of the request. + */ + IMPORT_C void Disconnect( TPckgBuf& aPckg, + TRequestStatus& aStatus ); + + /** + * Check if the engine is refreshing + * @since S60 5.0 + * @return ETrue if first refreshing + */ + IMPORT_C TBool Refreshing(); + + /** + * Change refreshing state + * @since S60 5.0 + * @param aRefreshing Refreshing state + */ + IMPORT_C void SetRefreshState( TBool aRefreshing ); + + /** + * Notifies server to start scanning if not scanning already + * @since S60 5.0 + * @return ETrue on success + */ + IMPORT_C TBool EnableScanL(); + + /** + * Notifies server to disable scanning + * However, scanning will continue if some other client + * has enabled scanning. + * @since S60 5.0 + * @return ETrue on success + */ + IMPORT_C TBool DisableScanL(); + + /** + * Checks if scanning is enabled in the server + * @since S60 5.0 + * @return EFalse if not scanning + */ + IMPORT_C TBool IsScanEnabledL(); + + /** + * Continues browsing + * @since S60 5.0 + */ + IMPORT_C void ContinueBrowsingL(); + + /** + * Continues browsing (browser launched if needed) + * @since S60 5.0 + * @param aIapId The IAP id to use with the browser + */ + IMPORT_C void ContinueBrowsingL( TUint32 aIapId ); + + /** + * Creates new WLAN access point based on wlaninfo passed as parameter. + * If aExplicitDefine is ETrue, the connection method is saved to the + * destination selected by the user, otherwise it is put into the + * Uncategorized folder. + * @since S60 5.0 + * @param aWlan Reference to Wlan which is used as base + * for new access point + * @param aExplicitDefine Should be ETrue in case of + * 'Define access point' + * @return ETrue if access point creation succeeds + */ + IMPORT_C TBool CreateAccessPointL( TWsfWlanInfo& aWlan, + TBool aExplicitDefine ); + + /** + * Requests a rescan for available wlans + * @since S60 5.0 + * @return ETrue on success + */ + IMPORT_C TBool RefreshScanL(); + + /** + * Asyncronous request to the server to make a scan + * @since S60 5.2 + * @param aPckg request result + * @param aStatus The request status object used to contain + * the completion status of the request. + */ + IMPORT_C void RefreshScan( TPckgBuf& aPckg, + TRequestStatus& aStatus ); + + /** + * Closes helper application if it is launched + * @since S60 5.2 + * @return ETrue if helper application task was closed + */ + IMPORT_C TBool CloseHelperApplication(); + + /** + * Launches and helper application to create an accesspoint + * @since S60 5.2 + * @param aWlanInfo The WlanInfo object to be passed to the helper app + */ + IMPORT_C void LaunchHelperApplicationL( TWsfWlanInfo& aWlanInfo ); + + /** + * Cancel notify events from server + * @since S60 5.0 + */ + IMPORT_C void CancelNotifyEvents(); + + /** + * Request notify events from server + * @since S60 5.0 + * @param aObserver Instance of MWsfStateChangeObserver to handle events + */ + IMPORT_C void RequestNotifyEventsL( + MWsfStateChangeObserver& aObserver ); + + /** + * Queries if there is an active WLAN connection. + * @since S60 5.0 + * @return ETrue if there is an active WLAN connection, + * EFalse otherwise. + */ + IMPORT_C TBool IsConnectedL(); + + /** + * If there is an active WLAN connection, returns its WLAN info. + * @since S60 5.0 + * @param aWlanInfo The wlaninfo object to fill + * @return ETrue if success, EFalse otherwise. + */ + IMPORT_C TBool GetConnectedWlanDetailsL( TWsfWlanInfo& aWlanInfo ); + + /** + * Asyncronous request to the server to return connected network + * @since S60 5.2 + * @param aPckg request result + * @param aWlanInfo The wlaninfo object to fill + * @param aStatus The request status object used to contain + * the completion status of the request. + */ + IMPORT_C void GetConnectedWlanDetails( TPckgBuf& aPckg, + TWsfWlanInfo& aWlanInfo, + TRequestStatus& aStatus ); + + /** + * Queries whether a connecting process is going on + * @since S60 5.0 + * @return ETrue if connection is in progress + */ + inline TBool IsConnecting() const; + + /** + * Sets connecting status + * @since S60 5.0 + * @param aIsConnecting The new status of the connecting process + */ + inline void SetConnecting( TBool aIsConnecting ); + + /** + * Aborts the currently ongoing connecting process + * @since S60 5.0 + */ + IMPORT_C void AbortConnectingL(); + + /** + * Aborts the currently ongoing scanning process + * @since S60 5.0 + */ + IMPORT_C void AbortScanningL(); + + /** + * Check if Iap Id is valid + * Leaves with system wide error code if Iap ID is + * not valid or checking fails + * @since S60 5.2 + * @param aIapId IAP id passed as a parameter + */ + IMPORT_C void CheckIsIapIdValidL( TUint aIapId ) const; + + public: // from MWsfBrowserLaunchAdapter + /** + * Launches Browser application using selected iap + * @since S60 5.0 + * @param aIapId IAP id passed as a parameter + */ + IMPORT_C void LaunchBrowserL( TUint32 aIapId ); + + + public: // From MWsfBrowserLaunchObserver + + /** + * Called if browser launch succeeds + * @since S60 5.0 + */ + void BrowserLaunchCompleteL(); + + /** + * Called if browser launch failed + * @since S60 5.0 + * @param aError System-wide error code + */ + void BrowserLaunchFailed( TInt aError ); + + /** + * Called when the previously launched browser exits + * @since S60 5.0 + */ + void BrowserExitL(); + + + private: // from MWsfScreenSaverStateObserver + + /** + * Called if the status of the screensaver has been changed + * @since S60 5.0 + * @param aScreenSaverActive Current status of the screensaver + */ + void ScreenSaverStatusChangedL( const TBool aScreenSaverActive ); + + + private: // New methods + + /** + * Check if there is disk space left + * Leaves with KErrDiskFull is space is below CL + * @since S60 5.0 + */ + void CheckSpaceBelowCriticalLevelL() const; + + /** + * Check if access point to be created is + * unknow and Network encryption is WAPI + * Leaves with KErrWlanProtectedSetupSetupLocked + * in the case of unknown WAPI AP. + * @since S60 5.2 + */ + void CheckUnknownWapiL( TWsfWlanInfo& aWlan ) const; + + private: // Data + /** + * Reference to the current UI environment (not owned) + */ + CEikonEnv* iEikEnv; + + /** + * Reference to the model observer (not owned) + */ + MWsfModelObserver* iObserver; + + /** + * Browser launcher class. Owned. + */ + CWsfAppLauncher* iBrowserLauncher; + + /** + * Screen saver watcher class. Owned. + */ + CWsfScreenSaverWatcher* iScreenSaverWatcher; + + /** + * Client-side handle for server session + */ + RWsfSession iSession; + + /** + * Array to store WLAN scan results. Owned. + */ + CWsfWlanInfoArray* iArray; + + /** + * UID of active view + */ + TUid iActiveView; + + /** + * Name of currently observed WLAN + */ + HBufC8* iObservedWlan; + + /** + * Id of currently connected IAP (if applicable) + */ + TUint iConnectedIapId; + + /** + * Refreshing status + */ + TBool iRefreshing; + + /** + * Indicates whether connection creation has been started but not + * finished yet. + */ + TBool iConnecting; + + }; + + +#include "wsfmodel.inl" + + + +#endif // C_WSFMODEL_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/model/inc/wsfmodel.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/inc/wsfmodel.inl Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 for CWsfModel +* +*/ + + + +// INLINE FUNCTIONS + +// ----------------------------------------------------------------------------- +// CWsfModel::IsConnecting +// ----------------------------------------------------------------------------- +// +inline TBool CWsfModel::IsConnecting() const + { + return iConnecting; + } + + +// ----------------------------------------------------------------------------- +// CWsfModel::SetConnecting +// ----------------------------------------------------------------------------- +// +inline void CWsfModel::SetConnecting( TBool aIsConnecting ) + { + iConnecting = aIsConnecting; + } + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/model/inc/wsfmodelobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/inc/wsfmodelobserver.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for MWsfModelObserver +* +*/ + + + + +#ifndef M_WSFMODELOBSERVER_H +#define M_WSFMODELOBSERVER_H + +// EXTERNAL INCLUDES +#include +#include + +#include "wsfbrowserlaunchobserver.h" + + + +// CLASS DEFINITION +/** +* Class acts as an interface for the model to be able to call back its clients +* in case of different model events. +* +* @since S60 5.0 +*/ +class MWsfModelObserver: public MWsfBrowserLaunchObserver + { + public: // Abstract methods + /** + * Notification that a connection is about to be created + * @since S60 5.0 + * @param aIapId The IAP id of the connection being created + */ + virtual void ConnectingL( TUint32 aIapId ) = 0; + + /** + * Notification that the connection creation process ended + * @since S60 5.0 + * @param aResult The result of the connection creation + */ + virtual void ConnectingFinishedL( TInt aResult ) = 0; + + }; + + +#endif // M_WSFMODELOBSERVER_H + +// End of file + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/model/inc/wsfscreensaverstateobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/inc/wsfscreensaverstateobserver.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for MWsfScreenSaverStateObserver +* +*/ + + + + +#ifndef M_WSFSCREENSAVERSTATEOBSERVER_H +#define M_WSFSCREENSAVERSTATEOBSERVER_H + + +#include + + +/** + * Interface class for notifications about screen saver status change + * + * @since S60 5.0 + */ +class MWsfScreenSaverStateObserver + { + public: + /** + * Called when screen saver status has changed + * @since S60 5.0 + * @param aScreenSaverActive ETrue if the screen saver was activated, + * EFalse on deactivation + */ + virtual void ScreenSaverStatusChangedL( + const TBool aScreenSaverActive ) = 0; + }; + + +#endif // M_WSFSCREENSAVERSTATEOBSERVER_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/model/inc/wsfscreensaverwatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/inc/wsfscreensaverwatcher.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfScreenSaverWatcher +* +*/ + + + +#ifndef C_WSFSCREENSAVERWACTHER_H +#define C_WSFSCREENSAVERWACTHER_H + +#include +#include + + +// FORWARD DECLARATIONS +class MWsfScreenSaverStateObserver; + +/** +* Active object class which monitors screen saver activity and notifies +* the observer when changes occur. +* +* @lib wsfmodel.lib +* @since S60 5.0 +*/ +NONSHARABLE_CLASS( CWsfScreenSaverWatcher ): public CActive + { + public: // Constructors + /** + * Factory function. + * @since S60 5.0 + * @param aObserver The object to notify when changes occur. + * @return Class instance. + */ + static CWsfScreenSaverWatcher* NewL( + MWsfScreenSaverStateObserver& aObserver ); + + /** + * Factory function. + * @since S60 5.0 + * @param aObserver The object to notify when changes occur. + * @return Class instance. + */ + static CWsfScreenSaverWatcher* NewLC( + MWsfScreenSaverStateObserver& aObserver ); + + ~CWsfScreenSaverWatcher(); + + private: // Constructors + + /** + * Constructor. + * @since S60 5.0 + * @param aObserver The object to notify when changes occur. + */ + CWsfScreenSaverWatcher( MWsfScreenSaverStateObserver& aObserver ); + + void ConstructL(); + + public: + + /** + * Start receiving events from screensaver + * @since S60 5.0 + */ + void StartStatusScanning(); + + protected: // from CActive + void RunL(); + void DoCancel(); + TInt RunError( TInt aError ); + + private: // Data + + /** + * Handle to the screen saver property value + */ + RProperty iProperty; + + /** + * The object to notify when changes occur. Not owned. + */ + MWsfScreenSaverStateObserver* iObserver; + + }; + +#endif // C_WSFSCREENSAVERWACTHER_H + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/model/rom/wsfmodel.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/rom/wsfmodel.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 WlanInfoSorting +* +*/ + + + +#ifndef WSFMODEL_IBY +#define WSFMODEL_IBY + +#ifdef __PROTOCOL_WLAN + +REM WlanSnifferModel + +#include + +file=ABI_DIR\BUILD_DIR\wsfmodel.dll SHARED_LIB_DIR\wsfmodel.dll + +#endif // __PROTOCOL_WLAN + +#endif // WSFMODEL_IBY diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/model/src/wsfactivewaiter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/src/wsfactivewaiter.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,108 @@ +/* +* 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 CWsfActiveWaiter. +* +*/ + + +// INCLUDE FILES +#include "wsfactivewaiter.h" +#include "wsflogger.h" + + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CWsfActiveWaiter* CWsfActiveWaiter::NewL() +// --------------------------------------------------------- +// +CWsfActiveWaiter* CWsfActiveWaiter::NewL( ) + { + CWsfActiveWaiter* self = + new ( ELeave ) CWsfActiveWaiter( ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// --------------------------------------------------------- +// CWsfActiveWaiter::ConstructL() +// --------------------------------------------------------- +// +void CWsfActiveWaiter::ConstructL() + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::CWsfActiveWaiter() +// --------------------------------------------------------- +// +CWsfActiveWaiter::CWsfActiveWaiter() +: CActive( EPriorityNormal ) + { + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::~CWsfActiveWaiter() +// --------------------------------------------------------- +// +CWsfActiveWaiter::~CWsfActiveWaiter() + { + Cancel(); + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::DoCancel() +// --------------------------------------------------------- +// +void CWsfActiveWaiter::DoCancel() + { + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::RunL() +// --------------------------------------------------------- +// +void CWsfActiveWaiter::RunL() + { + LOG_ENTERFN( "CWsfActiveWaiter::RunL" ); + if ( iWait.IsStarted() ) + { + LOG_WRITE("async call completed, resuming."); + iWait.AsyncStop(); + } + } + +// --------------------------------------------------------- +// CWsfActiveWaiter::WaitForRequest() +// --------------------------------------------------------- +// +TInt CWsfActiveWaiter::WaitForRequest() + { + LOG_ENTERFN("CWsfActiveWaiter::WaitForRequest"); + SetActive(); + iWait.Start(); + + return iStatus.Int(); + } +// End of File + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/model/src/wsfapplauncher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/src/wsfapplauncher.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,518 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfAppLauncher +* +*/ + + + + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include + +// CLASS HEADER +#include "wsfapplauncher.h" + +// INTERNAL INCLUDES +#include "wsfbrowserlaunchobserver.h" +#include "wsflogger.h" + + +// LOCAL DEFINITIONS +/** +* Delay that we wait for the browser to start or terminate +*/ +static const TInt KTimerTickInterval = 2 * 1000 * 1000; + +/** +* Repository key ID for the browser's homepage URL +*/ +static const TUint32 KBrowserNGHomepageURL = 0x00000030; + + +#ifdef _DEBUG + _LIT( KBrowserLauncherPanic, "CWsfAppLauncher" ); + #define _ASSERTD( cond ) __ASSERT_DEBUG( (cond), \ + User::Panic( KBrowserLauncherPanic, __LINE__) ) +#else + #define _ASSERTD( cond ) {} +#endif //_DEBUG + + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::NewL +// --------------------------------------------------------------------------- +// +EXPORT_C CWsfAppLauncher* CWsfAppLauncher::NewL() + { + CWsfAppLauncher* self = CWsfAppLauncher::NewLC(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::NewLC +// --------------------------------------------------------------------------- +// +EXPORT_C CWsfAppLauncher* CWsfAppLauncher::NewLC() + { + CWsfAppLauncher* self = new( ELeave ) CWsfAppLauncher(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::~CWsfAppLauncher +// --------------------------------------------------------------------------- +// +CWsfAppLauncher::~CWsfAppLauncher() + { + Cancel(); + delete iURL; + delete iRepository; + iTimer.Close(); + iWsSession.Close(); + } + + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::CWsfAppLauncher +// --------------------------------------------------------------------------- +// +CWsfAppLauncher::CWsfAppLauncher(): + CActive( CActive::EPriorityStandard ), + iIapId( 0 ), + iLaunchState( EIdle ), + iLaunchBookMarks( EFalse ) + { + } + + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::ConstructL +// --------------------------------------------------------------------------- +// +void CWsfAppLauncher::ConstructL() + { + LOG_ENTERFN( "CWsfAppLauncher::ConstructL" ); + iBrowserUid = KCRUidBrowser; + iHomepageKey = KBrowserNGHomepageURL; + iBrowserStartingPageKey = KBrowserNGHomepageType; + + // Common settings for both browsers + iRepository = CRepository::NewL( KCRUidBrowser ); + + User::LeaveIfError( iWsSession.Connect() ); + User::LeaveIfError( iTimer.CreateLocal() ); + + iURL = KNullDesC().AllocL(); + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::LaunchBrowserL +// --------------------------------------------------------------------------- +// +void CWsfAppLauncher::LaunchBrowserL( MWsfBrowserLaunchObserver& aObserver, + TUint aIapId, + const TDesC& aURL ) + { + LOG_ENTERFN( "CWsfAppLauncher::LaunchBrowserL_3" ); + Cancel(); + LOG_WRITE( "CWsfAppLauncher::LaunchBrowserL_3 -->> afer cancel" ); + iObserver = &aObserver; + iIapId = aIapId; + HBufC* url = aURL.AllocL(); + delete iURL; + iURL = url; + + iLaunchState = EIdle; + LOG_WRITE( "CWsfAppLauncher::LaunchBrowserL_3 -->> before set active" ); + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::LaunchBrowserL +// --------------------------------------------------------------------------- +// +void CWsfAppLauncher::LaunchBrowserL( MWsfBrowserLaunchObserver& aObserver, + TUint aIapId ) + { + LOG_ENTERFN( "CWsfAppLauncher::LaunchBrowserL_2" ); + LOG_WRITEF( "CWsfAppLauncher::LaunchBrowserL_2 -->> iIapid %d", aIapId ); + HBufC* url = HBufC::NewLC( + NCentralRepositoryConstants::KMaxUnicodeStringLength ); + TPtr urlPtr( url->Des() ); + + iLaunchBookMarks = EFalse; + + RCmManager cmManager; + + cmManager.OpenL(); + LOG_WRITE( "CWsfAppLauncher::LaunchBrowserL_2 -->> cmmanager opened" ); + CleanupClosePushL( cmManager ); + + RCmConnectionMethod plugin; + CleanupClosePushL( plugin ); + LOG_WRITE( "CWsfAppLauncher::LaunchBrowserL_2 -->> cm before open" ); + LOG_WRITEF( "CWsfAppLauncher::LaunchBrowserL_2 -->> iIapid %d", aIapId ); + plugin = cmManager.ConnectionMethodL( aIapId ); + LOG_WRITE( "CWsfAppLauncher::LaunchBrowserL_2 -->> cm after open" ); + + // do we have start page for Access Point? + HBufC* apHomepage = NULL; + apHomepage = plugin.GetStringAttributeL( CMManager::ECmStartPage ); + LOG_WRITE( "CWsfAppLauncher::LaunchBrowserL_2 -->> String Attrib got" ); + CleanupStack::PushL( apHomepage ); + + if( apHomepage->Length() == 0 ) + { + LOG_WRITE( "CWsfAppLauncher::LaunchBrowserL_2 -->> hplength = 0" ); + // if we can't have Access Point URL then + // we try to get browser homepage URL + TInt err = BrowserHomepage( urlPtr ); + + // if browser homepage is not defined either, + // launch bookmarks view + if ( err || url->Length() == 0 ) + { + LOG_WRITE( + "CWsfAppLauncher::LaunchBrowserL_2 -->> err in url length" ); + iLaunchBookMarks = ETrue; + } + } + else + { + LOG_WRITE( "CWsfAppLauncher::LaunchBrowserL_2 -->> hplength>0" ); + url->Des().Copy( *apHomepage ); + } + + LaunchBrowserL( aObserver, aIapId, *url ); + + LOG_WRITE( "CWsfAppLauncher::LaunchBrowserL_2 -->> after launch _3" ); + CleanupStack::PopAndDestroy( apHomepage ); + CleanupStack::PopAndDestroy( &plugin ); + CleanupStack::PopAndDestroy( &cmManager ); + CleanupStack::PopAndDestroy( url ); + } + + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::DoLaunchBrowserL +// --------------------------------------------------------------------------- +// +void CWsfAppLauncher::DoLaunchBrowserL() + { + LOG_ENTERFN( "CWsfAppLauncher::DoLaunchBrowserL" ); + _LIT( KFormatCommand, "%d %S" ); + const TInt KBrowserFirstParamUrlFollows = 4; + + iLaunchState = EStartingUp; + HBufC* param = NULL; + if ( iLaunchBookMarks ) + { + param = KNullDesC().AllocLC(); + } + else + { + param = HBufC::NewLC( KFormatCommand().Length() + iURL->Length() ); + param->Des().Format( KFormatCommand, + KBrowserFirstParamUrlFollows, iURL ); + } + + RApaLsSession appArcSession; + User::LeaveIfError( appArcSession.Connect() ); // connect to AppArc server + CleanupClosePushL( appArcSession ); + + User::LeaveIfError( appArcSession.StartDocument( *param, iBrowserUid, + iThreadId ) ); + + CleanupStack::PopAndDestroy( &appArcSession ); + CleanupStack::PopAndDestroy( param ); + + + iTimer.Cancel(); + iTimer.After( iStatus, KTimerTickInterval ); + SetActive(); + } + + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::BrowserExists +// --------------------------------------------------------------------------- +// +TBool CWsfAppLauncher::BrowserExists() + { + LOG_ENTERFN( "CWsfAppLauncher::BrowserExists" ); + TApaTaskList taskList( iWsSession ); + TApaTask startedtask = taskList.FindApp( iBrowserUid ); + return startedtask.Exists(); + } + + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::BrowserHomepage +// --------------------------------------------------------------------------- +// +TInt CWsfAppLauncher::BrowserHomepage( TDes& aHomePageURL ) + { + LOG_ENTERFN( "CWsfAppLauncher::BrowserHomepage" ); + CRepository* repository( iRepository ); + + // get the default starting page setting + TInt startingPageMode( 0 ); + TInt err = repository->Get( iBrowserStartingPageKey, startingPageMode ); + if ( err == KErrNone ) + { + switch ( startingPageMode ) + { + case 1: + case 2: + { + // user defined or current page + err = repository->Get( iHomepageKey, aHomePageURL ); + break; + } + default: + { + aHomePageURL.Zero(); + } + } + } + + return err; + } + + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::KillBrowserIfAlreadyExists +// --------------------------------------------------------------------------- +// +TBool CWsfAppLauncher::KillBrowserIfAlreadyExists() + { + LOG_ENTERFN( "CWsfAppLauncher::KillBrowserIfAlreadyExists" ); + _ASSERTD( iLaunchState == EIdle); + _ASSERTD( !IsActive() ); + + TBool killing = EFalse; + + TApaTaskList taskList( iWsSession ); + TApaTask task = taskList.FindApp( iBrowserUid ); + + if ( task.Exists() ) + { + // kill the browser... + task.EndTask(); + killing = ETrue; + + iTimer.Cancel(); + iTimer.After( iStatus, KTimerTickInterval ); + } + else + { + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + + SetActive(); + iLaunchState = EShuttingDown; + return killing; + } + + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::ContinueBrowsingL +// --------------------------------------------------------------------------- +// +void CWsfAppLauncher::ContinueBrowsingL() + { + LOG_ENTERFN( "CWsfAppLauncher::ContinueBrowsingL_0" ); + //Check if the application is already running + TBool exists = BrowserExists(); + if ( exists ) + { + TApaTaskList taskList( iWsSession ); + TApaTask task = taskList.FindApp( iBrowserUid ); + task.BringToForeground(); + } + else + { + User::Leave( KErrNotFound ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::ContinueBrowsingL +// --------------------------------------------------------------------------- +// +void CWsfAppLauncher::ContinueBrowsingL( MWsfBrowserLaunchObserver& aObserver, + TUint aIapId ) + { + LOG_ENTERFN( "CWsfAppLauncher::ContinueBrowsingL_2" ); + //Check if the application is already running + TBool exists = BrowserExists(); + if ( exists ) + { + TApaTaskList taskList( iWsSession ); + TApaTask task = taskList.FindApp( iBrowserUid ); + task.BringToForeground(); + } + else // browser not running - launch browser + { + LaunchBrowserL( aObserver, aIapId ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::Launching +// --------------------------------------------------------------------------- +// +TWsfLaunchState CWsfAppLauncher::Launching() + { + LOG_ENTERFN( "CWsfAppLauncher::Launching" ); + return iLaunchState; + } + + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::BrowserIap +// --------------------------------------------------------------------------- +// +TUint32 CWsfAppLauncher::BrowserIap() const + { + return iIapId; + } + + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::DoCancel +// --------------------------------------------------------------------------- +// +void CWsfAppLauncher::DoCancel() + { + LOG_ENTERFN( "CWsfAppLauncher::DoCancel" ); + iThread.LogonCancel( iStatus ); + + iThread.Close(); + iTimer.Cancel(); + iLaunchState = EIdle; + } + + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::RunL +// --------------------------------------------------------------------------- +// +void CWsfAppLauncher::RunL() + { + LOG_ENTERFN( "CWsfAppLauncher::RunL" ); + _ASSERTD( iObserver ); + User::LeaveIfError( iStatus.Int() ); + + switch( iLaunchState ) + { + case EIdle: // Starting to launch + { + LOG_WRITE( "CWsfAppLauncher::RunL -->> EIdle" ); + KillBrowserIfAlreadyExists(); + break; + } + case EShuttingDown: // Existing browser was succesfully closed + { + LOG_WRITE( "CWsfAppLauncher::RunL -->> EShuttingDown" ); + DoLaunchBrowserL(); + break; + } + case EStartingUp: // Start-up completed, check browser exists + { + LOG_WRITE( "CWsfAppLauncher::RunL -->> EStartingUp" ); + TBool exists = BrowserExists(); + TInt err = exists ? KErrNone : KErrNotFound; + iLaunchState = ECompleted; + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + SetActive(); + break; + } + case ECompleted: //Browser exists, notify observer about completion + { + LOG_WRITE( "CWsfAppLauncher::RunL -->> ECompleted" ); + iLaunchState = EFinished; + LOG_WRITE( "CWsfAppLauncher::RunL -->> Before thread open" ); + User::LeaveIfError( iThread.Open( iThreadId, EOwnerProcess ) ); + LOG_WRITE( "CWsfAppLauncher::RunL -->> Thread opened" ); + iObserver->BrowserLaunchCompleteL(); + TRequestStatus* status = &iStatus; + iThread.Logon( *status ); + SetActive(); + break; + } + case EFinished: //Browser exists, notify observer about completion + { + LOG_WRITE( "CWsfAppLauncher::RunL -->> EFinished" ); + iObserver->BrowserExitL(); + iLaunchState = EIdle; + break; + } + default: + { + _ASSERTD( EFalse ); + } + } + } + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::RunError +// --------------------------------------------------------------------------- +// +TInt CWsfAppLauncher::RunError( TInt aError ) + { + LOG_ENTERFN( "CWsfAppLauncher::RunError" ); + _ASSERTD( iObserver ); + + switch( iLaunchState ) + { + case EIdle: // + case EShuttingDown: // Shuttind down existing browser failed + case EStartingUp: // Starting up new browser failed + case ECompleted: // Starting up new browser failed + { + iObserver->BrowserLaunchFailed( aError ); + break; + } + default: + { + _ASSERTD( EFalse ); + } + } + + iLaunchState = EIdle; + return aError; + } + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/model/src/wsfmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/src/wsfmodel.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,787 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfModel +* +*/ + + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// CLASS HEADER +#include "wsfmodel.h" + +// INTERNAL INCLUDES +#include "wsfwlaninfoarray.h" +#include "wsfwlaniapwizard.h" +#include "wsfapplauncher.h" +#include "wsfmodelobserver.h" +#include "wsfstatechangeobserver.h" +#include "wsfscreensaverwatcher.h" +#include "wsflogger.h" + +using namespace CMManager; + + +/** +* UID of helper application +* used when model is instantiated in the active idle +*/ +static const TUid KHelperApUid = { 0x10281CEB }; + +/** +* Estimated overhead for access point creation +*/ +const TInt KEstimatedOverhead = 8192; + + +// ---------------------------------------------------------------------------- +// CWsfModel::NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CWsfModel* CWsfModel::NewL( MWsfStateChangeObserver& aObserver, + const TBool aScreenSaverAware ) + { + CWsfModel* self = CWsfModel::NewLC( aObserver, aScreenSaverAware ); + CleanupStack::Pop( self ); + return self; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::NewLC +// ---------------------------------------------------------------------------- +// +EXPORT_C CWsfModel* CWsfModel::NewLC( MWsfStateChangeObserver& aObserver, + const TBool aScreenSaverAware ) + { + CWsfModel* self = new( ELeave ) CWsfModel; + CleanupStack::PushL( self ); + self->ConstructL( aObserver, aScreenSaverAware ); + return self; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::~CWsfModel +// ---------------------------------------------------------------------------- +// +EXPORT_C CWsfModel::~CWsfModel() + { + LOG_ENTERFN( "CWsfModel::~CWsfModel" ); + iSession.CancelNotifyEvent(); + iSession.Close(); + delete iScreenSaverWatcher; + delete iArray; + delete iObservedWlan; + delete iBrowserLauncher; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::CWsfModel +// ---------------------------------------------------------------------------- +// +CWsfModel::CWsfModel(): + iEikEnv( CEikonEnv::Static() ), + iRefreshing( EFalse ) + { + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::ConstructL +// ---------------------------------------------------------------------------- +// +void CWsfModel::ConstructL( MWsfStateChangeObserver& aObserver, + const TBool aScreenSaverAware ) + { + iArray = CWsfWlanInfoArray::NewL(); + iBrowserLauncher = CWsfAppLauncher::NewL(); + User::LeaveIfError( iSession.Connect() ); + iSession.NotifyEventL( aObserver ); + if ( aScreenSaverAware ) + { + iScreenSaverWatcher = CWsfScreenSaverWatcher::NewL( *this ); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::SetEngineObserver +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::SetEngineObserver( MWsfModelObserver* aObserver ) + { + LOG_ENTERFN( "CWsfModel::SetEngineObserver" ); + iObserver = aObserver; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::GetWlanListL +// ---------------------------------------------------------------------------- +// +EXPORT_C CWsfWlanInfoArray* CWsfModel::GetWlanListL() + { + LOG_ENTERFN( "CWsfModel::GetWlanListL" ); + iArray->Reset(); + iSession.UpdateWlanListL( iArray ); + return iArray; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::GetWlanListSize +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::GetWlanListSize( TPckgBuf& aPckg, + TRequestStatus& aStatus ) + { + LOG_ENTERFN( "CWsfModel::GetWlanListSize" ); + iSession.GetWlanListSize( aPckg, aStatus ); + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::GetWlanList +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::GetWlanList( TPckgBuf& aPckg, TPtr8& aPtr, + TRequestStatus& aStatus ) + { + LOG_ENTERFN( "CWsfModel::GetWlanList" ); + iSession.GetWlanList( aPckg, aPtr, aStatus ); + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::SetActiveViewL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::SetActiveViewL( TInt aViewId ) + { + TUid id; + id.iUid = aViewId; + iActiveView = id; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::ActiveViewL +// ---------------------------------------------------------------------------- +// +EXPORT_C TUid CWsfModel::ActiveViewL() + { + return iActiveView; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::SetObservedWlanL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::SetObservedWlanL( const TDesC8& aSsid ) + { + HBufC8* ssid = aSsid.AllocL(); + delete iObservedWlan; + iObservedWlan = ssid; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::ObservedWlan +// ---------------------------------------------------------------------------- +// +EXPORT_C const TDesC8& CWsfModel::ObservedWlan() + { + return *iObservedWlan; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::ConnectL +// ---------------------------------------------------------------------------- +// +EXPORT_C int CWsfModel::ConnectL( TUint32 aIapId, TBool aConnectOnly, + TWsfIapPersistence aPersistence ) + { + LOG_ENTERFN( "CWsfModel::ConnectL" ); + + if ( iObserver ) + { + iObserver->ConnectingL( aIapId ); + } + + TInt err = iSession.ConnectWlanBearerL( aIapId, aConnectOnly, aPersistence ); + if ( err == KErrNone ) + { + iConnectedIapId = aIapId; + } + else + { + if ( iObserver ) + { + iObserver->BrowserLaunchFailed( err ); + } + } + + if ( iObserver ) + { + iObserver->ConnectingFinishedL( err ); + } + + iRefreshing = iSession.RequestScanL(); + + return err; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::ConnectL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::ConnectL( TPckgBuf& aPckg, TUint32 aIapId, + TBool aConnectOnly, + TWsfIapPersistence aPersistence, + TRequestStatus& aStatus ) + { + LOG_ENTERFN( "CWsfModel::ConnectL" ); + + if ( iObserver ) + { + iObserver->ConnectingL( aIapId ); + } + + iSession.ConnectWlanBearer( aPckg, aIapId, aConnectOnly, aPersistence, aStatus ); + } + +// ---------------------------------------------------------------------------- +// CWsfModel::SetConnectResultL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::SetConnectResultL( TInt aResult, TUint /*aIapId*/ ) + { + LOG_ENTERFN( "CWsfModel::SetConnectResultL" ); + + iSession.SetConnectWlanBearerResult( aResult ); + + if ( iObserver && aResult != KErrNone ) + { + iObserver->ConnectingFinishedL( aResult ); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::DisconnectL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::DisconnectL() + { + LOG_ENTERFN( "CWsfModel::DisconnectL" ); + TBool disconnected = iSession.DisconnectWlanBearerL(); + LOG_WRITEF( "disconnected = %d", disconnected ); + iConnectedIapId = 0; + if ( !disconnected ) + { + iRefreshing = iSession.RequestScanL(); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::Disconnect +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::Disconnect( TPckgBuf& aPckg, TRequestStatus& aStatus ) + { + LOG_ENTERFN( "CWsfModel::Disconnect" ); + iSession.DisconnectWlanBearer( aPckg, aStatus ); + iConnectedIapId = 0; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::Refreshing +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CWsfModel::Refreshing() + { + return iRefreshing; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::SetRefreshState +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::SetRefreshState( TBool aRefreshing ) + { + iRefreshing = aRefreshing; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::EnableScanL +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CWsfModel::EnableScanL() + { + LOG_ENTERFN( "CWsfModel::EnableScanL" ); + TBool enableScan( iSession.EnableScanL() ); + if ( iScreenSaverWatcher ) + { + iScreenSaverWatcher->Cancel(); + iScreenSaverWatcher->StartStatusScanning(); + } + return enableScan; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::DisableScanL +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CWsfModel::DisableScanL() + { + LOG_ENTERFN( "CWsfModel::DisableScanL" ); + TBool disableScan( iSession.DisableScanL() ); + if ( iScreenSaverWatcher ) + { + iScreenSaverWatcher->Cancel(); + } + return disableScan; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::IsScanEnabledL +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CWsfModel::IsScanEnabledL() + { + return iSession.IsScanEnabledL(); + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::LaunchBrowserL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::LaunchBrowserL( TUint32 aIapId ) + { + LOG_ENTERFN( "CWsfModel::LaunchBrowserL" ); + + if ( !iBrowserLauncher->Launching() || + iBrowserLauncher->BrowserIap() != aIapId ) + { + LOG_WRITE( "launching browser..." ); + iConnectedIapId = aIapId; + iBrowserLauncher->LaunchBrowserL( *this, aIapId ); + } + else if ( iBrowserLauncher->BrowserIap() == aIapId ) + { + LOG_WRITE( "bringing browser to foreground..." ); + ContinueBrowsingL(); + } + + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::ContinueBrowsingL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::ContinueBrowsingL() + { + LOG_ENTERFN( "CWsfModel::ContinueBrowsingL(void)" ); + iBrowserLauncher->ContinueBrowsingL(); + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::ContinueBrowsingL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::ContinueBrowsingL( TUint32 aIapId ) + { + LOG_ENTERFN( "CWsfModel::ContinueBrowsingL(TUint32)" ); + iBrowserLauncher->ContinueBrowsingL( *this, aIapId ); + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::CreateAccessPointL +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CWsfModel::CreateAccessPointL( TWsfWlanInfo& aWlan, + TBool aExplicitDefine ) + { + LOG_ENTERFN( "CWsfModel::CreateAccessPointL" ); + if ( aExplicitDefine ) + { + LOG_WRITE( "called from 'Define access point'" ); + } + + CheckSpaceBelowCriticalLevelL(); + CheckUnknownWapiL( aWlan ); + + CWsfWlanIapWizard* iapWizard = CWsfWlanIapWizard::NewLC(); + + // the wlaninfo must be persistent to avoid nullpointer crashes due to + // background refreshing + TBool ret( ETrue ); + + // query necessary data + if ( !iapWizard->LaunchWizardL( aWlan, aExplicitDefine ) ) + { + LOG_WRITE( "iapWizard.LaunchWizardL failed" ); + ret = EFalse; + } + + // then create accesspoint + if ( ret ) + { + if ( iapWizard->CreateAccessPointL() ) + { + // copy back the IAP id + LOG_WRITEF( "IAP id = %d", aWlan.iIapId ); + } + else + { + LOG_WRITE( "iapWizard.CreateAccessPointL failed" ); + ret = EFalse; + } + } + + CleanupStack::PopAndDestroy( iapWizard ); + + return ret; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::RefreshScanL +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CWsfModel::RefreshScanL() + { + LOG_ENTERFN( "CWsfModel::RefreshScanL" ); + iRefreshing = iSession.RequestScanL(); + LOG_WRITEF( "iRefreshing = %d", iRefreshing ); + return iRefreshing; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::RefreshScan +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::RefreshScan( TPckgBuf& aPckg, + TRequestStatus& aStatus ) + { + LOG_ENTERFN( "CWsfModel::RefreshScan" ); + iSession.RequestScan( aPckg, aStatus ); + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::CloseHelperApplication +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CWsfModel::CloseHelperApplication() + { + LOG_ENTERFN( "CWsfModel::CloseHelperApplication" ); + TBool endTaskCalled = EFalse; + // check if the app is already running ... and kill it. + TUid id( TUid::Uid( KHelperApUid.iUid ) ); + TApaTaskList taskList( iEikEnv->WsSession() ); + TApaTask task = taskList.FindApp( id ); + + if ( task.Exists() ) + { + LOG_WRITE( "ending task" ); + task.EndTask(); + endTaskCalled = ETrue; + } + return endTaskCalled; + } + + + +// ---------------------------------------------------------------------------- +// CWsfModel::LaunchHelperApplicationL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::LaunchHelperApplicationL( TWsfWlanInfo &aWlanInfo ) + { + LOG_ENTERFN( "CWsfModel::LaunchHelperApplicationL" ); + TPckgC param( aWlanInfo ); + + TBuf8 temp; + temp.Copy( param ); + + TFileName fileName; + fileName.Copy( temp ); + + RApaLsSession appArcSession; + + User::LeaveIfError( appArcSession.Connect() ); // connect to AppArc server + CleanupClosePushL( appArcSession ); + + // check if the app is already running ... and kill it. + TUid id( TUid::Uid( KHelperApUid.iUid ) ); + TApaTaskList taskList( iEikEnv->WsSession() ); + TApaTask task = taskList.FindApp( id ); + + if ( task.Exists() ) + { + task.EndTask(); + } + + TThreadId threadId; + User::LeaveIfError( appArcSession.StartDocument( fileName, TUid::Uid( + KHelperApUid.iUid ), threadId ) ); + + CleanupStack::PopAndDestroy( &appArcSession ); + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::CancelNotifyEvents +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::CancelNotifyEvents() + { + LOG_ENTERFN( "CWsfModel::CancelNotifyEvents" ); + iSession.CancelNotifyEvent(); + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::RequestNotifyEventsL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::RequestNotifyEventsL( + MWsfStateChangeObserver& aObserver ) + { + LOG_ENTERFN( "CWsfModel::RequestNotifyEventsL" ); + iSession.NotifyEventL( aObserver ); + } + + +// ------------------------- From MWsfBrowserLaunchObserver ------------------- + +// ---------------------------------------------------------------------------- +// CWsfModel::BrowserLaunchFailed +// ---------------------------------------------------------------------------- +// +void CWsfModel::BrowserLaunchFailed( TInt aError ) + { + LOG_ENTERFN( "CWsfModel::BrowserLaunchFailed" ); + LOG_WRITEF( "error = %d", aError ); + + if ( iObserver ) + { + iObserver->BrowserLaunchFailed( aError ); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::BrowserLaunchCompleteL +// ---------------------------------------------------------------------------- +// +void CWsfModel::BrowserLaunchCompleteL() + { + LOG_ENTERFN( "CWsfModel::BrowserLaunchCompleteL" ); + + iSession.MonitorAccessPointL( iConnectedIapId ); + + if ( iObserver ) + { + iObserver->BrowserLaunchCompleteL(); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::BrowserExitL +// ---------------------------------------------------------------------------- +// +void CWsfModel::BrowserExitL() + { + LOG_ENTERFN( "CWsfModel::BrowserExitL" ); + + // browser has been terminated, do the cleanup if necessary + iSession.SetIapPersistenceL( EIapForcedExpiry ); + + if ( iObserver ) + { + iObserver->BrowserExitL(); + } + } + +// ------------------------- From MWsfScreenSaverStateObserver ---------------- + +// ---------------------------------------------------------------------------- +// CWsfModel::ScreenSaverStatusChangedL +// ---------------------------------------------------------------------------- +// +void CWsfModel::ScreenSaverStatusChangedL( const TBool aScreenSaverActive ) + { + LOG_ENTERFN( "CWsfModel::ScreenSaverStatusChangedL" ); + LOG_WRITEF( "status = %d", aScreenSaverActive ); + if ( aScreenSaverActive ) + { + iSession.DisableScanL(); + } + else + { + iSession.EnableScanL(); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::IsConnectedL +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CWsfModel::IsConnectedL() + { + return iSession.IsConnectedL(); + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::GetConnectedWlanDetailsL +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CWsfModel::GetConnectedWlanDetailsL( TWsfWlanInfo& aWlanInfo ) + { + return iSession.GetConnectedWlanDetailsL( aWlanInfo ); + } + +// ---------------------------------------------------------------------------- +// CWsfModel::GetConnectedWlanDetails +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::GetConnectedWlanDetails( TPckgBuf& aPckg, + TWsfWlanInfo& aWlanInfo, + TRequestStatus& aStatus ) + { + iSession.GetConnectedWlanDetails( aPckg, aWlanInfo, aStatus ); + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::AbortConnectingL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::AbortConnectingL() + { + LOG_ENTERFN( "CWsfModel::AbortConnectingL" ); + if ( iConnecting ) + { + iSession.AbortConnectingL(); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::AbortScanningL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::AbortScanningL() + { + LOG_ENTERFN( "CWsfModel::AbortScanningL" ); + if ( iRefreshing ) + { + iSession.AbortScanningL(); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::CheckSpaceBelowCriticalLevelL +// ---------------------------------------------------------------------------- +// +void CWsfModel::CheckSpaceBelowCriticalLevelL() const + { + // OOD handling. If disk space is low user is notified. + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + + // Checks the FFS space "after" addition + TBool belowCL = SysUtil::FFSSpaceBelowCriticalLevelL + ( &fs, KEstimatedOverhead ); + + CleanupStack::PopAndDestroy(); // fs + + if( belowCL ) + { + User::Leave( KErrDiskFull ); + } + } + +// ---------------------------------------------------------------------------- +// CWsfModel::CheckUnknownWapiL +// ---------------------------------------------------------------------------- +// +void CWsfModel::CheckUnknownWapiL( TWsfWlanInfo& aWlan ) const + { + if( !aWlan.Known() && aWlan.SecurityMode() == EWlanSecModeWAPI ) + { + User::Leave( KErrWlanProtectedSetupSetupLocked ); + } + } + +// ---------------------------------------------------------------------------- +// CWsfModel::CheckIsIapIdValidL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::CheckIsIapIdValidL( TUint aIapId ) const + { + LOG_ENTERFN( "CWsfModel::CheckIsIapIdValidL" ); + LOG_WRITEF( "Checking iapId= %d", aIapId ); + if( aIapId ) + { + RCmManagerExt cmManager; + cmManager.OpenL(); + CleanupClosePushL( cmManager ); + + RCmConnectionMethodExt cm = cmManager.ConnectionMethodL( aIapId ); + cm.Close(); + CleanupStack::PopAndDestroy( &cmManager ); + } + else + { + User::Leave( KErrArgument ); + } + } + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/model/src/wsfscreensaverwatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/src/wsfscreensaverwatcher.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfScreenSaverWatcher +* +*/ + + +// EXTERNAL INCLUDES +#include +#include + +// CLASS HEADER +#include "wsfscreensaverwatcher.h" + +// INTERNAL INCLUDES +#include "wsfscreensaverstateobserver.h" + + + +// ---------------------------------------------------------------------------- +// CWsfScreenSaverWatcher::NewL +// ---------------------------------------------------------------------------- +// +CWsfScreenSaverWatcher* CWsfScreenSaverWatcher::NewL( + MWsfScreenSaverStateObserver& aObserver ) + { + CWsfScreenSaverWatcher* thisPtr = NewLC( aObserver ); + CleanupStack::Pop( thisPtr ); + return thisPtr; + } + + +// ---------------------------------------------------------------------------- +// CWsfScreenSaverWatcher::NewLC +// ---------------------------------------------------------------------------- +// +CWsfScreenSaverWatcher* CWsfScreenSaverWatcher::NewLC( + MWsfScreenSaverStateObserver& aObserver ) + { + CWsfScreenSaverWatcher* thisPtr = new ( ELeave ) CWsfScreenSaverWatcher( + aObserver ); + CleanupStack::PushL( thisPtr ); + thisPtr->ConstructL(); + return thisPtr; + } + + +// ---------------------------------------------------------------------------- +// CWsfScreenSaverWatcher::~CWsfScreenSaverWatcher +// ---------------------------------------------------------------------------- +// +CWsfScreenSaverWatcher::~CWsfScreenSaverWatcher() + { + Cancel(); + iProperty.Close(); + } + + +// ---------------------------------------------------------------------------- +// CWsfScreenSaverWatcher::CWsfScreenSaverWatcher +// ---------------------------------------------------------------------------- +// +CWsfScreenSaverWatcher::CWsfScreenSaverWatcher( + MWsfScreenSaverStateObserver& aObserver ): + CActive( EPriorityStandard ), + iObserver( &aObserver ) + { + } + + +// ---------------------------------------------------------------------------- +// CWsfScreenSaverWatcher::ConstructL +// ---------------------------------------------------------------------------- +// +void CWsfScreenSaverWatcher::ConstructL() + { + User::LeaveIfError( iProperty.Attach( KPSUidScreenSaver, + KScreenSaverOn ) ); + CActiveScheduler::Add( this ); + } + + +// ---------------------------------------------------------------------------- +// CWsfScreenSaverWatcher::RunL +// ---------------------------------------------------------------------------- +// +void CWsfScreenSaverWatcher::RunL() + { + // read the value of property + TBool screenSaverActive( EFalse ); + iProperty.Get( screenSaverActive ); + iObserver->ScreenSaverStatusChangedL( screenSaverActive ); + // reissue the request + StartStatusScanning(); + } + + +// ---------------------------------------------------------------------------- +// CWsfScreenSaverWatcher::DoCancel +// ---------------------------------------------------------------------------- +// +void CWsfScreenSaverWatcher::DoCancel() + { + iProperty.Cancel(); + } + + +// ---------------------------------------------------------------------------- +// CWsfScreenSaverWatcher::StartStatusScanning +// ---------------------------------------------------------------------------- +// +void CWsfScreenSaverWatcher::StartStatusScanning() + { + iProperty.Subscribe( iStatus ); + SetActive(); + } + + +// ---------------------------------------------------------------------------- +// CWsfScreenSaverWatcher::RunError +// ---------------------------------------------------------------------------- +// +TInt CWsfScreenSaverWatcher::RunError( TInt /*aError*/ ) + { + // issue the request so we will continue to receive + // state change notifications + StartStatusScanning(); + return KErrNone; + } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/rom/wlansniffer.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/rom/wlansniffer.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 WlanSniffer +* +*/ + + +#ifndef WLANSNIFFER_IBY +#define WLANSNIFFER_IBY + +#ifdef __PROTOCOL_WLAN + +REM WlanSniffer + +#include +#include + + +// appshell icon +S60_APP_AIF_ICONS(wsficons) + +// all other bitmaps +data=DATAZ_\APP_BITMAP_DIR\wsficons.mif APP_BITMAP_DIR\wsficons.mif + +#endif // __PROTOCOL_WLAN + +#endif // WLANSNIFFER_IBY \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 information required for building +* +*/ + + +#include + +#include "../widget_2001E637/group/bld.inf" +#include "../widget_20026F45/group/bld.inf" + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES + +// End of File diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_2001E637/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_2001E637/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 information required for building +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +// Support for productization and Carbide.Ui customization +//******************************************************** +../hsps/00/manifest.dat /epoc32/data/Z/resource/homescreen/wsfwidget_2001E637/hsps/manifest.dat +../hsps/00/wsfwidgetconfiguration.xml /epoc32/data/Z/resource/homescreen/wsfwidget_2001E637/hsps/wsfwidgetconfiguration.xml +../hsps/00/wsfwidgetconfiguration.dtd /epoc32/data/Z/resource/homescreen/wsfwidget_2001E637/hsps/wsfwidgetconfiguration.dtd + +../xuikon/00/wsfwidget.dat /epoc32/data/Z/resource/homescreen/wsfwidget_2001E637/xuikon/wsfwidget_2001E637.dat +../xuikon/00/wsfwidget.css /epoc32/data/Z/resource/homescreen/wsfwidget_2001E637/xuikon/wsfwidget.css +../xuikon/00/wsfwidget.xml /epoc32/data/Z/resource/homescreen/wsfwidget_2001E637/xuikon/wsfwidget.xml + +// Arabic languages +//***************** +../xuikon/37/wsfwidget.css /epoc32/data/Z/resource/homescreen/wsfwidget_2001E637/xuikon/37/wsfwidget.css +../xuikon/50/wsfwidget.css /epoc32/data/Z/resource/homescreen/wsfwidget_2001E637/xuikon/50/wsfwidget.css +../xuikon/57/wsfwidget.css /epoc32/data/Z/resource/homescreen/wsfwidget_2001E637/xuikon/57/wsfwidget.css +../xuikon/94/wsfwidget.css /epoc32/data/Z/resource/homescreen/wsfwidget_2001E637/xuikon/94/wsfwidget.css + +// Support for S60 localization +//***************************** +// export localizable loc files (engineering versions) +#ifndef __WSFWIDGETCONFIGURATION_LOC__ +#define __WSFWIDGETCONFIGURATION_LOC__ +../loc/wsfwidgetconfiguration.loc MW_LAYER_LOC_EXPORT_PATH(wsfwidgetconfiguration.loc) +#endif // __WSFWIDGETCONFIGURATION_LOC__ + +// Support for S60 builds +//*********************** +// export iby files +../rom/wsfwidget_resources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(wsfwidget_resources_2001E637.iby) +../rom/wsfwidget_customer.iby CUSTOMER_MW_LAYER_IBY_EXPORT_PATH(wsfwidget_customer_2001E637.iby) +../rom/wsfwidget_variant.iby CUSTOMER_MW_LAYER_IBY_EXPORT_PATH(wsfwidget_variant_2001E637.iby) +../rom/wsfwidget.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wsfwidget_2001E637.iby) + + +// Dtd-localization +//***************** +PRJ_EXTENSIONS +START EXTENSION tools/dtd +OPTION SWITCH_LOC_FILE_NAME wsfwidget_2001E637 +OPTION DTD_TYPE widget +OPTION LOC_FOLDERS yes +END + + +PRJ_MMPFILES + +// build icons + + +// build application + +PRJ_TESTMMPFILES + +//#endif + +// End of File diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_2001E637/hsps/00/manifest.dat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_2001E637/hsps/00/manifest.dat Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,37 @@ + + + + vga_tch + + widget + + + 0x2001f48a + + + 0x101FB657 + + + 0x2001E637 + + + &qtn_hs_wlan_widget; + wsfwidget + 1.0 + &qtn_sniffer_wm_widget_description; + uid(0x10281CAA) + + + wsfwidgetconfiguration.xml + + + wsfwidgetconfiguration.dtd + + + + + + wsfwidget.o0000 + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_2001E637/hsps/00/wsfwidgetconfiguration.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_2001E637/hsps/00/wsfwidgetconfiguration.dtd Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,39 @@ + + + + + + + + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_2001E637/hsps/00/wsfwidgetconfiguration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_2001E637/hsps/00/wsfwidgetconfiguration.xml Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,5 @@ + + + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_2001E637/loc/wsfwidgetconfiguration.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_2001E637/loc/wsfwidgetconfiguration.loc Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 strings for Wlan Sniffer widget +* +*/ + + + +// LOCALISATION STRINGS + +// d:Text for WLAN Wizard widget name +// l:listrow_wgtman_pane_t1 +// r:TB9.1 +#define qtn_hs_wlan_widget "WLAN wizard" + +// d:Text for WLAN Wizard widget description +// l:listrow_wgtman_pane_t2 +// r:TB9.2 +#define qtn_sniffer_wm_widget_description "Discover and connect to Wireless LAN networks." diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_2001E637/rom/wsfwidget.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_2001E637/rom/wsfwidget.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2005-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: wlansniffer widget IBY file. +* +*/ + + +#ifndef __WSFWIDGET_2001E637_IBY__ +#define __WSFWIDGET_2001E637_IBY__ + +#ifdef __PROTOCOL_WLAN + +#if defined (FF_LAYOUT_480_640_VGA3) || defined (FF_LAYOUT_640_480_VGA3) + +// Enabled by DTD-localization tools +data=ZPRIVATE\200159c0\install\wsfwidget_2001E637\hsps\00\manifest.dat \private\200159c0\install\wsfwidget_2001E637\hsps\00\manifest.dat +data=ZPRIVATE\200159c0\install\wsfwidget_2001E637\xuikon\00\wsfwidget.o0000 \private\200159c0\install\wsfwidget_2001E637\xuikon\00\wsfwidget.o0000 + +#endif // (FF_LAYOUT_480_640_VGA3) || defined (FF_LAYOUT_640_480_VGA3) + +#endif // __PROTOCOL_WLAN + +#endif // __WSFWIDGET_2001E637_IBY__ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_2001E637/rom/wsfwidget_customer.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_2001E637/rom/wsfwidget_customer.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: wlansniffer widget language specific IBY file. +* +*/ + + +#ifndef __WSFWIDGET_2001E637_CUSTOMER_IBY__ +#define __WSFWIDGET_2001E637_CUSTOMER_IBY__ + +#ifdef __PROTOCOL_WLAN + +#if defined (FF_LAYOUT_480_640_VGA3) || defined (FF_LAYOUT_640_480_VGA3) + +// Enabled by DTD-localization tools, language specific +data=ZPRIVATE\200159c0\install\wsfwidget_2001E637\hsps\00\wsfwidgetconfiguration.dtd \private\200159c0\install\wsfwidget_2001E637\hsps\00\wsfwidgetconfiguration.dtd + +#endif // (FF_LAYOUT_480_640_VGA3) || defined (FF_LAYOUT_640_480_VGA3) + +#endif // __PROTOCOL_WLAN + +#endif // __WSFWIDGET_2001E637_CUSTOMER_IBY__ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_2001E637/rom/wsfwidget_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_2001E637/rom/wsfwidget_resources.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: wlansniffer widget language specific IBY file. +* +*/ + + +#ifndef __WSFWIDGET_2001E637_RESOURCES_IBY__ +#define __WSFWIDGET_2001E637_RESOURCES_IBY__ + +#ifdef __PROTOCOL_WLAN + +#if defined (FF_LAYOUT_480_640_VGA3) || defined (FF_LAYOUT_640_480_VGA3) + +// Enabled by DTD-localization tools, language specific +#if defined (__LOCALES_37_IBY__) +data=ZPRIVATE\200159c0\install\wsfwidget_2001E637\xuikon\37\wsfwidget.o0037 \private\200159c0\install\wsfwidget_2001E637\xuikon\37\wsfwidget.o0037 +#endif +#if defined (__LOCALES_50_IBY__) +data=ZPRIVATE\200159c0\install\wsfwidget_2001E637\xuikon\50\wsfwidget.o0050 \private\200159c0\install\wsfwidget_2001E637\xuikon\50\wsfwidget.o0050 +#endif +#if defined (__LOCALES_57_IBY__) +data=ZPRIVATE\200159c0\install\wsfwidget_2001E637\xuikon\57\wsfwidget.o0057 \private\200159c0\install\wsfwidget_2001E637\xuikon\57\wsfwidget.o0057 +#endif +#if defined (__LOCALES_94_IBY__) +data=ZPRIVATE\200159c0\install\wsfwidget_2001E637\xuikon\94\wsfwidget.o0094 \private\200159c0\install\wsfwidget_2001E637\xuikon\94\wsfwidget.o0094 +#endif + +// Enabled by DTD-localization tools, language specific +data=ZPRIVATE\200159c0\install\wsfwidget_2001E637\hsps\00\wsfwidgetconfiguration.dtd \private\200159c0\install\wsfwidget_2001E637\hsps\00\wsfwidgetconfiguration.dtd + +#endif // (FF_LAYOUT_480_640_VGA3) || defined (FF_LAYOUT_640_480_VGA3) + +#endif // __PROTOCOL_WLAN + +#endif // __WSFWIDGET_2001E637_RESOURCES_IBY__ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_2001E637/rom/wsfwidget_variant.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_2001E637/rom/wsfwidget_variant.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: wlansniffer widget variant specific IBY file. +* +*/ + + +#ifndef __WSFWIDGET_2001E637_VARIANT_IBY__ +#define __WSFWIDGET_2001E637_VARIANT_IBY__ + +#ifdef __PROTOCOL_WLAN + +#if defined (FF_LAYOUT_480_640_VGA3) || defined (FF_LAYOUT_640_480_VGA3) + +// Enabled by variation tools, variant specific +data=ZPRIVATE\200159c0\install\wsfwidget_2001E637\hsps\00\wsfwidgetconfiguration.xml \private\200159c0\install\wsfwidget_2001E637\hsps\00\wsfwidgetconfiguration.xml + +#endif // (FF_LAYOUT_480_640_VGA3) || defined (FF_LAYOUT_640_480_VGA3) + +#endif // __PROTOCOL_WLAN + +#endif // __WSFWIDGET_2001E637_VARIANT_IBY__ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/00/wsfwidget.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/00/wsfwidget.css Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,89 @@ +/******************** + WIZARD PLUGIN AREA +*********************/ + +widget#wizardPluginContainer{ + height: 10u; + display: block; + nav-index: appearance; + width: auto; + padding-top: 0.5u; + block-progression: tb; +} + +button.wizardStatusBox1 { + display: block; + visibility: visible; + width: auto; + top: 0u; + block-progression: lr; + direction: ltr; +} + +button.wizardStatusBox2{ + display: block; + visibility: visible; + width: auto; + top: 5u; + block-progression: lr; + direction: ltr; +} + +image.wizardicon { + display: block; + visibility: visible; + position: static; + margin-top: 4%; + margin-left: 1.0u; + width: 4.0u; + height: 4.0u; +} + +text.wizardEntryText1 { + display: block; + visibility: visible; + position: static; + width: auto; + margin-top: 4%; + margin-left: 1.0u; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + text-align: left; + _s60-text-valign: top; + direction: ltr; + color: "SKIN(268458534 13056 74)"; +} + +text.wizardEntryText2 { + display: block; + visibility: visible; + position: static; + width: auto; + margin-left: 6.0u; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + text-align: left; + _s60-text-valign: top; + direction: ltr; + color: "SKIN(268458534 13056 74)"; +} + +image#wizardSecureIcon { + display: block; + visibility: visible; + position: static; + margin-top: 0.2%; + margin-right: 0.5u; + width: 4.0u; + height: 4.0u; +} + +image#wizardStrengthIcon { + display: block; + visibility: visible; + position: static; + margin-top: 0.2%; + margin-right: 1u; + width: 4.0u; + height: 4.0u; +} \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/00/wsfwidget.dat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/00/wsfwidget.dat Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,11 @@ + + + E029CF57 + 101FB657 + 2001E637 + WLAN wizard + wsfwidget + 1.0 + wsfwidget.xml + wsfwidget.css + \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/00/wsfwidget.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/00/wsfwidget.xml Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/37/wsfwidget.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/37/wsfwidget.css Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,89 @@ +/******************** + WIZARD PLUGIN AREA +*********************/ + +widget#wizardPluginContainer{ + height: 10u; + display: block; + nav-index: appearance; + width: auto; + padding-top: 0.5u; + block-progression: tb; +} + +button.wizardStatusBox1 { + display: block; + visibility: visible; + width: auto; + top: 0u; + block-progression: rl; + direction: rtl; +} + +button.wizardStatusBox2{ + display: block; + visibility: visible; + width: auto; + top: 5u; + block-progression: rl; + direction: rtl; +} + +image.wizardicon { + display: block; + visibility: visible; + position: static; + margin-top: 4%; + margin-right: 1.0u; + width: 4.0u; + height: 4.0u; +} + +text.wizardEntryText1 { + display: block; + visibility: visible; + position: static; + width: auto; + margin-top: 4%; + margin-right: 1.0u; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + text-align: right; + _s60-text-valign: top; + direction: ltr; + color: "SKIN(268458534 13056 74)"; +} + +text.wizardEntryText2 { + display: block; + visibility: visible; + position: static; + width: auto; + margin-right: 6.0u; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + text-align: right; + _s60-text-valign: top; + direction: ltr; + color: "SKIN(268458534 13056 74)"; +} + +image#wizardSecureIcon { + display: block; + visibility: visible; + position: static; + margin-top: 0.2%; + margin-left: 0.5u; + width: 4.0u; + height: 4.0u; +} + +image#wizardStrengthIcon { + display: block; + visibility: visible; + position: static; + margin-top: 0.2%; + margin-left: 1u; + width: 4.0u; + height: 4.0u; +} \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/50/wsfwidget.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/50/wsfwidget.css Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,89 @@ +/******************** + WIZARD PLUGIN AREA +*********************/ + +widget#wizardPluginContainer{ + height: 10u; + display: block; + nav-index: appearance; + width: auto; + padding-top: 0.5u; + block-progression: tb; +} + +button.wizardStatusBox1 { + display: block; + visibility: visible; + width: auto; + top: 0u; + block-progression: rl; + direction: rtl; +} + +button.wizardStatusBox2{ + display: block; + visibility: visible; + width: auto; + top: 5u; + block-progression: rl; + direction: rtl; +} + +image.wizardicon { + display: block; + visibility: visible; + position: static; + margin-top: 4%; + margin-right: 1.0u; + width: 4.0u; + height: 4.0u; +} + +text.wizardEntryText1 { + display: block; + visibility: visible; + position: static; + width: auto; + margin-top: 4%; + margin-right: 1.0u; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + text-align: right; + _s60-text-valign: top; + direction: ltr; + color: "SKIN(268458534 13056 74)"; +} + +text.wizardEntryText2 { + display: block; + visibility: visible; + position: static; + width: auto; + margin-right: 6.0u; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + text-align: right; + _s60-text-valign: top; + direction: ltr; + color: "SKIN(268458534 13056 74)"; +} + +image#wizardSecureIcon { + display: block; + visibility: visible; + position: static; + margin-top: 0.2%; + margin-left: 0.5u; + width: 4.0u; + height: 4.0u; +} + +image#wizardStrengthIcon { + display: block; + visibility: visible; + position: static; + margin-top: 0.2%; + margin-left: 1u; + width: 4.0u; + height: 4.0u; +} \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/57/wsfwidget.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/57/wsfwidget.css Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,89 @@ +/******************** + WIZARD PLUGIN AREA +*********************/ + +widget#wizardPluginContainer{ + height: 10u; + display: block; + nav-index: appearance; + width: auto; + padding-top: 0.5u; + block-progression: tb; +} + +button.wizardStatusBox1 { + display: block; + visibility: visible; + width: auto; + top: 0u; + block-progression: rl; + direction: rtl; +} + +button.wizardStatusBox2{ + display: block; + visibility: visible; + width: auto; + top: 5u; + block-progression: rl; + direction: rtl; +} + +image.wizardicon { + display: block; + visibility: visible; + position: static; + margin-top: 4%; + margin-right: 1.0u; + width: 4.0u; + height: 4.0u; +} + +text.wizardEntryText1 { + display: block; + visibility: visible; + position: static; + width: auto; + margin-top: 4%; + margin-right: 1.0u; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + text-align: right; + _s60-text-valign: top; + direction: ltr; + color: "SKIN(268458534 13056 74)"; +} + +text.wizardEntryText2 { + display: block; + visibility: visible; + position: static; + width: auto; + margin-right: 6.0u; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + text-align: right; + _s60-text-valign: top; + direction: ltr; + color: "SKIN(268458534 13056 74)"; +} + +image#wizardSecureIcon { + display: block; + visibility: visible; + position: static; + margin-top: 0.2%; + margin-left: 0.5u; + width: 4.0u; + height: 4.0u; +} + +image#wizardStrengthIcon { + display: block; + visibility: visible; + position: static; + margin-top: 0.2%; + margin-left: 1u; + width: 4.0u; + height: 4.0u; +} \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/94/wsfwidget.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/94/wsfwidget.css Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,89 @@ +/******************** + WIZARD PLUGIN AREA +*********************/ + +widget#wizardPluginContainer{ + height: 10u; + display: block; + nav-index: appearance; + width: auto; + padding-top: 0.5u; + block-progression: tb; +} + +button.wizardStatusBox1 { + display: block; + visibility: visible; + width: auto; + top: 0u; + block-progression: rl; + direction: rtl; +} + +button.wizardStatusBox2{ + display: block; + visibility: visible; + width: auto; + top: 5u; + block-progression: rl; + direction: rtl; +} + +image.wizardicon { + display: block; + visibility: visible; + position: static; + margin-top: 4%; + margin-right: 1.0u; + width: 4.0u; + height: 4.0u; +} + +text.wizardEntryText1 { + display: block; + visibility: visible; + position: static; + width: auto; + margin-top: 4%; + margin-right: 1.0u; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + text-align: right; + _s60-text-valign: top; + direction: ltr; + color: "SKIN(268458534 13056 74)"; +} + +text.wizardEntryText2 { + display: block; + visibility: visible; + position: static; + width: auto; + margin-right: 6.0u; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + text-align: right; + _s60-text-valign: top; + direction: ltr; + color: "SKIN(268458534 13056 74)"; +} + +image#wizardSecureIcon { + display: block; + visibility: visible; + position: static; + margin-top: 0.2%; + margin-left: 0.5u; + width: 4.0u; + height: 4.0u; +} + +image#wizardStrengthIcon { + display: block; + visibility: visible; + position: static; + margin-top: 0.2%; + margin-left: 1u; + width: 4.0u; + height: 4.0u; +} \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_20026F45/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_20026F45/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 information required for building +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +// Support for productization and Carbide.Ui customization +//******************************************************** +../hsps/00/manifest.dat /epoc32/data/Z/resource/homescreen/wsfwidget_20026F45/hsps/manifest.dat +../hsps/00/wsfwidgetconfiguration.xml /epoc32/data/Z/resource/homescreen/wsfwidget_20026F45/hsps/wsfwidgetconfiguration.xml +../hsps/00/wsfwidgetconfiguration.dtd /epoc32/data/Z/resource/homescreen/wsfwidget_20026F45/hsps/wsfwidgetconfiguration.dtd + +../xuikon/00/wsfwidget.dat /epoc32/data/Z/resource/homescreen/wsfwidget_20026F45/xuikon/wsfwidget_20026F45.dat +../xuikon/00/wsfwidget.css /epoc32/data/Z/resource/homescreen/wsfwidget_20026F45/xuikon/wsfwidget.css +../xuikon/00/wsfwidget.xml /epoc32/data/Z/resource/homescreen/wsfwidget_20026F45/xuikon/wsfwidget.xml + +// Arabic languages +//***************** +../xuikon/37/wsfwidget.css /epoc32/data/Z/resource/homescreen/wsfwidget_20026F45/xuikon/37/wsfwidget.css +../xuikon/50/wsfwidget.css /epoc32/data/Z/resource/homescreen/wsfwidget_20026F45/xuikon/50/wsfwidget.css +../xuikon/57/wsfwidget.css /epoc32/data/Z/resource/homescreen/wsfwidget_20026F45/xuikon/57/wsfwidget.css +../xuikon/94/wsfwidget.css /epoc32/data/Z/resource/homescreen/wsfwidget_20026F45/xuikon/94/wsfwidget.css + +// Support for S60 localization +//***************************** +// export localizable loc files (engineering versions) +#ifndef __WSFWIDGETCONFIGURATION_LOC__ +#define __WSFWIDGETCONFIGURATION_LOC__ +../loc/wsfwidgetconfiguration.loc MW_LAYER_LOC_EXPORT_PATH(wsfwidgetconfiguration.loc) +#endif // __WSFWIDGETCONFIGURATION_LOC__ + +// Support for S60 builds +//*********************** +// export iby files +../rom/wsfwidget_resources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(wsfwidget_resources_20026F45.iby) +../rom/wsfwidget_customer.iby CUSTOMER_MW_LAYER_IBY_EXPORT_PATH(wsfwidget_customer_20026F45.iby) +../rom/wsfwidget_variant.iby CUSTOMER_MW_LAYER_IBY_EXPORT_PATH(wsfwidget_variant_20026F45.iby) +../rom/wsfwidget.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wsfwidget_20026F45.iby) + + +// Dtd-localization +//***************** +PRJ_EXTENSIONS +START EXTENSION tools/dtd +OPTION SWITCH_LOC_FILE_NAME wsfwidget_20026F45 +OPTION DTD_TYPE widget +OPTION LOC_FOLDERS yes +END + + +PRJ_MMPFILES + +// build icons + + +// build application + +PRJ_TESTMMPFILES + +//#endif + +// End of File diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_20026F45/hsps/00/manifest.dat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_20026F45/hsps/00/manifest.dat Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,37 @@ + + + + qhd_tch + + widget + + + 0x2001f48a + + + 0x101FB657 + + + 0x20026F45 + + + &qtn_hs_wlan_widget; + wsfwidget + 1.0 + &qtn_sniffer_wm_widget_description; + uid(0x10281CAA) + + + wsfwidgetconfiguration.xml + + + wsfwidgetconfiguration.dtd + + + + + + wsfwidget.o0000 + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_20026F45/hsps/00/wsfwidgetconfiguration.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_20026F45/hsps/00/wsfwidgetconfiguration.dtd Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,39 @@ + + + + + + + + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_20026F45/hsps/00/wsfwidgetconfiguration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_20026F45/hsps/00/wsfwidgetconfiguration.xml Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,5 @@ + + + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_20026F45/loc/wsfwidgetconfiguration.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_20026F45/loc/wsfwidgetconfiguration.loc Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 strings for Wlan Sniffer widget +* +*/ + + + +// LOCALISATION STRINGS + +// d:Text for WLAN Wizard widget name +// l:listrow_wgtman_pane_t1 +// r:TB9.1 +#define qtn_hs_wlan_widget "WLAN wizard" + +// d:Text for WLAN Wizard widget description +// l:listrow_wgtman_pane_t2 +// r:TB9.2 +#define qtn_sniffer_wm_widget_description "Discover and connect to Wireless LAN networks." diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_20026F45/rom/wsfwidget.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_20026F45/rom/wsfwidget.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 information required for building +* +*/ + +#ifndef __WSFWIDGET_20026F45_IBY__ +#define __WSFWIDGET_20026F45_IBY__ + +#ifdef __PROTOCOL_WLAN + +#if defined(__LAYOUT_360_640_TOUCH) || defined(__LAYOUT_640_360_TOUCH) + +// Enabled by DTD-localization tools +data=ZPRIVATE\200159c0\install\wsfwidget_20026F45\hsps\00\manifest.dat \private\200159c0\install\wsfwidget_20026F45\hsps\00\manifest.dat +data=ZPRIVATE\200159c0\install\wsfwidget_20026F45\xuikon\00\wsfwidget.o0000 \private\200159c0\install\wsfwidget_20026F45\xuikon\00\wsfwidget.o0000 + +#endif // __LAYOUT_360_640_TOUCH || __LAYOUT_640_360_TOUCH + +#endif // __PROTOCOL_WLAN + +#endif // __WSFWIDGET_20026F45_IBY__ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_20026F45/rom/wsfwidget_customer.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_20026F45/rom/wsfwidget_customer.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 information required for building +* +*/ + +#ifndef __WSFWIDGET_20026F45_CUSTOMER_IBY__ +#define __WSFWIDGET_20026F45_CUSTOMER_IBY__ + +#ifdef __PROTOCOL_WLAN + +#if defined(__LAYOUT_360_640_TOUCH) || defined(__LAYOUT_640_360_TOUCH) + +// Enabled by DTD-localization tools, language specific +data=ZPRIVATE\200159c0\install\wsfwidget_20026F45\hsps\00\wsfwidgetconfiguration.dtd \private\200159c0\install\wsfwidget_20026F45\hsps\00\wsfwidgetconfiguration.dtd + +#endif // __LAYOUT_360_640_TOUCH || __LAYOUT_640_360_TOUCH + +#endif // __PROTOCOL_WLAN + +#endif // __WSFWIDGET_20026F45_CUSTOMER_IBY__ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_20026F45/rom/wsfwidget_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_20026F45/rom/wsfwidget_resources.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 information required for building +* +*/ + +#ifndef __WSFWIDGET_20026F45_RESOURCES_IBY__ +#define __WSFWIDGET_20026F45_RESOURCES_IBY__ + +#ifdef __PROTOCOL_WLAN + +#if defined(__LAYOUT_360_640_TOUCH) || defined(__LAYOUT_640_360_TOUCH) + +// Enabled by DTD-localization tools, language specific +#if defined (__LOCALES_37_IBY__) +data=ZPRIVATE\200159c0\install\wsfwidget_20026F45\xuikon\37\wsfwidget.o0037 \private\200159c0\install\wsfwidget_20026F45\xuikon\37\wsfwidget.o0037 +#endif +#if defined (__LOCALES_50_IBY__) +data=ZPRIVATE\200159c0\install\wsfwidget_20026F45\xuikon\50\wsfwidget.o0050 \private\200159c0\install\wsfwidget_20026F45\xuikon\50\wsfwidget.o0050 +#endif +#if defined (__LOCALES_57_IBY__) +data=ZPRIVATE\200159c0\install\wsfwidget_20026F45\xuikon\57\wsfwidget.o0057 \private\200159c0\install\wsfwidget_20026F45\xuikon\57\wsfwidget.o0057 +#endif +#if defined (__LOCALES_94_IBY__) +data=ZPRIVATE\200159c0\install\wsfwidget_20026F45\xuikon\94\wsfwidget.o0094 \private\200159c0\install\wsfwidget_20026F45\xuikon\94\wsfwidget.o0094 +#endif + +// Enabled by DTD-localization tools, language specific +data=ZPRIVATE\200159c0\install\wsfwidget_20026F45\hsps\00\wsfwidgetconfiguration.dtd \private\200159c0\install\wsfwidget_20026F45\hsps\00\wsfwidgetconfiguration.dtd + +#endif // __LAYOUT_360_640_TOUCH || __LAYOUT_640_360_TOUCH + +#endif // __PROTOCOL_WLAN + +#endif // __WSFWIDGET_20026F45_RESOURCES_IBY__ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_20026F45/rom/wsfwidget_variant.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_20026F45/rom/wsfwidget_variant.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 information required for building +* +*/ + +#ifndef __WSFWIDGET_20026F45_VARIANT_IBY__ +#define __WSFWIDGET_20026F45_VARIANT_IBY__ + +#ifdef __PROTOCOL_WLAN + +#if defined(__LAYOUT_360_640_TOUCH) || defined(__LAYOUT_640_360_TOUCH) + +// Enabled by variation tools, variant specific +data=ZPRIVATE\200159c0\install\wsfwidget_20026F45\hsps\00\wsfwidgetconfiguration.xml \private\200159c0\install\wsfwidget_20026F45\hsps\00\wsfwidgetconfiguration.xml + +#endif // __LAYOUT_360_640_TOUCH || __LAYOUT_640_360_TOUCH + +#endif // __PROTOCOL_WLAN + +#endif // __WSFWIDGET_20026F45_VARIANT_IBY__ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/00/wsfwidget.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/00/wsfwidget.css Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,99 @@ +/******************** + WIZARD PLUGIN AREA +*********************/ + +widget#wizardPluginContainer{ + display: block; + width: auto; + height: auto; + padding-left: 7px; + padding-right: 7px; + padding-top: 16px; + padding-bottom: 17px; + nav-index: appearance; + block-progression: tb; +} + +button.wizardStatusBox1 { + display: block; + visibility: visible; + width: auto; + height: 24px; + position: absolute; + top: 0u; + block-progression: lr; + direction: ltr; +} + +button.wizardStatusBox2{ + display: block; + visibility: visible; + width: auto; + height: 24px; + position: absolute; + top: 25px; + block-progression: lr; + direction: ltr; +} + +image.wizardicon { + display: block; + visibility: visible; + position: static; + margin-top: 0u; + margin-left: 0u; + width: 24px; + height: 24px; +} + +text.wizardEntryText1 { + display: block; + visibility: visible; + position: static; + width: auto; + height: 24px; + margin-top: 0u; + margin-left: 5px; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + color: "SKIN(268458534 13056 74)"; + text-align: left; + direction: ltr; + _s60-text-valign: top; +} + +text.wizardEntryText2 { + display: block; + visibility: visible; + position: static; + width: auto; + height: 24px; + margin-top: 0u; + margin-left: 29px; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + color: "SKIN(268458534 13056 74)"; + text-align: left; + direction: ltr; + _s60-text-valign: top; +} + +image#wizardSecureIcon { + display: block; + visibility: visible; + position: static; + margin-top: 0u; + margin-right: 5px; + width: 24px; + height: 24px; +} + +image#wizardStrengthIcon { + display: block; + visibility: visible; + position: static; + margin-top: 0u; + margin-right: 0u; + width: 24px; + height: 24px; +} \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/00/wsfwidget.dat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/00/wsfwidget.dat Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,11 @@ + + + E029CF57 + 101FB657 + 20026F45 + WLAN wizard + wsfwidget + 1.0 + wsfwidget.xml + wsfwidget.css + \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/00/wsfwidget.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/00/wsfwidget.xml Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/37/wsfwidget.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/37/wsfwidget.css Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,99 @@ +/******************** + WIZARD PLUGIN AREA +*********************/ + +widget#wizardPluginContainer{ + display: block; + width: auto; + height: auto; + padding-left: 7px; + padding-right: 7px; + padding-top: 16px; + padding-bottom: 17px; + nav-index: appearance; + block-progression: tb; +} + +button.wizardStatusBox1 { + display: block; + visibility: visible; + width: auto; + height: 24px; + position: absolute; + top: 0u; + block-progression: rl; + direction: rtl; +} + +button.wizardStatusBox2{ + display: block; + visibility: visible; + width: auto; + height: 24px; + position: absolute; + top: 25px; + block-progression: rl; + direction: rtl; +} + +image.wizardicon { + display: block; + visibility: visible; + position: static; + margin-top: 0u; + margin-right: 0u; + width: 24px; + height: 24px; +} + +text.wizardEntryText1 { + display: block; + visibility: visible; + position: static; + width: auto; + height: 24px; + margin-top: 0u; + margin-right: 5px; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + color: "SKIN(268458534 13056 74)"; + text-align: right; + direction: ltr; + _s60-text-valign: top; +} + +text.wizardEntryText2 { + display: block; + visibility: visible; + position: static; + width: auto; + height: 24px; + margin-top: 0u; + margin-right: 29px; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + color: "SKIN(268458534 13056 74)"; + text-align: right; + direction: ltr; + _s60-text-valign: top; +} + +image#wizardSecureIcon { + display: block; + visibility: visible; + position: static; + margin-top: 0u; + margin-left: 5px; + width: 24px; + height: 24px; +} + +image#wizardStrengthIcon { + display: block; + visibility: visible; + position: static; + margin-top: 0u; + margin-left: 0u; + width: 24px; + height: 24px; +} \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/50/wsfwidget.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/50/wsfwidget.css Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,99 @@ +/******************** + WIZARD PLUGIN AREA +*********************/ + +widget#wizardPluginContainer{ + display: block; + width: auto; + height: auto; + padding-left: 7px; + padding-right: 7px; + padding-top: 16px; + padding-bottom: 17px; + nav-index: appearance; + block-progression: tb; +} + +button.wizardStatusBox1 { + display: block; + visibility: visible; + width: auto; + height: 24px; + position: absolute; + top: 0u; + block-progression: rl; + direction: rtl; +} + +button.wizardStatusBox2{ + display: block; + visibility: visible; + width: auto; + height: 24px; + position: absolute; + top: 25px; + block-progression: rl; + direction: rtl; +} + +image.wizardicon { + display: block; + visibility: visible; + position: static; + margin-top: 0u; + margin-right: 0u; + width: 24px; + height: 24px; +} + +text.wizardEntryText1 { + display: block; + visibility: visible; + position: static; + width: auto; + height: 24px; + margin-top: 0u; + margin-right: 5px; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + color: "SKIN(268458534 13056 74)"; + text-align: right; + direction: ltr; + _s60-text-valign: top; +} + +text.wizardEntryText2 { + display: block; + visibility: visible; + position: static; + width: auto; + height: 24px; + margin-top: 0u; + margin-right: 29px; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + color: "SKIN(268458534 13056 74)"; + text-align: right; + direction: ltr; + _s60-text-valign: top; +} + +image#wizardSecureIcon { + display: block; + visibility: visible; + position: static; + margin-top: 0u; + margin-left: 5px; + width: 24px; + height: 24px; +} + +image#wizardStrengthIcon { + display: block; + visibility: visible; + position: static; + margin-top: 0u; + margin-left: 0u; + width: 24px; + height: 24px; +} \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/57/wsfwidget.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/57/wsfwidget.css Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,99 @@ +/******************** + WIZARD PLUGIN AREA +*********************/ + +widget#wizardPluginContainer{ + display: block; + width: auto; + height: auto; + padding-left: 7px; + padding-right: 7px; + padding-top: 16px; + padding-bottom: 17px; + nav-index: appearance; + block-progression: tb; +} + +button.wizardStatusBox1 { + display: block; + visibility: visible; + width: auto; + height: 24px; + position: absolute; + top: 0u; + block-progression: rl; + direction: rtl; +} + +button.wizardStatusBox2{ + display: block; + visibility: visible; + width: auto; + height: 24px; + position: absolute; + top: 25px; + block-progression: rl; + direction: rtl; +} + +image.wizardicon { + display: block; + visibility: visible; + position: static; + margin-top: 0u; + margin-right: 0u; + width: 24px; + height: 24px; +} + +text.wizardEntryText1 { + display: block; + visibility: visible; + position: static; + width: auto; + height: 24px; + margin-top: 0u; + margin-right: 5px; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + color: "SKIN(268458534 13056 74)"; + text-align: right; + direction: ltr; + _s60-text-valign: top; +} + +text.wizardEntryText2 { + display: block; + visibility: visible; + position: static; + width: auto; + height: 24px; + margin-top: 0u; + margin-right: 29px; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + color: "SKIN(268458534 13056 74)"; + text-align: right; + direction: ltr; + _s60-text-valign: top; +} + +image#wizardSecureIcon { + display: block; + visibility: visible; + position: static; + margin-top: 0u; + margin-left: 5px; + width: 24px; + height: 24px; +} + +image#wizardStrengthIcon { + display: block; + visibility: visible; + position: static; + margin-top: 0u; + margin-left: 0u; + width: 24px; + height: 24px; +} \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/94/wsfwidget.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/94/wsfwidget.css Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,99 @@ +/******************** + WIZARD PLUGIN AREA +*********************/ + +widget#wizardPluginContainer{ + display: block; + width: auto; + height: auto; + padding-left: 7px; + padding-right: 7px; + padding-top: 16px; + padding-bottom: 17px; + nav-index: appearance; + block-progression: tb; +} + +button.wizardStatusBox1 { + display: block; + visibility: visible; + width: auto; + height: 24px; + position: absolute; + top: 0u; + block-progression: rl; + direction: rtl; +} + +button.wizardStatusBox2{ + display: block; + visibility: visible; + width: auto; + height: 24px; + position: absolute; + top: 25px; + block-progression: rl; + direction: rtl; +} + +image.wizardicon { + display: block; + visibility: visible; + position: static; + margin-top: 0u; + margin-right: 0u; + width: 24px; + height: 24px; +} + +text.wizardEntryText1 { + display: block; + visibility: visible; + position: static; + width: auto; + height: 24px; + margin-top: 0u; + margin-right: 5px; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + color: "SKIN(268458534 13056 74)"; + text-align: right; + direction: ltr; + _s60-text-valign: top; +} + +text.wizardEntryText2 { + display: block; + visibility: visible; + position: static; + width: auto; + height: 24px; + margin-top: 0u; + margin-right: 29px; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + color: "SKIN(268458534 13056 74)"; + text-align: right; + direction: ltr; + _s60-text-valign: top; +} + +image#wizardSecureIcon { + display: block; + visibility: visible; + position: static; + margin-top: 0u; + margin-left: 5px; + width: 24px; + height: 24px; +} + +image#wizardStrengthIcon { + display: block; + visibility: visible; + position: static; + margin-top: 0u; + margin-left: 0u; + width: 24px; + height: 24px; +} \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfo/bwins/wsfwlaninfou.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/bwins/wsfwlaninfou.def Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,34 @@ +EXPORTS + ?ExternalizeL@TWsfWlanInfo@@QBEXAAVRWriteStream@@@Z @ 1 NONAME ; void TWsfWlanInfo::ExternalizeL(class RWriteStream &) const + ?At@CWsfWlanInfoArray@@QBEPAVTWsfWlanInfo@@H@Z @ 2 NONAME ; class TWsfWlanInfo * CWsfWlanInfoArray::At(int) const + ?GetSsidAsUtf8LC@TWsfWlanInfo@@QAEPAVHBufC8@@XZ @ 3 NONAME ; class HBufC8 * TWsfWlanInfo::GetSsidAsUtf8LC(void) + ??ACWsfWlanInfoArray@@QBEPAVTWsfWlanInfo@@I@Z @ 4 NONAME ; class TWsfWlanInfo * CWsfWlanInfoArray::operator[](unsigned int) const + ?Delete@CWsfWlanInfoArray@@QAEXPAVTWsfWlanInfo@@@Z @ 5 NONAME ; void CWsfWlanInfoArray::Delete(class TWsfWlanInfo *) + ?GetSsidAsUnicodeLC@TWsfWlanInfo@@QAEPAVHBufC16@@XZ @ 6 NONAME ; class HBufC16 * TWsfWlanInfo::GetSsidAsUnicodeLC(void) + ?Reset@CWsfWlanInfoArray@@QAEXXZ @ 7 NONAME ; void CWsfWlanInfoArray::Reset(void) + ?SetUIPrioritySort@CWsfWlanInfoArray@@QAEXH@Z @ 8 NONAME ; void CWsfWlanInfoArray::SetUIPrioritySort(int) + ?NewLC@CWsfWlanInfoArray@@SAPAV1@XZ @ 9 NONAME ; class CWsfWlanInfoArray * CWsfWlanInfoArray::NewLC(void) + ?AppendFromStreamBufferL@CWsfWlanInfoArray@@QAEHABVTDesC8@@@Z @ 10 NONAME ; int CWsfWlanInfoArray::AppendFromStreamBufferL(class TDesC8 const &) + ?DeleteFromTail@CWsfWlanInfoArray@@QAEHH@Z @ 11 NONAME ; int CWsfWlanInfoArray::DeleteFromTail(int) + ?Count@CWsfWlanInfoArray@@QAEIXZ @ 12 NONAME ; unsigned int CWsfWlanInfoArray::Count(void) + ?GetSsidAsUnicodeLC@TWsfWlanInfo@@SAPAVHBufC16@@ABV?$TBuf8@$0CA@@@@Z @ 13 NONAME ; class HBufC16 * TWsfWlanInfo::GetSsidAsUnicodeLC(class TBuf8<32> const &) + ?AppendL@CWsfWlanInfoArray@@QAEXPAVTWsfWlanInfo@@@Z @ 14 NONAME ; void CWsfWlanInfoArray::AppendL(class TWsfWlanInfo *) + ??0TWsfWlanInfo@@QAE@AAVTDesC8@@GW4TWlanSecMode@CMManager@@HW4TWlanNetMode@3@KEK@Z @ 15 NONAME ; TWsfWlanInfo::TWsfWlanInfo(class TDesC8 &, unsigned short, enum CMManager::TWlanSecMode, int, enum CMManager::TWlanNetMode, unsigned long, unsigned char, unsigned long) + ?SignalStrength@TWsfWlanInfo@@QAE?AW4TWsfWlanSignalStrengthLevel@@XZ @ 16 NONAME ; enum TWsfWlanSignalStrengthLevel TWsfWlanInfo::SignalStrength(void) + ?MatchWithIapIDL@CWsfWlanInfoArray@@QAEXIHAAV?$RPointerArray@VTWsfWlanInfo@@@@@Z @ 17 NONAME ; void CWsfWlanInfoArray::MatchWithIapIDL(unsigned int, int, class RPointerArray &) + ?FindHiddenEntry@CWsfWlanInfoArray@@QAEPAVTWsfWlanInfo@@H@Z @ 18 NONAME ; class TWsfWlanInfo * CWsfWlanInfoArray::FindHiddenEntry(int) + ?GetIapNameAsUtf8LC@TWsfWlanInfo@@QAEPAVHBufC8@@XZ @ 19 NONAME ; class HBufC8 * TWsfWlanInfo::GetIapNameAsUtf8LC(void) + ?SortArrayL@CWsfWlanInfoArray@@QAEXAAVMWsfWlanInfoArrayFilterVisitor@@@Z @ 20 NONAME ; void CWsfWlanInfoArray::SortArrayL(class MWsfWlanInfoArrayFilterVisitor &) + ?GetArrayIndex@CWsfWlanInfoArray@@QBEHPAVTWsfWlanInfo@@@Z @ 21 NONAME ; int CWsfWlanInfoArray::GetArrayIndex(class TWsfWlanInfo *) const + ?SortArrayL@CWsfWlanInfoArray@@QAEXXZ @ 22 NONAME ; void CWsfWlanInfoArray::SortArrayL(void) + ?NewL@CWsfWlanInfoArray@@SAPAV1@XZ @ 23 NONAME ; class CWsfWlanInfoArray * CWsfWlanInfoArray::NewL(void) + ?GetUIPrioritySort@CWsfWlanInfoArray@@QAEHXZ @ 24 NONAME ; int CWsfWlanInfoArray::GetUIPrioritySort(void) + ?GetIapNameAsUnicodeLC@TWsfWlanInfo@@QAEPAVHBufC16@@XZ @ 25 NONAME ; class HBufC16 * TWsfWlanInfo::GetIapNameAsUnicodeLC(void) + ??0TWsfWlanInfo@@QAE@XZ @ 26 NONAME ; TWsfWlanInfo::TWsfWlanInfo(void) + ?SignalStrengthPercentage@TWsfWlanInfo@@QAEHXZ @ 27 NONAME ; int TWsfWlanInfo::SignalStrengthPercentage(void) + ?SerializeContentLC@CWsfWlanInfoArray@@QAEPAVHBufC8@@XZ @ 28 NONAME ; class HBufC8 * CWsfWlanInfoArray::SerializeContentLC(void) + ?Match@CWsfWlanInfoArray@@QAEPAVTWsfWlanInfo@@KH@Z @ 29 NONAME ; class TWsfWlanInfo * CWsfWlanInfoArray::Match(unsigned long, int) + ?InternalizeL@TWsfWlanInfo@@QAEXAAVRReadStream@@@Z @ 30 NONAME ; void TWsfWlanInfo::InternalizeL(class RReadStream &) + ?MatchL@CWsfWlanInfoArray@@QAEXABVTDesC8@@W4TWlanSecMode@CMManager@@W4TWlanNetMode@4@HHAAV?$RPointerArray@VTWsfWlanInfo@@@@@Z @ 31 NONAME ; void CWsfWlanInfoArray::MatchL(class TDesC8 const &, enum CMManager::TWlanSecMode, enum CMManager::TWlanNetMode, int, int, class RPointerArray &) + ?Match@CWsfWlanInfoArray@@QAEPAVTWsfWlanInfo@@ABVTDesC8@@H@Z @ 32 NONAME ; class TWsfWlanInfo * CWsfWlanInfoArray::Match(class TDesC8 const &, int) + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfo/eabi/wsfwlaninfou.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/eabi/wsfwlaninfou.def Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,36 @@ +EXPORTS + _ZN12TWsfWlanInfo12InternalizeLER11RReadStream @ 1 NONAME + _ZN12TWsfWlanInfo14SignalStrengthEv @ 2 NONAME + _ZN12TWsfWlanInfo15GetSsidAsUtf8LCEv @ 3 NONAME + _ZN12TWsfWlanInfo18GetIapNameAsUtf8LCEv @ 4 NONAME + _ZN12TWsfWlanInfo18GetSsidAsUnicodeLCERK5TBuf8ILi32EE @ 5 NONAME + _ZN12TWsfWlanInfo18GetSsidAsUnicodeLCEv @ 6 NONAME + _ZN12TWsfWlanInfo21GetIapNameAsUnicodeLCEv @ 7 NONAME + _ZN12TWsfWlanInfo24SignalStrengthPercentageEv @ 8 NONAME + _ZN12TWsfWlanInfoC1ER6TDesC8tN9CMManager12TWlanSecModeEiNS2_12TWlanNetModeEmhm @ 9 NONAME + _ZN12TWsfWlanInfoC1Ev @ 10 NONAME + _ZN12TWsfWlanInfoC2ER6TDesC8tN9CMManager12TWlanSecModeEiNS2_12TWlanNetModeEmhm @ 11 NONAME + _ZN12TWsfWlanInfoC2Ev @ 12 NONAME + _ZN17CWsfWlanInfoArray10SortArrayLER30MWsfWlanInfoArrayFilterVisitor @ 13 NONAME + _ZN17CWsfWlanInfoArray10SortArrayLEv @ 14 NONAME + _ZN17CWsfWlanInfoArray14DeleteFromTailEi @ 15 NONAME + _ZN17CWsfWlanInfoArray15FindHiddenEntryEi @ 16 NONAME + _ZN17CWsfWlanInfoArray15MatchWithIapIDLEjiR13RPointerArrayI12TWsfWlanInfoE @ 17 NONAME + _ZN17CWsfWlanInfoArray17GetUIPrioritySortEv @ 18 NONAME + _ZN17CWsfWlanInfoArray17SetUIPrioritySortEi @ 19 NONAME + _ZN17CWsfWlanInfoArray18SerializeContentLCEv @ 20 NONAME + _ZN17CWsfWlanInfoArray23AppendFromStreamBufferLERK6TDesC8 @ 21 NONAME + _ZN17CWsfWlanInfoArray4NewLEv @ 22 NONAME + _ZN17CWsfWlanInfoArray5CountEv @ 23 NONAME + _ZN17CWsfWlanInfoArray5MatchERK6TDesC8i @ 24 NONAME + _ZN17CWsfWlanInfoArray5MatchEmi @ 25 NONAME + _ZN17CWsfWlanInfoArray5NewLCEv @ 26 NONAME + _ZN17CWsfWlanInfoArray5ResetEv @ 27 NONAME + _ZN17CWsfWlanInfoArray6DeleteEP12TWsfWlanInfo @ 28 NONAME + _ZN17CWsfWlanInfoArray6MatchLERK6TDesC8N9CMManager12TWlanSecModeENS3_12TWlanNetModeEiiR13RPointerArrayI12TWsfWlanInfoE @ 29 NONAME + _ZN17CWsfWlanInfoArray7AppendLEP12TWsfWlanInfo @ 30 NONAME + _ZNK12TWsfWlanInfo12ExternalizeLER12RWriteStream @ 31 NONAME + _ZNK17CWsfWlanInfoArray13GetArrayIndexEP12TWsfWlanInfo @ 32 NONAME + _ZNK17CWsfWlanInfoArray2AtEi @ 33 NONAME + _ZNK17CWsfWlanInfoArrayixEj @ 34 NONAME + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfo/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2007-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: Build information file for project WlanInfo +* +*/ + + + +#include + +PRJ_PLATFORMS +DEFAULT + + +PRJ_EXPORTS +// private API +../inc/wsfwlaninfo.h |../../../inc/wsfwlaninfo.h +../inc/wsfwlaninfo.inl |../../../inc/wsfwlaninfo.inl +../inc/wsfwlaninfoarray.h |../../../inc/wsfwlaninfoarray.h +../inc/wsfwlaninfoarrayfiltervisitor.h |../../../inc/wsfwlaninfoarrayfiltervisitor.h + +// IBY +../rom/wsfwlaninfo.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wsfwlaninfo.iby) + + +PRJ_MMPFILES +wlaninfo.mmp + +// End of file + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfo/group/wlaninfo.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/group/wlaninfo.mmp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2007-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: Project definition file for project WlanInfo +* +*/ + + +#include +#include + + +TARGET wsfwlaninfo.dll +TARGETTYPE dll +UID 0x1000008d 0x10281CAC + +CAPABILITY ALL -TCB + + +SOURCEPATH ../src +SOURCE wsfwlaninfoarray.cpp +SOURCE wsfwlaninfoarraysortkey.cpp +SOURCE wsfwlaninfo.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc + +//Macro to /epoc32 headers +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY estor.lib +LIBRARY charconv.lib + + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfo.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,360 @@ +/* +* Copyright (c) 2007-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: Class header for TWsfWlanInfo +* +*/ + + + +#ifndef T_WSFWLANINFO_H +#define T_WSFWLANINFO_H + +// EXTERNAL INCLUDES +#include +#include +#include + + +// ENUMS + +/** + * Signal strength categories for UI + */ +enum TWsfWlanSignalStrengthLevel + { + ENoSignal, + EPoor, + EAverage, + EExcelent + }; + + +/** + * Connection status + */ +enum TWsfWlanConnectionState + { + ENotConnected, + EConnecting, + EConnected + }; + + +/** + * Signal strength category boundaries in dB (absolute value). + * Smaller value means better signal. + */ +enum TWsfWlanSignalStrength + { + EWlanSignalStrengthMax = 60, + EWlanSignalStrengthGood = 74, + EWlanSignalStrengthLow = 87, + EWlanSignalStrengthMin = 100, + EWlanSignalUnavailable = 9999 + }; + + +/** + * Flags for different types of networks + */ +enum TWsfBrandDataDefs + { + EBrandedItem = 0xFF, + EBlackListItem = 0x01, + EUserSortListItem = 0x02, + EFonSsid = 0x04, + EUsesPresharedKey = 0x08 + }; + + +/** + * Maximal length of IAP name that the class should be able to store + */ +const TInt KWlanMaxAccessPointNameLength = 50; + + +// FORWARD DECLARATIONS +class RReadStream; +class RWriteStream; + + +// CLASS DEFINITION +/** + * Class to encapsulate network parameters + * + * TWsfWlanInfo serves for transferring the WLAN network related data + * between the different submodules of Wlan Sniffer. + * + * @lib wsfwlaninfo.lib + * @since S60 5.0 + */ +NONSHARABLE_CLASS( TWsfWlanInfo ) + { + public: // Constructors + + IMPORT_C TWsfWlanInfo(); + + /** + * Constructor. + * + * @since S60 5.0 + * @param aSsid SSID of the WLAN network + * @param aStrengthLevel Signal strength in dB (absolute value) + * @param aSecurityMode Network security mode + * @param aVisibility ETrue for public networks, EFalse for hidden ones + * @param aNetMode Network mode (infrastructure or adhoc) + * @param aIapId IAP id if known, zero otherwise. + * @param aCoverage Number of APs with the same SSID + * @param aTransferRate Maximal transfer rate reported by the AP + */ + IMPORT_C TWsfWlanInfo( TDesC8& aSsid, + TUint16 aStrengthLevel, + CMManager::TWlanSecMode aSecurityMode, + TInt aVisibility, + CMManager::TWlanNetMode aNetMode, + TUint32 aIapId, + TUint8 aCoverage, + TUint32 aTransferRate ); + + public: // New methods + + /** + * Gets WLAN name (Ssid) as unicode format + * @since S60 5.0 + * @return Ssid as unicode format + */ + IMPORT_C HBufC* GetSsidAsUnicodeLC(); + + /** + * Gets WLAN name (Ssid) as unicode format + * @since S60 5.0 + * @return Ssid as unicode format + */ + IMPORT_C static HBufC* GetSsidAsUnicodeLC( const TWlanSsid& aSsid ); + + /** + * Gets WLAN name (Ssid) as 8-bit format + * @since S60 5.0 + * @return Ssid as 8-bit format + */ + IMPORT_C HBufC8* GetSsidAsUtf8LC(); + + /** + * Serializes data from the stream + * @since S60 5.0 + * @param aStream Stream from where data is serialized + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + /** + * Serializes data to the stream + * @since S60 5.0 + * @param aStream Stream where data will be serialized + */ + IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; + + /** + * Get signal strength as enumeration + * @since S60 5.0 + * @return Signal stregth as enumeration + */ + IMPORT_C TWsfWlanSignalStrengthLevel SignalStrength(); + + /** + * Get signal strength as percentage + * @since S60 5.0 + * @return Signal stregth as percentage + */ + IMPORT_C TInt SignalStrengthPercentage(); + + /** + * Gets WLAN IAP name as unicode format + * @since S60 5.0 + * @return Ssid as unicode format + */ + IMPORT_C HBufC* GetIapNameAsUnicodeLC(); + + /** + * Gets WLAN IAP name as 8-bit format + * @since S60 5.0 + * @return Ssid as 8-bit format + */ + IMPORT_C HBufC8* GetIapNameAsUtf8LC(); + + /** + * Get WLAN connection state + * @since S60 5.0 + * @return ETrue if connected + */ + inline TBool Connected() const; + + /** + * Get WLAN connection state + * @since S60 5.2 + * @return TWsfWlanConnectionState + */ + inline TWsfWlanConnectionState ConnectionStatus() const; + + /** + * Get WLAN Known state + * @since S60 5.0 + * @return ETrue if access point has been defined + */ + inline TBool Known() const; + + /** + * Get WLAN visibility state + * @since S60 5.0 + * @return ETrue if WLAN is hidden + */ + inline TBool Hidden() const; + + /** + * Get WLAN security state + * @since S60 5.0 + * @return ETrue if WLAN is secured. + */ + inline TBool Secure() const; + + /** + * Set the brand id for entry + * @since S60 5.0 + * @param aBrandId The brand id. + */ + inline void SetBrand( const TInt8 aBrandId ); + + /** + * Get brand id + * @since S60 5.0 + * @return 8-bit value representing brand id + */ + inline TInt8 BrandId() const; + + /** + * Set blacklist entry flag + * @since S60 5.0 + * @param aBlackListEntry ETrue if the network is blacklisted. + */ + inline void SetBlackListEntry( const TBool aBlackListEntry ); + + /** + * Get blacklist flag + * @since S60 5.0 + * @return ETrue if the entry is marked as black list entry + */ + inline TBool BlackListEntry() const; + + /** + * Get Fon entry flag + * @since S60 5.0 + * @return ETrue if the network is recognised as FON. + */ + inline TBool FonSsid() const; + + /** + * Set Fon flag + * @since S60 5.0 + * @param aFonSsid ETrue if the entry is a Fon list entry + */ + inline void SetFonSsid( const TBool aFonSsid ); + + /** + * Query preshared key flag in WPA and 802.1x security modes. + * Note that the result is undefined in case of other security modes. + * @since S60 5.0 + * @return ETrue, if preshared key is used. + */ + inline TBool UsesPreSharedKey() const; + + /** + * Set preshared key flag for WPA and 802.1x security modes. + * @since S60 5.0 + * @param aUsePresharedKey ETrue if the network uses preshared key + */ + inline void SetUsesPreSharedKey( const TBool aUsePresharedKey ); + + /** + * Set the priority for entry + * @since S60 5.1 + * @param aPriority The priority id. + */ + inline void SetPriority( const TUint8 aPriority ); + + /** + * Get priority + * @since S60 5.1 + * @return 8-bit value representing priority + */ + inline TUint8 Priority() const; + + /** + * Get WLAN security mode + * @since S60 5.2 + * @return WLAN security mode + */ + inline CMManager::TWlanSecMode SecurityMode() const; + + + public: // Data + + // Network name (unknown: SSID, known: IAP name) + TWlanSsid iSsid; + + // Network strength + TUint16 iStrengthLevel; + + //Network encryption + CMManager::TWlanSecMode iSecurityMode; + + //Network visibility + TBool iVisibility; + + //Network capability + CMManager::TWlanNetMode iNetMode; + + //Internet Access Point Id. 0 if the IAP has not been defined. + TUint32 iIapId; + + // Available WLAN hotspots in this WLAN network + TUint8 iCoverage; + + // Transferrate + TUint32 iTransferRate; + + // Connection state + TWsfWlanConnectionState iConnectionState; + + // filter flags + TUint8 iFilterFlags; + + //brand id + TUint8 iBrandId; + + // The name of the WLAN IAP + TBuf8 iNetworkName; + + //UI priority for known networks + TUint8 iPriority; + + //Raw SSID - not converted + TWlanSsid iRawSsid; + }; + + +#include "wsfwlaninfo.inl" + + +#endif // T_WSFWLANINFO_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfo.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfo.inl Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,184 @@ +/* +* Copyright (c) 2007-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 for TWsfWlanInfo +* +*/ + + + +// INLINE FUNCTIONS + +// ----------------------------------------------------------------------------- +// TWsfWlanInfo::Connected +// ----------------------------------------------------------------------------- +// +inline TBool TWsfWlanInfo::Connected() const + { + return ( iConnectionState == EConnected ); + } + + +// ----------------------------------------------------------------------------- +// TWsfWlanInfo::ConnectionStatus +// ----------------------------------------------------------------------------- +// +inline TWsfWlanConnectionState TWsfWlanInfo::ConnectionStatus() const + { + return iConnectionState; + } + + +// ----------------------------------------------------------------------------- +// TWsfWlanInfo::Known +// ----------------------------------------------------------------------------- +// +inline TBool TWsfWlanInfo::Known() const + { + return ( iIapId ); + } + + +// ----------------------------------------------------------------------------- +// TWsfWlanInfo::Hidden +// ----------------------------------------------------------------------------- +// +inline TBool TWsfWlanInfo::Hidden() const + { + return !iVisibility; + } + + +// ----------------------------------------------------------------------------- +// TWsfWlanInfo::Secure +// ----------------------------------------------------------------------------- +// +inline TBool TWsfWlanInfo::Secure() const + { + return ( iSecurityMode != CMManager::EWlanSecModeOpen ); + } + + +// ----------------------------------------------------------------------------- +// TWsfWlanInfo::SetBrand +// ----------------------------------------------------------------------------- +// +inline void TWsfWlanInfo::SetBrand( const TInt8 aBrandId ) + { + iBrandId = aBrandId; + } + + +// ----------------------------------------------------------------------------- +// TWsfWlanInfo::BrandId +// ----------------------------------------------------------------------------- +// +inline TInt8 TWsfWlanInfo::BrandId() const + { + return iBrandId; + } + + +// ----------------------------------------------------------------------------- +// TWsfWlanInfo::SetBlackListEntry +// ----------------------------------------------------------------------------- +// +inline void TWsfWlanInfo::SetBlackListEntry( const TBool aBlackListEntry ) + { + iFilterFlags = aBlackListEntry ? + ( EBlackListItem | iFilterFlags ): + ( ~EBlackListItem & iFilterFlags ); + } + + +// ----------------------------------------------------------------------------- +// TWsfWlanInfo::BlackListEntry +// ----------------------------------------------------------------------------- +// +inline TBool TWsfWlanInfo::BlackListEntry() const + { + return ( iFilterFlags & EBlackListItem ); + } + + +// ----------------------------------------------------------------------------- +// TWsfWlanInfo::FonSsid +// ----------------------------------------------------------------------------- +// +inline TBool TWsfWlanInfo::FonSsid() const + { + return ( iFilterFlags & EFonSsid ); + } + + +// ----------------------------------------------------------------------------- +// TWsfWlanInfo::SetFonSsid +// ----------------------------------------------------------------------------- +// +inline void TWsfWlanInfo::SetFonSsid( const TBool aFonSsid ) + { + iFilterFlags = aFonSsid ? + ( EFonSsid | iFilterFlags ): + ( ~EFonSsid & iFilterFlags ); + } + + +// ----------------------------------------------------------------------------- +// TWsfWlanInfo::UsesPreSharedKey +// ----------------------------------------------------------------------------- +// +inline TBool TWsfWlanInfo::UsesPreSharedKey() const + { + return ( iFilterFlags & EUsesPresharedKey ); + } + + +// ----------------------------------------------------------------------------- +// TWsfWlanInfo::SetUsesPreSharedKey +// ----------------------------------------------------------------------------- +// +inline void TWsfWlanInfo::SetUsesPreSharedKey( const TBool aUsePresharedKey ) + { + iFilterFlags = aUsePresharedKey? + ( EUsesPresharedKey | iFilterFlags ): + ( ~EUsesPresharedKey & iFilterFlags ); + } + + +// ----------------------------------------------------------------------------- +// TWsfWlanInfo::SetPriority +// ----------------------------------------------------------------------------- +// +inline void TWsfWlanInfo::SetPriority( const TUint8 aPriority ) + { + iPriority = aPriority; + } + + +// ----------------------------------------------------------------------------- +// TWsfWlanInfo::Priority +// ----------------------------------------------------------------------------- +// +inline TUint8 TWsfWlanInfo::Priority() const + { + return iPriority; + } + +// ----------------------------------------------------------------------------- +// TWsfWlanInfo::SecurityMode +// ----------------------------------------------------------------------------- +// +inline CMManager::TWlanSecMode TWsfWlanInfo::SecurityMode() const + { + return iSecurityMode; + } diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfoarray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfoarray.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,251 @@ +/* +* Copyright (c) 2007-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: Class header for CWsfWlanInfoArray +* +*/ + + +#ifndef C_WSFWLANINFOARRAY_H +#define C_WSFWLANINFOARRAY_H + + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "wsfwlaninfo.h" + + +// FORWARD DECLARATIONS +class MWsfWlanInfoArrayFilterVisitor; + + +// CLASS DEFINITION +/** + * Pointerarray container for TWsfWlanInfo items. + * @lib wsfwlaninfo.lib + * @since S60 5.0 + */ +NONSHARABLE_CLASS( CWsfWlanInfoArray ): public CBase + { + public: // Constructors and destructor + + /** + * Factory function. + * @since S60 5.0 + * @return Class instance. + */ + IMPORT_C static CWsfWlanInfoArray* NewL(); + + /** + * Factory function. + * @since S60 5.0 + * @return Class instance. + */ + IMPORT_C static CWsfWlanInfoArray* NewLC(); + + ~CWsfWlanInfoArray(); + + private: // Constructors + CWsfWlanInfoArray(); + void ConstructL(); + + public: // New methods + + /** + * Returns the index of the given wlaninfo + * @since S60 5.0 + * @param aWlanInfo The element being searched for. Ownership not passed. + * @return Index of info in the array, or -1 if not found + */ + IMPORT_C TInt GetArrayIndex( TWsfWlanInfo* aWlanInfo ) const; + + /** + * Add a wlaninfo to the array + * @since S60 5.0 + * @param aWlanInfo The info element to be added to the array. + * Ownership passed. + */ + IMPORT_C void AppendL( TWsfWlanInfo* aWlanInfo ); + + /** + * Delete the given element from the array + * @since S60 5.0 + * @param aWlanInfo The wlaninfo to be removed from the array. + * Ownership not passed. + */ + IMPORT_C void Delete( TWsfWlanInfo* aWlanInfo ); + + /** + * Wipes all the elements from the array + * @since S60 5.0 + */ + IMPORT_C void Reset(); + + /** + * Returns the wlaninfo of the given index value in the array + * @since S60 5.0 + * @param aIndex Index of the element in the array + * @return Pointer to the wlan info object. Ownership not passed. + */ + IMPORT_C TWsfWlanInfo* operator[]( TUint aIndex ) const; + + /** + * Returns the wlaninfo of the given index value in the array with + * boundary check. + * @since S60 5.0 + * @param aIndex Index of the element in the array + * @return Pointer to the wlan info object if the given index is valid + * (ownership not passed), NULL otherwise + */ + IMPORT_C TWsfWlanInfo* At( TInt aIndex ) const; + + /** + * Return the number of info items stored in the array + * @since S60 5.0 + * @return Number of items in the array. + */ + IMPORT_C TUint Count(); + + /** + * Returns the info array element matching the SSID prior the given index + * @since S60 5.0 + * @param aSsid The SSID to match + * @param aPriorThis The index after which results are not reported + * @return Pointer to the wlan info object (ownership not passed), or + * NULL if ssid is not found + */ + IMPORT_C TWsfWlanInfo* Match( const TDesC8& aSsid, + const TInt aPriorThis ); + + /** + * Returns the info array element matching the IapID prior the given index + * @since S60 5.2 + * @param aIapID The IapID to match + * @param aPriorThis The index after which results are not reported + * @return Pointer to the wlan info object (ownership not passed), or + * NULL if IapID is not found + */ + IMPORT_C TWsfWlanInfo* Match( const TUint32 aIapID, + const TInt aPriorThis ); + + /** + * Returns the info array element matching the iap id prior the given index + * @since S60 5.0 + * @param aIapId The Iap Id to match + * @param aPriorThis The index after which results are not reported + * @return Pointer to the wlan info object (ownership not passed), or + * NULL if ssid is not found + */ + IMPORT_C void MatchWithIapIDL( const TUint aIapID, + const TInt aPriorThis, + RPointerArray& aMatchArray ); + + + /** + * Returns the info array element matching the SSID, security mode and net mode + * prior the given index + * @since S60 5.0 + * @param aSsid The SSID to match + * @param aSecMode The security mode to match + * @param aNetMode The network mode to match + * @param aUsesPreSharedKey pre shared key usage to match + * @param aPriorThis The index after which results are not reported + * @return Pointer to the wlan info object (ownership not passed), or + * NULL if ssid is not found + */ + IMPORT_C void MatchL( const TDesC8& aSsid, + CMManager::TWlanSecMode aSecMode, + CMManager::TWlanNetMode aNetMode, + TBool aUsesPreSharedKey, + const TInt aPriorThis, + RPointerArray& aMatchArray ); + + /** + * Serialize the array content to a buffer and pushes it on the + * cleanup stack + * @since S60 5.0 + * @return The buffer created + */ + IMPORT_C HBufC8* SerializeContentLC(); + + /** + * Read wlan info objects from buffer and append them to the array + * @since S60 5.0 + * @param aStreamBuffer The buffer to read from. + * @return The new array size + */ + IMPORT_C TInt AppendFromStreamBufferL( const TDesC8& aStreamBuffer ); + + /** + * Returns the hidden info array prior the given index + * @since S60 5.0 + * @param aPriorThis The index after which results are not reported + * @return Pointer to the wlan info object (ownership not passed), + * or NULL if not found + */ + IMPORT_C TWsfWlanInfo* FindHiddenEntry( const TInt aPriorThis ); + + /** + * Delete a given number of items starting from the last item in array + * @since S60 5.0 + * @param aCount The number of items to be deleted + * @return The count of remaining items in array + */ + IMPORT_C TInt DeleteFromTail( const TInt aCount ); + + /** + * Sort the array contents in order of + * configured access points in alphabetical order ( Ssid ) + * unknow networks in aplhabetical order ( Ssid ) + * and the hidden network container + * @since S60 5.0 + */ + IMPORT_C void SortArrayL(); + + /** + * Set UI priority Sort for array + * @since S60 5.1 + * @param aUIPrioritySort TBool value. + */ + IMPORT_C void SetUIPrioritySort( const TBool aUIPrioritySort ); + + /** + * Get UI Priority Sort value + * @since S60 5.1 + * @return TBool value representing iUIPrioritySort + */ + IMPORT_C TBool GetUIPrioritySort(); + + /* + * Sort the array using a visitor SortKey + * @since S60 5.0 + * @param aSortKey The sort key to be used. + */ + IMPORT_C void SortArrayL( MWsfWlanInfoArrayFilterVisitor& aSortKey ); + + + private: // Data + + CArrayPtrFlat* iInfoArray; ///< Owned. + + /** + * If EFalse, UI priority short not in use + */ + TBool iUIPrioritySort; + + }; + +#endif // C_WSFWLANINFOARRAY_H + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfoarrayfiltervisitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfoarrayfiltervisitor.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2007-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: Class header for MWsfWlanInfoArrayFilterVisitor +* +*/ + + + +#ifndef M_WSFWLANINFOARRAYFILTERVISITOR_H +#define M_WSFWLANINFOARRAYFILTERVISITOR_H + +// EXTERNAL INCLUDES +#include +#include + + +// FORWARD DECLARATIONS +class CWsfWlanInfoArray; + + +// CLASS DEFINITION +/** + * Abstract interface for CWsfWlanInfoArray to allow visitor-like overloading + * for array sorting + * @lib wsfwlaninfo.lib + * @since S60 5.0 + */ +class MWsfWlanInfoArrayFilterVisitor + { + public: // Destructor + /** + * Destructor + */ + virtual ~MWsfWlanInfoArrayFilterVisitor() {} + + public: + /** + * Execute presort before starting the actual sorting + * @since S60 5.0 + * @param aArray The array to work on + */ + virtual void FilterPreSortL( CWsfWlanInfoArray* aArray ) = 0; + + /** + * Run postsort after he actual sorting is executed + * @since S60 5.0 + * @param aArray The array to work on + */ + virtual void FilterPostSortL( CWsfWlanInfoArray* aArray ) = 0; + + /** + * Return the handle for sorting key + * @since S60 5.0 + * @return The handle for the sorting key + */ + virtual TKeyArrayFix& SortingKey() = 0; + + }; + +#endif // M_WSFWLANINFOARRAYFILTERVISITOR_H + +// End of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfoarraysortkey.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfoarraysortkey.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2007-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: Class header for CWsfWlanInfoArraySortKey +* +*/ + + + +#ifndef C_WSFWLANINFOARRAYSORTKEY_H +#define C_WSFWLANINFOARRAYSORTKEY_H + +// EXTERNAL INCLUDES +#include + + +// FORWARD DECLARATIONS +class CWsfWlanInfoArray; + + +// CLASS DEFINITION +/** + * Sort key for wlan info array + * @lib wsfwlaninfo.lib + * @since S60 5.0 + */ +NONSHARABLE_CLASS( CWsfWlanInfoArraySortKey ): public TKeyArrayFix + { + public: // Constructors + /** + * Factory function. + * @since S60 5.0 + * @param aArray The array to work with. + */ + static CWsfWlanInfoArraySortKey* NewLC( CWsfWlanInfoArray& aArray ); + + /** + * Destructor. + * @since S60 5.0 + */ + ~CWsfWlanInfoArraySortKey(); + + private: // Constructors + /** + * Constructor. + * @since S60 5.0 + * @param aArray The array to work with. + */ + CWsfWlanInfoArraySortKey( CWsfWlanInfoArray& aArray ); + + public: // from TKey + + /** + * Compare function + * @since S60 5.0 + * @param aLeft Left element to be compared + * @param aRight Right element to be compared + * @return -1 if aLeft + + +file=ABI_DIR\BUILD_DIR\wsfwlaninfo.dll SHARED_LIB_DIR\wsfwlaninfo.dll + +#endif // __PROTOCOL_WLAN + +#endif // WSFWLANINFO_IBY diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfo/src/wsfwlaninfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/src/wsfwlaninfo.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,250 @@ +/* +* Copyright (c) 2007-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 TWsfWlanInfo +* +*/ + + + +// EXTERNAL INCLUDES +#include +#include + +// CLASS HEADER +#include "wsfwlaninfo.h" + + +using namespace CMManager; + + +// Percentage max value +static const TInt KMaxPercentage = 100; + + + +// --------------------------------------------------------------------------- +// TWsfWlanInfo::TWsfWlanInfo +// --------------------------------------------------------------------------- +// +EXPORT_C TWsfWlanInfo::TWsfWlanInfo(): + iSsid( KNullDesC8 ), + iStrengthLevel( EWlanSignalUnavailable ), + iSecurityMode( EWlanSecModeOpen ), + iVisibility( EFalse ), + iNetMode( EAdhoc ), + iIapId( 0 ), + iCoverage( 0 ), + iTransferRate( 0 ), + iConnectionState( ENotConnected ), + iFilterFlags( 0 ), + iBrandId( 0 ), + iNetworkName( KNullDesC8 ), + iPriority ( 0 ), + iRawSsid ( KNullDesC8 ) + { + } + + +// --------------------------------------------------------------------------- +// TWsfWlanInfo::TWsfWlanInfo +// --------------------------------------------------------------------------- +// +EXPORT_C TWsfWlanInfo::TWsfWlanInfo( TDesC8& aSsid, + TUint16 aStrengthLevel, + TWlanSecMode aSecurityMode, + TInt aVisibility, + TWlanNetMode aNetMode, + TUint32 aIapId, + TUint8 aCoverage, + TUint32 aTransferRate ): + iSsid( aSsid ), + iStrengthLevel( aStrengthLevel ), + iSecurityMode( aSecurityMode ), + iVisibility( aVisibility ), + iNetMode( aNetMode ), + iIapId( aIapId ), + iCoverage( aCoverage ), + iTransferRate( aTransferRate ), + iConnectionState( ENotConnected ), + iFilterFlags( 0 ), + iBrandId( 0 ), + iPriority( 0 ), + iRawSsid ( KNullDesC8 ) + { + } + +// --------------------------------------------------------------------------- +// TWsfWlanInfo::GetSsidAsUnicodeLC +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC* TWsfWlanInfo::GetSsidAsUnicodeLC() + { + return GetSsidAsUnicodeLC( iSsid ); + } + + +// --------------------------------------------------------------------------- +// TWsfWlanInfo::GetSsidAsUnicodeLC +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC* TWsfWlanInfo::GetSsidAsUnicodeLC( const TWlanSsid& aSsid ) + { + HBufC* ssid = HBufC::NewLC( aSsid.Length() ); + TPtr ptr = ssid->Des(); + TInt err = CnvUtfConverter::ConvertToUnicodeFromUtf8( ptr, aSsid ); + if ( err != KErrNone ) + { + // If ssid wasn't utf-8 encoded, assume it unicode already + // it's not specified how WLAN SSIDs should be encoded. + ptr.Copy( aSsid ); + } + return ssid; + } + + +// --------------------------------------------------------------------------- +// TWsfWlanInfo::GetSsidAsUtf8LC +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC8* TWsfWlanInfo::GetSsidAsUtf8LC() + { + HBufC8* ssid = iSsid.AllocLC(); + return ssid; + } + + +// --------------------------------------------------------------------------- +// TWsfWlanInfo::InternalizeL +// --------------------------------------------------------------------------- +// +EXPORT_C void TWsfWlanInfo::InternalizeL( RReadStream& aStream ) + { + aStream >> iSsid; + iStrengthLevel = aStream.ReadInt16L(); + iSecurityMode = TWlanSecMode( aStream.ReadInt32L() ); + iVisibility = aStream.ReadInt8L(); + iNetMode = TWlanNetMode( aStream.ReadInt32L() ); + iIapId = aStream.ReadInt32L(); + iCoverage = aStream.ReadInt8L(); + iTransferRate = aStream.ReadInt32L(); + iConnectionState = TWsfWlanConnectionState( aStream.ReadInt8L() ); + iFilterFlags = aStream.ReadInt8L(); + iBrandId = aStream.ReadInt8L(); + iPriority = aStream.ReadInt8L(); + aStream >> iNetworkName; + aStream >> iRawSsid; + } + + +// --------------------------------------------------------------------------- +// TWsfWlanInfo::ExternalizeL +// --------------------------------------------------------------------------- +// +EXPORT_C void TWsfWlanInfo::ExternalizeL(RWriteStream& aStream) const + { + aStream << iSsid; + aStream.WriteInt16L( iStrengthLevel ); + aStream.WriteInt32L( iSecurityMode ); + aStream.WriteInt8L( iVisibility ); + aStream.WriteInt32L( iNetMode ); + aStream.WriteInt32L( iIapId ); + aStream.WriteInt8L( iCoverage ); + aStream.WriteInt32L( iTransferRate ); + aStream.WriteInt8L( iConnectionState ); + aStream.WriteInt8L( iFilterFlags ); + aStream.WriteInt8L( iBrandId ); + aStream.WriteInt8L( iPriority ); + aStream << iNetworkName; + aStream << iRawSsid; + } + + +// --------------------------------------------------------------------------- +// TWsfWlanInfo::SignalStrength +// --------------------------------------------------------------------------- +// +EXPORT_C TWsfWlanSignalStrengthLevel TWsfWlanInfo::SignalStrength() + { + // check the absolute signal level and return symbolic representation + // smaller value means stronger signal + TWsfWlanSignalStrengthLevel level( EAverage ); + + if ( iStrengthLevel < EWlanSignalStrengthGood ) + { + level = EExcelent; + } + else if ( iStrengthLevel > EWlanSignalStrengthLow ) + { + if ( iStrengthLevel == EWlanSignalUnavailable ) + { + level = ENoSignal; + } + else + { + level = EPoor; + } + } + + return level; + } + + +// --------------------------------------------------------------------------- +// TWsfWlanInfo::SignalStrengthPercentage +// --------------------------------------------------------------------------- +// +EXPORT_C TInt TWsfWlanInfo::SignalStrengthPercentage() + { + // smaller value means stronger signal + TInt signalStrength( 0 ); + + if ( iStrengthLevel <= EWlanSignalStrengthMax ) + { + signalStrength = KMaxPercentage; + } + else if ( iStrengthLevel < EWlanSignalStrengthMin ) + { + TInt diff = EWlanSignalStrengthMin - iStrengthLevel; + signalStrength = diff * KMaxPercentage / + ( EWlanSignalStrengthMin - EWlanSignalStrengthMax ); + } + + return signalStrength; + } + + +// --------------------------------------------------------------------------- +// TWsfWlanInfo::GetSsidAsUnicodeLC +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC* TWsfWlanInfo::GetIapNameAsUnicodeLC() + { + // This is essentially the same as ssid conversion + return GetSsidAsUnicodeLC( iNetworkName ); + } + + +// --------------------------------------------------------------------------- +// TWsfWlanInfo::GetSsidAsUtf8LC +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC8* TWsfWlanInfo::GetIapNameAsUtf8LC() + { + HBufC8* networkName = iNetworkName.AllocLC(); + return networkName; + } + + +// End of file + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfo/src/wsfwlaninfoarray.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/src/wsfwlaninfoarray.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,517 @@ +/* +* Copyright (c) 2007-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 CWsfWlanInfoArray +* +*/ + + + +// EXTERNAL INCLUDES +#include + + +// CLASS HEADER +#include "wsfwlaninfoarray.h" + + +// INTERNAL INCLUDES +#include "wsfwlaninfoarraysortkey.h" +#include "wsfwlaninfoarrayfiltervisitor.h" + + +using namespace CMManager; + +// LOCAL DEFINITIONS +static const TUint KInfoArrayGranuality = 10; + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::NewL +// --------------------------------------------------------------------------- +// +EXPORT_C CWsfWlanInfoArray* CWsfWlanInfoArray::NewL() + { + CWsfWlanInfoArray* thisPtr = NewLC(); + CleanupStack::Pop( thisPtr ); + return thisPtr; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::NewLC +// --------------------------------------------------------------------------- +// +EXPORT_C CWsfWlanInfoArray* CWsfWlanInfoArray::NewLC() + { + CWsfWlanInfoArray* thisPtr = new ( ELeave ) CWsfWlanInfoArray(); + CleanupStack::PushL( thisPtr ); + thisPtr->ConstructL(); + return thisPtr; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::~CWsfWlanInfoArray +// --------------------------------------------------------------------------- +// +CWsfWlanInfoArray::~CWsfWlanInfoArray() + { + if ( iInfoArray ) + { + iInfoArray->ResetAndDestroy(); + delete iInfoArray; + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::CWsfWlanInfoArray +// --------------------------------------------------------------------------- +// +CWsfWlanInfoArray::CWsfWlanInfoArray() : + iUIPrioritySort( EFalse ) + { + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::ConstructL +// --------------------------------------------------------------------------- +// +void CWsfWlanInfoArray::ConstructL() + { + iInfoArray = new (ELeave) CArrayPtrFlat( + KInfoArrayGranuality ); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::Reset +// --------------------------------------------------------------------------- +// +EXPORT_C void CWsfWlanInfoArray::Reset() + { + iInfoArray->ResetAndDestroy(); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::Count +// --------------------------------------------------------------------------- +// +EXPORT_C TUint CWsfWlanInfoArray::Count() + { + return iInfoArray->Count(); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::AppendL +// --------------------------------------------------------------------------- +// +EXPORT_C void CWsfWlanInfoArray::AppendL( TWsfWlanInfo* aWlanInfo ) + { + iInfoArray->AppendL( aWlanInfo ); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::At +// --------------------------------------------------------------------------- +// +EXPORT_C TWsfWlanInfo* CWsfWlanInfoArray::At( TInt aIndex ) const + { + TWsfWlanInfo* temp( NULL ); + TInt count = iInfoArray->Count(); + + if ( count && ( aIndex < count ) ) + { + temp = ( *iInfoArray )[aIndex]; + } + return temp; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::Delete +// --------------------------------------------------------------------------- +// +EXPORT_C void CWsfWlanInfoArray::Delete( TWsfWlanInfo* aWlanInfo ) + { + TInt count = iInfoArray->Count(); + + for( TInt i = 0; i < count; ++i ) + { + if ( ( *iInfoArray )[i] == aWlanInfo ) + { + delete ( *iInfoArray )[i]; + iInfoArray->Delete( i ); + iInfoArray->Compress(); + break; + } + } + + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::GetArrayIndex +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CWsfWlanInfoArray::GetArrayIndex( TWsfWlanInfo* aWlanInfo ) const + { + TBool found( EFalse ); + TInt index( 0 ); + TWsfWlanInfo* temp; + TInt count = iInfoArray->Count(); + + while( ( index < count ) && !found ) + { + temp = ( *iInfoArray )[index]; + if ( !temp->iSsid.Compare( aWlanInfo->iSsid ) ) + { + found = ETrue; + } + else + { + ++index; + } + } + return ( found ? index : KErrNotFound ); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::operator[] +// --------------------------------------------------------------------------- +// +EXPORT_C TWsfWlanInfo* CWsfWlanInfoArray::operator[]( TUint aIndex ) const + { + return ( *iInfoArray )[aIndex]; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::Match +// --------------------------------------------------------------------------- +// +EXPORT_C TWsfWlanInfo* CWsfWlanInfoArray::Match( const TDesC8& aSsid, + const TInt aPriorThis ) + { + TInt count = iInfoArray->Count(); + TWsfWlanInfo* ret( NULL ); + + count = count < aPriorThis ? count: aPriorThis; + + for( TInt i = 0; i < count; i++ ) + { + TWsfWlanInfo* temp = ( *iInfoArray )[i]; + if ( !temp->iSsid.Compare( aSsid ) ) + { + ret = temp; + break; + } + } + return ret; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::Match +// --------------------------------------------------------------------------- +// +EXPORT_C TWsfWlanInfo* CWsfWlanInfoArray::Match( const TUint32 aIapID, + const TInt aPriorThis ) + { + TInt count = iInfoArray->Count(); + TWsfWlanInfo* ret( NULL ); + + count = count < aPriorThis ? count: aPriorThis; + + for( TInt i = 0; i < count; i++ ) + { + TWsfWlanInfo* temp = ( *iInfoArray )[i]; + if ( temp->iIapId == aIapID ) + { + ret = temp; + break; + } + } + return ret; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::MatchWithIapIDL +// --------------------------------------------------------------------------- +// +EXPORT_C void CWsfWlanInfoArray::MatchWithIapIDL( const TUint aIapID, + const TInt aPriorThis, + RPointerArray& aMatchArray ) + { + aMatchArray.Reset(); + + TInt count = iInfoArray->Count(); + TWsfWlanInfo* temp(NULL); + + count = count < aPriorThis ? count: aPriorThis; + + for( TInt i = 0; i < count ; i++ ) + { + temp = ( *iInfoArray )[i]; + if( temp->iIapId == aIapID ) + { + aMatchArray.AppendL(temp); + } + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::MatchL +// --------------------------------------------------------------------------- +// +EXPORT_C void CWsfWlanInfoArray::MatchL( const TDesC8& aSsid, + CMManager::TWlanSecMode aSecMode, + CMManager::TWlanNetMode aNetMode, + TBool aUsesPreSharedKey, + const TInt aPriorThis, + RPointerArray& aMatchArray ) + { + aMatchArray.Reset(); + + TInt count = iInfoArray->Count(); + TWsfWlanInfo* temp(NULL); + + count = count < aPriorThis ? count: aPriorThis; + + for( TInt i = 0; i < count ; i++ ) + { + temp = ( *iInfoArray )[i]; + if( !temp->iSsid.Compare( aSsid ) && temp->iSecurityMode == aSecMode + && temp->iNetMode == aNetMode ) + { + aMatchArray.AppendL(temp); + } + else if ( temp->iIapId && !temp->iSsid.Compare( aSsid ) + && temp->SecurityMode() == CMManager::EWlanSecMode802_1x + && temp->iNetMode == aNetMode ) + { + if ( aSecMode == CMManager::EWlanSecModeOpen ) + { + aMatchArray.AppendL(temp); + } + else if ( aSecMode == CMManager::EWlanSecModeWep ) + { + aMatchArray.AppendL(temp); + } + else if ( aSecMode == CMManager::EWlanSecModeWpa + && !aUsesPreSharedKey ) + { + aMatchArray.AppendL(temp); + } + else if ( aSecMode == CMManager::EWlanSecMode802_1x ) + { + aMatchArray.AppendL(temp); + } + } + } + } +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::SerializeContentLC +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC8* CWsfWlanInfoArray::SerializeContentLC() + { + HBufC8* buffer( NULL ); + + if ( !iInfoArray->Count() ) + { + buffer = KNullDesC8().AllocLC(); + } + else + { + TInt32 requiredBufferSize = sizeof( TUint32 ) + + iInfoArray->Count() * sizeof( TWsfWlanInfo ); + buffer = HBufC8::NewLC( requiredBufferSize ); + + // create a stream.. + TPtr8 bufferPtr = buffer->Des(); + RDesWriteStream writeStream( bufferPtr ); + writeStream.Open( bufferPtr); + CleanupClosePushL( writeStream ); + writeStream.WriteInt16L( iInfoArray->Count() ); + TWsfWlanInfo* infoPtr = NULL; + for ( TInt i( 0 ); i < iInfoArray->Count(); i++) + { + infoPtr = ( *iInfoArray )[i]; + writeStream << *infoPtr; + } + writeStream.CommitL(); + // try to realloc - save space realloc to required level.. + TStreamPos position = writeStream.Sink()->TellL( MStreamBuf::EWrite ); + + CleanupStack::PopAndDestroy( &writeStream ); // closes the stream + CleanupStack::Pop( buffer ); + HBufC8* newBuffer = buffer->ReAlloc( position.Offset() ); + if ( newBuffer ) // the realloc succeeded - swap the buffer + { + buffer = newBuffer; + } + CleanupStack::PushL( buffer); + } + + return buffer; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::AppendFromStreamBufferL +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CWsfWlanInfoArray::AppendFromStreamBufferL( + const TDesC8& aStreamBuffer ) + { + RDesReadStream reader( aStreamBuffer ); + reader.Open( aStreamBuffer ); // codescanner false alarm + // ignoring Open() return value.. Open returns void + CleanupClosePushL( reader ); + + TInt infoCount = reader.ReadInt16L(); + + TWsfWlanInfo *infoPtr = NULL; + for ( TInt i(0); i < infoCount; i++ ) + { + infoPtr = new (ELeave)TWsfWlanInfo; + CleanupStack::PushL( infoPtr ); + reader >> *infoPtr; + AppendL( infoPtr ); + CleanupStack::Pop( infoPtr ); + } + + CleanupStack::PopAndDestroy( &reader ); + return Count(); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::FindHiddenEntry +// --------------------------------------------------------------------------- +// +EXPORT_C TWsfWlanInfo* CWsfWlanInfoArray::FindHiddenEntry( + const TInt aPriorThis ) + { + TInt count = iInfoArray->Count(); + TWsfWlanInfo* ret( NULL ); + count = count < aPriorThis ? count : aPriorThis; + + for ( TInt i = 0; i < count; ++i ) + { + TWsfWlanInfo* temp = ( *iInfoArray )[i]; + if ( !temp->iVisibility ) + { + ret = temp; + break; + } + } + return ret; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::DeleteFromTail +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CWsfWlanInfoArray::DeleteFromTail( const TInt aCount ) + { + TInt arrayItemCount = iInfoArray->Count(); + + if ( aCount >= arrayItemCount ) + { + iInfoArray->ResetAndDestroy(); + } + else + { + --arrayItemCount; + for ( TInt i( 1 ) ; i <= aCount; ++i, --arrayItemCount ) + { + delete ( *iInfoArray )[arrayItemCount]; + iInfoArray->Delete( arrayItemCount ); + } + iInfoArray->Compress(); + } + + return iInfoArray->Count(); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::SortArrayL +// --------------------------------------------------------------------------- +// +EXPORT_C void CWsfWlanInfoArray::SortArrayL() + { + if ( iInfoArray->Count() > 1 ) + { + CWsfWlanInfoArraySortKey* sortKey = CWsfWlanInfoArraySortKey::NewLC( + *this ); + + // Sort returns KErrGeneral if stack overflow, otherwise, returns + // KErrNone. So we will Leave only if stack overflow, + // but than that really does not matter... + User::LeaveIfError( iInfoArray->Sort( *sortKey ) ); + + CleanupStack::PopAndDestroy( sortKey ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::SortArrayL +// --------------------------------------------------------------------------- +// +EXPORT_C void CWsfWlanInfoArray::SortArrayL( + MWsfWlanInfoArrayFilterVisitor& aSortKey ) + { + // the visitor sortkey may do some other stuff too + // so don't make any asumptions... + // just go for the sorting... + + aSortKey.FilterPreSortL( this ); + + User::LeaveIfError( iInfoArray->Sort( aSortKey.SortingKey() ) ); + + aSortKey.FilterPostSortL( this ); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::SetUIPrioritySort +// --------------------------------------------------------------------------- +// +EXPORT_C void CWsfWlanInfoArray::SetUIPrioritySort( const TBool aUIPrioritySort ) + { + iUIPrioritySort = aUIPrioritySort; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArray::GetUIPrioritySort +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CWsfWlanInfoArray::GetUIPrioritySort( ) + { + return iUIPrioritySort; + } + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfo/src/wsfwlaninfoarraysortkey.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/src/wsfwlaninfoarraysortkey.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,173 @@ +/* +* Copyright (c) 2007-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 CWsfWlanInfoArraySortKey +* +*/ + + +// CLASS HEADER +#include "wsfwlaninfoarraysortkey.h" + +// INTERNAL INCLUDES +#include "wsfwlaninfoarray.h" + + +// CONSTANTS +static const TInt KLeftFirst = -1; +static const TInt KRightFirst = 1; + + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArraySortKey::NewL +// --------------------------------------------------------------------------- +// +CWsfWlanInfoArraySortKey* CWsfWlanInfoArraySortKey::NewLC( + CWsfWlanInfoArray& aArray ) + { + CWsfWlanInfoArraySortKey* thisPtr = new (ELeave) CWsfWlanInfoArraySortKey( + aArray ); + CleanupStack::PushL( thisPtr ); + // no ConstructL at this stage required + return thisPtr; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArraySortKey::NewL +// --------------------------------------------------------------------------- +// +CWsfWlanInfoArraySortKey::CWsfWlanInfoArraySortKey( CWsfWlanInfoArray& aArray ) + : TKeyArrayFix( 0, ECmpNormal ) + { + iArray = &aArray; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArraySortKey::NewL +// --------------------------------------------------------------------------- +// +CWsfWlanInfoArraySortKey::~CWsfWlanInfoArraySortKey() + { + iArray = NULL; // not owning + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoArraySortKey::NewL +// --------------------------------------------------------------------------- +// +TInt CWsfWlanInfoArraySortKey::Compare( TInt aLeft, TInt aRight ) const + { + TWsfWlanInfo* left = iArray->At( aLeft ); + TWsfWlanInfo* right = iArray->At( aRight ); + TBool uiPrioritySort = iArray->GetUIPrioritySort(); + + TInt ret( 0 ); + + // connected goes first + if ( left->Connected() ) + { + ret = KLeftFirst; + } + else if ( right->Connected() ) + { + ret = KRightFirst; + } + + // then network with connecting status + else if ( left->ConnectionStatus() == EConnecting ) + { + ret = KLeftFirst; + } + else if ( right->ConnectionStatus() == EConnecting ) + { + ret = KRightFirst; + } + + // then customer favourite networks + else if ( left->BrandId() ) + { + if ( right->BrandId() ) + { + // smaller brand id first + ret = left->BrandId() - right->BrandId(); + } + else + { + ret = KLeftFirst; + } + } + else if ( right->BrandId() ) + { + ret = KRightFirst; + } + + // then ui priority networks + else if ( uiPrioritySort && left->Priority() && !right->Priority() ) + { + ret = KLeftFirst; + } + else if ( uiPrioritySort && !left->Priority() && right->Priority() ) + { + ret = KRightFirst; + } + else if ( uiPrioritySort && left->Priority() && right->Priority() ) + { + if ( left->Priority() < right->Priority() ) + { + ret = KLeftFirst; + } + else + { + ret = KRightFirst; + } + } + + // then known networks + else if ( left->Known() && !right->Known() ) + { + ret = KLeftFirst; + } + else if ( !left->Known() && right->Known() ) + { + ret = KRightFirst; + } + + // finally SSID alphabetic order decides + else + { + if ( ( left->iNetworkName.Length() ) && + ( right->iNetworkName.Length() ) ) + { + ret = left->iNetworkName.CompareC( right->iNetworkName ); + } + else if ( left->iNetworkName.Length() ) + { + ret = left->iNetworkName.CompareC( right->iSsid ); + } + else if ( right->iNetworkName.Length() ) + { + ret = left->iSsid.CompareC( right->iNetworkName ); + } + else + { + ret = left->iSsid.CompareC( right->iSsid ); + } + } + + return ret; + } + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/bwins/wsfwlaninfosortingu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/bwins/wsfwlaninfosortingu.def Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,12 @@ +EXPORTS + ??1CWsfWlanInfoArrayVisitor@@UAE@XZ @ 1 NONAME ; CWsfWlanInfoArrayVisitor::~CWsfWlanInfoArrayVisitor(void) + ?AppendBrandingIconsL@CWsfWlanInfoArrayVisitor@@QAEXAAVCAknIconArray@@@Z @ 2 NONAME ; void CWsfWlanInfoArrayVisitor::AppendBrandingIconsL(class CAknIconArray &) + ?BlackListItemCount@CWsfWlanInfoArrayVisitor@@QBEHXZ @ 3 NONAME ; int CWsfWlanInfoArrayVisitor::BlackListItemCount(void) const + ?EditBlackListL@CWsfWlanInfoArrayVisitor@@QAEXAAVCWsfWlanInfoArray@@@Z @ 4 NONAME ; void CWsfWlanInfoArrayVisitor::EditBlackListL(class CWsfWlanInfoArray &) + ?FilterPostSortL@CWsfWlanInfoArrayVisitor@@UAEXPAVCWsfWlanInfoArray@@@Z @ 5 NONAME ; void CWsfWlanInfoArrayVisitor::FilterPostSortL(class CWsfWlanInfoArray *) + ?FilterPreSortL@CWsfWlanInfoArrayVisitor@@UAEXPAVCWsfWlanInfoArray@@@Z @ 6 NONAME ; void CWsfWlanInfoArrayVisitor::FilterPreSortL(class CWsfWlanInfoArray *) + ?LoadFilterDefinitionsL@CWsfWlanInfoArrayVisitor@@QAEXXZ @ 7 NONAME ; void CWsfWlanInfoArrayVisitor::LoadFilterDefinitionsL(void) + ?NewL@CWsfWlanInfoArrayVisitor@@SAPAV1@H@Z @ 8 NONAME ; class CWsfWlanInfoArrayVisitor * CWsfWlanInfoArrayVisitor::NewL(int) + ?NewLC@CWsfWlanInfoArrayVisitor@@SAPAV1@H@Z @ 9 NONAME ; class CWsfWlanInfoArrayVisitor * CWsfWlanInfoArrayVisitor::NewLC(int) + ?SortingKey@CWsfWlanInfoArrayVisitor@@UAEAAVTKeyArrayFix@@XZ @ 10 NONAME ; class TKeyArrayFix & CWsfWlanInfoArrayVisitor::SortingKey(void) + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/data/2000cf30.spd Binary file wlanutilities/wlansniffer/wlaninfosorting/data/2000cf30.spd has changed diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/data/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/data/backup_registration.xml Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,4 @@ + + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/data/wsfwlaninfosorting.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/data/wsfwlaninfosorting.rss Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,182 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource definitions for project wlaninfosorting +* +*/ + + + +NAME WIST + +#include +#include +#include +#include +#include +#include +#include + +#include "wsfwlansortingbrand.rh" +#include +#include "wsfwlaninfosorting.hrh" +#include + + +RESOURCE RSS_SIGNATURE { } + + +RESOURCE TBUF16 { buf=""; } + + +// --------------------------------------------------------------------------- +// r_qtn_title_filter_out_wlans +// --------------------------------------------------------------------------- +// +RESOURCE TBUF r_qtn_title_filter_out_wlans + { + buf = qtn_note_title_filter_out_wlans; + } + + +// --------------------------------------------------------------------------- +// r_qtn_blacklist_filter_selection_dialog_menubar +// --------------------------------------------------------------------------- +// +RESOURCE MENU_BAR r_qtn_blacklist_filter_selection_dialog_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = R_AVKON_MENUPANE_MARKABLE_LIST; + } + }; + } + + +// --------------------------------------------------------------------------- +// r_qtn_blacklist_filter_selection_dialog +// --------------------------------------------------------------------------- +// +RESOURCE DIALOG r_qtn_blacklist_filter_selection_dialog + { + flags = EAknDialogMarkableList; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL__MARK; + items = + { + DLG_LINE + { + type = EAknCtSingleListBox; + id = ESelectionListControl; + control = LISTBOX + { + flags = EAknListBoxMarkableList | EAknListBoxLoopScrolling; + }; + } + }; + } + + +// --------------------------------------------------------------------------- +// r_qtn_preferred_filter_selection_dialog2 +// --------------------------------------------------------------------------- +// +RESOURCE AVKON_MULTISELECTION_LIST_QUERY r_qtn_preferred_filter_selection_dialog2 + { + softkeys = R_AVKON_SOFTKEYS_OK_CANCEL__MARK; + items = + { + AVKON_MULTISELECTION_LIST_QUERY_DLG_LINE + { + control = AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSingleGraphicPopupMenuListBox; + listbox = AVKON_MULTISELECTION_LIST_QUERY_LIST + { + }; + heading = qtn_note_title_filter_out_wlans; + }; + } + }; + } + + +// --------------------------------------------------------------------------- +// r_qtn_user_preferred_filter_selection_dialog +// --------------------------------------------------------------------------- +// +RESOURCE DIALOG r_qtn_user_preferred_filter_selection_dialog + { + flags = EAknDialogMarkableList; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL__MARK; + items = + { + DLG_LINE + { + type = EECustom; + id = ESnifferLabel; + control = LABEL + { + }; + }, + + DLG_LINE + { + type = EAknCtSingleListBox; + id = ESelectionListControl; + control = LISTBOX + { + flags = EAknListBoxMarkableList | EAknListBoxLoopScrolling; + height = 18; + }; + } + + }; + } + + +// --------------------------------------------------------------------------- +// r_qtn_ssid_branding +// +// To add branded networks, modify the brandedItems structure as follows: +// +// brandedItems = +// { +// WLAN_BRAND_ITEM +// { +// brandedSsids = { "HugeOperator_protected", "HugeOperator_public" }; +// bmpIdImage = EMbmWsfwlaninfosortingHugeoperator; +// bmpIdMask = EMbmWsfwlaninfosortingHugeoperator_mask; +// } +// } +// +// Bitmap enums are defined in wsfwlaninfosorting.mbg. See also remarks +// in wsfwlaninfosorting.mk. In case you don't want to specify custom icons, +// set the bmpIdImage and bmpIdMask as follows: +// +// bmpIdImage = EMbmWsfwlaninfosortingQgn_prop_wlan_bearer; +// bmpIdMask = EMbmWsfwlaninfosortingQgn_prop_wlan_bearer_mask; +// +// DO NOT REMOVE the r_qtn_ssid_branding structure even if there are +// no networks to define! +// --------------------------------------------------------------------------- +// +RESOURCE WLAN_SORTING_BRAND r_qtn_ssid_branding + { + bmpfile = APP_BITMAP_DIR "\\wsfwlaninfosorting.mif"; + brandedItems = + { + }; + } + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/eabi/wsfwlaninfosortingu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/eabi/wsfwlaninfosortingu.def Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,19 @@ +EXPORTS + _ZN24CWsfWlanInfoArrayVisitor10SortingKeyEv @ 1 NONAME + _ZN24CWsfWlanInfoArrayVisitor14EditBlackListLER17CWsfWlanInfoArray @ 2 NONAME + _ZN24CWsfWlanInfoArrayVisitor14FilterPreSortLEP17CWsfWlanInfoArray @ 3 NONAME + _ZN24CWsfWlanInfoArrayVisitor15FilterPostSortLEP17CWsfWlanInfoArray @ 4 NONAME + _ZN24CWsfWlanInfoArrayVisitor20AppendBrandingIconsLER13CAknIconArray @ 5 NONAME + _ZN24CWsfWlanInfoArrayVisitor22LoadFilterDefinitionsLEv @ 6 NONAME + _ZN24CWsfWlanInfoArrayVisitor4NewLEi @ 7 NONAME + _ZN24CWsfWlanInfoArrayVisitor5NewLCEi @ 8 NONAME + _ZN24CWsfWlanInfoArrayVisitorD0Ev @ 9 NONAME + _ZN24CWsfWlanInfoArrayVisitorD1Ev @ 10 NONAME + _ZN24CWsfWlanInfoArrayVisitorD2Ev @ 11 NONAME + _ZNK24CWsfWlanInfoArrayVisitor18BlackListItemCountEv @ 12 NONAME + _ZThn32_N24CWsfWlanInfoArrayVisitor10SortingKeyEv @ 13 NONAME ; ## + _ZThn32_N24CWsfWlanInfoArrayVisitor14FilterPreSortLEP17CWsfWlanInfoArray @ 14 NONAME ; ## + _ZThn32_N24CWsfWlanInfoArrayVisitor15FilterPostSortLEP17CWsfWlanInfoArray @ 15 NONAME ; ## + _ZThn32_N24CWsfWlanInfoArrayVisitorD0Ev @ 16 NONAME ; ## + _ZThn32_N24CWsfWlanInfoArrayVisitorD1Ev @ 17 NONAME ; ## + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/group/bld.inf Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,95 @@ +/* +* 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: Build information file for project WlanInfoSorting +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + + +PRJ_EXPORTS + +../inc/wsfwlaninfoarrayvisitor.h |../../../inc/wsfwlaninfoarrayvisitor.h + +../rom/wsfwlaninfosorting.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wsfwlaninfosorting.iby) +../rom/wsfwlaninfosortingresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(wsfwlaninfosortingresources.iby) + +// blacklist database +../data/2000cf30.spd /epoc32/release/winscw/udeb/z/private/100012a5/policy/2000cf30.spd +../data/2000cf30.spd /epoc32/release/winscw/urel/z/private/100012a5/policy/2000cf30.spd +../data/2000cf30.spd /epoc32/data/z/private/100012a5/policy/2000cf30.spd + +// backup registration +../data/backup_registration.xml /epoc32/release/winscw/udeb/z/private/10281caa/backup_registration.xml +../data/backup_registration.xml /epoc32/release/winscw/urel/z/private/10281caa/backup_registration.xml +../data/backup_registration.xml /epoc32/data/z/private/10281caa/backup_registration.xml + + +PRJ_MMPFILES +// gnumakefile wlaninfosortingicons.mk +wlaninfosorting.mmp + + +PRJ_EXTENSIONS +/* +* Add your branding icons here like: +* +* START EXTENSION s60/mifconv +* OPTION TARGETFILE wsfwlaninfosorting.mif +* OPTION HEADERFILE wsfwlaninfosorting.mbg +* OPTION SOURCES -c8,1 hugeoperatoricon +* OPTION SOURCES -c8,1 hugeoperatoricon2 +* END +* +* and use the enums that result in wsfwlaninfosorting.mbg when specifying +* the custfav networks in the resource. +* +* If there are no customer favourite networks defined, you must still invoke +* mifconv the following way: +* +* START EXTENSION s60/mifconv +* OPTION TARGETFILE wsfwlaninfosorting.mif +* OPTION HEADERFILE wsfwlaninfosorting.mbg +* OPTION SOURCES -c8,1 qgn_prop_wlan_bearer +* END +* +* In case any of the defined networks doesn't need a specific icon, you must +* use the following invocation: +* +* START EXTENSION s60/mifconv +* OPTION TARGETFILE wsfwlaninfosorting.mif +* OPTION HEADERFILE wsfwlaninfosorting.mbg +* OPTION SOURCES -c8,1 qgn_prop_wlan_bearer +* OPTION SOURCES -c8,1 hugeoperatoricon +* OPTION SOURCES -c8,1 hugeoperatoricon2 +* END +* +* and use the enums that result in wsfwlaninfosorting.mbg when specifying +* the custfav networks in the resource. For the networks without icon, use +* the enums corresponding to qgn_prop_wlan_bearer. +*/ + +START EXTENSION s60/mifconv +OPTION TARGETFILE wsfwlaninfosorting.mif +OPTION HEADERFILE wsfwlaninfosorting.mbg +OPTION SOURCES -c8,1 qgn_prop_wlan_bearer +END + + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/group/wlaninfosorting.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/group/wlaninfosorting.mmp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 project WlanInfoSorting +* +*/ + + + +#include +#include + + +TARGET wsfwlaninfosorting.dll +TARGETTYPE dll +UID 0x1000008d 0x10281D14 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + + +SOURCEPATH ../src +SOURCE wsfwlaninfosortingdefault.cpp +SOURCE wsfwlaninfosortingbrand.cpp +SOURCE wsfwlaninfosortingblacklist.cpp +SOURCE wsfwlaninfoarrayvisitor.cpp +SOURCE wsfwlaninfosortingdbchangenotifier.cpp +SOURCE wsfwlanssidselectiondlg2.cpp + + +// own headers +USERINCLUDE ../inc + +// inner API +USERINCLUDE ../../inc + +// private API +USERINCLUDE ../../../inc + + +MW_LAYER_SYSTEMINCLUDE + + +SOURCEPATH ../data + +START RESOURCE wsfwlaninfosorting.rss +HEADER +TARGETPATH RESOURCE_FILES_DIR +LANGUAGE_IDS +END + + +LIBRARY euser.lib +LIBRARY estor.lib +LIBRARY charconv.lib +LIBRARY bafl.lib +LIBRARY edbms.lib +LIBRARY avkon.lib +LIBRARY efsrv.lib +LIBRARY cone.lib +LIBRARY egul.lib +LIBRARY aknicon.lib +LIBRARY eikdlg.lib +LIBRARY eikcore.lib +LIBRARY eikcoctl.lib +LIBRARY eikctl.lib +LIBRARY commonengine.lib +LIBRARY aknskins.lib +LIBRARY ws32.lib +LIBRARY wsfwlaninfo.lib + +DEBUGLIBRARY flogger.lib + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/group/wlaninfosortingicons.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/group/wlaninfosortingicons.mk Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,90 @@ +# +# Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Scalable icons makefile for project WlanInfoSorting +# + + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/z +else +ZDIR=$(EPOCROOT)epoc32/data/z +endif + +TARGETDIR=$(ZDIR)/resource/apps +ICONTARGETFILENAME=$(TARGETDIR)/wsfwlaninfosorting.mif + +HEADERDIR=$(EPOCROOT)epoc32/include +HEADERFILENAME=$(HEADERDIR)/wsfwlaninfosorting.mbg + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + + +# Add your branding icons here like: +# +# RESOURCE : +# mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ +# /c8,1 /path/to/graphics/hugeoperator.svg \ +# /c8,1 /path/to/graphics/hugeoperator2.svg +# +# and use the enums that result in $(HEADERFILENAME) when specifying +# the custfav networks in the resource. +# +# If there are no customer favourite networks defined, you must still invoke +# mifconv the following way: +# +# RESOURCE: +# mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ +# /c8,1 qgn_prop_wlan_bearer.svg +# +# In case any of the defined networks doesn't need a specific icon, you must +# use the following invocation: +# +# RESOURCE: +# mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ +# /c8,1 qgn_prop_wlan_bearer.svg \ +# /c8,1 /path/to/hugeoperator.svg \ +# /c8,1 /path/to/yetanothernetworkicon.svg +# +# and use the enums that result in $(HEADERFILENAME) when specifying +# the custfav networks in the resource. For the networks without icon, use +# the enums corresponding to qgn_prop_wlan_bearer.svg. +# + +RESOURCE : + mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ + /c8,1 qgn_prop_wlan_bearer.svg + + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(HEADERFILENAME)&& \ + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfoarrayvisitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfoarrayvisitor.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,225 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfWlanInfoArrayVisitor +* +*/ + + + +#ifndef C_WSFWLANINFOARRAYVISITOR_H +#define C_WSFWLANINFOARRAYVISITOR_H + + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "wsfwlaninfoarrayfiltervisitor.h" +#include "wsfwlaninfo.h" + + +// FORWARD DECLARATIONS +class CWsfWlanInfoSortingDefault; +class CWsfWlanInfoSortingBrand; +class CWsfWlanInfoSortingBlackList; +class CEikonEnv; +class CAknIconArray; +class CWsfWlanInfoSortingDbChangeNotifier; + +/** +* This class is the main entry point for wlan list sorting services +* +* @lib wsfwlaninfosorting.lib +* @since S60 5.0 +*/ +NONSHARABLE_CLASS( CWsfWlanInfoArrayVisitor ): public CBase, + public TKeyArrayFix, + public MWsfWlanInfoArrayFilterVisitor + { + public: // construction + /** + * Factory function. + * @since S60 5.0 + * @param aReadOnly If EFalse, database-dependent filters + * won't get updated + * @return Class instance + */ + IMPORT_C static CWsfWlanInfoArrayVisitor* NewLC( + const TBool aReadOnly ); + + /** + * Factory function. + * @since S60 5.0 + * @param aReadOnly If EFalse, database-dependent filters + * won't get updated + * @return Class instance + */ + IMPORT_C static CWsfWlanInfoArrayVisitor* NewL( + const TBool aReadOnly ); + + IMPORT_C ~CWsfWlanInfoArrayVisitor(); + + private: + /** + * Constructor. + * @since S60 5.0 + * @param aReadOnly If EFalse, database-dependent filters + * won't get updated + */ + CWsfWlanInfoArrayVisitor( const TBool aReadOnly ); + + void ConstructL(); + + + public: // new methods + /** + * Carries out operations before starting the actual sorting + * @since S60 5.0 + * @param aArrayToBeFiltered The array we are working on. + */ + IMPORT_C void FilterPreSortL( CWsfWlanInfoArray* aArrayToBeFiltered ); + + /** + * Carries out operations after having sorted the array + * @since S60 5.0 + * @param aArrayToBeFiltered The array we are working on. + */ + IMPORT_C void FilterPostSortL( CWsfWlanInfoArray* aArrayToBeFiltered ); + + /** + * Return the sorting key handle + * @since S60 5.0 + * @return Reference to the sorting key + */ + IMPORT_C TKeyArrayFix& SortingKey(); + + + public: // from TKeyArrayFix + /** + * Compares elements of the given indices according to the + * sorting criteria. + * @since S60 5.0 + * @param aLeft Index of left element + * @param aRight Index of right element + * @return Negative if the left element is less than the right, + * positive if the right element is less than the left, + * zero if the two elements are equal. + */ + TInt Compare( TInt aLeft, TInt aRight ) const; + + + public: // new methods + + /** + * Load definition of each filter + * @since S60 5.0 + */ + IMPORT_C void LoadFilterDefinitionsL(); + + /** + * Add the icons of the given array to the branding icon list + * @since S60 5.0 + * @param aIconArray The icons to be appended + */ + IMPORT_C void AppendBrandingIconsL( CAknIconArray& aIconArray ); + + /** + * Launches the UI to modify the SSID blacklist (filter out networks) + * @since S60 5.0 + * @param aInfoItemArray The current wlaninfo array + */ + IMPORT_C void EditBlackListL( CWsfWlanInfoArray& aInfoItemArray ); + + /** + * Returns the number of blacklisted SSIDs + * @since S60 5.0 + * @return The count of filtered SSIDs + */ + IMPORT_C TInt BlackListItemCount() const; + + + private: // new methods + + /** + * Opens the shared filter database + * @since S60 5.0 + */ + void OpenDataBaseL(); + + + private: //data + + /** + * The wlaninfo array we are currently working on. Not owned. + */ + CWsfWlanInfoArray* iInfoArray; + + /** + * Default sorting filter. Owned. + */ + CWsfWlanInfoSortingDefault* iDefaultSorting; + + /** + * Branded item sorting filter. Owned. + */ + CWsfWlanInfoSortingBrand* iBrandSorting; + + /** + * Blacklisted item sorting filter. Owned. + */ + CWsfWlanInfoSortingBlackList* iBlackListSorting; + + /** + * Notifier of database changes. Owned. + */ + CWsfWlanInfoSortingDbChangeNotifier* iDbChangeNotifier; + + /** + * Reference to the UI environment + */ + CEikonEnv& iCoeEnv; + + /** + * Resource file offset + */ + TInt iResourceFileOffset; + + /** + * Handle to the filter database + */ + RDbNamedDatabase iFilterDb; + + /** + * Handle to the DBMS + */ + RDbs iDbms; + + /** + * Handle to the FS + */ + RFs iFileServer; + + /** + * If EFalse, database-dependent filters won't get updated + */ + TBool iReadOnly; + + }; + + + + +#endif // C_WSFWLANINFOARRAYVISITOR_H + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosorting.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosorting.hrh Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource headers for project wlaninfosorting +* +*/ + + + + + +#ifndef WSFWLANINFOSORTING_HRH +#define WSFWLANINFOSORTING_HRH + + +enum TWsfControls + { + ESnifferLabel = 6000, + EECustom + }; + + +#endif // WSFWLANINFOSORTING_HRH diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingblacklist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingblacklist.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,177 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfWlanInfoArrayVisitor +* +*/ + + + +#ifndef C_WSFWLANINFOSORTINGBLACKLIST_H +#define C_WSFWLANINFOSORTINGBLACKLIST_H + + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "wsfwlaninfosortingfiltervisitor.h" +#include "wsfwlaninfo.h" + + + +// FORWARD DECLARATIONS +class CDesC8Array; +class CGulIcon; +class CAknIconArray; + + + +/** +* Blacklisted item sorting filter +* +* @lib wsfwlaninfosorting.lib +* @since S60 5.0 +*/ +NONSHARABLE_CLASS( CWsfWlanInfoSortingBlackList ): public CBase, + public MWsfWlanInfoSortingFilterVisitor + { + public: + /** + * Factory function. + * @since S60 5.0 + * @param aDatabase The database to read the blacklist from. + * @return Class instance. + */ + static CWsfWlanInfoSortingBlackList* NewLC( + RDbNamedDatabase& aDatabase ); + + /** + * Factory function. + * @since S60 5.0 + * @param aDatabase The database to read the blacklist from. + * @return Class instance. + */ + static CWsfWlanInfoSortingBlackList* NewL( + RDbNamedDatabase& aDatabase ); + + ~CWsfWlanInfoSortingBlackList(); + + + private: + /** + * Constructor. + * @since S60 5.0 + * @param aDatabase The database to read the blacklist from. + */ + CWsfWlanInfoSortingBlackList( RDbNamedDatabase& aDatabase ); + + void ConstructL(); + + + public: // from MWsfWlanInfoSortingFilterVisitor + + /** + * Do comparing between these two entries + * @since S60 5.0 + * @param aInfoLeft Left element + * @param aInfoRight Right element + * @return Negative if aInfoLeft is smaller tha aInfoRight, + * zero if the entries are equal, + * positive if the aInfoLeft is greater than aInfoRight + */ + virtual TInt Compare( const TWsfWlanInfo& aInfoLeft, + const TWsfWlanInfo& aInfoRight ); + + /** + * Check if the entry matches to filter rules and carry out additional + * operations if needed. + * @since S60 5.0 + * @param aInfoLeft The element to be checked + * @return ETrue if the item matches the blacklist rule + */ + virtual TBool SetupOnRuleMatch( TWsfWlanInfo& aInfoLeft ); + + /** + * Handle filter match + * @since S60 5.0 + * @param aFilterEntry The element in question + */ + virtual void MarkMatchedFilterL( TWsfWlanInfo& aFilterEntry ); + + /** + * Edit filter definitions + * @since S60 5.0 + * @param aInfoArray The element in question + */ + virtual void EditFilterDefsL( CWsfWlanInfoArray& aInfoArray ); + + /** + * Read the filter defintions to filter + * @since S60 5.0 + */ + virtual void ReadFilterDefsL(); + + + public: // new methods + /** + * Return the number of elements in the blacklist + * @since S60 5.0 + * @return The count of blacklisted SSIDs + */ + TInt BlackListItemCount() const; + + + private: // new methods + /** + * Save filter definitions + * @since S60 5.0 + */ + void SaveDefsL(); + + /** + * Restore filter definitions + * @since S60 5.0 + */ + void RestoreDefsL(); + + /** + * Check if the blacklist table exists in the database + * @since S60 5.0 + */ + void CheckTableL(); + + + private: //data + + /** + * Array of blacklisted SSIDs. Owned. + */ + CDesC8Array* iBlackListSsids; + + /** + * Handle to the blacklist database. Not owned. + */ + RDbNamedDatabase* iDefsDb; + + /** + * Handle to the blacklist table + */ + RDbTable iBlackListSsidTable; + }; + + + +#endif // C_WSFWLANINFOSORTINGBLACKLIST_H + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingbrand.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingbrand.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,229 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfWlanInfoSortingBrand +* +*/ + + + +#ifndef C_WSFWLANINFOSORTINGBRAND_H +#define C_WSFWLANINFOSORTINGBRAND_H + + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "wsfwlaninfosortingfiltervisitor.h" +#include "wsfwlaninfo.h" + + +// FORWARD DECLARATIONS +class CAknIconArray; +class CGulIcon; + + +/** +* Branded item sorting filter +* +* @lib wsfwlaninfosorting.lib +* @since S60 5.0 +*/ +NONSHARABLE_CLASS( CWsfWlanInfoSortingBrand ): public CBase, + public MWsfWlanInfoSortingFilterVisitor + { + protected: // Type definitions + + /** + * Structure to store and compare branded items + * + * @lib wsfwlaninfosorting.lib + * @since S60 5.0 + */ + class TBrandableItem + { + public: // constructors + TBrandableItem(); + + /** + * Constructor. + * @since S60 5.0 + * @param aSsid SSID of the branded network + * @param aBrandId ID of the branded network + */ + TBrandableItem( const TDesC8& aSsid, const TInt8 aBrandId ); + + public: // new methods + /** + * Compares two branded items. + * @since S60 5.0 + * @param aItemLeft First item + * @param aItemRight Second item + * @return ETrue if the two items are equal + */ + static TBool Match( const TBrandableItem& aItemLeft, + const TBrandableItem& aItemRight ); + + /** + * Defines a sorting relation between two branded items based on + * their brand id. + * @since S60 5.0 + * @param aItemLeft Left item + * @param aItemRight Right item + * @return Negative if left < right, zero if left == right, + * positive if left > right. + */ + static TInt SortByBrandId( const TBrandableItem& aItemLeft, + const TBrandableItem& aItemRight ); + + /** + * Defines a sorting relation between two branded items based on + * their SSID. + * @since S60 5.0 + * @param aItemLeft Left item + * @param aItemRight Right item + * @return Negative if left < right, zero if left == right, + * positive if left > right. + */ + static TInt SortBySsid( const TBrandableItem& aItemLeft, + const TBrandableItem& aItemRight ); + + public: // data + /** + * SSID of the branded item + */ + TBuf8 iSsid; + + /** + * Brand identifier number + */ + TInt8 iBrandId; + + /** + * Icon id for this branded item + */ + TInt iIconId; + + /** + * Icon mask id for this branded item + */ + TInt iMaskId; + }; + + public: // construction + static CWsfWlanInfoSortingBrand* NewLC(); + static CWsfWlanInfoSortingBrand* NewL(); + + ~CWsfWlanInfoSortingBrand(); + + + private: // constructors + CWsfWlanInfoSortingBrand(); + void ConstructL(); + + + public: // new methods + + /** + * Append the icons from the given array to the available icons list + * @since S60 5.0 + * @param aIconArray The array to take the icons from + */ + void AppendBrandIconsL( CAknIconArray& aIconArray ); + + + public: // from MWsfWlanInfoSortingFilterVisitor + + /** + * Do comparing between these two entries + * @since S60 5.0 + * @param aInfoLeft Left element + * @param aInfoRight Right element + * @return Negative if aInfoLeft is smaller tha aInfoRight, + * zero if the entries are equal, + * positive if the aInfoLeft is greater than aInfoRight + */ + virtual TInt Compare( const TWsfWlanInfo& aInfoLeft, + const TWsfWlanInfo& aInfoRight ); + + /** + * Check if the entry matches to filter rules and carry out additional + * operations if needed. + * @since S60 5.0 + * @param aInfoLeft The element to be checked + * @return ETrue if the item matches the rule + */ + virtual TBool SetupOnRuleMatch( TWsfWlanInfo& aInfoLeft ); + + /** + * Handle filter match + * @since S60 5.0 + * @param aFilterEntry The element in question + */ + virtual void MarkMatchedFilterL( TWsfWlanInfo& aFilterEntry ); + + /** + * Edit filter definitions + * @since S60 5.0 + * @param aInfoArray The element in question + */ + virtual void EditFilterDefsL( CWsfWlanInfoArray& aInfoArray ); + + /** + * Read the filter defintions to filter + * @since S60 5.0 + */ + virtual void ReadFilterDefsL(); + + + private: // new methods + + /** + * Creates an icon of the given icon and mask id + * @since S60 5.0 + * @param aIconId Icon ID + * @param aMaskId + * @return The created icon. Ownership passed. + */ + CGulIcon* MakeIconLC( const TInt aIconId, const TInt aMaskId ); + + /** + * Read the branded networks' data from file/resource + * @since S60 5.0 + */ + void ReadBrandedSsidsL(); + + + private: //data + + /** + * Array of branded items + */ + RPointerArray iBrandItemArray; + + /** + * Name of the bitmap file for the brand icons. Owned. + */ + HBufC* iBitmapFileName; + + /** + * Indicates whether the read data is ok + */ + TBool iBrandingDataOk; + }; + + + +#endif // C_WSFWLANINFOSORTINGBRAND_H + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingdbchangenotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingdbchangenotifier.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfWlanInfoSortingDbChangeNotifier +* +*/ + + + +#ifndef C_WSFWLANINFOSORTINGDBCHANGENOTIFIER_H +#define C_WSFWLANINFOSORTINGDBCHANGENOTIFIER_H + + +// EXTERNAL INCLUDES +#include +#include + + +// FORWARD DECLARATIONS +class MWsfWlanInfoSortingFilterVisitor; + + +/** + * Active object to monitor changes in a given database + * + * @lib wsfwlaninfosorting.lib + * @since S60 5.0 + */ + +NONSHARABLE_CLASS( CWsfWlanInfoSortingDbChangeNotifier ): public CActive + { + public: // construction + /** + * Factory function. + * @since S60 5.0 + * @param aDatabase The database to be monitored. Ownership not passed. + * @return Class instance + */ + static CWsfWlanInfoSortingDbChangeNotifier* NewLC( + RDbDatabase& aDatabase ); + + /** + * Factory function. + * @since S60 5.0 + * @param aDatabase The database to be monitored. Ownership not passed. + * @return Class instance + */ + static CWsfWlanInfoSortingDbChangeNotifier* NewL( + RDbDatabase& aDatabase ); + + ~CWsfWlanInfoSortingDbChangeNotifier(); + + + private: // constructors + /** + * Constructor + * @since S60 5.0 + * @param aDatabase The database to be monitored. Ownership not passed. + */ + CWsfWlanInfoSortingDbChangeNotifier( RDbDatabase& aDatabase ); + + void ConstructL(); + + + public: // new methods + + /** + * Starts monitoring the database + * @since S60 5.0 + */ + void StartDbObservation(); + + /** + * Append filter to the list of clients to be notified. + * @since S60 5.0 + * @param aRelatedFilter A filter which is interested in db events. + * Ownership not passed. + * @return - void + */ + void AppendDbRelatedFilterL( + MWsfWlanInfoSortingFilterVisitor* aRelatedFilter ); + + /** + * Removes the filter from the list of clients. + * @since S60 5.0 + * @param aRelatedFilter A filter which is interested in db events. + * Ownership not passed. + * @return - void + */ + void RemoveDbRelatedFilter( + MWsfWlanInfoSortingFilterVisitor* aRelatedFilter ); + + + private: // from CActive + + void DoCancel(); + void RunL(); + + + private: //data + /** + * The database to be monitored. Not owned. + */ + RDbDatabase* iDatabase; + + /** + * Database notifier + */ + RDbNotifier iNotifier; + + /** + * Array of DB-related filters to be notified + */ + RPointerArray iDbAwareFilters; + }; + +#endif // C_WSFWLANINFOSORTINGDBCHANGENOTIFIER_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingdefault.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingdefault.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfWlanInfoSortingDefault +* +*/ + + + +#ifndef C_WSFWLANINFOSORTINGDEFAULT_H +#define C_WSFWLANINFOSORTINGDEFAULT_H + + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "wsfwlaninfosortingfiltervisitor.h" + + +// CLASS DEFINITION +/** +* Default sorting filter for WLAN items +* +* @lib wsfwlaninfosorting.lib +* @since S60 5.0 +*/ +NONSHARABLE_CLASS( CWsfWlanInfoSortingDefault ): public CBase, + public MWsfWlanInfoSortingFilterVisitor + { + public: + static CWsfWlanInfoSortingDefault* NewLC(); + static CWsfWlanInfoSortingDefault* NewL(); + + ~CWsfWlanInfoSortingDefault(); + + + private: // constructors + void ConstructL(); + CWsfWlanInfoSortingDefault(); + + + public: // from MWsfWlanInfoSortingFilterVisitor + + /** + * Do comparing between these two entries + * @since S60 5.0 + * @param aInfoLeft Left element + * @param aInfoRight Right element + * @return Negative if aInfoLeft is smaller tha aInfoRight, + * zero if the entries are equal, + * positive if the aInfoLeft is greater than aInfoRight + */ + virtual TInt Compare( const TWsfWlanInfo& aInfoLeft, + const TWsfWlanInfo& aInfoRight ); + + /** + * Check if the entry matches to filter rules and carry out additional + * operations if needed. + * @since S60 5.0 + * @param aInfoLeft The element to be checked + * @return ETrue if the item matches the rule + */ + virtual TBool SetupOnRuleMatch( TWsfWlanInfo& aInfoLeft ); + + /** + * Handle filter match + * @since S60 5.0 + * @param aFilterEntry The element in question + */ + virtual void MarkMatchedFilterL( TWsfWlanInfo& aFilterEntry ); + + /** + * Edit filter definitions + * @since S60 5.0 + * @param aInfoArray The element in question + */ + virtual void EditFilterDefsL( CWsfWlanInfoArray& aInfoArray ); + + /** + * Read the filter defintions to filter + * @since S60 5.0 + */ + virtual void ReadFilterDefsL(); + + }; + + +#endif // C_WSFWLANINFOSORTINGDEFAULT_H + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingfiltervisitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingfiltervisitor.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2007-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: Class header for MWsfWlanInfoSortingFilterVisitor +* +*/ + + + +#ifndef M_WSFWLANINFOSORTINGFILTERVISITOR_H +#define M_WSFWLANINFOSORTINGFILTERVISITOR_H + + +// EXTERNAL INCLUDES +#include + + +// FORWARD DECLARATIONS +class TWsfWlanInfo; +class CWsfWlanInfoArray; + + +// CLASS DEFINITION +/** + * Interface class for common filtering actions + * + * @since S60 5.0 + */ +class MWsfWlanInfoSortingFilterVisitor + { + public: + + /** + * Do comparing between these two entries + * @since S60 5.0 + * @param aInfoLeft Left element + * @param aInfoRight Right element + * @return Negative if aInfoLeft is smaller tha aInfoRight, + * zero if the entries are equal, + * positive if the aInfoLeft is greater than aInfoRight + */ + virtual TInt Compare( const TWsfWlanInfo& aInfoLeft, + const TWsfWlanInfo& aInfoRight ) = 0; + + /** + * Check if the entry matches to filter rules and carry out additional + * operations if needed. + * @since S60 5.0 + * @param aInfoLeft The element to be checked + * @return ETrue if the item matches the rules + */ + virtual TBool SetupOnRuleMatch( TWsfWlanInfo& aInfoLeft ) = 0; + + + /** + * Handle filter match + * @since S60 5.0 + * @param aFilterEntry The element in question + */ + virtual void MarkMatchedFilterL( TWsfWlanInfo& aFilterEntry ) = 0; + + /** + * Edit filter definitions + * @since S60 5.0 + * @param aInfoArray The element in question + */ + virtual void EditFilterDefsL( CWsfWlanInfoArray& aInfoArray ) = 0; + + /** + * Read the filter defintions to filter + * @since S60 5.0 + */ + virtual void ReadFilterDefsL() = 0; + }; + + + + +#endif // M_WSFWLANINFOSORTINGFILTERVISITOR_H + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlansortingbrand.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlansortingbrand.rh Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource headers for project wlaninfosorting +* +*/ + + + +#ifndef WSFWLANSORTINGBRAND_RH +#define WSFWLANSORTINGBRAND_RH + + +STRUCT WLAN_BRAND_ITEM + { + LTEXT8 brandedSsids[]; // for ssid's with the same icon + WORD bmpIdImage; + WORD bmpIdMask; + } + +STRUCT WLAN_SORTING_BRAND + { + LTEXT bmpfile=""; + STRUCT brandedItems[]; + } + + + +#endif // WSFWLANSORTINGBRAND_RH diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlanssidselectiondlg2.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlanssidselectiondlg2.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfWlanSsidSelectionDlg2 +* +*/ + + + +#ifndef C_WSFWLANSSIDSELECTIONDLG2_H +#define C_WSFWLANSSIDSELECTIONDLG2_H + + +// EXTERNAL INCLUDES +#include +#include + + +// FORWARD DECLARATIONS +class CAknTitlePane; +class CAknIconArray; +class CGulIcon; + + +// CLASS DEFINITION +/** +* Dialog for modifying the SSID blacklist +* +* @lib wsfwlaninfosorting.lib +* @since S60 5.0 +*/ +NONSHARABLE_CLASS( CWsfWlanSsidSelectionDlg2 ): public CAknListQueryDialog + { + public: + /** + * Factory function. + * @since S60 5.0 + * @param aSsidArray Array of all SSIDs. Ownership not passed. + * @param aSelectionIndexArray Array to indicate selected state of + * the SSIDs. Ownership not passed. + * @return Class instance + */ + static CWsfWlanSsidSelectionDlg2* NewL( CDesCArrayFlat& aSsidArray, + CListBoxView::CSelectionIndexArray& aSelectionIndexArray ); + + /** + * Factory function. + * @since S60 5.0 + * @param aSsidArray Array of all SSIDs. Ownership not passed. + * @param aSelectionIndexArray Array to indicate selected state of + * the SSIDS. Ownership not passed. + * @return Class instance + */ + static CWsfWlanSsidSelectionDlg2* NewLC( CDesCArrayFlat& aSsidArray, + CListBoxView::CSelectionIndexArray& aSelectionIndexArray ); + + ~CWsfWlanSsidSelectionDlg2(); + + + private: + /** + * Constructor. + * @since S60 5.0 + * @param aSsidArray Array of all SSIDs. Ownership not passed. + * @param aSelectionIndexArray Array to indicate selected state of + * the SSIDS. Ownership not passed. + * @return Class instance + */ + CWsfWlanSsidSelectionDlg2( CDesCArrayFlat& aSsidArray, + CListBoxView::CSelectionIndexArray& aSelectionIndexArray ); + + void ConstructL(); + + + public: // from CEikDialog + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ); + + void PreLayoutDynInitL(); + + + private: // new methods + + /** + * Creates a listbox item array of the SSID list + * @since S60 5.0 + * @param aSource The source SSID array. Ownership not passed. + * @param aDest The array to put the resulting listbox items in. + * Ownership not passed. + */ + void CopyAndFormatArrayContentsL( CDesCArrayFlat* aSource, + CDesCArrayFlat* aDest ); + + /** + * Function to create checkbox icons for the markable list + * @since S60 5.0 + * @param aFileName Path to the icon file + * @param aIcon Icon id + * @param aMask Mask id + * @param aID Item ID of the masked bitmap to be created. + * @return The constructed icon. Ownership passed. + */ + CGulIcon* CreateIconLC( const TDesC& aFileName, TInt aIcon, TInt aMask, + const TAknsItemID& aID ); + + /** + * Create an icon array of the checkbox icons + * @since S60 5.0 + * @return The constructed icon array. Ownership passed. + */ + CAknIconArray* CreateQueryIconArrayL(); + + + private: //data + + /** + * Array of SSIDs in the list + */ + CDesCArrayFlat* iSsidArray; + + /** + * Array of selection states + */ + CArrayFix* iSelectedItems; + + /** + * Reference to the title pane of the list. Not owned. + */ + CAknTitlePane* iPane; + + /** + * Title text. Owned. + */ + HBufC* iTitle; + + }; + + +#endif // C_WSFWLANSSIDSELECTIONDLG2_H diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/rom/wsfwlaninfosorting.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/rom/wsfwlaninfosorting.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,41 @@ +/* +* 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: Image description file for project WlanInfoSorting +* +*/ + + + +#ifndef WSFWLANINFOSORTING_IBY +#define WSFWLANINFOSORTING_IBY + +#ifdef __PROTOCOL_WLAN + +REM WsfWlanInfoSorting + +#include + + +file=ABI_DIR\BUILD_DIR\wsfwlaninfosorting.dll SHARED_LIB_DIR\wsfwlaninfosorting.dll +SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,wsfwlaninfosorting) + +#if defined(__SECURE_BACKUP__) +data=DATAZ_\private\10281caa\backup_registration.xml private\10281caa\backup_registration.xml +#endif + +data=DATAZ_\private\100012a5\policy\2000cf30.spd private\100012a5\policy\2000cf30.spd + +#endif // __PROTOCOL_WLAN + +#endif // WSFWLANINFOSORTING_IBY diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/rom/wsfwlaninfosortingresources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/rom/wsfwlaninfosortingresources.iby Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,35 @@ +/* +* 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 WlanInfoSorting +* +*/ + + +#ifndef WSFWLANINFOSORTINGRESOURCES_IBY +#define WSFWLANINFOSORTINGRESOURCES_IBY + +#ifdef __PROTOCOL_WLAN + +REM WlanInfoSortingResources + +#include + +data = DATAZ_\RESOURCE_FILES_DIR\wsfwlaninfosorting.rsc RESOURCE_FILES_DIR\wsfwlaninfosorting.rsc + +#endif // __PROTOCOL_WLAN + +#endif // WSFWLANINFOSORTINGRESOURCES_IBY + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfoarrayvisitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfoarrayvisitor.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,319 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfWlanInfoArrayVisitor +* +*/ + + + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include + +// CLASS HEADER +#include "wsfwlaninfoarrayvisitor.h" + +//INTERNAL INCLUDES +#include "wsfwlaninfosortingbrand.h" +#include "wsfwlaninfosortingdefault.h" +#include "wsfwlaninfosortingblacklist.h" +#include "wsfwlaninfoarray.h" +#include "wsfwlaninfosortingdbchangenotifier.h" + + +/** +* Blacklist database identifier +*/ +_LIT( KBlacklistDbFormat, "SECURE[2000cf30]" ); + +/** +* Blacklist database file name +*/ +_LIT( KBlacklistDbName, "c:wsfblacklist.db" ); + +/** +* ROM folder +*/ +_LIT( KDriveZ, "z:" ); + +/** +* Resource file name +*/ +_LIT( KResourceFileName, "wsfwlaninfosorting.rsc" ); + + +#ifdef _DEBUG + _LIT( KCWsfWlanInfoArrayVisitor, "arrayvisitor" ); + #define __ASSERTD( cond ) __ASSERT_DEBUG( (cond), User::Panic( KCWsfWlanInfoArrayVisitor, __LINE__) ) +#else + #define __ASSERTD( cond ) +#endif //_DEBUG + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoArrayVisitor::NewLC +// ---------------------------------------------------------------------------- +// +EXPORT_C CWsfWlanInfoArrayVisitor* CWsfWlanInfoArrayVisitor::NewLC( + const TBool aReadOnly ) + { + CWsfWlanInfoArrayVisitor* thisPtr = new (ELeave) CWsfWlanInfoArrayVisitor( + aReadOnly ); + CleanupStack::PushL( thisPtr ); + thisPtr->ConstructL(); + return thisPtr; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoArrayVisitor::NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CWsfWlanInfoArrayVisitor* CWsfWlanInfoArrayVisitor::NewL( + const TBool aReadOnly ) + { + CWsfWlanInfoArrayVisitor* thisPtr = NewLC( aReadOnly ); + CleanupStack::Pop(); + return thisPtr; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoArrayVisitor::~CWsfWlanInfoArrayVisitor +// ---------------------------------------------------------------------------- +// +EXPORT_C CWsfWlanInfoArrayVisitor::~CWsfWlanInfoArrayVisitor() + { + delete iDbChangeNotifier; + delete iBlackListSorting; + delete iBrandSorting; + delete iDefaultSorting; + + iFilterDb.Close(); + + + iDbms.Close(); + iFileServer.Close(); + + // let the resourcefile go.. + if ( iResourceFileOffset != -1 ) + { + iCoeEnv.DeleteResourceFile( iResourceFileOffset ); + } + + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoArrayVisitor::CWsfWlanInfoArrayVisitor +// ---------------------------------------------------------------------------- +// +CWsfWlanInfoArrayVisitor::CWsfWlanInfoArrayVisitor( const TBool aReadOnly ): + TKeyArrayFix( 0, ECmpNormal ), + iCoeEnv( *CEikonEnv::Static() ), + iResourceFileOffset( -1 ), + iReadOnly( aReadOnly ) + { + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoArrayVisitor::ConstructL +// ---------------------------------------------------------------------------- +// +void CWsfWlanInfoArrayVisitor::ConstructL() + { + TFileName resourceFileName; + + resourceFileName.Append( KDriveZ ); + resourceFileName.Append( KDC_RESOURCE_FILES_DIR ); + resourceFileName.Append( KResourceFileName ); + + BaflUtils::NearestLanguageFile( iCoeEnv.FsSession(), resourceFileName ); + iResourceFileOffset = iCoeEnv.AddResourceFileL( resourceFileName ); + + + User::LeaveIfError( iFileServer.Connect() ); + User::LeaveIfError( iDbms.Connect() ); + + OpenDataBaseL(); + + + iDefaultSorting = CWsfWlanInfoSortingDefault::NewL(); + iBrandSorting = CWsfWlanInfoSortingBrand::NewL(); + iBlackListSorting = CWsfWlanInfoSortingBlackList::NewL( iFilterDb ); + + iDbChangeNotifier = CWsfWlanInfoSortingDbChangeNotifier::NewL( iFilterDb ); + iDbChangeNotifier->AppendDbRelatedFilterL( iBlackListSorting ); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoArrayVisitor::FilterPreSortL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfWlanInfoArrayVisitor::FilterPreSortL( + CWsfWlanInfoArray* aArrayToBeFiltered ) + { + __ASSERTD( aArrayToBeFiltered ); + + // go through the filters + // store the array ref + + TInt arrayLoopCount( aArrayToBeFiltered->Count() ); + TWsfWlanInfo* wlanInfo; + + for ( TInt arrayLoop( 0 ); arrayLoop < arrayLoopCount; ++arrayLoop ) + { + wlanInfo = aArrayToBeFiltered->At( arrayLoop ); + + // blacklist sorting must come first to be able to filter out + // customer favourite networks, too + if ( !iBlackListSorting->SetupOnRuleMatch( *wlanInfo ) ) + { + iBrandSorting->SetupOnRuleMatch( *wlanInfo ); + } + } + + iInfoArray = aArrayToBeFiltered; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoArrayVisitor::FilterPostSortL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfWlanInfoArrayVisitor::FilterPostSortL( + CWsfWlanInfoArray* aArrayToBeFiltered ) + { + __ASSERTD( aArrayToBeFiltered ); + + // go through the filters.... + + // we could remove the entries which are marked as blacklist entries... + TInt arrayLoopCount( aArrayToBeFiltered->Count() ); + TWsfWlanInfo* wlanInfo; + + for ( TInt arrayLoop( arrayLoopCount - 1); arrayLoop >= 0; --arrayLoop ) + { + wlanInfo = aArrayToBeFiltered->At( arrayLoop ); + if ( wlanInfo->BlackListEntry() && !wlanInfo->Connected() ) + { + // filter out only non-connected items + aArrayToBeFiltered->Delete( wlanInfo ); + } + } + // and let the iInfoArray expire.. + iInfoArray = NULL; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoArrayVisitor::SortingKey +// ---------------------------------------------------------------------------- +// +EXPORT_C TKeyArrayFix& CWsfWlanInfoArrayVisitor::SortingKey() + { + return *this; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoArrayVisitor::LoadFilterDefinitionsL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfWlanInfoArrayVisitor::LoadFilterDefinitionsL() + { + // filter by filter - call the load + iDefaultSorting->ReadFilterDefsL(); + iBrandSorting->ReadFilterDefsL(); + iBlackListSorting->ReadFilterDefsL(); + if ( iReadOnly && !iDbChangeNotifier->IsActive() ) + { + iDbChangeNotifier->StartDbObservation(); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoArrayVisitor::AppendBrandingIconsL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfWlanInfoArrayVisitor::AppendBrandingIconsL( + CAknIconArray& aIconArray ) + { + iBrandSorting->AppendBrandIconsL( aIconArray ); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoArrayVisitor::EditBlackListL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfWlanInfoArrayVisitor::EditBlackListL( + CWsfWlanInfoArray& aInfoItemArray ) + { + iBlackListSorting->EditFilterDefsL( aInfoItemArray ); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoArrayVisitor::BlackListItemCount +// ---------------------------------------------------------------------------- +// +EXPORT_C TInt CWsfWlanInfoArrayVisitor::BlackListItemCount() const + { + return iBlackListSorting->BlackListItemCount(); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoArrayVisitor::Compare +// ---------------------------------------------------------------------------- +// +TInt CWsfWlanInfoArrayVisitor::Compare( TInt aLeft, TInt aRight ) const + { + TWsfWlanInfo* left = iInfoArray->At( aLeft ); + TWsfWlanInfo* right = iInfoArray->At( aRight ); + + __ASSERTD( left ); + __ASSERTD( right ); + + return iDefaultSorting->Compare( *left, *right ); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoArrayVisitor::OpenDataBaseL +// ---------------------------------------------------------------------------- +// +void CWsfWlanInfoArrayVisitor::OpenDataBaseL() + { + if ( iFilterDb.Open( iDbms, KBlacklistDbName, KBlacklistDbFormat ) != + KErrNone ) + { + User::LeaveIfError( iFilterDb.Create( iDbms, + KBlacklistDbName, + KBlacklistDbFormat ) ); + + // create tables in the new database + CWsfWlanInfoSortingBlackList::NewLC( iFilterDb ); + CleanupStack::PopAndDestroy(); + } + } + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingblacklist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingblacklist.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,451 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfWlanInfoSortingBlackList +* +*/ + + + +// EXTERNAL INCLUDES +#include +#include +#include +#include + +// CLASS HEADER +#include "wsfwlaninfosortingblacklist.h" + +// INTERNAL INCLUDES +#include +#include "wsfwlaninfoarray.h" +#include "wsfwlanssidselectiondlg2.h" +#include "wsflogger.h" + + +/** +* SSID array granularity +*/ +static const TInt KIntSsidArrayGranularity = 3; + +/** +* SSID blacklist table name in DB +*/ +_LIT( KBlackListTableName,"WIZARD_BLACKLIST"); + +/** +* SSID column name in blacklist table +*/ +_LIT( KBlackListTableIdColumnName,"WIZARD_BLACKLIST_SSID"); + + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingBlackList::NewLC +// ---------------------------------------------------------------------------- +// +CWsfWlanInfoSortingBlackList* CWsfWlanInfoSortingBlackList::NewLC( + RDbNamedDatabase& aDatabase ) + { + CWsfWlanInfoSortingBlackList* thisPtr = + new (ELeave) CWsfWlanInfoSortingBlackList( aDatabase ); + CleanupStack::PushL( thisPtr ); + thisPtr->ConstructL(); + return thisPtr; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingBlackList::NewL +// ---------------------------------------------------------------------------- +// +CWsfWlanInfoSortingBlackList* CWsfWlanInfoSortingBlackList::NewL( + RDbNamedDatabase& aDatabase ) + { + CWsfWlanInfoSortingBlackList* thisPtr = NewLC( aDatabase ); + CleanupStack::Pop( thisPtr ); + return thisPtr; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingBlackList::CWsfWlanInfoSortingBlackList +// ---------------------------------------------------------------------------- +// +CWsfWlanInfoSortingBlackList::CWsfWlanInfoSortingBlackList( + RDbNamedDatabase& aDatabase ): + iDefsDb( &aDatabase ) + { + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingBlackList::~CWsfWlanInfoSortingBlackList +// ---------------------------------------------------------------------------- +// +CWsfWlanInfoSortingBlackList::~CWsfWlanInfoSortingBlackList() + { + // free the blacklist entries... + if ( iBlackListSsids ) + { + iBlackListSsids->Reset(); + } + delete iBlackListSsids; + + iBlackListSsidTable.Close(); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingBlackList::ConstructL +// ---------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingBlackList::ConstructL() + { + CheckTableL(); + iBlackListSsids = new (ELeave) CDesC8ArrayFlat( KIntSsidArrayGranularity ); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingBlackList::BlackListItemCount +// ---------------------------------------------------------------------------- +// +TInt CWsfWlanInfoSortingBlackList::BlackListItemCount() const + { + return iBlackListSsids->Count(); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingBlackList::Compare +// ---------------------------------------------------------------------------- +// +TInt CWsfWlanInfoSortingBlackList::Compare( const TWsfWlanInfo& /*aInfoLeft*/, + const TWsfWlanInfo& /*aInfoRight*/ ) + { + return 0; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingBlackList::SetupOnRuleMatch +// ---------------------------------------------------------------------------- +// +TBool CWsfWlanInfoSortingBlackList::SetupOnRuleMatch( TWsfWlanInfo& aInfoLeft ) + { + // look through the ssid array - and look for a match + TInt rulePosition( 0 ); + + if ( aInfoLeft.BlackListEntry() ) + { + return ETrue; + } + + if ( iBlackListSsids->FindIsq( aInfoLeft.iSsid, rulePosition ) == 0 ) + { + // the rule matches.... + aInfoLeft.SetBlackListEntry( ETrue ); + return ETrue; + } + + return EFalse; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingBlackList::MarkMatchedFilterL +// ---------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingBlackList::MarkMatchedFilterL( + TWsfWlanInfo& aFilterEntry ) + { + aFilterEntry.SetBlackListEntry( ETrue ); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingBlackList::EditFilterDefsL +// ---------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingBlackList::EditFilterDefsL( + CWsfWlanInfoArray& aInfoArray ) + { + LOG_ENTERFN( "CWsfWlanInfoSortingBlackList::EditFilterDefsL" ); + + // ok - lets map aInfoArray contents and iBlackListSsids and build our selves + // a list of blacklist entries and current non sorted entries... + + // first loop through the aInfoArray and ... + + // make 16 bit copy of the ssid array... + TInt arrayItemCount( iBlackListSsids->Count() + aInfoArray.Count() ); + if ( !arrayItemCount ) + { + // there's nothing to edit + // just return before showing edit dialog + return; + } + + LOG_WRITE( "there are items to show" ); + CDesCArrayFlat *arrayOfItems = + new (ELeave) CDesCArrayFlat( arrayItemCount ); + CleanupStack::PushL( arrayOfItems ); + + + // go through the ssid's in aInfoArray and append them to the array + TInt wlanArrayCount( aInfoArray.Count() ); + TWsfWlanInfo* wlanInfo( NULL ); + TWsfWlanInfo* connectedWlan( NULL ); + for ( TInt loopCounter( 0 ); loopCounter < wlanArrayCount; ++loopCounter ) + { + wlanInfo = aInfoArray.At( loopCounter ); + +// formerly (custfav or hidden -> does not appear in the list): +// if ( wlanInfo->BrandId() || wlanInfo->Hidden() ) +// instead now (connected -> does not appear in the list): + if ( wlanInfo->Connected() ) + { + connectedWlan = wlanInfo; + continue; + } + HBufC* ssid = wlanInfo->GetSsidAsUnicodeLC(); + arrayOfItems->AppendL( *ssid ); + CleanupStack::PopAndDestroy( ssid ); + } + + // simple alphabetical sort + arrayOfItems->Sort(); + + LOG_WRITE( "items added, list sorted" ); + + + // now insert the already selected items onto the top + CArrayFix *selectedItems = new (ELeave) CArrayFixFlat( + arrayItemCount ); + CleanupStack::PushL( selectedItems ); + + HBufC* connectedSsid( NULL ); + if ( connectedWlan ) + { + connectedSsid = connectedWlan->GetSsidAsUnicodeLC(); + } + + TBool connectedBlacklisted( EFalse ); + + TInt blackListLength( iBlackListSsids->Count() ); + TInt index( 0 ); + for ( TInt loopCounter( 0 ); loopCounter < blackListLength; ++loopCounter ) + { + HBufC* ssidUnicode = TWsfWlanInfo::GetSsidAsUnicodeLC( + iBlackListSsids->MdcaPoint( loopCounter ) ); + + if ( !connectedWlan || ssidUnicode->Compare( *connectedSsid ) ) + { + // only add the ssid to the list if it is not connected right now + arrayOfItems->InsertL( index, *ssidUnicode ); + // these are already selected + selectedItems->AppendL( index ); + ++index; + } + else if ( connectedWlan && !ssidUnicode->Compare( *connectedSsid ) ) + { + connectedBlacklisted = ETrue; + } + + + CleanupStack::PopAndDestroy( ssidUnicode ); + } + + if ( !arrayOfItems->Count() ) + { + // there's nothing to edit + // just return before showing edit dialog + if ( connectedWlan ) + { + CleanupStack::PopAndDestroy( connectedSsid ); + } + + CleanupStack::PopAndDestroy( selectedItems ); + CleanupStack::PopAndDestroy( arrayOfItems ); + return; + } + + LOG_WRITE( "creating the dialog" ); + CWsfWlanSsidSelectionDlg2* dlg = CWsfWlanSsidSelectionDlg2::NewL( + *arrayOfItems, *selectedItems ); + dlg->PrepareLC( R_QTN_PREFERRED_FILTER_SELECTION_DIALOG2 ); + + LOG_WRITE( "launching the dialog" ); + if ( dlg->RunLD() ) + { + LOG_WRITE( "dialog closed" ); + // go throught the list of selected items... and store them... + iBlackListSsids->Reset(); + + TInt selectedCount( selectedItems->Count() ); + + for ( TInt loopCounter( 0 ); loopCounter < selectedCount; ++loopCounter ) + { + TPtrC ssid = arrayOfItems->MdcaPoint( selectedItems->At( + loopCounter ) ); + HBufC8* ssidUtf8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( + ssid ); + CleanupStack::PushL( ssidUtf8 ); + iBlackListSsids->AppendL( *ssidUtf8 ); + CleanupStack::PopAndDestroy( ssidUtf8 ); + } + + if ( connectedBlacklisted ) + { + HBufC8* ssidUtf8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( + *connectedSsid ); + CleanupStack::PushL( ssidUtf8 ); + iBlackListSsids->AppendL( *ssidUtf8 ); + CleanupStack::PopAndDestroy( ssidUtf8 ); + } + + iBlackListSsids->Sort(); + SaveDefsL(); + } + + if ( connectedWlan ) + { + CleanupStack::PopAndDestroy( connectedSsid ); + } + + CleanupStack::PopAndDestroy( selectedItems ); + CleanupStack::PopAndDestroy( arrayOfItems ); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingBlackList::ReadFilterDefsL +// ---------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingBlackList::ReadFilterDefsL() + { + RestoreDefsL(); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingBlackList::SaveDefsL +// ---------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingBlackList::SaveDefsL() + { + LOG_ENTERFN( "CWsfWlanInfoSortingBlackList::SaveDefsL" ); + + // clear the db-table + if ( iBlackListSsidTable.FirstL() != EFalse ) + { + do + { + iBlackListSsidTable.DeleteL(); + } + while ( iBlackListSsidTable.NextL() ); + } + + // and add the iBlackListSsids contents there.... + TInt ssidCount( iBlackListSsids->Count() ); + + if ( ssidCount ) + { + // there are items + CDbColSet* colSet = iBlackListSsidTable.ColSetL(); + CleanupStack::PushL( colSet ); + TDbColNo ssidColumnNumber = colSet->ColNo( + KBlackListTableIdColumnName ); + + for ( TInt i( 0 ); i < ssidCount; ++i ) + { + iBlackListSsidTable.InsertL(); + iBlackListSsidTable.SetColL( ssidColumnNumber, + iBlackListSsids->MdcaPoint( i ) ); + iBlackListSsidTable.PutL(); + } + CleanupStack::PopAndDestroy( colSet ); + } + + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingBlackList::RestoreDefsL +// ---------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingBlackList::RestoreDefsL() + { + LOG_ENTERFN( "CWsfWlanInfoSortingBlackList::RestoreDefsL" ); + iBlackListSsids->Reset(); + iBlackListSsidTable.Reset(); + // go through the table and fill the ssid array... + if ( iBlackListSsidTable.FirstL() ) + { + CDbColSet* colSet = iBlackListSsidTable.ColSetL(); + CleanupStack::PushL( colSet ); + TDbColNo ssidColumnNumber = colSet->ColNo( + KBlackListTableIdColumnName ); + do + { + iBlackListSsidTable.GetL(); + iBlackListSsids->AppendL( iBlackListSsidTable.ColDes8( + ssidColumnNumber ) ); + } + while ( iBlackListSsidTable.NextL() ); + + CleanupStack::PopAndDestroy( colSet ); + // sort the array... + iBlackListSsids->Sort(); + + } + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingBlackList::CheckTableL +// ---------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingBlackList::CheckTableL() + { + LOG_ENTERFN( "CWsfWlanInfoSortingBlackList::CheckTableL" ); + + TInt tableStatus = iBlackListSsidTable.Open( *iDefsDb, + KBlackListTableName ); + if ( tableStatus == KErrNotFound ) + { + // the table does not exist... create it + CDbColSet *ssidTableColumnSet = CDbColSet::NewLC(); + + ssidTableColumnSet->AddL( TDbCol( KBlackListTableIdColumnName, + EDbColText8 ) ); + + iDefsDb->Begin(); + User::LeaveIfError( iDefsDb->CreateTable( KBlackListTableName, + *ssidTableColumnSet ) ); + iDefsDb->Commit(); + + CleanupStack::PopAndDestroy( ssidTableColumnSet ); + } + + if ( tableStatus != KErrNone ) + { + User::LeaveIfError( iBlackListSsidTable.Open( *iDefsDb, + KBlackListTableName ) ); + } + } + + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingbrand.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingbrand.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,458 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfWlanInfoSortingBrand +* +*/ + + + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include +#include + +// CLASS HEADER +#include "wsfwlaninfosortingbrand.h" + + + +/** +* Compare result: left-hand item goes first +*/ +static const TInt KLeftFirst = -1; + +/** +* Compare result: right-hand item goes first +*/ +static const TInt KRightFirst = 1; + + + +#ifdef _DEBUG + // Add own assert debug + // implementation if needed + #define __ASSERTD( cond ) +#else + #define __ASSERTD( cond ) +#endif //_DEBUG + + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingBrand::TBrandableItem::TBrandableItem +// --------------------------------------------------------------------------- +// +CWsfWlanInfoSortingBrand::TBrandableItem::TBrandableItem(): + iSsid( KNullDesC8 ), + iBrandId( 0 ) + { + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingBrand::TBrandableItem::TBrandableItem +// --------------------------------------------------------------------------- +// +CWsfWlanInfoSortingBrand::TBrandableItem::TBrandableItem( const TDesC8& aSsid, + const TInt8 aBrandId ): + iSsid( aSsid ), + iBrandId( aBrandId ) + { + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingBrand::TBrandableItem::Match +// --------------------------------------------------------------------------- +// +TBool CWsfWlanInfoSortingBrand::TBrandableItem::Match( + const TBrandableItem& aItemLeft, + const TBrandableItem& aItemRight ) + { + return aItemLeft.iSsid.Compare( aItemRight.iSsid ) == 0; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingBrand::TBrandableItem::SortByBrandId +// --------------------------------------------------------------------------- +// +TInt CWsfWlanInfoSortingBrand::TBrandableItem::SortByBrandId( + const TBrandableItem& aItemLeft, + const TBrandableItem& aItemRight ) + { + return aItemLeft.iBrandId - aItemRight.iBrandId; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingBrand::TBrandableItem::SortBySsid +// --------------------------------------------------------------------------- +// +TInt CWsfWlanInfoSortingBrand::TBrandableItem::SortBySsid( + const TBrandableItem& aItemLeft, + const TBrandableItem& aItemRight ) + { + return aItemLeft.iSsid.Compare( aItemRight.iSsid ); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingBrand::NewLC +// --------------------------------------------------------------------------- +// +CWsfWlanInfoSortingBrand* CWsfWlanInfoSortingBrand::NewLC() + { + CWsfWlanInfoSortingBrand* thisPtr = + new (ELeave) CWsfWlanInfoSortingBrand(); + CleanupStack::PushL( thisPtr ); + thisPtr->ConstructL(); + return thisPtr; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingBrand::NewL +// --------------------------------------------------------------------------- +// +CWsfWlanInfoSortingBrand* CWsfWlanInfoSortingBrand::NewL() + { + CWsfWlanInfoSortingBrand* thisPtr = NewLC(); + CleanupStack::Pop( thisPtr ); + return thisPtr; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingBrand::CWsfWlanInfoSortingBrand +// --------------------------------------------------------------------------- +// +CWsfWlanInfoSortingBrand::CWsfWlanInfoSortingBrand(): + iBitmapFileName( NULL ), + iBrandingDataOk( EFalse ) + { + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingBrand::~CWsfWlanInfoSortingBrand +// --------------------------------------------------------------------------- +// +CWsfWlanInfoSortingBrand::~CWsfWlanInfoSortingBrand() + { + delete iBitmapFileName; + iBrandItemArray.ResetAndDestroy(); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingBrand::ConstructL +// --------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingBrand::ConstructL() + { + // nothing to do... + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingBrand::Compare +// --------------------------------------------------------------------------- +// +TInt CWsfWlanInfoSortingBrand::Compare( const TWsfWlanInfo& aLeft, + const TWsfWlanInfo& aRight ) + { + TInt ret( 0 ); + + // connected goes first + if ( aLeft.Connected() ) + { + ret = KLeftFirst; + } + else if ( aRight.Connected() ) + { + ret = KRightFirst; + } + + // then customer favourite networks + else if ( aLeft.BrandId() ) + { + if ( aRight.BrandId() ) + { + // smaller brand id first + ret = aLeft.BrandId() - aRight.BrandId(); + } + else + { + ret = KLeftFirst; + } + } + else if ( aRight.BrandId() ) + { + ret = KRightFirst; + } + + + // then known networks + else if ( aLeft.Known() && !aRight.Known() ) + { + ret = KLeftFirst; + } + else if ( !aLeft.Known() && aRight.Known() ) + { + ret = KRightFirst; + } + + // finally SSID alphabetic order decides + else + { + if ( ( aLeft.iNetworkName.Length() ) && + ( aRight.iNetworkName.Length() ) ) + { + ret = aLeft.iNetworkName.CompareC( aRight.iNetworkName ); + } + else if ( aLeft.iNetworkName.Length() ) + { + ret = aLeft.iNetworkName.CompareC( aRight.iSsid ); + } + else if ( aRight.iNetworkName.Length() ) + { + ret = aLeft.iSsid.CompareC( aRight.iNetworkName ); + } + else + { + ret = aLeft.iSsid.CompareC( aRight.iSsid ); + } + } + + return ret; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingBrand::SetupOnRuleMatch +// --------------------------------------------------------------------------- +// +TBool CWsfWlanInfoSortingBrand::SetupOnRuleMatch( TWsfWlanInfo& aInfoLeft ) + { + TBool ret( EFalse ); + // check if the entry already has an branding flag on - return ETrue + + if ( iBrandingDataOk && !aInfoLeft.BrandId() ) + { + // using the ssid... try to find the ssid from iBrandItemArray + TBrandableItem item; + item.iSsid = aInfoLeft.iSsid; + + TLinearOrder findBinarySsid( + CWsfWlanInfoSortingBrand::TBrandableItem::SortBySsid ); + + TInt entryFindValue = iBrandItemArray.FindInOrder( &item, + findBinarySsid ); + if ( entryFindValue != KErrNotFound ) + { + // mark the entry... + aInfoLeft.SetBrand( + iBrandItemArray[entryFindValue]->iBrandId ); + ret = ETrue; + } + + } + + return ret; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingBrand::MarkMatchedFilterL +// --------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingBrand::MarkMatchedFilterL( + TWsfWlanInfo& /*aFilterEntry*/ ) + { + // we do not modify the contents in default filter... + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingBrand::EditFilterDefsL +// --------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingBrand::EditFilterDefsL( + CWsfWlanInfoArray& /*aInfoArray*/ ) + { + // we have hardcoded rules... we don't need editui.. + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingBrand::ReadFilterDefsL +// --------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingBrand::ReadFilterDefsL() + { + ReadBrandedSsidsL(); + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingBrand::ReadBrandedSsidsL +// --------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingBrand::ReadBrandedSsidsL() + { + iBrandItemArray.ResetAndDestroy(); + iBrandingDataOk = EFalse; + + TResourceReader reader; + CEikonEnv& env = *CEikonEnv::Static(); + env.CreateResourceReaderLC( reader, R_QTN_SSID_BRANDING ); + + delete iBitmapFileName; + iBitmapFileName = NULL; + + // ok - lets read the filename... + iBitmapFileName = reader.ReadHBufCL(); + + if ( iBitmapFileName ) // not iconfilename defined.... + { + // try to locate the icon file + TFindFile finder( env.FsSession() ); + + TParsePtrC parser( *iBitmapFileName ); + + TInt findError = finder.FindByDir( parser.NameAndExt(), + parser.Path() ); + + delete iBitmapFileName; + iBitmapFileName = NULL; + + if ( !findError ) + { + iBitmapFileName = finder.File().AllocL(); + + TInt brandedItemCount = reader.ReadInt16(); + TBrandableItem* brandableItem = NULL; + + CDesC8ArrayFlat* ssidArray = NULL; + TInt iconId( 0 ); + TInt maskId( 0 ); + + for ( TInt readCount( 0 ); readCount < brandedItemCount; + ++readCount ) + { + ssidArray = reader.ReadDesC8ArrayL(); + CleanupStack::PushL( ssidArray ); + + iconId = reader.ReadInt16(); + maskId = reader.ReadInt16(); + + TInt ssidCount( ssidArray->Count() ); + + for ( TInt ssidIter( 0 ); ssidIter < ssidCount; ssidIter++ ) + { + brandableItem = new (ELeave) TBrandableItem; + brandableItem->iSsid = ssidArray->MdcaPoint( ssidIter ); + brandableItem->iBrandId = readCount + 1; + brandableItem->iIconId = iconId; + brandableItem->iMaskId = maskId; + iBrandItemArray.AppendL( brandableItem ); + } + CleanupStack::PopAndDestroy( ssidArray ); + } + + // and to speed up the ssid match sort the array by ssid + TLinearOrder sortingRuleSSId( + CWsfWlanInfoSortingBrand::TBrandableItem::SortBySsid ); + + iBrandItemArray.Sort( sortingRuleSSId ); + iBrandingDataOk = ( iBrandItemArray.Count() > 0 ); + } + + } + + CleanupStack::PopAndDestroy(); //reader + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingBrand::AppendBrandIconsL +// --------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingBrand::AppendBrandIconsL( CAknIconArray& aIconArray ) + { + if ( iBrandingDataOk ) + { + // sort the array by brandid + TLinearOrder sortingRule( + CWsfWlanInfoSortingBrand::TBrandableItem::SortByBrandId ); + + iBrandItemArray.Sort( sortingRule ); + + + // loop here - load icon and append to array.... + TBrandableItem* item; + TInt brandArrayCount( iBrandItemArray.Count() ); + TInt brandId( 0 ); + for ( TInt loopCounter( 0 ); loopCounter < brandArrayCount; + ++loopCounter ) + { + item = iBrandItemArray[ loopCounter ]; + if ( item->iBrandId > brandId ) + { + brandId = item->iBrandId; + aIconArray.AppendL( MakeIconLC( item->iIconId, + item->iMaskId ) ); + CleanupStack::Pop(); // icon + } + } + + // and to speed up the ssid match sort the array by ssid + TLinearOrder sortingRuleSSId( + CWsfWlanInfoSortingBrand::TBrandableItem::SortBySsid ); + + iBrandItemArray.Sort( sortingRuleSSId ); + + } + + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingBrand::MakeIconLC +// --------------------------------------------------------------------------- +// +CGulIcon* CWsfWlanInfoSortingBrand::MakeIconLC( const TInt aIconId, + const TInt aMaskId ) + { + CGulIcon* icon = CGulIcon::NewLC(); + CFbsBitmap* bitmap( NULL ); + CFbsBitmap* mask( NULL ); + + // Creates bitmap an icon. + AknIconUtils::CreateIconL( bitmap, mask, *iBitmapFileName, + aIconId, aMaskId ); + + icon->SetBitmap( bitmap ); + icon->SetMask( mask ); + return icon; + } + + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingdbchangenotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingdbchangenotifier.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,160 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfWlanInfoSortingDbChangeNotifier +* +*/ + + + +// CLASS HEADER +#include "wsfwlaninfosortingdbchangenotifier.h" + +// INTERNAL INCLUDES +#include "wsfwlaninfosortingfiltervisitor.h" + + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingDbChangeNotifier::NewLC +// ---------------------------------------------------------------------------- +// +CWsfWlanInfoSortingDbChangeNotifier* + CWsfWlanInfoSortingDbChangeNotifier::NewLC( RDbDatabase& aDatabase ) + { + CWsfWlanInfoSortingDbChangeNotifier* thisPtr = + new (ELeave) CWsfWlanInfoSortingDbChangeNotifier( aDatabase ); + CleanupStack::PushL( thisPtr ); + thisPtr->ConstructL(); + return thisPtr; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingDbChangeNotifier::NewL +// ---------------------------------------------------------------------------- +// +CWsfWlanInfoSortingDbChangeNotifier* CWsfWlanInfoSortingDbChangeNotifier::NewL( + RDbDatabase& aDatabase ) + { + CWsfWlanInfoSortingDbChangeNotifier* thisPtr = NewLC( aDatabase ); + CleanupStack::Pop( thisPtr ); + return thisPtr; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingDbChangeNotifier::~CWsfWlanInfoSortingDbChangeNotifier +// ---------------------------------------------------------------------------- +// +CWsfWlanInfoSortingDbChangeNotifier::~CWsfWlanInfoSortingDbChangeNotifier() + { + Cancel(); + iDbAwareFilters.Reset(); + iNotifier.Close(); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingDbChangeNotifier::CWsfWlanInfoSortingDbChangeNotifier +// ---------------------------------------------------------------------------- +// +CWsfWlanInfoSortingDbChangeNotifier::CWsfWlanInfoSortingDbChangeNotifier( + RDbDatabase& aDatabase ): + CActive( CActive::EPriorityLow ), + iDatabase( &aDatabase ) + { + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingDbChangeNotifier::ConstructL +// ---------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingDbChangeNotifier::ConstructL() + { + User::LeaveIfError( iNotifier.Open( *iDatabase ) ); + CActiveScheduler::Add( this ); + + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingDbChangeNotifier::StartDbObservation +// ---------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingDbChangeNotifier::StartDbObservation() + { + iNotifier.NotifyChange( iStatus ); + SetActive(); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingDbChangeNotifier::DoCancel +// ---------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingDbChangeNotifier::DoCancel() + { + iNotifier.Cancel(); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingDbChangeNotifier::RunL +// ---------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingDbChangeNotifier::RunL() + { + if ( iStatus.Int() >= RDbNotifier::ECommit ) + { + TInt dbAwareFiltersCount( iDbAwareFilters.Count() ); + if ( dbAwareFiltersCount ) + { + TInt i( 0 ); + for ( ; i < dbAwareFiltersCount ; i++ ) + { + (iDbAwareFilters)[i]->ReadFilterDefsL(); + } + } + } + StartDbObservation(); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingDbChangeNotifier::AppendDbRelatedFilterL +// ---------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingDbChangeNotifier::AppendDbRelatedFilterL( + MWsfWlanInfoSortingFilterVisitor* aRelatedFilter ) + { + iDbAwareFilters.AppendL( aRelatedFilter ); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanInfoSortingDbChangeNotifier::RemoveDbRelatedFilter +// ---------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingDbChangeNotifier::RemoveDbRelatedFilter( + MWsfWlanInfoSortingFilterVisitor* aRelatedFilter ) + { + TInt index = iDbAwareFilters.Find( aRelatedFilter ); + if ( index != KErrNotFound ) + { + iDbAwareFilters.Remove( index ); + } + } + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingdefault.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingdefault.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,210 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfWlanInfoSortingDefault +* +*/ + + + +// CLASS HEADER +#include "wsfwlaninfosortingdefault.h" + +// INTERNAL INCLUDES +#include "wsfwlaninfo.h" + + +/** +* Compare result: left-hand item goes first +*/ +static const TInt KLeftFirst = -1; + +/** +* Compare result: right-hand item goes first +*/ +static const TInt KRightFirst = 1; + + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingDefault::NewLC +// --------------------------------------------------------------------------- +// +CWsfWlanInfoSortingDefault* CWsfWlanInfoSortingDefault::NewLC() + { + CWsfWlanInfoSortingDefault* thisPtr = + new (ELeave) CWsfWlanInfoSortingDefault(); + CleanupStack::PushL( thisPtr ); + thisPtr->ConstructL(); + return thisPtr; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingDefault::NewL +// --------------------------------------------------------------------------- +// +CWsfWlanInfoSortingDefault* CWsfWlanInfoSortingDefault::NewL() + { + CWsfWlanInfoSortingDefault* thisPtr = NewLC(); + CleanupStack::Pop( thisPtr ); + return thisPtr; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingDefault::CWsfWlanInfoSortingDefault +// --------------------------------------------------------------------------- +// +CWsfWlanInfoSortingDefault::CWsfWlanInfoSortingDefault() + { + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingDefault::~CWsfWlanInfoSortingDefault +// --------------------------------------------------------------------------- +// +CWsfWlanInfoSortingDefault::~CWsfWlanInfoSortingDefault() + { + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingDefault::ConstructL +// --------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingDefault::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingDefault::Compare +// --------------------------------------------------------------------------- +// +TInt CWsfWlanInfoSortingDefault::Compare( const TWsfWlanInfo& aLeft, + const TWsfWlanInfo& aRight ) + { + TInt ret( 0 ); + + // connected goes first + if ( aLeft.Connected() ) + { + ret = KLeftFirst; + } + else if ( aRight.Connected() ) + { + ret = KRightFirst; + } + + // then customer favourite networks + else if ( aLeft.BrandId() ) + { + if ( aRight.BrandId() ) + { + // smaller brand id first + ret = aLeft.BrandId() - aRight.BrandId(); + } + else + { + ret = KLeftFirst; + } + } + else if ( aRight.BrandId() ) + { + ret = KRightFirst; + } + + + // then known networks + else if ( aLeft.Known() && !aRight.Known() ) + { + ret = KLeftFirst; + } + else if ( !aLeft.Known() && aRight.Known() ) + { + ret = KRightFirst; + } + + // finally SSID alphabetic order decides + else + { + if ( ( aLeft.iNetworkName.Length() ) && + ( aRight.iNetworkName.Length() ) ) + { + ret = aLeft.iNetworkName.CompareC( aRight.iNetworkName ); + } + else if ( aLeft.iNetworkName.Length() ) + { + ret = aLeft.iNetworkName.CompareC( aRight.iSsid ); + } + else if ( aRight.iNetworkName.Length() ) + { + ret = aLeft.iSsid.CompareC( aRight.iNetworkName ); + } + else + { + ret = aLeft.iSsid.CompareC( aRight.iSsid ); + } + } + + return ret; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingDefault::SetupOnRuleMatch +// --------------------------------------------------------------------------- +// +TBool CWsfWlanInfoSortingDefault::SetupOnRuleMatch( TWsfWlanInfo& + /*aInfoLeft*/ ) + { + // as a default filter - every rules is a match + return ETrue; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingDefault::MarkMatchedFilterL +// --------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingDefault::MarkMatchedFilterL( + TWsfWlanInfo& /*aFilterEntry*/ ) + { + // we do not modify the contents in default filter... + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingDefault::EditFilterDefsL +// --------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingDefault::EditFilterDefsL( + CWsfWlanInfoArray& /*aInfoArray*/) + { + // we have hardcoded rules... we don't need editui.. + } + + +// --------------------------------------------------------------------------- +// CWsfWlanInfoSortingDefault::ReadFilterDefsL +// --------------------------------------------------------------------------- +// +void CWsfWlanInfoSortingDefault::ReadFilterDefsL() + { + // we have static definitions... nothing to do... + } + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlanssidselectiondlg2.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlanssidselectiondlg2.cpp Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,249 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CWsfWlanSsidSelectionDlg2 +* +*/ + + + +// EXTERNAL INCLUDES +#include +#include +#include +#include // CAknIcon +#include // akntitle pane +#include // CAknSingleGraphicStyleListBox + +// CLASS HEADER +#include "wsfwlanssidselectiondlg2.h" + +// INTERNAL INCLUDES +#include "wsfwlaninfosorting.hrh" +#include "wsflogger.h" + + +/** +* Format string for listbox items +*/ +_LIT( KFormatString, "1\t%S" ); + +/** +* Number of icons used +*/ +static const TInt KNumIcons = 2; + + + +// ---------------------------------------------------------------------------- +// CWsfWlanSsidSelectionDlg2::NewL +// ---------------------------------------------------------------------------- +// +CWsfWlanSsidSelectionDlg2* CWsfWlanSsidSelectionDlg2::NewL( + CDesCArrayFlat& aSsidArray, + CListBoxView::CSelectionIndexArray& aSelectionIndexArray ) + { + CWsfWlanSsidSelectionDlg2* self = NewLC( aSsidArray, + aSelectionIndexArray ); + CleanupStack::Pop( self ); + return self; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSsidSelectionDlg2::NewLC +// ---------------------------------------------------------------------------- +// +CWsfWlanSsidSelectionDlg2* CWsfWlanSsidSelectionDlg2::NewLC( + CDesCArrayFlat& aSsidArray, + CListBoxView::CSelectionIndexArray& aSelectionIndexArray ) + { + CWsfWlanSsidSelectionDlg2* self = new (ELeave) CWsfWlanSsidSelectionDlg2( + aSsidArray, aSelectionIndexArray ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSsidSelectionDlg2::ConstructL +// ---------------------------------------------------------------------------- +// +void CWsfWlanSsidSelectionDlg2::ConstructL() + { + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSsidSelectionDlg2::CWsfWlanSsidSelectionDlg2 +// ---------------------------------------------------------------------------- +// +CWsfWlanSsidSelectionDlg2::CWsfWlanSsidSelectionDlg2( + CDesCArrayFlat& aSsidArray, + CListBoxView::CSelectionIndexArray& aSelectionIndexArray ): + CAknListQueryDialog( &aSelectionIndexArray ), + iSsidArray( &aSsidArray ), + iSelectedItems( &aSelectionIndexArray ) + { + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSsidSelectionDlg2::~CWsfWlanSsidSelectionDlg2 +// ---------------------------------------------------------------------------- +// +CWsfWlanSsidSelectionDlg2::~CWsfWlanSsidSelectionDlg2() + { + // restore the title.... + if ( iTitle && iPane ) + { + iPane->SetText( iTitle ); + } + + iPane = NULL; + iTitle = NULL; + iSsidArray = NULL; + iSelectedItems = NULL; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSsidSelectionDlg2::OfferKeyEventL +// ---------------------------------------------------------------------------- +// +TKeyResponse CWsfWlanSsidSelectionDlg2::OfferKeyEventL( + const TKeyEvent& aKeyEvent, + TEventCode aType ) + { + if ( aKeyEvent.iCode == EKeyApplicationF ) + { + return EKeyWasConsumed; + } + else + { + return CAknListQueryDialog::OfferKeyEventL( aKeyEvent, aType ); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSsidSelectionDlg2::PreLayoutDynInitL +// ---------------------------------------------------------------------------- +// +void CWsfWlanSsidSelectionDlg2::PreLayoutDynInitL() + { + LOG_ENTERFN( "CWsfWlanSsidSelectionDlg2::PreLayoutDynInitL" ); + + CAknListQueryDialog::PreLayoutDynInitL(); + + CAknListQueryControl *control = static_cast( + Control( EListQueryControl ) ); + CEikListBox* listBox = control->Listbox(); + + CDesCArrayFlat *formattedSsids = new (ELeave) CDesCArrayFlat( + iSsidArray->Count() ); + CleanupStack::PushL( formattedSsids ); + CopyAndFormatArrayContentsL( iSsidArray, formattedSsids ); + + SetItemTextArray( formattedSsids ); + + CleanupStack::Pop( formattedSsids ); + + CAknIconArray* iconArray = CreateQueryIconArrayL(); + CleanupStack::PushL( iconArray ); + SetIconArrayL( iconArray ); + CleanupStack::Pop( iconArray ); + + for (TInt i = 0; i < iSelectedItems->Count(); i++) + { + listBox->View()->SelectItemL( (*iSelectedItems)[i] ); + } + + CEikStatusPane* statusPane = iAvkonAppUi->StatusPane(); + iPane = (CAknTitlePane*) statusPane->ControlL( + TUid::Uid( EEikStatusPaneUidTitle ) ); + iTitle = iPane->Text()->AllocL(); + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSsidSelectionDlg2::CopyAndFormatArrayContentsL +// ---------------------------------------------------------------------------- +// +void CWsfWlanSsidSelectionDlg2::CopyAndFormatArrayContentsL( + CDesCArrayFlat* aSource, + CDesCArrayFlat* aDest ) + { + TBuf<80> lineBuffer; + TInt sourceCount( aSource->Count() ); + for ( TInt i( 0 ) ; i < sourceCount ; i++ ) + { + const TDesC& item = aSource->MdcaPoint( i ); + lineBuffer.Format(KFormatString, &item ); + aDest->AppendL( lineBuffer ); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSsidSelectionDlg2::CreateQueryIconArrayL +// ---------------------------------------------------------------------------- +// +CAknIconArray* CWsfWlanSsidSelectionDlg2::CreateQueryIconArrayL() + { + CAknIconArray* iconarray = new( ELeave )CAknIconArray( KNumIcons ); + CleanupStack::PushL( iconarray ); + + const TDesC& iconfilename = AknIconUtils::AvkonIconFileName(); + + // empty + iconarray->AppendL( CreateIconLC( iconfilename, + EMbmAvkonQgn_prop_checkbox_on, + EMbmAvkonQgn_prop_checkbox_on_mask, + KAknsIIDQgnPropEmpty )); + CleanupStack::Pop(); // icon + + // copying + iconarray->AppendL(CreateIconLC( iconfilename, + EMbmAvkonQgn_prop_checkbox_off, + EMbmAvkonQgn_prop_checkbox_off_mask, + KAknsIIDNone )); + CleanupStack::Pop(); // icon + CleanupStack::Pop(); // iconarray + + + return iconarray; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSsidSelectionDlg2::CreateIconLC +// ---------------------------------------------------------------------------- +// +CGulIcon* CWsfWlanSsidSelectionDlg2::CreateIconLC( const TDesC& aFileName, + TInt aIcon, + TInt aMask, + const TAknsItemID& aID ) + { + MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); + + CGulIcon* icon = AknsUtils::CreateGulIconL( skinInstance, aID, aFileName, + aIcon, aMask ); + CleanupStack::PushL( icon ); + + return icon; + } + + + diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansniffer.pro --- a/wlanutilities/wlansniffer/wlansniffer.pro Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -# -# 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 project file. -# - -TEMPLATE = subdirs - -SUBDIRS += \ - wlansnifferapplication - -CONFIG += ordered - -# This enables compiling also the Symbian component from this level -BLD_INF_RULES.prj_exports += \ - "$${LITERAL_HASH}include \"./wlansnifferkeepalive/group/bld.inf\"" diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansniffer.h --- a/wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansniffer.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferengine.h --- a/wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferengine.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,154 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferlistitem.h --- a/wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferlistitem.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferlistview.h --- a/wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferlistview.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,158 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferlistwidget.h --- a/wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferlistwidget.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansniffermainwindow.h --- a/wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansniffermainwindow.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferservice.h --- a/wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferservice.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/res/hblistviewitem.css --- a/wlanutilities/wlansniffer/wlansnifferapplication/res/hblistviewitem.css Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ - -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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/res/hblistviewitem.widgetml --- a/wlanutilities/wlansniffer/wlansnifferapplication/res/hblistviewitem.widgetml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/res/listview.css --- a/wlanutilities/wlansniffer/wlansnifferapplication/res/listview.css Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -/* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/res/service_conf.xml --- a/wlanutilities/wlansniffer/wlansnifferapplication/res/service_conf.xml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ - - - wlansniffer - No path - WLAN Sniffer - - com.nokia.symbian.IWlanSniffer - 1.0 - WLAN Sniffer List View - - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/res/wlansniffer.qrc --- a/wlanutilities/wlansniffer/wlansnifferapplication/res/wlansniffer.qrc Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - - - - wlansnifferlistview.docml.bin - - - - listview.css - hblistviewitem.css - hblistviewitem.widgetml - - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/res/wlansnifferlistview.docml --- a/wlanutilities/wlansniffer/wlansnifferapplication/res/wlansnifferlistview.docml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - -
-
- - - - - - - - - - - - - -
- - - - - - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/rom/wlansniffer.iby --- a/wlanutilities/wlansniffer/wlansnifferapplication/rom/wlansniffer.iby Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/rom/wlansniffer_resources.iby --- a/wlanutilities/wlansniffer/wlansnifferapplication/rom/wlansniffer_resources.iby Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/src/main.cpp --- a/wlanutilities/wlansniffer/wlansnifferapplication/src/main.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/src/wlansniffer.cpp --- a/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansniffer.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,159 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferengine.cpp --- a/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferengine.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,452 +0,0 @@ -/* -* 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))); - - // Stop the scan - mWlanQtUtils->stopWlanScan(); - - // Stop periodic scan timer - 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferlistitem.cpp --- a/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferlistitem.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferlistview.cpp --- a/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferlistview.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,687 +0,0 @@ -/* -* 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 -#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"); - -//! WLAN Sniffer list view object name -static const QString WlanSnifferListViewName("occ_list"); - -// ======== 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) : - HbView(), - 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); - - // Pass the view to the document loader. Document loader uses this view - // when docml is parsed, instead of creating a new view. - setObjectName(WlanSnifferListViewName); - QObjectList objectList; - objectList.append(this); - mDocLoader->setObjectTree(objectList); - - // First load the common section - bool ok = false; - 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(WlanSnifferListViewName); - Q_ASSERT(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 = HbParameterLengthLimiter( - "txt_occ_grid_connecting_to_1").arg( - mEngine->wlanQtUtils()->iapName(iapId)); - break; - - case WlanQtUtils::ConnStatusConnected: - // WLAN is connected - Q_ASSERT(iapId != WlanQtUtils::IapIdNone); - status = HbParameterLengthLimiter( - "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( - HbParameterLengthLimiter( - "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( - HbParameterLengthLimiter( - "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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferlistwidget.cpp --- a/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferlistwidget.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,642 +0,0 @@ -/* -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/src/wlansniffermainwindow.cpp --- a/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansniffermainwindow.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,231 +0,0 @@ -/* -* 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::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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferservice.cpp --- a/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferservice.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -/* -* 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 - -#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 - QVariant titleInfo = info.info(XQINFO_KEY_WINDOW_TITLE); - QString title = titleInfo.toString(); - - OstTraceFunctionExit0(WLANSNIFFERSERVICE_TITLE_EXIT); - return title; -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/traces/OstTraceDefinitions.h --- a/wlanutilities/wlansniffer/wlansnifferapplication/traces/OstTraceDefinitions.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/tsrc/ctcmakeandruncases.cmd --- a/wlanutilities/wlansniffer/wlansnifferapplication/tsrc/ctcmakeandruncases.cmd Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +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 "Eclipse Public License v1.0" -:: which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/tsrc/ctcresults.cmd --- a/wlanutilities/wlansniffer/wlansnifferapplication/tsrc/ctcresults.cmd Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +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 "Eclipse Public License v1.0" -:: which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/tsrc/makeandruncases.cmd --- a/wlanutilities/wlansniffer/wlansnifferapplication/tsrc/makeandruncases.cmd Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +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 "Eclipse Public License v1.0" -:: which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/tsrc/t_wlansniffer.cpp --- a/wlanutilities/wlansniffer/wlansnifferapplication/tsrc/t_wlansniffer.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,563 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/tsrc/t_wlansniffer.h --- a/wlanutilities/wlansniffer/wlansnifferapplication/tsrc/t_wlansniffer.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/tsrc/t_wlansniffer.pro --- a/wlanutilities/wlansniffer/wlansnifferapplication/tsrc/t_wlansniffer.pro Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +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 "Eclipse Public License v1.0" -# which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferapplication/wlansnifferapplication.pro --- a/wlanutilities/wlansniffer/wlansnifferapplication/wlansnifferapplication.pro Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -# -# 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 - -DOCML += res/wlansnifferlistview.docml - -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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferkeepalive/group/bld.inf --- a/wlanutilities/wlansniffer/wlansnifferkeepalive/group/bld.inf Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferkeepalive/group/wsfkeepalive.mmp --- a/wlanutilities/wlansniffer/wlansnifferkeepalive/group/wsfkeepalive.mmp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepalive.h --- a/wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepalive.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,175 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepalivecmm.h --- a/wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepalivecmm.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepaliveconnmon.h --- a/wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepaliveconnmon.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepaliveconnmondisc.h --- a/wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepaliveconnmondisc.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepaliveesock.h --- a/wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepaliveesock.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepalivetimer.h --- a/wlanutilities/wlansniffer/wlansnifferkeepalive/inc/wsfkeepalivetimer.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferkeepalive/rom/wsfkeepalive.iby --- a/wlanutilities/wlansniffer/wlansnifferkeepalive/rom/wsfkeepalive.iby Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferkeepalive/src/main.cpp --- a/wlanutilities/wlansniffer/wlansnifferkeepalive/src/main.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepalive.cpp --- a/wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepalive.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,365 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepalivecmm.cpp --- a/wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepalivecmm.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepaliveconnmon.cpp --- a/wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepaliveconnmon.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,213 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepaliveconnmondisc.cpp --- a/wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepaliveconnmondisc.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepaliveesock.cpp --- a/wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepaliveesock.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,151 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepalivetimer.cpp --- a/wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepalivetimer.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferkeepalive/traces/OstTraceDefinitions.h --- a/wlanutilities/wlansniffer/wlansnifferkeepalive/traces/OstTraceDefinitions.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/wlansnifferkeepalive/traces/trace.properties --- a/wlanutilities/wlansniffer/wlansnifferkeepalive/traces/trace.properties Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ - - - - 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanutilities.pro --- a/wlanutilities/wlanutilities.pro Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -# -# 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 wlanutilities directory in wirelessacc package. -# - -TEMPLATE = subdirs - -SUBDIRS += \ - wlanqtutilities \ - eapwizard \ - wpswizard \ - wlanwizard \ - wlansniffer \ - wlanentryplugin \ - wlanindicatorplugin \ - cpwlansettingsplugin \ - wlanlogin - -CONFIG += ordered diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/bwins/wlanwizardu.def --- a/wlanutilities/wlanwizard/bwins/wlanwizardu.def Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -EXPORTS - ?qt_metacall@WlanWizard@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1 NONAME ; int WlanWizard::qt_metacall(enum QMetaObject::Call, int, void * *) - ?setParameters@WlanWizard@@QAEXABVQString@@HH_N1@Z @ 2 NONAME ; void WlanWizard::setParameters(class QString const &, int, int, 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/eabi/wlanwizardu.def --- a/wlanutilities/wlanwizard/eabi/wlanwizardu.def Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -EXPORTS - _ZN10WlanWizard11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME - _ZN10WlanWizard11qt_metacastEPKc @ 2 NONAME - _ZN10WlanWizard13setParametersERK7QStringiibb @ 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/inc/wlanwizard.h --- a/wlanutilities/wlanwizard/inc/wlanwizard.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +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 "Eclipse Public License v1.0" -* which accompanies 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); - ~WlanWizard(); - - void setParameters( - const QString &ssid, - int networkMode, - int securityMode, - bool usePsk, - 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/inc/wlanwizard_p.h --- a/wlanutilities/wlanwizard/inc/wlanwizard_p.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,192 +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 "Eclipse Public License v1.0" -* which accompanies 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 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/inc/wlanwizardhelper.h --- a/wlanutilities/wlanwizard/inc/wlanwizardhelper.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,210 +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 "Eclipse Public License v1.0" -* which accompanies 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: WLAN AP explicit scanning need - ConfWlanScanSSID = 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/inc/wlanwizardpage.h --- a/wlanutilities/wlanwizard/inc/wlanwizardpage.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,211 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/inc/wlanwizardpagegenericerror.h --- a/wlanutilities/wlanwizard/inc/wlanwizardpagegenericerror.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/inc/wlanwizardpageinternal.h --- a/wlanutilities/wlanwizard/inc/wlanwizardpageinternal.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/inc/wlanwizardpagekeyquery.h --- a/wlanutilities/wlanwizard/inc/wlanwizardpagekeyquery.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/inc/wlanwizardpagenetworkmode.h --- a/wlanutilities/wlanwizard/inc/wlanwizardpagenetworkmode.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +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 "Eclipse Public License v1.0" - * which accompanies 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, - bool wpsSupported); - void populateRadioButtonList(QStringList &list); - int selectNextPage(const WlanNetworkSetting &setting) const; - -private slots: - -private: - - /*! - * Internal network mode value constant. Used when wps used. - */ - static const int NetworkModeNone = -1; - - /*! - * 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; - - /*! - * List of wps support. This list is tied to the radio buttons during - * the initialization of the page. - */ - QList mWpsSupported; -}; - -/*! @} */ - -#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/inc/wlanwizardpageprocessingsettings.h --- a/wlanutilities/wlanwizard/inc/wlanwizardpageprocessingsettings.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/inc/wlanwizardpagescanning.h --- a/wlanutilities/wlanwizard/inc/wlanwizardpagescanning.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/inc/wlanwizardpagesecuritymode.h --- a/wlanutilities/wlanwizard/inc/wlanwizardpagesecuritymode.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/inc/wlanwizardpagessid.h --- a/wlanutilities/wlanwizard/inc/wlanwizardpagessid.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/inc/wlanwizardpagesummary.h --- a/wlanutilities/wlanwizard/inc/wlanwizardpagesummary.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/inc/wlanwizardplugin.h --- a/wlanutilities/wlanwizard/inc/wlanwizardplugin.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/inc/wlanwizardscanlist.h --- a/wlanutilities/wlanwizard/inc/wlanwizardscanlist.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +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 "Eclipse Public License v1.0" - * which accompanies 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: - //! Enumerated value defined by CMManagerShim::WlanSecMode - int mode; - - //! true, if passkey is required, false otherwise - bool usePsk; - - /*! - * Identifier of the next page associated with this security mode. - * Page ids are defined in WlanWizardPageInternal::WlanPageIds - */ - 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: - //! Enumerated value defined by CMManagerShim::WlanConnMode - int mode; - - //! true, if hidden, false otherwise - bool hidden; - - //! true, if supported, false otherwise - 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; - bool wpsSelected() const; - -private: - // Disabling implicit assignment operator - WlanWizardScanList &operator=(const WlanWizardScanList &); - -private: - QHash > mOpenOptions; - bool mWpsSelected; -}; - -/*! - * This macro makes WlanWizardScanList QVariant-compatible. - */ -Q_DECLARE_METATYPE(WlanWizardScanList) - -/*! @} */ - -#endif /* WLANWIZARDSCANLIST_H_ */ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/inc/wlanwizardsummaryviewitem.h --- a/wlanutilities/wlanwizard/inc/wlanwizardsummaryviewitem.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/inc/wlanwizardutils.h --- a/wlanutilities/wlanwizard/inc/wlanwizardutils.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/resources/custom.css --- a/wlanutilities/wlanwizard/resources/custom.css Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/resources/hblistviewitem.css --- a/wlanutilities/wlanwizard/resources/hblistviewitem.css Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ - -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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/resources/hblistviewitem.widgetml --- a/wlanutilities/wlanwizard/resources/hblistviewitem.widgetml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/resources/occ_add_wlan_01_04.docml --- a/wlanutilities/wlanwizard/resources/occ_add_wlan_01_04.docml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - -
- - - - - -
diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/resources/occ_add_wlan_02_03.docml --- a/wlanutilities/wlanwizard/resources/occ_add_wlan_02_03.docml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - -
- - - - - -
diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/resources/occ_add_wlan_05.docml --- a/wlanutilities/wlanwizard/resources/occ_add_wlan_05.docml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ - - - - - - - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/resources/occ_add_wlan_06.docml --- a/wlanutilities/wlanwizard/resources/occ_add_wlan_06.docml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
-
- - - - - - - - - - - - - -
- - - - - -
diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/resources/occ_add_wlan_error.docml --- a/wlanutilities/wlanwizard/resources/occ_add_wlan_error.docml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/resources/occ_wlan_wizard_main.docml --- a/wlanutilities/wlanwizard/resources/occ_wlan_wizard_main.docml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/resources/resource.qrc --- a/wlanutilities/wlanwizard/resources/resource.qrc Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ - - - occ_wlan_wizard_main.docml.bin - occ_add_wlan_05.docml.bin - occ_add_wlan_06.docml.bin - occ_add_wlan_02_03.docml.bin - occ_add_wlan_01_04.docml.bin - occ_add_wlan_error.docml.bin - - - custom.css - - - hblistviewitem.css - hblistviewitem.widgetml - - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/rom/wlanwizard.iby --- a/wlanutilities/wlanwizard/rom/wlanwizard.iby Tue Aug 31 16:18:40 2010 +0300 +++ /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: -* 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/rom/wlanwizard_resources.iby --- a/wlanutilities/wlanwizard/rom/wlanwizard_resources.iby Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/src/wlanwizard.cpp --- a/wlanutilities/wlanwizard/src/wlanwizard.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,172 +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 "Eclipse Public License v1.0" -* which accompanies 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-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] wps is Wifi Protected Setup supported? - */ -void WlanWizard::setParameters( - const QString &ssid, - int networkMode, - int securityMode, - bool usePsk, - bool wps) -{ - d_ptr->setParameters(ssid, networkMode, securityMode, usePsk, 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/src/wlanwizard_p.cpp --- a/wlanutilities/wlanwizard/src/wlanwizard_p.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1300 +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 "Eclipse Public License v1.0" -* which accompanies 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 - -// 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) -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_WLANWIZARDPRIVATE_ENTRY); - - OstTrace1( - TRACE_BORDER, - WLANWIZARDPRIVATE_WLANWIZARDPRIVATE, - "WlanWizardPrivate::WlanWizardPrivate;this=%x", - this); - - // Set initial values for configurations - setConfiguration(ConfIapId, WlanQtUtils::IapIdNone); - setConfiguration(ConfConnected, false); - setConfiguration(ConfWlanScanSSID, 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); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_WLANWIZARDPRIVATE_EXIT); -} - -/*! - Destructor. - */ -WlanWizardPrivate::~WlanWizardPrivate() -{ - OstTraceFunctionEntry0(DUP1_WLANWIZARDPRIVATE_WLANWIZARDPRIVATE_ENTRY); - - 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); - - OstTraceFunctionExit0(DUP1_WLANWIZARDPRIVATE_WLANWIZARDPRIVATE_EXIT); -} - -/*! - See WlanWizard::setParameters(). - */ -void WlanWizardPrivate::setParameters( - const QString &ssid, - int networkMode, - int securityMode, - bool usePsk, - bool wps) -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_SETPARAMETERS_ENTRY); - - OstTrace1( - TRACE_BORDER, - WLANWIZARDPRIVATE_SETPARAMETERS, - "WlanWizardPrivate::setParameters;this=%x", - this); - - mFirstPageId = getNextPageId( - ssid, - networkMode, - securityMode, - usePsk, - false, - wps); - - OstTrace1( - TRACE_BORDER, - WLANWIZARDPRIVATE_SETPARAMETERS_DONE, - "WlanWizardPrivate::setParameters - Done;this=%x", - this); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_SETPARAMETERS_EXIT); -} - -/*! - See WlanWizard::show(). - */ -void WlanWizardPrivate::show() -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_SHOW_ENTRY); - - 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); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_SHOW_EXIT); -} - -/*! - 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) -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_GETNEXTPAGEID_ENTRY); - - setConfiguration(ConfProcessSettings, true); - setConfiguration(ConfSsid, ssid); - setConfiguration(ConfNetworkMode, networkMode); - setConfiguration(ConfSecurityMode, securityMode); - setConfiguration(ConfUsePsk, usePsk); - setConfiguration(ConfWlanScanSSID, hidden); - - OstTrace1( - TRACE_NORMAL, - WLANWIZARDPRIVATE_GETNEXTPAGEID, - "WlanWizardPrivate::getNextPageId;wps=%u", - wps); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_GETNEXTPAGEID_EXIT); - 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 -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_WLANQTUTILS_ENTRY); - - Q_ASSERT(mWlanQtUtils.data()); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_WLANQTUTILS_EXIT); - 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 -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_WLANWIZARDPLUGIN_ENTRY); - - WlanWizardPlugin* plugin = NULL; - - if (isEapEnabled()) { - plugin = mEapWizard.data(); - Q_ASSERT(plugin); - } - - OstTrace1( - TRACE_NORMAL, - WLANWIZARDPRIVATE_WLANWIZARDPLUGIN, - "WlanWizardPrivate::wlanWizardPlugin;plugin=%x", - plugin); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_WLANWIZARDPLUGIN_EXIT); - 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 -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_ISEAPENABLED_ENTRY); - - 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); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_ISEAPENABLED_EXIT); - return ret; -} - -/*! - Creates new iap or updates existing iap. - - @return false in case IAP creation/update failed. - */ -bool WlanWizardPrivate::handleIap() -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_HANDLEIAP_ENTRY); - - 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, false); - wlanAp.setValue(WlanQtUtilsAp::ConfIdWlanScanSSID, configuration(ConfWlanScanSSID)); - - 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); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_HANDLEIAP_EXIT); - return ret; -} - -/*! - See WlanWizardHelper::configuration(). - */ -QVariant WlanWizardPrivate::configuration(ConfigurationId confId) const -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_CONFIGURATION_ENTRY); - - 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 - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_CONFIGURATION_EXIT); - return mConfigurations[confId]; -} - -/*! - See WlanWizardHelper::setConfiguration(). - */ -void WlanWizardPrivate::setConfiguration( - ConfigurationId confId, - const QVariant &value) -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_SETCONFIGURATION_ENTRY); - -#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; - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_SETCONFIGURATION_EXIT); -} - -/*! - * See WlanWizardHelper::clearConfiguration(). - */ -void WlanWizardPrivate::clearConfiguration(ConfigurationId confId) -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_CLEARCONFIGURATION_ENTRY); - - OstTrace1( - TRACE_FLOW, - WLANWIZARDPRIVATE_CLEARCONFIGURATION, - "WlanWizardPrivate::clearConfiguration;confId=%{ConfigurationId}", - (uint)confId); - - mConfigurations.remove(confId); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_CLEARCONFIGURATION_EXIT); -} - -/*! - * See WlanWizardHelper::configurationExists(). - */ -bool WlanWizardPrivate::configurationExists(ConfigurationId confId) -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_CONFIGURATIONEXISTS_ENTRY); - - OstTrace1( - TRACE_DUMP, - WLANWIZARDPRIVATE_CONFIGURATIONEXISTS, - "WlanWizardPrivate::configurationExists;confId=%{ConfigurationId}", - (uint)confId); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_CONFIGURATIONEXISTS_EXIT); - return mConfigurations[confId].isValid(); -} - -/*! - See WlanWizardHelper::enableNextButton(). - */ -void WlanWizardPrivate::enableNextButton(bool enable) -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_ENABLENEXTBUTTON_ENTRY); - - OstTraceExt2( - TRACE_FLOW, - WLANWIZARDPRIVATE_ENABLENEXTBUTTON, - "WlanWizardPrivate::enableNextButton;this=%x;enable=%x", - (unsigned)this, - (uint)enable); - mActionNext->setEnabled(enable); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_ENABLENEXTBUTTON_EXIT); -} - -/*! - See WlanWizardHelper::addPage(). - */ -void WlanWizardPrivate::addPage(int pageId, WlanWizardPage *page) -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_ADDPAGE_ENTRY); - - 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; - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_ADDPAGE_EXIT); -} - -/*! - See WlanWizardHelper::nextPage(). - */ -void WlanWizardPrivate::nextPage() -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_NEXTPAGE_ENTRY); - - OstTrace1( - TRACE_FLOW, - WLANWIZARDPRIVATE_NEXTPAGE, - "WlanWizardPrivate::nextPage;this=%x", - this); - - mPageFinished = true; - toNextPage(); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_NEXTPAGE_EXIT); -} - -/*! - See WlanWizardHelper::mainWindow(). - */ -HbMainWindow* WlanWizardPrivate::mainWindow() const -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_MAINWINDOW_ENTRY); - OstTraceFunctionExit0(WLANWIZARDPRIVATE_MAINWINDOW_EXIT); - return mMainWindow; -} - -/*! - See WlanWizardHelper::isCurrentPage(). - */ -bool WlanWizardPrivate::isCurrentPage(const HbWidget *page) const -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_ISCURRENTPAGE_ENTRY); - - bool ret = false; - if (mStackedWidget->currentWidget() == page) { - ret = true; - } - - OstTraceExt2( - TRACE_FLOW, - WLANWIZARDPRIVATE_ISCURRENTPAGE, - "WlanWizardPrivate::isCurrentPage;page=%x;ret=%d", - (uint)page, - ret); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_ISCURRENTPAGE_EXIT); - return ret; -} - -/*! - See WlanWizardHelper::nextPageId() - */ -int WlanWizardPrivate::nextPageId(bool useWps) -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_NEXTPAGEID_ENTRY); - - 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); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_NEXTPAGEID_EXIT); - 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() -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_CANCELTRIGGERED_ENTRY); - - 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); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_CANCELTRIGGERED_EXIT); -} - -/*! - 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() -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_PREVIOUSTRIGGERED_ENTRY); - - 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); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_PREVIOUSTRIGGERED_EXIT); -} - -/*! - 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() -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_NEXTTRIGGERED_ENTRY); - - 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); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_NEXTTRIGGERED_EXIT); -} - -/*! - Finish button has been pressed. Closes the wizard and sends finished() - signal to the client. - */ -void WlanWizardPrivate::finishTriggered() -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_FINISHTRIGGERED_ENTRY); - - 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); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_FINISHTRIGGERED_EXIT); -} - -/*! - 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() -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_ONTIMEOUT_ENTRY); - - OstTrace1( - TRACE_BORDER, - WLANWIZARDPRIVATE_ONTIMEOUT, - "WlanWizardPrivate::onTimeOut;this=%x", - this); - - toNextPage(); - - OstTrace1( - TRACE_BORDER, - WLANWIZARDPRIVATE_ONTIMEOUT_DONE, - "WlanWizardPrivate::onTimeOut - Done;this=%x", - this); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_ONTIMEOUT_EXIT); -} - -/*! - Slot to start wizard page operation asynchronous. Starts also the timer - to protect the wizard page. - */ -void WlanWizardPrivate::startPageOperation() -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_STARTPAGEOPERATION_ENTRY); - - // 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); - } - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_STARTPAGEOPERATION_EXIT); -} - -/*! - In case the wizard page uses timer protection this method determines when - the next page is shown. - */ -void WlanWizardPrivate::toNextPage() -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_TONEXTPAGE_ENTRY); - - 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); - } - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_TONEXTPAGE_EXIT); -} - -/*! - 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) -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_SHOWPAGE_ENTRY); - - 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) { - OstTraceFunctionExit0(WLANWIZARDPRIVATE_SHOWPAGE_EXIT); - 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); - } - - OstTraceFunctionExit0(DUP1_WLANWIZARDPRIVATE_SHOWPAGE_EXIT); -} - -/*! - Creates all control objects of WLAN wizard pages which are inherited from - WlanWizardPage and adds those into a internal database. - */ -void WlanWizardPrivate::createPages() -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_CREATEPAGES_ENTRY); - - 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)); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_CREATEPAGES_EXIT); -} - -/*! - Called when wizard is closed - - cancelled by the user - - finished by the user - */ -void WlanWizardPrivate::closeViews() -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_CLOSEVIEWS_ENTRY); - - mDialog->hide(); - mClosed = true; - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_CLOSEVIEWS_EXIT); -} - -/*! - 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) -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_UPDATEFRAME_ENTRY); - - 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); - } - } - } - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_UPDATEFRAME_EXIT); -} - -/*! - Loads widgets and objects from the docml file. - */ -void WlanWizardPrivate::loadDocml() -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_LOADDOCML_ENTRY); - - 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); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_LOADDOCML_EXIT); -} - -/*! - Disconnect receiving triggered() signal from any toolbar action. - */ -void WlanWizardPrivate::disconnectActions() -{ - OstTraceFunctionEntry0(WLANWIZARDPRIVATE_DISCONNECTACTIONS_ENTRY); - - 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())); - - OstTraceFunctionExit0(WLANWIZARDPRIVATE_DISCONNECTACTIONS_EXIT); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/src/wlanwizardpagegenericerror.cpp --- a/wlanutilities/wlanwizard/src/wlanwizardpagegenericerror.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +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 "Eclipse Public License v1.0" - * which accompanies 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" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlanwizardpagegenericerrorTraces.h" -#endif - -#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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEGENERICERROR_WLANWIZARDPAGEGENERICERROR_ENTRY ); - OstTraceFunctionExit0( WLANWIZARDPAGEGENERICERROR_WLANWIZARDPAGEGENERICERROR_EXIT ); -} - -/*! - Destructor. - */ -WlanWizardPageGenericError::~WlanWizardPageGenericError() -{ - OstTraceFunctionEntry0( DUP1_WLANWIZARDPAGEGENERICERROR_WLANWIZARDPAGEGENERICERROR_ENTRY ); - // signals are automatically disconnected - OstTraceFunctionExit0( DUP1_WLANWIZARDPAGEGENERICERROR_WLANWIZARDPAGEGENERICERROR_EXIT ); -} - -/*! - See WlanWizardPage::initializePage() - */ -HbWidget* WlanWizardPageGenericError::initializePage() -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEGENERICERROR_INITIALIZEPAGE_ENTRY ); - // 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()); - - OstTraceFunctionExit0( WLANWIZARDPAGEGENERICERROR_INITIALIZEPAGE_EXIT ); - return mWidget; -} - -/*! - See WlanWizardPage::showPage() - - @return false. Next button is dimmed when the page is displayed. - */ -bool WlanWizardPageGenericError::showPage() -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEGENERICERROR_SHOWPAGE_ENTRY ); - OstTraceFunctionExit0( WLANWIZARDPAGEGENERICERROR_SHOWPAGE_EXIT ); - return false; -} - -/*! - See WlanWizardPage::previousTriggered() - - @return steps backwards - */ -int WlanWizardPageGenericError::previousTriggered() -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEGENERICERROR_PREVIOUSTRIGGERED_ENTRY ); - OstTraceFunctionExit0( WLANWIZARDPAGEGENERICERROR_PREVIOUSTRIGGERED_EXIT ); - return mWizard->configuration( - WlanWizardHelper::ConfGenericErrorPageStepsBackwards).toInt(); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/src/wlanwizardpageinternal.cpp --- a/wlanutilities/wlanwizard/src/wlanwizardpageinternal.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +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 "Eclipse Public License v1.0" - * which accompanies 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" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlanwizardpageinternalTraces.h" -#endif - - -/*! - \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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEINTERNAL_WLANWIZARDPAGEINTERNAL_ENTRY ); - OstTraceFunctionExit0( WLANWIZARDPAGEINTERNAL_WLANWIZARDPAGEINTERNAL_EXIT ); -} - -/*! - Destructor. - */ -WlanWizardPageInternal::~WlanWizardPageInternal() -{ - OstTraceFunctionEntry0( DUP1_WLANWIZARDPAGEINTERNAL_WLANWIZARDPAGEINTERNAL_ENTRY ); - OstTraceFunctionExit0( DUP1_WLANWIZARDPAGEINTERNAL_WLANWIZARDPAGEINTERNAL_EXIT ); -} - - -/*! - 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 -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEINTERNAL_LOADDOCMLSECTION_ENTRY ); - 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); - } - OstTraceFunctionExit0( WLANWIZARDPAGEINTERNAL_LOADDOCMLSECTION_EXIT ); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/src/wlanwizardpagekeyquery.cpp --- a/wlanutilities/wlanwizard/src/wlanwizardpagekeyquery.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,283 +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 "Eclipse Public License v1.0" - * which accompanies 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" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlanwizardpagekeyqueryTraces.h" -#endif - - -/*! - \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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEKEYQUERY_WLANWIZARDPAGEKEYQUERY_ENTRY ); - OstTraceFunctionExit0( WLANWIZARDPAGEKEYQUERY_WLANWIZARDPAGEKEYQUERY_EXIT ); -} - -/*! - Destructor. - */ -WlanWizardPageKeyQuery::~WlanWizardPageKeyQuery() -{ - OstTraceFunctionEntry0( DUP1_WLANWIZARDPAGEKEYQUERY_WLANWIZARDPAGEKEYQUERY_ENTRY ); - delete mDocLoader; - - // Wizard framework deletes the visualization (owns mWidget). - OstTraceFunctionExit0( DUP1_WLANWIZARDPAGEKEYQUERY_WLANWIZARDPAGEKEYQUERY_EXIT ); -} - -/*! - See WlanWizardPage::initializePage() - - Initializes the key query page and initializes objects based on the security - mode. - */ -HbWidget* WlanWizardPageKeyQuery::initializePage() -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEKEYQUERY_INITIALIZEPAGE_ENTRY ); - 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("txt_occ_dialog_enter_key_for_1").arg( - mWizard->configuration(WlanWizardPrivate::ConfSsid).toString())); - - OstTraceFunctionExit0( WLANWIZARDPAGEKEYQUERY_INITIALIZEPAGE_EXIT ); - 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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEKEYQUERY_LOADDOCMLSECTION_ENTRY ); - WlanWizardPageInternal::loadDocmlSection( - mDocLoader, - orientation, - ":/docml/occ_add_wlan_01_04.docml", - "portrait_section", - "landscape_section"); - OstTraceFunctionExit0( WLANWIZARDPAGEKEYQUERY_LOADDOCMLSECTION_EXIT ); -} - -/*! - 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 -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEKEYQUERY_NEXTID_ENTRY ); - 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; - OstTraceFunctionExit0( WLANWIZARDPAGEKEYQUERY_NEXTID_EXIT ); - return pageId; -} - -/*! - See WlanWizardPage::showPage() - */ -bool WlanWizardPageKeyQuery::showPage() -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEKEYQUERY_SHOWPAGE_ENTRY ); - // Open virtual keyboard by setting focus to line edit - mLineEdit->setFocus(); - - OstTraceFunctionExit0( WLANWIZARDPAGEKEYQUERY_SHOWPAGE_EXIT ); - 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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEKEYQUERY_EVENTFILTER_ENTRY ); - if (obj == mLineEdit && event->type() == QEvent::FocusIn) { - mLabelError->setPlainText(""); - } - OstTraceFunctionExit0( WLANWIZARDPAGEKEYQUERY_EVENTFILTER_EXIT ); - 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 -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEKEYQUERY_KEYSTATUSTOERRORSTRING_ENTRY ); - 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; - } - OstTraceFunctionExit0( WLANWIZARDPAGEKEYQUERY_KEYSTATUSTOERRORSTRING_EXIT ); - return errorString; -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/src/wlanwizardpagenetworkmode.cpp --- a/wlanutilities/wlanwizard/src/wlanwizardpagenetworkmode.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,321 +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 "Eclipse Public License v1.0" -* which accompanies 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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGENETWORKMODE_WLANWIZARDPAGENETWORKMODE_ENTRY ); - OstTraceFunctionExit0( WLANWIZARDPAGENETWORKMODE_WLANWIZARDPAGENETWORKMODE_EXIT ); -} - -/*! - * Destructor. Loader widget is deleted. - * All document widgets are deleted by wlanwizard_p destructor. - */ -WlanWizardPageNetworkMode::~WlanWizardPageNetworkMode() -{ - OstTraceFunctionEntry0( DUP1_WLANWIZARDPAGENETWORKMODE_WLANWIZARDPAGENETWORKMODE_ENTRY ); - delete mLoader; - OstTraceFunctionExit0( DUP1_WLANWIZARDPAGENETWORKMODE_WLANWIZARDPAGENETWORKMODE_EXIT ); -} - -/*! - * Page initialization. If view is already loaded, does nothing. - * Inherited from WlanWizardPage. - */ -HbWidget* WlanWizardPageNetworkMode::initializePage() -{ - OstTraceFunctionEntry0( WLANWIZARDPAGENETWORKMODE_INITIALIZEPAGE_ENTRY ); - 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); - - OstTraceFunctionExit0( WLANWIZARDPAGENETWORKMODE_INITIALIZEPAGE_EXIT ); - 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 -{ - OstTraceFunctionEntry0( WLANWIZARDPAGENETWORKMODE_NEXTID_ENTRY ); - removeFromStack = false; - WlanNetworkSetting setting; - int index = mList->selected(); - int nextPage = WlanWizardPageInternal::PageNetworkSecurity; - - if (mWpsSupported.at(index)) { - nextPage = WlanWizardPageInternal::PageWpsStart; - } - else { - setting.mode = mNetworkModes.at(index); - setting.hidden = mIsHidden.at(index); - setting.wpsSupported = mWpsSupported.at(index); - - mWizard->setConfiguration( - WlanWizardPrivate::ConfNetworkMode, - setting.mode); - - mWizard->setConfiguration( - WlanWizardPrivate::ConfWlanScanSSID, - setting.hidden); - - mWizard->setConfiguration( - WlanWizardPrivate::ConfWpsSupported, - setting.wpsSupported); - - if (mWizard->configurationExists(WlanWizardPrivate::ConfAvailableNetworkOptions)) { - nextPage = selectNextPage(setting); - } - } - OstTraceFunctionExit0( WLANWIZARDPAGENETWORKMODE_NEXTID_EXIT ); - return nextPage; -} - -/*! - * 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() -{ - OstTraceFunctionEntry0( WLANWIZARDPAGENETWORKMODE_SHOWPAGE_ENTRY ); - OstTraceFunctionExit0( WLANWIZARDPAGENETWORKMODE_SHOWPAGE_EXIT ); - return mValid; -} - -/*! - * This function is invoked when user selects a mode from the radio button list. - * (HbRadioButtonList's itemSelected-signal) - */ -void WlanWizardPageNetworkMode::itemSelected() -{ - OstTraceFunctionEntry0( WLANWIZARDPAGENETWORKMODE_ITEMSELECTED_ENTRY ); - OstTrace0( TRACE_BORDER, WLANWIZARDPAGENETWORKMODE_ITEMSELECTED, - "WlanWizardPageNetworkMode::itemSelected" ); - - mValid = true; - mWizard->enableNextButton(mValid); - OstTraceFunctionExit0( WLANWIZARDPAGENETWORKMODE_ITEMSELECTED_EXIT ); -} - -/*! - * 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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGENETWORKMODE_LOADDOCMLSECTION_ENTRY ); - 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"); - OstTraceFunctionExit0( WLANWIZARDPAGENETWORKMODE_LOADDOCMLSECTION_EXIT ); -} - -/*! - * 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. - * @param [in] wpsSupported is the possibility for wps support. - */ -void WlanWizardPageNetworkMode::addToList( - QStringList &list, - const QString &item, - int mode, - bool isHidden, - bool wpsSupported) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGENETWORKMODE_ADDTOLIST_ENTRY ); - - 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 - && modes[i].wpsSupported == wpsSupported) - || (modes[i].wpsSupported && wpsSupported) ) { - list << item; - mNetworkModes.append(mode); - mIsHidden.append(isHidden); - mWpsSupported.append(wpsSupported); - } - } - } - else { - list << item; - mNetworkModes.append(mode); - mIsHidden.append(isHidden); - // If there are no known network options, WPS is not allowed to be - // selected. - mWpsSupported.append(false); - } - OstTraceFunctionExit0( WLANWIZARDPAGENETWORKMODE_ADDTOLIST_EXIT ); -} - -/*! - * 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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGENETWORKMODE_POPULATERADIOBUTTONLIST_ENTRY ); - list.clear(); - mNetworkModes.clear(); - mIsHidden.clear(); - mWpsSupported.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, false); - - addToList(list, hbTrId("txt_occ_list_infrastructure_hidden"), - CMManagerShim::Infra, true, false); - - addToList(list, hbTrId("txt_occ_list_adhoc_1"), CMManagerShim::Adhoc, - false, false); - - if (mWizard->configurationExists(WlanWizardHelper::ConfAvailableNetworkOptions)) { - // addToList with wpsSupported=true is only called, when there are available - // scan result options. If no network options exist, the user can not get to - // wps wizard from this view. Also, mode and isHidden are "don't care". - addToList(list, hbTrId("txt_occ_list_wifi_protected_setup"), NetworkModeNone, false, true); - } - OstTraceFunctionExit0( WLANWIZARDPAGENETWORKMODE_POPULATERADIOBUTTONLIST_EXIT ); -} - -/*! - * 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 -{ - OstTraceFunctionEntry0( WLANWIZARDPAGENETWORKMODE_SELECTNEXTPAGE_ENTRY ); - - int nextPage = WlanWizardPageInternal::PageNetworkSecurity; - - 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); - nextPage = secMode.nextPageId; - } - - OstTraceFunctionExit0( DUP1_WLANWIZARDPAGENETWORKMODE_SELECTNEXTPAGE_EXIT ); - return nextPage; -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/src/wlanwizardpageprocessingsettings.cpp --- a/wlanutilities/wlanwizard/src/wlanwizardpageprocessingsettings.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,374 +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 "Eclipse Public License v1.0" -* which accompanies 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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEPROCESSINGSETTINGS_WLANWIZARDPAGEPROCESSINGSETTINGS_ENTRY ); - 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); - OstTraceFunctionExit0( WLANWIZARDPAGEPROCESSINGSETTINGS_WLANWIZARDPAGEPROCESSINGSETTINGS_EXIT ); -} - -/*! - Destructor. - */ -WlanWizardPageProcessingSettings::~WlanWizardPageProcessingSettings() -{ - OstTraceFunctionEntry0( DUP1_WLANWIZARDPAGEPROCESSINGSETTINGS_WLANWIZARDPAGEPROCESSINGSETTINGS_ENTRY ); - // signals are automatically disconnected - delete mDocLoader; - - // Wizard framework deletes the visualization (owns mWidget). - OstTraceFunctionExit0( DUP1_WLANWIZARDPAGEPROCESSINGSETTINGS_WLANWIZARDPAGEPROCESSINGSETTINGS_EXIT ); -} - -/*! - See WlanWizardPage::initializePage() - */ -HbWidget* WlanWizardPageProcessingSettings::initializePage() -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEPROCESSINGSETTINGS_INITIALIZEPAGE_ENTRY ); - 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( - "txt_occ_dialog_checking_connection_to_1").arg( - mWizard->configuration(WlanWizardPrivate::ConfSsid).toString())); - - OstTraceFunctionExit0( WLANWIZARDPAGEPROCESSINGSETTINGS_INITIALIZEPAGE_EXIT ); - return mWidget; -} - -/*! - See WlanWizardPage::nextId() - - @param [out] removeFromStack return value is always true - - @return WlanWizardPageInternal::PageSummary - */ -int WlanWizardPageProcessingSettings::nextId(bool &removeFromStack) const -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEPROCESSINGSETTINGS_NEXTID_ENTRY ); - removeFromStack = true; - OstTraceFunctionExit0( WLANWIZARDPAGEPROCESSINGSETTINGS_NEXTID_EXIT ); - return mNextPageId; -} - - -/*! - See WlanWizardPage::showPage() - - @return false. Next button is dimmed when the page is displayed. - */ -bool WlanWizardPageProcessingSettings::showPage() -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEPROCESSINGSETTINGS_SHOWPAGE_ENTRY ); - OstTraceFunctionExit0( WLANWIZARDPAGEPROCESSINGSETTINGS_SHOWPAGE_EXIT ); - 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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEPROCESSINGSETTINGS_LOADDOCMLSECTION_ENTRY ); - WlanWizardPageInternal::loadDocmlSection( - mDocLoader, - orientation, - ":/docml/occ_add_wlan_06.docml", - "portrait_section", - "landscape_section"); - OstTraceFunctionExit0( WLANWIZARDPAGEPROCESSINGSETTINGS_LOADDOCMLSECTION_EXIT ); -} - -/*! - 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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEPROCESSINGSETTINGS_WLANNETWORKCLOSED_ENTRY ); - OstTraceExt2( TRACE_BORDER, - WLANWIZARDPAGEPROCESSINGSETTINGS_WLANNETWORKCLOSED, - "WlanWizardPageProcessingSettings::wlanNetworkClosed;iapId=%d;reason=%d", - iapId, reason ); - - if (iapId != mWizard->configuration(WlanWizardHelper::ConfIapId).toInt()) { - OstTraceFunctionExit0( WLANWIZARDPAGEPROCESSINGSETTINGS_WLANNETWORKCLOSED_EXIT ); - 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" ); - OstTraceFunctionExit0( DUP1_WLANWIZARDPAGEPROCESSINGSETTINGS_WLANNETWORKCLOSED_EXIT ); -} - -/*! - 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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEPROCESSINGSETTINGS_ICTRESULT_ENTRY ); - OstTraceExt2( - TRACE_BORDER, - WLANWIZARDPAGEPROCESSINGSETTINGS_ICTRESULT, - "WlanWizardPageProcessingSettings::ictResult;iapId=%d;result=%d", - iapId, reason ); - - if (iapId != mWizard->configuration(WlanWizardHelper::ConfIapId).toInt()) { - OstTraceFunctionExit0( WLANWIZARDPAGEPROCESSINGSETTINGS_ICTRESULT_EXIT ); - 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" ); - OstTraceFunctionExit0( DUP1_WLANWIZARDPAGEPROCESSINGSETTINGS_ICTRESULT_EXIT ); -} - -/*! - Handles wlanNetworkOpened(int) signal from WlanQtUtils. - - @param [in] iapId IAP ID - */ -void WlanWizardPageProcessingSettings::wlanNetworkOpened(int iapId) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEPROCESSINGSETTINGS_WLANNETWORKOPENED_ENTRY ); - Q_UNUSED(iapId); - OstTrace1( - TRACE_BORDER, - WLANWIZARDPAGEPROCESSINGSETTINGS_WLANNETWORKOPENED, - "WlanWizardPageProcessingSettings::wlanNetworkOpened;iapId=%d", - iapId); - OstTraceFunctionExit0( WLANWIZARDPAGEPROCESSINGSETTINGS_WLANNETWORKOPENED_EXIT ); -} - -/*! - See WlanWizardPage::requiresStartOperation(). - - Indicates to framework that startOperation() needs to called. - */ -bool WlanWizardPageProcessingSettings::requiresStartOperation() -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEPROCESSINGSETTINGS_REQUIRESSTARTOPERATION_ENTRY ); - OstTraceFunctionExit0( WLANWIZARDPAGEPROCESSINGSETTINGS_REQUIRESSTARTOPERATION_EXIT ); - return true; -} - -/*! - See WlanWizardPage::startOperation(). - - Starts the page operation. - */ -void WlanWizardPageProcessingSettings::startOperation() -{ - OstTraceFunctionEntry0( WLANWIZARDPAGEPROCESSINGSETTINGS_STARTOPERATION_ENTRY ); - 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(); - } - OstTraceFunctionExit0( WLANWIZARDPAGEPROCESSINGSETTINGS_STARTOPERATION_EXIT ); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/src/wlanwizardpagescanning.cpp --- a/wlanutilities/wlanwizard/src/wlanwizardpagescanning.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,511 +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 "Eclipse Public License v1.0" -* which accompanies 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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_ENTRY ); - 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); - OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_EXIT ); -} - -/*! - * Destructor. Loader widget is deleted. - * All document widgets are deleted by wlanwizard_p destructor. - */ -WlanWizardPageScanning::~WlanWizardPageScanning() -{ - OstTraceFunctionEntry0( DUP1_WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_ENTRY ); - delete mLoader; - OstTraceFunctionExit0( DUP1_WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_EXIT ); -} - -/*! - * Page initialization. If view is already loaded, does nothing. Inherited from - * WlanWizardPage. - * @return pointer to widget "occ_add_wlan_06". - */ -HbWidget* WlanWizardPageScanning::initializePage() -{ - OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_INITIALIZEPAGE_ENTRY ); - 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( - "txt_occ_dialog_searching").arg(mWizard->configuration( - WlanWizardPrivate::ConfSsid).toString())); - - OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_INITIALIZEPAGE_EXIT ); - 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 -{ - OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_NEXTID_ENTRY ); - removeFromStack = true; - - OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_NEXTID_EXIT ); - 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() -{ - OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_PREVIOUSTRIGGERED_ENTRY ); - 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); - - OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_PREVIOUSTRIGGERED_EXIT ); - 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() -{ - OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_SHOWPAGE_ENTRY ); - mWizard->setConfiguration(WlanWizardHelper::ConfProcessSettings, false); - OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_SHOWPAGE_EXIT ); - 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() -{ - OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_REQUIRESSTARTOPERATION_ENTRY ); - OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_REQUIRESSTARTOPERATION_EXIT ); - 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() -{ - OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_STARTOPERATION_ENTRY ); - OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_STARTOPERATION, - "WlanWizardPageScanning::startOperation - start AP scan if results" - " are available." ); - - if (mScanResultsAvailable) { - mScanResultsAvailable = false; - wlanScanApReady(); - } - OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_STARTOPERATION_EXIT ); -} - -/*! - * 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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_LOADDOCMLSECTION_ENTRY ); - 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"); - OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_LOADDOCMLSECTION_EXIT ); -} - -/*! - * 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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK_ENTRY ); - 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; - } - } - OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK_EXIT ); -} - -/*! - * 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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY_ENTRY ); - 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); - OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY_EXIT ); -} - -/*! - * 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() -{ - OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANSCANAPREADY_ENTRY ); - 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(); - } - OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANSCANAPREADY_EXIT ); -} - -/*! - * 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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_GETSSIDMATCHLIST_ENTRY ); - 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); - } - } - OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_GETSSIDMATCHLIST_EXIT ); -} - -/* - * 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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_GETFINALSCANRESULTS_ENTRY ); - 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); - } - OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_GETFINALSCANRESULTS_EXIT ); -} - -/*! - * 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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_PROCESSMULTIPLESCANRESULTS_ENTRY ); - 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 (networkOptions.wpsSelected()) { - // In case all available network mode options support wps, go directly - // to wps-wizard. - nextPage = WlanWizardPageInternal::PageWpsStart; - } else if (networkOptions.netModes() > SingleResult) { - // If there are more than one network mode choices, go to manual selection - // of network mode. - 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::ConfWlanScanSSID, setting.hidden); - mWizard->setConfiguration(WlanWizardHelper::ConfWpsSupported, setting.wpsSupported); - nextPage = WlanWizardPageInternal::PageNetworkSecurity; - } - - OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_PROCESSMULTIPLESCANRESULTS_EXIT ); - 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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_SELECTNEXTPAGEACTIONS_ENTRY ); - 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(); - OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_SELECTNEXTPAGEACTIONS_EXIT ); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/src/wlanwizardpagesecuritymode.cpp --- a/wlanutilities/wlanwizard/src/wlanwizardpagesecuritymode.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,328 +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 "Eclipse Public License v1.0" -* which accompanies 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) -{ - OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_ENTRY); - OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_EXIT); -} - -/*! - * Destructor. Loader widget is deleted. - * All document widgets are deleted by wlanwizard_p destructor. - */ -WlanWizardPageSecurityMode::~WlanWizardPageSecurityMode() -{ - OstTraceFunctionEntry0(DUP1_WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_ENTRY); - - delete mLoader; - - OstTraceFunctionExit0(DUP1_WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_EXIT); -} - -/*! - * Page initialization. If view widget is already loaded, does nothing. - * @return pointer to widget "occ_add_wlan_02". - */ -HbWidget* WlanWizardPageSecurityMode::initializePage() -{ - OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_INITIALIZEPAGE_ENTRY); - - 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(); - - OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_INITIALIZEPAGE_EXIT); - 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 -{ - OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_NEXTID_ENTRY); - - 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())); - - OstTraceFunctionExit0(LANWIZARDPAGESECURITYMODE_NEXTID_EXIT); - 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() -{ - OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_SHOWPAGE_ENTRY); - OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_SHOWPAGE_EXIT); - return mValid; -} - -/*! - * Is invoked when user selects a mode from the radio button list. - * (HbRadioButtonList's itemSelected-signal) - */ -void WlanWizardPageSecurityMode::itemSelected() -{ - OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_ITEMSELECTED_ENTRY); - - OstTrace0( - TRACE_BORDER, - WLANWIZARDPAGESECURITYMODE_ITEMSELECTED, - "WlanWizardPageSecurityMode::itemSelected"); - - mValid = true; - mWizard->enableNextButton(mValid); - - OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_ITEMSELECTED_EXIT); -} - -/*! - * 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) -{ - OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_LOADDOCMLSECTION_ENTRY); - - 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"); - - OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_LOADDOCMLSECTION_EXIT); -} - -/*! - * Support function that creates the contents of the security mode list. - */ -void WlanWizardPageSecurityMode::populateSecModeList() -{ - OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_POPULATESECMODELIST_ENTRY); - - 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); - - OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_POPULATESECMODELIST_EXIT); -} - -/*! - * 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) -{ - OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_ADDTOLIST_ENTRY); - - if (mWizard->configurationExists(WlanWizardHelper::ConfAvailableNetworkOptions)) { - WlanNetworkSetting netMode; - netMode.mode = mWizard->configuration(WlanWizardPrivate::ConfNetworkMode).toInt(); - netMode.hidden = mWizard->configuration(WlanWizardPrivate::ConfWlanScanSSID).toBool(); - netMode.wpsSupported = mWizard->configuration(WlanWizardPrivate::ConfWpsSupported).toBool(); - 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); - } - - OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_ADDTOLIST_EXIT); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/src/wlanwizardpagessid.cpp --- a/wlanutilities/wlanwizard/src/wlanwizardpagessid.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,201 +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 "Eclipse Public License v1.0" -* which accompanies 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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGESSID_WLANWIZARDPAGESSID_ENTRY ); - - OstTraceFunctionExit0( WLANWIZARDPAGESSID_WLANWIZARDPAGESSID_EXIT ); -} - -/*! - * Destructor. Loader widget is deleted. - * All document widgets are deleted by wlanwizard_p destructor. - */ -WlanWizardPageSsid::~WlanWizardPageSsid() -{ - OstTraceFunctionEntry0( DUP1_WLANWIZARDPAGESSID_WLANWIZARDPAGESSID_ENTRY ); - delete mLoader; - OstTraceFunctionExit0( DUP1_WLANWIZARDPAGESSID_WLANWIZARDPAGESSID_EXIT ); -} - -/*! - * Page initialization. If view is already loaded, does nothing. - * @return pointer to widget "occ_add_wlan_01". - */ -HbWidget* WlanWizardPageSsid::initializePage() -{ - OstTraceFunctionEntry0( WLANWIZARDPAGESSID_INITIALIZEPAGE_ENTRY ); - 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); - - OstTraceFunctionExit0( WLANWIZARDPAGESSID_INITIALIZEPAGE_EXIT ); - 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() -{ - OstTraceFunctionEntry0( WLANWIZARDPAGESSID_SHOWPAGE_ENTRY ); - // Initiate the scanning of public APs here. - mWizard->wlanQtUtils()->scanWlanAps(); - - // Open virtual keyboard by setting focus to line edit - mSsid->setFocus(); - OstTraceFunctionExit0( WLANWIZARDPAGESSID_SHOWPAGE_EXIT ); - 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 -{ - OstTraceFunctionEntry0( WLANWIZARDPAGESSID_NEXTID_ENTRY ); - removeFromStack = false; - - // SSID is stored into configuration - mWizard->setConfiguration(WlanWizardPrivate::ConfSsid, mSsid->text()); - - OstTraceFunctionExit0( WLANWIZARDPAGESSID_NEXTID_EXIT ); - 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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGESSID_LOADDOCMLSECTION_ENTRY ); - 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"); - OstTraceFunctionExit0( WLANWIZARDPAGESSID_LOADDOCMLSECTION_EXIT ); -} - -/*! - * 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) -{ - OstTraceFunctionEntry0( WLANWIZARDPAGESSID_TEXTCHANGED_ENTRY ); - Q_UNUSED(text); - OstTrace0( TRACE_FLOW, WLANWIZARDPAGESSID_TEXTCHANGED, - "WlanWizardPageSsid::textChanged in text edit widget" ); - - mWizard->enableNextButton(!(mSsid->text().isEmpty())); - OstTraceFunctionExit0( WLANWIZARDPAGESSID_TEXTCHANGED_EXIT ); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/src/wlanwizardpagesummary.cpp --- a/wlanutilities/wlanwizard/src/wlanwizardpagesummary.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,306 +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 "Eclipse Public License v1.0" -* which accompanies 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" - -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlanwizardpagesummaryTraces.h" -#endif - - -/*! - \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) -{ - OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_ENTRY); - OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_EXIT); -} - -/*! - Destructor. - */ -WlanWizardPageSummary::~WlanWizardPageSummary() -{ - OstTraceFunctionEntry0(DUP1_WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_ENTRY); - - HbStyleLoader::unregisterFilePath(WlanWizardPageSummaryLayout); - - // Wizard framework deletes the visualization (owns mListWidget). - - OstTraceFunctionExit0(DUP1_WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_EXIT); -} - -/*! - See WlanWizardPage::initializePage() - */ -HbWidget* WlanWizardPageSummary::initializePage() -{ - OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_INITIALIZEPAGE_ENTRY); - - // 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); - - OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_INITIALIZEPAGE_EXIT); - return qobject_cast(mListWidget); -} - -/*! - Loads docml. - */ -void WlanWizardPageSummary::loadDocml() -{ - OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_LOADDOCML_ENTRY); - - 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); - - OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_LOADDOCML_EXIT); -} - -/*! - Gets localized network mode from the WlanWizardPrivate::ConfNetworkMode - configuration. - - @return localized network mode text. - */ -QString WlanWizardPageSummary::networkModeText() const -{ - OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_NETWORKMODETEXT_ENTRY); - - 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::ConfWlanScanSSID).toBool()) { - ret = hbTrId("txt_occ_dblist_network_mode_val_infrastructure_hi"); - } else { - ret = hbTrId("txt_occ_dblist_network_mode_val_infrastructure_pu"); - } - break; - } - - OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_NETWORKMODETEXT_EXIT); - return ret; -} - -/*! - Gets localized security mode from the WlanWizardPrivate::ConfSecurityMode - configuration. - - @return localized security mode text. - */ -QString WlanWizardPageSummary::securityModeText() const -{ - OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_SECURITYMODETEXT_ENTRY); - - 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; - } - - OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_SECURITYMODETEXT_EXIT); - return ret; -} - -/*! - Adds dynamic content to the view. - - @param [in,out] row row to where insert happens. - */ -void WlanWizardPageSummary::addDynamicItems(int &row) -{ - OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_ADDDYNAMICITEMS_ENTRY); - - if (mWizard->isEapEnabled()) { - appendToListPluginInfo(WlanWizardPlugin::SummaryEapOuterType, row); - appendToListPluginInfo(WlanWizardPlugin::SummaryEapInnerType, row); - appendToListPluginInfo(WlanWizardPlugin::SummaryEapFastProvisioningMode, row); - } - - 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; - } - - OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_ADDDYNAMICITEMS_EXIT); -} - -/*! - 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) -{ - OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_APPENDTOLIST_ENTRY); - - HbListWidgetItem *item = new HbListWidgetItem(); - item->setText(title); - item->setSecondaryText(value); - mListWidget->insertItem(row++, item); - - OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_APPENDTOLIST_EXIT); -} - -/*! - 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) -{ - OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_APPENDTOLISTPLUGININFO_ENTRY); - - QString title; - QString value; - WlanWizardPlugin *plugin = mWizard->wlanWizardPlugin(); - Q_ASSERT(plugin); - if (plugin->summary(id, title, value)) { - appendToList(row, title, value ); - } - - OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_APPENDTOLISTPLUGININFO_EXIT); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/src/wlanwizardscanlist.cpp --- a/wlanutilities/wlanwizard/src/wlanwizardscanlist.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,193 +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 "Eclipse Public License v1.0" - * which accompanies 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" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlanwizardscanlistTraces.h" -#endif - - -/*! - * Constructor for WlanWizardScanList object. - */ -WlanWizardScanList::WlanWizardScanList(): mWpsSelected(false) -{ - OstTraceFunctionEntry0( WLANWIZARDSCANLIST_WLANWIZARDSCANLIST_ENTRY ); - - OstTraceFunctionExit0( WLANWIZARDSCANLIST_WLANWIZARDSCANLIST_EXIT ); -} - -/*! - * Copy Constructor for WlanWizardScanList object. - * @param [in] scanList is the object to be copied. - */ -WlanWizardScanList::WlanWizardScanList(const WlanWizardScanList &scanList): -mOpenOptions(scanList.mOpenOptions), mWpsSelected(false) -{ - OstTraceFunctionEntry0( DUP1_WLANWIZARDSCANLIST_WLANWIZARDSCANLIST_ENTRY ); - - OstTraceFunctionExit0( DUP1_WLANWIZARDSCANLIST_WLANWIZARDSCANLIST_EXIT ); -} - -/*! - * Destructor for WlanWizardScanList object. - */ -WlanWizardScanList::~WlanWizardScanList() -{ - OstTraceFunctionEntry0( DUP2_WLANWIZARDSCANLIST_WLANWIZARDSCANLIST_ENTRY ); - - OstTraceFunctionExit0( DUP2_WLANWIZARDSCANLIST_WLANWIZARDSCANLIST_EXIT ); -} - -/*! - * 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) -{ - OstTraceFunctionEntry0( WLANWIZARDSCANLIST_BUILD_ENTRY ); - - mWpsSelected = true; - - 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)) { - mWpsSelected = (mWpsSelected && netMode.wpsSupported); - 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. - } - OstTraceFunctionExit0( WLANWIZARDSCANLIST_BUILD_EXIT ); -} - -/*! - * 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 -{ - OstTraceFunctionEntry0( WLANWIZARDSCANLIST_GETSECMODE_ENTRY ); - 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 -{ - OstTraceFunctionEntry0( WLANWIZARDSCANLIST_NETMODES_ENTRY ); - 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 -{ - OstTraceFunctionEntry0( WLANWIZARDSCANLIST_SECMODES_ENTRY ); - Q_ASSERT(mOpenOptions.contains(netMode)); - return mOpenOptions.find(netMode)->size(); -} - -/*! - * This function returns the list of keys in the hash. - * @return a list of keys. - */ -QList WlanWizardScanList::getNetModes() const -{ - OstTraceFunctionEntry0( WLANWIZARDSCANLIST_GETNETMODES_ENTRY ); - return mOpenOptions.keys(); -} - -/*! - * This function indicates whether the list of scan results supports - * Wi-Fi Protected Setup. - * @return true, if all result network modes support wps, false if even - * a single result does not. - */ -bool WlanWizardScanList::wpsSelected() const -{ - OstTraceFunctionEntry0( WLANWIZARDSCANLIST_WPSSELECTED_ENTRY ); - return mWpsSelected; -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/src/wlanwizardsummaryviewitem.cpp --- a/wlanutilities/wlanwizard/src/wlanwizardsummaryviewitem.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +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 "Eclipse Public License v1.0" - * which accompanies 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" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlanwizardsummaryviewitemTraces.h" -#endif - - -/*! - \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) -{ - OstTraceFunctionEntry0( - WLANWIZARDSUMMARYLISTVIEWITEM_WLANWIZARDSUMMARYLISTVIEWITEM_ENTRY ); - OstTraceFunctionExit0( - WLANWIZARDSUMMARYLISTVIEWITEM_WLANWIZARDSUMMARYLISTVIEWITEM_EXIT ); -} - -/*! - Destructor. - */ -WlanWizardSummaryListViewItem::~WlanWizardSummaryListViewItem() -{ - OstTraceFunctionEntry0( - DUP1_WLANWIZARDSUMMARYLISTVIEWITEM_WLANWIZARDSUMMARYLISTVIEWITEM_ENTRY ); - OstTraceFunctionExit0( - DUP1_WLANWIZARDSUMMARYLISTVIEWITEM_WLANWIZARDSUMMARYLISTVIEWITEM_EXIT ); -} - -/*! - See HbListViewItem::updateChildItems(). - - Disables selection. - */ -void WlanWizardSummaryListViewItem::updateChildItems() -{ - OstTraceFunctionEntry0( WLANWIZARDSUMMARYLISTVIEWITEM_UPDATECHILDITEMS_ENTRY ); - HbListViewItem::updateChildItems(); - - ungrabGesture(Qt::TapGesture); - - GraphicsItemFlags itemFlags = flags(); - itemFlags &= ~QGraphicsItem::ItemIsFocusable; - setFlags(itemFlags); - OstTraceFunctionExit0( WLANWIZARDSUMMARYLISTVIEWITEM_UPDATECHILDITEMS_EXIT ); -} - -/*! - See HbListViewItem::createItem(). - */ -HbAbstractViewItem* WlanWizardSummaryListViewItem::createItem() -{ - OstTraceFunctionEntry0( WLANWIZARDSUMMARYLISTVIEWITEM_CREATEITEM_ENTRY ); - OstTraceFunctionExit0( WLANWIZARDSUMMARYLISTVIEWITEM_CREATEITEM_EXIT ); - return new WlanWizardSummaryListViewItem(*this); -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/src/wlanwizardutils.cpp --- a/wlanutilities/wlanwizard/src/wlanwizardutils.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,274 +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 "Eclipse Public License v1.0" - * which accompanies 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) -{ - OstTraceFunctionEntry0( WLANWIZARDUTILS_VALIDATEWPAKEY_ENTRY ); -#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 ); - - OstTraceFunctionExit0( WLANWIZARDUTILS_VALIDATEWPAKEY_EXIT ); - 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) -{ - OstTraceFunctionEntry0( WLANWIZARDUTILS_VALIDATEWEPKEY_ENTRY ); -#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 ); - - OstTraceFunctionExit0( WLANWIZARDUTILS_VALIDATEWEPKEY_EXIT ); - 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) -{ - OstTraceFunctionEntry0( WLANWIZARDUTILS_ISASCII_ENTRY ); - 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) { - OstTraceFunctionExit0( WLANWIZARDUTILS_ISASCII_EXIT ); - return KeyStatusIllegalCharacters; - } - ++data; - } - OstTraceFunctionExit0( DUP1_WLANWIZARDUTILS_ISASCII_EXIT ); - 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) -{ - OstTraceFunctionEntry0( WLANWIZARDUTILS_ISHEX_ENTRY ); - 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 { - OstTraceFunctionExit0( WLANWIZARDUTILS_ISHEX_EXIT ); - return KeyStatusIllegalCharacters; - } - } - OstTraceFunctionExit0( DUP1_WLANWIZARDUTILS_ISHEX_EXIT ); - 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) -{ - OstTraceFunctionEntry0( WLANWIZARDUTILS_VALIDATESSID_ENTRY ); - 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 ); - OstTraceFunctionExit0( WLANWIZARDUTILS_VALIDATESSID_EXIT ); - return ret; -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/traces/OstTraceDefinitions.h --- a/wlanutilities/wlanwizard/traces/OstTraceDefinitions.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/traces/trace.properties --- a/wlanutilities/wlanwizard/traces/trace.properties Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ - - - - ConfSsid - ConfNetworkMode - ConfSecurityMode - ConfKeyWpa - ConfKeyWep1 - ConfKeyWep2 - ConfKeyWep3 - ConfKeyWep4 - ConfKeyWepDefault - ConfIctStatus - ConfIapId - ConfConnected - ConfWlanScanSSID - 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/make_ctc.bat --- a/wlanutilities/wlanwizard/tsrc/make_ctc.bat Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +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 "Eclipse Public License v1.0" -:: which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/make_ctc_post.bat --- a/wlanutilities/wlanwizard/tsrc/make_ctc_post.bat Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +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 "Eclipse Public License v1.0" -:: which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/make_ctc_with_clean.bat --- a/wlanutilities/wlanwizard/tsrc/make_ctc_with_clean.bat Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +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 "Eclipse Public License v1.0" -:: which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/eapqtcertificateinfo.h --- a/wlanutilities/wlanwizard/tsrc/stubs/eapqtcertificateinfo.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +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 "Eclipse Public License v1.0" -* which accompanies 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 - -// System includes -#include -#include - -// User includes - -// Forward declarations -class EapQtCertificateInfoPrivate; - -// External data types - -// Constants - -// Class declaration -class EapQtCertificateInfo -{ -public: - - // Data types - - enum ItemId - { - /*! QString */ - SubjectName = 0, - /*! 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(const ItemId id) const; - void setValue(const ItemId id, const 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/eapqtcertificateinfo_stub.cpp --- a/wlanutilities/wlanwizard/tsrc/stubs/eapqtcertificateinfo_stub.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +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 "Eclipse Public License v1.0" - * which accompanies 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: 3 % - */ - -#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(const 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(const ItemId id, const 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/eapqtconfig.h --- a/wlanutilities/wlanwizard/tsrc/stubs/eapqtconfig.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,143 +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 "Eclipse Public License v1.0" -* which accompanies 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 eapwizard testing. -*/ - -#ifndef EAPQTCONFIG_H -#define EAPQTCONFIG_H - -// System includes -#include -#include - -// User includes - -// Forward declarations - -// External data types - -// Constants - -// Class declaration - -class EapQtConfig -{ -public: - - // Data types - - enum CipherSuite - { - /* from RFC4346, listing only suites supported by EAP server */ - TLS_NULL_WITH_NULL_NULL = 0x0000, - TLS_RSA_WITH_RC4_128_MD5 = 0x0004, - TLS_RSA_WITH_RC4_128_SHA = 0x0005, - TLS_RSA_WITH_3DES_EDE_CBC_SHA = 0x000a, - TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA = 0x0013, - TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA = 0x0016, - TLS_RSA_WITH_AES_128_CBC_SHA = 0x002f, - TLS_DHE_DSS_WITH_AES_128_CBC_SHA = 0x0032, - TLS_DHE_RSA_WITH_AES_128_CBC_SHA = 0x0033, - TLS_DH_anon_WITH_AES_128_CBC_SHA = 0x0034, - }; - - enum SettingsId - { - // see also EapSettings.h - - /*! bool */ - UsernameAutomatic = 0, - /*! 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, values from EapQtConfig::CipherSuite */ - CipherSuites, - /*! bool */ - PeapVersion0Allowed, - /*! bool */ - PeapVersion1Allowed, - /*! bool */ - PeapVersion2Allowed, - /*! bool */ - AuthorityCertificateAutomatic, - /*! 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, - /* marker for the last entry */ - SettingsIdLast - }; - -public: - EapQtConfig(); - EapQtConfig(const EapQtConfig& other); - ~EapQtConfig(); - - QVariant value(const SettingsId id) const; - void setValue(const SettingsId id, const QVariant &newValue); - void clear(); - -public: // FOR TESTING PURPOSE - bool operator==(const EapQtConfig & rhs ) const; - -private: - QHash mSettings; -}; - -#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/eapqtconfig_stub.cpp --- a/wlanutilities/wlanwizard/tsrc/stubs/eapqtconfig_stub.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,146 +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 "Eclipse Public License v1.0" - * which accompanies 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: 4 % - */ - -#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(const SettingsId id) const -{ - // 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(const SettingsId id, const 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; -} - -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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/eapqtconfiginterface.h --- a/wlanutilities/wlanwizard/tsrc/stubs/eapqtconfiginterface.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +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 "Eclipse Public License v1.0" -* which accompanies 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. -*/ - -#ifndef EAPQTCONFIGINTERFACE_H -#define EAPQTCONFIGINTERFACE_H - -#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 = 0, - // EAP configuration interface for VPN - EapBearerTypeVpn, - }; - - static const int IapIdUndefined = -1; - -public: - EapQtConfigInterface(const EapBearerType bearerType, const int iapId); - ~EapQtConfigInterface(); - - EapQtValidator *validatorEap(const EapQtExpandedEapType &type, const EapQtConfig::SettingsId id); - EapQtValidator *validatorPacStore(const EapQtPacStoreConfig::PacStoreSettings id); - - 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, const EapQtConfig &config); - bool deleteConfiguration(); - - bool readPacStoreConfiguration(EapQtPacStoreConfig &config); - bool savePacStoreConfiguration(EapQtPacStoreConfig &config); - - -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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/eapqtconfiginterface_context.cpp --- a/wlanutilities/wlanwizard/tsrc/stubs/eapqtconfiginterface_context.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,422 +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 "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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/eapqtconfiginterface_context.h --- a/wlanutilities/wlanwizard/tsrc/stubs/eapqtconfiginterface_context.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +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 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/eapqtconfiginterface_stub.cpp --- a/wlanutilities/wlanwizard/tsrc/stubs/eapqtconfiginterface_stub.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,155 +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 "Eclipse Public License v1.0" - * which accompanies 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: 6 % - */ - -#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"); -} - - -EapQtValidator *EapQtConfigInterface::validatorEap( - const EapQtExpandedEapType &type, - const 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; -} - -EapQtValidator *EapQtConfigInterface::validatorPacStore( - const EapQtPacStoreConfig::PacStoreSettings id) -{ - mCalledMethods.append("validatorPacStore"); - - QCOMPARE(mValidatorPacStore.contains(id), true); - EapQtValidator *validator = mValidatorPacStore[id]; - mValidatorPacStore.remove(id); - return validator; -} - -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, - const 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; -} - - -bool EapQtConfigInterface::readPacStoreConfiguration(EapQtPacStoreConfig &config) -{ - config = mReadPacStoreConfiguration; - return mReadPacStoreConfigurationReturn; -} - -bool EapQtConfigInterface::savePacStoreConfiguration(EapQtPacStoreConfig &config) -{ - QCOMPARE(config == mSavePacStoreConfiguration, true); - return mSavePacStoreConfigurationReturn; -} - - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/eapqtpacstoreconfig.h --- a/wlanutilities/wlanwizard/tsrc/stubs/eapqtpacstoreconfig.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +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 "Eclipse Public License v1.0" - * which accompanies 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: For EAP Wizard testing - * - */ - -#ifndef EAPQTPACSTORECONFIG_H -#define EAPQTPACSTORECONFIG_H - -// System includes -#include - -// User includes - -// Forward declarations - -// External data types - -// Constants - -// Class declaration - -class EapQtPacStoreConfig -{ -public: - - // PAC store is global, i.e. only a single PAC store exists in a device - - // Data types - - enum PacStoreStatus - { - // PAC store does not exist and needs to be created - // (status also reverts to PacStoreStateStoreNotExists if the PAC store is - // corrupted, i.e. it gets deleted automatically) - 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, - // 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 including saved password - * false/QVariant::Invalid: no actions */ - PacStoreReset, - /*! read-only: int (PacStoreStatus) */ - 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(); - - // gets the configuration field referred to by an id from PacStoreSettings - // returns QVariant::Invalid is the field has not been set - QVariant value(const PacStoreSettings id) const; - - // sets the configuration field referred to by an id from PacStoreSettings - // does nothing if newValue >= PacStoreLast - void setValue(const PacStoreSettings id, const QVariant &newValue); - - // resets the object i.e. any successive call to - // value() returns QVariant::Invalid - 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/eapqtpacstoreconfig_stub.cpp --- a/wlanutilities/wlanwizard/tsrc/stubs/eapqtpacstoreconfig_stub.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +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 "Eclipse Public License v1.0" - * which accompanies 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: 3 % - */ -#include -#include - -EapQtPacStoreConfig::EapQtPacStoreConfig() -{ -} - -EapQtPacStoreConfig::~EapQtPacStoreConfig() -{ - // scoped pointer deleted automatically -} - -QVariant EapQtPacStoreConfig::value(const PacStoreSettings id) const -{ - // 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( - const PacStoreSettings id, - const 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/eapqtvalidator.h --- a/wlanutilities/wlanwizard/tsrc/stubs/eapqtvalidator.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +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 "Eclipse Public License v1.0" -* which accompanies 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. -*/ - -#ifndef EAPQTVALIDATOR_H -#define EAPQTVALIDATOR_H - -// System includes -#include - -// User includes - -// Forward declarations - -class HbLineEdit; - -// External data types - -// Constants - -// Class declaration - -/*! - * @addtogroup group_eap_config_api - * @{ - */ - -/* - * 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. - * - * validate() method checks that the content and format are valid for - * given configuration parameter. - * - * An instance of a validator is created with - * EapQtConfigInterface::validatorEap() method. - */ - -class EapQtValidator -{ - -public: - - // Data types - - /* - * Validation status. Can be extended. - */ - enum Status { - /// Ok - StatusOk = 0, - /// Content is invalid - StatusInvalid, - /// The length is not valid - StatusInvalidLength, - /// Invalid characters detected - StatusInvalidCharacters, - /// Input is too short - StatusTooShort, - /// Input is too long - StatusTooLong, - }; - - EapQtValidator() {}; - virtual ~EapQtValidator() {}; - - /*! - * Validates the given input \a value. - * - * @param value Value to be validated - * - * @return Status code. - */ - virtual Status validate(const QVariant &value) = 0; - - /*! - * Sets required configurations to the line edit. - * - * Configurations depend on given EAP type and the configuration - * identifire which was used to instantiate the validator. - * - * @param edit LineEdit to be updated. - */ - virtual void updateEditor(HbLineEdit* const edit) = 0; - -private: - - Q_DISABLE_COPY(EapQtValidator) -}; - -/*! @} */ - -#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/eapqtvalidator_stub.cpp --- a/wlanutilities/wlanwizard/tsrc/stubs/eapqtvalidator_stub.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +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 "Eclipse Public License v1.0" -* which accompanies 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(const QVariant & value) -{ - Q_UNUSED(value); - return mStatus; -} - -void EapQtValidatorStub::updateEditor(HbLineEdit* const edit) -{ - Q_UNUSED(edit); -} - -void EapQtValidatorStub::setReturnValue(EapQtValidator::Status status) -{ - mStatus = status; -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/eapqtvalidator_stub.h --- a/wlanutilities/wlanwizard/tsrc/stubs/eapqtvalidator_stub.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +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 "Eclipse Public License v1.0" - * which accompanies 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 - * - */ - -#ifndef EAPQTVALIDATOR_STUB_H -#define EAPQTVALIDATOR_STUB_H - -// System includes -#include - -// User includes - -// Forward declarations - -class HbLineEdit; - -// External data types - -// Constants - -// Class declaration - -/*! - * @addtogroup group_eap_config_api - * @{ - */ - -class EapQtValidatorStub : public EapQtValidator -{ - -public: - - EapQtValidatorStub(EapQtValidator::Status status); - ~EapQtValidatorStub(); - virtual EapQtValidator::Status validate(const QVariant & value); - void updateEditor(HbLineEdit* const edit ); - void setReturnValue(EapQtValidator::Status status); - -private: - EapQtValidator::Status mStatus; - Q_DISABLE_COPY(EapQtValidatorStub) -}; - -/*! @} */ - -#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/stubs.pri --- a/wlanutilities/wlanwizard/tsrc/stubs/stubs.pri Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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: -# 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/wlanmgmtclient.h --- a/wlanutilities/wlanwizard/tsrc/stubs/wlanmgmtclient.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/wlanmgmtclient_context.cpp --- a/wlanutilities/wlanwizard/tsrc/stubs/wlanmgmtclient_context.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +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 "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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/wlanmgmtclient_context.h --- a/wlanutilities/wlanwizard/tsrc/stubs/wlanmgmtclient_context.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +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 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/wlanmgmtclient_stub.cpp --- a/wlanutilities/wlanwizard/tsrc/stubs/wlanmgmtclient_stub.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/wlanqtutils.h --- a/wlanutilities/wlanwizard/tsrc/stubs/wlanqtutils.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +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 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/wlanqtutils_context.cpp --- a/wlanutilities/wlanwizard/tsrc/stubs/wlanqtutils_context.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +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 "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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/wlanqtutils_context.h --- a/wlanutilities/wlanwizard/tsrc/stubs/wlanqtutils_context.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +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 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/wlanqtutils_stub.cpp --- a/wlanutilities/wlanwizard/tsrc/stubs/wlanqtutils_stub.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,138 +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 "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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/wlanqtutilsap.h --- a/wlanutilities/wlanwizard/tsrc/stubs/wlanqtutilsap.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +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 "Eclipse Public License v1.0" -* which accompanies 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: - - // Data types - - /*! - Configuration IDs that can be read and set in this class. - - 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 - - ConfIdWlanScanSSID - */ - 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 (CMManagerShim::CmHidden). - ConfIdHidden = 12, - //! bool: Does WLAN AP need explicit scanning (CMManagerShim::WlanScanSSID) - ConfIdWlanScanSSID = 13, - //! bool: true - Wifi Protected setup is supported, false - not - ConfIdWpsSupported = 14 - }; - -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 int compare( - const WlanQtUtilsAp *ap1, - const WlanQtUtilsAp *ap2); - -private: - WlanQtUtilsApPrivate *d_ptr; - -}; - -Q_DECLARE_METATYPE(WlanQtUtilsAp) - -#endif /* WLANQTUTILSWLANIAP_H */ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/wlanqtutilsap_stub.cpp --- a/wlanutilities/wlanwizard/tsrc/stubs/wlanqtutilsap_stub.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /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: - * 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 Zero(0), if APs are considered to be same. -*/ - -int WlanQtUtilsAp::compare( - const WlanQtUtilsAp *ap1, - const WlanQtUtilsAp *ap2) -{ - int equal = 1; // Not equal - - // 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 = 0; // Equal - } - - return equal; -} - - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/stubs/wlanqtutilscommon.h --- a/wlanutilities/wlanwizard/tsrc/stubs/wlanqtutilscommon.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +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 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/t_wlanwizard.pro --- a/wlanutilities/wlanwizard/tsrc/t_wlanwizard.pro Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +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 "Eclipse Public License v1.0" -# which accompanies 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 unit testing Qt project file. -# - -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 - -# Stub headers must be used instead of real ones -symbian { - MMP_RULES += "USERINCLUDE stubs" -} - -# Temporary solution to fix tracecompiler -# When tracecompiler is fixed, these can be removed -symbian: { - MMP_RULES += \ - "USERINCLUDE ../traces" \ - "USERINCLUDE ../../eapwizard/traces" \ - "USERINCLUDE ../../wpswizard/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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/ut/hbautotest.cpp --- a/wlanutilities/wlanwizard/tsrc/ut/hbautotest.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,835 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/ut/hbautotest.h --- a/wlanutilities/wlanwizard/tsrc/ut/hbautotest.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,279 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/ut/main.cpp --- a/wlanutilities/wlanwizard/tsrc/ut/main.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +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: - */ - -// 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/ut/testwlanwizard.cpp --- a/wlanutilities/wlanwizard/tsrc/ut/testwlanwizard.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,347 +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 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/ut/testwlanwizard.h --- a/wlanutilities/wlanwizard/tsrc/ut/testwlanwizard.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +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 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/ut/testwlanwizardconnect.cpp --- a/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardconnect.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,615 +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 "Eclipse Public License v1.0" -* which accompanies 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 UT. -*/ - -// 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_adhoc() -{ -#ifdef tc_connect_to_open_success_adhoc_enabled - tc_connect_success("tc_connect_to_open_success_adhoc", CMManagerShim::Adhoc, - CMManagerShim::WlanSecModeOpen, false, ""); -#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, false, "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); - - 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, - false, - "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); - - 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); - 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, - false); - - WlanQtUtilsAp ap; - ap.setValue(WlanQtUtilsAp::ConfIdConnectionMode, networkMode); - ap.setValue(WlanQtUtilsAp::ConfIdSecurityMode, securityMode); - ap.setValue(WlanQtUtilsAp::ConfIdSsid, ssid); - ap.setValue(WlanQtUtilsAp::ConfIdHidden, false); - ap.setValue(WlanQtUtilsAp::ConfIdWlanScanSSID, 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 combinations 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, - false); - - WlanQtUtilsAp ap; - ap.setValue(WlanQtUtilsAp::ConfIdConnectionMode, networkMode); - ap.setValue(WlanQtUtilsAp::ConfIdSecurityMode, securityMode); - ap.setValue(WlanQtUtilsAp::ConfIdSsid, ssid); - ap.setValue(WlanQtUtilsAp::ConfIdHidden, false); - ap.setValue(WlanQtUtilsAp::ConfIdWlanScanSSID, 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/ut/testwlanwizardconnect.h --- a/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardconnect.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +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 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_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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/ut/testwlanwizardconnect_conf.h --- a/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardconnect_conf.h Tue Aug 31 16:18:40 2010 +0300 +++ /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: - */ - -// System includes - -// User includes - -// External function prototypes - -// Local constants - - -#define tc_connect_to_open_success_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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/ut/testwlanwizardcontext.cpp --- a/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardcontext.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,968 +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 "Eclipse Public License v1.0" - * which accompanies 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, QGraphicsItem *widget) -{ - QList list = widget->childItems(); - for (int i = 0; i < list.size(); i++) { - QGraphicsItem* item = list[i]; - - QGraphicsWidget* widget = NULL; - if (item->isWidget()) { - widget = (QGraphicsWidget*)item; - } - if (widget && widget->objectName() == itemName) { - return widget; - } - else if ((item = findChildItem(itemName, item))) { - return (QGraphicsWidget*)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("txt_occ_dialog_enter_key_for_1").arg(info)); - - case WlanWizardPageInternal::PageProcessSettings: - return verifyDialogText("dialog", HbParameterLengthLimiter("txt_occ_dialog_checking_connection_to_1").arg(info)); - - case WlanWizardPageInternal::PageScanning: - return verifyDialogText("dialog", HbParameterLengthLimiter("txt_occ_dialog_searching").arg(info)); - - case EapWizardPage::PageUsernamePassword: - ret &= verifyDialogText( - "setlabel_55", - HbParameterLengthLimiter("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("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("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; - } - QString netModeString(toNetworkModeString(netMode, hidden)); - if (item->secondaryText() != netModeString){ - qWarning("verifySummaryPage: no match network mode value"); - qDebug() << "Actual: " << item->secondaryText(); - qDebug() << "Expected: " << netModeString; - 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/ut/testwlanwizardcontext.h --- a/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardcontext.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,191 +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 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, QGraphicsItem *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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/ut/testwlanwizardeap.cpp --- a/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardeap.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1859 +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 "Eclipse Public License v1.0" -* which accompanies 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 UT. -*/ - -// System includes -#include -#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); - - 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); - - 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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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, - HbParameterLengthLimiter("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); - - 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); - - 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); - - 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); - - 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); - - 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); - - 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); - - 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); - - 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); - - 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); - - 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); - - 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); - - 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); - 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); - - 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); - - 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); - - 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); - - 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); - - 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/ut/testwlanwizardeap.h --- a/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardeap.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +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 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/ut/testwlanwizardeap_conf.h --- a/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardeap_conf.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +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: - */ - -// 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/ut/testwlanwizardmanual.cpp --- a/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardmanual.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1260 +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: - */ - -// 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 ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QTest::qWait(WaitTimeForUi); - 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 ); - QStringList buttons; - buttons << hbTrId("txt_occ_list_infrastructure_hidden") - << hbTrId("txt_occ_list_adhoc_1"); - QCOMPARE( verifyRadioButtons("list"), buttons ); - - 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 ); - 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 ); - 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 -} - -/*! - * - */ -void TestWlanWizardManual::tc_multiple_ssids_with_same_name_wps_and_nonwps() -{ -#ifdef tc_multiple_ssids_with_same_name_wps_and_nonwps_enabled - mApList->Add("huuhaa", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); - - // Add all five kinds of security modes. - mApList->Add("huuhaa", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, true, true, 300); - - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa", 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", "huuhaa"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); - QStringList buttons; - buttons << hbTrId("txt_occ_list_infrastructure_hidden") - << hbTrId("txt_occ_list_wifi_protected_setup"); - QCOMPARE( verifyRadioButtons("list"), buttons ); - QCOMPARE( selectRadioButton( "list", 1 ), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageWpsStart), true ); -#endif -} - -/*! - * - */ -void TestWlanWizardManual::tc_multiple_ssids_with_same_name_two_wps_aps() -{ -#ifdef tc_multiple_ssids_with_same_name_two_wps_aps_enabled - mApList->Add("huuhaa", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, true, 100); - - // Add all five kinds of security modes. - mApList->Add("huuhaa", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, true, true, 300); - - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa", 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", "huuhaa"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageWpsStart), true ); -#endif -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/ut/testwlanwizardmanual.h --- a/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardmanual.h Tue Aug 31 16:18:40 2010 +0300 +++ /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 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(); - void tc_multiple_ssids_with_same_name_wps_and_nonwps(); - void tc_multiple_ssids_with_same_name_two_wps_aps(); - -}; - -#endif /* TESTWLANWIZARDRNMANUAL_H_ */ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/ut/testwlanwizardmanual_conf.h --- a/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardmanual_conf.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +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: - */ - -// 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 -#define tc_multiple_ssids_with_same_name_wps_and_nonwps_enabled -#define tc_multiple_ssids_with_same_name_two_wps_aps_enabled diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/ut/testwlanwizardwps.cpp --- a/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardwps.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,496 +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 "Eclipse Public License v1.0" -* which accompanies 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 UT. -*/ - -// 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); - ap.setValue(WlanQtUtilsAp::ConfIdWlanScanSSID, 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, - 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); - ap.setValue(WlanQtUtilsAp::ConfIdWlanScanSSID, 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, - 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, - 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/ut/testwlanwizardwps.h --- a/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardwps.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/ut/testwlanwizardwps_conf.h --- a/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardwps_conf.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/tsrc/ut/ut.pri --- a/wlanutilities/wlanwizard/tsrc/ut/ut.pri Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +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: -# 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlanwizard/wlanwizard.pro --- a/wlanutilities/wlanwizard/wlanwizard.pro Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -# -# 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 - -DOCML += \ - resources/occ_wlan_wizard_main.docml \ - resources/occ_add_wlan_05.docml \ - resources/occ_add_wlan_06.docml \ - resources/occ_add_wlan_02_03.docml \ - resources/occ_add_wlan_01_04.docml \ - resources/occ_add_wlan_error.docml - -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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/bwins/wpswizardu.def --- a/wlanutilities/wpswizard/bwins/wpswizardu.def Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/eabi/wpswizardu.def --- a/wlanutilities/wpswizard/eabi/wpswizardu.def Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/inc/cwpsactiverunner.h --- a/wlanutilities/wpswizard/inc/cwpsactiverunner.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +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 "Eclipse Public License v1.0" -* which accompanies 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 CWPSACTIVERUNNER_H_ -#define CWPSACTIVERUNNER_H_ - -// System includes -#include -#include - -// User includes -#include "mwpsactiverunnercallback.h" - -// Forward declarations -// External data types -// Constants - -/*! - * @addtogroup group_wps_wizard_plugin - * @{ - */ -// Class declaration -class CWpsActiveRunner : public CActive -{ -public: - static CWpsActiveRunner* NewL(MWpsActiveRunnerCallback& aObserver); - virtual ~CWpsActiveRunner(); -public: - - void RunL(); - void DoCancel(); - TInt RunError(TInt aError); - void StartSetup(RBuf8& aSsid, int aPin); - -protected: - -private: - explicit CWpsActiveRunner(MWpsActiveRunnerCallback& aObserver); - void ConstructL(); - void InitializeL(); -private: - - //! observer for notification of WPS setup completion - MWpsActiveRunnerCallback& iObserver; - //! 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; - - friend class TestWlanWizardContext; -}; - -#endif /* CWPSACTIVERUNNER_H_ */ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/inc/mwpsactiverunnercallback.h --- a/wlanutilities/wpswizard/inc/mwpsactiverunnercallback.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +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 "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Interface class for the middleware callback -* -*/ -#ifndef MWPSACTIVERUNNERCALLBACK_H_ -#define MWPSACTIVERUNNERCALLBACK_H_ - -// System includes -#include -#include - -// User includes -// Forward declarations -// External data types -// Constants - -/*! - * @addtogroup group_wps_wizard_plugin - * @{ - */ - -// Class declaration -class MWpsActiveRunnerCallback - { -public: - /*! - * Callback to notify the completion of middleware API call - */ - virtual void WpsActiveRunnerStopped( - QList& aCredentials, - TInt aError) = 0; - }; - -#endif /* MWPSACTIVERUNNERCALLBACK_H_ */ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/inc/wpswizard.h --- a/wlanutilities/wpswizard/inc/wpswizard.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +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 "Eclipse Public License v1.0" - * which accompanies 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 API - * - */ - -#ifndef WPSWIZARD_H_ -#define WPSWIZARD_H_ - - -// System includes -#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 - -/*! - * @addtogroup group_wps_wizard_plugin - * @{ - */ - -// Class declaration -class WPS_WIZARD_EXPORT WpsWizard: public QObject, public WlanWizardPlugin -{ - Q_OBJECT - -public: - - explicit WpsWizard( WlanWizardHelper *wizardHelper); - ~WpsWizard(); - -signals: - -public slots: - -protected: - -protected slots: - -private: - - Q_DISABLE_COPY(WpsWizard) - -private slots: - -private: - - //data - - //! pointer to the private implementation class. - QScopedPointer d_ptr; - - friend class WpsWizardPrivate; - friend class TestWlanWizardContext; -}; - -#endif /* WPSWIZARD_H_ */ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/inc/wpswizard_p.h --- a/wlanutilities/wpswizard/inc/wpswizard_p.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +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 "Eclipse Public License v1.0" - * which accompanies 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 - - -// User includes -#include "wlanwizardhelper.h" -#include "wpswizard.h" - -// Forward declarations -class HbStackedWidget; -class HbTranslator; -class HbWidget; -class HbLabel; -class HbView; -class HbAction; -class HbDocumentLoader; -class WlanWizardHelper; - -// External data types -// Constants - -/*! - * @addtogroup group_wps_wizard_plugin - * @{ - */ - -// Class declaration -class WpsWizardPrivate : public QObject - { - Q_OBJECT - -public: - WpsWizardPrivate(WpsWizard* wizard, WlanWizardHelper *wizardHelper); - ~WpsWizardPrivate(); -public: - - void enableNextButton(bool enable); - - void nextPage(); - - QString getSsid(); - - void storeSettings(int index); - - HbMainWindow* mainWindow(); - - void storeSettingsArray( - QList& credentials); - QList getSettingsArray(); - - void setPin(int random); - - int getPin(); - - 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; - //! 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; - //! Random number generated for Number entry mode - int mRandomNumber; - - friend class WpsWizard; - friend class TestWlanWizardContext; - }; - -#endif /* WPSWIZARD_P_H_ */ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/inc/wpswizardpage.h --- a/wlanutilities/wpswizard/inc/wpswizardpage.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +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 "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: API for wps wizard pages -* -*/ - -#ifndef WPSWIZARDPAGE_H_ -#define WPSWIZARDPAGE_H_ - - -// System includes -#include - -// User includes -#include "wlanwizardpage.h" - -// Forward declarations -class WpsWizardPrivate; -class HbWidget; - - -// External data types -// Constants - -/*! - * @addtogroup group_wps_wizard_plugin - * @{ - */ - -// Class declaration -class WpsWizardPage : public QObject, public WlanWizardPage -{ - Q_OBJECT - -public: - enum WpsPageIds { - PageWpsWizardStep2 = WlanWizardPage::PageWpsStart, - PageWpsWizardStep3_Button, - PageWpsWizardStep3_Number, - PageWpsWizardStep4, - PageWpsWizardStep5, - PageWpsWizardStep6 - }; - - enum WpsMode { - WpsPushButtonMode = 0, - WpsPinCodeMode, - WpsManualMode - }; - -public: - explicit WpsWizardPage(WpsWizardPrivate* parent); - virtual ~WpsWizardPage(); - - /*! - * Creates a visualization of the page. - */ - virtual HbWidget* initializePage() = 0; - /*! - * Returns id of next page. updates settings EapWizard. - */ - virtual int nextId(bool &removeFromStack) const = 0; - /*! - * This method is called when "previous" button has been pressed. - */ - virtual int previousTriggered() { return OneStepBackwards;}; - /*! - * This method is called when Cancel button has been pressed. - */ - 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/inc/wpswizardstepfive.h --- a/wlanutilities/wpswizard/inc/wpswizardstepfive.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +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 "Eclipse Public License v1.0" -* which accompanies 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 5 -* -*/ - -#ifndef WPSWIZARDSTEPFIVE_H_ -#define WPSWIZARDSTEPFIVE_H_ - - -// System includes -#include -#include - -// User includes -#include "wpswizardpage.h" - -// Forward declarations -class HbRadioButtonList; -class HbWidget; -class HbLabel; -class HbProgressBar; -class WpsWizardPrivate; - - -// External data types -// Constants - -/*! - * @addtogroup group_wps_wizard_plugin - * @{ - */ - -// Class declaration -class WpsPageStepFive : public WpsWizardPage - { -Q_OBJECT - -public: - - explicit WpsPageStepFive(WpsWizardPrivate* parent); - ~WpsPageStepFive(); - -public: - - HbWidget* initializePage(); - - int nextId(bool &removeFromStack) const; - - int previousTriggered(); - - void cancelTriggered(); - - 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; - //! 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/inc/wpswizardstepfour.h --- a/wlanutilities/wpswizard/inc/wpswizardstepfour.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +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 "Eclipse Public License v1.0" -* which accompanies 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 -* -*/ - -#ifndef WPSWIZARDSTEPFOUR_H_ -#define WPSWIZARDSTEPFOUR_H_ - - -// System includes -#include -#include - -// User includes -#include "wpswizardpage.h" -#include "mwpsactiverunnercallback.h" -#include "cwpsactiverunner.h" - -// Forward declarations -class HbWidget; -class WpsWizardPrivate; -class WpsPageStepFourPrivate; - -// External data types -// Constants - -/*! - * @addtogroup group_wps_wizard_plugin - * @{ - */ - -// Class declaration -class WpsPageStepFour : public WpsWizardPage - { -Q_OBJECT - -public: - - explicit WpsPageStepFour(WpsWizardPrivate* parent); - ~WpsPageStepFour(); - -public: - - HbWidget* initializePage(); - - int nextId(bool &removeFromStack) const; - - int previousTriggered(); - - void cancelTriggered(); - - 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) - -private slots: - -private: - - //data - - //! HbWidget object displayed on the page - HbWidget *mWidget; - //! Member variable to hold the result of of the WPS operation - int mWpsErrorCode; - //! 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/inc/wpswizardstepfour_p.h --- a/wlanutilities/wpswizard/inc/wpswizardstepfour_p.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/inc/wpswizardstepthreebutton.h --- a/wlanutilities/wpswizard/inc/wpswizardstepthreebutton.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +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 "Eclipse Public License v1.0" -* which accompanies 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 Button press mode -* -*/ - -#ifndef WPSWIZARDSTEPTHREEBUTTON_H_ -#define WPSWIZARDSTEPTHREEBUTTON_H_ - -// System includes -#include -#include - -// User includes -#include "wpswizardpage.h" - -// Forward declarations -class HbRadioButtonList; -class HbWidget; -class HbLabel; -class WpsWizardPrivate; - -// External data types - -// Constants - -/*! - * @addtogroup group_wps_wizard_plugin - * @{ - */ - -// Class declaration -class WpsPageStepThreeButton : public WpsWizardPage - { -Q_OBJECT - -public: - explicit WpsPageStepThreeButton(WpsWizardPrivate* parent); - ~WpsPageStepThreeButton(); - -public: - - HbWidget* initializePage(); - - int nextId(bool &removeFromStack) const; - - int previousTriggered(); - -signals: - -public slots: - -protected: - -protected slots: - -private: - Q_DISABLE_COPY(WpsPageStepThreeButton) - -private slots: - -private: //data - //! Pointer to the widget object - HbWidget *mWidget; - //! Pointer to the label displaying the heading - HbLabel *mHeading; - //! Document loader object. - HbDocumentLoader *mLoader; - }; - -#endif /* WPSWIZARDSTEPTHREEBUTTON_H_ */ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/inc/wpswizardstepthreenumber.h --- a/wlanutilities/wpswizard/inc/wpswizardstepthreenumber.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +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 "Eclipse Public License v1.0" - * which accompanies 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" - -// Forward declarations -class HbRadioButtonList; -class HbWidget; -class HbLabel; -class WpsWizardPrivate; - -// External data types -// Constants - -/*! - * @addtogroup group_wps_wizard_plugin - * @{ - */ - -// Class declaration -class WpsPageStepThreeNumber : public WpsWizardPage -{ -Q_OBJECT - -public: - explicit WpsPageStepThreeNumber(WpsWizardPrivate* parent); - ~WpsPageStepThreeNumber(); - -public: - HbWidget* initializePage(); - - int nextId(bool &removeFromStack) const; - - int previousTriggered(); - - void cancelTriggered(); - - bool showPage(); - -private: - int computeRandNumber(); - - int computeCheckSum(int aPin); - -signals: - -public slots: - -protected: - -protected slots: - -private: - Q_DISABLE_COPY(WpsPageStepThreeNumber) - -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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/inc/wpswizardsteptwo.h --- a/wlanutilities/wpswizard/inc/wpswizardsteptwo.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +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 "Eclipse Public License v1.0" -* which accompanies 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 2 -* -*/ -#ifndef WPSWIZARDSTEPTWO_H_ -#define WPSWIZARDSTEPTWO_H_ - -// System includes -#include -#include - -// User includes -#include "wpswizardpage.h" - -// Forward declarations -class HbRadioButtonList; -class HbWidget; -class HbLabel; -class WpsWizardPrivate; - -// External data types -// Constants - -/*! - * @addtogroup group_wps_wizard_plugin - * @{ - */ - -// Class declaration -class WpsPageStepTwo : public WpsWizardPage - { -Q_OBJECT - -public: - explicit WpsPageStepTwo(WpsWizardPrivate* parent); - ~WpsPageStepTwo(); - -public: - HbWidget* initializePage(); - - int nextId(bool &removeFromStack) const; - - int previousTriggered(); - - void cancelTriggered(); - - bool showPage(); - -signals: - -public slots: - 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; - //! 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; - }; - - -#endif /* WPSWIZARDSTEPTWO_H_ */ diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/resources/occ_wps_01_05.docml --- a/wlanutilities/wpswizard/resources/occ_wps_01_05.docml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - -
- - - - - -
- \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/resources/occ_wps_02_03.docml --- a/wlanutilities/wpswizard/resources/occ_wps_02_03.docml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/resources/occ_wps_P4.docml --- a/wlanutilities/wpswizard/resources/occ_wps_P4.docml Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
-
- - - - - - - - - - - - - -
- - - - - -
- \ No newline at end of file diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/resources/wpswizard_resource.qrc --- a/wlanutilities/wpswizard/resources/wpswizard_resource.qrc Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - - - occ_wps_01_05.docml.bin - occ_wps_02_03.docml.bin - occ_wps_P4.docml.bin - - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/rom/wpswizard.iby --- a/wlanutilities/wpswizard/rom/wpswizard.iby Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +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 "Eclipse Public License v1.0" -* which accompanies 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 WPS Wizard -* -*/ - -#ifndef WPSWIZARD_IBY -#define WPSWIZARD_IBY - -#include - -#ifdef __PROTOCOL_WLAN - -file=ABI_DIR/BUILD_DIR/wpswizard.dll SHARED_LIB_DIR/wpswizard.dll - -#endif // __PROTOCOL_WLAN - -#endif // WPSWIZARD_IBY diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/rom/wpswizard_resources.iby --- a/wlanutilities/wpswizard/rom/wpswizard_resources.iby Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/src/cwpsactiverunner.cpp --- a/wlanutilities/wpswizard/src/cwpsactiverunner.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,223 +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 "Eclipse Public License v1.0" - * which accompanies 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 middleware wrapper class - * - * - */ -// System includes -#include -#include - -// User includes -#include "cwpsactiverunner.h" - -// External function prototypes - -//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. - 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[in] call back interface to notify the - * completion of the middleware calls - */ -CWpsActiveRunner::CWpsActiveRunner(MWpsActiveRunnerCallback& aObserver) : - CActive(EPriorityStandard), - iObserver(aObserver), - isCancelTriggered(false), - iWLANMgmtClient(NULL), - iIapParametersArray(NULL) -{ - OstTraceFunctionEntry1( CWPSACTIVERUNNER_CWPSACTIVERUNNER_ENTRY, this ); - OstTraceFunctionExit1( CWPSACTIVERUNNER_CWPSACTIVERUNNER_EXIT, this ); -} - -/*! - * ConstructL, Two phased constructor. - * - */ -void CWpsActiveRunner::ConstructL() -{ - 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() -{ - 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(); - delete iWLANMgmtClient; - delete iIapParametersArray; - 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) -{ - OstTraceFunctionEntry1( CWPSACTIVERUNNER_STARTSETUP_ENTRY, this ); - TWlanSsid ssid; - TWlanWpsPin pin; - - isCancelTriggered = false; - ssid.Copy(aSsid); - TBuf8 pinCode; - - if (aPin == 0) { - pinCode.AppendFill('0', 8); - } - else { - pinCode.AppendNum(aPin); - } - - pin.Copy(pinCode); - - iWLANMgmtClient->RunProtectedSetup(iStatus, ssid, pin, *iIapParametersArray); - - SetActive(); - - OstTraceFunctionExit1( CWPSACTIVERUNNER_STARTSETUP_EXIT, this ); -} - -/*! - * RunL implementation - */ -void CWpsActiveRunner::RunL() -{ - OstTraceFunctionEntry1( CWPSACTIVERUNNER_RUNL_ENTRY, this ); - - TInt completionCode = iStatus.Int(); - QList credentials; - - if(!isCancelTriggered) { - - if (completionCode < KErrNone) { - //Raise Error - QT_TRYCATCH_LEAVING(iObserver.WpsActiveRunnerStopped(credentials, completionCode)); - } - 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)); - - } - } - - OstTraceFunctionExit1( CWPSACTIVERUNNER_RUNL_EXIT, this ); -} - -/*! - * Cancels the ongoing call - */ -void CWpsActiveRunner::DoCancel() -{ - OstTraceFunctionEntry1( CWPSACTIVERUNNER_DOCANCEL_ENTRY, this ); - isCancelTriggered = true; - if(iWLANMgmtClient) - { - iWLANMgmtClient->CancelProtectedSetup(); - } - OstTraceFunctionExit1( CWPSACTIVERUNNER_DOCANCEL_EXIT, this ); -} - -/*! - * Handles the error usecase - */ -TInt CWpsActiveRunner::RunError(TInt aError) -{ - OstTraceFunctionEntry1( CWPSACTIVERUNNER_RUNERROR_ENTRY, this ); - - OstTrace1( TRACE_ERROR, CWPSACTIVERUNNER_RUNERROR, "CWpsActiveRunner::RunError;aError=%d", aError ); - - QList credentials; - if(iWLANMgmtClient) - { - iWLANMgmtClient->CancelProtectedSetup(); - } - - QT_TRYCATCH_LEAVING(iObserver.WpsActiveRunnerStopped(credentials, aError)); - - return 0; -} - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/src/wpswizard.cpp --- a/wlanutilities/wpswizard/src/wpswizard.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +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 "Eclipse Public License v1.0" - * which accompanies 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: API implementation. - * - */ - -// System includes -#include - -// User includes -// WLAN Wizard -#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" - -// Trace includes -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wpswizardTraces.h" -#endif - -//Forward Declarations -class WlanWizardHelper; - -// External function prototypes - -//Local Constants - -/*! - \class WpsWizard - \brief Provides the WPS wizard implementation - */ - -// ======== LOCAL FUNCTIONS ======== - -// ======== MEMBER FUNCTIONS ======== - -/*! - Creates the WpsWizard object - - @param [in] wizardHelper WlanWizardHelper* Helper class to from the framework - */ - -WpsWizard::WpsWizard(WlanWizardHelper *wizardHelper) : - d_ptr(NULL) -{ - OstTraceFunctionEntry1(WPSWIZARD_WPSWIZARD_ENTRY, this); - d_ptr.reset(new WpsWizardPrivate(this, wizardHelper)); - OstTraceFunctionExit1(WPSWIZARD_WPSWIZARD_EXIT, this); -} - -/*! - Destructor - - */ -WpsWizard::~WpsWizard() -{ - OstTraceFunctionEntry1(WPSWIZARD_WPSWIZARD_DESTRUCTOR_ENTRY, this); - OstTraceFunctionExit1(WPSWIZARD_WPSWIZARD_DESTRUCTOR_EXIT, this); -} - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/src/wpswizard_p.cpp --- a/wlanutilities/wpswizard/src/wpswizard_p.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,391 +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 "Eclipse Public License v1.0" - * which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/src/wpswizardpage.cpp --- a/wlanutilities/wpswizard/src/wpswizardpage.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +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 "Eclipse Public License v1.0" - * which accompanies 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: API for wizard pages. - * - */ - -// System includes -#include - -// User includes -#include "wpswizard_p.h" -#include "wpswizardpage.h" - -// Trace includes -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wpswizardpageTraces.h" -#endif - -// External function prototypes - -// Local constants - -/*! - \class WpsWizardPage - \brief Implementation of the basic wps wizard page functionality - */ - -// ======== LOCAL FUNCTIONS ======== - - -// ======== 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); -} - -/*! - Destructor - */ -WpsWizardPage::~WpsWizardPage() -{ - OstTraceFunctionEntry1(WPSWIZARDPAGE_WPSWIZARDPAGE_DESTRUCTOR_ENTRY, this); - mWizard = NULL; - OstTraceFunctionExit1(WPSWIZARDPAGE_WPSWIZARDPAGE_DESTRUCTOR_EXIT, this); -} - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/src/wpswizardstepfive.cpp --- a/wlanutilities/wpswizard/src/wpswizardstepfive.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /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 "Eclipse Public License v1.0" - * which accompanies 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 5 - * - */ - -// System includes -#include -#include -#include -#include -#include -#include - -// User includes -#include "wpswizardstepfive.h" -#include "wpswizard_p.h" - -// Trace Includes -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wpswizardstepfiveTraces.h" -#endif - -// External function prototypes - -// Local constants - - -/*! - \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), - mHeading(NULL), - mValid(false), - mLoader(NULL) -{ - OstTraceFunctionEntry1(WPSPAGESTEPFIVE_WPSPAGESTEPFIVE_ENTRY, this); - OstTraceFunctionExit1(WPSPAGESTEPFIVE_WPSPAGESTEPFIVE_EXIT, this); -} - -/*! - Destructor - */ -WpsPageStepFive::~WpsPageStepFive() -{ - 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 - */ -HbWidget* WpsPageStepFive::initializePage() -{ - OstTraceFunctionEntry1(WPSPAGESTEPFIVE_INITIALIZEPAGE_ENTRY, this); - - if (!mWidget) { - bool ok; - - 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 (mLoader->findWidget("occ_wps_P1")); - Q_ASSERT(mWidget); - - mHeading = qobject_cast (mLoader->findWidget("label")); - Q_ASSERT(mHeading); - - mHeading->setPlainText(hbTrId("txt_occ_dialog_settings_received_for_multiple_wlan")); - - mRadio = qobject_cast (mLoader->findWidget( - "radioButtonList")); - Q_ASSERT(mRadio); - - QList arr = mWizard->getSettingsArray(); - - QStringList ssidList; - for (int count = 0; count < arr.count(); count++) - { - TWlanProtectedSetupCredentialAttribute attr = arr[count]; - QString ssid = QString::fromUtf8((const char*) attr.iSsid.Ptr(), - attr.iSsid.Length()); - ssidList.append(ssid); - } - mRadio->setItems(ssidList); - - 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); - return mWidget; -} - -/*! - Determines the Number of steps to move backwards when 'Prev' Button - is clicked - - @return int Number of pages to move backwards - */ -int WpsPageStepFive::previousTriggered() -{ - OstTraceFunctionEntry1(WPSPAGESTEPFIVE_PREVIOUSTRIGGERED_ENTRY, this); - OstTraceFunctionExit1(WPSPAGESTEPFIVE_PREVIOUSTRIGGERED_EXIT, this); - - return (PageWpsWizardStep5 - PageWpsWizardStep2) - 1; -} -/*! - CallBack when the cancel button is clicked - */ -void WpsPageStepFive::cancelTriggered() -{ - OstTraceFunctionEntry1(WPSPAGESTEPFIVE_CANCELTRIGGERED_ENTRY, this); - OstTraceFunctionExit1(WPSPAGESTEPFIVE_CANCELTRIGGERED_EXIT, this); -} - -/*! - 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); - removeFromStack = false; - OstTraceFunctionExit1(WPSPAGESTEPFIVE_NEXTID_EXIT, this); - return WlanWizardPage::PageProcessSettings; -} - -/*! - Determines whether the Next action button should be enabled or not - - @return bool Indicating whether next button is enabled or not. - */ -bool WpsPageStepFive::showPage() -{ - return mValid; -} - - -/*! - 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); - mValid = true; - mWizard->storeSettings(index); - mWizard->enableNextButton(mValid); - 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/src/wpswizardstepfour.cpp --- a/wlanutilities/wpswizard/src/wpswizardstepfour.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,330 +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 "Eclipse Public License v1.0" - * which accompanies 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 -#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 "wpswizardstepfourTraces.h" -#endif - -// External function prototypes - -// Local constants - - -/*! - \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), - mWpsErrorCode(0), - mCountCredentials(0), - mLoader(NULL), - d_ptr(NULL) -{ - OstTraceFunctionEntry1(WPSPAGESTEPFOUR_WPSPAGESTEPFOUR_ENTRY, this); - d_ptr.reset(new WpsPageStepFourPrivate(this)); - OstTraceFunctionExit1(WPSPAGESTEPFOUR_WPSPAGESTEPFOUR_EXIT, this); -} - -/*! - Destructor - */ -WpsPageStepFour::~WpsPageStepFour() -{ - 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 - */ -HbWidget* WpsPageStepFour::initializePage() -{ - OstTraceFunctionEntry1(WPSPAGESTEPFOUR_INITIALIZEPAGE_ENTRY, this); - - if (!mWidget) { - bool ok; - - mLoader = new HbDocumentLoader(mWizard->mainWindow()); - - mLoader->load(":/docml/occ_wps_P4.docml", &ok); - Q_ASSERT(ok); - - // Initialize orientation - loadDocmlSection(mWizard->mainWindow()->orientation()); - - mWidget = qobject_cast (mLoader->findWidget("occ_wps_P4")); - Q_ASSERT(mWidget); - - bool connectOk = connect( - mWizard->mainWindow(), - SIGNAL(orientationChanged(Qt::Orientation)), - this, - SLOT(loadDocmlSection(Qt::Orientation))); - Q_ASSERT(connectOk); - } - - OstTraceFunctionExit1(WPSPAGESTEPFOUR_INITIALIZEPAGE_EXIT, this); - - return mWidget; -} - -/*! - 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); - - int id = WpsWizardPage::PageNone; - removeFromStack = false; - - // 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 { - // only one response received. So go to the summary page - mWizard->storeSettings(0); - id = WlanWizardPage::PageProcessSettings; - } - - 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 - */ -int WpsPageStepFour::previousTriggered() -{ - OstTraceFunctionEntry1(WPSPAGESTEPFOUR_PREVIOUSTRIGGERED_ENTRY, this); - d_ptr->Cancel(); - OstTraceFunctionExit1(WPSPAGESTEPFOUR_PREVIOUSTRIGGERED_EXIT, this); - return (PageWpsWizardStep4 - PageWpsWizardStep2) - 1; -} - -/*! - Determines whether the Next action button should be enabled or not - - @return bool Indicating whether next button is enabled or not. - */ -bool WpsPageStepFour::showPage() -{ - mWpsErrorCode = 0; - - return false; -} - -/*! - 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_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; - - 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) ; -} - -/*! - Provides the functionality to initiate the WPS functionality - */ -void WpsPageStepFour::startWpsRunner() -{ - 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 when the cancel button is clicked - */ -void WpsPageStepFour::cancelTriggered() -{ - OstTraceFunctionEntry1( WPSPAGESTEPFOUR_CANCELTRIGGERED_ENTRY, this ); - d_ptr->Cancel(); - OstTraceFunctionExit1( WPSPAGESTEPFOUR_CANCELTRIGGERED_EXIT, this ); -} - -/*! - Loads docml at initialization phase and when HbMainWindow sends - orientation() signal. - - @param orientation[in] orientation to be loaded. - */ -void WpsPageStepFour::loadDocmlSection(Qt::Orientation orientation) -{ - 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); - } -} - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/src/wpswizardstepfour_p.cpp --- a/wlanutilities/wpswizard/src/wpswizardstepfour_p.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +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 "Eclipse Public License v1.0" -* which accompanies 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; - QT_TRAP_THROWING(ssidName.CreateL(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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/src/wpswizardstepthreebutton.cpp --- a/wlanutilities/wpswizard/src/wpswizardstepthreebutton.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +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 "Eclipse Public License v1.0" - * which accompanies 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 3 Push button number - * - */ - -// System includes -#include -#include -#include -#include -#include -#include - -// User includes -#include "wpswizardstepthreebutton.h" -#include "wpswizard_p.h" - -// Trace includes -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wpswizardstepthreebuttonTraces.h" -#endif - -// External function prototypes - -// Local constants - -/*! - \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), - mHeading(NULL), - mLoader(NULL) -{ - OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_WPSPAGESTEPTHREEBUTTON_ENTRY, this); - OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_WPSPAGESTEPTHREEBUTTON_EXIT, this); - -} - -/*! - Destructor - */ -WpsPageStepThreeButton::~WpsPageStepThreeButton() -{ - 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 - */ -HbWidget* WpsPageStepThreeButton::initializePage() -{ - OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_INITIALIZEPAGE_ENTRY, this); - - if (!mWidget) { - bool ok; - mLoader = new HbDocumentLoader(mWizard->mainWindow()); - - mLoader->load(":/docml/occ_wps_02_03.docml", &ok); - Q_ASSERT(ok); - - mWidget = qobject_cast (mLoader->findWidget("occ_wps_P2")); - Q_ASSERT(mWidget); - - mHeading = qobject_cast (mLoader->findWidget("label_heading")); - Q_ASSERT(mHeading); - - mHeading->setPlainText(hbTrId("txt_occ_dialog_first_press_button_on_the_wireless")); - } - - OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_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 WpsPageStepThreeButton::nextId(bool &removeFromStack) const -{ - OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_NEXTID_ENTRY, this); - removeFromStack = false; - OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_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 WpsPageStepThreeButton::previousTriggered() -{ - OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_PREVIOUSTRIGGERED_ENTRY, this); - OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_PREVIOUSTRIGGERED_EXIT, this); - return (PageWpsWizardStep3_Button - PageWpsWizardStep2); -} - - - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/src/wpswizardstepthreenumber.cpp --- a/wlanutilities/wpswizard/src/wpswizardstepthreenumber.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,218 +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 "Eclipse Public License v1.0" - * which accompanies 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 3 Number enter mode. - * - */ - -// System includes -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "wpswizardstepthreenumber.h" -#include "wpswizard_p.h" - -// Trace includes -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wpswizardstepthreenumberTraces.h" -#endif - -// External function prototypes - -// Local constants -const static int KMaxPINLength = 8; - -/*! - \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), - mHeading(NULL), - mLoader(NULL) -{ - OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_WPSPAGESTEPTHREENUMBER_ENTRY, this); - OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_WPSPAGESTEPTHREENUMBER_EXIT, this); - -} - -/*! - Destructor - */ -WpsPageStepThreeNumber::~WpsPageStepThreeNumber() -{ - 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 - */ -HbWidget* WpsPageStepThreeNumber::initializePage() -{ - OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_INITIALIZEPAGE_ENTRY, this); - - if (!mWidget) { - bool ok; - mLoader = new HbDocumentLoader(mWizard->mainWindow()); - - mLoader->load(":/docml/occ_wps_02_03.docml", &ok); - Q_ASSERT(ok); - - mWidget = qobject_cast (mLoader->findWidget("occ_wps_P2")); - Q_ASSERT(mWidget); - - mHeading= qobject_cast (mLoader->findWidget("label_heading")); - Q_ASSERT(mHeading); - } - - 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); -} - - -/*! - Determines whether the Next action button should be enabled or not - - @return bool Indicating whether next button is enabled or not. - */ -bool WpsPageStepThreeNumber::showPage() -{ - int randomNumber = computeRandNumber(); - mHeading->setPlainText( - HbParameterLengthLimiter( - "txt_occ_dialog_enter_1_on_the_wireless_station_t").arg( - QString::number(randomNumber))); - mWizard->setPin(randomNumber); - return true; -} - -/*! - Computes the Random number based on current system time - - @return int Returns the generated random number - */ -int WpsPageStepThreeNumber::computeRandNumber() -{ - 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; - int checkSum = computeCheckSum(pin); - pin *= 10; - pin += checkSum; - - OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_COMPUTERANDNUMBER_EXIT, this); - return pin; -} - -/*! - Computes the checksum for a given pin - - @return Returns the generated checksum - */ -int WpsPageStepThreeNumber::computeCheckSum(int aPin) -{ - OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_COMPUTECHECKSUM_ENTRY, this); - - int accum = 0; - aPin *= 10; - accum += 3 * ((aPin / 10000000) % 10); - accum += 1 * ((aPin / 1000000) % 10); - accum += 3 * ((aPin / 100000) % 10); - accum += 1 * ((aPin / 10000) % 10); - accum += 3 * ((aPin / 1000) % 10); - accum += 1 * ((aPin / 100) % 10); - accum += 3 * ((aPin / 10) % 10); - int digit = (accum % 10); - OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_COMPUTECHECKSUM_EXIT, this); - return (10 - digit) % 10; -} diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/src/wpswizardsteptwo.cpp --- a/wlanutilities/wpswizard/src/wpswizardsteptwo.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,227 +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 "Eclipse Public License v1.0" - * which accompanies 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 2 - * - */ - -// System includes -#include -#include -#include -#include -#include - -// User includes -#include "wpswizardsteptwo.h" -#include "wpswizard_p.h" - -// Trace includes -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wpswizardsteptwoTraces.h" -#endif - -// External function prototypes - -// Local constants - -/*! - \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), - mHeading(NULL), - mValid(false), - mItemSelected(0), - mLoader(NULL) -{ - OstTraceFunctionEntry1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_ENTRY, this); - OstTraceFunctionExit1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_EXIT, this); - -} - -/*! - Destructor - */ -WpsPageStepTwo::~WpsPageStepTwo() -{ - 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 - */ -HbWidget* WpsPageStepTwo::initializePage() -{ - OstTraceFunctionEntry1(WPSPAGESTEPTWO_INITIALIZEPAGE_ENTRY, this); - - if (!mWidget) { - bool ok; - 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 (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")); - - 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); - - 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(WPSPAGESTEPTWO_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 WpsPageStepTwo::nextId(bool &removeFromStack) const -{ - OstTraceFunctionEntry1(WPSPAGESTEPTWO_NEXTID_ENTRY, this); - int id = WpsWizardPage::PageWpsWizardStep3_Button; - removeFromStack = false; - - if (mItemSelected == WpsPushButtonMode) { - id = WpsWizardPage::PageWpsWizardStep3_Button; - - } else if (mItemSelected == WpsPinCodeMode) { - id = WpsWizardPage::PageWpsWizardStep3_Number; - - } 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 - */ -int WpsPageStepTwo::previousTriggered() -{ - OstTraceFunctionEntry1(WPSPAGESTEPTWO_PREVIOUSTRIGGERED_ENTRY, this); - OstTraceFunctionExit1(WPSPAGESTEPTWO_PREVIOUSTRIGGERED_EXIT, this); - return 1; -} - -/*! - CallBack when the cancel button is clicked - */ -void WpsPageStepTwo::cancelTriggered() -{ - OstTraceFunctionEntry1(WPSPAGESTEPTWO_CANCELTRIGGERED_ENTRY, this); - OstTraceFunctionExit1(WPSPAGESTEPTWO_CANCELTRIGGERED_EXIT, this); -} - -/*! - Determines whether the Next action button should be enabled or not - - @return bool Indicating whether next button is enabled or not. - */ -bool WpsPageStepTwo::showPage() -{ - return mValid; -} - -/*! - Call back when an item is selected from the list on the UI - - @param [in] index Indcating the relative position in the list - */ -void WpsPageStepTwo::itemSelected(int index) -{ - OstTraceFunctionEntry1(WPSPAGESTEPTWO_ITEMSELECTED_ENTRY, this); - mValid = true; - mWizard->enableNextButton(mValid); - mItemSelected = index; - OstTraceFunctionExit1(WPSPAGESTEPTWO_ITEMSELECTED_EXIT, this); -} - -/*! - Loads docml at initialization phase and when HbMainWindow sends - orientation() signal. - - @param [in] orientation orientation to be loaded. - */ -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); - } -} - diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/stubs/stub_wlanmgmtclient.cpp --- a/wlanutilities/wpswizard/stubs/stub_wlanmgmtclient.cpp Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/stubs/stubs.pri --- a/wlanutilities/wpswizard/stubs/stubs.pri Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +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 "Eclipse Public License v1.0" -# which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/stubs/wlanmgmtclient.h --- a/wlanutilities/wpswizard/stubs/wlanmgmtclient.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +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 "Eclipse Public License v1.0" -* which accompanies 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 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/traces/OstTraceDefinitions.h --- a/wlanutilities/wpswizard/traces/OstTraceDefinitions.h Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +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 "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: TraceHeader ,includes the TraceAPI - * - * - */ -#ifndef __OSTTRACEDEFINITIONS_H__ -#define __OSTTRACEDEFINITIONS_H__ -#include -#endif diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wpswizard/wpswizard.pro --- a/wlanutilities/wpswizard/wpswizard.pro Tue Aug 31 16:18:40 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +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 "Eclipse Public License v1.0" -# which accompanies 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 -# - - -TEMPLATE = lib -TARGET = wpswizard -DEFINES += BUILD_WPS_WIZARD_DLL -VERSION = 0.0.1 -CONFIG += hb -MOC_DIR = build -RCC_DIR = build -RESOURCES += resources/wpswizard_resource.qrc -TRANSLATIONS += wpswizardplugin.ts - -DOCML += \ - resources/occ_wps_01_05.docml \ - resources/occ_wps_02_03.docml \ - resources/occ_wps_P4.docml - -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 \ - -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 - - -symbian { - - LIBS += -lecom - - TARGET.UID3 = 0x2003D2FE - TARGET.CAPABILITY = CAP_GENERAL_DLL - - TARGET.EPOCALLOWDLLDATA = 1 - -    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) -