# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1261034428 -7200 # Node ID 56b72877c1cbc509b4126714052c6255c1ae8ee7 Revision: 200949 Kit: 200951 diff -r 000000000000 -r 56b72877c1cb group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,30 @@ +/* +* 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 wirelessacc +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +#include "../hotspotfw/group/bld.inf" +#include "../hsfw_plat/group/bld.inf" +#include "../wlanutilities/group/bld.inf" + +PRJ_TESTMMPFILES + diff -r 000000000000 -r 56b72877c1cb hotspotfw/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2002-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 file for project HotSpot Server +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/hotspot.iby CORE_MW_LAYER_IBY_EXPORT_PATH(hotspot.iby) +../rom/hotspotResources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(hotspotResources.iby) + +// 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 + +// internal interface +../hsserver/inc/hssscaninfo.h |../inc/hssscaninfo.h +../hsserver/inc/hssscaninfo.inl |../inc/hssscaninfo.inl +../hsserver/inc/hssscanlist.h |../inc/hssscanlist.h +../hsserver/inc/hssscanlist.inl |../inc/hssscanlist.inl +../hsserver/inc/hssscanlistiterator.h |../inc/hssscanlistiterator.h +../hsserver/inc/hssscanlistiterator.inl |../inc/hssscanlistiterator.inl +../hsserver/inc/hssscanoffsets.h |../inc/hssscanoffsets.h +../hsserver/inc/hssiapsettingshandler.h |../inc/hssiapsettingshandler.h +../hsserver/inc/hotspotclientserver.h |../inc/hotspotclientserver.h +../hsclient/inc/hssinterface.h |../inc/hssinterface.h +../hsclient/inc/hssiaphandler.h |../inc/hssiaphandler.h +../hsclient/inc/hssscanhandler.h |../inc/hssscanhandler.h +../hsclient/inc/hsssrvnotifications.h |../inc/hsssrvnotifications.h + +PRJ_MMPFILES +../internetconnectivitytestservice/group/ictsclientinterface.mmp +../hsserver/group/hotspotserver.mmp +../hsclient/group/hotspotclient.mmp +../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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/data/hsbrowser.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/data/hsbrowser.rss Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/data/hsbrowser_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/data/hsbrowser_reg.rss Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/group/hsbrowser.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/group/hsbrowser.mmp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/inc/am_debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/am_debug.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/inc/am_debug.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/am_debug.inl Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/inc/hsbrowserapp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowserapp.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/inc/hsbrowserappui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowserappui.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/inc/hsbrowsercommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowsercommon.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/inc/hsbrowsercontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowsercontainer.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/inc/hsbrowsercontainer.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowsercontainer.inl Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/inc/hsbrowserdocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowserdocument.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/inc/hsbrowserdocument.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowserdocument.inl Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/inc/hsbrowserhssrvnotifs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowserhssrvnotifs.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,128 @@ +/* +* 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 ); + + /** + * BSSID has changed (i.e. AP handover). + */ + virtual void BssidChanged( TWlanBssid& /* aNewBSSID */ ) {}; + + /** + * Connection has been lost. + */ + virtual void BssLost() {}; + + /** + * Connection has been regained. + */ + virtual void BssRegained() {}; + + /** + * New networks have been detected during scan. + */ + virtual void NewNetworksDetected() {}; + + /** + * One or more networks have been lost since the last scan. + */ + virtual void OldNetworksLost() {}; + + /** + * The used transmit power has been changed. + * @param aPower The transmit power in mW. + */ + virtual void TransmitPowerChanged( TUint /* aPower */ ) {}; + + /** + * Received signal strength level has been changed. + * @param aRssClass specifies the current class of the received signal + * @param aRss RSS level in absolute dBm values. + */ + virtual void RssChanged(TWlanRssClass /* aRssClass */, TUint /* aRss */ ) {}; + + + 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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/inc/hsbrowserictsobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowserictsobserver.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implements callback interface for Internet Connectivity Test Service +* notifications. +* +*/ + + + +#ifndef HSBROWSERICTSOBSERVER_H +#define HSBROWSERICTSOBSERVER_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATION +class CHsBrowserContainer; + +// CLASS DECLARATION +/** +* This class implements callback interface for Internet Connectivity Test Service +* notifications. +*/ +class CHsBrowserIctsObserver : public CBase, public MIctsObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * + * @param aContainer Pointer to container of browser application + */ + static CHsBrowserIctsObserver* NewL( CHsBrowserContainer* aContainer ); + + /** + * Destructor. + */ + ~CHsBrowserIctsObserver(); + + public: // from MIctsObserver + + /** + * From MIctsObserver, ConnectivityObserver + */ + void ConnectivityObserver( TIctsTestResult aResult, const TDesC& aString ); + + private: // new + + /** + * Process connection ok event. + */ + void ProcessConnectionOk(); + + private: + + /** + * C++ default constructor. + * + * @param aContainer Pointer to container of browser application. + */ + CHsBrowserIctsObserver( CHsBrowserContainer* aContainer ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: + + /** + * Container of hotspot browser application. + * Not owned. + */ + CHsBrowserContainer* iContainer; + }; + +#endif // HSBROWSERICTSOBSERVER_H + +// End of File + diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/inc/hsbrowserloadeventobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowserloadeventobserver.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/inc/hsbrowsermodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowsermodel.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/inc/hsbrowsermodel.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowsermodel.inl Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/inc/hsbrowserspecialloadobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/hsbrowserspecialloadobserver.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/loc/hsbrowser.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/loc/hsbrowser.loc Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/src/hsbrowserapp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/src/hsbrowserapp.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/src/hsbrowserappui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/src/hsbrowserappui.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/src/hsbrowsercontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/src/hsbrowsercontainer.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/src/hsbrowserdocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/src/hsbrowserdocument.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/src/hsbrowserhssrvnotifs.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/src/hsbrowserhssrvnotifs.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/src/hsbrowserictsobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/src/hsbrowserictsobserver.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implements callback interface for Internet Connectivity Test Service +* notifications. +* +*/ + + + +// INCLUDE FILES +#include +#include + +#include "hsbrowserictsobserver.h" +#include "hsbrowsercontainer.h" +#include "hotspotclientserver.h" +#include "hsbrowsermodel.h" +#include "am_debug.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CHsBrowserIctsObserver::NewL +// --------------------------------------------------------- +// +CHsBrowserIctsObserver* CHsBrowserIctsObserver::NewL( + CHsBrowserContainer* aContainer ) + { + DEBUG( "CHsBrowserIctsObserver::CHsBrowserIctsObserver::NewL()()" ); + CHsBrowserIctsObserver* self = new(ELeave) CHsBrowserIctsObserver( aContainer ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------- +// CHsBrowserIctsObserver::~CHsBrowserIctsObserver +// --------------------------------------------------------- +// +CHsBrowserIctsObserver::~CHsBrowserIctsObserver() + { + DEBUG( "CHsBrowserIctsObserver::~CHsBrowserIctsObserver()" ); + } + +// ----------------------------------------------------------------------------- +// CHsBrowserIctsObserver::ConnectivityObserver +// ----------------------------------------------------------------------------- +// +void CHsBrowserIctsObserver::ConnectivityObserver( TIctsTestResult aResult, + const TDesC& /* aString */ ) + { + DEBUG1("CHsBrowserIctsObserver::ConnectivityObserver() result: %d", aResult); + switch ( aResult ) + { + case EConnectionOk : + ProcessConnectionOk(); + break; + case EHttpAuthenticationNeeded : + case EConnectionNotOk : + case ETimeout : + default: + break; + } + } + +// --------------------------------------------------------- +// CHsBrowserIctsObserver::ProcessConnectionOk +// --------------------------------------------------------- +// +void CHsBrowserIctsObserver::ProcessConnectionOk() + { + DEBUG( "CHsBrowserIctsObserver::ProcessConnectionOk()" ); + if ( iContainer ) + { + CHsBrowserModel* model = iContainer->Model(); + if ( model ) + { + model->SetState( EHsBrowserUiAuthenticatedOk, ETrue ); + } + iContainer->ShowLoginCompleteNote(); + iContainer->SendToBackground(); + iContainer->UpdateSoftkeys(); + } + } + +// --------------------------------------------------------- +// CHsBrowserIctsObserver::CHsBrowserIctsObserver +// --------------------------------------------------------- +// +CHsBrowserIctsObserver::CHsBrowserIctsObserver( + CHsBrowserContainer* aContainer ) : iContainer( aContainer ) + { + DEBUG( "CHsBrowserIctsObserver::CHsBrowserIctsObserver()" ); + } + +// --------------------------------------------------------- +// CHsBrowserIctsObserver::ConstructL +// --------------------------------------------------------- +// +void CHsBrowserIctsObserver::ConstructL() + { + DEBUG( "CHsBrowserIctsObserver::ConstructL()" ); + } + +// End of File diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/src/hsbrowserloadeventobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/src/hsbrowserloadeventobserver.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,327 @@ +/* +* 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: + { + DEBUG( "CHsBrowserLoadEventObserver::HandleBrowserLoadEventL() 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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/src/hsbrowsermodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/src/hsbrowsermodel.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsbrowser/src/hsbrowserspecialloadobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/src/hsbrowserspecialloadobserver.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hotspotfw/hsclient/NetCfgExtnHotSpot/inc/NetCfgExtnHotSpot.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsclient/NetCfgExtnHotSpot/inc/NetCfgExtnHotSpot.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,111 @@ +/* +* 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: NIFMAN configuration +* +*/ + + + + +#ifndef __NET_CFG_EXTN_HOTSPOT_H__ +#define __NET_CFG_EXTN_HOTSPOT_H__ + +// INCLUDES +#include +#include +#include +#include "hssinterface.h" + +// CLASS DECLARATION +/** +* ECom plugin of NIFMAN configuration +* +* @lib NetCfgExtnHotSpot.lib +* @since S60 5.0 +*/ +class CNetworkConfigExtensionHotSpot : public CNetworkConfigExtensionBase + { + +public: + + /** + * Two-phased constructor. + */ + static CNetworkConfigExtensionHotSpot* NewL( TAny* aMNifIfNotify ); + + /** + * Destructor. + */ + virtual ~CNetworkConfigExtensionHotSpot(); + + /** + * From CNetworkConfigExtensionBase + * @since S60 5.0 + * @param aMessage the message + * @return None + */ + void SendIoctlMessageL( const ESock::RLegacyResponseMsg& aMessage ); + +protected: + + /** + * C++ default constructor. + */ + CNetworkConfigExtensionHotSpot( MNifIfNotify& aNifIfNotify ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * From CTimer. Waits for StartLogin() completion from Hotspot Server + * @since S60 5.0 + * @return None + */ + virtual void RunL(); + + /** + * From CTimer. Implements cancel routines. + * @since S60 5.0 + * @return None + */ + virtual void DoCancel(); + + // Authentication flag + TBool iNotAuthenticated; + + // Authentication flag + TBool iNotDeregistered; + + // Flagging if Connect() to Hotspot done successfully + TInt iHotspotConnect; + +private: + + // Hotspot client interface + RHssInterface iClient; + }; + + /** + * CNetworkConfigExtensionBase - constructor + * @param aNifIfNotify - client of the control + */ + inline CNetworkConfigExtensionHotSpot::CNetworkConfigExtensionHotSpot( MNifIfNotify& aNifIfNotify ) : + CNetworkConfigExtensionBase( aNifIfNotify ) + { + } + +#endif + diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsclient/NetCfgExtnHotSpot/src/10282EC9.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsclient/NetCfgExtnHotSpot/src/10282EC9.rss Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 1028 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Registry info for Hotspot Network Config Extension to NIFMAN +* +*/ + + + + + +#include + +// ---------------------------------------------------------------------------------------- +// ECOM resource definitions for Network Config Extension plugin +// ---------------------------------------------------------------------------------------- +// + +RESOURCE REGISTRY_INFO NIFPlugin +{ +dll_uid = 0x10282EC9; +interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x101FEBE1; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x10282ECA; + version_no = 1; + display_name = ""; + default_data = "NetCfgExtnHotSpot"; + opaque_data = ""; + } + }; + } + }; +} diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsclient/NetCfgExtnHotSpot/src/NetCfgExtnHotSpot.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsclient/NetCfgExtnHotSpot/src/NetCfgExtnHotSpot.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,199 @@ +/* +* Copyright (c) 2002-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 Network Config Extension for HotSpot +* +*/ + +// INCLUDE FILES +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include "NetCfgExtnHotSpot.h" +#include "implementationproxy.h" +#include "am_debug.h" + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +CNetworkConfigExtensionHotSpot* CNetworkConfigExtensionHotSpot::NewL( + TAny* aMNifIfNotify ) + { + MNifIfNotify* nifIfNotify = reinterpret_cast( aMNifIfNotify ); + CNetworkConfigExtensionHotSpot* pDaemon = + new( ELeave )CNetworkConfigExtensionHotSpot( *nifIfNotify ); + CleanupStack::PushL( pDaemon ); + pDaemon->ConstructL(); + CleanupStack::Pop( pDaemon ); + return pDaemon; + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CNetworkConfigExtensionHotSpot::ConstructL() + { + DEBUG( "CNetworkConfigExtensionHotSpot::ConstructL()" ); + CNetworkConfigExtensionBase::ConstructL(); + iNotAuthenticated = ETrue; + iNotDeregistered = ETrue; + iHotspotConnect = KErrNotFound; + DEBUG( "CNetworkConfigExtensionHotSpot::ConstructL() Done" ); + } + +// ----------------------------------------------------------------------------- +// SendIoctlMessageL +// Forwards Ioctl request to the daemon and activates the AO to wait for response +// ----------------------------------------------------------------------------- +// +void CNetworkConfigExtensionHotSpot::SendIoctlMessageL( const ESock::RLegacyResponseMsg& aMessage ) + + { + TInt name = aMessage.Int1(); + if ( aMessage.Int0() != KCOLConfiguration ) + { + User::Leave( KErrNotSupported ); + } + else + { + switch ( name ) + { + case KConnAddrRelease: + case KConnAddrRenew: + case KConnSetDhcpRawOptionData: + if ( aMessage.HasCapability(ECapabilityNetworkControl, "NetCfgExtnDhcp" ) == EFalse ) + { + User::Leave (KErrPermissionDenied ); + } + } + } + CNetworkConfigExtensionBase::SendIoctlMessageL( aMessage ); + } + +// ----------------------------------------------------------------------------- +// ~CNetworkConfigExtensionHotSpot +// ----------------------------------------------------------------------------- +// +CNetworkConfigExtensionHotSpot::~CNetworkConfigExtensionHotSpot() + + { + DEBUG( "CNetworkConfigExtensionHotSpot::~CNetworkConfigExtensionHotSpot()" ); + } + +// ----------------------------------------------------------------------------- +// ImplementationTable +// ----------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x10282ECA, CNetworkConfigExtensionHotSpot::NewL) + }; + +// ----------------------------------------------------------------------------- +// ImplementationGroupProxy +// ----------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + + +// ----------------------------------------------------------------------------- +// RunL +// ----------------------------------------------------------------------------- +// +void CNetworkConfigExtensionHotSpot::RunL() + { + DEBUG( "CNetworkConfigExtensionHotSpot::RunL()" ); + if (iLastGenericProgressStage == KConfigDaemonStartingRegistration) + { + + if(iNotAuthenticated) + { + DEBUG( "CNetworkConfigExtensionHotSpot::RunL() not auth" ); + TUint iapId = iConnectionInfoBuf().iIapId; + TUint networkId = iConnectionInfoBuf().iNetId; + + iHotspotConnect = iClient.Connect(); + + if ( KErrNone == iHotspotConnect ) + { + iClient.StartLogin( iapId, networkId, iStatus); + SetActive(); + } + else + { + CNetworkConfigExtensionBase::RunL(); + } + iNotAuthenticated = EFalse; + } + else + { + DEBUG( "CNetworkConfigExtensionHotSpot::RunL() close" ); + CNetworkConfigExtensionBase::RunL(); + } + + } + else if (iLastGenericProgressStage == KConfigDaemonStartingDeregistration) + { + if(iNotDeregistered) + { + DEBUG( "CNetworkConfigExtensionHotSpot::RunL() dereg" ); + TUint iapId = iConnectionInfoBuf().iIapId; + TUint networkId = iConnectionInfoBuf().iNetId; + + if ( KErrNone == iHotspotConnect ) + { + iClient.CloseConnection( iapId, iStatus); + SetActive(); + } + else + { + CNetworkConfigExtensionBase::RunL(); + } + iNotDeregistered = EFalse; + } + else + { + DEBUG( "CNetworkConfigExtensionHotSpot::RunL() dereg close" ); + iClient.Close(); + CNetworkConfigExtensionBase::RunL(); + } + } + else // original ========================================================= + { + DEBUG( "CNetworkConfigExtensionHotSpot::RunL() original" ); + CNetworkConfigExtensionBase::RunL(); + } + } + +// ----------------------------------------------------------------------------- +// DoCancel +// ----------------------------------------------------------------------------- +// +void CNetworkConfigExtensionHotSpot::DoCancel() + { + DEBUG( "CNetworkConfigExtensionHotSpot::RunL() DoCancel" ); + iClient.CancelLogin(); + } + +// end of file + diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsclient/bwins/hotspotclientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsclient/bwins/hotspotclientu.def Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,30 @@ +EXPORTS + ?ActivateNotificationsL@RHssInterface@@QAEXAAVMHssSrvNotifications@@@Z @ 1 NONAME ; void RHssInterface::ActivateNotificationsL(class MHssSrvNotifications &) + ?Cancel@RHssInterface@@QAEXI@Z @ 2 NONAME ; void RHssInterface::Cancel(unsigned int) + ?CancelLogin@RHssInterface@@QAEHXZ @ 3 NONAME ; int RHssInterface::CancelLogin(void) + ?CancelNotifications@RHssInterface@@QAEXXZ @ 4 NONAME ; void RHssInterface::CancelNotifications(void) + ?CancelStart@RHssInterface@@QAEHI@Z @ 5 NONAME ; int RHssInterface::CancelStart(unsigned int) + ?ChangeSettings@RHssInterface@@QAEHIABVTHssIapSettings@@@Z @ 6 NONAME ; int RHssInterface::ChangeSettings(unsigned int, class THssIapSettings const &) + ?CheckBackgroundScanL@RHssInterface@@QAEKXZ @ 7 NONAME ; unsigned long RHssInterface::CheckBackgroundScanL(void) + ?Close@RHssInterface@@QAEXXZ @ 8 NONAME ; void RHssInterface::Close(void) + ?CloseConnection@RHssInterface@@QAEXIAAVTRequestStatus@@@Z @ 9 NONAME ; void RHssInterface::CloseConnection(unsigned int, class TRequestStatus &) + ?Connect@RHssInterface@@QAEHXZ @ 10 NONAME ; int RHssInterface::Connect(void) + ?GetIap@RHssInterface@@QAEKVTIpcArgs@@@Z @ 11 NONAME ; unsigned long RHssInterface::GetIap(class TIpcArgs) + ?GetScanResults@RHssInterface@@QAEHAAVHssScanList@@@Z @ 12 NONAME ; int RHssInterface::GetScanResults(class HssScanList &) + ?Join@RHssInterface@@QAEHI@Z @ 13 NONAME ; int RHssInterface::Join(unsigned int) + ?LoginComplete@RHssInterface@@QAEHIH@Z @ 14 NONAME ; int RHssInterface::LoginComplete(unsigned int, int) + ?LogoutComplete@RHssInterface@@QAEHI@Z @ 15 NONAME ; int RHssInterface::LogoutComplete(unsigned int) + ?Register@RHssInterface@@QAEIVTUid@@ABVTDesC16@@I@Z @ 16 NONAME ; unsigned int RHssInterface::Register(class TUid, class TDesC16 const &, unsigned int) + ?SetUiState@RHssInterface@@QAEXII@Z @ 17 NONAME ; void RHssInterface::SetUiState(unsigned int, unsigned int) + ?ShutdownServerL@RHssInterface@@QAEHXZ @ 18 NONAME ; int RHssInterface::ShutdownServerL(void) + ?Start@RHssInterface@@QAEXIAAVTRequestStatus@@@Z @ 19 NONAME ; void RHssInterface::Start(unsigned int, class TRequestStatus &) + ?StartAgain@RHssInterface@@QAEXIAAVTRequestStatus@@@Z @ 20 NONAME ; void RHssInterface::StartAgain(unsigned int, class TRequestStatus &) + ?StartLogin@RHssInterface@@QAEXIIAAVTRequestStatus@@@Z @ 21 NONAME ; void RHssInterface::StartLogin(unsigned int, unsigned int, class TRequestStatus &) + ?Stop@RHssInterface@@QAEHI@Z @ 22 NONAME ; int RHssInterface::Stop(unsigned int) + ?UnRegister@RHssInterface@@QAEHIIVTUid@@@Z @ 23 NONAME ; int RHssInterface::UnRegister(unsigned int, unsigned int, class TUid) + ?StartBrowser@RHssInterface@@QAEXABVTDesC16@@IIAAVTRequestStatus@@@Z @ 24 NONAME ; void RHssInterface::StartBrowser(class TDesC16 const &, unsigned int, unsigned int, class TRequestStatus &) + ?GetConnectionBssid@RHssInterface@@QAEHAAV?$TBuf8@$05@@@Z @ 25 NONAME ; int RHssInterface::GetConnectionBssid(class TBuf8<6> &) + ?AddIapSsidList@RHssInterface@@QAEHIABV?$CArrayFixFlat@V?$TBuf8@$0CA@@@@@@Z @ 26 NONAME ; int RHssInterface::AddIapSsidList(unsigned int, class CArrayFixFlat > const &) + ?SetTimerValues@RHssInterface@@QAEHVTUid@@II@Z @ 27 NONAME ; int RHssInterface::SetTimerValues(class TUid, unsigned int, unsigned int) + ?GetClientIapsL@RHssInterface@@QAEXVTUid@@AAV?$RArray@I@@@Z @ 28 NONAME ; void RHssInterface::GetClientIapsL(class TUid, class RArray &) + diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsclient/eabi/hotspotclientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsclient/eabi/hotspotclientu.def Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,34 @@ +EXPORTS + _ZN13RHssInterface10SetUiStateEjj @ 1 NONAME + _ZN13RHssInterface10StartAgainEjR14TRequestStatus @ 2 NONAME + _ZN13RHssInterface10StartLoginEjjR14TRequestStatus @ 3 NONAME + _ZN13RHssInterface10UnRegisterEjj4TUid @ 4 NONAME + _ZN13RHssInterface11CancelLoginEv @ 5 NONAME + _ZN13RHssInterface11CancelStartEj @ 6 NONAME + _ZN13RHssInterface13LoginCompleteEji @ 7 NONAME + _ZN13RHssInterface14ChangeSettingsEjRK15THssIapSettings @ 8 NONAME + _ZN13RHssInterface14GetScanResultsER11HssScanList @ 9 NONAME + _ZN13RHssInterface14LogoutCompleteEj @ 10 NONAME + _ZN13RHssInterface15CloseConnectionEjR14TRequestStatus @ 11 NONAME + _ZN13RHssInterface15ShutdownServerLEv @ 12 NONAME + _ZN13RHssInterface19CancelNotificationsEv @ 13 NONAME + _ZN13RHssInterface20CheckBackgroundScanLEv @ 14 NONAME + _ZN13RHssInterface22ActivateNotificationsLER20MHssSrvNotifications @ 15 NONAME + _ZN13RHssInterface4JoinEj @ 16 NONAME + _ZN13RHssInterface4StopEj @ 17 NONAME + _ZN13RHssInterface5CloseEv @ 18 NONAME + _ZN13RHssInterface5StartEjR14TRequestStatus @ 19 NONAME + _ZN13RHssInterface6CancelEj @ 20 NONAME + _ZN13RHssInterface6GetIapE8TIpcArgs @ 21 NONAME + _ZN13RHssInterface7ConnectEv @ 22 NONAME + _ZN13RHssInterface8RegisterE4TUidRK7TDesC16j @ 23 NONAME + _ZTI14CHssIapHandler @ 24 NONAME ; ## + _ZTI15CHssScanHandler @ 25 NONAME ; ## + _ZTV14CHssIapHandler @ 26 NONAME ; ## + _ZTV15CHssScanHandler @ 27 NONAME ; ## + _ZN13RHssInterface12StartBrowserERK7TDesC16jjR14TRequestStatus @ 28 NONAME + _ZN13RHssInterface18GetConnectionBssidER5TBuf8ILi6EE @ 29 NONAME + _ZN13RHssInterface14AddIapSsidListEjRK13CArrayFixFlatI5TBuf8ILi32EEE @ 30 NONAME + _ZN13RHssInterface14SetTimerValuesE4TUidjj @ 31 NONAME + _ZN13RHssInterface14GetClientIapsLE4TUidR6RArrayIjE @ 32 NONAME + diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsclient/group/NetCfgExtnHotSpot.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsclient/group/NetCfgExtnHotSpot.mmp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2002-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 specification file for the HotSpot NIFMAN plug-in +* +*/ + +#include + +TARGET NetCfgExtnHotSpot.dll +TARGETTYPE PLUGIN + +UID 0x10009D8D 0x10282EC9 +VENDORID VID_DEFAULT + +SOURCEPATH ../NetCfgExtnHotSpot/src +SOURCE NetCfgExtnHotSpot.cpp + +START RESOURCE 10282EC9.rss +TARGET NetCfgExtnHotSpot +END + +USERINCLUDE ../inc +USERINCLUDE ../../hsserver/inc +USERINCLUDE ../NetCfgExtnHotSpot/inc + +SYSTEMINCLUDE /epoc32/include/ecom + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY netstsrv.lib +LIBRARY ecom.lib +LIBRARY netcfgext.lib +LIBRARY esock.lib +LIBRARY http.lib +LIBRARY inetprotutil.lib +LIBRARY insock.lib +LIBRARY hotspotclient.lib +LIBRARY esocksvr.lib + +CAPABILITY CommDD PowerMgmt ReadDeviceData WriteDeviceData TrustedUI ProtServ NetworkControl NetworkServices LocalServices ReadUserData WriteUserData diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsclient/group/hotspotclient.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsclient/group/hotspotclient.mmp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2002-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: project specification file +* +*/ + + +#include + +TARGET hotspotclient.dll +TARGETTYPE dll +UID 0x1000008d 0x10282EC8 +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE hssinterface.cpp +SOURCE hsssrvnotifications.cpp +SOURCE hssiaphandler.cpp +SOURCE hssscanhandler.cpp + +USERINCLUDE ../../inc +USERINCLUDE ../inc +USERINCLUDE ../../hsserver/inc + +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +LIBRARY commdb.lib +LIBRARY commsdat.lib +LIBRARY euser.lib +LIBRARY estor.lib +LIBRARY esock.lib +LIBRARY ecom.lib +LIBRARY efsrv.lib +LIBRARY cmmanager.lib + +STATICLIBRARY wlanscanlist.lib +STATICLIBRARY hssscanlist.lib + diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsclient/group/hssmgmtimpl.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsclient/group/hssmgmtimpl.mmp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2002-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: project specification file for the CHSSMgmtImpl +* +*/ + + +#include + +TARGET hssmgmtimpl.dll +TARGETTYPE plugin +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +UID 0x10009D8D 0x10282ecc + +SOURCEPATH ../src +SOURCE hssmgmtimpl.cpp +SOURCE hssmgmtscaninfoimpl.cpp + +START RESOURCE ../src/10282ecc.rss +TARGET HSSMgmtImpl.rsc +END + +USERINCLUDE ../../inc +USERINCLUDE ../../hsserver/inc +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY hotspotclient.lib + + +STATICLIBRARY hssscanlist.lib diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsclient/inc/hssiaphandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsclient/inc/hssiaphandler.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2002-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 iap +* +*/ + + +#ifndef HSSIAPHANDLER_H +#define HSSIAPHANDLER_H + +// INCLUDES +#include +#include "hssiapsettings.h" +#include "hssiapsettingshandler.h" + +// CLASS DECLARATION +/** +* @brief IAP settings handler +*/ +class CHssIapHandler : public CBase + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + * @return Pointer to the constructed object. + */ + static CHssIapHandler* NewL( ); + + /** + * Destructor. + */ + virtual ~CHssIapHandler(); + + /** + * Starts IAP changes + * @param aIapID, IAP id + * @param aSettings, IAP settings struct + * @return KErrNone if successful, otherwise one of system wide errorcodes. + */ + TInt ChangeSettingsL( const TUint aIapID, const THssIapSettings& aSettings ); + + /** + * Gets Network Id + * @param aIapId, IAP id + * @param aNetId, Network id + * @return None + */ + void GetNetworkIdL( const TUint aIapId, TUint32& aNetId ); + + /** + * Gets all Iaps of client + * @param aUId, UID of client + * @param aIapIdArray, Array for client's Iaps + * @return None + */ + void GetClientIapsL( const TUid aUid, RArray& aIapIdArray ); + + protected: + + /** + * C++ default constructor. + */ + CHssIapHandler(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: + + /** + * Writes WEP keys from aSettings to current WLANServiceTable record + * @param aSettings, IAP settings struct + * @return KErrNone if successful, otherwice one of system wide errorcodes. + */ + TInt WriteWepKeysL( const THssIapSettings& aSettings ); + + /** + * Copies wepkey string from wepkey structs TUint8 + * buffer to a WLANServiceTable (CommsDat) + * @param aInputKey, WepKey + * @param aFormat, format of WepKey ( ascii/hexadecimal) + * @param aPackedKey, packed WepKey + */ + 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 + * @param aDest, hexa + */ + void ConvertAsciiToHex( const TDes8& aSource, + 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 ); + + private: // Data + + /** + * CommsDat WLAN record instance + * Own + */ + CMDBGenericRecord* iWLANRecord; + + }; + + +#endif diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsclient/inc/hssinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsclient/inc/hssinterface.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,329 @@ +/* +* 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: Implementation of HotSpot Server API +* +*/ + + +#ifndef HSSINTERFACE_H +#define HSSINTERFACE_H + +#include +#include "hssmgmtcommon.h" +#include "hssiapsettings.h" +#include "hssiaphandler.h" +#include "hssscanhandler.h" +#include "hssscanlist.h" +#include "hsssrvnotifications.h" + +class MHssSrvNotifications; +class CHssSrvNotifications; + +NONSHARABLE_CLASS( RHssInterface ) : public RSessionBase +{ + public: + + /** + * Client makes the connection to the server. + * @return General Symbian error code. + */ + IMPORT_C TInt Connect(); + + /** + * Version information. + * @return Version information. + */ + TVersion Version() const; + + /** + * Close the connection; release the handle to the server. + */ + IMPORT_C void Close(); + + /** + * Set a message to pend notification. + * @param aReturnValue Status of the calling active object. + * @param aReturnData (OUT) Data returned by the notification. + */ + void WaitForNotification( TRequestStatus& aReturnValue, + TDes8& aReturnData ); + + /** + * Cancel pending notification message from server. + * CHssSrvNotifications class uses this method to cancel pending message at server + * side. + */ + void CancelWaitForNotification(); + + /** + * Activate the notification service. + * + * After the client has enabled the notification service, it can + * receive asynchronous notifications from the server. + * @param aCallback The class that implements the callback interface. + */ + IMPORT_C void ActivateNotificationsL( MHssSrvNotifications& aCallback ); + + /** + * Cancel the notification service. + */ + IMPORT_C void CancelNotifications(); + + /** + * Perform a scan and return the detected WLAN networks. + * @param aResults Results of the scan. + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + */ + IMPORT_C TInt GetScanResults( HssScanList& aResults ); + + /** + * Create and Protect IAP, register HotSpot Client. + * @param aUid, UID of the client. + * @param aIapName, Name of the iap to be created. + * @param aWaitnote, TRUE or FALSE indication of external prowserplugin need. + * @return On successful completion returns IAP ID, otherwise return value is 0. + */ + IMPORT_C TUint Register( const TUid aUid, + const TDesC& aIapName, + const TUint aWaitnote ); + + /** + * Delete IAP and unregister HotSpot Client. + * @param IapID, ID of the IAP to be unregistered. + * @param Uid, UID of the client. + * @return KErrNone if successful + */ + IMPORT_C TInt UnRegister( const TUint aIapId, + const TUint aNetworkId, + const TUid aUid ); + + /** + * Change IAP settings. + * @param aIapId, ID of the IAP. + * @param aSettings, Complete IAP settings struct + * @return KErrNone if successful + */ + IMPORT_C TInt ChangeSettings( const TUint aIapId, + const THssIapSettings& aSettings); + + /** + * Associate IAP with network. + * @param aIapId, ID of the IAP. + * @return KErrNone if successful + */ + IMPORT_C TInt Join( const TUint aIapId ); + + /** + * Cancel start call. + * @param aIapId, ID of the IAP. + * @return KErrNone if successful + */ + IMPORT_C TInt CancelStart( const TUint aIapId ); + + /** + * Stop associating IAP. + * @param aIapId, ID of the IAP. + * @return KErrNone if successful + */ + IMPORT_C TInt Stop( const TUint aIapId ); + + /** + * End connection. + * @param aIapId, ID of the IAP. + * @param aStatus, Status of the calling active object. + * @return KErrNone, if successful; otherwise one of the other system-wide error codes. + */ + IMPORT_C TInt LoginComplete( const TUint aIapId, TInt aStatus ); + + /** + * End connection. + * @param aIapID, ID of the IAP. + * @return KErrNone if successful + */ + IMPORT_C TInt LogoutComplete( const TUint aIapId ); + + /** + * StartLogin for NIFMAN Configuration Daemon. + * @param aIapId, ID of the IAP. + * @param aNetworkId, ID of the network. + * @param aStatus, Status of the calling active object. + */ + IMPORT_C void StartLogin ( const TUint aIapId, + const TUint aNetworkId, + TRequestStatus& aStatus ); + + /** + * CancelLogin for DHCP Configuration Daemon. + * @return KErrNone if successful + */ + IMPORT_C TInt CancelLogin (); + + /** + * Start for WLAN agent. + * @param aIapId, ID of the IAP. + * @param aStatus, Status of the calling active object. + */ + IMPORT_C void Start( const TUint aIapId, TRequestStatus& aStatus ); + + /** + * Start again for WLAN agent. + * @param aIapID, ID of the IAP. + * @param aStatus, Status of the calling active object. + */ + IMPORT_C void StartAgain( const TUint aIapId, TRequestStatus& aStatus ); + + /** + * Close connection for WLAN agent. + * @param aIapID, ID of the IAP. + * @param aStatus, Status of the calling active object. + */ + IMPORT_C void CloseConnection( const TUint aIapId, TRequestStatus& aStatus ); + + /** + * Check status of BackgroundScan. + * @return 0 if off, otherwice number as scan interval. + */ + IMPORT_C TUint32 CheckBackgroundScanL(); + + /** + * Cancel for WLAN agent. + * @param aIapId, ID of the IAP. + */ + IMPORT_C void Cancel( const TUint aIapId ); + + /** + * Shutdown server when uninstalling .sis -file. + */ + IMPORT_C TInt ShutdownServerL(); + + /** + * Set UI state of HotSpot browser logon application. + * @param aIapId, ID of the IAP. + * @param aState, value of THsBrowserUiStates. + */ + IMPORT_C void SetUiState( const TUint aIapId, const TUint aState ); + + /** + * Get ID of the IAP . + * @return IAP ID. + */ + inline TUint IapId(); + IMPORT_C TUint32 GetIap(TIpcArgs aArgs); + + /** + * Starts HotSpot browser for browser based authentication. + * @param aStatus, Status of the calling active object. + */ + IMPORT_C void StartBrowser( const TDesC& aString, + const TUint aIapId, + const TUint aNetId, + TRequestStatus& aStatus ); + + /** + * Get the BSSID of the currently connected AP. + * @param aBssId, MAC address of a connection + * @return KErrNone if successful, + * otherwise one of the other system-wide error codes. + */ + IMPORT_C TInt GetConnectionBssid( THssBssid& aBssId ); + + /** + * Add an SSID list to the given IAP. + * @param aIapId, IAP ID given. + * @param aSsidList, SSID list to add to the IAP. + * @return KErrNone if successful, + * otherwise one of the other system-wide error codes. + */ + IMPORT_C TInt AddIapSsidList( + TUint aIapId, + const CArrayFixFlat& aSsidList ); + + /** + * Set login and logout timer values of this client. + * If given values aren't suitable, the default values are set. + * @param aClientUid, Client's UID: clients may have own timer values, + * @param aLoginTimerValue, login timer value, + * @param aLogoutTimerValue, logout timer value. + * @return KErrNone if successful, + * otherwise one of the other system-wide error codes. + */ + IMPORT_C TInt SetTimerValues ( + TUid aClientUid, + TUint aLoginTimerValue, + TUint aLogoutTimerValue ); + + /** + * Gets all Iaps of client + * @param aUId, UID of client + * @param aIapIdArray, Array for client's Iaps + * @return None + */ + IMPORT_C void GetClientIapsL( const TUid aUid, RArray& aIapIdArray ); + + protected: // Methods + + /** + * Start the server during Connect() if the server is not loaded. + * @return KErrNone if successful otherwise another of the system wide error codes. + */ + TInt StartServer(); + + /** + * Server startup continues. + * @return KErrNone if successful otherwise another of the system wide error codes. + */ + TInt CreateServerProcess(); + + private: // Methods + + /** + * Stops active connection + * @param aIapId, ID of the IAP. + * @param aNetworkId, ID of the network. + * @return KErrNone if successful otherwise another of the system wide error codes. + */ + TInt StopConnectionL( const TUint aIapId, const TUint aNetworkId ); + + private: // Data + + /** + * Callback interface to HSS management. + */ + CHssSrvNotifications* iNotify; + + /** + * ID of the IAP. + */ + TUint iIapId; + + /** + * Handler for changing IAP settings + */ + CHssIapHandler* iIapHandler; + + /** + * Handler for changing IAP settings + */ + CHssScanHandler* iScanHandler; + + /** + * Parameter array type + */ + TIpcArgs iArgs; + }; + +#endif // HSSINTERFACE_H + +// End of File diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsclient/inc/hssmgmtimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsclient/inc/hssmgmtimpl.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,238 @@ +/* +* 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: ECom interface implementation definition +* +*/ + + + +#ifndef HSSMGMTIMPL_H +#define HSSMGMTIMPL_H + +#include "hssinterface.h" +#include "hssscanlist.h" +#include "hssmgmtclient.h" +#include "hssiapsettings.h" + +/** +* Implementation for MHssMgmtInterface interface. +* +* This class uses services from RHssInterface class to implement +* most of the required functionality. +*/ +class CHssMgmtImpl : public CHssMgmtClient, public MHssSrvNotifications + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + */ + static CHssMgmtImpl* NewL(); + + /** + * Destructor. + */ + virtual ~CHssMgmtImpl(); + + // Methods from base classes + + /** + * (From MHssMgmtInterface) Activate the notification service. + * + * After the client has enabled the notification service, it can + * receive asynchronous notifications from the server. + * @param aCallback The class that implements the callback interface. + */ + virtual void ActivateNotificationsL( MHssMgmtNotifications& aCallback ); + + /** + * (From MHssMgmtInterface) Cancel the notification service. + */ + virtual void CancelNotifications(); + + /** + * (From MHssMgmtInterface) Perform a scan and return the detected WLAN networks. + * @param aResults Results of the scan. + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + */ + virtual TInt GetScanResults( CHssMgmtScanInfo& aResults ); + + /** + * (From MHssMgmtInterface) Create and Protect IAP, register Client. + * @param aUid UID of the client. + * @param aIapName Name of the IAP to be registered. + * @param aWaitNote Indication of UI authentication, if in use TRUE, else FALSE. + * @return On successful completion returns IAP ID, otherwise return value is 0. + */ + virtual TUint Register( const TUid aUid, + const TDesC& aIapName, + const TUint aWaitNote ); + + /** + * (From MHssMgmtInterface) Delete IAP and unregister Client. + * + * @param aUid UID of the client. + * @param aIapId ID of the IAP. + * @return KErrNone, if IAP removal successful; + * otherwise one of the other system-wide error codes. + */ + virtual TInt UnRegister( const TUid aUid, + const TUint aIapId, + const TUint aNetworkId ); + + /** + * (From MHssMgmtInterface) Change IAP settings. + * + * @param aIapId ID of the IAP. + * @param aSettings Settings of the IAP. + * @return KErrNone if HotSpot FW was able to receive message; + * otherwise one of the other system-wide error codes. + */ + virtual TInt ChangeSettings( const TUint aIapId, + const THssIapSettings &aSettings ); + + /** + * (From MHssMgmtInterface) Associate IAP with network. + * + * @param aIapId ID of the IAP. + * @return KErrNone if HotSpot FW was able to receive message; + * otherwise one of the other system-wide error codes. + */ + virtual TInt Join( const TUint aIapId ); + + /** + * (From MHssMgmtInterface) Cancel IAP association. + * + * @param aIapId ID of the IAP. + * @return KErrNone if HotSpot FW was able to receive message; + * otherwise one of the other system-wide error codes. + */ + virtual TInt CancelStart( const TUint aIapId ); + + /** + * (From MHssMgmtInterface) Stop associating IAP. + * + * @param aIapId ID of the IAP. + * @return KErrNone if HotSpot FW was able to receive message; + * otherwise one of the other system-wide error codes. + */ + virtual TInt Stop( const TUint aIapId ); + + /** + * (From MHssMgmtInterface) Inform login completion. + * + * @param aIapId, ID of the IAP. + * @param aStatus, Result of login procedure. + * @return KErrNone if HotSpot FW was able to receive message; + * otherwise one of the other system-wide error codes. + */ + virtual TInt LoginComplete( const TUint aIapId, const TInt aStatus ); + + /** + * (From MHssMgmtInterface) Inform logout completion. + * + * @param aIapId ID of the IAP. + * @return KErrNone if HotSpot FW was able to receive message; + * otherwise one of the other system-wide error codes. + */ + virtual TInt LogoutComplete( const TUint aIapId ); + + /** + * Check status of BackgroundScan. + * @return 0 if off, otherwice number as scan interval. + */ + virtual TUint32 CheckBackgroundScan(); + + /** + * Get the BSSID of the currently connected AP. + * @param aBssId, MAC address of a connection + * @return KErrNone if successful, + * otherwise one of the other system-wide error codes. + */ + virtual TInt GetConnectionBssid( THssBssid& aBssId ); + + /** + * Add an SSID list to the given IAP. + * @param aIapId, IAP ID given. + * @param aSsidList, SSID list to add to the IAP. + * @return KErrNone if successful, + * otherwise one of the other system-wide error codes. + */ + virtual TInt AddIapSsidList( + TUint aIapId, + const CArrayFixFlat& aSsidList ); + + /** + * Set login and logout timers for this client. + * @param aClientUid, Client's UID: clients may have own timer values, + * @param aLoginTimerValue, login timer value, + * @param aLogoutTimerValue, logout timer value. + * @return KErrNone if successful, + * otherwise one of the other system-wide error codes. + */ + virtual TInt SetTimerValues( + TUid aClientUid, + TUint aLoginTimerValue, + TUint aLogoutTimerValue ); + + /** + * Gets all Iaps of client + * @param aUId, UID of client + * @param aIapIdArray, Array for client's Iaps + * otherwise one of the other system-wide error codes. + */ + virtual TInt GetClientIaps( const TUid aUid, RArray& aIapIdArray ); + + protected: // Methods + + /** + * (From MHssNotify) New networks have been detected during scan. + * + * @param aIapId ID of the IAP. + */ + virtual void NewNetworksDetected( TUint aIapId ); + + /** + * (From MHssNotify) One or more networks have been lost since the last scan. + * + * @param aIapId ID of the IAP. + */ + virtual void OldNetworksLost( TUint aIapId ); + + private: // Methods + + /** + * C++ default constructor. + */ + CHssMgmtImpl(); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + private: // Data + + // Interface to RWLMServer + RHssInterface iServer; + + // Client notification callback + MHssMgmtNotifications* iClientNotification; + }; + + +#endif // HSSMGMTIMPL_H diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsclient/inc/hssmgmtscaninfoimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsclient/inc/hssmgmtscaninfoimpl.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,201 @@ +/* +* Copyright (c) 2002-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: scan info +* +*/ + + + +#ifndef HSSMGMTSCANINFOIMPL_H +#define HSSMGMTSCANINFOIMPL_H + +// INCLUDES +#include "hssinterface.h" +#include "hssscaninfo.h" +#include "hssscanlist.h" +#include + +class HssScanInfo; + +// CLASS DECLARATION +/** +* Implementation for MHssMgmtScanInfoBase and MHssMgmtScanInfoIteratorBase interfaces. +* +* This class uses services from CHssMgmtScanInfo and HssScanList classes to implement +* most of the required functionality. +*/ +class CHssMgmtScanInfoImpl : public CHssMgmtScanInfo + + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + */ + static CHssMgmtScanInfoImpl* NewL(); + + /** + * Destructor. + */ + virtual ~CHssMgmtScanInfoImpl(); + + // New methods + + /** + * Return the reference to the internal scan list. + * @return Internal scan list. + */ + HssScanList& GetInternalList(); + + /** + * Update the internal variables after the internal + * scan list has been updated. + */ + void UpdateResultsL(); + + // Methods from base classes + + /** + * (From MHssMgmtScanInfoIteratorBase) Return the size of the scan info. + * The size includes Status Info, MAC header and Frame Body. + * @return The size of the scan info in bytes. + */ + virtual TUint16 Size() const; + + /** + * (From MHssMgmtScanInfoIteratorBase) 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. + */ + virtual const THssMgmtScanInfoFrame* First(); + + /** + * (From MHssMgmtScanInfoIteratorBase) 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. + */ + virtual const THssMgmtScanInfoFrame* Next(); + + /** + * (From MHssMgmtScanInfoIteratorBase) Find the data of the current access point. + * @return Pointer at the beginning of the current access point stored + * in the scan list. NULL if not any. + */ + virtual const THssMgmtScanInfoFrame* Current() const; + + /** + * (From MHssMgmtScanInfoIteratorBase) Find is there any more unhandled access points. + * @return EFalse if there is access points in the list left, + * ETrue if not. + */ + virtual TBool IsDone() const; + + /** + * (From MHssMgmtScanInfoBase) Return RX level of the BSS. + * @return RX level. + */ + virtual TUint8 RXLevel() const; + + /** + * (From MHssMgmtScanInfoBase) Return BSSID of the BSS. + * @param aBssid ID of the access point or IBSS network. + */ + virtual void Bssid( THssBssid& aBssid ) const; + + /** + * (From MHssMgmtScanInfoBase) Get beacon interval of the BSS. + * @return the beacon interval. + */ + virtual TUint16 BeaconInterval() const; + + /** + * (From MHssMgmtScanInfoBase) Get capability of the BSS (see IEEE 802.11 section 7.3.1.4. + * @return The capability information. + */ + virtual TUint16 Capability() const; + + /** + * (From MHssMgmtScanInfoBase) Get security mode of the BSS. + * @return security mode. + */ + virtual THssConnectionSecurityMode SecurityMode() const; + + /** + * (From MHssMgmtScanInfoBase) 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 code. + */ + virtual TInt InformationElement( TUint8 aIE, + TUint8& aLength, + const TUint8** aData ); + + /** + * (From MHssMgmtScanInfoBase) Return WPA information element. + * @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 code. + */ + virtual TInt WpaIE( TUint8& aLength, + const TUint8** aData ); + + /** + * (From MHssMgmtScanInfoBase) Return the first information element. + * @param aIE Id of the IE. See IEEE 802.11 section 7.3.2. + * @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 code. + */ + virtual TInt FirstIE( TUint8& aIE, + TUint8& aLength, + const TUint8** aData ); + + /** + * (From MHssMgmtScanInfoBase) Return next information element. + * @param aIE Id of the IE. See IEEE 802.11 section 7.3.2. + * @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 code. + */ + virtual TInt NextIE( TUint8& aIE, + TUint8& aLength, + const TUint8** aData ); + + private: // Methods + + /** + * C++ default constructor. + */ + CHssMgmtScanInfoImpl(); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + private: // Data + + /** Scan results */ + HssScanList iScanList; + + /** Wrapper class for parsing */ + HssScanInfo* iScanInfo; + }; + +#endif // HSSMGMTSCANINFOIMPL_H + +// End of File diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsclient/inc/hssscanhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsclient/inc/hssscanhandler.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2002-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 iap +* +*/ + + +#ifndef HssScanHandler_H +#define HssScanHandler_H + +// INCLUDES +#include +#include "hssmgmtcommon.h" + +// FORWARD DECLARATION +class CWlanMgmtClient; +class CWlanScanInfo; +class HssScanList; + +// CLASS DECLARATION +/** +* @brief IAP settings handler +*/ +class CHssScanHandler : public CBase + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + * @return Pointer to the constructed object. + */ + static CHssScanHandler* NewL( ); + + /** + * Destructor. + */ + virtual ~CHssScanHandler(); + + /** + * Issues a GetScanResults to wlan engine + * @param aResults, HSS scan list + * @return KErrNone if successful, + * otherwise one of system wide errorcodes. + */ + TInt ScanRequest( HssScanList& aResults ); + + /** + * Get the BSSID of the currently connected AP. + * @param aBssId, MAC address of a connection + * @return KErrNone if successful, + * otherwise one of system wide error codes. + */ + TInt GetConnectionBssid( THssBssid& aBssId ); + + /** + * Add an SSID list to the given IAP. + * @param aIapId, IAP ID given. + * @param aSsidList, SSID list to add to the IAP. + * @return KErrNone if successful, + * otherwise one of the other system-wide error codes. + */ + TInt AddIapSsidList( + TUint aIapId, + const CArrayFixFlat& aSsidList ); + + protected: + + /** + * C++ default constructor. + */ + CHssScanHandler(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: + + + private: // Data + + /** + * wlan management client instance + * Own + */ + CWlanMgmtClient* iMgmtClient; + + /** + * pointer to scaninfo. + * own + */ + CWlanScanInfo* iScanInfo; + + + }; + + +#endif diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsclient/inc/hsssrvnotifications.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsclient/inc/hsssrvnotifications.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,163 @@ +/* +* Copyright (c) 2002-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: Notifications from HotSpot Server to HSS management. +* +*/ + + +#ifndef HSSSRVNOTIFICATIONS_H +#define HSSSRVNOTIFICATIONS_H + +#include "hssinterface.h" +#include +#include + +class RHssInterface; + + +/** +* MHssSrvNotifications specifies a callback interface for notification services. +* These virtual methods should be implemented by HSS management if it +* needs any notifications. +*/ +class MHssSrvNotifications +{ + public: + + /** + * New networks have been detected during scan. + * + * @param aIapId ID of the IAP. + */ + virtual void NewNetworksDetected( TUint /*aIapId*/ ) {}; + + /** + * One or more networks have been lost since the last scan. + * + * @param aIapId ID of the IAP. + */ + virtual void OldNetworksLost( TUint /*aIapId*/ ) {}; + + virtual void WlanConnModeNotConnected() {}; +}; + +/** +* Notifications' data. +*/ +const TUint KHssMaxNotificationLength = 128; // Max data length for notification data. + +/** +* HSS package data for notifications. +*/ +struct THssPckgData + { + TBuf8 data; + }; + +/** +* CHssSrvNotifications offers the notification service. +* Active object that waits notifications from server. +*/ +NONSHARABLE_CLASS( CHssSrvNotifications ) : public CActive + { + public: // Methods + + // Constructors and destructor + + /** + * Destructor. + */ + virtual ~CHssSrvNotifications(); + + /** + * Create and activate notification service. + * @note The notification service is activated in this call. + * @param aCallback Callback interface to forward notifications to + * user process. + * @param aServer Interface to send requests to server. + * @return Pointer to a new constructed CHssSrvNotifications object. + */ + static CHssSrvNotifications* NewL( MHssSrvNotifications& aCallback, RHssInterface& aServer ); + + /** + * Change the callback interface + * and activate notifications + * @param aCallback New callback interface. + */ + void Activate( MHssSrvNotifications& aCallback ); + + /** + * Sets the requests cancelled flag so that no new notification requests + * are done once current notification is complete. + */ + void SetCancelled(); + + protected: // from CActive + /** + * (From CActive) Receive notification. + */ + void RunL(); + + /** + * (From CActive) This is called by Cancel() of CActive framework. + */ + void DoCancel(); + + private: + /** + * Constructor. + * @param aCallback Callback interface to forward notifications to + * application. + * @param aServer Interface to send requests to server. + */ + CHssSrvNotifications(MHssSrvNotifications& aCallback, RHssInterface& aServer); + + /** + * Second phase construction. + */ + void ConstructL(); + + /** + * Notification query loop. + */ + void WaitForNotifications(); + + private: // Members. + /** + * Callback interface to the client + */ + MHssSrvNotifications* iCallback; + /** + * Interface to send messages to the server + */ + RHssInterface& iServer; + /** + * Return data value from server for the asynchronous messages + */ + THssPckgData iReturnData; + /** + * Data package for return data + */ + TPckg iDataPckg; + /** + * Cancel has been requested + */ + TBool iCancelRequested; + + /** + * IapId for notifications + */ + TUint iIapId; + }; +#endif // HSSSRVNOTIFICATIONS_H diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsclient/src/10282ecc.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsclient/src/10282ecc.rss Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 1028 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 resources for the HssMgmtImpl +* +*/ + + + +#include + +// --------------------------------------------------------- +// +// +// ECOM resource definitions for HssMgmtImpl plugin +// +// --------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = 0x10282ecc; + + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = 0x10282ecd; + implementations = + { + // Info for HssMgmtImpl + IMPLEMENTATION_INFO + { + implementation_uid = 0x10282ece; + version_no = 1; + display_name = "HssMgmtImpl"; + default_data = ""; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = 0x10282ecf; + implementations = + { + // Info for HssMgmtScanInfoImpl + IMPLEMENTATION_INFO + { + implementation_uid = 0x10282ed0; + version_no = 1; + display_name = "HssMgmtScanInfoImpl"; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsclient/src/hssiaphandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsclient/src/hssiaphandler.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,612 @@ +/* +* Copyright (c) 2002-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 iapsettings +* +*/ + + + +// INCLUDE FILES +#include +#include +#include "hssiaphandler.h" +#include "hotspotclientserver.h" +#include "am_debug.h" +#include + +#include +#include +#include +#include +#include + +using namespace CMManager; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CHotSpotPluginSession +// ----------------------------------------------------------------------------- +// +CHssIapHandler::CHssIapHandler( ) + { + DEBUG("CHssIapHandler::CHssIapHandler"); + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CHssIapHandler::ConstructL() + { + DEBUG("CHssIapHandler::ConstructL()"); + } + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +CHssIapHandler* CHssIapHandler::NewL() + { + CHssIapHandler* self = new( ELeave ) CHssIapHandler(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// ~CHssIapHandler +// ----------------------------------------------------------------------------- +// +CHssIapHandler::~CHssIapHandler() + { + DEBUG("CHssIapHandler::~CHssIapHandler()"); + + if ( iWLANRecord != NULL ) + { + delete iWLANRecord; + } + iWLANRecord = NULL; + } + +// ----------------------------------------------------------------------------- +// ChangeSettingsL +// ----------------------------------------------------------------------------- +// +TInt CHssIapHandler::ChangeSettingsL( const TUint aIapID, + const THssIapSettings& aSettings ) + { + // Wlan table name -field not modified, because it is used to store UIDs + // of clients. + DEBUG("CHssIapHandler::ChangeSettingsL"); + TInt ret( KErrNone ); + + RCmManagerExt cmManager; + cmManager.OpenL(); + CleanupClosePushL( cmManager ); + + TUint easyWlanId = cmManager.EasyWlanIdL(); + // Easy WLAN can't be modified + if ( easyWlanId == aIapID ) + { + cmManager.Close(); + return KErrPermissionDenied; + } + + // Read WLAN table service id + TUint32 serviceId(0); + RCmConnectionMethodExt plugin = cmManager.ConnectionMethodL( aIapID ); + CleanupClosePushL( plugin ); + serviceId = plugin.GetIntAttributeL( EWlanServiceId ); + DEBUG1("CHssIapHandler::ChangeSettingsL WLAN serviceId: %d", serviceId); + + if ( aSettings.Name.Length() > 0 ) + { + plugin.SetStringAttributeL( ECmName, aSettings.Name ); + plugin.UpdateL(); + } + CleanupStack::PopAndDestroy( &plugin ); // Close() called on "plugin" + CleanupStack::PopAndDestroy( &cmManager ); // Close() called on "cmManager" + + // CommsDat section starts + CMDBSession* dbSession = CMDBSession::NewL(CMDBSession::LatestVersion()); + CleanupStack::PushL( dbSession ); + iWLANRecord = static_cast + ( CCDRecordBase::RecordFactoryL( 0)); + + iWLANRecord->InitializeL( KGenericTable(),NULL ); + iWLANRecord->SetRecordId( serviceId ); + iWLANRecord->LoadL( *dbSession ); + + // Set Network Name + if ( aSettings.iSSID.Length() > 0 ) + { + CMDBField* textField = + (CMDBField*)iWLANRecord->GetFieldByIdL( KCDTIdWlanSSID ); + textField->SetMaxLengthL( aSettings.iSSID.Length() ); + textField->SetL( aSettings.iSSID ); + } + + // Set Connection Mode + *((CMDBField*)iWLANRecord->GetFieldByIdL( KCDTIdWlanConnMode)) = + aSettings.iConnectionMode; + + // Set Channel Id. + *((CMDBField*)iWLANRecord->GetFieldByIdL( KCDTIdWlanChannelID )) = 0; + + // Set Security Mode + *((CMDBField*)iWLANRecord->GetFieldByIdL( KCDTIdWlanSecMode )) = + aSettings.iSecurityMode; + + // Check if THssIapSettings is created wrong (dynamically). + // -> Then default value is not set to security mode and it will be huge. + // -> Destination can become unusable. + TInt secMode = aSettings.iSecurityMode; + if ( secMode > EHssWpa2Only ) + { + secMode = EHssAllowUnsecure; + } + + if( secMode == EHssWep ) + { + DEBUG("CHssIapHandler::ChangeSettingsL -> SecurityMode == EHssWep"); + *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanAuthMode)) = aSettings.iAuthenticationMode; + *((CMDBField*)iWLANRecord->GetFieldByIdL( KCDTIdWlanWepIndex )) = aSettings.iWepIndex; + + ret = WriteWepKeysL( aSettings ); + + *((CMDBField*)iWLANRecord->GetFieldByIdL( KCDTIdWlanFormatKey1 )) = aSettings.iWepKeyFormat[0]; + *((CMDBField*)iWLANRecord->GetFieldByIdL( KCDTIdWlanFormatKey2 )) = aSettings.iWepKeyFormat[1]; + *((CMDBField*)iWLANRecord->GetFieldByIdL( KCDTIdWlanFormatKey3 )) = aSettings.iWepKeyFormat[2]; + *((CMDBField*)iWLANRecord->GetFieldByIdL( KCDTIdWlanFormatKey4 )) = aSettings.iWepKeyFormat[3]; + } + else if( secMode > EHssWep ) + { + DEBUG("CHssIapHandler::ChangeSettingsL -> SecurityMode > EHssWep"); + if ( aSettings.iEnableWpaPsk ) // Use PreSharedKey + { + TBuf8 buf; + + TInt len = aSettings.iWPAPreSharedKey.Length(); + + for( TInt i=0; i* binField = (CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanWpaPreSharedKey); + binField->SetMaxLengthL( len); + binField->SetL( buf); + + *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanWpaKeyLength)) = aSettings.iWPAKeyLength; + *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanEnableWpaPsk)) = aSettings.iEnableWpaPsk; + } + 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 ); + } + } + // now update the access point + iWLANRecord->ModifyL( *dbSession ); + + CleanupStack::PopAndDestroy( dbSession ); + DEBUG("CHssIapHandler::ChangeSettingsL DONE"); + return ret; + } + +// ----------------------------------------------------------------------------- +// WriteWepKeysL +// Writes WEP keys from aSettings to current WLANServiceTable record +// The record which the data is written to must be fetched from CommsDat +// before calling WriteWepKeysL() +// ----------------------------------------------------------------------------- +// +TInt CHssIapHandler::WriteWepKeysL( const THssIapSettings& aSettings ) + { + DEBUG("CHssIapHandler::WriteWepKeysL"); + // 1 + CMDBField* wepKey = static_cast*>(iWLANRecord->GetFieldByIdL(KCDTIdWlanWepKey1)); + if ( aSettings.iWepKey1.KeyLength <= KHssMaxWEPKeyLength ) + { + PackWepKeyCommsDatL( aSettings.iWepKey1, aSettings.iWepKeyFormat[0], wepKey ); + } + else + { + return KErrTooBig; + } + + // 2 + wepKey = static_cast*>(iWLANRecord->GetFieldByIdL(KCDTIdWlanWepKey2)); + if ( aSettings.iWepKey2.KeyLength <= KHssMaxWEPKeyLength ) + { + PackWepKeyCommsDatL( aSettings.iWepKey2, aSettings.iWepKeyFormat[1], wepKey ); + } + else + { + return KErrTooBig; + } + + // 3 + wepKey = static_cast*>(iWLANRecord->GetFieldByIdL(KCDTIdWlanWepKey3)); + if ( aSettings.iWepKey3.KeyLength <= KHssMaxWEPKeyLength ) + { + PackWepKeyCommsDatL( aSettings.iWepKey3, aSettings.iWepKeyFormat[2], wepKey ); + } + else + { + return KErrTooBig; + } + + // 4 + wepKey = static_cast*>(iWLANRecord->GetFieldByIdL(KCDTIdWlanWepKey4)); + if ( aSettings.iWepKey4.KeyLength <= KHssMaxWEPKeyLength ) + { + PackWepKeyCommsDatL( aSettings.iWepKey4,aSettings.iWepKeyFormat[3], wepKey ); + } + else + { + return KErrTooBig; + } + return KErrNone; + } + + +// ----------------------------------------------------------------------------- +// PackWepKeyCommsDatL +// Copies wepkey string from wepkey structs TUint8 buffer to a WLANServiceTable +// record's WEP key field descriptor +// ----------------------------------------------------------------------------- +// +void CHssIapHandler::PackWepKeyCommsDatL( const SHssWep& aInputKey, + const EHssWEPKeyFormat& aFormat, + CMDBField* aPackedKey ) + { + DEBUG("CHssIapHandler:::PackWepKeyL"); + if( aInputKey.KeyLength > KHssMaxWEPKeyLength) + { + User::Leave( KErrArgument); + } + + TBuf8 wepBuf; + + for (TUint i = 0 ; iDes() ); + CleanupStack::PopAndDestroy( buf8Conv ); + } + + 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 +// ----------------------------------------------------------------------------- +// +void CHssIapHandler::ConvertAsciiToHex( const TDes8& aSource, + HBufC8*& aDest ) + { + DEBUG("CHssIapHandler::ConvertAsciiToHex"); + _LIT( hex, "0123456789ABCDEF" ); + TInt size = aSource.Size(); + TPtr8 ptr = aDest->Des(); + for ( TInt ii = 0; ii < size; ii++ ) + { + TText8 ch = aSource[ii]; + ptr.Append( hex()[(ch/16)&0x0f] ); + ptr.Append( hex()[ch&0x0f] ); + } + } + +// ----------------------------------------------------------------------------- +// 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 +// ----------------------------------------------------------------------------- +// +void CHssIapHandler::GetNetworkIdL( const TUint aIapId, TUint32& aNetId ) + { + DEBUG( "CHssIapHandler::GetNetworkIdL()" ); + + RCmManagerExt cmManager; + cmManager.OpenL(); + CleanupClosePushL( cmManager ); + + RCmConnectionMethodExt plugin = cmManager.ConnectionMethodL( aIapId ); + CleanupClosePushL( plugin ); + + aNetId = plugin.GetIntAttributeL( ECmNetworkId ); + + CleanupStack::PopAndDestroy( &plugin ); // Close() called on "plugin" + CleanupStack::PopAndDestroy( &cmManager ); // Close() called on "cmManager" + + DEBUG1( "CHssIapHandler::GetNetworkIdL netId: %d", aNetId ); + } + +// ----------------------------------------------------------------------------- +// GetClientIapsL +// ----------------------------------------------------------------------------- +// +void CHssIapHandler::GetClientIapsL( const TUid aUId, RArray& aIapIdArray ) + { + DEBUG("CHssIapSettingsHandler::GetClientsIapsL"); + TBuf<32> buffer; // Temporary buffer for found UID from destination. + TUidName uidClient = aUId.Name(); // UID of the client. + TUint32 iapId = 0; // IAP Identifiier. + + RArray destArray = RArray( 10 ); // KCmArrayGranularity instead of 10 + CleanupClosePushL( destArray ); + + RCmManagerExt cmManager; + cmManager.OpenL(); + CleanupClosePushL( cmManager ); + + cmManager.AllDestinationsL( destArray ); + + for (TInt i = 0; i < destArray.Count(); i++) + { + RCmDestinationExt dest = cmManager.DestinationL( destArray[i] ); + CleanupClosePushL( dest ); + + for (TInt j = 0; j < dest.ConnectionMethodCount(); j++) + { + TInt bearerType = dest.ConnectionMethodL(j). + GetIntAttributeL( CMManager::ECmBearerType ); + + if (bearerType == KUidWlanBearerType) + { + HBufC* uid = dest.ConnectionMethodL(j). + GetStringAttributeL( EWlanServiceExtensionTableName ); + CleanupStack::PushL( uid ); + + // Copy found uid to temporary buffer + buffer.Copy( *uid ); + + // If uids match, store corresponding IapId to aIapIdArray. + if (buffer.Compare( uidClient ) == 0) + { + iapId = dest.ConnectionMethodL(j).GetIntAttributeL( ECmIapId ); + aIapIdArray.Append( iapId ); + DEBUG("CHssIapSettingsHandler::GetClientsIapsL: UIDs matched"); + DEBUG1("CHssIapSettingsHandler::Found IapId: %d", iapId); + } + else + { + DEBUG("CHssIapSettingsHandler::GetClientsIapsL: NO match"); + } + CleanupStack::PopAndDestroy( uid ); + } + } + CleanupStack::PopAndDestroy( &dest ); + } + + CleanupStack::PopAndDestroy( &cmManager ); + CleanupStack::PopAndDestroy( &destArray ); + } + +// End of File diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsclient/src/hssinterface.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsclient/src/hssinterface.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,709 @@ +/* +* Copyright (c) 2002-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 interface for HotSpot services. +* +*/ + + + +// INCLUDES +#include "hssinterface.h" +#include "hotspotclientserver.h" +#include "am_debug.h" +#include +#include +#include + +// CONSTS +const TUint32 KHssWlanUserSettings = 1; +_LIT( KHssWlanDeviceSettings, "WLANDeviceTable" ); +_LIT( KHssWlanDeviceSettingsType, "WlanDeviceSettingsType" ); +_LIT( KHssBgScanInterval, "WlanBgScanInterval" ); + +// ----------------------------------------------------------------------------- +// RHssInterface::ActivateNotificationsL +// ----------------------------------------------------------------------------- +// +EXPORT_C void RHssInterface::ActivateNotificationsL( MHssSrvNotifications& aCallback ) + { + DEBUG( "RHssInterface::ActivateNotificationsL()" ); + if( iNotify != NULL ) + { + iNotify->Activate( aCallback ); + } + else + { + iNotify = CHssSrvNotifications::NewL( aCallback, *this ); + } + } + + + +// ----------------------------------------------------------------------------- +// RHssInterface::CancelNotifications +// ----------------------------------------------------------------------------- +// +EXPORT_C void RHssInterface::CancelNotifications() + { + DEBUG( "RHssInterface::CancelNotifications()" ); + if( iNotify == NULL ) + { + return; + } + if( iNotify->IsActive() ) + { + // Notifications activated, request is pending + iNotify->Cancel(); + } + else + { + // Notifications activated, currently executing a notification + + //(i.e. in RunL of iNotify) + + iNotify->SetCancelled(); + } + } + +// ----------------------------------------------------------------------------- +// RHssInterface::Close +// ----------------------------------------------------------------------------- +// +EXPORT_C void RHssInterface::Close() + { + DEBUG( "RHssInterface::Close()" ); + if ( iNotify != NULL ) + { + delete iNotify; + } + iNotify = NULL; + + RHandleBase::Close(); + DEBUG( "RHssInterface::Close() Done" ); + } + +// ----------------------------------------------------------------------------- +// RHssInterface::Connect +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt RHssInterface::Connect() + { + TInt error = StartServer(); + DEBUG1( "RHssInterface::Connect() StartServer: %d", error ); + iNotify = NULL; + + if ( KErrNone == error ) + { + error = CreateSession( KHotSpotDataServerName, + Version(), + KDefaultMsgSlots ); + DEBUG1( "RHssInterface::Connect() CreateSession: %d", error ); + } + return error; + } + +// ----------------------------------------------------------------------------- +// RHssInterface::GetScanResults +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt RHssInterface::GetScanResults( HssScanList& aResults ) + { + DEBUG( "RHssInterface::GetScanResults(HssScanList&)" ); + TInt ret( KErrNone ); + CHssScanHandler* scanHandler( NULL ); + TRAP( ret, scanHandler = CHssScanHandler::NewL() ); + if (ret == KErrNone) + { + ret = scanHandler->ScanRequest( aResults ); + delete scanHandler; + } + return ret; + } + +// ----------------------------------------------------------------------------- +// RHssInterface::Register +// ----------------------------------------------------------------------------- +// +EXPORT_C TUint RHssInterface::Register (const TUid aUID, + const TDesC& aIapName, + const TUint aWaitnote) + { + DEBUG( "RHssInterface::Register()" ); + TPckgBuf< TClientUid > uidPckg; + uidPckg().SetUid( aUID ); + TPckgBuf< TIapName > iapPckg; + iapPckg().SetIapName( aIapName ); + TIpcArgs args( &uidPckg, &iapPckg, aWaitnote ); + iIapId = SendReceive( EHssRegister, args ); + return iIapId; + } + +// ----------------------------------------------------------------------------- +// RHssInterface::UnRegister +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt RHssInterface::UnRegister (const TUint aIapID, + const TUint aNetworkId, + const TUid aUID) + { + DEBUG( "RHssInterface::UnRegister()" ); + TRAPD( err, StopConnectionL( aIapID, aNetworkId ) ); + + if ( err == KErrNone ) + { + TPckgBuf< TClientUid > uidPckg; + uidPckg().SetUid( aUID ); + TIpcArgs args( aIapID, &uidPckg ); + err = SendReceive( EHssUnRegister, args ); + } + + return err; + } + +// ----------------------------------------------------------------------------- +// RHssInterface::ChangeSettings +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt RHssInterface::ChangeSettings ( const TUint aIapID, + const THssIapSettings& aSettings ) + { + DEBUG( "RHssInterface::ChangeSettings()" ); + TInt ret( KErrNone ); + CHssIapHandler* iapHandler( NULL ); + TRAP( ret, iapHandler = CHssIapHandler::NewL()); + if ( ret != KErrNone ) + { + DEBUG1( "RHssInterface::ChangeSettings() leave1: %d", ret ); + } + else + { + TRAPD( err, ret = iapHandler->ChangeSettingsL( aIapID, aSettings ) ); + if ( err != KErrNone ) + { + DEBUG1( "RHssInterface::ChangeSettings() leave2: %d", err ); + ret = err; + } + if ( iapHandler != NULL ) + { + delete iapHandler; + } + } + return ret; + } + +// ----------------------------------------------------------------------------- +// RHssInterface::Stop +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt RHssInterface::Stop ( const TUint aIapID ) + { + DEBUG( "RHssInterface::Stop()" ); + + TIpcArgs args( aIapID ); + TInt ret = Send( EHssStop, args ); + + TUint32 netId; + CHssIapHandler* iapHandler(NULL); + + TRAPD( err, iapHandler = CHssIapHandler::NewL() ); + if (err == KErrNone) + { + TRAP( err, iapHandler->GetNetworkIdL( aIapID, netId ) ); + delete iapHandler; + if (err == KErrNone) + { + TRAP( err, StopConnectionL( aIapID, netId ) ); + // Possible error value is neglected?! + } + } + + return ret; + } + +// ----------------------------------------------------------------------------- +// RHssInterface::CancelStart +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt RHssInterface::CancelStart ( const TUint aIapID ) + { + DEBUG( "RHssInterface::CancelStart()" ); + TIpcArgs args( aIapID ); + return Send( EHssCancelStart, args ); + } + +// ----------------------------------------------------------------------------- +// RHssInterface::LoginComplete +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt RHssInterface::LoginComplete ( const TUint aIapID, const TInt aStatus ) + { + DEBUG( "RHssInterface::LoginComplete()" ); + iArgs = TIpcArgs( aIapID, aStatus ); + return Send( EHssLoginComplete, iArgs ); + } + +// ----------------------------------------------------------------------------- +// RHssInterface::LogoutComplete +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt RHssInterface::LogoutComplete ( const TUint aIapID ) + { + DEBUG( "RHssInterface::LogoutComplete()" ); + TIpcArgs args( aIapID ); + return Send( EHssLogoutComplete, args ); + } + +// ----------------------------------------------------------------------------- +// RHssInterface::Join +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt RHssInterface::Join( const TUint aIapId ) + { + DEBUG( "RHssInterface::Join()" ); + TIpcArgs args( aIapId ); + return Send( EHssJoin, args ); + } + + +// ----------------------------------------------------------------------------- +// RHssInterface::StartLogin +// ----------------------------------------------------------------------------- +// +EXPORT_C void RHssInterface::StartLogin( const TUint aIapId, + const TUint aNetworkId, + TRequestStatus& aStatus ) + { + DEBUG( "RHssInterface::StartLogin()" ); + iArgs = TIpcArgs( aIapId, aNetworkId ); + SendReceive( EHssStartLogin, iArgs, aStatus ); + } + +// ----------------------------------------------------------------------------- +// RHssInterface::CancelLogin +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt RHssInterface::CancelLogin() + { + DEBUG( "RHssInterface::CancelLogin()" ); + return Send( EHssCancelLogin ); + } + +// ----------------------------------------------------------------------------- +// RHssInterface::Start +// ----------------------------------------------------------------------------- +// +EXPORT_C void RHssInterface::Start( const TUint aIapId, + TRequestStatus& aStatus ) + { + DEBUG( "RHssInterface::Start()" ); + iArgs = TIpcArgs( aIapId ); + SendReceive( EHssStart, iArgs, aStatus ); + } + +// ----------------------------------------------------------------------------- +// RHssInterface::StartAgain +// ----------------------------------------------------------------------------- +// +EXPORT_C void RHssInterface::StartAgain( const TUint aIapId, + TRequestStatus& aStatus ) + { + DEBUG( "RHssInterface::StartAgain()" ); + iArgs = TIpcArgs( aIapId ); + SendReceive( EHssStartAgain, iArgs, aStatus ); + } + +// ----------------------------------------------------------------------------- +// RHssInterface::CloseConnection +// ----------------------------------------------------------------------------- +// +EXPORT_C void RHssInterface::CloseConnection( const TUint aIapId, + TRequestStatus& aStatus ) + { + DEBUG( "RHssInterface::CloseConnection()" ); + iArgs = TIpcArgs( aIapId ); + SendReceive( EHssCloseConnection, iArgs, aStatus ); + } + +// ----------------------------------------------------------------------------- +// RHssInterface::Cancel +// ----------------------------------------------------------------------------- +// +EXPORT_C void RHssInterface::Cancel( const TUint aIapId ) + { + DEBUG( "RHssInterface::Cancel()" ); + TIpcArgs args( aIapId ); + Send( EHssCancel, args ); + } + +// ----------------------------------------------------------------------------- +// RHssInterface::ShutdownServerL +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt RHssInterface::ShutdownServerL() + { + DEBUG( "RHssInterface::ShutdownServerL" ); + TInt ret( KErrNone ); + TInt iapId; + TInt netId; + TPckgBuf iapPckg; + TPckgBuf netPckg; + TIpcArgs args( &iapPckg, &netPckg ); + ret = SendReceive( EHssServerShutdown, args ); + + if ( ret == KErrInUse ) + { + iapId = iapPckg(); + netId = netPckg(); + DEBUG1("iapID RHSSINTERFACE : %d", iapId ); + ret = StopConnectionL( iapId, netId ); + + if ( ret == KErrNone ) + { + ret = SendReceive( EHssServerShutdown, args ); + } + } + + TIpcArgs args2( KHssShutdown ); + ret = SendReceive( EHssServerShutdown, args2 ); + + return ret; + } + +// ----------------------------------------------------------------------------- +// RHssInterface::SetUiState +// ----------------------------------------------------------------------------- +// +EXPORT_C void RHssInterface::SetUiState( const TUint aIapId, + const TUint aState ) + { + DEBUG( "RHssInterface::SetUiState()" ); + TIpcArgs args( aIapId, aState ); + SendReceive( EHssUiState, args ); + } + +// ----------------------------------------------------------------------------- +// RHssInterface::Version +// Needed only when activating the server. +// ----------------------------------------------------------------------------- +// +TVersion RHssInterface::Version() const + { + return( TVersion( + KHotSpotMajorVersionNumber, + KHotSpotMinorVersionNumber, + KHotSpotBuildVersionNumber ) ); + } + +// ----------------------------------------------------------------------------- +// RHssInterface::StartServer() +// Starts the server if it is not already running +// ----------------------------------------------------------------------------- +// +TInt RHssInterface::StartServer() + { + DEBUG( "RHssInterface::StartServer" ); + TInt result; + + TFindServer findHotSpotServer( KHotSpotDataServerName ); + TFullName name; + + result = findHotSpotServer.Next( name ); + if ( result == KErrNone ) + { + // Server already running + return KErrNone; + } + + RSemaphore semaphore; + result = semaphore.CreateGlobal( KHotSpotServerSemaphore, 0 ); + DEBUG1( "RHssInterface::StartServer semaphore: %d", result ); + if ( result != KErrNone ) + { + return result; + } + + result = CreateServerProcess(); + DEBUG1( "RHssInterface::StartServer CreateServerProcess: %d", result ); + if ( result != KErrNone ) + { + // Should the semaphore be closed if process creating fails? + return result; + } + + semaphore.Wait(); + semaphore.Close(); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// RHssInterface::CreateServerProcess() +// Creates a server process +// ----------------------------------------------------------------------------- +// +TInt RHssInterface::CreateServerProcess() + { + const TUidType serverUid( KNullUid,KNullUid, KHotspotServerUid3 ); + + RProcess server; + + TInt r = server.Create(KHotSpotServerExe,KNullDesC); + if ( r != KErrNone ) + { + DEBUG1( "**** RHssInterface: server start failed %d", r ); + return r; + } + TRequestStatus stat; + server.Rendezvous( stat ); + if ( stat!=KRequestPending ) + { + server.Kill(0); // abort startup + } + else + { + server.Resume(); // logon OK - start the server + } + + DEBUG("**** RHssInterface: Started"); + + User::WaitForRequest(stat); + r = ( server.ExitType()==EExitPanic ) ? KErrGeneral : stat.Int(); + server.Close(); + return r; + } + +// --------------------------------------------------------- +// RHssInterface::WaitForNotification +// When the message is completed at the server side, the +// CHssSrvNotifications::RunL() is been called. This is used by the +// notification service. +// --------------------------------------------------------- +// +void RHssInterface::WaitForNotification( + TRequestStatus& aReturnValue, + TDes8& aReturnData ) + { + DEBUG( "RHssInterface::WaitForNotification()" ); + TIpcArgs params( &aReturnData ); + SendReceive( EHssActivateNotifications, params, aReturnValue ); + } + +// --------------------------------------------------------- +// RHssInterface::CancelWaitForNotification +// CHssSrvNotifications class uses this method to cancel pending +// message at server side. +// --------------------------------------------------------- +// +void RHssInterface::CancelWaitForNotification() + { + DEBUG( "RHssInterface::CancelWaitForNotification()" ); + + // Check is notify service activated. + if( iNotify != NULL ) + { + // Send synchronous request to the data server + DEBUG( "RHssInterface::CancelWaitForNotification() Cancelling..." ); + Send( EHssCancelNotifications, TIpcArgs() ); + DEBUG( "Done!" ); + } + else + { + DEBUG( "RHssInterface::CancelWaitForNotification() Notification service was not started." ); + } + } + +// --------------------------------------------------------- +// RHssInterface::StopConnectionL +// --------------------------------------------------------- +// +TInt RHssInterface::StopConnectionL( const TUint aIapId, const TUint aNetworkId ) + { + DEBUG( "RHssInterface::StopConnectionL()" ); + + TInt ret( KErrNone ); + RSocketServ socketServ; + RConnection conn; + + User::LeaveIfError( socketServ.Connect() ); + CleanupClosePushL( socketServ ); + + // Open connection + User::LeaveIfError( conn.Open(socketServ) ); + CleanupClosePushL( conn ); + + TConnectionInfo info; + info.iIapId = aIapId; + info.iNetId = aNetworkId; + + TInt err = conn.Attach( + TPckg< TConnectionInfo >( info ), + RConnection::EAttachTypeNormal ); + DEBUG1( "RHssInterface::conn.Attach: %d", err ); + + if ( err == KErrNone ) + { + ret = conn.Stop( RConnection::EStopAuthoritative ); + DEBUG1( "RHssInterface::connection.Stop: %d", ret ); + } + + /* Note: In previous version, tried to PopAndDestroy conn (RConnection) + * from cleanup stack... + * => Somehow this broke Sniffer connection opening, no idea why. + */ + CleanupStack::Pop( &conn ); + conn.Close(); + CleanupStack::PopAndDestroy( &socketServ ); + + return ret; + } + +// --------------------------------------------------------- +// RHssInterface::CheckBackgroundScanL +// --------------------------------------------------------- +// +EXPORT_C TUint32 RHssInterface::CheckBackgroundScanL() + { + DEBUG( "RHssInterface::CheckBackgroundScanL()" ); + CCommsDatabase* commDB = NULL; + CCommsDbTableView* table = NULL; + + // Open commDB + commDB = CCommsDatabase::NewL(); + CleanupStack::PushL( commDB ); + + table = commDB->OpenViewMatchingUintLC( KHssWlanDeviceSettings, + KHssWlanDeviceSettingsType, + KHssWlanUserSettings ); + + TInt err = table->GotoFirstRecord(); + + if ( err ) + { + User::Leave( err ); + } + + TUint32 scanInterval; + table->ReadUintL( KHssBgScanInterval, scanInterval ); + + // cleanup + CleanupStack::PopAndDestroy( table ); + CleanupStack::PopAndDestroy( commDB ); + + return (scanInterval); + + } + +// --------------------------------------------------------- +// RHssInterface::GetIap +// --------------------------------------------------------- +// +EXPORT_C TUint32 RHssInterface::GetIap( TIpcArgs aArgs ) + { + DEBUG( "RHssInterface::GetIap()" ); + return SendReceive ( EHssGetIAP, aArgs ); + } + +// --------------------------------------------------------- +// RHssInterface::StartBrowser +// --------------------------------------------------------- +// +EXPORT_C void RHssInterface::StartBrowser( const TDesC& aString, + const TUint aIapId, + const TUint aNetId, + TRequestStatus& aStatus ) + { + DEBUG( "RHssInterface::StartBrowser()" ); + + iArgs = TIpcArgs( &aString, aIapId, aNetId ) ; + SendReceive( EHssStartBrowser, iArgs, aStatus ); + } + +// --------------------------------------------------------- +// RHssInterface::GetConnectionBssid +// --------------------------------------------------------- +// +EXPORT_C TInt RHssInterface::GetConnectionBssid( THssBssid& aBssId ) + { + DEBUG( "RHssInterface::GetConnectionBssid()" ); + TInt ret( KErrNone ); + CHssScanHandler* scanHandler( NULL ); + TRAP( ret, scanHandler = CHssScanHandler::NewL() ); + if (KErrNone != ret ) + { + DEBUG1( "RHssInterface::GetConnectionBssid() err:", ret ); + } + else + { + ret = scanHandler->GetConnectionBssid( aBssId ); + DEBUG1( "RHssInterface::GetConnectionBssid() ret:", ret ); + delete scanHandler; + } + return ret; + } + +// --------------------------------------------------------- +// RHssInterface::AddIapSsidList +// --------------------------------------------------------- +// +EXPORT_C TInt RHssInterface::AddIapSsidList( + TUint aIapId, + const CArrayFixFlat& aSsidList ) + { + DEBUG( "RHssInterface::AddIapSsidList()" ); + TInt ret( KErrNone ); + CHssScanHandler* scanHandler( NULL ); + TRAP( ret, scanHandler = CHssScanHandler::NewL() ); + if (KErrNone != ret ) + { + DEBUG1( "RHssInterface::AddIapSsidList() err:", ret ); + } + else + { + ret = scanHandler->AddIapSsidList( aIapId, aSsidList ); + DEBUG1( "RHssInterface::AddIapSsidList() ret:", ret ); + delete scanHandler; + } + return ret; + } + +// ----------------------------------------------------------------------------- +// RHssInterface::SetTimerValues +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt RHssInterface::SetTimerValues ( + TUid aClientUid, + TUint aLoginTimerValue, + TUint aLogoutTimerValue ) + { + DEBUG( "RHssInterface::SetTimerValues()" ); + TIpcArgs args( aClientUid.iUid, aLoginTimerValue, aLogoutTimerValue ); + return Send( EHssSetTimerValues, args ); + } + +// --------------------------------------------------------- +// RHssInterface::GetClientIapsL +// --------------------------------------------------------- +// +EXPORT_C void RHssInterface::GetClientIapsL( const TUid aUid, RArray& aIapIdArray ) + { + DEBUG( "RHssInterface::GetClientIapsL()" ); + CHssIapHandler* iapHandler( NULL ); + iapHandler = CHssIapHandler::NewL(); + CleanupStack::PushL( iapHandler ); + iapHandler->GetClientIapsL( aUid, aIapIdArray ); + CleanupStack::PopAndDestroy( iapHandler ); + } + +// End of File + diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsclient/src/hssmgmtimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsclient/src/hssmgmtimpl.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,305 @@ +/* +* Copyright (c) 2002-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: Implementation of hotspot management API +* +*/ + + + +// INCLUDE FILES +#include +#include +#include "hssmgmtimpl.h" +#include "hssmgmtscaninfoimpl.h" +#include "am_debug.h" + +// LOCAL CONSTANTS +/** +* Pairs ECom implementation UIDs with a pointer to the instantiation +* method for that implementation. Required for all ECom implementation +* collections. +*/ +const TImplementationProxy ImplementationTable[] = + { + {{0x10282ece}, reinterpret_cast(CHssMgmtImpl::NewL)}, + {{0x10282ed0}, reinterpret_cast(CHssMgmtScanInfoImpl::NewL)} + }; + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CHssMgmtImpl::CHssMgmtImpl() : + iClientNotification( NULL ) + { + DEBUG( "CHssMgmtImpl::CHssMgmtImpl()" ); + } + +// Symbian 2nd phase constructor can leave. +void CHssMgmtImpl::ConstructL() + { + DEBUG( "CHssMgmtImpl::ConstructL()" ); + User::LeaveIfError( iServer.Connect() ); + } + +// Static constructor. +CHssMgmtImpl* CHssMgmtImpl::NewL() + { + DEBUG( "CHssMgmtImpl::NewL()" ); + CHssMgmtImpl* self = new (ELeave) CHssMgmtImpl; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// Destructor +CHssMgmtImpl::~CHssMgmtImpl() + { + DEBUG( "CHssMgmtImpl::~CHssMgmtImpl()" ); + iServer.Close(); + } + +// --------------------------------------------------------- +// CHssMgmtImpl::ActivateNotificationsL +// --------------------------------------------------------- +// +void CHssMgmtImpl::ActivateNotificationsL( MHssMgmtNotifications& aCallback ) + { + DEBUG( "CHssMgmtImpl::ActivateNotificationsL()" ); + iClientNotification = &aCallback; + iServer.ActivateNotificationsL( *this ); + } + +// --------------------------------------------------------- +// CHssMgmtImpl::CancelNotifications +// --------------------------------------------------------- +// +void CHssMgmtImpl::CancelNotifications() + { + DEBUG( "CHssMgmtImpl::CancelNotifications()" ); + iServer.CancelNotifications(); + iClientNotification = NULL; + } + +// --------------------------------------------------------- +// CHssMgmtImpl::GetScanResults +// --------------------------------------------------------- +// +TInt CHssMgmtImpl::GetScanResults( CHssMgmtScanInfo& aResults ) + { + DEBUG( "CHssMgmtImpl::GetScanResults() " ); + // Because CHssMgmtScanInfo has been initialized through ECom + // interface, the object is actually CHssMgmtScanInfoImpl. + CHssMgmtScanInfoImpl* impl = reinterpret_cast(&aResults); + + TInt ret(KErrNone); + ret = iServer.GetScanResults( impl->GetInternalList() ); + if ( ret != KErrNone ) + { + DEBUG1( "GetScanResults() returned with %d", ret ); + return ret; + } + TRAP( ret, impl->UpdateResultsL() ); + if ( ret != KErrNone ) + { + DEBUG1( "UpdateResultsL() returned with %d", ret ); + } + return ret; + } + + +// --------------------------------------------------------- +// CHssMgmtImpl::Register +// --------------------------------------------------------- +// +TUint CHssMgmtImpl::Register( const TUid aUid, + const TDesC& aIapName, + const TUint aWaitNote ) + { + DEBUG( "CHssMgmtImpl::Register()" ); + return iServer.Register( aUid, aIapName, aWaitNote ); + } + +// --------------------------------------------------------- +// CHssMgmtImpl::UnRegister +// --------------------------------------------------------- +// +TInt CHssMgmtImpl::UnRegister( const TUid aUid, + const TUint aIapId, + const TUint aNetworkId ) + { + DEBUG( "CHssMgmtImpl::UnRegister()" ); + return iServer.UnRegister( aIapId, aNetworkId, aUid ); + } + +// --------------------------------------------------------- +// CHssMgmtImpl::ChangeSettings +// --------------------------------------------------------- +// +TInt CHssMgmtImpl::ChangeSettings( const TUint aIapId, const THssIapSettings& aSettings ) + { + DEBUG( "CHssMgmtImpl::ChangeSettings()" ); + return iServer.ChangeSettings( aIapId, aSettings ); + } + +// --------------------------------------------------------- +// CHssMgmtImpl::Join +// --------------------------------------------------------- +// +TInt CHssMgmtImpl::Join( const TUint aIapId ) + { + DEBUG( "CHssMgmtImpl::Join()" ); + return iServer.Join( aIapId ); + } + +// --------------------------------------------------------- +// CHssMgmtImpl::CancelStart +// --------------------------------------------------------- +// +TInt CHssMgmtImpl::CancelStart( const TUint aIapId ) + { + DEBUG( "CHssMgmtImpl::CancelStart()" ); + return iServer.CancelStart( aIapId ); + } + +// --------------------------------------------------------- +// CHssMgmtImpl::Stop +// --------------------------------------------------------- +// +TInt CHssMgmtImpl::Stop( const TUint aIapId ) + { + DEBUG( "CHssMgmtImpl::Stop()" ); + return iServer.Stop( aIapId ); + } + +// --------------------------------------------------------- +// CHssMgmtImpl::LoginComplete +// --------------------------------------------------------- +// +TInt CHssMgmtImpl::LoginComplete( const TUint aIapId, const TInt aStatus ) + { + DEBUG( "CHssMgmtImpl::LoginComplete()" ); + return iServer.LoginComplete( aIapId, aStatus ); + } + +// --------------------------------------------------------- +// CHssMgmtImpl::LogoutComplete +// --------------------------------------------------------- +// +TInt CHssMgmtImpl::LogoutComplete( const TUint aIapId ) + { + DEBUG( "CHssMgmtImpl::LogoutComplete()" ); + return iServer.LogoutComplete( aIapId ); + } + +// --------------------------------------------------------- +// CHssMgmtImpl::CheckBackgroundScan +// --------------------------------------------------------- +// +TUint32 CHssMgmtImpl::CheckBackgroundScan() + { + DEBUG( "CHssMgmtImpl::CheckBackgroundScan()" ); + TInt ret(KErrNone); + TRAPD( err, ret = iServer.CheckBackgroundScanL() ); + if ( err != KErrNone ) + { + return err; + } + DEBUG1( "CheckBackgroundScan() returned with %d", ret ); + return ret; + } + +// --------------------------------------------------------- +// CHssMgmtImpl::GetConnectionBssid +// --------------------------------------------------------- +// +TInt CHssMgmtImpl::GetConnectionBssid( THssBssid& aBssId ) + { + DEBUG( "CHssMgmtImpl::GetConnectionBssid()" ); + return iServer.GetConnectionBssid( aBssId ); + } + +// --------------------------------------------------------- +// CHssMgmtImpl::AddIapSsidList +// --------------------------------------------------------- +// +TInt CHssMgmtImpl::AddIapSsidList( + TUint aIapId, + const CArrayFixFlat& aSsidList ) + { + DEBUG( "CHssMgmtImpl::AddIapSsidList()" ); + return iServer.AddIapSsidList( aIapId, aSsidList ); + } + +// --------------------------------------------------------- +// CHssMgmtImpl::NewNetworksDetected +// --------------------------------------------------------- +// +void CHssMgmtImpl::NewNetworksDetected( TUint aIapId ) + { + DEBUG( "CHssMgmtImpl::NewNetworksDetected()" ); + iClientNotification->NewNetworksDetected( aIapId ); + } + +// --------------------------------------------------------- +// CHssMgmtImpl::OldNetworksLost +// --------------------------------------------------------- +// +void CHssMgmtImpl::OldNetworksLost( TUint aIapId ) + { + DEBUG( "CHssMgmtImpl::OldNetworksLost()" ); + iClientNotification->OldNetworksLost( aIapId ); + } + +// --------------------------------------------------------- +// CHssMgmtImpl::SetTimerValues +// --------------------------------------------------------- +// +TInt CHssMgmtImpl::SetTimerValues( + TUid aClientUid, + TUint aLoginTimerValue, + TUint aLogoutTimerValue ) + { + DEBUG( "CHssMgmtImpl::SetTimerValues()" ); + return iServer.SetTimerValues( aClientUid, aLoginTimerValue, aLogoutTimerValue ); + } + +// --------------------------------------------------------- +// CHssMgmtImpl::GetClientIaps +// --------------------------------------------------------- +// +TInt CHssMgmtImpl::GetClientIaps( const TUid aUid, RArray& aIapIdArray ) + { + DEBUG( "CHssMgmtImpl::GetClientIaps()" ); + TRAPD( err, iServer.GetClientIapsL( aUid, aIapIdArray ) ); + DEBUG1( "CHssMgmtImpl::GetClientIaps() returned with %d", err ); + return err; + } + +// ================= OTHER EXPORTED FUNCTIONS ============== + +// --------------------------------------------------------- +// Returns an instance of the proxy table. +// Returns: KErrNone +// --------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + +// End of File diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsclient/src/hssmgmtscaninfoimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsclient/src/hssmgmtscaninfoimpl.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,246 @@ +/* +* Copyright (c) 2002-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: Scan info +* +*/ + + + +// INCLUDE FILES +#include +#include +#include "am_debug.h" +#include "hssmgmtscaninfoimpl.h" +#include "hotspotclientserver.h" + + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CHssMgmtScanInfoImpl::CHssMgmtScanInfoImpl() + { + DEBUG("CHssMgmtScanInfoImpl::CHssMgmtScanInfoImpl()"); + } + +// Symbian 2nd phase constructor can leave. +void CHssMgmtScanInfoImpl::ConstructL() + { + DEBUG( "CHssMgmtScanInfoImpl::ConstructL()" ); + + iScanInfo = new(ELeave) HssScanInfo( iScanList ); + } + +// Static constructor. +CHssMgmtScanInfoImpl* CHssMgmtScanInfoImpl::NewL() + { + DEBUG( "CHssMgmtScanInfoImpl::NewL()" ); + + CHssMgmtScanInfoImpl* self = new (ELeave) CHssMgmtScanInfoImpl; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// Destructor +CHssMgmtScanInfoImpl::~CHssMgmtScanInfoImpl() + { + DEBUG( "CHssMgmtScanInfoImpl::~CHssMgmtScanInfoImpl()" ); + delete iScanInfo; + } + +// --------------------------------------------------------- +// CHssMgmtScanInfoImpl::Size +// --------------------------------------------------------- +// +TUint16 CHssMgmtScanInfoImpl::Size() const + { + return iScanInfo->Size(); + } + +// --------------------------------------------------------- +// CHssMgmtScanInfoImpl::First +// --------------------------------------------------------- +// +const THssMgmtScanInfoFrame* CHssMgmtScanInfoImpl::First() + { + return iScanInfo->First(); + } + +// --------------------------------------------------------- +// CHssMgmtScanInfoImpl::Next +// --------------------------------------------------------- +// +const THssMgmtScanInfoFrame* CHssMgmtScanInfoImpl::Next() + { + return iScanInfo->Next(); + } + +// --------------------------------------------------------- +// CHssMgmtScanInfoImpl::Current +// --------------------------------------------------------- +// +const THssMgmtScanInfoFrame* CHssMgmtScanInfoImpl::Current() const + { + return iScanInfo->Current(); + } + +// --------------------------------------------------------- +// CHssMgmtScanInfoImpl::IsDone +// --------------------------------------------------------- +// +TBool CHssMgmtScanInfoImpl::IsDone() const + { + return iScanInfo->IsDone(); + } + +// --------------------------------------------------------- +// CHssMgmtScanInfoImpl::RXLevel +// --------------------------------------------------------- +// +TUint8 CHssMgmtScanInfoImpl::RXLevel() const + { + TUint8 rssiValue = 110 - ( iScanInfo->RXLevel() / 2 ); + DEBUG2( "CHssMgmtScanInfoImpl::RXLevel(): (RCP, RSS) == (%u, %u )", iScanInfo->RXLevel(), rssiValue ); + return rssiValue; + } + +// --------------------------------------------------------- +// CHssMgmtScanInfoImpl::Bssid +// --------------------------------------------------------- +// +void CHssMgmtScanInfoImpl::Bssid( THssBssid& aBssid ) const + { + TMacAddress bssid; + iScanInfo->BSSID( bssid.iMacAddress ); + aBssid.Copy( &bssid.iMacAddress[0], KMacAddressLength ); + } + +// --------------------------------------------------------- +// CHssMgmtScanInfoImpl::BeaconInterval +// --------------------------------------------------------- +// +TUint16 CHssMgmtScanInfoImpl::BeaconInterval() const + { + return iScanInfo->BeaconInterval(); + } + +// --------------------------------------------------------- +// CHssMgmtScanInfoImpl::Capability +// --------------------------------------------------------- +// +TUint16 CHssMgmtScanInfoImpl::Capability() const + { + return iScanInfo->Capability(); + } + +// --------------------------------------------------------- +// CHssMgmtScanInfoImpl::SecurityMode +// Status : Draft +// --------------------------------------------------------- +// +THssConnectionSecurityMode CHssMgmtScanInfoImpl::SecurityMode() const + { + THssConnectionSecurityMode securityMode; + + switch( iScanInfo->SecurityMode() ) + { + case EHssSecurityWep: + securityMode = EHssConnectionSecurityWep; + break; + case EHssSecurity802d1x: + securityMode = EHssConnectionSecurity802d1x; + break; + case EHssSecurityWpa: // Fallthrough on purpose + case EHssSecurityWpa2: + securityMode = EHssConnectionSecurityWpa; + break; + case EHssSecurityWpaPsk: // Fallthrough on purpose + case EHssSecurityWpa2Psk: + securityMode = EHssConnectionSecurityWpaPsk; + break; + default: + securityMode = EHssConnectionSecurityOpen; + break; + }; + + return securityMode; + } + +// --------------------------------------------------------- +// CHssMgmtScanInfoImpl::InformationElement +// --------------------------------------------------------- +// +TInt CHssMgmtScanInfoImpl::InformationElement( TUint8 aIE, + TUint8& aLength, + const TUint8** aData ) + { + return iScanInfo->InformationElement( aIE, aLength, aData ); + } + +// --------------------------------------------------------- +// CHssMgmtScanInfoImpl::WpaIE +// --------------------------------------------------------- +// +TInt CHssMgmtScanInfoImpl::WpaIE( TUint8& aLength, + const TUint8** aData ) + { + return iScanInfo->WpaIE( aLength, aData ); + } + +// --------------------------------------------------------- +// CHssMgmtScanInfoImpl::FirstIE +// --------------------------------------------------------- +// +TInt CHssMgmtScanInfoImpl::FirstIE( TUint8& aIE, + TUint8& aLength, + const TUint8** aData ) + { + return iScanInfo->FirstIE( aIE, aLength, aData ); + } + +// --------------------------------------------------------- +// CHssMgmtScanInfoImpl::NextIE +// --------------------------------------------------------- +// +TInt CHssMgmtScanInfoImpl::NextIE( TUint8& aIE, + TUint8& aLength, + const TUint8** aData ) + { + return iScanInfo->NextIE( aIE, aLength, aData ); + } + +// --------------------------------------------------------- +// CHssMgmtScanInfoImpl::GetInternalList +// --------------------------------------------------------- +// +HssScanList& CHssMgmtScanInfoImpl::GetInternalList() + { + return iScanList; + } + +// --------------------------------------------------------- +// CHssMgmtScanInfoImpl::UpdateResultsL +// --------------------------------------------------------- +// +void CHssMgmtScanInfoImpl::UpdateResultsL() + { + delete iScanInfo; + iScanInfo = NULL; + iScanInfo = new(ELeave) HssScanInfo( iScanList ); + } + +// End of File diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsclient/src/hssscanhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsclient/src/hssscanhandler.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2002-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 iapsettings +* +*/ + + + +// INCLUDE FILES + +#include "hssscanhandler.h" +#include "hotspotclientserver.h" +#include +#include +#include "hssscaninfo.h" +#include "hssscanlist.h" +#include "am_debug.h" + +// CONSTS + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CHssScanHandler +// ----------------------------------------------------------------------------- +// +CHssScanHandler::CHssScanHandler( ) + { + DEBUG("CHssScanHandler::CHssScanHandler"); + + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CHssScanHandler::ConstructL() + { + DEBUG("CHssScanHandler::ConstructL()"); + iMgmtClient = CWlanMgmtClient::NewL(); + iScanInfo = CWlanScanInfo::NewL(); + } + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +CHssScanHandler* CHssScanHandler::NewL() + { + CHssScanHandler* self = new( ELeave ) CHssScanHandler(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// ~CHssScanHandler +// ----------------------------------------------------------------------------- +// +CHssScanHandler::~CHssScanHandler() + { + DEBUG("CHssScanHandler::~CHssScanHandler()"); + delete iMgmtClient; + delete iScanInfo; + } + +// ----------------------------------------------------------------------------- +// ScanRequest +// ----------------------------------------------------------------------------- +// +TInt CHssScanHandler::ScanRequest( HssScanList& aResults ) + { + DEBUG("CHssScanHandler::ScanRequest()"); + TInt ret( KErrNone ); + ret = iMgmtClient->GetScanResults( *iScanInfo ); + + TUint count( NULL ); + + aResults.ClearAll(); + + for ( iScanInfo->First(); !iScanInfo->IsDone(); iScanInfo->Next(), ++count ) + { + aResults.Append( iScanInfo->Size(),iScanInfo->Current() ); + } + DEBUG1("CHssScanHandler::ScanRequest() DONE ret: %d", ret); + return ret; + } + + +// ----------------------------------------------------------------------------- +// GetConnectionBssid +// ----------------------------------------------------------------------------- +// +TInt CHssScanHandler::GetConnectionBssid( THssBssid& aBssId ) + { + DEBUG("CHssScanHandler::GetConnectionBssid"); + return iMgmtClient->GetConnectionBssid( aBssId ); + } + +// ----------------------------------------------------------------------------- +// AddIapSsidList +// ----------------------------------------------------------------------------- +// +TInt CHssScanHandler::AddIapSsidList( + TUint aIapId, + const CArrayFixFlat& aSsidList ) + { + DEBUG("CHssScanHandler::AddIapSsidList"); + return iMgmtClient->AddIapSsidList( aIapId, aSsidList ); + } + +// End of File diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsclient/src/hsssrvnotifications.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsclient/src/hsssrvnotifications.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,165 @@ +/* +* 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: Notification class +* +*/ + + +#include "e32std.h" +#include "hssinterface.h" +#include "hsssrvnotifications.h" +#include "am_debug.h" +#include "hotspotclientserver.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CHssSrvNotifications::ConstructL +// --------------------------------------------------------- +// +void CHssSrvNotifications::ConstructL() + { + DEBUG( "CHssSrvNotifications::ConstructL()" ); + CActiveScheduler::Add( this ); + WaitForNotifications(); + } + +// --------------------------------------------------------- +// CHssSrvNotifications::CHssSrvNotifications +// --------------------------------------------------------- +// +CHssSrvNotifications::CHssSrvNotifications( + MHssSrvNotifications& aCallback, + RHssInterface& aServer): + CActive( CActive::EPriorityStandard ), + iCallback( &aCallback ), + iServer( aServer ), + iReturnData(), + iDataPckg( iReturnData ), + iCancelRequested( EFalse ), + iIapId( 0 ) + { + DEBUG( "CHssSrvNotifications::CHssSrvNotifications()" ); + } + +// --------------------------------------------------------- +// CHssSrvNotifications::~CHssSrvNotifications +// --------------------------------------------------------- +// +CHssSrvNotifications::~CHssSrvNotifications() + { + DEBUG( "CHssSrvNotifications::~CHssSrvNotifications()" ); + Cancel(); + } + +// --------------------------------------------------------- +// CHssSrvNotifications::NewL +// --------------------------------------------------------- +// +CHssSrvNotifications* CHssSrvNotifications::NewL( + MHssSrvNotifications& aCallback, + RHssInterface& aServer ) + { + DEBUG( "CHssSrvNotifications::NewL()" ); + CHssSrvNotifications* self = new (ELeave) CHssSrvNotifications( aCallback, aServer ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------- +// CHssSrvNotifications::RunL +// --------------------------------------------------------- +// +void CHssSrvNotifications::RunL() + { + DEBUG1( "CHssSrvNotifications::RunL(), status == %d", iStatus.Int() ); + + if( iStatus == KRequestPending ) + { + DEBUG( "ERROR in CHssSrvNotifications::RunL(): request still pending!" ); + return; + } + + if( iStatus == KErrServerTerminated ) + { + DEBUG( "ERROR in CHssSrvNotifications::RunL(): server terminated" ); + return; + } + + switch( iStatus.Int() ) + { + case EHssNewNetworksDetected: + { + iCallback->NewNetworksDetected( iIapId ); + break; + } + case EHssOldNetworksLost: + { + iCallback->OldNetworksLost( iIapId ); + break; + } + default: + DEBUG1( "ERROR in CHssSrvNotifications::RunL: unknown notification: %d", iStatus.Int() ); + } + + // Make a new notification request if allowed + if( !iCancelRequested ) + { + WaitForNotifications(); + } + } + +// --------------------------------------------------------- +// CHssSrvNotifications::DoCancel +// --------------------------------------------------------- +// +void CHssSrvNotifications::DoCancel() + { + DEBUG( "CHssSrvNotifications::DoCancel()" ); + iServer.CancelWaitForNotification(); + } + +// --------------------------------------------------------- +// CHssSrvNotifications::WaitForNotifications +// --------------------------------------------------------- +// +void CHssSrvNotifications::WaitForNotifications() + { + DEBUG( "CHssSrvNotifications::WaitForNotifications()" ); + iServer.WaitForNotification( iStatus, iDataPckg ); + SetActive(); + } + +// --------------------------------------------------------- +// CHssSrvNotifications::Activate +// --------------------------------------------------------- +// +void CHssSrvNotifications::Activate( MHssSrvNotifications& aCallback ) + { + DEBUG( "CHssSrvNotifications::Activate()" ); + iCallback = &aCallback; + iCancelRequested = EFalse; + WaitForNotifications(); + } + +// --------------------------------------------------------- +// CHssSrvNotifications::SetCancelled +// --------------------------------------------------------- +// +void CHssSrvNotifications::SetCancelled() + { + iCancelRequested = ETrue; + } diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsfw_sis/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsfw_sis/backup_registration.xml Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,5 @@ + + + + + diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsfw_sis/cenrep.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsfw_sis/cenrep.pkg Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,47 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: ; Languages +; + +; ============================================================================ +; Name : cenrep_armv5.pkg +; --------------------------------------------------------------------------- +; Version history: +; ============================================================================ +; +; Languages + +; ============================================================================ +; Name : cenrep_armv5.pkg +; --------------------------------------------------------------------------- +; Version history: +; ============================================================================ +; +; Languages +&EN + +; Header +#{"HotSpot ICTS Repository"}, (0x10202BE9), 1, 0, 0, TYPE=SISPATCH + +; Supports Series 60 v 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +;Files +"..\InternetConnectivityTestService\cenrep\10282EC7.txt"-"c:\private\10202BE9\10282EC7.txt" \ No newline at end of file diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsfw_sis/hotspot.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsfw_sis/hotspot.pkg Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,63 @@ +; +; 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: ;Languages +; +&EN + +;Header +#{"Hotspot FW demo"},(0x10282ECB),1,0,0 + +; Supports Series 60 v 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +; Localised Vendor Name +%{"Nokia"} + +;Unique Vendor Name +:"Nokia" + +; Uninstall +"\EPOC32\RELEASE\ARMV5\UREL\HotspotUninstall.exe"-"c:\sys\bin\HotspotUninstall.exe", FR, RR, RW + +; Server +"\EPOC32\RELEASE\ARMV5\UREL\HotSpotServer.exe"-"c:\sys\bin\HotSpotServer.exe" + +; Client API +"\EPOC32\RELEASE\ARMV5\UREL\hotspotclient.dll"-"c:\sys\bin\hotspotclient.dll" + +; ECOM plugin +"\EPOC32\DATA\Z\Resource\Plugins\NetCfgExtnHotSpot.RSC"-"c:\resource\plugins\NetCfgExtnHotSpot.RSC" +"\EPOC32\RELEASE\ARMV5\UREL\NetCfgExtnHotSpot.dll"-"c:\sys\bin\NetCfgExtnHotSpot.dll" + +; ECOM plugin +"\EPOC32\DATA\Z\Resource\Plugins\HssMgmtImpl.rsc"-"c:\resource\plugins\HssMgmtImpl.rsc" +"\EPOC32\RELEASE\ARMV5\UREL\hssmgmtimpl.dll"-"c:\sys\bin\hssmgmtimpl.dll" + +; ICTS +"\EPOC32\RELEASE\ARMV5\UREL\ictsclientinterface.dll"-"c:\sys\bin\ictsclientinterface.dll" + +"\EPOC32\RELEASE\ARMV5\UREL\wlanagthotspotimpl.dll"-"c:\sys\bin\wlanagthotspotimpl.dll" +"\EPOC32\RELEASE\ARMV5\UREL\wlanagt2.agt"-"c:\sys\bin\WlanAgt2.agt" +"\EPOC32\DATA\Z\Resource\Plugins\WlanAgtHotSpotImpl.RSC"-"c:\resource\plugins\WlanAgtHotSpotImpl.RSC" + +; Hotspot browser logon application +"\epoc32\release\armv5\urel\HsBrowser.exe" -"c:\sys\bin\HsBrowser.exe" + +; Hotspot browser logon application, resources and bitmaps +"\epoc32\data\z\resource\apps\hsbrowser.rsc" -"c:\Resource\apps\hsbrowser.rsc" +"\epoc32\data\z\private\10003a3f\apps\hsbrowser_reg.RSC" -"c:\private\10003a3f\import\apps\hsbrowser_reg.rsc" + +; Embedded SIS-files +@"ictscenrep.sisx" ,(0x10202BE9) +"backup_registration.xml"-"c:\private\10282ECB\backup_registration.xml" diff -r 000000000000 -r 56b72877c1cb hotspotfw/hspluginforagent/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hspluginforagent/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2002-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: Build information file for WLAN Agent-HS plugin +* +*/ + + + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +wlanagthotspotimpl.mmp diff -r 000000000000 -r 56b72877c1cb hotspotfw/hspluginforagent/group/wlanagthotspotimpl.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hspluginforagent/group/wlanagthotspotimpl.mmp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2002-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: project specification file for the wlanagthotspotimpl +* +*/ + + + +#include + +TARGET wlanagthotspotimpl.dll +TARGETTYPE plugin +UID 0x10009d8d 0x1028309b +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +START RESOURCE ../src/1028309b.rss +TARGET WlanAgtHotSpotImpl +END + +SOURCEPATH ../src +SOURCE wlanagthotspotimpl.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc +USERINCLUDE ../../hsserver/inc + +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom +SYSTEMINCLUDE /epoc32/include/comms-infras + +LIBRARY ecom.lib +LIBRARY euser.lib +LIBRARY hotspotclient.lib diff -r 000000000000 -r 56b72877c1cb hotspotfw/hspluginforagent/inc/wlanagthotspotimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hspluginforagent/inc/wlanagthotspotimpl.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2002-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: Agent-hotspot interaction plugin +* +*/ + + + +#ifndef WLANAGTHOTSPOTIMPL_H +#define WLANAGTHOTSPOTIMPL_H + +#include +#include +#include "hssinterface.h" + +/** +* Plugin used by WLAN Agent in order to interact with Hot Spot frame work which is middleware component +* +* @lib wlanagthotspotimpl.dll +* @since Series 60 3.0 +*/ +class CWlanAgtHotSpotImpl : + public CWlanAgtHotSpotClient + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param aCallback specifies the callback interface + */ + static CWlanAgtHotSpotImpl* NewL( ); + + /** + * Destructor. + */ + virtual ~CWlanAgtHotSpotImpl(); + + public: // Functions from base classes + + /* From CWlanAgtHotSpotClient */ + + void HotSpotStart( const TUint aIapId, TRequestStatus& aStatus ); + + void HotSpotStartAgain( const TUint aIapId, TRequestStatus& aStatus ); + + void HotSpotCloseConnection( const TUint aIapId, TRequestStatus& aStatus ); + + void HotSpotCancel( const TUint aIapId ); + + private: + + /** + * C++ default constructor. + */ + CWlanAgtHotSpotImpl( ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Requests a notification from System Agent. + */ + void IssueRequest(); + + + private: // Data + + RHssInterface iHSServer; + + }; + +#endif // WLANAGTHOTSPOTIMPL_H diff -r 000000000000 -r 56b72877c1cb hotspotfw/hspluginforagent/src/1028309b.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hspluginforagent/src/1028309b.rss Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 1020 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 resources for the Agent-Hotspot interaction +* +*/ + + + +#include + +// --------------------------------------------------------- +// +// +// ECOM resource definitions for WlanAgtHotSpotImpl plugin +// +// --------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = 0x1028309b; + + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = 0x1028309c; + implementations = + { + // Info for WlanAgtHotSpotImpl + IMPLEMENTATION_INFO + { + implementation_uid = 0x1028309d; + version_no = 1; + display_name = "WlanAgtHotSpotImpl"; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } diff -r 000000000000 -r 56b72877c1cb hotspotfw/hspluginforagent/src/wlanagthotspotimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hspluginforagent/src/wlanagthotspotimpl.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2002-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 Agent-hotspot frame work interaction plugin +* +*/ + + + +#include +#include + +#include "wlanagthotspotimpl.h" +#include "am_debug.h" + +/** +* Pairs ECom implementation UIDs with a pointer to the instantiation +* method for that implementation. Required for all ECom implementation +* collections. +*/ +const TImplementationProxy ImplementationTable[] = + { + {{0x1028309d}, reinterpret_cast(CWlanAgtHotSpotImpl::NewL)} + }; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CWlanAgtHotSpotImpl::CWlanAgtHotSpotImpl +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CWlanAgtHotSpotImpl::CWlanAgtHotSpotImpl( ) + { + //LOGPRINT((_L("CWlanAgtHotSpotImpl::CWlanAgtHotSpotImpl()" ))) + DEBUG( "CWlanAgtHotSpotImpl::CWlanAgtHotSpotImpl()" ); + } + +// ----------------------------------------------------------------------------- +// CWlanAgtHotSpotImpl::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CWlanAgtHotSpotImpl::ConstructL() + { + //LOGPRINT((_L("CWlanAgtHotSpotImpl::ConstructL()" ))) + DEBUG( "CWlanAgtHotSpotImpl::ConstructL()" ); + + User::LeaveIfError( iHSServer.Connect() ); + } + +// ----------------------------------------------------------------------------- +// CWlanAgtHotSpotImpl::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CWlanAgtHotSpotImpl* CWlanAgtHotSpotImpl::NewL( ) + { + DEBUG("CWlanAgtHotSpotImpl::NewL()"); + CWlanAgtHotSpotImpl* self = new( ELeave ) CWlanAgtHotSpotImpl( ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// Destructor +CWlanAgtHotSpotImpl::~CWlanAgtHotSpotImpl() + { + //LOGPRINT((_L("CWlanAgtHotSpotImpl::~CWlanAgtHotSpotImpl()" ))) + DEBUG( "CWlanAgtHotSpotImpl::~CWlanAgtHotSpotImpl()" ); + iHSServer.Close(); + } + + +// ----------------------------------------------------------------------------- +// CWlanAgtHotSpotImpl::HotSpotStart +// Sends Start request for an iAP to the HotSpot server +// ----------------------------------------------------------------------------- +// +void CWlanAgtHotSpotImpl::HotSpotStart( const TUint aIapId, TRequestStatus& aStatus ) + { + //LOGPRINT((_L("CWlanAgtHotSpotImpl::HotSpotStart()" ))) + DEBUG( "CWlanAgtHotSpotImpl::HotSpotStart()" ); + iHSServer.Start( aIapId, aStatus ); + } + +// ----------------------------------------------------------------------------- +// CWlanAgtHotSpotImpl::HotSpotStartAgain +// Sends StartAgain request for an iAP to the HotSpot server +// ----------------------------------------------------------------------------- +// +void CWlanAgtHotSpotImpl::HotSpotStartAgain( const TUint aIapId, TRequestStatus& aStatus ) + { + //LOGPRINT((_L("CWlanAgtHotSpotImpl::HotSpotStartAgain()" ))) + DEBUG( "CWlanAgtHotSpotImpl::HotSpotStartAgain()" ); + iHSServer.StartAgain( aIapId, aStatus ); + } + + +// ----------------------------------------------------------------------------- +// CWlanAgtHotSpotImpl::HotSpotCloseConnection +// Sends CloseConnection request for an iAP to the HotSpot server +// ----------------------------------------------------------------------------- +// +void CWlanAgtHotSpotImpl::HotSpotCloseConnection( const TUint aIapId, TRequestStatus& aStatus ) + { + //LOGPRINT((_L("CWlanAgtHotSpotImpl::HotSpotCloseConnection()" ))) + DEBUG( "CWlanAgtHotSpotImpl::HotSpotCloseConnection()" ); + iHSServer.CloseConnection( aIapId, aStatus ); + } + + +// ----------------------------------------------------------------------------- +// CWlanAgtHotSpotImpl::HotSpotCancel +// Sends Cancel request for an iAP to the HotSpot server +// ----------------------------------------------------------------------------- +// +void CWlanAgtHotSpotImpl::HotSpotCancel( const TUint aIapId ) + { + //LOGPRINT((_L("CWlanAgtHotSpotImpl::HotSpotCancel()" ))) + DEBUG( "CWlanAgtHotSpotImpl::HotSpotCancel()" ); + iHSServer.Cancel( aIapId ); + } + + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// --------------------------------------------------------- +// Returns an instance of the proxy table. +// Returns: KErrNone +// --------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable) / sizeof( TImplementationProxy ); + return ImplementationTable; + } diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/group/hotspotserver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/group/hotspotserver.mmp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2002-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: Project definition file for project HotSpot Server +* +*/ + + +#include + +TARGET HotSpotServer.exe +TARGETTYPE exe +TARGETPATH /system/programs +UID 0x1000008d 0x10282ECB +VENDORID VID_DEFAULT + +EPOCSTACKSIZE 0x05000 + +SOURCEPATH ../src +SOURCE hotspotserver.cpp +SOURCE hotspotsession.cpp +SOURCE hssnotif.cpp +SOURCE hssiapsettingshandler.cpp +SOURCE hsslogintimer.cpp +SOURCE hsslogouttimer.cpp + +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 +LIBRARY cmmanager.lib +STATICLIBRARY hssscanlist.lib + +CAPABILITY CAP_SERVER NetworkControl diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/group/hssscanlist.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/group/hssscanlist.mmp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2002-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: Project definition file for project wlanscanlist +* +*/ + + +#include + +TARGET hssscanlist.lib +TARGETTYPE lib + +VENDORID VID_DEFAULT + + +SOURCEPATH ../src +USERINCLUDE ../inc + +SOURCE hssscaninfo.cpp +SOURCE hssscanlist.cpp +SOURCE hssscanlistiterator.cpp +SOURCE hssscaninfoie.cpp + +MW_LAYER_SYSTEMINCLUDE + diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/802dot11.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/802dot11.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,3713 @@ +/* +* Copyright (c) 2005-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: Header file mainly for 802.11 specific declarations and +* definitions. +* +*/ + + + +#ifndef WLAN802DOT11_H +#define WLAN802DOT11_H + +// for copy, equal and operator != support +#include "algorithm.h" +#include "pack.h" + +// returns aDest +extern +TAny* os_memcpy( TAny* aDest, const TAny* aSrc, TUint32 aLengthinBytes ); +// returns 0 if equal +extern TInt +os_memcmp( const TAny* aSrc1, const TAny* aSrc2, TUint aLengthinBytes ); + +/** + * Returns a TUint16 host byte order value in WLAN MAC layer byte order + * (LSB first) + * + * @since S60 3.1 + * @param aNw value in network byte order + * @return value in host byte order + */ +extern TUint16 os_Hton( TUint16 aHost ); + +/** + * Returns a TUint16 WLAN MAC layer byte order (LSB first) value in host byte + * order + * + * @since S60 3.1 + * @param aNw value in network byte order + * @return value in host byte order + */ +extern TUint16 os_Ntoh( TUint16 aNw ); + +/** + * Allows also unaligned reading of a TUint16 WLAN MAC layer byte order + * (LSB first) value and returns the result in the byte order which + * is in use in the host + * + * @since S60 3.1 + * @param aNwSource where to read the WLAN MAC layer byte order value from + * @return the value which was read, in host byte order + */ +inline TUint16 ReadUint16Toh( const TUint16* aNwSource ) + { + return ( os_Ntoh( + ( static_cast( + ( reinterpret_cast(aNwSource) )[0] ) | + ( static_cast( + ( reinterpret_cast(aNwSource) )[1] ) << 8 ) ) ) ); + } + +/** + * Allows also unaligned writing of a TUint16 host byte order value + * into WLAN MAC layer byte order + * + * @since S60 3.1 + * @param aNwTarget where to write the WLAN MAC layer byte order value to + * @param aHostValue the host byte order value to be written + */ +inline void WriteHtoUint16( TUint16* aNwTarget, TUint16 aHostValue ) + { + TUint16 nwValue = os_Hton( aHostValue ); + reinterpret_cast(aNwTarget)[0] = + ( reinterpret_cast(&nwValue) )[0]; + reinterpret_cast(aNwTarget)[1] = + ( reinterpret_cast(&nwValue) )[1]; + } + +/** + * Reverses the byte order of a TUint16 value + * + * @since S60 3.1 + * @param aOriginal value whose byte order is to be reversed + * @return the input parameter in reversed byte order + */ +inline TUint16 ReverseUint16( TUint16 aOriginal ) + { + return ( ( aOriginal >> 8 ) | ( aOriginal << 8 ) ); + } + + +/** +* A measurement of time equal to 1024 µs. +*/ +const TUint16 KTU = 1024; + +/** +* Length of the MAC address +*/ +const TUint8 KMacAddressLength = 6; + +/** +* Length of MAC header +*/ +const TUint8 KMacHeaderLength = 24; + +/** +* Maximum number of 802.11b supported rates +* 1, 2, 5.5, 11 MBit/s +*/ +const TUint8 KMaxNumberOfDot11bRates = 4; + +/** +* Maximum number of actual supported rate elements in +* supported rates information element +*/ +const TUint8 KMaxNumberOfRates = 8; + +/** +* Maximum number of actual 802.11 supported rate elements in +* extended supported rates information element +*/ +const TUint8 KMaxNumberOfExtendedRates = 255; + +/** +* Maximum number of 802.11b plus 802.11g supported rates +*/ +const TUint8 KMaxNumberOfDot11bAndgRates = 14; + +/** +* Bit mask for checking is supported rate element +* part of BSS Basic Rate Set (MSB bit is set) +*/ +const TUint8 KBasicRateMask = 0x80; + +/** +* Maximum length for a WEP key in BYTES +*/ +const TUint32 KMaxWEPKeyLength = 29; // 232 bits + +/** +* Length of TKIP key; +*/ +const TUint8 KTKIPKeyLength = 16; + +/** +* Length of WEP Init.Vector in BYTES +*/ +const TUint8 KWepIVLength = 4; + +/** +* Length of WEP ICV in BYTES +*/ +const TUint8 KWEPICVLength = 4; + +/** +* Length of Extended IV field in bytes. +*/ +const TUint8 KWepExtendedIVLength = 4; + +/** +* Mask to determine is Ext IV bit up in WEP IV +*/ +const TUint32 KWepExtendedIvMask = 0x20000000; + +/** +* Mask for Use Protection bit in ERP Information IE +*/ +const TUint8 KUseProtectionMask = 0x02; + +/** +* Length of MIC in BYTEs +*/ +const TUint8 KMicLength = 8; + +/** +* Length of the MIC key in BYTEs +*/ +const TUint8 KMicKeyLength = 8; + +/** +* Maximum length of a SSID in BYTES +*/ +const TUint8 KMaxSSIDLength = 32; + +/** +* Maximum length of an outbound RSN IE length in BYTEs +*/ +const TUint8 KMaxTxRsnIELength = 38; + +/** +* Length of ID and Length fields of an information element. +*/ +const TUint8 KInfoElementHeaderLength = 2; + +/** +* Length of the challenge text in BYTES used in shared key authentication +*/ +const TUint8 KChallengeTextLength = 128; + +/** +* Ethernet header type field identifier for Bounce type packet +*/ +const TUint16 KBounceType = 0x8013; + +/** +* Ethernet header type field identifier for EAPOL type packet (IEEE 802.1X) +*/ +const TUint16 KEapolType = 0x888E; + +/** +* Ethernet header type field identifier for IP type packet +*/ +const TUint16 KIpType = 0x0800; + +/** +* Ethernet header type field identifier for IPv6 type packet +*/ +const TUint16 KIpv6Type = 0x86DD; + +/** +* Ethernet header type field identifier for ARP type packet +*/ +const TUint16 KArpType = 0x0806; + +/** +* Maks for determining does PLCP header service field have PBCC bit set +*/ +const TUint8 KPlcpServicePbccMask = 0x08; + +/** +* Length of OUI field in SNAP header +*/ +const TUint8 KOIULength = 3; + +/** +* Maximum length of 802.11 Frame Body field +*/ +const TUint16 KMaxDot11FrameBodyLength = 2312; + +/** +* Length of trailing FCS in bytes +*/ +const TUint32 KFcsLength = 4; + +/** +* Maximum length of 802.11 frame we will transmit or receive. +* This excludes the tailing FCS ( HW strips it ) +* and Address4 field in the MPDU header +* ( AP-to-AP mode frames are filtered out ) +*/ +const TUint16 KMaxDot11FrameLength = KMacHeaderLength + + KMaxDot11FrameBodyLength; // 24 + 2312 = 2336 + +/** +* Maximum length of 802.11 frame as stated in the standard +*/ +const TUint16 KDot11MPDUMaxLength = 2346; + +/** +* Maximum length of ethernet frame +*/ +const TUint16 KMaxEthernetFrameLength = 1514; + +/** +* Maximum value in ethernet length field +*/ +const TUint16 KMaxEthernetLengthFieldvalue = 1500; + +/** +* Length of the TKIP key in BYTEs +*/ +const TUint8 KTkIpKeyLength = 16; + +/** +* Length of IPv4 address field in BYTEs +*/ +const TUint8 KIpv4AddrLength = 4; + +/** +* Length of the priority filed used in WPA MIC calculation +*/ +const TUint32 KWpaPriorityVecLen = 4; + +/** +* WPA priority field used in MIC calculation +*/ +const TUint8 KWpaPriorityVec[KWpaPriorityVecLen] = {0,0,0,0}; + +/** +* Mask for frame type for frame control field. +*/ +const TUint32 K802Dot11FrameTypeMask = 0xFFFF; + +/** +* Mask to determine if U-APSD bit is up in QoS info field of WMM IE +*/ +const TUint8 KUapsdQosInfoMask = 0x80; + +/** +* Mask for parameter set count in QoS info field of WMM IE +*/ +const TUint8 KParamSetCountQosInfoMask = 0x0F; + +/** +* Length of WMM Information Element +*/ +const TUint8 KWmmInfoElemLen = 7; + +/** +* Length of OUI field in Information Elements +*/ +const TUint8 KIeOuiLength = 3; + +typedef TUint8 TIeOui[KIeOuiLength]; + +/** +* OUI value of WMM Information Element and +* WMM Parameter Element +*/ +const TIeOui KWmmElemOui = { 0x00, 0x50, 0xF2 }; + +/** +* OUI Type value of WMM Information Element and +* WMM Parameter Element +*/ +const TUint8 KWmmElemOuiType = 2; + +/** +* OUI Subtype value of WMM Information Element +*/ +const TUint8 KWmmInfoElemOuiSubType = 0; + +/** +* OUI Subtype value of WMM Parameter Element +*/ +const TUint8 KWmmParamElemOuiSubtype = 1; + +/** +* Version of WMM Information Element +*/ +const TUint8 KWmmInfoElemVersion = 1; + +/** +* Version of WMM Parameter Element +*/ +const TUint8 KWmmParamElemVersion = 1; + +/** +* The TXOP Limit in the AC Parameters Record of WMM Parameter Element +* needs to be multiplied by this value to get TXOP Limit in microseconds +*/ +const TUint8 KWmmTxOpLimitMultiplier = 32; + +/** +* AC flags in QoS info field of WMM IE +* When a flag is set the corresponding AC is both trigger and delivery enabled +*/ +enum TQosInfoUapsdFlag + { + EAcVoUapsdFlag = 0x01, // Voice + EAcViUapsdFlag = 0x02, // Video + EAcBkUapsdFlag = 0x04, // Background + EAcBeUapsdFlag = 0x08 // Best Effort + }; + + +/** +* Maximum U-APSD Service Period length. Indicates the max number of MSDUs and +* MMPDUs the WMM AP may deliver to a WMM STA during any service period +* triggered by the WMM STA. +*/ +enum TQosInfoUapsdMaxSpLen + { + EMaxSpLenAllFrames = 0x00, + EMaxSpLenTwoFrames = 0x20, + EMaxSpLenFourFrames = 0x40, + EMaxSpLenSixFrames = 0x60 + }; + +const TUint8 K802Dot11AccessCategoryMask = 0x60; + +/** +* WMM Access Categories +*/ +enum TWmmAccessCategory + { + EAcBestEffort = 0x00, + EAcBackground = 0x20, + EAcVideo = 0x40, + EAcVoice = 0x60 + }; + +/** +* Number of WMM Access Categories +*/ +const TUint8 KNumOfWmmACs = 4; + +/** +* Mask for the Admission Control Mandatory flag +* in ACI/AIFSN field +* of AC parameter Record +* of WMM Parameter Element +*/ +const TUint8 KWmmAdmissionCtrlMandatoryMask = 0x10; + +/** +* Mask for the AIFSN subfiled +* in ACI/AIFSN field +* of AC parameter Record +* of WMM Parameter Element +*/ +const TUint8 KWmmAifsnMask = 0x0F; + +/** +* Mask for the ECWmin field +* of AC parameter Record +* of WMM Parameter Element +*/ +const TUint8 KWmmEcwMinMask = 0x0F; + +/** +* Mask for the ECWmax field +* of AC parameter Record +* of WMM Parameter Element +*/ +const TUint8 KWmmEcwMaxMask = 0xF0; + +/** +* 802.11 Authentication sequence numbers +*/ +enum T802Dot11AuthenticationSeqNmbr + { + E802Dot11AuthenticationSeqNmbr1 = 1, + E802Dot11AuthenticationSeqNmbr2 = 2, + E802Dot11AuthenticationSeqNmbr3 = 3, + E802Dot11AuthenticationSeqNmbr4 = 4 + }; + +/** +* 802.11 WEP key ID values +*/ +enum T802Dot11WepKeyId + { + E802Dot11WepKeyId0 = 0, + E802Dot11WepKeyId1 = 1, + E802Dot11WepKeyId2 = 2, + E802Dot11WepKeyId3 = 3, + // defined as an upper bound + E802Dot11WepKeyIdMax = 4 + }; + +/** +* 802.11 supported rate bytes. Used e.g. in Beacon frames. +*/ +enum T802Dot11SupportedRate + { + E802Dot11Rate1MBit = 2, + E802Dot11Rate2MBit = 4, + E802Dot11Rate5p5MBit = 11, + E802Dot11Rate6MBit = 12, + E802Dot11Rate9MBit = 18, + E802Dot11Rate11MBit = 22, + E802Dot11Rate12MBit = 24, + E802Dot11Rate18MBit = 36, + E802Dot11Rate22MBit = 44, + E802Dot11Rate24MBit = 48, + E802Dot11Rate33MBit = 66, + E802Dot11Rate36MBit = 72, + E802Dot11Rate48MBit = 96, + E802Dot11Rate54MBit = 108 + }; + +/** +* Management frame information element IDs. +*/ +enum T802Dot11InformationElementID + { + 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, + E802Dot11ExtendedRatesIE = 50, + E802Dot11RsnIE = 221, + E802Dot11VendorSpecificIE = 221 + }; + +/** +* Bit masks for bit fields ín Frame Control field. +*/ +enum T802Dot11FrameControlBitMask + { + E802Dot11FrameControlProtVersionMask= 0x0003, + E802Dot11FrameControlTypeMask = 0x000C, + E802Dot11FrameControlSubtypeMask = 0x00F0, + E802Dot11FrameControlToDsMask = 0x0100, + E802Dot11FrameControlFromDsMask = 0x0200, + E802Dot11FrameControlMoreFragMask = 0x0400, + E802Dot11FrameControlRetryMask = 0x0800, + E802Dot11FrameControlPowerMgmtMask = 0x1000, + E802Dot11FrameControlMoreDataMask = 0x2000, + E802Dot11FrameControlWepMask = 0x4000, + E802Dot11FrameControlOrderMask = 0x8000 + }; + +/** +* Frame Control field type masks. +*/ +enum T802Dot11FrameControlBasicTypeMask +{ + E802Dot11FrameBasicTypeManagement = 0x00, + E802Dot11FrameBasicTypeControl = 0x04, + E802Dot11FrameBasicTypeData = 0x08 +}; + +/** +* Frame Control field subtype masks. +*/ +enum T802Dot11FrameControlTypeMask + { + E802Dot11FrameTypeAssociationReq = 0x00, + E802Dot11FrameTypeAssociationResp = 0x10, + E802Dot11FrameTypeReassociationReq = 0x20, + E802Dot11FrameTypeReassociationResp = 0x30, + E802Dot11FrameTypeProbeReq = 0x40, + E802Dot11FrameTypeProbeResp = 0x50, + E802Dot11FrameTypeBeacon = 0x80, + E802Dot11FrameTypeAtim = 0x90, + E802Dot11FrameTypeDisassociation = 0xA0, + E802Dot11FrameTypeAuthentication = 0xB0, + E802Dot11FrameTypeDeauthentication = 0xC0, + E802Dot11FrameTypePowerSavePoll = 0xA4, + E802Dot11FrameTypeReqToSend = 0xB4, + E802Dot11FrameTypeClearToSend = 0xC4, + E802Dot11FrameTypeAcknowledgement = 0xD4, + E802Dot11FrameTypeCfEnd = 0xE4, + E802Dot11FrameTypeCfEndCfAck = 0xF4, + E802Dot11FrameTypeData = 0x08, + E802Dot11FrameTypeDataCfAck = 0x18, + E802Dot11FrameTypeDataCfPoll = 0x28, + E802Dot11FrameTypeDataCfAckCfPoll = 0x38, + E802Dot11FrameTypeDataNull = 0x48, + E802Dot11FrameTypeCfAckNoData = 0x58, + E802Dot11FrameTypeCfPollNoData = 0x68, + E802Dot11FrameTypeCfAckCfPollNoData = 0x78, + E802Dot11FrameTypeQosData = 0x88, + E802Dot11FrameTypeQosDataCfAck = 0x98, + E802Dot11FrameTypeQosDataCfPoll = 0xA8, + E802Dot11FrameTypeQosDataCfAckCfPoll = 0xB8, + E802Dot11FrameTypeQosDataNull = 0xC8, + + // not valid 802.11 types. + // just used in TxCompleted function to distinct separate cases + E802Dot11FrameTypeAuthSeqNmbr1 = 0xFD, + E802Dot11FrameTypeAuthSeqNmbr3 = 0xFE, + E802Dot11FrameTypeDataEapol = 0xFF, + + // not valid 802.11 types. + // just for test purposes + E802Dot11FrameTypeTestFrame = 0xFFFF + }; + +/** +* Bit masks for Capability Information field. +*/ +enum T802Dot11CapabilityBitMask + { + E802Dot11CapabilityEssMask = 0x0001, + E802Dot11CapabilityIbssMask = 0x0002, + E802Dot11CapabilityCfPollableMask = 0x0004, + E802Dot11CapabilityCfPollRequestMask= 0x0008, + E802Dot11CapabilityPrivacyMask = 0x0010, + // these little critters are from 802.11b spec + E802Dot11ShortPreambleMask = 0x0020, + E802Dot11PbccMask = 0x0040, + E802Dot11ChannelAgilityMask = 0x0080, + E802Dot11ShortSlotTimeMask = 0x0400 + }; + +/** +* Supported authentication modes +*/ +const TUint16 K802Dot11AuthModeOpen = 0; +const TUint16 K802Dot11AuthModeShared = 1; + +/** +* 802.11 status codes +*/ +enum T802Dot11ManagementStatusCode + { + E802Dot11StatusSuccess = 0, + E802Dot11StatusUnspecifiedFailure = 1, + // 2 -9 reserved + E802Dot11StatusUnsupportedCapabilities = 10, + E802Dot11StatusReAssociationDenied = 11, + E802Dot11StatusAssocDenied = 12, + E802Dot11StatusAuthAlgorithmNotSupported = 13, + E802Dot11StatusAuthFrameOutOfSequence = 14, + E802Dot11StatusChallengeFailure = 15, + E802Dot11StatusAuthRejectedTimeout = 16, + E802Dot11StatusAssocDeniedApFull = 17, + E802Dot11StatusAssocDeniedBasicRatesUnSupp = 18, + // following three little critters are from 802.11b spec + E802Dot11StatusAssocDeniedShortPreambleUnSupp = 19, + E802Dot11StatusAssocDeniedPbccUnSupp = 20, + E802Dot11StatusAssocDeniedChannelAgilityUnSupp = 21 + // 22 - 65,535 reserved + }; + +/** +* 802.11 reason codes +*/ +enum T802Dot11ManagementReasonCode + { + // 0 reserved + E802Dot11ReasonUnspecified = 1, + E802Dot11ReasonAuthNoLongerValid = 2, + E802Dot11ReasonDeauthStationLeft = 3, + E802Dot11ReasonDisAssocInactivity = 4, + E802Dot11ReasonDisAssocAPFull = 5, + E802Dot11ReasonClass2FrameWhenNotAuth = 6, + E802Dot11ReasonClass3FrameWhenNotAssoc = 7, + E802Dot11ReasonDisAssocStationLeft = 8, + E802Dot11ReasonAssocFailNotAuth = 9, + // 10 - 12 reserved + // WPA stuff + E802Dot11ReasonInvalidIe = 13, + E802Dot11ReasonMicFailure = 14, + E802Dot11ReasonHandshakeTimeout = 15, + E802Dot11ReasonGroupKeyUpdateTimeout = 16, + E802Dot11ReasonIeMismatch = 17, + E802Dot11ReasonMulticastChipherNotValid = 18, + E802Dot11ReasonUnicastChipherNotValid = 19, + E802Dot11ReasonAkmpNotValid = 20, + E802Dot11ReasonUnsupportedRsneVersion = 21, + E802Dot11ReasonInvalidRsneCapabilities = 22, + E802Dot11Reason1xAuthenticationFailed = 23, + // 24 - 65,535 reserved + }; + +/** +* 802.11 management frame fixed field and IE lengths in BYTEs +*/ +const TUint32 KTimeStampFixedFieldLength = 8; +const TUint32 KBeaconIntervalFixedFieldLength = 2; +const TUint32 KCapabilityInformationFixedFieldLength = 2; +const TUint32 KDsParameterSetIeLength = 3; +const TUint32 KIbssParameterSetIeLength = 4; + +/** +* The one and only MAC address struct +*/ +#pragma pack( 1 ) +struct TMacAddress + { + /** the MAC address */ + TUint8 iMacAddress[KMacAddressLength]; + } __PACKED; // 6 bytes + +/** +* Broadcast MAC Address. +*/ +const TMacAddress KBroadcastMacAddr = {{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }}; + +/** +* MAC address that all zeros +*/ +const TMacAddress KZeroMacAddr = {{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}; + +/** +* operator== for TMacAddress +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const TMacAddress& aLhs, const TMacAddress& aRhs ) + { + return ( equal( (aLhs.iMacAddress), + (aLhs.iMacAddress) + KMacAddressLength, + aRhs.iMacAddress) ); + } + +/** +* Sets or clears the group bit of the MAC address +* @param aMac the address +* @param aSet set or clear the bit +*/ +inline void GroupBit( TMacAddress& aMac, TBool aSet = ETrue ) + { + if ( aSet ) + { + aMac.iMacAddress[0] |= KBit0; + } + else + { + aMac.iMacAddress[0] &= ~KBit0; + } + } + +/** +* Evaluates if the group bit of the MAC address is set +* @param aMac the address +* @return ETrue if group bit is set EFalse in other case +*/ +inline TBool IsGroupBitSet( const TMacAddress& aMac ) + { + return (aMac.iMacAddress[0] & KBit0); + } + +/** +* Sets or clears the local bit of the MAC address +* @param aMac the address +* @param aSet set or clear the bit +*/ +inline void LocalBit( TMacAddress& aMac, TBool aSet = ETrue ) + { + if ( aSet ) + { + aMac.iMacAddress[0] |= KBit1; + } + else + { + aMac.iMacAddress[0] &= ~KBit1; + } + } + +/** +* Evaluates if the local bit of the MAC address is set +* @param aMac the address +* @return ETrue if group bit is set EFalse in other case +*/ +inline TBool IsLocalBitSet( const TMacAddress& aMac ) + { + return (aMac.iMacAddress[0] & KBit1); + } + +/** +* 802.11 information element header +*/ +#pragma pack( 1 ) +struct SInformationElementHeader + { + /** the element ID */ + const TUint8 iElementID; + /** length of the following IE */ + TUint8 iLength; + + /** + * Ctor + * @param aElementID element ID used + */ + explicit SInformationElementHeader( + T802Dot11InformationElementID aElementID ) + : iElementID( static_cast(aElementID) ), iLength( 0 ) {}; + /** + * Ctor + * @param aElementID element ID used + * @param aLength length of the information element following this header + */ + SInformationElementHeader( T802Dot11InformationElementID aElementID, + const TUint8 aLength ) + : iElementID( static_cast(aElementID) ), iLength( aLength ) {}; + +private: + + /** Prohibit assignment operator */ + SInformationElementHeader& operator= ( const SInformationElementHeader& ); + /** Prohibit copy constructor */ + SInformationElementHeader( const SInformationElementHeader& ); + } __PACKED; // 2 bytes + +/** +* operator== for SInformationElementHeader +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SInformationElementHeader& aLhs, + const SInformationElementHeader& aRhs ) + { + return static_cast(( aLhs.iElementID == aRhs.iElementID + && aLhs.iLength == aRhs.iLength )); + } + +/** +* 802.11 SSID information element +*/ +#pragma pack( 1 ) +struct SSsIdIE + { + /** information element header */ + SInformationElementHeader iHeader; // 2 bytes + /** SSID information element */ + TUint8 iSsIdIe[KMaxSSIDLength]; // 32 bytes + + /** + * Ctor + */ + inline SSsIdIE() : iHeader( E802Dot11SsidIE ) {}; + + /** + * Ctor + * @param aData pointer to SSID + * @param aLength length of aData + */ + inline SSsIdIE( const TUint8* aData, TUint8 aLength ); + + /** + * Returns information elements length ( the element + its header ) + * @return see above + */ + TUint8 GetIeLength() const { return static_cast( + (iHeader.iLength + sizeof( SInformationElementHeader ) ) ); } + +private: + + /** Prohibit assignment operator */ + SSsIdIE& operator= ( const SSsIdIE& ); + /** Prohibit copy constructor */ + SSsIdIE( const SSsIdIE& ); + } __PACKED; // 34 bytes + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SSsIdIE::SSsIdIE( const TUint8* aData, TUint8 aLength ) + : iHeader( E802Dot11SsidIE ) + { + iHeader.iLength = aLength; + os_memcpy( &(iSsIdIe[0]), aData, aLength ); + } + +/** +* operator== for SSsIdIE +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal EFalse not equal +*/ +inline TBool operator== ( + const SSsIdIE& aLhs, + const SSsIdIE& aRhs) + { + return static_cast(( ( aLhs.iHeader == aRhs.iHeader ) + && !(os_memcmp( aLhs.iSsIdIe, aRhs.iSsIdIe, aLhs.iHeader.iLength )) )); + } + +/** +* 802.11 supported rates information element +*/ +#pragma pack( 1 ) +struct SSupportedRatesIE + { + /** information element header */ + SInformationElementHeader iHeader; // 2 + /** + * supported rates information element + * NOTE! The 802.11 standard specifies that the max length of the + * information part of this IE is eight rates (eight bytes). + * However at least some APs seem to put all their supported rates + * into this element. In order to be able to associate with those + * APs we allocate enough space to incorporate all 802.11b/g rates + * in this IE. We ourselves will still always advertise max eight + * rates using this IE (and the rest using the Extended Supported + * Rates IE). + */ + TUint8 iSupportedRatesIE[KMaxNumberOfDot11bAndgRates]; // 14 + + /** + * Ctor + */ + SSupportedRatesIE() + : iHeader( E802Dot11SupportedRatesIE, KMaxNumberOfRates ) {}; + + /** + * operator[] to get supported rates element at given index + * @param aIdx index to be get + * @return value in given index + */ + inline TUint8 operator[] ( TUint8 aIdx ) const; + + /** + * sets IE data also sets the IE headers length field + * @param aIeData actual IE data + * @param aLength length of aIeData + */ + inline void SetIeData( const TUint8* aIeData, const TUint8 aLength); + + /** + * Returns information element's actual length + * ( element's size + its header ) + * @return see above + */ + inline TUint8 GetIeLength() const; + + /** + * Returns only the information element's actual length ( header excluded ) + * @return see above + */ + inline TUint8 GetElementLength() const; + + /** Marks IE zero length size */ + inline void Clear(); + + /** + * Appends a single rate element to IE + * @param aRate rate element to be appended + */ + inline void Append( TUint8 aRate ); + +private: + + /** Prohibit assignment operator */ + SSupportedRatesIE& operator= ( const SSupportedRatesIE& ); + /** Prohibit copy constructor */ + SSupportedRatesIE( const SSupportedRatesIE& ); + } __PACKED; // 16 bytes + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SSupportedRatesIE::SetIeData( + const TUint8* aIeData, + const TUint8 aLength) + { + iHeader.iLength = aLength; + os_memcpy( iSupportedRatesIE, aIeData, aLength ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SSupportedRatesIE::operator[] ( TUint8 aIdx ) const + { + return iSupportedRatesIE[aIdx]; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SSupportedRatesIE::GetIeLength() const + { + return static_cast( + ( iHeader.iLength + sizeof( SInformationElementHeader ) ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SSupportedRatesIE::GetElementLength() const + { + return iHeader.iLength; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SSupportedRatesIE::Clear() + { + iHeader.iLength = 0; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SSupportedRatesIE::Append( TUint8 aRate ) + { + iSupportedRatesIE[iHeader.iLength] = aRate; + ++(iHeader.iLength); + } + +/** +* operator== for SSupportedRatesIE +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SSupportedRatesIE& aLhs, + const SSupportedRatesIE& aRhs ) + { + return static_cast(( ( aLhs.iHeader == aRhs.iHeader ) + && !(os_memcmp( aLhs.iSupportedRatesIE, + aRhs.iSupportedRatesIE, aLhs.iHeader.iLength )) )); + } + +/** +* 802.11 extended supported rates information element +*/ +#pragma pack( 1 ) +struct SExtendedSupportedRatesIE + { + enum { KPad = 1 }; + /** information element header */ + SInformationElementHeader iHeader; // 2 + /** supported rates information element */ + TUint8 iSupportedRatesIE[KMaxNumberOfExtendedRates]; // 255 + /** padding */ + TUint8 iPad[KPad]; // 1 + + /** + * Ctor + */ + SExtendedSupportedRatesIE() + : iHeader( E802Dot11ExtendedRatesIE, KMaxNumberOfExtendedRates ) {}; + + /** + * operator[] to get supported rates element at given index + * @param aIdx index to be get + * @return value in given index + */ + inline TUint8 operator[] ( TUint8 aIdx ) const; + + /** + * sets IE data also sets the IE headers length field + * @param aIeData actual IE data + * @param aLength length of aIeData + */ + inline void SetIeData( const TUint8* aIeData, const TUint8 aLength); + + /** + * Returns information element's actual length + * ( element's size + its header ) + * @return see above + */ + inline TUint8 GetIeLength() const; + + /** + * Returns only the information element's actual length ( header excluded ) + * @return see above + */ + inline TUint8 GetElementLength() const; + + /** Marks IE zero length size */ + inline void Clear(); + + /** + * Appends a single rate element to IE + * @param aRate rate element to be appended + */ + inline void Append( TUint8 aRate ); + +private: + + /** Prohibit assignment operator */ + SExtendedSupportedRatesIE& operator= ( const SExtendedSupportedRatesIE& ); + /** Prohibit copy constructor */ + SExtendedSupportedRatesIE( const SExtendedSupportedRatesIE& ); + } __PACKED; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SExtendedSupportedRatesIE::SetIeData( + const TUint8* aIeData, + const TUint8 aLength) + { + iHeader.iLength = aLength; + os_memcpy( iSupportedRatesIE, aIeData, aLength ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SExtendedSupportedRatesIE::operator[] ( TUint8 aIdx ) const + { + return iSupportedRatesIE[aIdx]; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SExtendedSupportedRatesIE::GetIeLength() const + { + return static_cast( + ( iHeader.iLength + sizeof( SInformationElementHeader ) ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SExtendedSupportedRatesIE::GetElementLength() const + { + return iHeader.iLength; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SExtendedSupportedRatesIE::Clear() + { + iHeader.iLength = 0; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SExtendedSupportedRatesIE::Append( TUint8 aRate ) + { + iSupportedRatesIE[iHeader.iLength] = aRate; + ++(iHeader.iLength); + } + +/** +* operator== for SExtendedSupportedRatesIE +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SExtendedSupportedRatesIE& aLhs, + const SExtendedSupportedRatesIE& aRhs ) + { + return static_cast(( ( aLhs.iHeader == aRhs.iHeader ) + && !(os_memcmp( aLhs.iSupportedRatesIE, + aRhs.iSupportedRatesIE, aLhs.iHeader.iLength )) )); + } + +#pragma pack( 1 ) +struct SDsParameterSetIE + { + SInformationElementHeader iHeader; // 2 + TUint8 iValue; // 1 + + inline SDsParameterSetIE( const TUint32 aValue ); + +private: + + /** Prohibit assignment operator */ + SDsParameterSetIE& operator= ( const SDsParameterSetIE& aObj ); + /** Prohibit copy constructor */ + SDsParameterSetIE( const SDsParameterSetIE& ); + } __PACKED; // 3 bytes + +inline SDsParameterSetIE::SDsParameterSetIE( + const TUint32 aValue ) + : iHeader( E802Dot11DsParameterSetIE, sizeof(iValue) ) + { + iValue = aValue; + } + +#pragma pack( 1 ) +struct SIbssParameterSetIE + { + SInformationElementHeader iHeader; // 2 + TUint16 iValue; // 2 + + inline SIbssParameterSetIE( const TUint16 aValue ); + + inline TUint16 AtimWindow() const; + +private: + + /** Prohibit assignment operator */ + SIbssParameterSetIE& operator= ( const SIbssParameterSetIE& aObj ); + /** Prohibit copy constructor */ + SIbssParameterSetIE( const SIbssParameterSetIE& ); + } __PACKED; // 4 bytes + +inline SIbssParameterSetIE::SIbssParameterSetIE( + const TUint16 aValue ) + : iHeader( E802Dot11IbssParameterSetIE, sizeof(iValue) ) + { + WriteHtoUint16( &iValue, aValue ); + } + +inline TUint16 SIbssParameterSetIE::AtimWindow() const + { + return ( ReadUint16Toh( &iValue ) ); + } + +/** +* 802.11 WiFi WPA outbound information element +*/ +#pragma pack( 1 ) +struct STxRsnIE + { + /** information element header */ + SInformationElementHeader iHeader; // 2 + /** RSN information element */ + TUint8 iTxRsnIe[KMaxTxRsnIELength]; // 38 + + /** Ctor */ + STxRsnIE() + : iHeader( E802Dot11VendorSpecificIE , KMaxTxRsnIELength ) {}; + + /** + * Returns information element's actual length + * ( element's size + its header ) + * @return see above + */ + inline TUint8 GetIeLength() const; + + /** + * Sets iTxRsnIe field and IE length field + * @param aData data to be set + * @param aLength length of the data + */ + inline void SetRsn( const TUint8* aData, TUint32 aLength ); + +private: + + /** Prohibit assignment operator */ + STxRsnIE& operator= ( const STxRsnIE& aObj ); + /** Prohibit copy constructor */ + STxRsnIE( const STxRsnIE& ); + } __PACKED; // 40 bytes + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 STxRsnIE::GetIeLength() const + { + return static_cast( + ( iHeader.iLength + sizeof( SInformationElementHeader ) ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void STxRsnIE::SetRsn( const TUint8* aData, TUint32 aLength ) + { + iHeader.iLength = static_cast(aLength); + os_memcpy( iTxRsnIe, aData, aLength ); + } + +/** +* Inbound WMM information element without IE header +*/ +#pragma pack( 1 ) +struct SRxWmmIeData + { + TIeOui iOui; // 3 + TUint8 iOuiType; // 1 + TUint8 iOuiSubType; // 1 + TUint8 iVersion; // 1 + /** information element */ + TUint8 iQosInfo; // 1 + + /** + * Evaluates if U-APSD bit is up + * @return ETrue if bit is up, otherwise EFalse + */ + inline TBool IsUapsdBitSet() const; + + /** + * Gets the the parameter set count + * @return parameter set count + */ + inline TUint8 ParameterSetCount() const; + +private: + + /** Prohibit assignment operator */ + SRxWmmIeData& operator= ( const SRxWmmIeData& aObj ); + /** Prohibit copy constructor */ + SRxWmmIeData( const SRxWmmIeData& ); + } __PACKED; // 7 bytes + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SRxWmmIeData::IsUapsdBitSet() const + { + return ( (iQosInfo & KUapsdQosInfoMask )? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SRxWmmIeData::ParameterSetCount() const + { + return ( iQosInfo & KParamSetCountQosInfoMask ); + } + + +/** +* Outbound WMM information element +*/ +#pragma pack( 1 ) +struct STxWmmIE + { + /** information element header */ + SInformationElementHeader iHeader; // 2 + TIeOui iOui; // 3 + TUint8 iOuiType; // 1 + TUint8 iOuiSubType; // 1 + TUint8 iVersion; // 1 + /** information element */ + TUint8 iQosInfo; // 1 + + + /** + * Ctor + */ + inline STxWmmIE() : iHeader( E802Dot11VendorSpecificIE, KWmmInfoElemLen ), + iOuiType( KWmmElemOuiType ), + iOuiSubType( KWmmInfoElemOuiSubType ), iVersion( KWmmInfoElemVersion ), + iQosInfo( 0 ) + { + os_memcpy( iOui, KWmmElemOui, KIeOuiLength ); + } + + /** + * Sets the U-APSD flags for different ACs + * @param aFlags flag(s) to be set + */ + inline void SetUapsdFlags( TQosInfoUapsdFlag aFlags ); + + /** + * Sets the maximum service period length + * @param aMaxSpLen length of the service period + */ + inline void SetMaxSpLen( TQosInfoUapsdMaxSpLen aMaxSpLen ); + + /** + * Returns information elements total length, i.e. + * element's length + header length + * @return see above + */ + inline TUint8 GetIeLength() const; + + /** Clears the IE content, i.e. the iQosInfo field */ + inline void Clear(); + +private: + + /** Prohibit assignment operator */ + STxWmmIE& operator= ( const STxWmmIE& aObj ); + /** Prohibit copy constructor */ + STxWmmIE( const STxWmmIE& ); + } __PACKED; // 9 bytes + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void STxWmmIE::SetUapsdFlags( TQosInfoUapsdFlag aFlags ) + { + iQosInfo |= aFlags; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void STxWmmIE::SetMaxSpLen( TQosInfoUapsdMaxSpLen aMaxSpLen ) + { + iQosInfo |= aMaxSpLen; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 STxWmmIE::GetIeLength() const + { + return static_cast( + ( iHeader.iLength + sizeof( SInformationElementHeader ) ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void STxWmmIE::Clear() + { + iQosInfo = 0; + } + +/** +* AC parameters record of WMM parameter element +*/ +#pragma pack( 1 ) +struct SAcParamsRecord + { + + TUint8 iAciAifsn; // 1 + TUint8 iEcwMinMax; // 1 + TUint16 iTxOpLimit; // 2 + + inline TWmmAccessCategory AccessCategory() const; + + inline TBool AdmissionControlMandatory() const; + + inline TUint8 Aifsn() const; + + inline TUint16 CwMin() const; + + inline TUint16 CwMax() const; + + inline TUint16 TxOpLimit() const; + +private: + + /** Prohibit assignment operator */ + SAcParamsRecord& operator= ( const SAcParamsRecord& aObj ); + /** Prohibit copy constructor */ + SAcParamsRecord( const SAcParamsRecord& ); + } __PACKED; // 4 bytes + +inline TWmmAccessCategory SAcParamsRecord::AccessCategory() const + { + return ( static_cast(iAciAifsn & K802Dot11AccessCategoryMask) ); + } + +inline TBool SAcParamsRecord::AdmissionControlMandatory() const + { + return ( iAciAifsn & KWmmAdmissionCtrlMandatoryMask ); + } + +inline TUint8 SAcParamsRecord::Aifsn() const + { + return ( iAciAifsn & KWmmAifsnMask ); + } + +inline TUint16 SAcParamsRecord::CwMin() const + { + return ( ( static_cast( 1 ) << + ( iEcwMinMax & KWmmEcwMinMask ) ) - 1 ); + } + +inline TUint16 SAcParamsRecord::CwMax() const + { + return ( ( static_cast( 1 ) << + ( ( iEcwMinMax & KWmmEcwMaxMask ) >> 4 ) ) - 1 ); + } + +inline TUint16 SAcParamsRecord::TxOpLimit() const + { + return ( ReadUint16Toh( &iTxOpLimit ) ); + } + +/** +* WMM Parameter Element without element header +*/ +#pragma pack( 1 ) +struct SWmmParamElemData + { + /** information element header */ + TIeOui iOui; // 3 + TUint8 iOuiType; // 1 + TUint8 iOuiSubType; // 1 + TUint8 iVersion; // 1 + /** information element fields: */ + TUint8 iQosInfo; // 1 + TUint8 iReserved; // 1 + SAcParamsRecord iAcParams[KNumOfWmmACs]; // 16 + + /** + * Evaluates if U-APSD bit is up + * @return ETrue if bit is up, otherwise EFalse + */ + inline TBool IsUapsdBitSet() const; + + /** + * Gets the the parameter set count + * @return parameter set count + */ + inline TUint8 ParameterSetCount() const; + +private: + + /** Prohibit assignment operator */ + SWmmParamElemData& operator= ( const SWmmParamElemData& aObj ); + /** Prohibit copy constructor */ + SWmmParamElemData( const SWmmParamElemData& ); + } __PACKED; // 24 + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SWmmParamElemData::IsUapsdBitSet() const + { + return ( (iQosInfo & KUapsdQosInfoMask )? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SWmmParamElemData::ParameterSetCount() const + { + return ( iQosInfo & KParamSetCountQosInfoMask ); + } + +// capability information fixed-field +// +// bit 14 - 15 13 11 - 12 10 8-9 7 6 +// ----------+-------+-----------+-------+---------+----------+------- +// reserved | DSSS- | reserved | short | reserved| Channel | PBCC +// | OFDM | | slot | | Agility | +// ----------+-------+-----------+-------+---------+----------+-------- +// bit 5 4 3 2 1 0 +// ----------+----------+----------+----------+----------+----------+ +// Short | Privacy | CF-Poll | CF | IBSS | ESS | +// Preamble| (WEP) | Request | Pollable | | | +// ----------+----------+----------+----------+----------+----------+ + +/** +* 802.11 management frame body capability information fixed-field +*/ +#pragma pack( 1 ) +struct SCapabilityInformationField + { + enum { KReservedFieldsMask = 0xEB00 }; + + /** capability information fixed field */ + TUint16 iCapabilityInformationField; + + /** + * Ctor + */ + SCapabilityInformationField() + : iCapabilityInformationField( 0 ) {}; + + /** + * Ctor + * @param aParam value used in iCapabilityInformationField field + */ + explicit inline SCapabilityInformationField( const TUint16 aParam ); + + /** + * Assignment operator for TUint16 type + * @param aParam value used as iCapabilityInformationField + */ + inline SCapabilityInformationField& operator= ( const TUint16 aParam ); + + /** + * Returns the value of the Capability Information Field + * @return + */ + inline TUint16 CapabilityInformationField() const; + /** + * Evaluates if ESS bit is up + * @return ETrue if bit is up, otherwise EFalse + */ + inline TBool IsEssBitSet() const; + /** + * Evaluates if IBSS bit is up + * @return ETrue if bit is up, otherwise EFalse + */ + inline TBool IsIbssBitSet() const; + /** + * Evaluates if Privaecy bit bit is up + * @return ETrue if bit is up, otherwise EFalse + */ + inline TBool IsPrivacyBitSet() const; + /** + * Evaluates if Short Preamble bit is up + * @return ETrue if bit is up, otherwise EFalse + */ + inline TBool IsShortPreambleBitSet() const; + /** + * Evaluates if PBCC bit is up + * @return ETrue if bit is up, otherwise EFalse + */ + inline TBool IsPbccBitSet() const; + /** + * Evaluates if Channel Agility bit is up + * @return ETrue if bit is up, otherwise EFalse + */ + inline TBool IsChannelAgilityBitSet() const; + /** + * Evaluates if short slot time bit is up + * @return ETrue if bit is up, otherwise EFalse + */ + inline TBool IsShortSlotTimeBitSet() const; + /** + * Clears both CF bits + */ + inline void ClearCfFields(); + /** + * Clear CF pollable field + */ + inline void ClearCfPollable(); + /** + * Clears both CF poll request field + */ + inline void ClearCfPollRequest(); + /** + * Sets the short preamble bit + */ + inline void SetShortPreamble(); + /** + * Clears the short preamble bit + */ + inline void ClearShortPreamble(); + /** + * sets the pbcc bit + */ + inline void SetPbcc(); + /** + * sets the IBSS bit + */ + inline void SetIbss(); + /** + * Clear PBCC bit + */ + inline void ClearPbcc(); + /** Clear reserved fields */ + inline void ClearReservedFields(); + /** Set WEP bit */ + inline void SetWepBit(); + /** Clear WEP bit */ + inline void ClearWepBit(); + +private: + + /** Prohibit copy constructor */ + SCapabilityInformationField( const SCapabilityInformationField& ); + } __PACKED; // 2 bytes + + +inline SCapabilityInformationField::SCapabilityInformationField( const TUint16 aParam ) + { + WriteHtoUint16( &iCapabilityInformationField, aParam ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SCapabilityInformationField& SCapabilityInformationField::operator= ( + const TUint16 aParam ) + { + WriteHtoUint16( &iCapabilityInformationField, aParam ); + return (*this); + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +inline TUint16 SCapabilityInformationField::CapabilityInformationField() const + { + return ( ReadUint16Toh( &iCapabilityInformationField ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SCapabilityInformationField::IsEssBitSet() const + { + return ( ( ReadUint16Toh( &iCapabilityInformationField ) & + E802Dot11CapabilityEssMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SCapabilityInformationField::IsIbssBitSet() const + { + return ( ( ReadUint16Toh( &iCapabilityInformationField ) & + E802Dot11CapabilityIbssMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SCapabilityInformationField::IsPrivacyBitSet() const + { + return ( ( ReadUint16Toh( &iCapabilityInformationField ) & + E802Dot11CapabilityPrivacyMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SCapabilityInformationField::IsShortPreambleBitSet() const + { + return ( ( ReadUint16Toh( &iCapabilityInformationField ) & + E802Dot11ShortPreambleMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SCapabilityInformationField::IsPbccBitSet() const + { + return ( ( ReadUint16Toh( &iCapabilityInformationField ) & + E802Dot11PbccMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SCapabilityInformationField::IsChannelAgilityBitSet() const + { + return ( ( ReadUint16Toh( &iCapabilityInformationField ) & + E802Dot11ChannelAgilityMask ) + ? ETrue : EFalse ); + } + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SCapabilityInformationField::IsShortSlotTimeBitSet() const + { + return ( ( ReadUint16Toh( &iCapabilityInformationField ) & + E802Dot11ShortSlotTimeMask ) + ? ETrue : EFalse ); + } + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::ClearCfFields() + { + ClearCfPollable(); + ClearCfPollRequest(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::ClearCfPollable() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) & + ( ~E802Dot11CapabilityCfPollableMask ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::ClearCfPollRequest() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) & + ( ~E802Dot11CapabilityCfPollRequestMask ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::SetShortPreamble() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) | + E802Dot11ShortPreambleMask ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::SetPbcc() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) | + E802Dot11PbccMask ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::SetIbss() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) | + E802Dot11CapabilityIbssMask ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::ClearShortPreamble() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) & + ( ~E802Dot11ShortPreambleMask ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::ClearPbcc() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) & + ( ~E802Dot11PbccMask ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::ClearReservedFields() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) & + ( ~KReservedFieldsMask ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::SetWepBit() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) | + E802Dot11CapabilityPrivacyMask ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::ClearWepBit() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) & + ( ~E802Dot11CapabilityPrivacyMask ) ); + } + +/** +* operator== for SCapabilityInformationField +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SCapabilityInformationField& aLhs, + const SCapabilityInformationField& aRhs) + { + return static_cast( aLhs.CapabilityInformationField() + == aRhs.CapabilityInformationField() ); + } + +/** +* 802.11 management frame body listen interval fixed-field +*/ +#pragma pack( 1 ) +struct SListenIntervalField + { + /** listen interval fixed field */ + TUint16 iListenInterval; + + /** + * Ctor + */ + SListenIntervalField() : iListenInterval( 0 ) {}; + + /** + * Ctor + * @param aParam value used in iListenInterval + */ + explicit inline SListenIntervalField( const TUint16 aParam ); + + /** + * Returns the value of the Listen Interval + * @return Listen Interval + */ + inline TUint16 ListenInterval() const; + + /** + * assignment operator for TUint16 type + * @param aInterval listen interval fixed field + */ + inline SListenIntervalField& operator= ( const TUint16 aInterval ); + +private: + + /** Prohibit assignment operator */ + SListenIntervalField& operator= ( const SListenIntervalField& ); + /** Prohibit copy constructor */ + SListenIntervalField( const SListenIntervalField& ); + } __PACKED; // 2 bytes + +inline SListenIntervalField::SListenIntervalField( const TUint16 aParam ) + { + WriteHtoUint16( &iListenInterval, aParam ); + } + +inline TUint16 SListenIntervalField::ListenInterval() const + { + return ( ReadUint16Toh( &iListenInterval ) ); + } + +inline SListenIntervalField& SListenIntervalField::operator= ( + const TUint16 aInterval ) + { + WriteHtoUint16( &iListenInterval, aInterval ); + return (*this); + } + +/** +* operator== for SListenIntervalField +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SListenIntervalField& aLhs, + const SListenIntervalField& aRhs) + { + return static_cast( aLhs.ListenInterval() == aRhs.ListenInterval() ); + } + + +/* + 802.11 DATA Frame + +----------------+ + | | + | Frame Control | + | 2 bytes | + +----------------+ + | | + | Duration ID | + | 2 bytes | + +----------------+ + | | + | Address 1 | + | 6 bytes | + +----------------+ + | | + | Address 2 | + | 6 bytes | + +----------------+ + | | + | Address 3 | + | 6 bytes | + +----------------+ + | | + | Sequence Cntrl | + | 2 bytes | + +----------------+ + | | + | Address 4 | + | 6 bytes | + +----------------+ + | DSAP - 1 byte | = 0xAA ( SNAP ) + +----------------+ + | SSAP - 1 byte | = 0xAA ( SNAP ) + +----------------+ + |Control - 1 byte| = 0x03 + +----------------+ + | OUI - 3 bytes | = 0x0 + | | + +----------------+ + | Type - 2 bytes | = Ethernet type (IP=0x0800) + +----------------+ + | | + | Data | + | | + ~ ~ + ~ ~ + | 46 to 1500 | + | bytes | + | | + +----------------+ + | FCS | + | 4 bytes | + +----------------+ + +*/ + +// FrameControl field of the 802.11 header +// +// |--------------------- control -----------------------| +// +// bit 15 14 13 12 11 10 9 8 +// +-------+-----+------+-----+-------+------+------+----+ +// | Order | WEP | More | Pwr | Retry | More | From | To | +// | | | Data | Mgmt| | Frag | DS | DS | +// +-------+-----+------+-----+-------+------+------+----+ +// 1 1 1 1 1 1 1 1 +//--------- type ------------| +// +// 7-4 3-2 1-0 +//---------+------+----------+ +// Subtype | Type | Protocol | +// | | Version | +//---------+------+----------+ +// 4 2 2 + +/** +* 802.11 Frame Control field +*/ +#pragma pack( 1 ) +struct SFrameControl + { + /** type field */ + TUint8 iType; + /** control filed */ + TUint8 iControl; + + /** + * Ctor + * @param aType type field + * @param aControl control field + */ + SFrameControl( + T802Dot11FrameControlTypeMask aType, + T802Dot11FrameControlBitMask aControl ) + : iType( static_cast(aType) ), + iControl( static_cast(aControl) ) {}; + + /** + * Returns type and control fields combined as a single TUint16 value + * @return see above + */ + inline TUint16 operator()() const; + +private: + + /** Prohibit assignment operator */ + SFrameControl& operator= ( const SFrameControl& aObj ); + /** Prohibit copy constructor */ + SFrameControl( const SFrameControl& ); + } __PACKED; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 SFrameControl::operator()() const + { + TUint16 value( iType ); + return ( static_cast(( value << 8 ) + iControl )); + } + +/** +* operator== for SFrameControl +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SFrameControl& aLhs, + const SFrameControl& aRhs) + { + return static_cast( aLhs.iType == aRhs.iType + && aLhs.iControl == aRhs.iControl ); + } + + +// SequenceControl field of the 802.11 header +// +// bit 15 - 4 3 - 0 +// +-------------------+-----------+ +// | Sequence Number | Fragment | +// | | Number | +// +-------------------+-----------+ +// 12 4 + +#pragma pack( 1 ) +struct SPsPoll + { + const SFrameControl iFrameControl; // 2 bytes + TUint16 iAid; // 2 bytes + const TMacAddress iBssId; // 6 bytes + const TMacAddress iTa; // 6 bytes + + inline SPsPoll( + TUint16 aAid, + const TMacAddress& aBssId, + const TMacAddress& aTa ); + } __PACKED; // 16 bytes + + +inline SPsPoll::SPsPoll( + TUint16 aAid, + const TMacAddress& aBssId, + const TMacAddress& aTa ) + : iFrameControl( E802Dot11FrameTypePowerSavePoll, + static_cast(0) ), + iAid( 0 ), + iBssId( aBssId ), iTa( aTa ) + { + // AID always has the 2 most significant bits set to 1 + WriteHtoUint16( &iAid, ( aAid | 0xC000 ) ); + } + +/** +* 802.11 data frame MAC header +*/ +#pragma pack( 1 ) +struct SDataFrameHeader + { + /** frame control field */ + SFrameControl iFrameControl; // 2 bytes + /** duration field */ + const TUint16 iDuration; // 2 bytes + /** address1 field */ + TMacAddress iAddress1; // 6 bytes + /** address2 field */ + TMacAddress iAddress2; // 6 bytes + /** address3 field */ + TMacAddress iAddress3; // 6 bytes + /** sequence control field */ + const TUint16 iSeqCtl; // 2 bytes + // this littly piggy is only used in AP-AP mode + // which we don't do so it is omitted + // const TMacAddress iAddress4; // 6 bytes + + /** + * Ctor + */ + SDataFrameHeader() + : iFrameControl( E802Dot11FrameTypeData, + static_cast(0) ) + ,iDuration( 0 ), iSeqCtl( 0 ) {}; + + /** + * Sets WEP bit from Frame Control field + */ + inline void SetWepBit(); + /** + * Clears WEP bit from Frame Control field + */ + inline void ClearWepBit(); + /** + * Sets ToDS bit from Frame Control field + */ + inline void SetToDsBit(); + /** + * Clears ToDS bit from Frame Control field + */ + inline void ClearToDsBit(); + /** + * Clears FromDS bit from Frame Control field + */ + inline void ClearFromDsBit(); + /** + * Evaluates is FromDS bit set from Frame Control field + */ + inline TBool IsFromDsBitSet() const; + inline TBool IsToDsBitSet() const; + /** + * Evaluates is WEP bit set from Frame Control field + */ + inline TBool IsWepBitSet() const; + /** + * Gets Frame Control field + * @return reference to the frame control field + */ + inline const SFrameControl& GetFrameControl() const; + + /** + * Returns Sequence Number from iSeqCtl field + * @return Sequence Number + */ + inline TUint16 SequenceNumber() const; + +private: + + /** Prohibit assignment operator */ + SDataFrameHeader& operator= ( const SDataFrameHeader& aObj ); + /** Prohibit copy constructor */ + SDataFrameHeader( const SDataFrameHeader& ); + } __PACKED; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SDataFrameHeader::SetWepBit() + { + iFrameControl.iControl |= ( E802Dot11FrameControlWepMask >> 8 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SDataFrameHeader::ClearWepBit() + { + iFrameControl.iControl &= ~( E802Dot11FrameControlWepMask >> 8 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SDataFrameHeader::SetToDsBit() + { + iFrameControl.iControl |= ( E802Dot11FrameControlToDsMask >> 8 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SDataFrameHeader::ClearToDsBit() + { + iFrameControl.iControl &= ~( E802Dot11FrameControlToDsMask >> 8 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SDataFrameHeader::ClearFromDsBit() + { + iFrameControl.iControl &= ~( E802Dot11FrameControlFromDsMask >> 8 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SDataFrameHeader::IsFromDsBitSet() const + { + return static_cast( iFrameControl.iControl & ( + E802Dot11FrameControlFromDsMask >> 8 )); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SDataFrameHeader::IsToDsBitSet() const + { + return static_cast( iFrameControl.iControl & ( + E802Dot11FrameControlToDsMask >> 8 )); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SDataFrameHeader::IsWepBitSet() const + { + return static_cast( iFrameControl.iControl & ( + E802Dot11FrameControlWepMask >> 8 )); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline const SFrameControl& SDataFrameHeader::GetFrameControl() const + { + return iFrameControl; + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +inline TUint16 SDataFrameHeader::SequenceNumber() const + { + return ( ReadUint16Toh( &iSeqCtl ) >> 4 ); + } + + +typedef SDataFrameHeader SNullDataFrame; +typedef SDataFrameHeader Sdot11MacHeader; + +typedef TUint16 T802Dot11QosControl; + +/** +* According to the WiFi-WMM Test Specification v1.2 bits 3-5 of +* the DSCP bits 0-5 of the DS field determine the user priority +* This is a mask for those bits for IPv4 header +*/ +const T802Dot11QosControl KWmmUserPriorityMask = 0x0007; + +/** +* 802.11 QoS data frame MAC header +*/ +#pragma pack( 1 ) +struct SQosDataFrameHeader + { + /** frame control field */ + SDataFrameHeader iHdr; // 24 bytes + /** QoS control field */ + T802Dot11QosControl iQosControl; // 2 bytes + + /** + * Resets the QoS Control field to zero + */ + inline void ResetQosControl(); + + /** + * Sets the WMM user priority (3 lowest bits) of the QoS Control field + */ + inline void SetUserPriority( TUint8 aPriority ); + + /** + * Returns the WMM user priority (3 lowest bits) of the QoS Control field + */ + inline TUint8 UserPriority() const; + } __PACKED; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SQosDataFrameHeader::ResetQosControl() + { + iQosControl = 0; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SQosDataFrameHeader::SetUserPriority( TUint8 aPriority ) + { + // clear old priority + WriteHtoUint16( &iQosControl, + ReadUint16Toh( &iQosControl ) & + ( ~KWmmUserPriorityMask ) ); + // set new priority + WriteHtoUint16( &iQosControl, + ReadUint16Toh( &iQosControl ) | + aPriority ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SQosDataFrameHeader::UserPriority() const + { + return ( ReadUint16Toh( &iQosControl ) & KWmmUserPriorityMask ); + } + +typedef SQosDataFrameHeader SQosNullDataFrame; + +/** +* 802.11 management frame MAC header +*/ +#pragma pack( 1 ) +struct SManagementFrameHeader + { + /** frame control field */ + SFrameControl iFrameControl; // 2 bytes + /** duration field */ + const TUint16 iDuration; // 2 bytes + /** DA address field */ + TMacAddress iDA; // 6 bytes frames destination = AP + /** SA address field */ + TMacAddress iSA; // 6 bytes source address + /** BSSID address field */ + TMacAddress iBSSID; // 6 bytes BSS identifier = iDA + /** sequence control field */ + const TUint16 iSeqCtl; // 2 bytes + + /** + * Ctor + * @param aTypeMask frame control type mask + * @param aControlMask frame control control mask + */ + SManagementFrameHeader( + T802Dot11FrameControlTypeMask aTypeMask, + T802Dot11FrameControlBitMask aControlMask + = static_cast( 0 ) ) + : iFrameControl( aTypeMask, aControlMask ), + iDuration( 0 ), iSeqCtl( 0 ) {}; + + /** + * Set WEP bit from Frame Control Field + */ + void SetWepBit(); + /** + * Clear WEP bit from Frame Control Field + */ + void ClearWepBit(); + +private: + + /** Prohibit assignment operator */ + SManagementFrameHeader& operator= ( SManagementFrameHeader& aObj ); + /** Prohibit copy constructor */ + SManagementFrameHeader( const SManagementFrameHeader& ); + } __PACKED; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SManagementFrameHeader::SetWepBit() + { + iFrameControl.iControl |= ( E802Dot11FrameControlWepMask >> 8 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SManagementFrameHeader::ClearWepBit() + { + iFrameControl.iControl &= ~( E802Dot11FrameControlWepMask >> 8 ); + } + +/** +* 802.11 fixed length components required in +* authentication request management frame +*/ +#pragma pack( 1 ) +struct SAuthenticationFixedFields + { + /** algorithm number */ + TUint16 iAlgorithmNumber; // 2 bytes + /** sequence number */ + TUint16 iSequenceNmbr; // 2 bytes + /** status code */ + TUint16 iStatusCode; // 2 bytes + + /** + * Ctor + * @param aAlgorithm authentication mode used + * @param aSeqNmbr sequence number used + * @param aStatusCode status code used + */ + inline SAuthenticationFixedFields( + const TUint16 aAlgorithm = K802Dot11AuthModeOpen, + const TUint16 aSeqNmbr = E802Dot11AuthenticationSeqNmbr1, + const T802Dot11ManagementStatusCode aStatusCode + = E802Dot11StatusSuccess ); + + /** + * Returns the authentication transaction algorithm number + * @return sequence number + */ + inline TUint16 AlgorithmNumber() const; + + /** + * Sets the authentication transaction algorithm number + * @param aSequenceNumber value to be set + */ + inline void SetAlgorithmNumber( + TUint16 aAlgorithmNumber ); + + /** + * Returns the authentication transaction sequence number + * @return sequence number + */ + inline TUint16 SequenceNumber() const; + + /** + * Sets the authentication transaction sequence number + * @param aSequenceNumber value to be set + */ + inline void SetSequenceNumber( TUint16 aSequenceNumber ); + + /** + * Returns the authentication transaction status code + * @return status code + */ + inline TUint16 StatusCode() const; + + } __PACKED; + +inline SAuthenticationFixedFields::SAuthenticationFixedFields( + const TUint16 aAlgorithm, + const TUint16 aSeqNmbr, + const T802Dot11ManagementStatusCode aStatusCode ) + { + WriteHtoUint16( &iAlgorithmNumber, static_cast( aAlgorithm ) ); + WriteHtoUint16( &iSequenceNmbr, static_cast( aSeqNmbr ) ); + WriteHtoUint16( &iStatusCode, static_cast( aStatusCode ) ); + } + +inline TUint16 SAuthenticationFixedFields::AlgorithmNumber() const + { + return ( ReadUint16Toh( &iAlgorithmNumber ) ); + } + +inline void SAuthenticationFixedFields::SetAlgorithmNumber( TUint16 aAlgorithmNumber ) + { + WriteHtoUint16( &iAlgorithmNumber, aAlgorithmNumber ); + } + +inline TUint16 SAuthenticationFixedFields::SequenceNumber() const + { + return ( ReadUint16Toh( &iSequenceNmbr ) ); + } + +inline void SAuthenticationFixedFields::SetSequenceNumber( + TUint16 aSequenceNumber ) + { + WriteHtoUint16( &iSequenceNmbr, aSequenceNumber ); + } + +inline TUint16 SAuthenticationFixedFields::StatusCode() const + { + return ( ReadUint16Toh( &iStatusCode ) ); + } + + +/** +* 802.11 authentication management frame +*/ +#pragma pack( 1 ) +struct SAuthenticationFrame + { + /** management frame header */ + SManagementFrameHeader iHeader; // 24 bytes + /** authentication frame fixed fields */ + SAuthenticationFixedFields iAuthenticationFields; // 6 bytes + + /** Ctor */ + SAuthenticationFrame() + : iHeader( E802Dot11FrameTypeAuthentication ) {}; + + /** Increments sequnece number to next number we shall send */ + inline void IncrementSeqNmbr(); + + /** Resets sequnece number to initial value */ + inline void ResetSeqNmbr(); + + /** + * Gets the frames sequence number + * @return frames sequence number + */ + inline TUint16 GetSeqNmbr() const; + + /** + * Gets the frames status code field + * @return frames status code field + */ + inline TUint16 GetStatusCode() const; + + /** + * Gets the algorithm number + * @return algorithm number + */ + inline TUint16 GetAlgorithmNumber() const; + + /** Sets the WEP bit from frame control field */ + inline void SetWepBit(); + + /** Clears the WEP bit from frame control field */ + inline void ClearWepBit(); + + /** + * Sets the the algorithm number field + * @param aAlgorithm algorithm to be used + */ + inline void SetAlgorithmNmbr( TUint16 aAlgorithm ); + +private: + + /** Prohibit assignment operator */ + SAuthenticationFrame& operator= ( const SAuthenticationFrame& ); + /** Prohibit copy constructor */ + SAuthenticationFrame( const SAuthenticationFrame& ); + } __PACKED; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAuthenticationFrame::IncrementSeqNmbr() + { + iAuthenticationFields.SetSequenceNumber( + iAuthenticationFields.SequenceNumber() + 2 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAuthenticationFrame::ResetSeqNmbr() + { + iAuthenticationFields.SetSequenceNumber( E802Dot11AuthenticationSeqNmbr1 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 SAuthenticationFrame::GetSeqNmbr() const + { + return ( iAuthenticationFields.SequenceNumber() ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 SAuthenticationFrame::GetStatusCode() const + { + return ( iAuthenticationFields.StatusCode() ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAuthenticationFrame::SetAlgorithmNmbr( + TUint16 aAlgorithm ) + { + iAuthenticationFields.SetAlgorithmNumber( aAlgorithm ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 SAuthenticationFrame::GetAlgorithmNumber() const + { + return ( iAuthenticationFields.AlgorithmNumber() ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAuthenticationFrame::SetWepBit() + { + iHeader.SetWepBit(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAuthenticationFrame::ClearWepBit() + { + iHeader.ClearWepBit(); + } + +/** +* 802.11 fixed length components required +* in association request management frame +*/ +#pragma pack( 1 ) +struct SAssociationRequestFixedFields + { + /** capability info fixed field */ + SCapabilityInformationField iCapabilityInfo; // 2 bytes + /** listeninterval fixed field */ + SListenIntervalField iListenInterval; // 2 bytes + + /** Ctor */ + SAssociationRequestFixedFields() {}; + +private: + + /** Prohibit assignment operator */ + SAssociationRequestFixedFields& operator= ( + const SAssociationRequestFixedFields& ); + /** Prohibit copy constructor */ + SAssociationRequestFixedFields( + const SAssociationRequestFixedFields& ); + } __PACKED; + +/** +* operator== for SAssociationRequestFixedFields +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SAssociationRequestFixedFields& aLhs, + const SAssociationRequestFixedFields& aRhs) + { + return static_cast( aLhs.iCapabilityInfo == aRhs.iCapabilityInfo + && aLhs.iListenInterval == aRhs.iListenInterval ); + } + + +/** +* 802.11 association request management frame +* excluding variable length information elements +* - SSID +* - supported rates +*/ +#pragma pack( 1 ) +struct SAssociationRequestFrame + { + /** management frame header */ + SManagementFrameHeader iHeader; // 24 bytes + /** association request fixed fields */ + SAssociationRequestFixedFields iFixedFields; // 4 bytes + + /** Ctor */ + SAssociationRequestFrame() + : iHeader( E802Dot11FrameTypeAssociationReq ), + iFixedFields() {}; + + /** + * Helper function to set short preamble bit in capability info + */ + inline void SetCapabilityShortPreamble(); + + /** + * Helper function to clear short preamble bit in capability info + */ + inline void ClearCapabilityShortPreamble(); + + /** + * Helper function to set PBCC bit in capability info + */ + inline void SetCapabilityPbcc(); + + /** + * Helper function to clear PBCC bit in capability info + */ + inline void ClearCapabilityPbcc(); + + /** + * Helper function to clear CF fields from capability info + */ + inline void ClearCFfields(); + + /** Helper function to clear reserved fields */ + inline void ClearReservedFields(); + + /** Helper function to set WEP bit from the capability info fixed field */ + inline void SetWepBit(); + + /** + * Helper function to clear WEP bit from + * the capability info fixed field + */ + inline void ClearWepBit(); + +private: + + /** Prohibit assignment operator */ + SAssociationRequestFrame& operator= ( + const SAssociationRequestFrame& ); + /** Prohibit copy constructor */ + SAssociationRequestFrame( + const SAssociationRequestFrame& ); + } __PACKED; // 28 bytes + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAssociationRequestFrame::SetCapabilityShortPreamble() + { + iFixedFields.iCapabilityInfo.SetShortPreamble(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAssociationRequestFrame::ClearCapabilityShortPreamble() + { + iFixedFields.iCapabilityInfo.ClearShortPreamble(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAssociationRequestFrame::SetCapabilityPbcc() + { + iFixedFields.iCapabilityInfo.SetPbcc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAssociationRequestFrame::ClearCapabilityPbcc() + { + iFixedFields.iCapabilityInfo.ClearPbcc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAssociationRequestFrame::ClearCFfields() + { + iFixedFields.iCapabilityInfo.ClearCfFields(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAssociationRequestFrame::ClearReservedFields() + { + iFixedFields.iCapabilityInfo.ClearReservedFields(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAssociationRequestFrame::SetWepBit() + { + iFixedFields.iCapabilityInfo.SetWepBit(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAssociationRequestFrame::ClearWepBit() + { + iFixedFields.iCapabilityInfo.ClearWepBit(); + } + +/** +* 802.11 association response frame fixed fields +*/ +#pragma pack( 1 ) +struct SAssociationResponseFixedFields + { + /** capability info fixed field */ + SCapabilityInformationField iCapabilityInfo; // 2 bytes + /** status code fixed field */ + TUint16 iStatusCode; // 2 bytes + /** AID fixed field */ + TUint16 iAID; // 2 bytes + + /** + * Returns the association response status code + * @return status code + */ + inline TUint16 StatusCode() const; + + /** + * Returns the Association ID (AID) + * @return AID + */ + inline TUint16 Aid() const; + +private: + + /** Prohibit assignment operator */ + SAssociationResponseFixedFields& operator= ( + const SAssociationResponseFixedFields& ); + /** Prohibit copy constructor */ + SAssociationResponseFixedFields( const SAssociationResponseFixedFields& ); + } __PACKED; + +inline TUint16 SAssociationResponseFixedFields::StatusCode() const + { + return ( ReadUint16Toh( &iStatusCode ) ); + } + +inline TUint16 SAssociationResponseFixedFields::Aid() const + { + return ( ReadUint16Toh( &iAID ) ); + } + + +/** +* 802.11 fixed length components required in deauthenticate frame +*/ +#pragma pack( 1 ) +struct SDeauthenticateFixedFields + { + /** reason code fixed field */ + TUint16 iReasonCode; + + /** Ctor */ + SDeauthenticateFixedFields() + : iReasonCode( E802Dot11ReasonDeauthStationLeft ) {}; + + /* + * Returns the reason code + * @return Reason code + */ + inline TUint16 ReasonCode() const; + + /** Setter for the reason code */ + inline void SetReasonCode( TUint16 aReasonCode ); + +private: + + /** Prohibit assignment operator */ + SDeauthenticateFixedFields& operator= ( + T802Dot11ManagementReasonCode aReason ); + /** Prohibit copy constructor */ + SDeauthenticateFixedFields( const SDeauthenticateFixedFields& ); + } __PACKED; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 SDeauthenticateFixedFields::ReasonCode() const + { + return ( ReadUint16Toh( &iReasonCode ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SDeauthenticateFixedFields::SetReasonCode( TUint16 aReasonCode ) + { + WriteHtoUint16( &iReasonCode, aReasonCode ); + } + +/** +* operator== for SDeauthenticateFixedFields +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SDeauthenticateFixedFields& aLhs, + const SDeauthenticateFixedFields& aRhs) + { + return static_cast( + aLhs.ReasonCode() == aRhs.ReasonCode() ); + } + +/** +* 802.11 deauthenticate management frame +*/ +#pragma pack( 1 ) +struct SDeauthenticateFrame + { + /** management frame header */ + SManagementFrameHeader iHeader; // 24 bytes + /** reason code fixed field */ + SDeauthenticateFixedFields iReasonCode; // 2 bytes + + /** Ctor */ + SDeauthenticateFrame() + : iHeader( E802Dot11FrameTypeDeauthentication ), + iReasonCode() {}; + +private: + + /** Prohibit assignment operator */ + SDeauthenticateFrame& operator= ( const SDeauthenticateFrame& ); + /** Prohibit copy constructor */ + SDeauthenticateFrame( const SDeauthenticateFrame& ); + } __PACKED; + +/** +* operator== for SDeauthenticateFrame +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SDeauthenticateFrame& aLhs, + const SDeauthenticateFrame& aRhs) + { + return ( aLhs == aRhs ); + } + +/** +* 802.11 fixed length components required in disassociate frame +*/ +#pragma pack( 1 ) +struct SDisAssociateFixedFields + { + /** reason code fixed field */ + TUint16 iReasonCode; + + /** Ctor */ + inline SDisAssociateFixedFields(); + + /* + * Returns the reason code + * @return Reason code + */ + inline TUint16 ReasonCode() const; + + /** Setter for the reason code */ + inline void SetReasonCode( TUint16 aReasonCode ); + +private: + // Prohibit assignment operator + SDisAssociateFixedFields& operator= ( const SDisAssociateFixedFields& ); + // Prohibit copy constructor + SDisAssociateFixedFields( const SDisAssociateFixedFields& ); + } __PACKED; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SDisAssociateFixedFields::SDisAssociateFixedFields() + { + WriteHtoUint16( &iReasonCode, E802Dot11ReasonClass3FrameWhenNotAssoc ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 SDisAssociateFixedFields::ReasonCode() const + { + return ( ReadUint16Toh( &iReasonCode ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SDisAssociateFixedFields::SetReasonCode( TUint16 aReasonCode ) + { + WriteHtoUint16( &iReasonCode, aReasonCode ); + } + +/** +* operator== for SDisAssociateFixedFields +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SDisAssociateFixedFields& aLhs, + const SDisAssociateFixedFields& aRhs) + { + return static_cast( + aLhs.ReasonCode() == aRhs.ReasonCode() ); + } + +/** +* 802.11 disassociate management frame +*/ +#pragma pack( 1 ) +struct SDisassociateFrame + { + /** management frame header */ + SManagementFrameHeader iHeader; // 24 bytes + /** reason code fixed field */ + SDisAssociateFixedFields iReasonCode; // 2 bytes + + /** Ctor */ + SDisassociateFrame() + : iHeader( E802Dot11FrameTypeDisassociation ), + iReasonCode() {}; + +private: + + /** Prohibit assignment operator */ + SDisassociateFrame& operator= ( const SDisassociateFrame& ); + /** Prohibit copy constructor */ + SDisassociateFrame( const SDisassociateFrame& ); + } __PACKED; // 26 bytes + +/** +* operator== for SDisassociateFrame +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SDisassociateFrame& aLhs, + const SDisassociateFrame& aRhs) + { + return ( aLhs == aRhs ); + } + +/** +* 802.11 fixed length components required +* in reassociation request management frame +*/ +#pragma pack( 1 ) +struct SReassociationRequestFixedFields + { + /** capability info fixed field */ + SCapabilityInformationField iCapabilityInfo; // 2 bytes + /** listeninterval fixed field */ + SListenIntervalField iListenInterval; // 2 bytes + /** current AP address fixed field */ + TMacAddress iCurrentApAddress; // 6 bytes + + /** Ctor */ + SReassociationRequestFixedFields() {}; + +private: + + /** Prohibit assignment operator */ + SReassociationRequestFixedFields& operator= ( + const SReassociationRequestFixedFields& ); + /** Prohibit copy constructor */ + SReassociationRequestFixedFields( + const SReassociationRequestFixedFields& ); + } __PACKED; + +/** +* operator== for SReassociationRequestFixedFields +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SReassociationRequestFixedFields& aLhs, + const SReassociationRequestFixedFields& aRhs) + { + return static_cast( aLhs.iCapabilityInfo == aRhs.iCapabilityInfo + && aLhs.iListenInterval == aRhs.iListenInterval + && aLhs.iCurrentApAddress == aRhs.iCurrentApAddress ); + } + +/** +* 802.11 reassociation request management frame +* excluding variable length information elements +*/ +#pragma pack( 1 ) +struct SReassociationRequestFrame + { + /** management frame header */ + SManagementFrameHeader iHeader; // 24 bytes + /** association request fixed fields */ + SReassociationRequestFixedFields iFixedFields; // 10 bytes + + /** Ctor */ + SReassociationRequestFrame() + : iHeader( E802Dot11FrameTypeReassociationReq ), + iFixedFields() {}; + + /** + * Helper function to set short preamble bit in capability info + */ + inline void SetCapabilityShortPreamble(); + + /** + * Helper function to clear short preamble bit in capability info + */ + inline void ClearCapabilityShortPreamble(); + + /** + * Helper function to set PBCC bit in capability info + */ + inline void SetCapabilityPbcc(); + + /** + * Helper function to clear PBCC bit in capability info + */ + inline void ClearCapabilityPbcc(); + + /** + * Helper function to clear CF fields from capability info + */ + inline void ClearCFfields(); + + /** Helper function to clear reserved fields */ + inline void ClearReservedFields(); + + /** Helper function to set WEP bit from the capability info fixed field */ + inline void SetWepBit(); + + /** + * Helper function to clear WEP bit from + * the capability info fixed field + */ + inline void ClearWepBit(); + +private: + + /** Prohibit assignment operator */ + SReassociationRequestFrame& operator= ( + const SReassociationRequestFrame& ); + /** Prohibit copy constructor */ + SReassociationRequestFrame( + const SReassociationRequestFrame& ); + } __PACKED; // 34 bytes + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SReassociationRequestFrame::SetCapabilityShortPreamble() + { + iFixedFields.iCapabilityInfo.SetShortPreamble(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SReassociationRequestFrame::ClearCapabilityShortPreamble() + { + iFixedFields.iCapabilityInfo.ClearShortPreamble(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SReassociationRequestFrame::SetCapabilityPbcc() + { + iFixedFields.iCapabilityInfo.SetPbcc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SReassociationRequestFrame::ClearCapabilityPbcc() + { + iFixedFields.iCapabilityInfo.ClearPbcc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SReassociationRequestFrame::ClearCFfields() + { + iFixedFields.iCapabilityInfo.ClearCfFields(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SReassociationRequestFrame::ClearReservedFields() + { + iFixedFields.iCapabilityInfo.ClearReservedFields(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SReassociationRequestFrame::SetWepBit() + { + iFixedFields.iCapabilityInfo.SetWepBit(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SReassociationRequestFrame::ClearWepBit() + { + iFixedFields.iCapabilityInfo.ClearWepBit(); + } + +/** +* 802.11 reassociation response frame fixed fields +*/ +#pragma pack( 1 ) +struct SReassociationResponseFixedFields + { + /** capability info fixed field */ + SCapabilityInformationField iCapabilityInfo; // 2 bytes + /** status code fixed field */ + TUint16 iStatusCode; // 2 bytes + /** AID fixed field */ + TUint16 iAID; // 2 bytes + + /* + * Returns the reassociation response status code + * @return status code + */ + inline TUint16 StatusCode() const; + + /* + * Returns the Asociation ID (AID) + * @return AID + */ + inline TUint16 Aid() const; + +private: + + /** Prohibit assignment operator */ + SReassociationResponseFixedFields& operator= ( + const SReassociationResponseFixedFields& ); + /** Prohibit copy constructor */ + SReassociationResponseFixedFields( const SReassociationResponseFixedFields& ); + } __PACKED; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 SReassociationResponseFixedFields::StatusCode() const + { + return ( ReadUint16Toh( &iStatusCode ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 SReassociationResponseFixedFields::Aid() const + { + return ( ReadUint16Toh( &iAID ) ); + } + + +/** +* SNAP header +*/ +#pragma pack( 1 ) +struct SSnapHeader + { + /** destination service access point */ + TUint8 iDSAP; + /** source service access point */ + TUint8 iSSAP; + /** control field */ + TUint8 iControl; + /** organizationally unique identifier */ + TUint8 iOUI[KOIULength]; // 3 + } __PACKED; // 6 bytes + +/** +* operator== for SSnapHeader +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SSnapHeader& aLhs, + const SSnapHeader& aRhs) + { + return ( equal( reinterpret_cast(&aLhs), + reinterpret_cast(&aLhs) + sizeof(SSnapHeader), + reinterpret_cast(&aRhs) )); + } + +/** +* RFC 1042 encapsulation SNAP header +*/ +const SSnapHeader KEncapsulatingRfc1042SnapHeader + = { 0xAA, 0xAA, 0x03, { 0x00, 0x00, 0x00 } }; + +/** +* 802.1 h SNAP header +*/ +const SSnapHeader KEncapsulating802_1hSnapHeader + = { 0xAA, 0xAA, 0x03, { 0x00, 0x00, 0xF8 } }; + +/** +* 802.11 data frame encapsulation header +*/ +#pragma pack( 1 ) +struct SDataFrameEncapsulationHeader + { + /** SNAP header */ + SSnapHeader iSnapHeader; // 6 + } __PACKED; + +/** +* 802.11 data frame and its encapsulation header combined +*/ +#pragma pack( 1 ) +struct SDataMpduHeader + { + /** Ctor */ + SDataMpduHeader() + { + iEncHdr.iSnapHeader = KEncapsulatingRfc1042SnapHeader; + } + + /** 802.11 data frame header */ + SDataFrameHeader iHdr; // 24 + /** 802.11 data frame encapsulation header */ + SDataFrameEncapsulationHeader iEncHdr; // 6 + } __PACKED; // 30 + +/* + 802.2 SNAP DATA Frame + +----------------+ + | | + | Destination | + | 6 bytes | + +----------------+ + | | + | Source | + | 6 bytes | + +----------------+ + | Frame Length | Must be <= 1500 Dec. + | 2 bytes | + +----------------+ + | DSAP - 1 byte | = 0xAA ( SNAP ) + +----------------+ + | SSAP - 1 byte | = 0xAA ( SNAP ) + +----------------+ + |Control - 1 byte| = 0x03 + +----------------+ + | OUI - 3 bytes | = 0x0 + | | + +----------------+ + | Type - 2 bytes | = Ethernet type (IP=0x0800) + +----------------+ + | | + | Data | + | | + ~ ~ + ~ ~ + | 46 to 1500 | + | bytes | + | | + +----------------+ + | FCS | + | 4 bytes | + +----------------+ +*/ + +/* +This is an Ethernet Version 2 frame: + + +--------------+ + | | The destination address is a six byte Media Access + | Destination | Control (MAC) address, usually burned into the + | 6 bytes | ROM of the Ethernet card. + +--------------+ + | | The source address is a six byte MAC address, and + | Source | can signify a physical station or a broadcast. + | 6 bytes | + +--------------+ + | Type | The Type field it must be grater then 1500 dec. + | 2 bytes | + +--------------+ + | | Any higher layer information is placed in the + | Data | data field, which could contain protocol + | | information or user data. + ~ ~ + ~ ~ + | 46 to 1500 | + | bytes | + | | + +--------------+ + | FCS | + | 4 bytes | + +--------------+ + +*/ + +/** +* 802.11 QoS data frame and its encapsulation header combined +*/ +#pragma pack( 1 ) +struct SQosDataMpduHeader + { + /** Ctor */ + SQosDataMpduHeader() + { + iEncHdr.iSnapHeader = KEncapsulatingRfc1042SnapHeader; + } + + /** 802.11 QoS data frame header */ + SQosDataFrameHeader iHdr; // 26 + /** 802.11 data frame encapsulation header */ + SDataFrameEncapsulationHeader iEncHdr; // 6 + } __PACKED; // 33 + +const TUint16 KUint16HiByteMask = 0xFF00; + +/** +* Ethernet 14-byte Header (RFC 894) +*/ +#pragma pack( 1 ) +struct SEthernetHeader + { + /** destination MAC address */ + TMacAddress iDA; // 6 + /** source MAC address */ + TMacAddress iSA; // 6 + /** ethernet type field */ + TUint16 iType; // 2 + + /** + * Returns the Ethernet Type + * @return ethernet type + */ + inline TUint16 Type() const; + } __PACKED; + +// --------------------------------------------------------------------------- +// If the type is other than EAPOL (e.g. IP or ARP), we need to reverse the +// byte order as the IP world uses different byter order (MSB first) as WLAN +// MAC layer (LSB first) +// --------------------------------------------------------------------------- +// +inline TUint16 SEthernetHeader::Type() const + { + return ReverseUint16( ReadUint16Toh( &iType ) ); + } + +/** +* Ethernet 802.2/802.3 Header (RFC 1042) +*/ +#pragma pack( 1 ) +struct SEthernet802_3Header + { + /** destination MAC address */ + TMacAddress iDA; // 6 + /** source MAC address */ + TMacAddress iSA; // 6 + /** length of frame */ + TUint16 iLength; // 2 + /** SNAP header */ + SSnapHeader iSnapHeader;// 6 + /** type field */ + TUint16 iType; // 2 + } __PACKED; + +/** +* Ethernet type field +*/ +#pragma pack( 1 ) +struct SEthernetType + { + /** type field */ + TUint16 iType; // 2 + + /** + * Returns the Ethernet Type + * @return ethernet type + */ + inline TUint16 Type() const; + } __PACKED; + +// --------------------------------------------------------------------------- +// We need to reverse the byte order as the IP world uses different byter +// order (MSB first) as WLAN MAC layer (LSB first) +// --------------------------------------------------------------------------- +// +inline TUint16 SEthernetType::Type() const + { + return ReverseUint16( ReadUint16Toh( &iType ) ); + } + +/** +* IP version mask +*/ +const TUint8 KIpVersionMask = 0xF0; + +/** +* The DS (differentiated services) field according to RFC 2474 +* Bits 0-5: DSCP (differentiated services codepoint) +* Bits 6-7: CU (currently unused) +*/ +typedef TUint8 TDsField; + +/** +* According to the WiFi-WMM Test Specification v1.2 the three highest +* bits of the DS field determine the user priority +* This is a mask for those bits in IPv4 header +*/ +const TUint8 KDscpIpv4Mask = 0xE0; + +/** +* Version number for IPv4 +*/ +const TUint8 KIpv4 = 4; + +/** +* Version number for IPv6 +*/ +const TUint8 KIpv6 = 6; + +/** +* IPv4 header (RFC 791) prefix with the Type of Service field redefined +* as the DS field according to RFC 2474 +*/ +#pragma pack( 1 ) +struct SIpv4HeaderPrefix + { + /** Version (4 highest bits) + IHL (Internet Header Length, 4 lowest + bits) */ + TUint8 iVersionIhl; // 1 + /** DS field */ + TDsField iDs; // 1 + + /** + * Returns the IP protocol version + */ + inline TUint8 Version() const; + + /** + * Returns the 802.1d priority value (range 0-7) + */ + inline TUint8 The802Dot1dPriority() const; + } __PACKED; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SIpv4HeaderPrefix::Version() const + { + return ( iVersionIhl & KIpVersionMask ) >> 4; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SIpv4HeaderPrefix::The802Dot1dPriority() const + { + return ( ( iDs & KDscpIpv4Mask ) >> 5 ); + } + +/** +* According to the WiFi-WMM Test Specification v1.2 the three highest +* bits of the DS field determine the user priority +* This is a mask for those bits in IPv6 header +*/ +const TUint8 KDscpIpv6Mask = 0x0E; + +/** +* IPv6 header (RFC 2460) prefix with the Traffic Class field redefined +* as the DS field according to RFC 2474 +*/ +#pragma pack( 1 ) +struct SIpv6HeaderPrefix + { + /** + * Version (highest 4 bits) + highest 4 bits of the DS (in lowest 4 bits + * of this byte) + */ + TUint8 iVersionDs; // 1 + + /** + * Returns the 802.1d priority value (range 0-7) + */ + inline TUint8 The802Dot1dPriority() const; + } __PACKED; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SIpv6HeaderPrefix::The802Dot1dPriority() const + { + return ( ( iVersionDs & KDscpIpv6Mask ) >> 1 ); + } + +// pop the pragma pack stack to return to normal alignment of structures +#pragma pack( ) + +/** +* typedef for WEP key +*/ +typedef TUint8 TWepKey[KMaxWEPKeyLength]; + +/** +* Struct for mapped key: key + mac address +*/ +struct SMappedWepKey + { + TMacAddress MacAddress; + TWepKey WepKey; + }; + +/** +* Struct for tkip key +*/ +struct STkipKey + { + TMacAddress MacAddress; + TWepKey WepKey; + TUint8 KeyId; + TUint8 KeyIndicator; + TUint8 KeyIndex; + }; + +#endif // WLAN802DOT11_H diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/algorithm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/algorithm.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,283 @@ +/* +* Copyright (c) 2002-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: Algorithms for HotSpot FW +* +*/ + + + + + + +#ifndef ALGORITHM_H +#define ALGORITHM_H + +/** +* global operator!= for type T +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +template< class T > +inline TBool operator!= ( + const T& aLhs, + const T& aRhs) + { + return !( aLhs == aRhs ); + } + +/** +* global operator > for type T +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue greater, EFalse else +*/ +template< class T > +inline TBool operator > ( + const T& aLhs, + const T& aRhs) + { + return ( aRhs < aLhs ); + } + +/** +* global operator <= for type T +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue smaller or equal, EFalse else +*/ +template< class T > +inline TBool operator <= ( + const T& aLhs, + const T& aRhs) + { + return !( aRhs < aLhs ); + } + +/** +* global operator >= for type T +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue greater or equal, EFalse else +*/ +template< class T > +inline TBool operator >= ( + const T& aLhs, + const T& aRhs) + { + return !( aLhs < aRhs ); + } + +/** +* Just like equal in C++ STL for testing equality for T type +* Checks weather elements in the range [aBeg, aEnd) are equal +* to the elements in the range starting with aCmpBeg +* Complexity: linear +* @param aBeg begin of the search range +* @param aEnd end ( one past last element ) of the search range +* @param aCmpBeg begin of the range to be compared with +* @return ETrue equal, EFalse not equal +*/ +template< class T > +inline TBool equal( + const T* aBeg, + const T*const aEnd, + const T* aCmpBeg) + { + while ( aBeg != aEnd ) + { + if ( *aBeg != *aCmpBeg ) + { + return EFalse; + } + ++aBeg; + ++aCmpBeg; + } + + return ETrue; + } + +/** +* Just like find in C++ STL +* Returns the position of the first element in the range [aBeg, aEnd) +* that has a value equal to aValue +* Complexity: linear +* @param aBeg begin of range +* @param aEnd end ( one past last element ) of the range +* @param aValue value to be searched +* @return the position of the first element in the range (aBeg, aEnd] +* that has a value equal to aValue. aEnd is returned if no matching +* element is found +*/ +template< class T, class J > +inline T* find( + const T* aBeg, + const T* const aEnd, + const J& aValue) + { + while ( aBeg != aEnd ) + { + if ( *aBeg == aValue ) + { + break; + } + + ++aBeg; + } + + return const_cast(aBeg); + } + +/** +* Just like find_if in C++ STL +* Returns the position of the first element in the range [aBeg, aEnd) +* for which the unary predicate op(elem) yields true +* Complexity: linear +* @param aBeg begin of range +* @param aEnd end ( one past last element ) of the range +* @param aUnaryPredicate a unary predicate +* @return the position of the first element in the range (aBeg, aEnd] +* for which the unary predicate op(elem) yields true. +* aEnd is returned if no matching element is found +* NOTE: aUnaryPredicate should not change its state during a function call +*/ +template< class T, class J > +inline T* find_if( + const T* aBeg, + const T* const aEnd, + const J& aUnaryPredicate) + { + while ( aBeg != aEnd ) + { + if ( aUnaryPredicate( *aBeg ) ) + { + break; + } + + ++aBeg; + } + + return const_cast(aBeg); + } + +/** +* Just like fill in C++ STL for T type +* Assigns aValue to each element in the range [aBeg, aEnd) +* The caller must ensure that the destination range is big enough +* Complexity: linear +* @param aBeg begin of range +* @param aEnd end ( one past last element ) of the range +* @param aValue value to be assigned +*/ +template< class T, class J> +inline void fill( + T* aBeg, + const T* const aEnd, + const J& aValue) + { + while ( aBeg != aEnd ) + { + *aBeg = aValue; + ++aBeg; + } + } + +/** +* Just like fill_n in C++ STL for T type +* Assigns aValue to the first aNum elements in the range starting with aBeg +* The caller must ensure that the destination range is big enough +* Complexity: linear +* @param aBeg begin of range +* @param aNum number of elements to be processed +* @param aValue value to be assigned +*/ +template< class T, class J > +inline void fill_n( + T* aBeg, + TUint32 aNum, + const J& aValue) + { + while ( aNum ) + { + *aBeg = aValue; + ++aBeg; + --aNum; + } + } + +/** +* Just like copy in C++ STL +* @param aSrc begin of copy +* @param aSrcEnd end of copy +* @param aDest target of copy +* @return aDest +*/ +template +inline T* copy( + const T* aSrc, + const T* aSrcEnd, + T* aDest) + { + while ( aSrc != aSrcEnd ) + { + *aDest = *aSrc; + ++aSrc; + ++aDest; + } + + return aDest; + } + +template +inline T* reverse_copy( + const T* aSrcBeg, + const T* aSrcEnd, + T* aDest) + { + --aSrcEnd; + while ( aSrcEnd >= aSrcBeg ) + { + *aDest = *aSrcEnd; + --aSrcEnd; + ++aDest; + } + + return aDest; + } + +/** +* Does a looped copy for T type +* @param aSource source of the copy +* @param aDest destination where to copy +* @param aCount number of iterations +* @return aDest +*/ +template +inline TAny* assign( + const T* aSource, + T* aDest, + const TInt aCount) + { + TAny* origdest = static_cast(aDest); + for ( TInt idx = 0 ; idx != aCount ; ++idx, ++aSource, ++aDest ) + { + *aDest = *aSource; + } + + return origdest; + } + +#endif // ALGORITHM_H + +// End of File diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/am_debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/am_debug.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2002-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: 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 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/am_debug.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/am_debug.inl Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2006-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: 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 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/hotspotclientserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/hotspotclientserver.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,203 @@ +/* +* Copyright (c) 2002-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: Data structures for client server communication. +* +*/ + + + +#ifndef HOTSPOTCLIENTSERVER_H +#define HOTSPOTCLIENTSERVER_H + +#include "hssiapsettings.h" + +_LIT(KHotSpotServerExe, "\\sys\\bin\\HotSpotServer.exe"); +_LIT(KHotSpotServerSemaphore, "HotSpotServerSemaphore"); +_LIT(KHotSpotDataServerName, "HotSpotServer"); + +_LIT( KWlanBearerAgent, "wlanagt.agt" ); +_LIT( KWlanBearerAgent2, "wlanagt2.agt" ); + +_LIT(KHotSpotServerName,"hotspotserver"); +_LIT(KHotSpotServerImg,"HotSpotServer"); // DLL/EXE name + +_LIT(KExePath, "\\sys\\bin\\"); +_LIT(KExe, ".exe"); + +_LIT( KHotSpotPlugin, "NetCfgExtnHotSpot" ); +_LIT( KDhcpPlugin, "NetCfgExtnDhcp" ); +const TUint KEasyWlanServiceId = 1; + +const TUint KMaxSqlQueryLength = 2048; +_LIT(KDatabaseName, "c:\\system\\data\\hotspot.dat"); +_LIT(KTableName, "hotspot"); +_LIT(KIapName, "IapName"); +_LIT(KTestStatus, "TestStatus"); +_LIT(KRedirectStatus, "RedirectStatus"); + +const TInt KAppNameMaxLength = 64; +const TInt KExePathLength = 14; +const TInt KExeLength = 4; +const TUid KHotspotServerUid3={0x10282ECB}; + +const TInt KMaxHotspotMessage=512; +const TInt KScanHotspotIapId=0; + +const TUint KHssShutdown = 777; + +const TUid KInternetConnectivityUid={0x10282EC5}; +const TUid K3rdPartyEcomInterfaceUid={0x10282ED1}; + +_LIT8( KExtensionAPI, " HSFWExt" ); +_LIT8( KUidPrefix, "0x" ); +const TInt KExtensionAPILength = 32; + +/** + * Number of message slots in the server. + * Needed message slots can be defined as follows: + * total slots = n+2, where n is number of independent + * asynchronous services offered by the server. + */ +const TUint KDefaultMsgSlots = 6; + +//the server version. A version must be specifyed when creating a session with the server +const TUint KHotSpotMajorVersionNumber = 0; +const TUint KHotSpotMinorVersionNumber = 1; +const TUint KHotSpotBuildVersionNumber = 1; + +const TInt KIapNameLength = 128; +const TUint KConnectivityTestedId = 20; +const TUint KConnectivityTestNeededId = 30; +const TUint KNoRedirect = 40; +const TUint KRedirect = 50; + +/** +* Commands from client to server. +*/ +enum THotSpotCommands + { + // Client API + EHssGetScanResults, + EHssRegister, + EHssUnRegister, + EHssJoin, + EHssCancelStart, + EHssStop, + EHssLoginComplete, + EHssLogoutComplete, + EHssActivateNotifications, + EHssCancelNotifications, + EHssSetTimerValues, + // WLAN Agent API + EHssStart, + EHssStartAgain, + EHssCloseConnection, + EHssCancel, + // NIFMAN Config API + EHssStartLogin, + EHssCancelLogin, + // Shutdown API + EHssServerShutdown, + // Internal + EHssGetIAP, + // UI API + EHssUiState, + // ICTS API + EHssStartBrowser + }; + +class TIapName + { + public: + inline void SetIapName( const TDesC& aIapName ) + { + iIapName = aIapName; + }; + inline TDesC& IapName() + { + return iIapName; + }; + private: + TBufC< KIapNameLength > iIapName; + + }; + +class TClientUid + { + public: + inline void SetUid( const TUid aUid ) + { + iUid = aUid; + }; + inline TUid ClientUid() + { + return iUid; + }; + private: + TUid iUid; + + }; + +class TIapSettings + { + public: + inline void SetIapSettings( const THssIapSettings& aIapSettings ) + { + iIapSettings = aIapSettings; + }; + inline THssIapSettings& IapSettings() + { + return iIapSettings; + }; + private: + THssIapSettings iIapSettings; + + }; + +/** + * Data values for security modes. + */ +enum THssSecurity + { + EHssSecurityOpen, + EHssSecurityWep, + EHssSecurity802d1x, + EHssSecurityWpa, + EHssSecurityWpaPsk, + EHssSecurityWpa2, + EHssSecurityWpa2Psk + }; + +/** +* Nofications from server to client. +*/ +enum THssResponses + { + EHssNewNetworksDetected, + EHssOldNetworksLost + }; + +/** +* Hotspot Browser UI states. +*/ +enum THsBrowserUiStates + { + EHsBrowserUiUndefined, + EHsBrowserUiRunning, + EHsBrowserUiAuthenticatedOk, + EHsBrowserUiAuthenticatedNok, + EHsBrowserUiClosed + }; + +#endif // HOTSPOTCLIENTSERVER_H diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/hotspotserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/hotspotserver.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,378 @@ +/* +* Copyright (c) 2002-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 HotSpot Server +* +*/ + + + +#ifndef HOTSPOTSERVER_H +#define HOTSPOTSERVER_H + +// INCLUDES +#include +#include +#include +#include "hotspotclientserver.h" +#include "hssscanlist.h" +#include "hssnotif.h" + +#include +#include + +// FORWARD DECLARATIONS +class CHotSpotSession; +class HssScanList; +class CNotificationBase; + +// ----------------------------------------------------------------------------- +// Server's policy +// ----------------------------------------------------------------------------- + +//Total number of ranges +const TUint KHotSpotServerPlatSecRangeCount = 3; + +//Definition of the ranges of IPC numbers +const TInt THotSpotServerPlatSecRanges[ KHotSpotServerPlatSecRangeCount ] = + { + 0, // Internal IPC Messages (Client, WLAN, NIfman, Shutdown, Internal, UI) + 20, // IPC Message ICTS API + 21 // Not supported IPC Messages + }; + +//Policy to implement for each of the above ranges +const TUint8 THotSpotServerPlatSecElementsIndex[ KHotSpotServerPlatSecRangeCount ] = + { + 0, // Internal IPC Messages + CPolicyServer::EAlwaysPass, // IPC Messages ICTS API + CPolicyServer::ENotSupported // Not supported IPC Messages + }; + +//Specific capability checks +const CPolicyServer::TPolicyElement THotSpotServerPlatSecElements[] = + { + { _INIT_SECURITY_POLICY_C1( ECapabilityNetworkControl ), CPolicyServer::EFailClient } + }; + +//Package all the above together into a policy +const CPolicyServer::TPolicy THotSpotServerPlatSecPolicy = + { + CPolicyServer::EAlwaysPass, // specifies all connect attempts should pass + KHotSpotServerPlatSecRangeCount, // number of ranges + THotSpotServerPlatSecRanges, // ranges array + THotSpotServerPlatSecElementsIndex, // elements<->ranges index + THotSpotServerPlatSecElements, // array of elements + }; + +// ---------------------------------------------------------------------------------------- +// Server's panic codes here +// ---------------------------------------------------------------------------------------- +enum THotspotPanic + { + EPanicGeneral, + EPanicIllegalFunction + }; + +void PanicClient(const RMessagePtr2& aMessage,THotspotPanic aPanic); + +struct SRequestMapEntry + { + RMessagePtr2 iMessage; + THotSpotCommands iFunction; + TUint iIapId; + }; + +struct SLoginLogoutTimers + { + TUid clientUid; + TUint loginTimeMicroSecs; + TUint logoutTimeMicroSecs; + }; + +// CLASS DECLARATION + +/** +* The server of HotSpot services. +* +* @lib HotSpotServer.exe +* @since Series 60 3.0 +*/ +NONSHARABLE_CLASS ( CHotSpotServer ) : public CPolicyServer, public MWlanMgmtNotifications + { + + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CHotSpotServer* NewLC(); + + /** + * Destructor. + */ + virtual ~CHotSpotServer(); + + + public: // New functions + + virtual void NotifyAdd( CNotificationBase& aNotification ); + virtual void NotifyRemove(CNotificationBase& aNotification ); + + /** + * Saves Iap Id, RMessage2, THotSpotCommands as one entry + * @since Series 60 3.0 + * @param aIapId IAP id + * @param aMessage Client/Server message from client + * @param aCommand Command/Function of message + * @return None + */ + TInt SaveMessage( TUint aIapId, const RMessage2& aMessage, + THotSpotCommands aCommand ); + + /** + * Complete RMessage2 + * @since Series 60 3.0 + * @param aIndex Index of completed message in array + * @param aResult Return value in complete + * @return None + */ + void CompleteMessage( TInt aIndex, TInt aResult ); + + /** + * Find message & add data to message + * @since Series 60 3.0 + * @param aIndex, Index of message in array + * @param aData, TPckg type of data + * @return Index of message in array, otherwise KErrNotFound + */ + TInt EditMessage( TInt aIndex, TPckg& aData); + + /** + * Check if IAP id has uncomplete messages + * @since Series 60 3.0 + * @param aIapId IAP id + * @param aCommand Command/Function of message + * @return Index of message in array, otherwise KErrNotFound + */ + TInt FindMessage( TUint aIapId, THotSpotCommands aCommand ); + + /** + * Set value whether Logout() is sent or not + * @since Series 60 3.0 + * @param aValue New value of flag + * @return None + */ + void SetLogoutFlag( TBool aValue ); + + /** + * Gets value if Logout is sent to client or not + * @since Series 60 3.0 + * @return ETrue if Login is sent. Otherwise EFalse + */ + TBool GetLogoutFlagValue(); + + /** + * Set value whether Login() is sent or not + * @since Series 60 3.0 + * @param aValue New value of flag + * @return None + */ + void SetLoginFlag( TBool aValue ); + + /** + * Gets value if Login is sent to client or not + * @since Series 60 3.0 + * @return ETrue if Login can be sent. Otherwise EFalse + */ + TBool GetLoginFlagValue(); + + /** + * Set value whether WLAN association status can be sent + * @param aValue New value of flag + * @return None + */ + void SetAssociationFlag( TBool aValue ); + + /** + * Gets value whether WLAN association status can be sent + * @return ETrue if can be sent. Otherwise EFalse. + */ + TBool GetAssociationFlagValue(); + + /** + * Set service id of IAP in use + * @since Series 60 3.0 + * @param aServiceId service id + * @return None + */ + void SetServiceId( TInt aServiceId ); + + /** + * Gets service id of IAP in use + * @since Series 60 3.0 + * @return service ID + */ + TInt GetServiceId(); + + /** + * Checks IAPs if there's any unused Hotspot IAPs. + * @since Series 60 3.0 + * @return None + */ + void CheckIapsL(); + + /** + * Checks EasyWLAN service id + * @since Series 60 MCL + * @return ETrue if commits were successful, otherwise EFalse. + */ + TBool EasyWlanIdL(); + + /** + * Getter for EasyWLAN service id + * @since Series 60 MCL + * @return EasyWLAN IAP id + */ + TUint32 GetEasyWlanId(); + + /** + * Get login timer value for the specified client. + * @param aClientUid, client's user ID, + * @return Login timer value. + */ + TUint GetLoginTimeMicroSecs( TUid aClientUid ); + + /** + * Get logout timer value for the specified client. + * @param aClientUid, client's user ID, + * @return Logout timer value. + */ + TUint GetLogoutTimeMicroSecs( TUid aClientUid ); + + /** + * Set both login and logout timer values for the specified client. + * @param aClientUid, client's user ID, + * @param aLoginTimerValue, set login timer value, + * @param aLogoutTimerValue, set logout timer value. + */ + void CHotSpotServer::SetTimerValues( + TUid aClientUid, + TUint aLoginTimerValue, + TUint aLogoutTimerValue ); + + private: + + /** + * Find matching Client UID from the timer array. + * @param aClientUid, client UID to find. + * @return matching index if UID was found, otherwise KErrNotFound. + */ + TInt CHotSpotServer::FindClientUid( TUid aClientUid ); + + public: // Functions from base classes + + /** + * From CServer creates a new session + * @since Series 60 3.0 + * @param aVersion Version + * @return Pointer to created server side session + */ + CSession2* NewSessionL( const TVersion& aVersion, + const RMessage2& aMessage ) const; + + /** + * From MWlanMgmtNotifications + * @since Series 60 3.0 + * @param aNewState State of WLAN + * @return None + */ + virtual void ConnectionStateChanged( TWlanConnectionMode aNewState ); + + protected: + + /** + * Overrides CActive::RunError() + */ + virtual TInt RunError( TInt aError ); + + private: + + /** + * C++ default constructor. + */ + CHotSpotServer(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: + /** + * Messages that are needed to be saved for later completion + * Own + */ + RArray iMap; + /** + * List of clients who have subscribed notifications + */ + RArray iNotificationArray; + + /** + * Flag for sending client Logout -message + */ + TBool iLogoutSent; + + /** + * Flag for sending client Login -message + */ + TBool iLoginValue; + + /** + * Flag for sending WLAN association status to client + */ + TBool iAssociationValue; + + /** + * Boolean flag whether the IAPs has been checked or not + */ + TBool iIapCheckValue; + + /** + * WLAN management API + */ + CWlanMgmtClient* iMgtClient; + + /** + * Service id of IAP in use + */ + TInt iCurrentServiceIdInUse; + + /** + * Return/leave value of ChangeConfigDaemonL() + */ + TInt iConfigDaemonChanged; + + /** + * Service id of IAP in use + */ + TUint32 iEasyWlanId; + + /** + * Array for storing client dependent login and logout timer values. + */ + RArray iLoginLogoutTimerArray; + }; + +#endif diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/hotspotsession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/hotspotsession.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,344 @@ +/* +* Copyright (c) 2002-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 HotSpot Server Session +* +*/ + + +#ifndef HOTSPOTSESSION_H +#define HOTSPOTSESSION_H + +// INCLUDES +#include +#include "hssclientplugin.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include "hssnotif.h" +#include "hssiapsettingshandler.h" +#include "hssclientinterface.h" +#include "hsslogintimerobserver.h" +#include "hsslogouttimerobserver.h" + +// FORWARD DECLARATIONS +class CHotSpotServer; +class CWlanMgmtClient; +class HssNotifications; +class CSessionNotification; +class CHssLoginTimer; +class CHssLogoutTimer; + + +// CLASS DECLARATION +/** +* Server side counterpart for client's Session classes. +* Each connection has own session in server. +* @lib HotSpotServer.exe +* @since Series 60 3.0 +*/ +NONSHARABLE_CLASS( CHotSpotSession ) : public CSession2, + public MIctsObserver, + public MHssLoginTimerObserver, + public MHssLogoutTimerObserver, + public MWlanMgmtNotifications + { + + public: + + /** + * Two-phased constructor. + */ + static CHotSpotSession* NewL( CHotSpotServer& aServer ); + + /** + * Destructor. + */ + ~CHotSpotSession(); + + struct TNotification + { + TInt id; + TBuf8 data; + }; + public: // Functions from base classes + + /** + * From CSession called when a client asks for service + * @param aMessage the message + * @return None + */ + void ServiceL( const RMessage2& aMessage ); + + /** + * Called by ServiceL when a client asks for service + * @param aMessage the message + * @return None + */ + 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 + */ + void LoginTimeout(); + + /** + * From MHssLogoutTimerObserver. Called when time used for Logout(..) + * has run out for client. + * @return None + */ + void LogoutTimeout(); + + /** + * From MWlanMgmtNotifications + * @since Series 60 3.0 + * @param aNewState State of WLAN + * @return None + */ + virtual void ConnectionStateChanged( TWlanConnectionMode aNewState ); + + public: // New functions + + + /** + * Metods for handling passthrough notifications + */ + void HandleCancelNotifications( const RMessage2& aMessage ); + void AddNotification( TInt aNotification, TDes8& aData ); + void HandleOrderNotifications( const RMessage2& aMessage ); + void HandleNotification(); + + private: + + /** + * C++ default constructor. + */ + CHotSpotSession( CHotSpotServer& aServer ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + + void ConstructL(); + /** + * Initialize Scan to WlanEngine + * @return None + */ + + /** + * Launch Intenet Connectivity Test Service + * @return None + */ + void TestInternetConnectivityL(); + + /** + * Starts client register procedures + * @param aMessage, RMessage from client side + * @return None + */ + void ProcessRegisterL( const RMessage2& aMessage ); + + /** + * Starts client unregister procedures + * @param aMessage, RMessage from client side + * @return None + */ + void ProcessUnRegisterL( const RMessage2& aMessage ); + + /** + * Starts login procedures + * @param aIapId, IAP id + * @param aNetId, Network id + * @return KErrNone, if successful, otherwice one of system wide errorcodes. + */ + TInt ProcessStartLoginL( const TUint aIapId, const TUint aNetId ); + + /** + * Starts Join procedures + * @param aIapId, IAP id + * @return KErrNone, if successful, otherwice one of system wide errorcodes. + */ + TInt ProcessStartL( const TUint aIapId ); + + /** + * Starts Configure & reJoin procedures + * @param aIapId, IAP id + * @return KErrNone, if successful, otherwice one of system wide errorcodes. + */ + TInt ProcessStartAgain( const TUint aIapId ); + + /** + * Sends WLAN association status to client + * @param aIapId, IAP id + * @param aResult, ETrue is successful, otherwise EFalse + * @return KErrNone, if successful, otherwice one of system wide errorcodes. + */ + TInt ProcessAssociationStatus( const TUint aIapId, TBool aResult ); + + /** + * Starts CloseConnection procedures + * @param aIapId, IAP id + * @return KErrNone, if successful, otherwice one of system wide errorcodes. + */ + TInt ProcessCloseL( const TUint aIapId ); + + /** + * Creates client instance through ECom + * @param aUid, ECom implementation UID of client + * @return KErrNone, if successful, otherwice one of system wide errorcodes. + */ + TInt CreateClient( const TUid aUid, TDesC8& aUidText ); + + /** + * Makes server shutdown processes (agent change and IAP removals) + * @param aMessage, Message for completing request + */ + void ProcessServerShutdown( const RMessage2& aMessage ); + + /** + * Updates UI state of HotSpot browser logon application. + * @param aMessage, Message for completing request + */ + void ProcessUiState( const RMessage2& aMessage ); + + /** + * Start HotSpot browser logon application. + * @param aString, redirect URL + */ + void AuthenticateL( const TDesC& aString ); + + private: // Data + + /** List of pending (not sent) notifications. */ + RArray iPendingNotifications; + + /** The request from the client pending for a notification. */ + RMessagePtr2 iPendingNotificationRequest; + + /** Is there a pending request from the client. */ + TBool iIsNotificationRequestPending; + + /** + * Handle to server + */ + CHotSpotServer& iServer; + + /** + * Instance of 3rd party client (ECom) + * Own + */ + CHssClientPlugin* iClient; + + /** + * handle to MHssSrvNotifications + */ + MHssSrvNotifications *iSrvNotifications; + + /** Handle to remove notification. */ + CSessionNotification* iNotificationHandle; + + /** + * RMessage instance + */ + RMessage2 iMessage; + + /** + * IAP id in use + */ + TInt iIapId; + + /** + * Network Id in use + */ + TInt iNetId; + + /** + * handle to WlanMgmtClient + */ + CWlanMgmtClient *iMgtClient; + + /** + * handle to HssNotifications + */ + HssNotifications *iNotifications; + + + /** + * statusinformation of Async call + */ + TRequestStatus iStatus; + + /** + * Handler for changing IAP settings + * Own + */ + CHssIapSettingsHandler* iIapSettingsHandler; + + /** + * Internet Connectivity testing instance + * Own + */ + CIctsClientInterface* iIcts; + + /** + * Timer used for client Login procedure + * Own + */ + CHssLoginTimer* iLoginTimer; + + /** + * Timer used for client Logout procedure + * Own + */ + CHssLogoutTimer* iLogoutTimer; + + /** + * Flag for notification sending + */ + TBool iAllowNotifications; + + /** + * Instance of CenRep + * Own. + */ + CRepository* iRepository; + + /** + * Client UID of this session + */ + TUid iClientUid; + + /** + * Flag for indicate if extended HSFW API is used + */ + TBool iHotspotExtension; + }; + +#endif diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/hssclientplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/hssclientplugin.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2002-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: Wrapper class for instantiating an implementation of +* MHssClientInterface via ECom framework. +* +*/ + + + +#ifndef HSSCLIENTPLUGIN_H +#define HSSCLIENTPLUGIN_H + +// INCLUDES +#include +#include "hssclientinterface.h" +#include "hotspotclientserver.h" + +// CLASS DECLARATION +/** +* @brief Class for instantiating an implementation of MHssMgmtInterface via ECom. +*/ +class CHssClientPlugin : public CBase, public MHssClientInterface + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + * @return Pointer to the constructed object. + */ + inline static CHssClientPlugin* NewL( const TUid aUid, TDesC8& aUidText ); + + /** + * Destructor. + */ + inline virtual ~CHssClientPlugin(); + + private: // Data + + // Identifies the instance of an implementation created by + // the ECOM framework. + TUid iInstanceIdentifier; + }; + +#include "hssclientplugin.inl" + +#endif // CHssClientPlugin_H + +// End of File diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/hssclientplugin.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/hssclientplugin.inl Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2002-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: Inline functions of CHssClientPlugin class. +* +*/ + + + +#ifndef HSSCLIENTPLUGIN_INL +#define HSSCLIENTPLUGIN_INL + +// --------------------------------------------------------- +// CHssClientPlugin::NewL +// --------------------------------------------------------- +// +inline CHssClientPlugin* CHssClientPlugin::NewL( const TUid aUid, TDesC8& aUidText ) + { + TAny* interface( NULL ); + if ( aUidText != KNullDesC8 ) + { + TEComResolverParams resolverParams; + + TBuf8 buf; + buf.Append( KUidPrefix ); + buf.Append( aUidText ); + buf.Append( KExtensionAPI ); + resolverParams.SetDataType( buf ); + resolverParams.SetWildcardMatch( ETrue ); + + interface = REComSession::CreateImplementationL( + K3rdPartyEcomInterfaceUid, _FOFF( CHssClientPlugin, + iInstanceIdentifier ), + resolverParams ); + } + else + { + interface = REComSession::CreateImplementationL( + aUid, _FOFF( CHssClientPlugin, + iInstanceIdentifier ) ); + } + return reinterpret_cast( interface ); + } + +// --------------------------------------------------------- +//CHssClientPlugin::~CHssClientPlugin +// --------------------------------------------------------- +// +inline CHssClientPlugin::~CHssClientPlugin() + { + REComSession::DestroyedImplementation( iInstanceIdentifier ); + } + +#endif // CHssClientPlugin_INL + +// End of File diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/hssiapsettingshandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/hssiapsettingshandler.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,206 @@ +/* +* Copyright (c) 2002-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 iapsettings +* +*/ + + +#ifndef HSSIAPSETTINGSHANDLER_H +#define HSSIAPSETTINGSHANDLER_H + +// INCLUDES +#include +#include "hssiapsettings.h" +#include +#include +#include +#include +#include +#include + +// CONSTANTS + +/** +* Max attempts to reserve a trasnaction for secure key saving to IAP +*/ +const TUint KHssMaxTransAttempts = 10; + +/** +* Max wait time between secure key saving attempts +*/ +const TUint KHssRetryAfter = 100000; + +_LIT( KGenericTable, "WLANServiceTable"); +_LIT8(KEapPlus,"+0"); +_LIT8(KDot,", "); + +_LIT8(KMark1, "[" ); +_LIT8(KMark2, "]" ); + +_LIT8(KEapNone,"0"); +_LIT8(KEapGtc,"6"); +_LIT8(KEapTls,"13"); +_LIT8(KEapLeap,"17"); +_LIT8(KEapSim,"18"); +_LIT8(KEapTtls,"21"); +_LIT8(KEapAka,"23"); +_LIT8(KEapPeap,"25"); +_LIT8(KEapMschapv2,"26"); +_LIT8(KEapSecurid,"32"); +_LIT8(KEapPlainMschapv2,"99"); + +const TUint8 KEapNoneId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +const TUint8 KEapTlsId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d}; +const TUint8 KEapGtcId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06}; +const TUint8 KEapLeapId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11}; +const TUint8 KEapSimId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12}; +const TUint8 KEapTtlsId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15}; +const TUint8 KEapAkaId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17}; +const TUint8 KEapPeapId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19}; +const TUint8 KEapMschapv2Id[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A}; +const TUint8 KEapSecuridId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}; +const TUint8 KEapPlainMschapv2Id[] = {0xfe, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x63}; + +const TInt KEapLength = 2; +const TUint KEapListMaxLength = 1024; +const TUint KEapExpandedIdLength = 8; + +// WLAN Service Table +const TMDBElementId KCDTIdWlanServiceId = 0x00030000; +const TMDBElementId KCDTIdWlanConnMode = 0x00040000; + +const TMDBElementId KCDTIdWlanSSID = 0x00050000; +const TMDBElementId KCDTIdWlanWepKey1 = 0x00060000; //EDesC8 +const TMDBElementId KCDTIdWlanWepKey2 = 0x00070000; //EDesC8 +const TMDBElementId KCDTIdWlanWepKey3 = 0x00080000; //EDesC8 +const TMDBElementId KCDTIdWlanWepKey4 = 0x00090000; //EDesC8 +const TMDBElementId KCDTIdWlanWepIndex = 0x000A0000; //EUint32 +const TMDBElementId KCDTIdWlanSecMode = 0x000B0000; //EUint32 +const TMDBElementId KCDTIdWlanAuthMode = 0x000C0000; //EUint32 +const TMDBElementId KCDTIdWlanEnableWpaPsk = 0x000D0000; //EUint32 +const TMDBElementId KCDTIdWlanWpaPreSharedKey = 0x000E0000; //EDesC8 + +const TMDBElementId KCDTIdWlanWpaKeyLength = 0x000F0000; //EUint32 +const TMDBElementId KCDTIdWlanEaps = 0x00100000; //ELongText +const TMDBElementId KCDTIdWlanScanSSID = 0x00110000; +const TMDBElementId KCDTIdWlanChannelID = 0x00120000; +const TMDBElementId KCDTIdWlanUsedSSID = 0x00130000; +const TMDBElementId KCDTIdWlanFormatKey1 = 0x00140000; +const TMDBElementId KCDTIdWlanFormatKey2 = 0x00150000; +const TMDBElementId KCDTIdWlanFormatKey3 = 0x00160000; +const TMDBElementId KCDTIdWlanFormatKey4 = 0x00170000; +const TMDBElementId KCDTIdWlanEnabledEaps = 0x00190000; +const TMDBElementId KCDTIdWlanDisabledEaps = 0x001A0000; + +// CLASS DECLARATION +/** +* @brief IAP creator and settings handler +*/ +class CHssIapSettingsHandler : public CBase + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + * @return Pointer to the constructed object. + */ + static CHssIapSettingsHandler* NewL( ); + + /** + * Destructor. + */ + virtual ~CHssIapSettingsHandler(); + + /** + * Create new IAP for client application use + * @param aIapName, Name of IAP + * @param aUid, UID of the client + * @return Iap ID, Otherwise aIapId will be null + */ + void CreateClientIapL( const TDesC& aIapName, TUint32& aIapId, const TUid aUid ); + + /** + * Create new IAP to Internet SNAP. + */ + void CreateIapL(); + + /** + * Deletes the IAP + * @param aIapID, IAP id + */ + void DeleteIapL( const TUint aIapId ); + + /** + * Finds client if found return its UID + * @param aIapId, IAP id + * @param aUid, UID id + * @param aUidText, UID id as a descriptor. Without[]. + * @return KErrNone, if successful, otherwise one of system wide errorcodes. + */ + TInt FindClientL( const TUint aIapId, TUid& aUid, TDes8& aUidText ); + + protected: + + /** + * C++ default constructor. + */ + CHssIapSettingsHandler(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: + + /** + * Saves WEP key to newly created IAP + * @param aFrom, From which IAP + * @param aTo, To what IAP + */ + void SaveWEPKeyL( const TUint32 aFrom, const TUint32 aTo ); + + /** + * Saves WPA key to newly created IAP + * @param aFrom, From which IAP + * @param aTo, To what IAP + */ + void SaveWPAKeyL( const TUint32 aFrom, const TUint32 aTo ); + + /** + * Rolls back CMDBSession + * @param aDbSession, Session to CommsDat + */ + static void RollbackCommsDat( TAny* aDbSession ); + + /** + * Convert security mode types + * @param aSecurityMode, WLAN connection security mode + */ + CMManager::TWlanSecMode ConvertConnectionSecurityModeToSecModeL( + TWlanConnectionSecurityMode aSecurityMode ); + + /** + * Convert connection mode types + * @param aConnMode, WLAN connection mode + */ + CMManager::TWlanNetMode ConvertConnectionModeToNetModeL( + TWlanConnectionMode aConnMode ); + + }; + + +#endif diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/hsslogintimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/hsslogintimer.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,77 @@ +/* +* 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: Timer class for login time +* +*/ + + + +#ifndef HSSLOGINTIMER_H +#define HSSLOGINTIMER_H + +#include + +class MHssLoginTimerObserver; + +/** + * Timer for total time used for polling + * + * @lib ictsclientinterface.lib + * @since S60 5.0 + */ +class CHssLoginTimer : public CTimer + { + + public: + + /** + * Static constructor. + */ + static CHssLoginTimer* NewL( MHssLoginTimerObserver& aObserver ); + + /** + * Destructor. + */ + virtual ~CHssLoginTimer(); + + // from CTimer + + /** + * Timer expired + */ + void RunL(); + + private: + + /** + * C++ default constructor. + */ + CHssLoginTimer( MHssLoginTimerObserver& aObserver ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // data + + /** + * Reference of client using timer + * Not own. + */ + MHssLoginTimerObserver& iObserver; + + }; + +#endif // HSSLOGINTIMER_H \ No newline at end of file diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/hsslogintimerobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/hsslogintimerobserver.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,42 @@ +/* +* 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: Observer class login timeout +* +*/ + + + + +#ifndef HSSLOGINTIMEROBSERVER_H +#define HSSLOGINTIMEROBSERVER_H + +#include + +class MHssLoginTimerObserver + { + + public: + + /** + * Timeout occurred + * + * @return None + */ + virtual void LoginTimeout() = 0; + + }; + + + +#endif // HSSLOGINTIMEROBSERVER_H diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/hsslogouttimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/hsslogouttimer.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,77 @@ +/* +* 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: Timer class for logout time +* +*/ + + + +#ifndef HSSLOGOUTTIMER_H +#define HSSLOGOUTTIMER_H + +#include + +class MHssLogoutTimerObserver; + +/** + * Timer for total time used for polling + * + * @lib ictsclientinterface.lib + * @since S60 5.0 + */ +class CHssLogoutTimer : public CTimer + { + + public: + + /** + * Static constructor. + */ + static CHssLogoutTimer* NewL( MHssLogoutTimerObserver& aObserver ); + + /** + * Destructor. + */ + virtual ~CHssLogoutTimer(); + + // from CTimer + + /** + * Timer expired + */ + void RunL(); + + private: + + /** + * C++ default constructor. + */ + CHssLogoutTimer( MHssLogoutTimerObserver& aObserver ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // data + + /** + * Reference of client using timer + * Not own. + */ + MHssLogoutTimerObserver& iObserver; + + }; + +#endif // HSSLOGOUTTIMER_H \ No newline at end of file diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/hsslogouttimerobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/hsslogouttimerobserver.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,42 @@ +/* +* 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: Observer class logout timeout +* +*/ + + + + +#ifndef HSSLOGOUTTIMEROBSERVER_H +#define HSSLOGOUTTIMEROBSERVER_H + +#include + +class MHssLogoutTimerObserver + { + + public: + + /** + * Timeout occurred + * + * @return None + */ + virtual void LogoutTimeout() = 0; + + }; + + + +#endif // HSSLOGOUTTIMEROBSERVER_H diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/hssnotif.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/hssnotif.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,165 @@ +/* +* Copyright (c) 2002-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 HotSpot Server +* +*/ + + +#ifndef HSSNOTIF_H +#define HSSNOTIF_H + +// INCLUDES +#include "hssinterface.h" +#include +#include +#include "hotspotsession.h" +#include "hotspotclientserver.h" + +// FORWARD DECLARATIONS +class CHotSpotSession; +class CSessionNotification; + +// CLASS DECLARATION +/** +* HssNotifications, callback implementation of MWlanMgmtNotifications. +*/ +class HssNotifications : public MWlanMgmtNotifications + { + public: + + /** + * Constructor. + */ + HssNotifications(CHotSpotSession& aSession): iSession(aSession){} + /** + * Connection status has changed. + */ + virtual void ConnectionStateChanged( TWlanConnectionMode /* aNewState */ ) {}; + + /** + * BSSID has changed (i.e. AP handover). + */ + virtual void BssidChanged( TWlanBssid& /* aNewBSSID */ ) {}; + + /** + * Connection has been lost. + */ + virtual void BssLost() {}; + + /** + * Connection has been regained. + */ + virtual void BssRegained() {}; + + /** + * New networks have been detected during scan. + */ + virtual void NewNetworksDetected(); + + /** + * One or more networks have been lost since the last scan. + */ + virtual void OldNetworksLost(); + + /** + * The used transmit power has been changed. + * @param aPower The transmit power in mW. + */ + virtual void TransmitPowerChanged( TUint /* aPower */ ) {}; + + /** + * Received signal strength level has been changed. + * @param aRssClass specifies the current class of the received signal + * @param aRss RSS level in absolute dBm values. + */ + virtual void RssChanged(TWlanRssClass /* aRssClass */, TUint /* aRss */ ) {}; + + private: + + /** + * Callback interface to Session. + */ + CHotSpotSession& iSession; + + }; +// CLASS DECLARATION +/** +* Base class for all notification types. +* +* Basically this only determines the interface how Server is forwarding +* notifications to Sessions or WAL. +*/ +class CNotificationBase : public CBase + { + public: // Constructors and destructor + + /** + * Destructor. + */ + virtual ~CNotificationBase() {}; + + public: // New functions + + /** + * AddNotification + * @param aNotification identifier + * @param aData content of the notification + */ + virtual void AddNotification( + TUint aNotification, + TDes8& aData ) = 0; + }; + +// CLASS DECLARATION +/** +* Forwards notifications to a session. +*/ +NONSHARABLE_CLASS( CSessionNotification ) : public CNotificationBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CSessionNotification* NewL( CHotSpotSession& aSession ); + + /** + * Destructor. + */ + virtual ~CSessionNotification(); + + public: // Functions from base classes + + /** + * AddNotification + * @param aNotification identifier + * @param aData content of the notification + */ + void AddNotification( TUint aNotification, TDes8& aData ); + + private: // Methods + + /** + * C++ default constructor. + */ + CSessionNotification( CHotSpotSession& aSession ); + + private: // Data + + /** Interface to session to forward notifications. */ + CHotSpotSession& iSession; + }; + + +#endif // HSSNOTIF_H diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/hssscan.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/hssscan.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2002-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 Active Object +* +*/ + + + +#ifndef HSSSCAN_H +#define HSSSCAN_H + +// INCLUDES +#include "HSSInterface.h" +#include "hotspotsession.h" + +// Active object for Notification support +// FORWARD DECLARATIONS +class CHotSpotSession; + + +class CWlanMgmtClient; + +// CLASS DECLARATION +/** +* Active object for Notification support. +*/ +class CHssScan : public CActive + { + public: + + /** + * C++ constructor and destructor + */ + CHssScan( CWlanMgmtClient* aWlanMgmtClient, CHotSpotSession& aCallback); + virtual ~CHssScan(); + + /** + * Initialize Scan to WlanEngine + * @return None + */ + void IssueRequest(); + + /** + * RunL to catch answer from WlanEngine + * @return None + */ + void RunL(); + + /** + * RunError to handle error situations + * @return KErrNone + */ + TInt RunError( TInt aError ); + + /** + * DoCancel to handle Cancel + * @return None + */ + void DoCancel(); + + private: + + /** + * Callback interface to Session. + */ + CHotSpotSession& iCallback; + + /** + * handle to wlanMgmtClient + */ + CWlanMgmtClient* iMgmtClient; + + /** + * pointer to scaninfo. + */ + CWlanScanInfo* iScanInfo; + }; + + +#endif \ No newline at end of file diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/hssscaninfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/hssscaninfo.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,237 @@ +/* +* Copyright (c) 2002-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: Class to dig information from scan results. +* +*/ + + + +#ifndef HSSSCANINFO_H +#define HSSSCANINFO_H + + +// INCLUDES +#include "hssscanlistiterator.h" + +// CONSTANTS +const TUint8 BSSID_LENGTH = 6; +const TUint16 SCAN_CAPABILITY_BIT_MASK_ESS = 0x0001; +const TUint16 SCAN_CAPABILITY_BIT_MASK_PRIVACY = 0x0010; +const TUint8 SCAN_IE_OUI_LENGTH = 3; +const TUint8 TIMESTAMP_LENGTH = 8; + +// LOCAL DATATYPES + +typedef enum _HssScanError +{ + HssScanError_Ok, + HssScanError_IeNotFound + +} HssScanError; + +typedef enum _HssSecurityMode + { + HssSecurityModeOpen, + HssSecurityModeWep, + HssSecurityMode802_1x, + HssSecurityModeWpaEap, + HssSecurityModeWpaPsk, + HssSecurityModeWpa2Eap, + HssSecurityModeWpa2Psk + } HssSecurityMode; + +typedef enum _HssOperatingMode + { + HssOperatingModeInfra, + HssOperatingModeAdhoc + } HssOperatingMode; + +typedef TUint8 HssIeOui[SCAN_IE_OUI_LENGTH]; + +// LOCAL CONSTANTS + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Wrapper class to parse data fields from scan info. +*/ +class HssScanInfo : public HssScanListIterator +{ +public: // Methods + + // Constructors and destructor + + /** + * C++ default constructor. + */ + HssScanInfo( const HssScanList& scan_list); + + // New methods + + /** + * Return the signal noise ratio of the received (info) packet. + * @return Signal noise ratio (SNR). + */ + inline TUint8 SignalNoiseRatio() const; + + /** + * Return RX level of the received (info) packet. + * @return RX level. + */ + inline TUint8 RXLevel() const; + + /** + * Return BSSID of the scan info. + * @param bssid (OUT) ID of the access point or IBSS network. + */ + inline void BSSID( TUint8 bssid[BSSID_LENGTH] ) const; + + + /** + * Get beacon interval of the network. + * @return the beacon interval. + */ + inline TUint16 BeaconInterval() const; + + /** + * Get capability of the network (see IEEE 802.11 section 7.3.1.4. + * @return The capability information. + */ + inline TUint16 Capability() const; + + /** + * Return whether the privacy bit is enabled in AP capabilities. + * @return Whether the privacy is enabled. ETrue when enabled, EFalse when disabled. + */ + inline TBool Privacy() const; + + /** + * Return the operating mode of the AP. + * @return The operating mode of the AP. + */ + inline HssOperatingMode OperatingMode() const; + + /** + * Return the security mode of the AP. + * @return The security mode of the AP. + */ + HssSecurityMode SecurityMode(); + + /** + * Return the timestamp field of the frame. + */ + inline void Timestamp( TUint8 timestamp[TIMESTAMP_LENGTH] ) const; + + /** + * Return requested information element. + * @param ie Id of the requested IE data. See 802dot11.h + * @param length (OUT) Length of the IE. Zero if IE not found. + * @param data (OUT) Pointer to the beginning of the IE data. NULL if IE not found. + * @return General error message. + */ + HssScanError InformationElement( TUint8 ie, + TUint8& length, + const TUint8** data ); + /** + * Return WPA information element. + * @param length (OUT) Length of the IE. Zero if IE not found. + * @param data (OUT) Pointer to the beginning of the IE data. NULL if IE not found. + * @return General error message. + */ + HssScanError WpaIE( TUint8& length, + const TUint8** data ); + + /** + * Return the first information element. + * @param ie (OUT) Id of the IE. See 802dot11.h. + * @param length (OUT) Length of the IE. Zero if IE not found. + * @param data (OUT) Pointer to the beginning of the IE data. NULL if IE not found. + * @return General error message. + */ + HssScanError FirstIE( TUint8& ie, + TUint8& length, + const TUint8** data ); + /** + * Return next information element. + * @param ie (OUT) Id of the IE. See 802dot11.h. + * @param length (OUT) Length of the IE. Zero if IE not found. + * @param data (OUT) Pointer to the beginning of the IE data. NULL if IE not found. + * @return General error message. + */ + HssScanError NextIE( TUint8& ie, + TUint8& length, + const TUint8** data ); + + /** + * Return requested information element data. + * @param ie_id (IN) Id of the requested IE data. See 802dot11.h + * @param ie_oui (IN) OUI of the requested IE data. See 802dot11.h + * @param ie_oui_type (IN) OUI Type of the requested IE data. See 802dot11.h + * @param length (OUT) Length of the IE. Zero if IE not found. + * @param data (OUT) Pointer to the beginning of the IE data. NULL if IE not found. + * @return General error message. + */ + HssScanError InformationElement( TUint8 ie_id, + const HssIeOui& ie_oui, + TUint8 ie_oui_type, + TUint8& ie_length, + const TUint8** ie_data ); + + /** + * Return requested information element data. + * @param ie_id (IN) Id of the requested IE data. See 802dot11.h + * @param ie_oui (IN) OUI of the requested IE data. See 802dot11.h + * @param ie_oui_type (IN) OUI Type of the requested IE data. See 802dot11.h + * @param ie_oui_subtype (IN) OUI Subtype of the requested IE data. See 802dot11.h + * @param length (OUT) Length of the IE. Zero if IE not found. + * @param data (OUT) Pointer to the beginning of the IE data. NULL if IE not found. + * @return General error message. + */ + HssScanError InformationElement( TUint8 ie_id, + const HssIeOui& ie_oui, + TUint8 ie_oui_type, + TUint8 ie_oui_subtype, + TUint8& ie_length, + const TUint8** ie_data ); + +private: //Methods + + // Prohibit copy constructor if not deriving from CBase. + HssScanInfo( const HssScanInfo& ); + // Prohibit assigment operator if not deriving from CBase. + HssScanInfo& operator= ( const HssScanInfo& ); + + /** + * Return current information element. + * @param ie (OUT) Id of the IE. See 802dot11.h. + * @param length (OUT) Length of the IE. Zero if IE not found. + * @param data (OUT) Pointer to the beginning of the IE data. NULL if IE not found. + * @return General error message. + */ + HssScanError CurrentIE( TUint8& ie, + TUint8& length, + const TUint8** data ) const; + +private: // Data + /** Iterator for going through IEs of scan info. */ + const TUint8* ie_iter_m; +}; + +#include "hssscaninfo.inl" + +#endif // HssSCANINFO_H + +// End of File diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/hssscaninfo.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/hssscaninfo.inl Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2002-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 ScanInfo inline methods. +* +*/ + + + +#include "hssscanoffsets.h" + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 HssScanInfo::SignalNoiseRatio() const +{ + return *( current_m + RX_SNR_OFFSET ); +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 HssScanInfo::RXLevel() const +{ + return *( current_m + RX_LEVEL_OFFSET ); +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void HssScanInfo::BSSID( TUint8 bssid[BSSID_LENGTH] ) const +{ + TUint8* dst = bssid; + const TUint8* src = current_m + BSSID_OFFSET; + const TUint8* end = src + BSSID_LENGTH; + + for ( ; src < end; ++dst, ++src ) + { + *dst = *src; + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 HssScanInfo::BeaconInterval() const +{ + return *( reinterpret_cast( current_m + BEACON_INTERVAL_OFFSET ) ); +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 HssScanInfo::Capability() const +{ + return *( reinterpret_cast( current_m + CAPABILITY_OFFSET ) ); +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool HssScanInfo::Privacy() const + { + if ( Capability() & SCAN_CAPABILITY_BIT_MASK_PRIVACY ) + { + return 1; + } + + return 0; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void HssScanInfo::Timestamp( TUint8 timestamp[TIMESTAMP_LENGTH] ) const + { + TUint8* dst = timestamp; + const TUint8* src = current_m + TIMESTAMP_OFFSET; + const TUint8* end = src + TIMESTAMP_LENGTH; + + for ( ; src < end; ++dst, ++src ) + { + *dst = *src; + } + } diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/hssscaninfoie.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/hssscaninfoie.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2002-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: Declaration of the ScanInfoIe class. +* +*/ + + + +#ifndef HSSSCANINFOIE_H +#define HSSSCANINFOIE_H + +#include "hssscaninfo.h" + +/** Defines the possible types of security information elements. */ +enum HssScanInfoIeType + { + HssScanInfoIeTypeRsn, + HssScanInfoIeTypeWpa + }; + +/** Defines the possible types of key management suites. */ +enum HssScanInfoIeKeyManagement + { + HssScanInfoIeKeyManagementEap, + HssScanInfoIeKeyManagementPsk + }; + +/** +* Class determining the security mode of an access point. +*/ +class HssScanInfoIe + { + public: // Methods + + // Constructors and destructor + + /** + * C++ default constructor. + */ + HssScanInfoIe(); + + /** + * Destructor. + */ + virtual ~HssScanInfoIe(); + + // New methods + + /** + * Parses the given scan information and returns the security + * mode of the access point. + * @param info Scan information to be parsed. + * @return Security mode of the access point. + */ + HssSecurityMode SecurityMode( + HssScanInfo& info ); + + private: // Methods + + /** + * Checks whether the given memory buffers are equal. + * + */ + int Compare( + const unsigned char* pl, + int ll, + const unsigned char* pr, + int rl ); + + /** + * Checks whether the given information element defines + * the expected key management suite. + */ + TBool IsKeyManagement( + HssScanInfoIeType ie_type, + HssScanInfoIeKeyManagement key_type, + TUint8 ie_length, + const TUint8* ie_data + ); + + /** + * Checks whether the given information element defines + * valid ciphers suites for WPA2. + */ + TBool IsWpa2Ciphers( + HssScanInfoIeType ie_type, + TUint8 ie_length, + const TUint8* ie_data + ); + + // Prohibit copy constructor if not deriving from CBase. + HssScanInfoIe( + const HssScanInfoIe& ); + // Prohibit assigment operator if not deriving from CBase. + HssScanInfoIe& operator= ( + const HssScanInfoIe& ); + }; + +#endif // HssSCANINFOIE_H diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/hssscanlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/hssscanlist.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2002-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: Declaration of the ScanList class +* +*/ + + + + +#ifndef HSSSCANLIST_H +#define HSSSCANLIST_H + +#include + +const TUint32 HSS_SCAN_LIST_DATA_SIZE = 8000; ///< HssScanList container size (bytes) +const TUint32 HSS_APPEND_FAILED_NO_MEMORY = 0; ///< Return value for Append function. + +const TUint16 HSS_MANDATORY_IE_LIST_SIZE = 3; +const TUint8 HSS_MANDATORY_IE_LIST[] = { 0, 1, 3 }; + +typedef TUint8 HssScanFrame; + +/** +* Container class for delivering scan results. +*/ +class HssScanList +{ + +friend class HssScanListIterator; +friend class HssCScanTimer; + +public: // Methods + + // Constructors and destructor + + /** + * C++ default constructor. + */ + HssScanList(); + + /** + * Returns the number of access points the instance contains. + * @return the number of access points the instance contains. + */ + inline TUint32 Count() const; + + /** + * Appends one access point to list. + * @param size size of the accces point frame to be appended. + * @param data_pointer pointer to the frame. + * @return HSS_APPEND_FAILED_NO_MEMORY if there is not enough space otherwise + * the new size of the list. + */ + TUint32 Append(TUint32 size, const HssScanFrame* data_pointer); + + /** + * Returns the size of the list. + * @return the size of the list. + */ + inline TUint32 Size() const; + + /** + * Returns the size of the container. + * @return the size of the container. + */ + inline TUint32 MaxSize() const; + + /** + * Clears the list. + */ + inline void ClearAll(); + + /** + * The scan result's alignment should be four bytes. This method returns + * the size with needed padding. + * @param size Size of added data. + * @return Total size with additional padding. + */ + inline static TUint32 AddPadding( TInt size ); + +private: // Methods + + // Prohibit copy constructor. + HssScanList( const HssScanList& ); + + /** + * Appends one acces point to list variables, but does not do the actual + * copying. + * @param size The size of added memory block in bytes. + * @return The new size of the list. + */ + TUint32 Append( unsigned long size ); + + /** + * Check that the appended data is valid, i.e. it has all mandatory + * fields included. Once more: the data being checked has to be in + * the buffer (iData). + * @param data Pointer to the beginning of the data being appended. + * @return True if data can be append, False if it should be rejected. + */ + TBool CheckData( HssScanFrame* data ) const; + +private: // Data + + TUint8 data_m[HSS_SCAN_LIST_DATA_SIZE]; ///< Data Container (~4kB). + TUint32 count_m; ///< Number of access points. + TUint32 size_m; ///< Used bytes. +}; + +#include "hssscanlist.inl" + +#endif // HssSCANLIST_H diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/hssscanlist.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/hssscanlist.inl Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2002-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 HssScanList inline methods. +* +*/ + + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint32 HssScanList::Count() const +{ + return count_m; +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint32 HssScanList::Size() const +{ + return size_m; +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint32 HssScanList::MaxSize() const +{ + return HSS_SCAN_LIST_DATA_SIZE; +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void HssScanList::ClearAll() +{ + count_m = 0; + size_m = 0; +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint32 HssScanList::AddPadding( TInt size ) +{ + // Note! size&3 has the same result than size%4 + return ( size&3 ) ? size + ( 4 - size&3 ) : size; +} diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/hssscanlistiterator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/hssscanlistiterator.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2002-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: Declaration of the ScanListIterator class +* +*/ + + + +#ifndef HSSSCANLISTITERATOR_H +#define HSSSCANLISTITERATOR_H + +#include "hssscanlist.h" + +class HssScanList; + +/** +* Iterator for TScanList. +*/ +class HssScanListIterator +{ +public: + + /** + * Return the size of the scan info. The size includes Status Info, + * MAC header and Frame Body. + * @return The size of the scan info in bytes. + */ + inline TUint16 Size() const; + + /** + * 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 HssScanFrame* 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 HssScanFrame* Next(); + + /** + * Find the data of the current access point. + * @return Pointer at the beginning of the current access point stored + * in the scan list. NULL if not any. + */ + const HssScanFrame* Current() const; + + /** + * Find is there any more unhandled access points. + * @return False if there is access points in the list left, + * True if not. + */ + TBool IsDone() const; + +protected: // Methods + + /** + * C++ default constructor. + * + * Constructor is protected, so, class has to be inherited before use. + */ + explicit HssScanListIterator( const HssScanList& scan_list ); + + +private: //Methods + + // Prohibit copy constructor if not deriving from CBase. + HssScanListIterator( const HssScanListIterator& ); + // Prohibit assigment operator if not deriving from CBase. + HssScanListIterator& operator= ( const HssScanListIterator& ); + +protected: // Data + /** Pointer to the beginning of the current item. */ + const HssScanFrame* current_m; + +private: // Data + /** Information about scanned WLAN networks. */ + const HssScanList& scan_list_m; +}; + +#include "hssscanlistiterator.inl" + +#endif // HssSCANLISTITERATOR_H diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/hssscanlistiterator.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/hssscanlistiterator.inl Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2002-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 ScanListIterator inline methods. +* +*/ + + + +#include "hssscanoffsets.h" + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 HssScanListIterator::Size() const +{ + return static_cast( CNTRL_HEADER_LEN + + *( reinterpret_cast( current_m + LENGTH_OFFSET ) ) ); +} diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/hssscanoffsets.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/hssscanoffsets.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2002-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: Definition of scan frame offsets. +* +*/ + + + +#ifndef HSSSCANOFFSETS_H +#define HSSSCANOFFSETS_H + +#include "802dot11.h" + +// Offsets for the static header. +const TUint32 RX_LEVEL_OFFSET = 0; // 0 +const TUint32 RX_SNR_OFFSET = RX_LEVEL_OFFSET + sizeof(TUint32); // 4 + +// Offsets for scan results. +const TUint32 LENGTH_OFFSET = RX_SNR_OFFSET + sizeof(TUint32); // 8 + +// length of the control information proceeding the DOT11 header (DOT11_BASE_OFFSET) +const TUint32 CNTRL_HEADER_LEN = 12; + +const TUint32 DOT11_BASE_OFFSET = CNTRL_HEADER_LEN; +// start of BSSID +const TUint32 BSSID_OFFSET = DOT11_BASE_OFFSET + 16; +// start of first IE in beacon of the probe response +const TUint32 BODY_OFFSET = DOT11_BASE_OFFSET + sizeof(SManagementFrameHeader) + + KTimeStampFixedFieldLength + + KBeaconIntervalFixedFieldLength + + KCapabilityInformationFixedFieldLength; + +const TUint32 BEACON_INTERVAL_OFFSET = DOT11_BASE_OFFSET + + sizeof(SManagementFrameHeader) + + KTimeStampFixedFieldLength; +const TUint32 CAPABILITY_OFFSET = BEACON_INTERVAL_OFFSET + KBeaconIntervalFixedFieldLength; + +// start of timestamp field +const TUint32 TIMESTAMP_OFFSET = DOT11_BASE_OFFSET + sizeof(SManagementFrameHeader); + +// Offsets for the static header. +const TUint16 x30RX_LEVEL_OFFSET = 13; +const TUint16 x30RX_SNR_OFFSET = 12; +//const TUint16 FRAME_CNTRL_OFFSET = 12; +const TUint16 x30BSSID_OFFSET = 0; +const TUint16 x30BEACON_INTERVAL_OFFSET = 52; +const TUint16 x30CAPABILITY_OFFSET = 54; +const TUint16 x30STATUS_INFO_LENGTH = 12; +// Offsets for scan results. +const TUint16 x30LENGTH_OFFSET = 62; +const TUint16 x30BODY_OFFSET = 64 + x30STATUS_INFO_LENGTH; +#endif // HSSSCANOFFSETS_H diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/inc/pack.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/inc/pack.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2002-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: Pack macros for WLAN +* +*/ + + + + +#ifndef PACK_H +#define PACK_H + +#ifdef __PACKED + #undef __PACKED +#endif //__PACKED + +#define __PACKED + +#endif // PACK_H diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/src/hotspotserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/src/hotspotserver.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,711 @@ +/* +* Copyright (c) 2002-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 HotSpot Plugin Server +* +*/ + + + + + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "hotspotserver.h" +#include "am_debug.h" +#include "hotspotsession.h" +#include "hssclientplugin.h" +#include "hssiapsettingshandler.h" + +// LOCAL FUNCTION PROTOTYPES +GLDEF_C TInt E32Main(); + +using namespace CMManager; + +// CONSTANTS +// Panic codes for HotSpot server +const TInt KHotSpotPanicCleanupStackCreationFailed = 1; +const TInt KHotSpotPanicOpenSemaforeFailed = 2; +const TInt KHotSpotPanicCreationOfSchedulerFailed = 3; + +// Default timeout values + +const TUint KMillion = 1000000; +const TUint KHssDefaultLoginTimeMicroSecs = 180 * KMillion; // 180 seconds (3 mins) +const TUint KHssMinLoginTime = 5; // 5 seconds +const TUint KHssMaxLoginTime = 1200; // 1200 seconds (20 mins) +const TUint KHssDefaultLogoutTimeMicroSecs = 12 * KMillion; // 12 seconds +const TUint KHssMinLogoutTime = 1; // 1 seconds +const TUint KHssMaxLogoutTime = 30; // 30 seconds + +// Panic category of HotSpot server +_LIT( KHotSpotModuleName, "HOTSPOTSRV" ); + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// RunServerL +// ----------------------------------------------------------------------------- +// +static void RunServerL() + { + User::LeaveIfError( User::RenameThread( KHotSpotServerName ) ); + + CActiveScheduler* s=new(ELeave) CActiveScheduler; + if ( !s ) + { + User::Panic( KHotSpotModuleName, KHotSpotPanicCreationOfSchedulerFailed ); + } + CleanupStack::PushL(s); + CActiveScheduler::Install(s); + + CHotSpotServer::NewLC(); // Is NewLC: Server was pushed into cleanup stack. + + RSemaphore started; + TInt err = started.CreateGlobal( KHotSpotServerSemaphore, 0 ); + if ( err != KErrNone ) + { + err = started.OpenGlobal( KHotSpotServerSemaphore ); + } + + __ASSERT_ALWAYS( + err == KErrNone, + User::Panic( KHotSpotModuleName, KHotSpotPanicOpenSemaforeFailed ) + ); + + // lets everyone know that the thread is ready to deal with requests + RProcess::Rendezvous(KErrNone); + + started.Signal(); + started.Close(); + + DEBUG("**** HotspotServer: server fully running"); + CActiveScheduler::Start(); + CleanupStack::PopAndDestroy( 2, s ); // Cleanup both server and scheduler + REComSession::FinalClose(); + } + +// ----------------------------------------------------------------------------- +// PanicClient +// ----------------------------------------------------------------------------- +// +void PanicClient(const RMessagePtr2& aMessage,THotspotPanic aPanic) + { + _LIT(KPanic,"HotspotServer"); + aMessage.Panic(KPanic,aPanic); + } + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CHotSpotServer +// ----------------------------------------------------------------------------- +// +CHotSpotServer::CHotSpotServer() + :CPolicyServer( EPriorityStandard, THotSpotServerPlatSecPolicy, ESharableSessions ) + { + } + +// ----------------------------------------------------------------------------- +// NewLC +// ----------------------------------------------------------------------------- +// +CHotSpotServer* CHotSpotServer::NewLC() + { + DEBUG("**** HotSpotServer: CHotSpotServer::NewLC"); + CHotSpotServer* self = new(ELeave) CHotSpotServer; + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// ~CHotSpotServer +// ----------------------------------------------------------------------------- +// +CHotSpotServer::~CHotSpotServer() + { + DEBUG("**** HotSpotServer: CHotSpotServer::~CHotSpotServer"); + + iMap.Close(); + iNotificationArray.Close(); + iLoginLogoutTimerArray.Close(); + + if ( iMgtClient != NULL ) + { +#ifndef __WINS__ + iMgtClient->CancelNotifications(); +#endif + delete iMgtClient; + } + iMgtClient = NULL; + + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CHotSpotServer::ConstructL() + { + + DEBUG("**** HotSpotServer: CHotSpotServer::ConstructL"); + StartL( KHotSpotServerName ); + + iIapCheckValue = EFalse; + iLogoutSent = EFalse; + iLoginValue = ETrue; + iAssociationValue = EFalse; + +#ifndef __WINS__ + + // Change config daemon for Easy WLAN access point + iConfigDaemonChanged = KErrNone; + TBool retVal( EFalse ); + iEasyWlanId = KEasyWlanServiceId; // Set to default value + TRAPD( leave, retVal = EasyWlanIdL() ); + if ( KErrNone != leave ) + { + iConfigDaemonChanged = leave; + } + if ( !retVal ) + { + iConfigDaemonChanged = KErrGeneral; + } + DEBUG1("**** HotSpotServer: CHotSpotServer::ConstructL iConfigDaemonChanged: %d", iConfigDaemonChanged ); +#endif + // Activate notifications for IAP check purposes + // When EWlanConnectionModeNotConnected is received we can cancel this and + // we know that it safe to go through IAPs. + iMgtClient = CWlanMgmtClient::NewL(); +#ifndef __WINS__ + iMgtClient->ActivateNotificationsL( *this ); +#endif + } + +// ----------------------------------------------------------------------------- +// ConnectionStateChanged +// ----------------------------------------------------------------------------- +// +void CHotSpotServer::ConnectionStateChanged( TWlanConnectionMode aNewState ) + { + DEBUG1( "CHotSpotServer::ConnectionStateChanged() aNewState=%d", aNewState ); + if ( aNewState == EWlanConnectionModeNotConnected ) + { + if ( iMgtClient != NULL ) + { +#ifndef __WINS__ + iMgtClient->CancelNotifications(); +#endif + DEBUG("CHotSpotServer::ConnectionStateChanged2"); + } + + TRAPD(err, CheckIapsL()); + if ( err != KErrNone ) + { + DEBUG1("CHotSpotServer::ConnectionStateChanged(): %d", err); + } + if ( iConfigDaemonChanged != KErrNone ) + { + // ConstructL call leaved. Let's call again once more. + TRAP_IGNORE( EasyWlanIdL() ); + } + } + } + +// ----------------------------------------------------------------------------- +// CheckIapsL +// ----------------------------------------------------------------------------- +// +void CHotSpotServer::CheckIapsL() + { + DEBUG("CHotSpotServer::CheckIapsL"); + + _LIT(KMarkFirst, "[" ); + _LIT(KMarkLast, "]" ); + // This is needed to be checked only once per boot + if ( iIapCheckValue == EFalse ) + { + iIapCheckValue = ETrue; + + RCmManagerExt cmManager; + cmManager.OpenL(); + CleanupClosePushL(cmManager); + + TBool supportedBearersOnly = ETrue; + TBool legacyCmsOnly = EFalse; + + RArray cmArray; + CleanupClosePushL( cmArray ); + + cmManager.ConnectionMethodL( cmArray, supportedBearersOnly, legacyCmsOnly ); + DEBUG1("CHotSpotServer::CheckIapsL count: %d", cmArray.Count()); + for( TInt i = 0; i < cmArray.Count(); i++ ) + { + RCmConnectionMethodExt cm; + TRAPD( err, cm = cmManager.ConnectionMethodL( cmArray[i] ) ); + DEBUG1("CHotSpotServer::CheckIapsL: err %d", err ); + if ( KErrNone == err ) + { + HBufC* client( NULL ); + TRAPD( errr, client = cm.GetStringAttributeL( EWlanServiceExtensionTableName )); + DEBUG1("CHotSpotServer::CheckIapsL: errr %d", errr ); + if( KErrNone == errr ) + { + TBuf clientUid; + TUid uid(TUid::Null()); + + clientUid.Copy( client->Des() ); + delete client; + TInt indx = clientUid.Find( KMarkFirst ); + if ( KErrNotFound != indx ) + { + DEBUG("CHotSpotServer::CheckIapsL Client is found"); + clientUid.Delete( indx, 1 ); + indx = clientUid.Find( KMarkLast ); + if ( KErrNotFound != indx ) + { + clientUid.Delete( indx, 1 ); + } + // Convert TBuf to TUid + TLex lex( clientUid ); + TUint value( 0 ); + User::LeaveIfError( lex.Val( value, EHex ) ); + uid.iUid = value; + + // Try to find if 3rd party client exists. + // Delete IAP if no client. + CHssClientPlugin* plugin(NULL); + TBuf8 nullBuf; + TRAPD( error, plugin = CHssClientPlugin::NewL( uid, nullBuf ) ); + delete plugin; + + DEBUG1("CHotSpotServer::CheckIapsL find client error: %d", error ); + if ( error == KErrNotFound ) + { + cm.DeleteL(); + } + } + } + } + DEBUG("CHotSpotServer::CheckIapsLOK"); + } + CleanupStack::PopAndDestroy( &cmArray ); + CleanupStack::PopAndDestroy( &cmManager ); + } + DEBUG("CHotSpotServer::CheckIapsL Done"); + } + +// ----------------------------------------------------------------------------- +// NewSessionL +// ----------------------------------------------------------------------------- +// +CSession2* CHotSpotServer::NewSessionL( const TVersion& aVersion, + const RMessage2& /* aMessage */ ) const + { + TVersion version( KHotSpotMajorVersionNumber, + KHotSpotMinorVersionNumber, + KHotSpotBuildVersionNumber ); + + if ( !User::QueryVersionSupported( version, aVersion ) ) + { + User::Leave( KErrNotSupported ); + } + + DEBUG("**** CHotSpotServer::NewSessionL"); + CHotSpotSession* session = + CHotSpotSession::NewL( const_cast( *this ) ); + return session; + } + +// --------------------------------------------------------- +// NotifyAdd +// --------------------------------------------------------- +// +void CHotSpotServer::NotifyAdd( + CNotificationBase& aNotification ) + { + DEBUG( "CHotSpotServer::NotifyAdd()" ); + iNotificationArray.Insert( &aNotification, 0 ); + } + +// --------------------------------------------------------- +// NotifyRemove +// --------------------------------------------------------- +// +void CHotSpotServer::NotifyRemove( + CNotificationBase& aNotification ) + { + DEBUG( "CHotSpotServer::NotifyRemove()" ); + TInt index = iNotificationArray.Find( &aNotification ); + iNotificationArray.Remove( index ); + } + +// ----------------------------------------------------------------------------- +// SaveMessage +// ----------------------------------------------------------------------------- +// +TInt CHotSpotServer::SaveMessage( TUint aIapId, const RMessage2& aMessage, + THotSpotCommands aCommand ) + { + DEBUG("**** HotspotServer: SaveMessage"); + TInt ret( KErrNone ); + SRequestMapEntry entry; + entry.iMessage = aMessage; + entry.iFunction = aCommand; + entry.iIapId = aIapId; + ret = iMap.Append(entry); + return ret; + } + +// ----------------------------------------------------------------------------- +// CompleteMessage +// ----------------------------------------------------------------------------- +// +void CHotSpotServer::CompleteMessage( TInt aIndex, TInt aResult ) + { + DEBUG("**** HotspotServer: CompleteMessage"); + SRequestMapEntry entry = iMap[aIndex]; + + RMessagePtr2 message = entry.iMessage; + message.Complete( aResult ); + iMap.Remove( aIndex ); + } + +// ----------------------------------------------------------------------------- +// EditMessage +// ----------------------------------------------------------------------------- +// +TInt CHotSpotServer::EditMessage( TInt aIndex, TPckg& aData) + { + DEBUG("**** HotspotServer: EditMessage"); + TInt ret( KErrNone ); + + iMap[aIndex].iMessage.Write(0, aData); + + DEBUG1("**** HotspotServer: EditMessage ret: %d", ret); + return ret; + } + + +// ----------------------------------------------------------------------------- +// FindMessage +// ----------------------------------------------------------------------------- +// +TInt CHotSpotServer::FindMessage( TUint aIapId, THotSpotCommands aCommand ) + { + DEBUG("**** HotspotServer: FindMessage"); + TInt ret( KErrNotFound ); + SRequestMapEntry entry; + + for ( TInt i = 0; i < iMap.Count(); i++ ) + { + entry = iMap[i]; + if ( ( entry.iFunction == aCommand ) && ( entry.iIapId == aIapId ) ) + { + // Correct message found + // Now stop loop and return index value, so that CompeteMessage can + // be called with that + ret = i; + i = iMap.Count(); + } + } + DEBUG1("**** HotspotServer: FindMessage ret: %d", ret); + return ret; + } + +// ----------------------------------------------------------------------------- +// SetLogoutFlag +// ----------------------------------------------------------------------------- +// +void CHotSpotServer::SetLogoutFlag( TBool aValue ) + { + DEBUG("HotspotServer::SetLogoutFlag"); + iLogoutSent = aValue; + } + +// ----------------------------------------------------------------------------- +// GetLogoutFlagValue +// ----------------------------------------------------------------------------- +// +TBool CHotSpotServer::GetLogoutFlagValue() + { + DEBUG("HotspotServer::GetLogoutFlagValue()"); + return iLogoutSent; + } + +// ----------------------------------------------------------------------------- +// SetLoginFlag +// ----------------------------------------------------------------------------- +// +void CHotSpotServer::SetLoginFlag( TBool aValue ) + { + DEBUG("HotspotServer::SetLoginFlag"); + iLoginValue = aValue; + } + +// ----------------------------------------------------------------------------- +// GetLoginFlagValue +// ----------------------------------------------------------------------------- +// +TBool CHotSpotServer::GetLoginFlagValue() + { + DEBUG("HotspotServer::GetLoginFlagValue()"); + return iLoginValue; + } + + +// ----------------------------------------------------------------------------- +// SetAssociationFlag +// ----------------------------------------------------------------------------- +// +void CHotSpotServer::SetAssociationFlag( TBool aValue ) + { + DEBUG("HotspotServer::SetAssociationFlag"); + iAssociationValue = aValue; + } + +// ----------------------------------------------------------------------------- +// GetAssociationFlagValue +// ----------------------------------------------------------------------------- +// +TBool CHotSpotServer::GetAssociationFlagValue() + { + DEBUG("HotspotServer::GetAssociationFlagValue()"); + return iAssociationValue; + } + +// ----------------------------------------------------------------------------- +// SetServiceId +// ----------------------------------------------------------------------------- +// +void CHotSpotServer::SetServiceId( TInt aServiceId ) + { + DEBUG("HotspotServer::SetServiceId"); + iCurrentServiceIdInUse = aServiceId; + } + +// ----------------------------------------------------------------------------- +// GetServiceId +// ----------------------------------------------------------------------------- +// +TInt CHotSpotServer::GetServiceId() + { + DEBUG("HotspotServer::GetServiceId()"); + return iCurrentServiceIdInUse; + } + +// ----------------------------------------------------------------------------- +// RunError +// ----------------------------------------------------------------------------- +// +TInt CHotSpotServer::RunError( TInt aError ) + { + // error from CHotSpotSession::ServiceL + Message().Complete( aError ); + // Continue reading client requests + ReStart(); + return (KErrNone); + } + +// ----------------------------------------------------------------------------- +// EasyWlanIdL +// ----------------------------------------------------------------------------- +// +TBool CHotSpotServer::EasyWlanIdL() + { + TBool ret( EFalse ); + DEBUG("CHotSpotServer::EasyWlanIdL()"); + RCmManagerExt cmManager; + cmManager.OpenL(); + CleanupClosePushL( cmManager ); + + iEasyWlanId = cmManager.EasyWlanIdL(); + DEBUG1("CHotSpotServer::EasyWlanIdL() ret: % d", iEasyWlanId); + // if iEasyWlanId is 0, then it was not found + if ( iEasyWlanId > 0 ) + { + RCmConnectionMethodExt plugin = cmManager.ConnectionMethodL( iEasyWlanId ); + CleanupClosePushL( plugin ); + //iEasyWlanId = plugin.GetIntAttributeL( /*ECmIapServiceId*/EWlanServiceId ) + plugin.SetStringAttributeL( ECmConfigDaemonManagerName, KHotSpotPlugin ); + // commit changes + plugin.UpdateL(); + CleanupStack::PopAndDestroy( &plugin ); // Close() called on "plugin" + ret = ETrue; + } + CleanupStack::PopAndDestroy( &cmManager ); + DEBUG("CHotSpotServer::EasyWlanIdL() DONE"); + return ret; + } + +// ----------------------------------------------------------------------------- +// GetEasyWlanId +// ----------------------------------------------------------------------------- +// +TUint32 CHotSpotServer::GetEasyWlanId() + { + return iEasyWlanId; + } + +// ----------------------------------------------------------------------------- +// GetLoginTimerMicroSecs +// ----------------------------------------------------------------------------- +// +TUint CHotSpotServer::GetLoginTimeMicroSecs( TUid aClientUid ) + { + // Default timer value will be returned if matching client UID isn't found. + TUint retval = KHssDefaultLoginTimeMicroSecs ; + + TInt ret = CHotSpotServer::FindClientUid( aClientUid ); + if (ret != KErrNotFound) + { + // ret is the matching element's index. + retval = iLoginLogoutTimerArray[ret].loginTimeMicroSecs; + } + + return retval; + } + +// ----------------------------------------------------------------------------- +// GetLogoutTimerMicroSecs +// ----------------------------------------------------------------------------- +// +TUint CHotSpotServer::GetLogoutTimeMicroSecs( TUid aClientUid ) + { + // Default timer value will be returned if matching client UID isn't found. + TUint retval = KHssDefaultLogoutTimeMicroSecs ; + + TInt ret = CHotSpotServer::FindClientUid( aClientUid ); + if (ret != KErrNotFound) + { + // ret is the matching element's index. + retval = iLoginLogoutTimerArray[ret].logoutTimeMicroSecs; + } + + return retval; + } + +// ----------------------------------------------------------------------------- +// SetTimerValues +// ----------------------------------------------------------------------------- +// +void CHotSpotServer::SetTimerValues( + TUid aClientUid, + TUint aLoginTimerValue, // in seconds + TUint aLogoutTimerValue ) // in seconds + { + TInt ret = CHotSpotServer::FindClientUid( aClientUid ); + TUint loginTimeMicroSecs = KHssDefaultLoginTimeMicroSecs ; + TUint logoutTimeMicroSecs = KHssDefaultLogoutTimeMicroSecs ; + + // Check that values are in bounds and modify them into micro seconds. + if( aLoginTimerValue >= KHssMinLoginTime && + aLoginTimerValue <= KHssMaxLoginTime ) + { + loginTimeMicroSecs = KMillion * aLoginTimerValue; + } + + if( aLogoutTimerValue >= KHssMinLogoutTime && + aLogoutTimerValue <= KHssMaxLogoutTime ) + { + logoutTimeMicroSecs = KMillion * aLogoutTimerValue; + } + + if (ret != KErrNotFound) + { + DEBUG("CHotSpotServer::SetTimerValues(): Existing client modified."); + // ret is the matching element's index. + iLoginLogoutTimerArray[ret].loginTimeMicroSecs = loginTimeMicroSecs; + iLoginLogoutTimerArray[ret].logoutTimeMicroSecs = logoutTimeMicroSecs; + } + else + { + DEBUG("CHotSpotServer::SetTimerValues(): New Client added."); + // Create a new element and append it to the array. + const SLoginLogoutTimers addedElement = { + aClientUid, + loginTimeMicroSecs, + logoutTimeMicroSecs }; + iLoginLogoutTimerArray.Append( addedElement ); + } + } + +// ----------------------------------------------------------------------------- +// FindClientUid +// ----------------------------------------------------------------------------- +// +TInt CHotSpotServer::FindClientUid( TUid aClientUid ) + { + TInt count = iLoginLogoutTimerArray.Count(); + TInt i = 0; + TInt ret = KErrNotFound; + + while (i < count) + { + if (aClientUid == iLoginLogoutTimerArray[i].clientUid) + { + ret = i; + break; + } + i++; + } + + return ret; + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// E32Main implements the executable entry function. +// Note that because the target type of the IPWServer Hss +// is EXEDLL, the entry point has different signature depending +// on the build platform. +// Creates a cleanup stack and runs the server. +// Returns: Zero +// ----------------------------------------------------------------------------- +// +GLDEF_C TInt E32Main() + { + __UHEAP_MARK; + DEBUG("**** HotspotServer: E32Main"); + CTrapCleanup* cleanup=CTrapCleanup::New(); + TInt r=KErrNoMemory; + if (cleanup) + { + TRAP(r,RunServerL()); + delete cleanup; + } + else + { + User::Panic( KHotSpotModuleName, KHotSpotPanicCleanupStackCreationFailed ); + } + __UHEAP_MARKEND; + return r; + } + +// end of file diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/src/hotspotsession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/src/hotspotsession.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,1207 @@ +/* +* Copyright (c) 2002-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 HotSpot Server Session +* +*/ + + + +// INCLUDE FILES +#include "hotspotserver.h" +#include "hotspotsession.h" +#include "hssnotif.h" +#include "hsslogintimer.h" +#include "hsslogouttimer.h" +#include +#include +#include +#include "e32std.h" +#include "am_debug.h" +#include +#include "hssclientinterface.h" +#include +#include + +// Forward declarations +class CWlanMgmtClient; +class MWlanMgmtNotifications; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CHotSpotPluginSession +// ----------------------------------------------------------------------------- +// +CHotSpotSession::CHotSpotSession( CHotSpotServer& aServer ) : + iServer( aServer ), iClient( NULL ), iSrvNotifications ( NULL ), + iNotificationHandle( NULL ), iAllowNotifications( ETrue ), iHotspotExtension( ETrue ) + { + + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CHotSpotSession::ConstructL() + { + DEBUG( "CHotSpotSession::ConstructL()" ); + iIapSettingsHandler = CHssIapSettingsHandler::NewL(); + iLoginTimer = CHssLoginTimer::NewL( *this ); + iLogoutTimer = CHssLogoutTimer::NewL( *this ); + + iMgtClient = CWlanMgmtClient::NewL(); + + iRepository = CRepository::NewL( KCRUidInternetConnectivitySettings ); + } + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +CHotSpotSession* CHotSpotSession::NewL( CHotSpotServer& aServer ) + { + CHotSpotSession* self = new( ELeave ) CHotSpotSession( aServer ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); // Should this class have a 2-way constructor? + return self; + } + +// ---------------------------------------------------------------------------------------- +// ~CHotSpotSession +// ---------------------------------------------------------------------------------------- +// +CHotSpotSession::~CHotSpotSession() + { + DEBUG( "CHotSpotSession::~CHotSpotSession()" ); + iPendingNotifications.Close(); + if ( iMgtClient != NULL ) + { + iMgtClient->CancelNotifications(); + delete iMgtClient; + } + iMgtClient = NULL; + + if ( iIapSettingsHandler != NULL ) + { + delete iIapSettingsHandler; + } + iIapSettingsHandler = NULL; + + + if ( iClient != NULL ) + { + delete iClient; + } + iClient = NULL; + + if ( iNotifications != NULL ) + { + delete iNotifications; + } + iNotifications = NULL; + + if ( iLoginTimer != NULL ) + { + iLoginTimer->Cancel(); + delete iLoginTimer; + } + iLoginTimer = NULL; + + if ( iLogoutTimer != NULL ) + { + iLogoutTimer->Cancel(); + delete iLogoutTimer; + } + iLogoutTimer = NULL; + + if ( iRepository != NULL ) + { + delete iRepository; + } + iRepository = NULL; + + if ( iIcts != NULL ) + { + delete iIcts; + } + iIcts = NULL; + DEBUG( "CHotSpotSession::~CHotSpotSession() Done" ); + } + +// ---------------------------------------------------------------------------------------- +// ServiceL +// ---------------------------------------------------------------------------------------- +// +void CHotSpotSession::ServiceL( const RMessage2& aMessage ) + { + DEBUG1( "CHotSpotSession::ServiceL message: %d", aMessage.Function() ); + TRAPD( err, DispatchMessageL( aMessage) ); + if (err != KErrNone) + { + // Something went wrong. Complete message to let + // the client to continue + aMessage.Complete(err); + } + } +// ---------------------------------------------------------------------------------------- +// ServiceL +// ---------------------------------------------------------------------------------------- +// +void CHotSpotSession::DispatchMessageL( const RMessage2& aMessage ) + { + DEBUG( "CHotSpotSession::DispatchMessageL()" ); + TUint value1(NULL); + TInt value2(NULL); + TInt err(KErrNone); + TInt indx(KErrNone); + TPckgBuf iapPackage( iIapId ); + + switch ( aMessage.Function() ) + { + case EHssActivateNotifications : + iAllowNotifications = EFalse; + DEBUG( "CHotSpotSession::ActivateNotificationsL" ); + if ( iNotifications == NULL ) + { + DEBUG( "CHotSpotSession::DispatchMessageL activated !!!" ); + iNotifications = new (ELeave) HssNotifications(*this); + iMgtClient->ActivateNotificationsL( *iNotifications ); + } + HandleOrderNotifications( aMessage ); + break; + case EHssCancelNotifications : + iAllowNotifications = EFalse; + DEBUG( "CHotSpotSession::CancelNotifications" ); + iMgtClient->CancelNotifications( ); + if ( iNotifications != NULL ) + { + delete iNotifications; + } + iNotifications = NULL; + HandleCancelNotifications( aMessage ); + break; + case EHssGetScanResults : + // Handled now in client side. Left here for future use. + break; + case EHssRegister : + ProcessRegisterL( aMessage ); + break; + case EHssUnRegister : + ProcessUnRegisterL( aMessage ); + break; + case EHssJoin : + iAllowNotifications = EFalse; + // IAP id + value1 = ( TInt )aMessage.Int0(); + iIapId = value1; + indx = iServer.FindMessage(value1, EHssStart ); + if ( indx >= 0 ) + { + iServer.CompleteMessage( indx , KErrNone ); + } + else + { + indx = iServer.FindMessage(value1, EHssStartAgain ); + if ( indx >= 0 ) + { + iServer.CompleteMessage( indx , KErrNone ); + } + } + aMessage.Complete( KErrNone ); + break; + case EHssCancelStart : + iServer.SetLogoutFlag( ETrue ); + // Do not send association status to client + iServer.SetAssociationFlag( EFalse ); + // IAP id + iIapId = ( TInt )aMessage.Int0(); + indx = iServer.FindMessage(iIapId, EHssStart ); + if ( indx >= 0 ) + { + iServer.CompleteMessage( indx , KErrAbort); + } + else + { + indx = iServer.FindMessage(iIapId, EHssStartAgain ); + if ( indx >= 0 ) + { + iServer.CompleteMessage( indx , KErrAbort ); + } + } + + aMessage.Complete( KErrNone ); + break; + case EHssStop : + iAllowNotifications = EFalse; + iServer.SetLogoutFlag( ETrue ); + + iLoginTimer->Cancel(); + iLogoutTimer->Cancel(); + // IAP id + value1 = ( TInt )aMessage.Int0(); + for (TInt counter = EHssGetScanResults; counter = 0 ) + { + iServer.CompleteMessage( indx , KErrCancel); + } + } + + aMessage.Complete( KErrNone ); + break; + case EHssLoginComplete : + iAllowNotifications = EFalse; + // IAP id + value1 = ( TInt )aMessage.Int0(); + // ret value + value2 = ( TInt )aMessage.Int1(); + + iLoginTimer->Cancel(); + + DEBUG1( "EHssLoginComplete value2: %d", value2 ); + indx = iServer.FindMessage( value1, EHssStartLogin ); + if ( KErrNotFound != indx ) + { + if (value2 == KErrNone) + { + DEBUG( "EHssLoginComplete1" ); + iServer.CompleteMessage( indx, KErrNone ); + } + else + { + DEBUG( "EHssLoginComplete2" ); + iServer.CompleteMessage( indx, KErrCancel ); + iServer.SetLogoutFlag( ETrue ); + } + + } + + aMessage.Complete( KErrNone ); + break; + case EHssLogoutComplete : + iAllowNotifications = EFalse; + iLogoutTimer->Cancel(); + + // IAP id + value1 = ( TInt )aMessage.Int0(); + + indx = iServer.FindMessage( value1, EHssCloseConnection ); + if ( KErrNotFound != indx ) + { + iServer.CompleteMessage( indx, KErrNone ); + } + + aMessage.Complete( KErrNone ); + break; + case EHssStartLogin : + // Do not send association status, since it's already done. + iServer.SetAssociationFlag( EFalse ); + // IAP id + iIapId = ( TInt )aMessage.Int0(); + // Network id + iNetId = ( TInt )aMessage.Int1(); + err = iServer.SaveMessage( iIapId, aMessage, EHssStartLogin ); + if ( KErrNone != err ) + { + aMessage.Complete( err ); + } + else + { + err = ProcessStartLoginL( iIapId, iNetId ); + // If client not found, an error was returned. + // Otherwise message completed elsewhere. + if ( KErrNone != err ) + { + indx = iServer.FindMessage(iIapId, EHssStartLogin ); + if ( indx >= 0 ) + { + iServer.CompleteMessage( indx , KErrNone ); + } + else + { + aMessage.Complete( KErrNone ); + } + } + } + break; + case EHssCancelLogin : + iLoginTimer->Cancel(); + // if client doesn't exist (is NULL), Login(.) has not been + // called to client -> that is CancelLogin() not needed to call + if ( iClient != NULL ) + { + iClient->CancelLogin( iIapId ); + } + + indx = iServer.FindMessage(iIapId, EHssStartLogin ); + if ( indx >= 0 ) + { + iServer.CompleteMessage( indx , err ); + } + aMessage.Complete( KErrNone ); + break; + case EHssStart: + // IAP id + iServer.SetLoginFlag( ETrue ); + iIapId = ( TInt )aMessage.Int0(); + err = iServer.SaveMessage( iIapId, aMessage, EHssStart ); + if ( err != KErrNone) + { + aMessage.Complete( err ); + } + else + { + TRAPD( startLeaved, err = ProcessStartL( iIapId ) ); + + if ( startLeaved != KErrNone) + { + indx = iServer.FindMessage(iIapId, EHssStart ); + if ( indx >= 0 ) + { + iServer.CompleteMessage( indx , KErrNotSupported ); + } + else + { + aMessage.Complete( KErrNotSupported ); + } + } + + else if ( err != KErrNone) + { + indx = iServer.FindMessage(iIapId, EHssStart ); + if ( indx >= 0 ) + { + iServer.CompleteMessage( indx , KErrNotSupported ); + } + else + { + aMessage.Complete( KErrNotSupported ); + } + } + // else -> client is created and called + // WLAN agent waits for 30 seconds before continuing connection setup. + } + break; + case EHssStartAgain: + // IAP id + iServer.SetLoginFlag( ETrue ); + iIapId = ( TInt )aMessage.Int0(); + err = iServer.SaveMessage( iIapId, aMessage, EHssStartAgain ); + if ( err != KErrNone) + { + aMessage.Complete( err ); + } + else + { + err = ProcessStartAgain( iIapId ); + if ( err != KErrNone) + { + indx = iServer.FindMessage(iIapId, EHssStartAgain ); + if ( indx >= 0 ) + { + iServer.CompleteMessage( indx , err ); + } + else + { + aMessage.Complete( err ); + } + } + } + break; + + case EHssCancel: + iLoginTimer->Cancel(); + iLogoutTimer->Cancel(); + // IAP id + iIapId = ( TInt )aMessage.Int0(); + if ( iServer.GetAssociationFlagValue() ) + { + // We are in association phase and Agent failed it for some reason + ProcessAssociationStatus( iIapId, EFalse ); + } + + indx = iServer.FindMessage(iIapId, EHssStart ); + if ( indx >= 0 ) + { + iServer.CompleteMessage( indx , KErrCancel ); + } + indx = iServer.FindMessage(iIapId, EHssStartAgain ); + if ( indx >= 0 ) + { + iServer.CompleteMessage( indx , KErrCancel ); + } + indx = iServer.FindMessage(iIapId, EHssCloseConnection ); + if ( indx >= 0 ) + { + iServer.CompleteMessage( indx , KErrCancel ); + } + //Not needed to send Logout() + //iServer.SetLogoutFlag( ETrue ) + //ProcessCloseL( iIapId ) + aMessage.Complete( KErrNone ); + break; + + case EHssCloseConnection: + iLoginTimer->Cancel(); + iLogoutTimer->Cancel(); + + // IAP id + iIapId = ( TInt )aMessage.Int0(); + + if ( iServer.GetAssociationFlagValue() ) + { + // We are in association phase and Agent failed it for some reason + ProcessAssociationStatus( iIapId, EFalse ); + } + + err = iServer.SaveMessage( iIapId, aMessage, EHssCloseConnection ); + if ( KErrNone != err ) + { + aMessage.Complete( err ); + } + else + { + err = ProcessCloseL( iIapId ); + // If client not found, an error was returned. + // Otherwise message completed elsewhere. + if ( KErrNone != err ) + { + indx = iServer.FindMessage(iIapId, EHssCloseConnection ); + if ( indx >= 0 ) + { + iServer.CompleteMessage( indx , KErrNone ); + } + else + { + aMessage.Complete( KErrNone ); + } + } + } + break; + + case EHssServerShutdown: + ProcessServerShutdown( aMessage ); + break; + + case EHssGetIAP: + aMessage.WriteL( 0, iapPackage ); + aMessage.Complete( KErrNone ); + break; + + case EHssUiState: + ProcessUiState( aMessage ); + break; + case EHssStartBrowser: + { + TInt len = aMessage.GetDesLength( 0 ); + iIapId = ( TInt )aMessage.Int1(); + iNetId = ( TInt )aMessage.Int2(); + err = iServer.SaveMessage( iIapId, aMessage, EHssStartBrowser ); + HBufC* buf = HBufC::NewLC( len ); + TPtr ptr( buf->Des() ); + User::LeaveIfError( aMessage.Read( 0, ptr ) ); + + AuthenticateL( ptr ); + + CleanupStack::PopAndDestroy(buf); + } + break; + + case EHssSetTimerValues: + { + TUid clientUid( TUid::Uid( aMessage.Int0() ) ); + TUint loginTimerValue = aMessage.Int1(); + TUint logoutTimerValue = aMessage.Int2(); + iServer.SetTimerValues( clientUid, loginTimerValue, logoutTimerValue ); + aMessage.Complete( KErrNone ); + } + break; + + default: + aMessage.Complete( KErrNotSupported ); + //PanicClient( aMessage, EBadRequest ) + break; + } + iAllowNotifications = TRUE; + + } + +// --------------------------------------------------------- +// HandleOrderNotifications +// --------------------------------------------------------- +// +void CHotSpotSession::HandleOrderNotifications( const RMessage2& aMessage ) + { + iPendingNotificationRequest = aMessage; + iIsNotificationRequestPending = ETrue; + if( !iNotificationHandle ) // == NULL i.e. is not activated + { + TRAPD( err, iNotificationHandle = CSessionNotification::NewL( *this ) ); + if ( err == KErrNone ) + { + iServer.NotifyAdd( *iNotificationHandle ); + } + else + { + iIsNotificationRequestPending = EFalse; + aMessage.Complete( err ); + return; + } + } + HandleNotification(); // check is there any unsent notifications + } + +// --------------------------------------------------------- +// HandleCancelNotifications +// --------------------------------------------------------- +// +void CHotSpotSession::HandleCancelNotifications( const RMessage2& aMessage ) + { + if( iIsNotificationRequestPending ) + { + iPendingNotificationRequest.Complete( KErrNone /*EWLMNotificationsCancelled*/ ); + iIsNotificationRequestPending = EFalse; + iPendingNotifications.Reset(); + } + if( iNotificationHandle ) + { + iServer.NotifyRemove( *iNotificationHandle ); + delete iNotificationHandle; + iNotificationHandle = NULL; + } + aMessage.Complete( KErrNone ); + } + +// --------------------------------------------------------- +// AddNotification +// --------------------------------------------------------- +// +void CHotSpotSession::AddNotification( TInt aNotification, TDes8& aData ) + { + DEBUG( "CHotSpotSession::AddNotification" ); + + TNotification notif; + notif.id = aNotification; + notif.data = aData; + if ( iIsNotificationRequestPending ) + { + DEBUG( "CHotSpotSession::AddNotification added to array. Request found..." ); + iPendingNotifications.Append( notif ); + HandleNotification(); // check is there client waiting for notification + } + } + +// --------------------------------------------------------- +// HandleNotification +// --------------------------------------------------------- +// +void CHotSpotSession::HandleNotification() + { + DEBUG( "CHotSpotSession::HandleNotification" ); + + // Check if we allow notifications + if (iAllowNotifications == TRUE) + { + // Check is there message to wait notification and + // notification that is not sent. + if ( iIsNotificationRequestPending && iPendingNotifications.Count() != 0 ) + { + DEBUG( "CHotSpotSession::HandleNotification - sending response..." ); + iIsNotificationRequestPending = EFalse; + + THssPckgData data; + TPckg pckg( data ); + data.data = iPendingNotifications[0].data; + TInt ret( iPendingNotificationRequest.Write( 0, pckg ) ); + if ( ret != KErrNone ) + { + iPendingNotificationRequest.Complete( ret ); + return; + } + iPendingNotificationRequest.Complete( iPendingNotifications[0].id ); + iPendingNotifications.Reset(); + } + } + } + +// ----------------------------------------------------------------------------- +// TestInternetConnectivityL +// ----------------------------------------------------------------------------- +// +void CHotSpotSession::TestInternetConnectivityL() + { + DEBUG("CHotSpotSession::TestInternetConnectivityL"); + if ( iIcts != NULL ) + { + delete iIcts; + } + TInt connectivityTestAllowed( EIctsRunAutomatically ); + iRepository->Get( KIctsTestPermission, connectivityTestAllowed ); + DEBUG1("CHotSpotSession::TestInternetConnectivityL: %d", connectivityTestAllowed); + if ( connectivityTestAllowed == EIctsNeverRun ) + { + TInt indx = iServer.FindMessage( iIapId, EHssStartLogin ); + if ( KErrNotFound != indx ) + { + iServer.CompleteMessage( indx, KErrNone ); + } + } + else + { + iIcts = CIctsClientInterface::NewL( iIapId, iNetId, *this ); + iIcts->StartL(); + } + + } + +// ----------------------------------------------------------------------------- +// ConnectivityObserver +// ----------------------------------------------------------------------------- +// +void CHotSpotSession::ConnectivityObserver( TIctsTestResult aResult, + const TDesC& aString ) + { + DEBUG1("CHotSpotSession::ConnectivityObserver result: %d", aResult); + TInt indx( KErrNone ); + switch ( aResult ) + { + case EConnectionOk : + indx = iServer.FindMessage( iIapId, EHssStartLogin ); + if ( KErrNotFound != indx ) + { + iServer.CompleteMessage( indx, KErrNone ); + } + TRAP_IGNORE( iIapSettingsHandler->CreateIapL() ); + break; + case EHttpAuthenticationNeeded : + // Start browser for authentication + TRAP_IGNORE( AuthenticateL( aString ) ); + break; + case EConnectionNotOk : + indx = iServer.FindMessage( iIapId, EHssStartLogin ); + if ( KErrNotFound != indx ) + { + iServer.CompleteMessage( indx, KErrNone ); + } + break; + case ETimeout : + indx = iServer.FindMessage( iIapId, EHssStartLogin ); + if ( KErrNotFound != indx ) + { + iServer.CompleteMessage( indx, KErrNone ); + } + + break; + default: + break; + } + } + +// ----------------------------------------------------------------------------- +// LoginTimeout +// ----------------------------------------------------------------------------- +// +void CHotSpotSession::LoginTimeout() + { + DEBUG1("CHotSpotSession::LoginTimeout iIapId :%d", iIapId ); + iServer.SetLogoutFlag( ETrue ); + + // if message is not found, client has not completed it (LoginComplete(..)) + TInt indx = iServer.FindMessage( iIapId, EHssStartLogin ); + if ( KErrNotFound != indx ) + { + iServer.CompleteMessage( indx, KErrCancel ); + } + + TUid clientUid; + TBuf8 extAPI; + TRAP_IGNORE( iIapSettingsHandler->FindClientL( iIapId, clientUid, extAPI ) ); + + // 3rd party client was found + if ( clientUid != TUid::Null() ) + { + DEBUG("CHotSpotSession::LoginTimeout clientUid = CLIENT"); + TBuf8 nullBuf; + TInt ret = CreateClient( clientUid, nullBuf ); + DEBUG1("CHotSpotSession::LoginTimeout CreateClient ret: %d", ret); + if ( KErrNone == ret ) + { + iClient->CancelLogin( iIapId ); + } + } + + DEBUG("CHotSpotSession::LoginTimeout Done"); + } + +// ----------------------------------------------------------------------------- +// LogoutTimeout +// ----------------------------------------------------------------------------- +// +void CHotSpotSession::LogoutTimeout() + { + DEBUG("CHotSpotSession::LogoutTimeout"); + // if message is not found, client has not completed it (LogoutComplete(..)) + TInt indx = iServer.FindMessage( iIapId, EHssCloseConnection ); + if ( KErrNotFound != indx ) + { + iServer.CompleteMessage( indx, KErrNone ); + } + } + +// --------------------------------------------------------- +// ProcessRegisterL +// --------------------------------------------------------- +// +void CHotSpotSession::ProcessRegisterL( const RMessage2& aMessage ) + { + DEBUG("CHotSpotSession::ProcessRegisterL"); + + iAllowNotifications = EFalse; + TBufC< KIapNameLength > iapName; + TPckgBuf< TIapName > iapPckg; + TUid clientUid; + TPckgBuf< TClientUid > uidPckg; + TPckgBuf iapPackage( iIapId ); + + // Read message + aMessage.ReadL( 0, uidPckg ); + clientUid = uidPckg().ClientUid(); + aMessage.ReadL( 1, iapPckg ); + iapName = iapPckg().IapName(); + + TUint32 iapId( 0 ); + // TRAPD needed here so that 0 can be returned if DeleteIapL leaves + TInt ret( KErrNone ); + TRAP( ret, iIapSettingsHandler->CreateClientIapL( iapName, iapId, clientUid )); + DEBUG1( "CHotSpotSession::EHssRegister iapId: %d", iapId ); + DEBUG1( "CHotSpotSession::EHssRegister ret: %d", ret ); + if ( KErrNone == ret ) + { + aMessage.Complete( iapId ); + } + + else + { + // TRAP needed here so that 0 can be returned if DeleteIapL leaves + //TRAP(err, iIapSettingsHandler->DeleteIapL( iapId )) + // Error, we are returning 0 to client + // and no IAP is created + aMessage.Complete( KErrNone ); + } + } + +// --------------------------------------------------------- +// ProcessUnRegisterL +// --------------------------------------------------------- +// +void CHotSpotSession::ProcessUnRegisterL( const RMessage2& aMessage ) + { + DEBUG("CHotSpotSession::ProcessUnRegisterL"); + iAllowNotifications = EFalse; + + // Read message + TInt iapId = ( TInt )aMessage.Int0(); + + TInt ret( KErrNone ); + // Check that this is not Easy WLAN + if ( iServer.GetEasyWlanId() != iapId ) + { + TRAPD( err, iIapSettingsHandler->DeleteIapL( iapId ) ); + // return KErrGeneral if IAP removal is not successful + if ( err != KErrNone ) + { + ret = KErrGeneral; + } + } + else + { + ret = KErrPermissionDenied; + } + + aMessage.Complete( ret ); + } + +// ----------------------------------------------------------------------------- +// ProcessStartLogin +// ----------------------------------------------------------------------------- +// +TInt CHotSpotSession::ProcessStartLoginL( const TUint aIapId, const TUint aNetId ) + { + DEBUG("CHotSpotSession::ProcessStartLogin"); + TInt ret( KErrNotFound ); + TUid clientUid; + TBuf8 extAPI; + iIapId = aIapId; + + // This is Easy WLAN. + if ( iServer.GetEasyWlanId() == aIapId ) + { + DEBUG("CHotSpotSession::ProcessStartLogin Easy WLAN detected"); + // Just test internet connectivity and complete message later + TestInternetConnectivityL(); + ret = KErrNone; + return ret; + } + + iIapSettingsHandler->FindClientL( aIapId, clientUid, extAPI ); + + // 3rd party client was found + if ( clientUid != TUid::Null() ) + { + DEBUG("CHotSpotSession::ProcessStartLogin clientUid = CLIENT"); + TBuf8 nullBuf; + ret = CreateClient( clientUid, nullBuf ); + + if ( KErrNone == ret && iServer.GetLoginFlagValue() ) + { + iLoginTimer->After( iServer.GetLoginTimeMicroSecs( clientUid ) ); + DEBUG("CHotSpotSession::ProcessStartLogin iClient->Login( iIapId, iNetId );"); + iClient->Login( aIapId, aNetId ); + iServer.SetLogoutFlag( EFalse ); + } + else + { + ret = KErrNotFound; + } + } + DEBUG("CHotSpotSession::ProcessStartLogin DONE"); + return ret; + } + +// ----------------------------------------------------------------------------- +// ProcessStart +// ----------------------------------------------------------------------------- +// +TInt CHotSpotSession::ProcessStartL( const TUint aIapId ) + { + DEBUG("CHotSpotSession::ProcessStart"); + + TInt ret( KErrNone ); + TBuf8 extAPI; + + iIapSettingsHandler->FindClientL( aIapId, iClientUid, extAPI ); + if ( iClientUid == TUid::Null() ) + { + DEBUG("CHotSpotSession::ProcessStartL clientUid = EMPTY"); + + ret = KErrNotSupported; + } + else + { + DEBUG("CHotSpotSession::ProcessStartL clientUid = CLIENT"); + + // Try first with API extension defined + ret = CreateClient( iClientUid, extAPI ); + + if ( ret != KErrNone ) + { + // Client exists, but hasn't implemented API extension + // Let's try again without API extension definition + TBuf8 nullBuf; + ret = CreateClient( iClientUid, nullBuf ); + } + + if ( ret == KErrNone ) + { + iServer.SetAssociationFlag( ETrue ); + iMgtClient->ActivateNotificationsL( *this ); + iClient->Start( aIapId ); + } + } + DEBUG1("CHotSpotSession::ProcessStartL DONE ret%d", ret); + return ret; + } + +// ----------------------------------------------------------------------------- +// ProcessStartAgain +// ----------------------------------------------------------------------------- +// +TInt CHotSpotSession::ProcessStartAgain( const TUint aIapId ) + { + DEBUG("CHotSpotSession::ProcessStartAgain"); + TInt ret( KErrNone ); + + // Client exists if StartAgain is called. + if ( iClient == NULL ) + { + TBuf8 nullBuf; + ret = CreateClient( iClientUid, nullBuf ); + } + + if ( ret == KErrNone ) + { + iServer.SetAssociationFlag( ETrue ); // Send association status + iClient->Update( aIapId ); + } + + return ret; + } +// ----------------------------------------------------------------------------- +// ProcessAssociationStatus +// ----------------------------------------------------------------------------- +// +TInt CHotSpotSession::ProcessAssociationStatus( const TUint aIapId, TBool aResult ) + { + DEBUG("CHotSpotSession::ProcessAssociationStatus"); + TInt ret( KErrNone ); + iServer.SetAssociationFlag( EFalse ); + if ( iHotspotExtension ) + { + iHotspotExtension = EFalse; + if ( iClient != NULL ) + { + DEBUG("CHotSpotSession::ProcessAssociationStatus sent to client"); + iClient->WlanAssociationStatus( aIapId, aResult ); + } + } + DEBUG("CHotSpotSession::ProcessAssociationStatus Done"); + return ret; + } + +// ----------------------------------------------------------------------------- +// CreateClient +// ----------------------------------------------------------------------------- +// +TInt CHotSpotSession::CreateClient( const TUid aUid, TDesC8& aUidText ) + { + DEBUG("CHotSpotSession::CreateClient"); + TInt err( KErrNone ); + if ( aUidText == KNullDesC8 ) + { + DEBUG("CHotSpotSession::CreateClient iHotspotExtension = EFalse;"); + iHotspotExtension = EFalse; + TRAP( err, iClient = CHssClientPlugin::NewL( aUid, aUidText ) ); + DEBUG1("CHotSpotSession::CreateClient err: %d", err ); + } + else + { + DEBUG("CHotSpotSession::CreateClient iHotspotExtension = ETrue;"); + iHotspotExtension = ETrue; + TRAP( err, iClient = CHssClientPlugin::NewL( aUid, aUidText ) ); + DEBUG1("CHotSpotSession::CreateClient err: %d", err ); + } + return err; + } + +// ----------------------------------------------------------------------------- +// ProcessClose +// ----------------------------------------------------------------------------- +// +TInt CHotSpotSession::ProcessCloseL( const TUint aIapId ) + { + DEBUG("CHotSpotSession::ProcessCloseL"); + TInt ret( KErrNone ); + TUid clientUid; + TBuf8 extAPI; + + iIapSettingsHandler->FindClientL( aIapId, clientUid, extAPI ); + if ( clientUid == TUid::Null() ) + { + DEBUG("CHotSpotSession::ProcessCloseL clientUid = EMPTY"); + // do nothing + ret = KErrNotSupported; + } + else + { + DEBUG("CHotSpotSession::ProcessCloseL clientUid = CLIENT"); + if ( iClient == NULL ) + { + TBuf8 nullBuf; + ret = CreateClient( clientUid, nullBuf ); + } + else + { + ret = KErrNone; + } + iLogoutTimer->After( iServer.GetLogoutTimeMicroSecs( clientUid ) ); + if ( ret == KErrNone && !iServer.GetLogoutFlagValue() ) + { + DEBUG("CHotSpotSession::ProcessCloseL send Logout()"); + iClient->Logout( aIapId ); + iServer.SetLogoutFlag( ETrue ); + iServer.SetLoginFlag( EFalse ); + } + else + { + ret = KErrNotFound; + } + + } + return ret; + } + +// ----------------------------------------------------------------------------- +// ProcessServerShutdown +// ----------------------------------------------------------------------------- +// +void CHotSpotSession::ProcessServerShutdown( const RMessage2& aMessage ) + { + DEBUG("CHotSpotSession::ProcessServerShutdown"); + TInt shutdown; + + shutdown = ( TInt )aMessage.Int0(); + if ( KHssShutdown == shutdown ) + { + DEBUG("CHotSpotSession::ProcessServerShutdown shutdown "); + aMessage.Complete( KErrNone ); + RProcess server; // Sets the handle-number to the KCurrentProcessHandle + server.Kill( KErrNone ); + } + else + { + DEBUG("CHotSpotSession::ProcessServerShutdown else "); + aMessage.Complete( KErrNone ); + } + } + +// ----------------------------------------------------------------------------- +// ProcessUiState +// ----------------------------------------------------------------------------- +// +void CHotSpotSession::ProcessUiState( const RMessage2& aMessage ) + { + DEBUG( "CHotSpotSession::ProcessUiState()" ); + TBool completeMsg = EFalse; + TInt indx( KErrNone ); + TInt indxBrowser( KErrNone ); + TInt ret( KErrNone ); + iIapId = ( TInt )aMessage.Int0(); + + indx = iServer.FindMessage( iIapId, EHssStartLogin ); + indxBrowser = iServer.FindMessage( iIapId, EHssStartBrowser ); + THsBrowserUiStates uiState = ( THsBrowserUiStates ) aMessage.Int1(); // UI state + switch ( uiState ) + { + case EHsBrowserUiRunning: + { + DEBUG( "CHotSpotSession::ProcessUiState() EHsBrowserUiRunning" ); + break; + } + case EHsBrowserUiAuthenticatedOk: + { + DEBUG( "CHotSpotSession::ProcessUiState() EHsBrowserUiAuthenticatedOk" ); + + completeMsg = ETrue; + break; + } + case EHsBrowserUiAuthenticatedNok: + { + DEBUG( "CHotSpotSession::ProcessUiState() EHsBrowserUiAuthenticatedNok" ); + completeMsg = ETrue; + break; + } + case EHsBrowserUiClosed: + { + DEBUG( "CHotSpotSession::ProcessUiState() EHsBrowserUiClosed" ); + completeMsg = ETrue; + break; + } + default: + { + DEBUG( "CHotSpotSession::ProcessUiState() default" ); + completeMsg = ETrue; + } + } + if ( completeMsg ) + { + // complete messages EHssStartLogin/EHssStartBrowser + if ( indx >= 0 ) + { + DEBUG( "CHotSpotSession::ProcessUiState() completing EHssStartLogin" ); + iServer.CompleteMessage( indx , KErrNone ); + aMessage.Complete( KErrNone ); + } + else if ( indxBrowser >= 0 ) + { + DEBUG( "CHotSpotSession::ProcessUiState() completing EHssStartBrowser" ); + iServer.CompleteMessage( indxBrowser, ret ); + aMessage.Complete( KErrNone ); + } + else + { + DEBUG( "CHotSpotSession::ProcessUiState() completing EHssUiState" ); + aMessage.Complete( KErrNotFound ); + } + } + } + +// ----------------------------------------------------------------------------- +// Authenticate() +// ----------------------------------------------------------------------------- +// +void CHotSpotSession::AuthenticateL( const TDesC& aString ) + { + DEBUG("CHotSpotSession::AuthenticateL()"); + + const TInt KBrowserUid = 0x2000AFCC; // hotspot browser application + HBufC* param = HBufC::NewLC( KMaxFileName ); + _LIT(tmpString, "%d, %d, %S"); + param->Des().Format( tmpString, iIapId, iNetId, &aString ); + TUid uid( TUid::Uid( KBrowserUid ) ); + RApaLsSession appArcSession; + User::LeaveIfError( appArcSession.Connect() ); // connect to AppArc server + CleanupClosePushL( appArcSession ); + TThreadId id; + TInt err = appArcSession.StartDocument( *param, TUid::Uid( KBrowserUid ), id ); + if ( err != KErrNone ) + { + DEBUG1( "CHotSpotSession::AuthenticateL() StartDocument: %d", err ); + } + CleanupStack::PopAndDestroy( &appArcSession ); + CleanupStack::PopAndDestroy( param ); + + DEBUG("CHotSpotSession::AuthenticateLC() done"); + } + +// ----------------------------------------------------------------------------- +// ConnectionStateChanged +// ----------------------------------------------------------------------------- +// +void CHotSpotSession::ConnectionStateChanged( TWlanConnectionMode aNewState ) + { + DEBUG1( "CHotSpotSession::ConnectionStateChanged() aNewState=%d", aNewState ); + switch ( aNewState ) + { + case EWlanConnectionModeSearching: + { + break; + } + case EWlanConnectionModeInfrastructure: + case EWlanConnectionModeSecureInfra: + { + iMgtClient->CancelNotifications(); + ProcessAssociationStatus( iIapId, ETrue ); + break; + } + case EWlanConnectionModeAdhoc: + case EWlanConnectionModeNotConnected: + { + iMgtClient->CancelNotifications(); + iServer.SetAssociationFlag( EFalse ); + break; + } + default: + { + iMgtClient->CancelNotifications(); + iServer.SetAssociationFlag( EFalse ); + } + } + + } + +// end of file + diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/src/hssiapsettingshandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/src/hssiapsettingshandler.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,514 @@ +/* +* Copyright (c) 2002-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 iapsettings +* +*/ + + + +// INCLUDE FILES +#include "hssiapsettingshandler.h" +#include "hotspotclientserver.h" +#include "am_debug.h" +#include + +#include +#include +#include +#include + +using namespace CMManager; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CHssIapSettingsHandler +// ----------------------------------------------------------------------------- +// +CHssIapSettingsHandler::CHssIapSettingsHandler( ) + { + DEBUG("CHssIapSettingsHandler::CHssIapSettingsHandler"); + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CHssIapSettingsHandler::ConstructL() + { + DEBUG("CHssIapSettingsHandler::ConstructL()"); + } + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +CHssIapSettingsHandler* CHssIapSettingsHandler::NewL() + { + CHssIapSettingsHandler* self = new( ELeave ) CHssIapSettingsHandler(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// ~CHssIapSettingsHandler +// ----------------------------------------------------------------------------- +// +CHssIapSettingsHandler::~CHssIapSettingsHandler() + { + DEBUG("CHssIapSettingsHandler::~CHssIapSettingsHandler()"); + } + +// ----------------------------------------------------------------------------- +// CreateClientIapL +// ----------------------------------------------------------------------------- +// +void CHssIapSettingsHandler::CreateClientIapL( const TDesC& aIapName, + TUint32& aIapId, + const TUid aUid ) + { + DEBUG("CHssIapSettingsHandler::CreateClientIapL"); + + 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 plugin = cmManager.CreateConnectionMethodL( KUidWlanBearerType ); + CleanupClosePushL( plugin ); + + plugin.SetStringAttributeL( ECmName, aIapName ); + plugin.SetStringAttributeL( EWlanSSID, aIapName ); + plugin.SetStringAttributeL( EWlanServiceExtensionTableName, aUid.Name() ); + plugin.SetStringAttributeL( ECmConfigDaemonManagerName, KHotSpotPlugin ); + plugin.SetBoolAttributeL( ECmProtected, ETrue ); + + destination.AddConnectionMethodL( plugin ); + destination.UpdateL(); + + aIapId = plugin.GetIntAttributeL( ECmIapId ); + CleanupStack::PopAndDestroy( &plugin ); + } + CleanupStack::PopAndDestroy(); // destination + } + CleanupStack::PopAndDestroy(); // destinations + CleanupStack::PopAndDestroy( &cmManager ); + + DEBUG("CHssIapSettingsHandler::CreateClientIapL Done"); + } + +// ----------------------------------------------------------------------------- +// CreateIapL +// ----------------------------------------------------------------------------- +// +void CHssIapSettingsHandler::CreateIapL() + { + DEBUG("CHssIapSettingsHandler::CreateIapL"); + + RCmManagerExt cmManager; + cmManager.OpenL(); + CleanupClosePushL( cmManager ); + + // Read all destination(SNAP) settings into an array + RArray destinations; + CleanupClosePushL( destinations ); + + cmManager.AllDestinationsL( destinations ); + RCmDestinationExt destination; + // Loop through each destination + for( TInt i = 0; i < destinations.Count(); i++ ) + { + destination = cmManager.DestinationL( destinations[i] ); + CleanupClosePushL( destination ); + // Internet destination will always exist in the system. + // Internet destination will have ESnapPurposeInternet set in its metadata. + if (destination.MetadataL( CMManager::ESnapMetadataPurpose ) == + CMManager::ESnapPurposeInternet ) + { + CWlanMgmtClient* wlanMgmtClient = CWlanMgmtClient::NewL(); + CleanupStack::PushL( wlanMgmtClient ); + + TWlanConnectionMode connMode( EWlanConnectionModeNotConnected ); + wlanMgmtClient->GetConnectionMode( connMode ); + + TWlanConnectionSecurityMode secMode( EWlanConnectionSecurityOpen ); + wlanMgmtClient->GetConnectionSecurityMode( secMode ); + + HBufC* ssid( NULL ); + TWlanSsid ssidConn; + + wlanMgmtClient->GetConnectionSsid( ssidConn ); + + ssid = HBufC::NewLC( ssidConn.Length() ); + ssid->Des().Copy( ssidConn ); + + TUint32 serviceId(0); + TUint32 easyWlanIapId(0); + easyWlanIapId = cmManager.EasyWlanIdL(); + DEBUG1("CHssIapSettingsHandler::SaveDestinationL easyWlanIapId: %d", + easyWlanIapId); + + RCmConnectionMethodExt easyWlanPlugin; + easyWlanPlugin = cmManager.ConnectionMethodL( easyWlanIapId ); + CleanupClosePushL( easyWlanPlugin ); + TBool scanSsid = easyWlanPlugin.GetBoolAttributeL( EWlanScanSSID ); + DEBUG1("CHssIapSettingsHandler::SaveDestinationL scanSsid: %d", scanSsid); + TUint32 easyWlanServiceId = easyWlanPlugin.GetIntAttributeL( EWlanServiceId ); + DEBUG1("CHssIapSettingsHandler::SaveDestinationL easyWlanServiceId: %d", easyWlanServiceId); + CleanupStack::PopAndDestroy(); // easyWlanPlugin; + + RCmConnectionMethodExt plugin = + cmManager.CreateConnectionMethodL( KUidWlanBearerType ); + CleanupClosePushL( plugin ); + plugin.SetStringAttributeL( ECmName, *ssid ); + plugin.SetStringAttributeL( EWlanSSID, *ssid ); + plugin.SetIntAttributeL( CMManager::EWlanSecurityMode, + ConvertConnectionSecurityModeToSecModeL( secMode )); + plugin.SetIntAttributeL( EWlanConnectionMode, + ConvertConnectionModeToNetModeL( connMode ) ); + plugin.SetBoolAttributeL( EWlanScanSSID, scanSsid ); + destination.AddConnectionMethodL( plugin ); + destination.UpdateL(); + serviceId = plugin.GetIntAttributeL( EWlanServiceId ); + + CleanupStack::PopAndDestroy( &plugin ); // Close() called + if ( secMode == EWlanConnectionSecurityWep ) + { + SaveWEPKeyL( easyWlanServiceId, serviceId ); + } + + if ( secMode == EWlanConnectionSecurityWpaPsk ) + { + SaveWPAKeyL( easyWlanServiceId, serviceId ); + } + CleanupStack::PopAndDestroy( ssid ); // ssid + CleanupStack::PopAndDestroy( wlanMgmtClient ); + } + CleanupStack::PopAndDestroy(); // destination + } + CleanupStack::PopAndDestroy(); // destinations + CleanupStack::PopAndDestroy( &cmManager ); + + DEBUG("CHssIapSettingsHandler::CreateIapL Done"); + } + +// ----------------------------------------------------------------------------- +// DeleteIapL +// ----------------------------------------------------------------------------- +// +void CHssIapSettingsHandler::DeleteIapL( const TUint aIapId ) + { + DEBUG1("CHssIapSettingsHandler:::DeleteIapL aIapId=%d ", aIapId); + + RCmManagerExt cmManager; + cmManager.OpenL(); + CleanupClosePushL( cmManager ); + + RCmConnectionMethodExt plugin = cmManager.ConnectionMethodL( aIapId ); + CleanupClosePushL( plugin ); + + cmManager.RemoveAllReferencesL( plugin ); + CleanupStack::Pop( &plugin ); + + TBool result = plugin.DeleteL(); + DEBUG1("CHssIapSettingsHandler:::DeleteIapL result = %d ", result); + + CleanupStack::PopAndDestroy( &cmManager ); + } + +// ----------------------------------------------------------------------------- +// FindClientL +// ----------------------------------------------------------------------------- +// +TInt CHssIapSettingsHandler::FindClientL( const TUint aIapId, TUid& aUid, TDes8& aUidText ) + { + DEBUG("CHssIapSettingsHandler::FindClientL"); + TInt ret( KErrNone ); + aUid = TUid::Null(); + RCmManagerExt cmManager; + cmManager.OpenL(); + CleanupClosePushL( cmManager ); + + RCmConnectionMethodExt plugin = cmManager.ConnectionMethodL( aIapId ); + CleanupClosePushL( plugin ); + + HBufC* uid = plugin.GetStringAttributeL( EWlanServiceExtensionTableName ); + + TBuf8 buffer; + buffer.Copy( *uid ); + delete uid; + // Find and remove [ and ]. + // If found [ it's known that buffer contains UID + TInt indx = buffer.Find( KMark1 ); + if ( KErrNotFound != indx ) + { + DEBUG("CHssIapSettingsHandler::FindClientL Client is found"); + buffer.Delete( indx, 1 ); + indx = buffer.Find( KMark2 ); + if ( KErrNotFound != indx ) + { + buffer.Delete( indx, 1 ); + } + // Convert TBuf to TUid + TLex8 lex( buffer ); + TUint value( 0 ); + User::LeaveIfError( lex.Val( value, EHex ) ); + aUid.iUid = value; + aUidText = buffer; + } + + CleanupStack::PopAndDestroy( &plugin ); // Close() called on "plugin" + CleanupStack::PopAndDestroy( &cmManager ); + DEBUG("CHssIapSettingsHandler::FindClientL"); + + return ret; + } + +// --------------------------------------------------------- +// SaveWEPKeyL() +// --------------------------------------------------------- +// +void CHssIapSettingsHandler::SaveWEPKeyL( const TUint32 aFrom, + const TUint32 aTo ) + { + DEBUG("CHssIapSettingsHandler::SaveWEPKey"); + TInt err( KErrNone ); + TUint attempts( KHssMaxTransAttempts ); + + CMDBSession* dbSession = + CMDBSession::NewLC( CMDBSession::LatestVersion() ); + + // open a transaction to make sure key is saved + do + { + TRAP( err, dbSession->OpenTransactionL() ); + if ( err ) + { + DEBUG1("CHssIapSettingsHandler::SaveWEPKey err: %d", err); + User::After( KHssRetryAfter ); + } + } + while ( err && attempts-- ); + + if ( err != KErrNone ) + { + dbSession->Close(); + CleanupStack::PopAndDestroy( dbSession ); + User::LeaveIfError( err ); + } + + CleanupStack::PushL( TCleanupItem( RollbackCommsDat, dbSession ) ); + + CMDBGenericRecord* wlanRecord = static_cast + ( CCDRecordBase::RecordFactoryL( 0)); + CleanupStack::PushL( wlanRecord ); + wlanRecord->InitializeL( KGenericTable(),NULL ); + wlanRecord->SetRecordId( aFrom ); + wlanRecord->LoadL( *dbSession ); + + TInt format = + *((CMDBField*)wlanRecord->GetFieldByIdL( KCDTIdWlanFormatKey1 )); + CMDBField* wepKey = + static_cast*>(wlanRecord->GetFieldByIdL(KCDTIdWlanWepKey1)); + + TBuf8 buf8; + buf8.Copy( *wepKey ); + CleanupStack::PopAndDestroy( wlanRecord ); + + CMDBGenericRecord* wlanRecordNew = static_cast + ( CCDRecordBase::RecordFactoryL( 0)); + CleanupStack::PushL( wlanRecordNew ); + wlanRecordNew->InitializeL( KGenericTable(),NULL ); + wlanRecordNew->SetRecordId( aTo ); + wlanRecordNew->LoadL( *dbSession ); + + CMDBField* wepKeyNew = + static_cast*>(wlanRecordNew->GetFieldByIdL(KCDTIdWlanWepKey1)); + *((CMDBField*)wlanRecordNew->GetFieldByIdL( KCDTIdWlanFormatKey1 )) = format; + + wepKeyNew->SetL(buf8); + + wlanRecordNew->ModifyL( *dbSession ); + CleanupStack::PopAndDestroy( wlanRecordNew ); + + dbSession->CommitTransactionL(); + + dbSession->Close(); + CleanupStack::PopAndDestroy( dbSession ); + + CleanupStack::Pop( 1 ); // transaction rollback popped + + dbSession->CommitTransactionL(); + + + DEBUG("CHssIapSettingsHandler::SaveWEPKey Done"); + } + +// --------------------------------------------------------- +// SaveWPAKeyL() +// --------------------------------------------------------- +// +void CHssIapSettingsHandler::SaveWPAKeyL( const TUint32 aFrom, + const TUint32 aTo ) + { + DEBUG("CHssIapSettingsHandler::SaveWPAKey"); + TInt err( KErrNone ); + TUint attempts( KHssMaxTransAttempts ); + + CMDBSession* dbSession = + CMDBSession::NewLC( CMDBSession::LatestVersion() ); + + // open a transaction to make sure key is saved + do + { + TRAP( err, dbSession->OpenTransactionL() ); + if ( err ) + { + DEBUG1("CHssIapSettingsHandler::SaveWPAKey err: %d", err); + User::After( KHssRetryAfter ); + } + } + while ( err && attempts-- ); + + if ( err != KErrNone ) + { + dbSession->Close(); + CleanupStack::PopAndDestroy( dbSession ); + User::LeaveIfError( err ); + } + + CleanupStack::PushL( TCleanupItem( RollbackCommsDat, dbSession ) ); + + CMDBGenericRecord* wlanRecord = static_cast + ( CCDRecordBase::RecordFactoryL( 0)); + CleanupStack::PushL( wlanRecord ); + wlanRecord->InitializeL( KGenericTable(), NULL ); + wlanRecord->SetRecordId( aFrom ); + wlanRecord->LoadL( *dbSession ); + + CMDBField* binField = + (CMDBField*)wlanRecord->GetFieldByIdL(KCDTIdWlanWpaPreSharedKey); + TBuf8 buf8; + buf8.Copy( *binField ); + CleanupStack::PopAndDestroy( wlanRecord ); + + CMDBGenericRecord* wlanRecordNew = static_cast + ( CCDRecordBase::RecordFactoryL( 0)); + CleanupStack::PushL( wlanRecordNew ); + wlanRecordNew->InitializeL( KGenericTable(),NULL ); + wlanRecordNew->SetRecordId( aTo ); + wlanRecordNew->LoadL( *dbSession ); + + CMDBField* binFieldNew = + (CMDBField*)wlanRecordNew->GetFieldByIdL(KCDTIdWlanWpaPreSharedKey); + binFieldNew->SetMaxLengthL( KWLMMaxWpaPskLength ); + binFieldNew->SetL( buf8 ); + *((CMDBField*)wlanRecordNew->GetFieldByIdL(KCDTIdWlanEnableWpaPsk)) = ETrue; + wlanRecordNew->ModifyL( *dbSession ); + CleanupStack::PopAndDestroy( wlanRecordNew ); + + CleanupStack::Pop( 1 ); // transaction rollback popped + + dbSession->CommitTransactionL(); + + dbSession->Close(); + CleanupStack::PopAndDestroy( dbSession ); + DEBUG("CHssIapSettingsHandler::SaveWPAKey Done"); +} + +// ---------------------------------------------------------------------------- +// RollbackCommsDat +// ---------------------------------------------------------------------------- +void CHssIapSettingsHandler::RollbackCommsDat( TAny* aDbSession ) + { + DEBUG("CHssIapSettingsHandler::RollbackCommsDat"); + CommsDat::CMDBSession* session = static_cast( aDbSession ); + TRAP_IGNORE( session->RollbackTransactionL() ); + } + +// --------------------------------------------------------- +// ConvertConnectionSecurityModeToSecModeL +// --------------------------------------------------------- +// +TWlanSecMode CHssIapSettingsHandler::ConvertConnectionSecurityModeToSecModeL( + TWlanConnectionSecurityMode aSecurityMode ) + { + DEBUG( "CHssIapSettingsHandler::ConvertConnectionSecurityModeToSecModeL" ); + switch( aSecurityMode ) + { + case EWlanConnectionSecurityOpen: + { + return EWlanSecModeOpen; + } + + case EWlanConnectionSecurityWep: + { + return EWlanSecModeWep; + } + + case EWlanConnectionSecurity802d1x: + { + return EWlanSecMode802_1x; + } + + case EWlanConnectionSecurityWpa: + case EWlanConnectionSecurityWpaPsk: + { + return EWlanSecModeWpa; + } + + default: + { + User::Leave( KErrNotSupported ); + } + } + + return EWlanSecModeOpen; + } + +// --------------------------------------------------------- +// ConvertConnectionModeToNetModeL +// --------------------------------------------------------- +// +TWlanNetMode CHssIapSettingsHandler::ConvertConnectionModeToNetModeL( + TWlanConnectionMode aConnMode ) + { + DEBUG( "CHssIapSettingsHandler::ConvertConnectionModeToNetModeL" ); + if ( EWlanConnectionModeAdhoc == aConnMode ) + { + return EAdhoc; + } + else + { + return EInfra; + } + } + +// End of File diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/src/hsslogintimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/src/hsslogintimer.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,87 @@ +/* +* 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: Timer for client login procedures +* +*/ + + + +#include "hsslogintimer.h" +#include "hsslogintimerobserver.h" +#include "am_debug.h" + + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// CHssLoginTimer::CHssLoginTimer +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CHssLoginTimer::CHssLoginTimer( MHssLoginTimerObserver& aObserver ) +: CTimer( EPriorityStandard ), iObserver( aObserver ) + { + + } + + +// --------------------------------------------------------------------------- +// CHssLoginTimer::ConstructL +// --------------------------------------------------------------------------- +// +void CHssLoginTimer::ConstructL() + { + DEBUG("CHssLoginTimer::ConstructL()"); + CTimer::ConstructL(); + CActiveScheduler::Add(this); + } + + +// --------------------------------------------------------------------------- +// CHssLoginTimer::NewL +// --------------------------------------------------------------------------- +// +CHssLoginTimer* CHssLoginTimer::NewL( MHssLoginTimerObserver& aObserver ) + { + CHssLoginTimer* self = new( ELeave ) CHssLoginTimer( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +// --------------------------------------------------------------------------- +// CHssLoginTimer::~CHssLoginTimer +// --------------------------------------------------------------------------- +// +CHssLoginTimer::~CHssLoginTimer() + { + CTimer::Cancel(); + } + +// --------------------------------------------------------------------------- +// CHssLoginTimer::RunL +// --------------------------------------------------------------------------- +// +void CHssLoginTimer::RunL() + { + DEBUG("CHssLoginTimer::RunL()"); + iObserver.LoginTimeout(); + } + +// End of File diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/src/hsslogouttimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/src/hsslogouttimer.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,87 @@ +/* +* 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: Timer for client logout procedures +* +*/ + + + +#include "hsslogouttimer.h" +#include "hsslogouttimerobserver.h" +#include "am_debug.h" + + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// CHssLogoutTimer::CHssLogoutTimer +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CHssLogoutTimer::CHssLogoutTimer( MHssLogoutTimerObserver& aObserver ) +: CTimer( EPriorityStandard ), iObserver( aObserver ) + { + + } + + +// --------------------------------------------------------------------------- +// CHssLogoutTimer::ConstructL +// --------------------------------------------------------------------------- +// +void CHssLogoutTimer::ConstructL() + { + DEBUG("CHssLogoutTimer::ConstructL()"); + CTimer::ConstructL(); + CActiveScheduler::Add(this); + } + + +// --------------------------------------------------------------------------- +// CHssLogoutTimer::NewL +// --------------------------------------------------------------------------- +// +CHssLogoutTimer* CHssLogoutTimer::NewL( MHssLogoutTimerObserver& aObserver ) + { + CHssLogoutTimer* self = new( ELeave ) CHssLogoutTimer( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +// --------------------------------------------------------------------------- +// CHssLogoutTimer::~CHssLogoutTimer +// --------------------------------------------------------------------------- +// +CHssLogoutTimer::~CHssLogoutTimer() + { + CTimer::Cancel(); + } + +// --------------------------------------------------------------------------- +// CHssLogoutTimer::RunL +// --------------------------------------------------------------------------- +// +void CHssLogoutTimer::RunL() + { + DEBUG("CHssLogoutTimer::RunL()"); + iObserver.LogoutTimeout(); + } + +// End of File diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/src/hssnotif.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/src/hssnotif.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2002-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 Notifications receiving +* +*/ + + + +// INCLUDE FILES +#include "hssnotif.h" +#include "hssinterface.h" +#include "am_debug.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// HssNotifications::NewNetworksDetected +// New networks have been detected during scan. +// ----------------------------------------------------------------------------- +void HssNotifications::NewNetworksDetected() + { + DEBUG( "HssNotifications::NewNetworksDetected()" ); + TBuf8<1> tmp; + iSession.AddNotification( EHssNewNetworksDetected, tmp ); + } + +// ----------------------------------------------------------------------------- +// HssNotifications::OldNetworksLost +// One or more networks have been lost since the last scan. +// ----------------------------------------------------------------------------- +void HssNotifications::OldNetworksLost() + { + DEBUG( "HssNotifications::OldNetworksLost()" ); + TBuf8<1> tmp; + iSession.AddNotification( EHssOldNetworksLost, tmp ); + } + +// ----------------------------------------------------------------------------- +// CSessionNotification::CSessionNotification +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CSessionNotification::CSessionNotification( + CHotSpotSession& aSession ) : + iSession( aSession ) + { + DEBUG( "CSessionNotification::CSessionNotification()" ); + } + +// ----------------------------------------------------------------------------- +// CSessionNotification::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +CSessionNotification* CSessionNotification::NewL( + CHotSpotSession& aSession ) + { + DEBUG( "CSessionNotification::NewL()" ); + CSessionNotification* self = + new( ELeave ) CSessionNotification( aSession ); + return self; + } + +// Destructor +CSessionNotification::~CSessionNotification() + { + DEBUG( "CSessionNotification::~CSessionNotification()" ); + } + +// ----------------------------------------------------------------------------- +// CSessionNotification::AddNotification +// ----------------------------------------------------------------------------- +void CSessionNotification::AddNotification( + TUint aNotification, + TDes8& aData ) + { + DEBUG( "CSessionNotification::AddNotification()" ); + iSession.AddNotification( aNotification, aData ); + } + +// End of File diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/src/hssscan.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/src/hssscan.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2002-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 Active Object +* +*/ + + + +// INCLUDE FILES +#include +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CHssScan +// ----------------------------------------------------------------------------- +CHssScan::CHssScan( CWlanMgmtClient* aWlanMgmtClient, CHotSpotSession& aCallback) : + CActive( CActive::EPriorityStandard ), + iCallback( aCallback ), + iMgmtClient( aWlanMgmtClient ), + iScanInfo( NULL ) + { + TRAP_IGNORE( iScanInfo = CWlanScanInfo::NewL() ); + // Possible leave error neglected!? + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// ~CHssScan +// ----------------------------------------------------------------------------- +CHssScan::~CHssScan() + { + Cancel(); + delete iScanInfo; + } + +// ----------------------------------------------------------------------------- +// RunL +// ----------------------------------------------------------------------------- +void CHssScan::RunL() + { + iCallback.ScanCompleteL( iStatus , *iScanInfo ); + } + +// ----------------------------------------------------------------------------- +// RunError +// ----------------------------------------------------------------------------- +TInt CHssScan::RunError( TInt /* aError */ ) + { + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// DoCancel +// ----------------------------------------------------------------------------- +void CHssScan::DoCancel() + { + + } + +// ----------------------------------------------------------------------------- +// IssueRequest +// ----------------------------------------------------------------------------- +void CHssScan::IssueRequest() + { + iMgmtClient->GetScanResults( iStatus, *iScanInfo ); + SetActive(); + } + + +// end of file diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/src/hssscaninfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/src/hssscaninfo.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,328 @@ +/* +* Copyright (c) 2002-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: Class to dig information of scan results. +* +*/ + + + + +#include "hssscaninfo.h" +#include "hssscaninfoie.h" +#include + +// Default values for information element IDs. +const TUint8 WPA_IE_ID = 221; +const TUint32 SCAN_WPA_OUI_LENGTH = 4; +const TUint8 SCAN_WPA_OUI[] = { 0x00, 0x50, 0xF2, 0x01 }; + +const TUint8 SCAN_OUI_TYPE_OFFSET = 3; +const TUint8 SCAN_OUI_SUBTYPE_OFFSET = 4; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +HssScanInfo::HssScanInfo( const HssScanList& scan_list ) + : HssScanListIterator( scan_list ), + ie_iter_m( current_m + BODY_OFFSET ) +{ +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +HssSecurityMode HssScanInfo::SecurityMode() + { + HssScanInfoIe ie; + return ie.SecurityMode( *this ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +HssScanError HssScanInfo::InformationElement( TUint8 ie_id, + TUint8& ie_length, + const TUint8** ie_data ) +{ + // IE is not found when the whole scan info element is gone through. + // + // The Element format is: + // +----+----+--...--+ + // | a | b | c | + // +----+----+--...--+ + // where + // a) Element id (1 byte) + // b) Length (1 byte) + // c) Information (length bytes) + // + + TUint8 ie, len; + const TUint8* data; + + if ( FirstIE( ie, len, &data ) != HssScanError_Ok ) + { + ie_length = 0; + *ie_data = NULL; + return HssScanError_IeNotFound; + } + + HssScanError ret( HssScanError_Ok ); + + while ( ie != ie_id && ret == HssScanError_Ok ) + { + ret = NextIE( ie, len, &data ); + } + + ie_length = len; + *ie_data = data; + return ret; +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +HssScanError HssScanInfo::WpaIE( TUint8& ie_length, + const TUint8** ie_data ) +{ + // Element format is: + // +----+-----+-----+-----+------+-------+--...--+-------+--...--+--------+ + // | ID | Len | OUI | Ver | GKCS | PKCSC | PKSCL | AKMSC | AKMSL | RSNCap | + // +----+-----+-----+-----+------+-------+--...--+-------+--...--+--------+ + // where + // ID = Element ID = 221 (1 octet) + // Len = Length (1 octet) + // OUI = 00:50:F2:01 (4 octets) + // Ver = Version (2 octets) + // GKCS = Group Key Cipher Suite (4 octets) + // PKCSC = Pairwise Key Cipher Suite Count (2 octets) + // PKCSL = Pairwise Key Cipher Suite List (4*m octets) + // AKMSC = Authenticated Key Management Suite Count (2 octets) + // AKMSL = Authenticated Key Management Suite List (4*n octets) + // RSNCap = RSN Capabilities + + TUint8 ie( WPA_IE_ID ), len; + const TUint8* data; + + // Find out the first element + if ( InformationElement( WPA_IE_ID, len, &data ) != HssScanError_Ok ) + { // Okay, it didn't exist. + ie_length = 0; + *ie_data = NULL; + return HssScanError_IeNotFound; + } + + // The ID is correct but check also the UID. + HssScanError ret( HssScanError_Ok ); + + while ( ie == WPA_IE_ID && + ret == HssScanError_Ok && + ( len < SCAN_WPA_OUI_LENGTH || + !( data[0] == SCAN_WPA_OUI[0] && data[1] == SCAN_WPA_OUI[1] && + data[2] == SCAN_WPA_OUI[2] && data[3] == SCAN_WPA_OUI[3] ) ) ) + { + ret = NextIE( ie, len, &data ); + } + + // Check is the element was corrupted + if ( ie != WPA_IE_ID ) + { + ie_length = 0; + *ie_data = NULL; + return HssScanError_IeNotFound; + } + + ie_length = len; + *ie_data = data; + return ret; +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +HssScanError HssScanInfo::InformationElement( TUint8 ie_id, + const HssIeOui& ie_oui, + TUint8 ie_oui_type, + TUint8& ie_length, + const TUint8** ie_data ) +{ + // Element format is: + // +----+-----+-----+-----+------+-------+--...--+-------+--...--+--------+ + // | ID | Len | OUI | | | | | | | | + // +----+-----+-----+-----+------+-------+--...--+-------+--...--+--------+ + // where + // ID = Element ID (1 octet) + // Len = Length (1 octet) + // OUI = OUI (3 octets) + // OUItyp = OUI Type (1 octet) + + TUint8 ie( ie_id ); + TUint8 len( 0 ); + const TUint8* data; + + // Find the first element + if ( InformationElement( ie_id, len, &data ) + != HssScanError_Ok ) + { // Okay, it didn't exist. + ie_length = 0; + *ie_data = NULL; + return HssScanError_IeNotFound; + } + + // The ID is correct but also the OUI and OUI Type need to match + HssScanError ret( HssScanError_Ok ); + + while ( ret == HssScanError_Ok && + ( ie != ie_id || + !( data[0] == ie_oui[0] && + data[1] == ie_oui[1] && + data[2] == ie_oui[2] + ) || + *( data + SCAN_OUI_TYPE_OFFSET ) != ie_oui_type + ) + ) + { + ret = NextIE( ie, len, &data ); + } + + // Check if the element is corrupted + if ( ie != ie_id ) + { + ie_length = 0; + *ie_data = NULL; + return HssScanError_IeNotFound; + } + + ie_length = len; + *ie_data = data; + return ret; +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +HssScanError HssScanInfo::InformationElement( TUint8 ie_id, + const HssIeOui& ie_oui, + TUint8 ie_oui_type, + TUint8 ie_oui_subtype, + TUint8& ie_length, + const TUint8** ie_data ) +{ + // Element format is: + // +----+-----+-----+-----+------+-------+--...--+-------+--...--+--------+ + // | ID | Len | OUI | | | | | | | | + // +----+-----+-----+-----+------+-------+--...--+-------+--...--+--------+ + // where + // ID = Element ID (1 octet) + // Len = Length (1 octet) + // OUI = OUI (3 octets) + // OUItyp = OUI Type (1 octet) + + TUint8 ie( ie_id ); + TUint8 len( 0 ); + const TUint8* data; + + // Find the first element + if ( InformationElement( ie_id, len, &data ) + != HssScanError_Ok ) + { // Okay, it didn't exist. + ie_length = 0; + *ie_data = NULL; + return HssScanError_IeNotFound; + } + + // The ID is correct but also the OUI and OUI Type need to match + HssScanError ret( HssScanError_Ok ); + + while ( ret == HssScanError_Ok && + ( ie != ie_id || + !( data[0] == ie_oui[0] && + data[1] == ie_oui[1] && + data[2] == ie_oui[2] + ) || + *( data + SCAN_OUI_TYPE_OFFSET ) != ie_oui_type || + *( data + SCAN_OUI_SUBTYPE_OFFSET ) != ie_oui_subtype + ) + ) + { + ret = NextIE( ie, len, &data ); + } + + // Check if the element is corrupted + if ( ie != ie_id ) + { + ie_length = 0; + *ie_data = NULL; + return HssScanError_IeNotFound; + } + + ie_length = len; + *ie_data = data; + return ret; +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +HssScanError HssScanInfo::FirstIE( + TUint8& ie, + TUint8& length, + const TUint8** data) +{ + ie_iter_m = current_m + BODY_OFFSET; + return CurrentIE( ie, length, data ); +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +HssScanError HssScanInfo::NextIE( + TUint8& ie, + TUint8& length, + const TUint8** data) +{ + ie_iter_m += *( ie_iter_m+1 ) + 2; + return CurrentIE( ie, length, data ); +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +HssScanError HssScanInfo::CurrentIE( + TUint8& ie, + TUint8& length, + const TUint8** data) const +{ + if ( ie_iter_m >= current_m + Size() ) + { + ie = 0; + length = 0; + *data = NULL; + return HssScanError_IeNotFound; + } + ie = *ie_iter_m; + length = *( ie_iter_m+1 ); + *data = ie_iter_m+2; + return HssScanError_Ok; +} diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/src/hssscaninfoie.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/src/hssscaninfoie.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,271 @@ +/* +* Copyright (c) 2002-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 the ScanInfoIe class. +* +*/ + + + +#include "hssscaninfoie.h" + +// Defines the id byte of the RSN Information Element. +const TUint8 SCANINFOIE_RSNIE_ID = 48; + +// Defines the static offsets for different fields in RSN IE. +const TUint32 SCANINFOIE_RSNIE_GROUP_SUITE_OFFSET = 2; +const TUint32 SCANINFOIE_RSNIE_PAIRWISE_SUITE_COUNT_OFFSET = 6; +const TUint32 SCANINFOIE_RSNIE_PAIRWISE_SUITE_OFFSET = 8; + +// Defines the OUIs used in RSN IEs. +const TUint32 SCANINFOIE_OUI_LENGTH = 4; +const TUint8 SCANINFOIE_RSNIE_OUI_CCMP[] = { 0x00, 0x0F, 0xAC, 0x04 }; +const TUint8 SCANINFOIE_RSNIE_OUI_EAP[] = { 0x00, 0x0F, 0xAC, 0x01 }; +const TUint8 SCANINFOIE_RSNIE_OUI_PSK[] = { 0x00, 0x0F, 0xAC, 0x02 }; + +// Defines the static offsets for different fields in RSN IE. +const TUint32 SCANINFOIE_WPAIE_PAIRWISE_SUITE_COUNT_OFFSET = 10; +const TUint32 SCANINFOIE_WPAIE_PAIRWISE_SUITE_OFFSET = 12; + +// Defines the OUIs used in WPA IEs. +const TUint8 SCANINFOIE_WPAIE_OUI_EAP[] = { 0x00, 0x50, 0xF2, 0x01 }; +const TUint8 SCANINFOIE_WPAIE_OUI_PSK[] = { 0x00, 0x50, 0xF2, 0x02 }; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ScanInfoIe::ScanInfoIe +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +HssScanInfoIe::HssScanInfoIe() + { + } + +// Destructor +HssScanInfoIe::~HssScanInfoIe() + { + } + +// ----------------------------------------------------------------------------- +// ScanInfoIe::SecurityMode +// ----------------------------------------------------------------------------- +// +HssSecurityMode HssScanInfoIe::SecurityMode( + HssScanInfo& info ) + { + TUint8 wpaie_length( 0 ); + const TUint8* wpaie_data = NULL; + TUint8 rsnie_length( 0 ); + const TUint8* rsnie_data = NULL; + + info.InformationElement( SCANINFOIE_RSNIE_ID, rsnie_length, &rsnie_data ); + info.WpaIE( wpaie_length, &wpaie_data ); + + if ( !info.Privacy() ) + { + if ( !wpaie_length && !rsnie_length ) + { + return HssSecurityModeOpen; + } + return HssSecurityMode802_1x; + } + + if ( !wpaie_length && !rsnie_length ) + { + return HssSecurityModeWep; + } + + if ( rsnie_length ) + { + if ( IsKeyManagement( + HssScanInfoIeTypeRsn, + HssScanInfoIeKeyManagementPsk, + rsnie_length, + rsnie_data ) ) + { + if ( IsWpa2Ciphers( + HssScanInfoIeTypeRsn, + rsnie_length, + rsnie_data ) ) + { + return HssSecurityModeWpa2Psk; + } + + return HssSecurityModeWpaPsk; + } + else if ( IsKeyManagement( + HssScanInfoIeTypeRsn, + HssScanInfoIeKeyManagementEap, + rsnie_length, + rsnie_data ) ) + { + if ( IsWpa2Ciphers( + HssScanInfoIeTypeRsn, + rsnie_length, + rsnie_data ) ) + { + return HssSecurityModeWpa2Eap; + } + + return HssSecurityModeWpaEap; + } + } + + if ( wpaie_length ) + { + if ( IsKeyManagement( + HssScanInfoIeTypeWpa, + HssScanInfoIeKeyManagementPsk, + wpaie_length, + wpaie_data ) ) + { + return HssSecurityModeWpaPsk; + } + else if ( IsKeyManagement( + HssScanInfoIeTypeWpa, + HssScanInfoIeKeyManagementEap, + wpaie_length, + wpaie_data ) ) + { + return HssSecurityModeWpaEap; + } + } + + return HssSecurityMode802_1x; + } + +// ----------------------------------------------------------------------------- +// ScanInfoIe::Compare +// ----------------------------------------------------------------------------- +// +TInt HssScanInfoIe::Compare( + const unsigned char* pl, + int ll, + const unsigned char* pr, + int rl ) + { + if ( ll != rl ) + return ll - rl; + + if ( pl == pr ) + return 0; + + for ( int i( 0 ); i < ll; ++i ) + if ( *(pl+i) != *(pr+i) ) + return *(pl+i) - *(pr+i); + + return 0; + } + +// ----------------------------------------------------------------------------- +// ScanInfoIe::IsKeyManagement +// ----------------------------------------------------------------------------- +// + +TBool HssScanInfoIe::IsKeyManagement( + HssScanInfoIeType ie_type, + HssScanInfoIeKeyManagement key_type, + TUint8 /* ie_length */, + const TUint8* ie_data ) + { + const TUint8* key_data = NULL; + const TUint8* key_comp = NULL; + + if ( ie_type == HssScanInfoIeTypeRsn ) + { + if ( key_type == HssScanInfoIeKeyManagementEap ) + { + key_comp = &SCANINFOIE_RSNIE_OUI_EAP[0]; + } + else + { + key_comp = &SCANINFOIE_RSNIE_OUI_PSK[0]; + } + TUint32 suites( *( ie_data + SCANINFOIE_RSNIE_PAIRWISE_SUITE_COUNT_OFFSET ) ); + key_data = ie_data + SCANINFOIE_RSNIE_PAIRWISE_SUITE_OFFSET + + ( suites * SCANINFOIE_OUI_LENGTH ); + } + else + { + if ( key_type == HssScanInfoIeKeyManagementEap ) + { + key_comp = &SCANINFOIE_WPAIE_OUI_EAP[0]; + } + else + { + key_comp = &SCANINFOIE_WPAIE_OUI_PSK[0]; + } + TUint32 suites( *( ie_data + SCANINFOIE_WPAIE_PAIRWISE_SUITE_COUNT_OFFSET ) ); + key_data = ie_data + SCANINFOIE_WPAIE_PAIRWISE_SUITE_OFFSET + + ( suites * SCANINFOIE_OUI_LENGTH ); + } + TUint16 key_suites( *key_data ); + key_data += sizeof( key_suites ); + + while ( key_suites-- ) + { + if ( !Compare( + key_data + ( key_suites * SCANINFOIE_OUI_LENGTH ), SCANINFOIE_OUI_LENGTH, + key_comp, SCANINFOIE_OUI_LENGTH ) ) + { + return true; + } + } + + return false; + }; + +// ----------------------------------------------------------------------------- +// ScanInfoIe::IsWpa2Ciphers +// ----------------------------------------------------------------------------- +// +TBool HssScanInfoIe::IsWpa2Ciphers( + HssScanInfoIeType ie_type, + TUint8 /* ie_length */, + const TUint8* ie_data ) + { + /** + * WPA IE is not used in WPA2 + */ + if ( ie_type == HssScanInfoIeTypeWpa ) + { + return false; + } + + const TUint8* cipher = + ie_data + SCANINFOIE_RSNIE_GROUP_SUITE_OFFSET; + + if ( Compare( + cipher, SCANINFOIE_OUI_LENGTH, + &SCANINFOIE_RSNIE_OUI_CCMP[0], SCANINFOIE_OUI_LENGTH ) ) + { + return false; + } + + TUint32 suites( *( ie_data + SCANINFOIE_RSNIE_PAIRWISE_SUITE_COUNT_OFFSET ) ); + cipher = ie_data + SCANINFOIE_RSNIE_PAIRWISE_SUITE_OFFSET; + + while ( suites-- ) + { + if ( !Compare( + cipher + ( suites * SCANINFOIE_OUI_LENGTH ), SCANINFOIE_OUI_LENGTH, + &SCANINFOIE_RSNIE_OUI_CCMP[0], SCANINFOIE_OUI_LENGTH ) ) + { + return true; + } + } + + return false; + } diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/src/hssscanlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/src/hssscanlist.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2002-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 the ScanList class. +* +*/ + + + +#include "hssscanlist.h" +#include "hssscanoffsets.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +HssScanList::HssScanList():count_m( 0 ), size_m( 0 ) +{ +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint32 HssScanList::Append( TUint32 size, const HssScanFrame* data_pointer ) +{ + + if( AddPadding( size ) >= ( HSS_SCAN_LIST_DATA_SIZE - size_m ) ) + { + + return HSS_APPEND_FAILED_NO_MEMORY; + } + + TUint8* dst = data_m + size_m; + const TUint8* src = data_pointer; + const TUint8* end = data_pointer + size; + + for ( ; src < end; ++dst, ++src ) + { + *dst = *src; + } + + // The checking has to been done after copying it to the buffer + // due it relies the buffers limits. + if ( CheckData( data_m + size_m ) ) + { // Add data only if it is valid. + size_m += AddPadding( size ); + ++count_m; + } + + return size_m; +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint32 HssScanList::Append( TUint32 size ) +{ + + if ( CheckData( data_m + size_m ) ) + { // Add data only if it is valid. + size_m += AddPadding( size ); + ++count_m; + } + + return size_m; +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// + +TBool HssScanList::CheckData( HssScanFrame* data ) const +{ + // Check that the data is at the range. + if ( data < data_m || + data > data_m + size_m || + size_m + sizeof( TUint16 ) > HSS_SCAN_LIST_DATA_SIZE ) + { + return false; + } + + // Calculate the length of the data. + TUint16 size = static_cast( *( reinterpret_cast( data + LENGTH_OFFSET ) ) + CNTRL_HEADER_LEN); + + // Check that the whole data fits to the buffer. + if ( data + size > data_m + HSS_SCAN_LIST_DATA_SIZE ) + { + return false; + } + + const TUint8* currentIE; + + // Search mandatory IEs. + for ( TUint i = 0; i < HSS_MANDATORY_IE_LIST_SIZE; ++i ) + { + // Go through all IEs. + for ( currentIE = data + BODY_OFFSET; + ; // No condition here -- it is in the loop. + currentIE += *( currentIE + 1 ) + 2 ) + { + if ( currentIE < data + size ) + { // Still searching... + if ( *currentIE == HSS_MANDATORY_IE_LIST[i] ) + { // We have a match! Lets find out the next one. + break; + } + } + else + { // The IE was not found. + return false; + } + } + } + // Data is ok. + return true; +} diff -r 000000000000 -r 56b72877c1cb hotspotfw/hsserver/src/hssscanlistiterator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsserver/src/hssscanlistiterator.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2002-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 the ScanListIterator class. +* +*/ + + + +#include "hssscanlist.h" +#include "hssscanlistiterator.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +HssScanListIterator::HssScanListIterator( const HssScanList& scan_list ) + :current_m( &scan_list.data_m[0] ), + scan_list_m( scan_list ) +{ +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +const HssScanFrame* HssScanListIterator::First() +{ + if ( scan_list_m.size_m == 0 ) + { + // No data stored -> no first elemen -> set NULL. + return NULL; + } + // Data exist -> set current at the beginning od the data. + current_m = &scan_list_m.data_m[0]; + return current_m; +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +const HssScanFrame* HssScanListIterator::Next() +{ + current_m += HssScanList::AddPadding( Size() ); + return Current(); +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +const HssScanFrame* HssScanListIterator::Current() const +{ + if( current_m >= scan_list_m.data_m + scan_list_m.size_m ) + { + return NULL; + } + + return current_m; +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool HssScanListIterator::IsDone() const +{ + return ( current_m >= scan_list_m.data_m + scan_list_m.size_m ); +} diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/bwins/ictsclientinterfaceu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/internetconnectivitytestservice/bwins/ictsclientinterfaceu.def Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,7 @@ +EXPORTS + ?StopPolling@CIctsClientInterface@@QAEXXZ @ 1 NONAME ; void CIctsClientInterface::StopPolling(void) + ?StartPolling@CIctsClientInterface@@QAEXHH@Z @ 2 NONAME ; void CIctsClientInterface::StartPolling(int, int) + ?CancelStartL@CIctsClientInterface@@QAEXXZ @ 3 NONAME ; void CIctsClientInterface::CancelStartL(void) + ?NewL@CIctsClientInterface@@SAPAV1@KKAAVMIctsObserver@@@Z @ 4 NONAME ; class CIctsClientInterface * CIctsClientInterface::NewL(unsigned long, unsigned long, class MIctsObserver &) + ?StartL@CIctsClientInterface@@QAEXXZ @ 5 NONAME ; void CIctsClientInterface::StartL(void) + diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/cenrep/10282EC7.txt Binary file hotspotfw/internetconnectivitytestservice/cenrep/10282EC7.txt has changed diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/cenrep/keys_icts.xls Binary file hotspotfw/internetconnectivitytestservice/cenrep/keys_icts.xls has changed diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/conf/icts.confml Binary file hotspotfw/internetconnectivitytestservice/conf/icts.confml has changed diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/conf/icts_10282EC7.crml Binary file hotspotfw/internetconnectivitytestservice/conf/icts_10282EC7.crml has changed diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/eabi/ictsclientinterfaceu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/internetconnectivitytestservice/eabi/ictsclientinterfaceu.def Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,19 @@ +EXPORTS + _ZN20CIctsClientInterface11StopPollingEv @ 1 NONAME + _ZN20CIctsClientInterface12CancelStartLEv @ 2 NONAME + _ZN20CIctsClientInterface12StartPollingEii @ 3 NONAME + _ZN20CIctsClientInterface4NewLEmmR13MIctsObserver @ 4 NONAME + _ZN20CIctsClientInterface6StartLEv @ 5 NONAME + _ZTI11CIctsEngine @ 6 NONAME + _ZTI14CIctsAsyncWait @ 7 NONAME + _ZTI16CIctsHttpHandler @ 8 NONAME + _ZTI20CIctsClientInterface @ 9 NONAME + _ZTI21CIctsPollingTimeTimer @ 10 NONAME + _ZTI25CIctsPollingIntervalTimer @ 11 NONAME + _ZTV11CIctsEngine @ 12 NONAME + _ZTV14CIctsAsyncWait @ 13 NONAME + _ZTV16CIctsHttpHandler @ 14 NONAME + _ZTV20CIctsClientInterface @ 15 NONAME + _ZTV21CIctsPollingTimeTimer @ 16 NONAME + _ZTV25CIctsPollingIntervalTimer @ 17 NONAME + diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/group/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/internetconnectivitytestservice/group/backup_registration.xml Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,5 @@ + + + + + diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/internetconnectivitytestservice/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,29 @@ +/* +* 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: Build information file +* +*/ + + + +#include +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +ictsclientinterface.mmp + + diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/group/ictsclientinterface.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/internetconnectivitytestservice/group/ictsclientinterface.mmp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,56 @@ +/* +* 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: Project definition file +* +*/ + + +#include + +TARGET ictsclientinterface.dll + +TARGETTYPE dll +UID 0x1000008d 0x10282EC5 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE ictsclientinterface.cpp +SOURCE ictsengine.cpp +SOURCE ictspollingintervaltimer.cpp +SOURCE ictspollingtimetimer.cpp +SOURCE ictshttphandler.cpp +SOURCE ictsasyncwait.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc + +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom +SYSTEMINCLUDE /epoc32/include/http + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY esock.lib +LIBRARY http.lib +LIBRARY bafl.lib +LIBRARY centralrepository.lib +LIBRARY inetprotutil.lib +LIBRARY apgrfx.lib +LIBRARY eikcore.lib cone.lib +LIBRARY efsrv.lib +LIBRARY hotspotclient.lib +LIBRARY cmmanager.lib + diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/inc/am_debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/internetconnectivitytestservice/inc/am_debug.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2002-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: 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) + + +#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. */ + + +#endif // _DEBUG + +#endif // AM_DEBUG_H diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/inc/am_debug.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/internetconnectivitytestservice/inc/am_debug.inl Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2006-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: 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 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/inc/ictsasyncwait.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/internetconnectivitytestservice/inc/ictsasyncwait.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,60 @@ +/* +* 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: Asynchronic waiting possibility +* +*/ + + + + +#ifndef __ICTSASYNCWAIT_H__ +#define __ICTSASYNCWAIT_H__ + +/** + * CIctsAsyncWait class + */ + +class CIctsAsyncWait : public CActive + { + public: + + /** + * C++ default constructor. + */ + CIctsAsyncWait(); + + /** + * Destructor. + */ + ~CIctsAsyncWait() ; + + public: + + /** + * Nested scheduler loop + */ + void Wait() ; + + private: // CActive + + void RunL(); + void DoCancel(); + + + private: // data + + CActiveSchedulerWait iActiveWait ; // nested loop for active scheduler +} ; + +#endif // __ICTSASYNCWAIT_H__ diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/inc/ictsengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/internetconnectivitytestservice/inc/ictsengine.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,236 @@ +/* +* 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: Engine for plugins. Contains logic how to use them. +* +*/ + + + + + +#ifndef CICTSEngine_H +#define CICTSEngine_H + +#include +#include + +#include "ictscommon.h" +#include "ictshttphandler.h" +#include "ictspollingintervaltimer.h" +#include "ictspollingtimetimer.h" +#include "ictspollingintervalobserver.h" +#include "ictspollingtimeobserver.h" +#include "hssinterface.h" + +// CONSTANTS +_LIT8( KHttp, "http" ); +const TInt KMaxIpLength = 100; +const TInt KStringLength = 1000; +const TInt KMaxProtocolNameLength = 56; +const TUint KStartPollingWait = 2500000; // 2.5s + +// FORWARD DECLARATIONS +class RHssInterface; + +/** + * Engine + * + * @lib ictsclientinterface.lib + */ +class CIctsEngine : public CBase, + public MIctsPollingIntervalObserver, + public MIctsPollingTimeObserver + { + + public: + + /** + * Two-phased constructor. + * + * @param aIapId IAP id + * @param aNetworkId Network id + * @param aClient Client for callback calls + */ + static CIctsEngine* NewL( TUint32 aIapId, + TUint32 aNetworkId, + MIctsObserver& aClient ); + + /** + * Destructor. + */ + virtual ~CIctsEngine(); + + /** + * Starts basic internet connectivity test. + * + * @return None + */ + void StartL(); + + /** + * Cancels connectivity test. + * + * @return None + */ + void CancelStartL(); + + /** + * Starts polling. + * + * @param aTime Polling time used + * @param aInterval Time interval of execution + * @return None + */ + void StartPolling( TInt aTime, TInt aInterval ); + + /** + * Stops polling + * + * @return None + */ + void StopPolling(); + + + /** + * Callback from CHttpHandler + * + * @param aResult Result of HTTP::GET + * @param aString HTTP Response body (if exists) + * @return None + */ + void HttpEventL( TIctsTestResult aResult , TDesC& aString ); + + + // from MPollingIntervaObserver + + /** + * Callback from CIctsPollingIntervalTimer + * + * @return None + */ + virtual void PollingIntervalTimeout(); + + // from MPollingTimeObserver + + /** + * Callback from CIctsPollingTimeTimer + * + * @return None + */ + virtual void PollingTimeTimeout(); + + private: + + /** + * C++ default constructor. + * + * @param aIapId IAP id + * @param aNetworkId Network id + * @param aClient Client for callback calls + */ + CIctsEngine( TUint32 aIapId, + TUint32 aNetworkId, + MIctsObserver& aClient ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Checks user defined ICT settings stored in CenRep + * + * @return TTestConnQueryResults if successful, otherwise one of the system-wide + * error codes. + */ + TInt CheckSettingL(); + + private: // data + + /** + * IAP identifier + */ + TUint32 iIapId; + + /** + * Network identifier + */ + TUint32 iNetworkId; + + /** + * Return string to client. Can contain + * redirect URL or error information. + */ + TBuf iString; + + /** + * Status if we are polling or not + */ + TBool iPollingStatus; + + /** + * Interval of polling + */ + TInt iPollingInterval; + + /** + * Intance of CenRep + * Own. + */ + CRepository* iRepository; + + /** + * Contains IP address to be used + */ + TBuf8 iIPAddress; + + /** + * Timer for polling interval + * Own. + */ + CIctsPollingIntervalTimer* iPollingIntervalTimer; + + + /** + * Timer for total polling time + * Own. + */ + CIctsPollingTimeTimer* iPollingTimeTimer; + + /** + * Instance of HTTP handling class + * Own. + */ + CIctsHttpHandler* iHttpHandler; + + /** + * Reference of client using test service + * Not own. + */ + MIctsObserver& iClient; + + /** + * Handle to a session with a hotspot server + */ + RHssInterface iHsServer; + + /** + * Easy WLAN IAP id + */ + TUint32 iEasyWlanIapId; + + }; + + +#endif // CICTSEngine_H diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/inc/ictshttphandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/internetconnectivitytestservice/inc/ictshttphandler.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,195 @@ +/* +* 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: Contains implementation for HTTP::HEAD test +* +*/ + + + +#ifndef ICTSHTTPHANDLER_H +#define ICTSHTTPHANDLER_H + +#include +#include +#include + +#include "ictscommon.h" + +class CIctsEngine; + +/** + * Handles HTTP related things. + * + * Sends HTTP::HEAD and interact with HTTP FW. Returns results to + * caller. + * + * @lib ictsclientinterface.lib + */ +class CIctsHttpHandler : public CTimer, public MHTTPTransactionCallback + { + + public: + + /** + * Static constructor. + */ + static CIctsHttpHandler* NewL( CIctsEngine& aOwner, + TInt aHttpResponseTime ); + + /** + * Destructor. + */ + virtual ~CIctsHttpHandler(); + + /** + * Send HTTP::HEAD request + * + * @param aIPAddress IP address + * @param aIapID IAP id + * @param aNetworkId Network id + * @return KErrNone if successful + */ + TInt SendHttpRequestL( TDesC8& aIPAddress, + TUint32 aIapID, + TUint32 aNetworkId ); + + /** + * Cancels HTTP::HEAD request + * + * @return None + */ + void CancelHttpRequestL(); + + public: // from MHTTPTransactionCallback + + /** + * Callback for HTTP FW to call when HTTP events occur + * + * @param aTransaction HTTP transaction + * @param aEvent HTTP event + * @return None + */ + virtual void MHFRunL( RHTTPTransaction aTransaction, + const THTTPEvent& aEvent); + + /** + * Callback for HTTP FW to call when HTTP errors occur + * + * @param aError error code + * @param aTransaction HTTP transaction + * @param aEvent HTTP event + * @return None + */ + virtual TInt MHFRunError( TInt aError, + RHTTPTransaction aTransaction, + const THTTPEvent& aEvent); + + + protected: // Functions from base classes + + /** + * From CActive Handles an active object's request completion event. + */ + void RunL(); + + private: + + /** + * C++ default constructor. + * + * @param aOwner Owner of this instance + * @param aHttpResponseTime Max time for response + */ + CIctsHttpHandler( CIctsEngine& aOwner, TInt aHttpResponseTime ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Set HTTP connection info + * + * @param aConnection Network connection + * @param aSocketServ Socket server + * @return None + */ + void SetHttpConnectionInfoL( RConnection& aConnection, + RSocketServ& aSocketServ ); + /** + * Send HTTP request + * + * @param aIp IP address + * @return None + */ + void SendHttpGetL( TDesC8& aIp ); + + /** + * Check http prefix in URL/IP address + * + * @param aIPAddress URL + * @return ETrue if found, else EFalse + */ + TBool CheckHttp( TDesC8& aIPAddress ); + + private: // data + + /** + * Handle to HTTP session + * Own. + */ + RHTTPSession iHttpSession; + + /** + * Handle to HTTP transaction + * Own. + */ + RHTTPTransaction iHttpTransaction; + + /** + * Handle to socket server + * Own. + */ + RSocketServ iSocketServ; + + /** + * Handle to connection + * Own. + */ + RConnection iConnection; + + /** + * String from HTTP FW + */ + TBuf< KHttpResponseLength > iString; + + + /** + * Reference of owner class + * Not Own. + */ + CIctsEngine& iOwner; + + /** + * Waiting time of HTTP response + */ + TInt iHttpResponseTime; + + /** + * Is attached to connection + */ + TBool iAttachDone; + }; + +#endif // ICTSHTTPHANDLER_H diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/inc/ictspollingintervalobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/internetconnectivitytestservice/inc/ictspollingintervalobserver.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,42 @@ +/* +* 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: Observer class for polling interval +* +*/ + + + + +#ifndef ICTSPOLLINGINTERVALOBSERVER_H +#define ICTSPOLLINGINTERVALOBSERVER_H + +#include + +class MIctsPollingIntervalObserver + { + + public: + + /** + * Timeout occurred ( HTTP response ) + * + * @return None + */ + virtual void PollingIntervalTimeout() = 0; + + }; + + + +#endif // ICTSPOLLINGINTERVALOBSERVER_H diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/inc/ictspollingintervaltimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/internetconnectivitytestservice/inc/ictspollingintervaltimer.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,76 @@ +/* +* 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: Timer class for polling interval +* +*/ + + + +#ifndef ICTSPOLLINGINTERVALTIMER_H +#define ICTSPOLLINGINTERVALTIMER_H + +#include + +class MIctsPollingIntervalObserver; + +/** + * Timer for polling interval + * + * @lib ictsclientinterface.lib + */ +class CIctsPollingIntervalTimer : public CTimer + { + + public: + + /** + * Static constructor. + */ + static CIctsPollingIntervalTimer* NewL( MIctsPollingIntervalObserver& aObserver ); + + /** + * Destructor. + */ + virtual ~CIctsPollingIntervalTimer(); + + // from CTimer + + /** + * Timer expired + */ + void RunL(); + + private: + + /** + * C++ default constructor. + */ + CIctsPollingIntervalTimer( MIctsPollingIntervalObserver& aObserver ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // data + + /** + * Reference of client using timer + * Not own. + */ + MIctsPollingIntervalObserver& iObserver; + + }; + +#endif // ICTSPOLLINGINTERVALTIMER_H \ No newline at end of file diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/inc/ictspollingtimeobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/internetconnectivitytestservice/inc/ictspollingtimeobserver.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,42 @@ +/* +* 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: Observer class for total polling time +* +*/ + + + + +#ifndef ICTSPOLLINGTIMEOBSERVER_H +#define ICTSPOLLINGTIMEOBSERVER_H + +#include + +class MIctsPollingTimeObserver + { + + public: + + /** + * Timeout occurred + * + * @return None + */ + virtual void PollingTimeTimeout() = 0; + + }; + + + +#endif // ICTSPOLLINGTIMEOBSERVER_H diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/inc/ictspollingtimetimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/internetconnectivitytestservice/inc/ictspollingtimetimer.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,76 @@ +/* +* 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: Timer class for total polling time +* +*/ + + + +#ifndef ICTSPOLLINGTIMETIMER_H +#define ICTSPOLLINGTIMETIMER_H + +#include + +class MIctsPollingTimeObserver; + +/** + * Timer for total time used for polling + * + * @lib ictsclientinterface.lib + */ +class CIctsPollingTimeTimer : public CTimer + { + + public: + + /** + * Static constructor. + */ + static CIctsPollingTimeTimer* NewL( MIctsPollingTimeObserver& aObserver ); + + /** + * Destructor. + */ + virtual ~CIctsPollingTimeTimer(); + + // from CTimer + + /** + * Timer expired + */ + void RunL(); + + private: + + /** + * C++ default constructor. + */ + CIctsPollingTimeTimer( MIctsPollingTimeObserver& aObserver ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // data + + /** + * Reference of client using timer + * Not own. + */ + MIctsPollingTimeObserver& iObserver; + + }; + +#endif // ICTSPOLLINGTIMETIMER_H \ No newline at end of file diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/src/ictsasyncwait.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/internetconnectivitytestservice/src/ictsasyncwait.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,74 @@ +/* +* 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 CIctsActiveWait +* +*/ + + + +// INCLUDE FILES +#include +#include "ictsasyncwait.h" + +// --------------------------------------------------------- +// CIctsAsyncWait::CIctsAsyncWait() +// --------------------------------------------------------- +// +CIctsAsyncWait::CIctsAsyncWait() : CActive(CActive::EPriorityUserInput) + { + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------- +// CIctsAsyncWait::~CIctsAsyncWait() +// --------------------------------------------------------- +// +CIctsAsyncWait::~CIctsAsyncWait() + { + Cancel() ; + } + +// --------------------------------------------------------- +// CIctsAsyncWait::Wait() +// --------------------------------------------------------- +// +void CIctsAsyncWait::Wait() +{ + SetActive(); + iActiveWait.Start(); +} + +// --------------------------------------------------------- +// CIctsAsyncWait::RunL() +// --------------------------------------------------------- +// +void CIctsAsyncWait::RunL() +{ + iActiveWait.AsyncStop() ; +} + +// --------------------------------------------------------- +// CIctsAsyncWait::DoCancel() +// --------------------------------------------------------- +// +void CIctsAsyncWait::DoCancel() +{ + if( iStatus == KRequestPending ) + { + TRequestStatus * reqStat = &iStatus; + User::RequestComplete(reqStat, KErrCancel); + } +} + +// End of File diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/src/ictsclientinterface.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/internetconnectivitytestservice/src/ictsclientinterface.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,112 @@ +/* +* 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: Domain API implementation +* +*/ + +#include "ictsclientinterface.h" +#include "ictsengine.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CIctsClientInterface::CIctsClientInterface +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CIctsClientInterface::CIctsClientInterface() + { + + } + +// --------------------------------------------------------------------------- +// CIctsClientInterface::ConstructL +// --------------------------------------------------------------------------- +// +void CIctsClientInterface::ConstructL( TUint32 aIapId, + TUint32 aNetworkId, + MIctsObserver& aClient ) + { + DEBUG("CIctsClientInterface::ConstructL"); + iEngine = CIctsEngine::NewL( aIapId, aNetworkId, aClient ); + } + +// --------------------------------------------------------------------------- +// CIctsClientInterface::NewL +// --------------------------------------------------------------------------- +// +EXPORT_C CIctsClientInterface* CIctsClientInterface::NewL( TUint32 aIapId, + TUint32 aNetworkId, + MIctsObserver& aClient + ) + { + CIctsClientInterface* self = new (ELeave) CIctsClientInterface(); + CleanupStack::PushL( self ); + self->ConstructL( aIapId, aNetworkId, aClient ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CIctsClientInterface::~CIctsClientInterface() +// --------------------------------------------------------------------------- +// +CIctsClientInterface::~CIctsClientInterface() + { + delete iEngine; + } + +// --------------------------------------------------------------------------- +// CIctsClientInterface::StartL +// --------------------------------------------------------------------------- +// +EXPORT_C void CIctsClientInterface::StartL() + { + DEBUG("CIctsClientInterface::StartL()"); + iEngine->StartL(); + } + +// --------------------------------------------------------------------------- +// CIctsClientInterface::CancelStartL +// --------------------------------------------------------------------------- +// +EXPORT_C void CIctsClientInterface::CancelStartL() + { + DEBUG("CIctsClientInterface::CancelStartL()"); + iEngine->CancelStartL(); + } + +// --------------------------------------------------------------------------- +// CIctsClientInterface::StartPolling +// --------------------------------------------------------------------------- +// +EXPORT_C void CIctsClientInterface::StartPolling( TInt aTime, TInt aInterval ) + { + DEBUG("CIctsClientInterface::StartPolling()"); + iEngine->StartPolling( aTime, aInterval ); + } + +// --------------------------------------------------------------------------- +// CIctsClientInterface::StopPolling +// --------------------------------------------------------------------------- +// +EXPORT_C void CIctsClientInterface::StopPolling() + { + DEBUG("CIctsClientInterface::StopPolling()"); + iEngine->StopPolling(); + } + +// End of File diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/src/ictsengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/internetconnectivitytestservice/src/ictsengine.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,285 @@ +/* +* 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: Actual implementation of DLL. +* +*/ + + +#include +#include +#include +#include +#include +#include +#include + +#include "ictsengine.h" +#include "internetconnectivitycrkeys.h" +#include "ictsasyncwait.h" +#include "am_debug.h" +#include "hotspotclientserver.h" + + +using namespace CMManager; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CIctsEngine::CIctsEngine +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CIctsEngine::CIctsEngine( TUint32 aIapId, + TUint32 aNetworkId, + MIctsObserver& aClient ) : +iIapId( aIapId ), iNetworkId( aNetworkId ), iPollingStatus( EFalse ), +iRepository( NULL ), iClient( aClient ) + { + + } + +// --------------------------------------------------------------------------- +// CIctsEngine::ConstructL +// --------------------------------------------------------------------------- +// +void CIctsEngine::ConstructL() + { + DEBUG("CIctsEngine::ConstructL"); + _LIT8(KIp, "http://connectivity-test.ext.nokia.com/"); + + // CenRep uses UTF 16 + HBufC16* uriBuffer = HBufC16::NewLC( KMaxIpLength ); + TPtr16 uriPtr = uriBuffer->Des(); + // For HTTP FW change it to 8bit + HBufC8* uriBuffer8 = HBufC8::NewLC( KMaxIpLength ); + TPtr8 uriPtr8 = uriBuffer8->Des(); + TRAPD(err, iRepository = CRepository::NewL( + KCRUidInternetConnectivitySettings ) ); + if ( KErrNone == err ) + { + TInt err = iRepository->Get( KIctsIpDestination, uriPtr ); + uriPtr8.Copy( uriPtr ); + iIPAddress = uriPtr8; + if ( KErrNone != err ) + { + iIPAddress = KIp(); + } + } + else + { + iIPAddress = KIp(); + } + CleanupStack::PopAndDestroy(uriBuffer8); + CleanupStack::PopAndDestroy(uriBuffer); + iPollingIntervalTimer = CIctsPollingIntervalTimer::NewL( *this ); + + iPollingTimeTimer = CIctsPollingTimeTimer::NewL( *this ); + + iHttpHandler = CIctsHttpHandler::NewL( *this, KHttpResponseTime ); + + RCmManagerExt cmManager; + cmManager.OpenL(); + CleanupClosePushL( cmManager ); + + iEasyWlanIapId = cmManager.EasyWlanIdL(); + DEBUG1("CIctsEngine::ConstructL iEasyWlanIapId %d", iEasyWlanIapId ); + CleanupStack::PopAndDestroy( &cmManager ); + } + +// --------------------------------------------------------------------------- +// CIctsEngine::NewL +// --------------------------------------------------------------------------- +// +CIctsEngine* CIctsEngine::NewL( TUint32 aIapId, + TUint32 aNetworkId, + MIctsObserver& aClient + ) + { + CIctsEngine* self = new (ELeave) CIctsEngine( aIapId, + aNetworkId, + aClient ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CIctsEngine::~CIctsEngine +// --------------------------------------------------------------------------- +// +CIctsEngine::~CIctsEngine() + { + DEBUG("CIctsEngine::~CIctsEngine()"); + if ( iRepository ) + { + delete iRepository; + } + + if ( iPollingIntervalTimer ) + { + delete iPollingIntervalTimer; + } + + if ( iPollingTimeTimer ) + { + delete iPollingTimeTimer; + } + + if ( iHttpHandler ) + { + delete iHttpHandler; + } + + iHsServer.Close(); + DEBUG("CIctsEngine::~CIctsEngine() DONE"); + } + +// --------------------------------------------------------------------------- +// CIctsEngine::Start +// --------------------------------------------------------------------------- +// +void CIctsEngine::StartL() + { + DEBUG("CIctsEngine::StartL()"); + if ( CheckSettingL() == EIctsRunAutomatically ) + { + TInt result = iHttpHandler->SendHttpRequestL( iIPAddress , iIapId, iNetworkId ); + + // Sending HTTP request did not succeed. RConnection failed. + if ( KErrNone != result ) + { + iClient.ConnectivityObserver( EConnectionNotOk, iString ); + } + } + else + { + iClient.ConnectivityObserver( EConnectionNotOk, iString ); + } + } + +// --------------------------------------------------------------------------- +// CIctsEngine::CancelStart +// --------------------------------------------------------------------------- +// +void CIctsEngine::CancelStartL() + { + DEBUG("CIctsEngine::CancelStartL()"); + iHttpHandler->CancelHttpRequestL(); + } + +// --------------------------------------------------------------------------- +// CIctsEngine::StartPolling +// --------------------------------------------------------------------------- +// +void CIctsEngine::StartPolling( TInt aTime, + TInt aInterval ) + { + DEBUG("CIctsEngine::StartPolling()"); + iPollingStatus = ETrue; + iPollingInterval = aInterval; + // Do not send right away HTTP request since most likely it will fail. -> hotspot browser case. + iPollingIntervalTimer->After( KStartPollingWait ); + iPollingTimeTimer->After( aTime + KStartPollingWait ); + } + +// --------------------------------------------------------------------------- +// CIctsEngine::StopPolling +// --------------------------------------------------------------------------- +// +void CIctsEngine::StopPolling() + { + DEBUG("CIctsEngine::StopPolling()"); + iPollingIntervalTimer->Cancel(); + iPollingTimeTimer->Cancel(); + iPollingStatus = EFalse; + } + +// --------------------------------------------------------------------------- +// CIctsEngine::CheckSettingL +// --------------------------------------------------------------------------- +// +TInt CIctsEngine::CheckSettingL() + { + DEBUG("CIctsEngine::CheckSettingL()"); + // Check connectivity test setting from CenRep + TInt ret( EIctsRunAutomatically ); + iRepository->Get( KIctsTestPermission, ret ); + + return ret; + } + +// --------------------------------------------------------------------------- +// CIctsEngine::PollingIntervalTimeout +// --------------------------------------------------------------------------- +// +void CIctsEngine::PollingIntervalTimeout() + { + DEBUG("CIctsEngine::PollingIntervalTimeout()"); + TRAPD( err, iHttpHandler->SendHttpRequestL( iIPAddress , + iIapId, + iNetworkId )); + + if ( KErrNone != err ) + { + DEBUG1("CIctsEngine::PollingIntervalTimeout() err: %d", err); + StopPolling(); + iClient.ConnectivityObserver( EConnectionNotOk, iString ); + } + iPollingIntervalTimer->After( iPollingInterval ); + } + +// --------------------------------------------------------------------------- +// CIctsEngine::PollingTimeTimeout +// --------------------------------------------------------------------------- +// +void CIctsEngine::PollingTimeTimeout() + { + DEBUG("CIctsEngine::PollingTimeTimeout()"); + StopPolling(); + iClient.ConnectivityObserver( ETimeout, iString ); + } + +// --------------------------------------------------------------------------- +// CIctsEngine::HttpEventL +// --------------------------------------------------------------------------- +// +void CIctsEngine::HttpEventL( TIctsTestResult aResult, TDesC& aString ) + { + DEBUG("CIctsEngine::HttpEventL()"); + + if( iPollingStatus ) + { + DEBUG("CIctsEngine::HttpEventL() polling"); + // We are polling. Send only EConnectionOk result to client. + // Otherwise continue polling. + if ( aResult == EConnectionOk) + { + DEBUG("CIctsEngine::HttpEventL() EConnectionOk"); + StopPolling(); + iClient.ConnectivityObserver( aResult, aString ); + } + + } + else + { + DEBUG("CIctsEngine::HttpEventL() not polling"); + iClient.ConnectivityObserver( aResult, aString ); + DEBUG("CIctsEngine::HttpEventL() result sent"); + } + } + +// End of File diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/src/ictshttphandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/internetconnectivitytestservice/src/ictshttphandler.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,421 @@ +/* +* 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: HTTP class for HTTP::HEAD testing +* +*/ + + + +#include +#include + +#include "ictshttphandler.h" +#include "ictsengine.h" +#include "am_debug.h" + +// CONSTANTS +_LIT8( KHeaderName, "X-Nokia-WLAN-Connectivity-Test" ); +_LIT8( KHeaderValue, "true" ); +_LIT8( KHttpPrefix, "http://" ); + +const TInt KMovedPermanently = 301; +const TInt KFound = 302; +const TInt KSeeOther = 303; +const TInt KTemporaryRedirect = 307; +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// CIctsHttpHandler::CIctsHttpHandler +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CIctsHttpHandler::CIctsHttpHandler( CIctsEngine& aOwner, + TInt aHttpResponseTime ) : +CTimer( EPriorityLow ), iOwner( aOwner ), +iHttpResponseTime( aHttpResponseTime ), iAttachDone( EFalse ) + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------------------------- +// CIctsHttpHandler::ConstructL +// --------------------------------------------------------------------------- +// +void CIctsHttpHandler::ConstructL() + { + DEBUG("CIctsHttpHandler::ConstructL()"); + // Open channel to Socket Server + User::LeaveIfError( iSocketServ.Connect() ); + // Open connection + User::LeaveIfError( iConnection.Open(iSocketServ) ); + + CTimer::ConstructL(); + + } + + +// --------------------------------------------------------------------------- +// CIctsHttpHandler::NewL +// --------------------------------------------------------------------------- +// +CIctsHttpHandler* CIctsHttpHandler::NewL( CIctsEngine& aOwner, + TInt aHttpResponseTime ) + { + DEBUG("CIctsHttpHandler::NewL()"); + CIctsHttpHandler* self = new( ELeave ) CIctsHttpHandler( aOwner, aHttpResponseTime ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CIctsHttpHandler::~CIctsHttpHandler +// --------------------------------------------------------------------------- +// +CIctsHttpHandler::~CIctsHttpHandler() + { + DEBUG("CIctsHttpHandler::~CIctsHttpHandler()"); + iHttpSession.Close(); + CTimer::Cancel(); + iConnection.Close(); + iSocketServ.Close(); + DEBUG("CIctsHttpHandler::~CIctsHttpHandler() Done"); + } + + +// --------------------------------------------------------------------------- +// CIctsHttpHandler::SetHttpConnectionInfoL +// --------------------------------------------------------------------------- +// +void CIctsHttpHandler::SetHttpConnectionInfoL( RConnection& aConnection, + RSocketServ& aSocketServ) + { + DEBUG("CIctsHttpHandler::SetHttpConnectionInfoL"); + TInt result; + TBuf<16> serviceType; + TUint32 serviceId; + TBuf<100> query; + TUint connCount; + + iHttpSession.Close(); + iHttpSession.OpenL(); + + RStringPool strPool = iHttpSession.StringPool(); + + // Remove first session properties just in case. + RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo(); + + // Clear RConnection and Socket Server instances + connInfo.RemoveProperty(strPool.StringF(HTTP::EHttpSocketServ,RHTTPSession::GetTable())); + connInfo.RemoveProperty(strPool.StringF(HTTP::EHttpSocketConnection,RHTTPSession::GetTable())); + + // Clear the proxy settings + THTTPHdrVal proxyUsage(strPool.StringF(HTTP::EUseProxy,RHTTPSession::GetTable())); + connInfo.RemoveProperty(strPool.StringF(HTTP::EProxyUsage,RHTTPSession::GetTable())); + connInfo.RemoveProperty(strPool.StringF(HTTP::EProxyAddress,RHTTPSession::GetTable())); + + // RConnection has been started, set proxy (if defined) and RConnection and + // Socket Server session properties. + + // Proxy + result = aConnection.EnumerateConnections(connCount); + User::LeaveIfError(result); + + // Get service and service type for this connection + // + _LIT(string, "%s\\%s"); + query.Format(string, IAP, IAP_SERVICE); + result = aConnection.GetIntSetting(query, serviceId); + + query.Format(string, IAP, IAP_SERVICE_TYPE); + result = aConnection.GetDesSetting(query, serviceType); + User::LeaveIfError(result); + + + // RConnection and Socket Server + // Now bind the HTTP session with the socket server connection + connInfo.SetPropertyL ( + strPool.StringF(HTTP::EHttpSocketServ, RHTTPSession::GetTable()), + THTTPHdrVal (aSocketServ.Handle()) ); + + TInt connPtr1 = reinterpret_cast(&aConnection); + connInfo.SetPropertyL ( + strPool.StringF(HTTP::EHttpSocketConnection, + RHTTPSession::GetTable() ), THTTPHdrVal (connPtr1) ); + + } + +// --------------------------------------------------------------------------- +// CIctsHttpHandler::SendHttpRequestL +// --------------------------------------------------------------------------- +// +TInt CIctsHttpHandler::SendHttpRequestL( TDesC8& aIPAddress, + TUint32 aIapID, + TUint32 aNetworkId ) + { + + DEBUG("CIctsHttpHandler::SendHttpRequestL"); + + // Cancel possibly outstanding request for polling reasons. + CTimer::Cancel(); + + TConnectionInfo info; + TPckg< TConnectionInfo > pckgInfo( info ); + info.iIapId = aIapID; + info.iNetId = aNetworkId; + + TInt err( KErrNone ); + + if ( !iAttachDone ) + { + err = iConnection.Attach( pckgInfo, RConnection::EAttachTypeMonitor); + DEBUG1("CIctsHttpHandler::SendHttpRequestL attach: %d", err); + } + + if ( KErrNone == err ) + { + iAttachDone = ETrue; + SetHttpConnectionInfoL( iConnection, iSocketServ ); + + // Remove redirect filter + RStringPool stringPool = iHttpSession.StringPool(); + RStringF filterName = stringPool.StringF(HTTP::ERedirect, RHTTPSession::GetTable()); + iHttpSession.FilterCollection().RemoveFilter(filterName); + + RStringPool strPool = iHttpSession.StringPool(); + RStringF method = strPool.StringF(HTTP::EHEAD,RHTTPSession::GetTable()); + + TBuf8 ip; + + TBool httpExists = CheckHttp( aIPAddress ); + if ( !httpExists ) + { + ip.Copy( KHttpPrefix ); + } + ip.Append( aIPAddress ); + + // Parse string to URI + TUriParser8 uri; + uri.Parse(ip); + iHttpTransaction = iHttpSession.OpenTransactionL(uri, *this, method); + RHTTPHeaders hdr = iHttpTransaction.Request().GetHeaderCollection(); + + RStringF headerStrName = strPool.OpenFStringL( KHeaderName() ); + CleanupClosePushL( headerStrName ); + + RStringF headerStrValue = strPool.OpenFStringL( KHeaderValue() ); + CleanupClosePushL( headerStrValue ); + + THTTPHdrVal headerValue( headerStrValue ); + hdr.SetFieldL( headerStrName, headerValue ); + + CleanupStack::PopAndDestroy( &headerStrValue ); + CleanupStack::PopAndDestroy( &headerStrName ); + + iHttpTransaction.SubmitL(); + DEBUG("CIctsHttpHandler::SendHttpGetL SubmitL() done"); + CTimer::After( iHttpResponseTime ); + } + + return err; + } + +// --------------------------------------------------------------------------- +// CIctsHttpHandler::CancelHttpRequestL +// --------------------------------------------------------------------------- +// +void CIctsHttpHandler::CancelHttpRequestL() + { + DEBUG("CIctsHttpHandler::CancelHttpRequestL()"); + CTimer::Cancel(); + iHttpTransaction.Cancel(); + } + +// --------------------------------------------------------------------------- +// CIctsHttpHandler::RunL +// --------------------------------------------------------------------------- +// +void CIctsHttpHandler::RunL() + { + DEBUG("CIctsHttpHandler::RunL()"); + iHttpSession.Close(); + iString = KNullDesC; + iOwner.HttpEventL( ETimeout, iString ); + } + + +// --------------------------------------------------------------------------- +// CIctsHttpHandler::MHFRunL +// +// Inherited from MHTTPTransactionCallback +// Called by framework to pass transaction events. +// --------------------------------------------------------------------------- +// +void CIctsHttpHandler::MHFRunL(RHTTPTransaction aTransaction, + const THTTPEvent& aEvent) + { + DEBUG("CIctsHttpHandler::MHFRunL"); + + switch (aEvent.iStatus) + { + + case THTTPEvent::EGotResponseHeaders: + { + DEBUG("CIctsHttpHandler::THTTPEvent::EGotResponseHeaders"); + } + break; + + case THTTPEvent::EGotResponseBodyData: + { + DEBUG("CIctsHttpHandler::THTTPEvent::EGotResponseBodyData"); + } + break; + + case THTTPEvent::EResponseComplete: + { + DEBUG("CIctsHttpHandler::THTTPEvent::EResponseComplete"); + } + break; + + case THTTPEvent::ESucceeded: + { + DEBUG("CIctsHttpHandler::THTTPEvent::ESucceeded"); + CTimer::Cancel(); + // Indicates that transaction succeeded. + // Transaction can be closed now. It's not needed anymore. + aTransaction.Close(); + iHttpSession.Close(); + iOwner.HttpEventL( EConnectionOk, iString ); + iString = KNullDesC; + } + break; + + case THTTPEvent::EFailed: + { + CTimer::Cancel(); + DEBUG("CIctsHttpHandler::THTTPEvent::EFailed"); + + RHTTPResponse resp = aTransaction.Response(); + TInt status = resp.StatusCode(); + + // Check if redirect was cause of EFailed + if( status == KMovedPermanently || status == KFound || + status == KSeeOther || status == KTemporaryRedirect ) + { + + // Inform the hotspot server that authentication is needed + RHTTPHeaders hdr =aTransaction.Response().GetHeaderCollection(); + RStringPool strP = aTransaction.Session().StringPool(); + RStringF location = strP.StringF(HTTP::ELocation,RHTTPSession::GetTable()); + + //parse the headers and look for location header + THTTPHdrVal hVal; + if(hdr.GetField(location,0,hVal)== KErrNone) + { + DEBUG("CIctsHttpHandler::THTTPEvent::GetField"); + // Location header is present + RStringF fieldValStr = strP.StringF(hVal.StrF()); + const TDesC8& fieldValDesC = fieldValStr.DesC(); + iString.Copy(fieldValDesC); + aTransaction.Close(); + iHttpSession.Close(); + iOwner.HttpEventL( EHttpAuthenticationNeeded, iString ); + } + else + { + // No location header. Can't use authentication -> redirect. + aTransaction.Close(); + iHttpSession.Close(); + iOwner.HttpEventL( EConnectionNotOk, iString ); + } + } + else + { + // Failed for other reason than redirect + aTransaction.Close(); + iHttpSession.Close(); + iOwner.HttpEventL( EConnectionNotOk, iString ); + } + + iString = KNullDesC; + } + break; + + case THTTPEvent::ERedirectedPermanently: + { + // Nothing here + DEBUG("CIctsHttpHandler::THTTPEvent::ERedirectedPermanently"); + } + break; + + case THTTPEvent::ERedirectedTemporarily: + { + // Nothing here + DEBUG("CIctsHttpHandler::THTTPEvent::ERedirectedTemporarily"); + } + break; + + default: + { + DEBUG1( "CIctsHttpHandler::MHFRunL::default iStatus: %d", aEvent.iStatus ); + CTimer::Cancel(); + aTransaction.Close(); + iHttpSession.Close(); + // close the transaction if it's an error + if ( aEvent.iStatus < 0 ) + { + _LIT(string, "Unknown error"); + iString = string; + iOwner.HttpEventL( EConnectionNotOk, iString ); + } + else + { + _LIT(string, "Default"); + iString = string; + iOwner.HttpEventL( EConnectionNotOk, iString ); + } + } + break; + } + } + +// --------------------------------------------------------------------------- +// CIctsHttpHandler::MHFRunError +// +// Inherited from MHTTPTransactionCallback +// Called by framework to pass transaction error. +// --------------------------------------------------------------------------- +// +TInt CIctsHttpHandler::MHFRunError( TInt /*aError*/, + RHTTPTransaction /*aTransaction*/, + const THTTPEvent& /*aEvent*/) + { + DEBUG("CIctsHttpHandler::MHFRunError"); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// CIctsHttpHandler::CheckHttp +// ---------------------------------------------------------------------------- +TBool CIctsHttpHandler::CheckHttp( TDesC8& aIPAddress ) + { + // The "http://" prefix is expected to be at the beginning of the URI. + return ( 0 == aIPAddress.Find( KHttpPrefix ) ); + } + +// End of File diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/src/ictspollingintervaltimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/internetconnectivitytestservice/src/ictspollingintervaltimer.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,86 @@ +/* +* 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: Timer for polling interval +* +*/ + + + +#include "ictspollingintervaltimer.h" +#include "ictspollingintervalobserver.h" +#include "am_debug.h" + + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// CIctsPollingIntervalTimer::CIctsPollingIntervalTimer +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CIctsPollingIntervalTimer::CIctsPollingIntervalTimer( MIctsPollingIntervalObserver& aObserver ) +: CTimer( EPriorityStandard ), iObserver( aObserver ) + { + + } + +// --------------------------------------------------------------------------- +// CIctsPollingIntervalTimer::ConstructL +// --------------------------------------------------------------------------- +// +void CIctsPollingIntervalTimer::ConstructL() + { + DEBUG("CIctsPollingIntervalTimer::ConstructL()"); + CTimer::ConstructL(); + CActiveScheduler::Add(this); + } + + +// --------------------------------------------------------------------------- +// CIctsPollingIntervalTimer::NewL +// --------------------------------------------------------------------------- +// +CIctsPollingIntervalTimer* CIctsPollingIntervalTimer::NewL( MIctsPollingIntervalObserver& aObserver ) + { + CIctsPollingIntervalTimer* self = new( ELeave ) CIctsPollingIntervalTimer( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +// --------------------------------------------------------------------------- +// CIctsPollingIntervalTimer::~CIctsPollingIntervalTimer +// --------------------------------------------------------------------------- +// +CIctsPollingIntervalTimer::~CIctsPollingIntervalTimer() + { + CTimer::Cancel(); + } + +// --------------------------------------------------------------------------- +// CIctsPollingIntervalTimer::RunL +// --------------------------------------------------------------------------- +// +void CIctsPollingIntervalTimer::RunL() + { + DEBUG("CIctsPollingIntervalTimer::RunL()"); + iObserver.PollingIntervalTimeout(); + } + +// End of File diff -r 000000000000 -r 56b72877c1cb hotspotfw/internetconnectivitytestservice/src/ictspollingtimetimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/internetconnectivitytestservice/src/ictspollingtimetimer.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,88 @@ +/* +* 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: Timer of time that will be used to polling +* +*/ + + + +#include "ictspollingtimetimer.h" +#include "ictspollingtimeobserver.h" +#include "am_debug.h" + + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// CIctsPollingTimeTimer::CIctsPollingTimeTimer +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CIctsPollingTimeTimer::CIctsPollingTimeTimer( MIctsPollingTimeObserver& aObserver ) +: CTimer( EPriorityStandard ), iObserver( aObserver ) + { + + } + + +// --------------------------------------------------------------------------- +// CIctsPollingTimeTimer::ConstructL +// --------------------------------------------------------------------------- +// +void CIctsPollingTimeTimer::ConstructL() + { + DEBUG("CIctsPollingTimeTimer::ConstructL()"); + CTimer::ConstructL(); + CActiveScheduler::Add(this); + } + + +// --------------------------------------------------------------------------- +// CIctsPollingTimeTimer::NewL +// --------------------------------------------------------------------------- +// +CIctsPollingTimeTimer* CIctsPollingTimeTimer::NewL( MIctsPollingTimeObserver& aObserver ) + { + CIctsPollingTimeTimer* self = new( ELeave ) CIctsPollingTimeTimer( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +// --------------------------------------------------------------------------- +// CIctsPollingTimeTimer::~CIctsPollingTimeTimer +// --------------------------------------------------------------------------- +// +CIctsPollingTimeTimer::~CIctsPollingTimeTimer() + { + CTimer::Cancel(); + + } + +// --------------------------------------------------------------------------- +// CIctsPollingTimeTimer::RunL +// --------------------------------------------------------------------------- +// +void CIctsPollingTimeTimer::RunL() + { + DEBUG("CIctsPollingTimeTimer::RunL()"); + iObserver.PollingTimeTimeout(); + } + +// End of File diff -r 000000000000 -r 56b72877c1cb hotspotfw/rom/hotspot.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/rom/hotspot.iby Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,49 @@ +/* +* 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 HOTSPOT_IBY +#define HOTSPOT_IBY + +#include +#include + +#ifdef __PROTOCOL_WLAN + +*** DLLs +file=ABI_DIR\BUILD_DIR\hotspotclient.dll SHARED_LIB_DIR\hotspotclient.dll +file=ABI_DIR\BUILD_DIR\ictsclientinterface.dll SHARED_LIB_DIR\ictsclientinterface.dll + +S60_APP_EXE( HotSpotServer ) + +ECOM_PLUGIN( NetCfgExtnHotSpot.dll, 10282EC9.rss ) +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 + +#endif // __PROTOCOL_WLAN +#endif // HOTSPOTS_IBY \ No newline at end of file diff -r 000000000000 -r 56b72877c1cb hotspotfw/rom/hotspotResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/rom/hotspotResources.iby Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hsfw_plat/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,23 @@ +/* +* 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: Includes all the Domain API specific bld.inf files, which +: export files. +* +*/ + + +#include "../hotspot_framework_client_api/group/bld.inf" +#include "../internet_connectivity_test_service_api/group/bld.inf" +#include "../internet_connectivity_test_service_settings_api/group/bld.inf" +#include "../hotspot_framework_client_plugin_api/group/bld.inf" diff -r 000000000000 -r 56b72877c1cb hsfw_plat/hotspot_framework_client_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/hotspot_framework_client_api/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,35 @@ +/* +* 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: File that exports the files belonging to +: HotSpot Framework Client API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/hssmgmtinterface.h MW_LAYER_PLATFORM_EXPORT_PATH(hssmgmtinterface.h) +../inc/hssmgmtscaninfointerface.h MW_LAYER_PLATFORM_EXPORT_PATH(hssmgmtscaninfointerface.h) +../inc/hssmgmtclient.h MW_LAYER_PLATFORM_EXPORT_PATH(hssmgmtclient.h) +../inc/hssiapsettings.h MW_LAYER_PLATFORM_EXPORT_PATH(hssiapsettings.h) +../inc/hssmgmtcommon.h MW_LAYER_PLATFORM_EXPORT_PATH(hssmgmtcommon.h) +../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 000000000000 -r 56b72877c1cb hsfw_plat/hotspot_framework_client_api/hotspot_framework_client_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/hotspot_framework_client_api/hotspot_framework_client_api.metaxml Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,17 @@ + + + HotSpot Framework Client API + An API for the clients to request services from HotSpot Framework. + c++ + hotspotfw + + + + + + + + yes + no + + diff -r 000000000000 -r 56b72877c1cb hsfw_plat/hotspot_framework_client_api/inc/hssiapsettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/hotspot_framework_client_api/inc/hssiapsettings.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,250 @@ +/* +* Copyright (c) 2002-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: IAP Settings for HotSpot FW +* +*/ + + + + +#ifndef HSSIAPSETTINGS_H +#define HSSIAPSETTINGS_H + +// INCLUDES +#include +#include + +// CONSTANTS +const TInt KHssWlanWpaPskLength = 64; +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 + +enum EHssWepAuthenticationMode + { + EHssOpen = 0, + EHssShared = 1 + }; + +enum EHssConnectionMode + { + EHssAdhoc = 0, + EHssInfrastructure = 1 + }; + +enum EHssWlanSecurityMode + { + EHssAllowUnsecure = 1, + EHssWep = 2, + EHssWlan8021x = 4, + EHssWpa = 8, + EHssWpa2Only = 16 + }; + +enum EHssWEPKeyFormat + { + EAscii, // Ascii format + EHexadecimal // Hex format + }; + +/** +* Data structure for storing a WEP key. +*/ +struct SHssWep + { + /** Specifies 64/128/152/256-bit WEP. Range: 0-3 */ + TUint32 KeyIndex; + /** The length of KeyMaterial in bytes. Range: 0-29 */ + TUint32 KeyLength; + /** 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 +*/ +class THssIapSettings + + { + public: + THssIapSettings(); + TBuf Name; + + EHssConnectionMode iConnectionMode; + TBuf iSSID; + + EHssWlanSecurityMode iSecurityMode; + + SHssWep iWepKey1; + SHssWep iWepKey2; + SHssWep iWepKey3; + SHssWep iWepKey4; + EHssWEPKeyFormat iWepKeyFormat[KHssMaxNumberOfKeys]; + // Defines which WEP is in use. Range 0-3. + TUint32 iWepIndex; + + EHssWepAuthenticationMode iAuthenticationMode; + + TBuf8 iWPAPreSharedKey; + TUint32 iWPAKeyLength; + TBool iEnableWpaPsk; + + RPointerArray iEapDataArray; + }; + + +#include "hssiapsettings.inl" + +#endif // HSSIAPSETTINGS_H + +// end of file + diff -r 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb hsfw_plat/hotspot_framework_client_api/inc/hssmgmtclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/hotspot_framework_client_api/inc/hssmgmtclient.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2002-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: Wrapper class for instantiating an implementation of +* MHssMgmtInterface via ECom framework. +* +*/ + + + +#ifndef HSSMGMTCLIENT_H +#define HSSMGMTCLIENT_H + +// INCLUDES +#include +#include "hssmgmtinterface.h" + +// CLASS DECLARATION +/** +* @brief Class for instantiating an implementation of MHssMgmtInterface via ECom. +*/ +class CHssMgmtClient : public CBase, public MHssMgmtInterface + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + * @return Pointer to the constructed object. + */ + inline static CHssMgmtClient* NewL(); + + /** + * Destructor. + */ + inline virtual ~CHssMgmtClient(); + + private: // Data + + // Identifies the instance of an implementation created by + // the ECOM framework. + TUid iInstanceIdentifier; + }; + +#include "hssmgmtclient.inl" + +#endif // HSSMGMTCLIENT_H + +// End of File diff -r 000000000000 -r 56b72877c1cb hsfw_plat/hotspot_framework_client_api/inc/hssmgmtclient.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/hotspot_framework_client_api/inc/hssmgmtclient.inl Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2002-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: Inline functions of CHssMgmtClient class. +* +*/ + + + +#ifndef HSSMGMTCLIENT_INL +#define HSSMGMTCLIENT_INL + +// --------------------------------------------------------- +// CHssScanRequest::NewL +// --------------------------------------------------------- +// +inline CHssMgmtClient* CHssMgmtClient::NewL() + { + const TUid KCHssMgmtClientUid = { 0x10282ece }; + + TAny* interface = REComSession::CreateImplementationL( + KCHssMgmtClientUid, + _FOFF( CHssMgmtClient, + iInstanceIdentifier ) ); + return reinterpret_cast( interface ); + } + +// --------------------------------------------------------- +// CHssScanRequest::~CHssMgmtClient +// --------------------------------------------------------- +// +inline CHssMgmtClient::~CHssMgmtClient() + { + REComSession::DestroyedImplementation( iInstanceIdentifier ); + } + +#endif // HSSMGMTCLIENT_INL + +// End of File diff -r 000000000000 -r 56b72877c1cb hsfw_plat/hotspot_framework_client_api/inc/hssmgmtcommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/hotspot_framework_client_api/inc/hssmgmtcommon.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,88 @@ +/* +* 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: Contains common data structures used by HotSpot management service. +* +*/ + + + +#ifndef HSSMGMTCOMMON_H +#define HSSMGMTCOMMON_H + +// INCLUDES +#include + +// LOCAL CONSTANTS +// The maximum SSID length. +const TUint KHssMaxSsidLength = 32; + +// The maximum BSSID length. +const TUint KHssMaxBssidLength = 6; + +// DATA TYPES +// Data structure for storing the SSID of a HSS network. +typedef TBuf8 THssSsid; + +// Data structure for storing the BSSID of a BSS. +typedef TBuf8 THssBssid; + +// Values for possible HSS connection security modes. +enum THssConnectionSecurityMode + { + // Security mode open, i.e. no security + EHssConnectionSecurityOpen, + // Security mode WEP + EHssConnectionSecurityWep, + // Security mode 802d1x + EHssConnectionSecurity802d1x, + // Security mode WPA + EHssConnectionSecurityWpa, + // Security mode WPA PSK + EHssConnectionSecurityWpaPsk + }; + +// CLASS DECLARATION +/** +* @brief Callback interface for HotSpot management notifications. +* +* These virtual methods should be inherited and implemented by the +* client wanting to observe HotSpot management events. +* +* The client has to enable notifications by calling the appropriate +* method from the management interface. +* @see MHssInterface::ActivateNotificationsL. +*/ +class MHssMgmtNotifications + { + public: + + /** + * New networks have been detected during scan. + * + * @param aIapId ID of the IAP. + */ + virtual void NewNetworksDetected( TUint /*aIapId*/) {}; + + /** + * One or more networks have been lost since the last scan. + * + * @param aIapId ID of the IAP. + */ + virtual void OldNetworksLost( TUint /*aIapId*/ ) {}; + + }; + +#endif // HSSMGMTCOMMON_H + +// End of File diff -r 000000000000 -r 56b72877c1cb hsfw_plat/hotspot_framework_client_api/inc/hssmgmtinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/hotspot_framework_client_api/inc/hssmgmtinterface.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,197 @@ +/* +* 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: ECom interface definition for HSS management services. +* +*/ + + + +#ifndef HSSMGMTINTERFACE_H +#define HSSMGMTINTERFACE_H + +// INCLUDES +#include "hssmgmtcommon.h" +#include "hssmgmtscaninfo.h" +#include "hssiapsettings.h" + + +// CLASS DECLARATION +/** +* @brief ECom interface class for HSS management services. +* +* This class contains the methods for managing HSS connections +* and querying the statuses of various connection variables. +*/ +class MHssMgmtInterface + { + public: + + /** + * Activate the notification service. + * + * After the client has enabled the notification service, it can + * receive asynchronous notifications from the server. + * @param aCallback The class that implements the callback interface. + */ + virtual void ActivateNotificationsL( MHssMgmtNotifications& aCallback ) = 0; + + /** + * Cancel the notification service. + */ + virtual void CancelNotifications() = 0; + + /** + * Perform a scan and return the detected HSS networks. + * @param aResults Results of the scan. + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + */ + virtual TInt GetScanResults( CHssMgmtScanInfo& aResults ) = 0; + + + /** + * Create and Protect IAP, register Client. + * + * @param aUid UID of the client. + * @param aIapName Name of the IAP to be registered. + * @param aWaitNote Indication of UI authentication, if in use TRUE, else FALSE. + * @return IAP ID if successful, otherwise 0 is returned (0 can't be IAP id). + */ + virtual TUint Register( const TUid aUid, + const TDesC& aIapName, + const TUint aWaitNote ) = 0; + + + /** + * Delete IAP and unregister Client. + * + * @param aUid, UID of the client. + * @param aIapId, ID of the IAP. + * @param aNetworkId, ID of Network which IAP belongs to. + * @return KErrNone, if IAP removal successful; + * otherwise one of the other system-wide error codes. + */ + virtual TInt UnRegister( const TUid aUid, + const TUint aIapId, + const TUint aNetworkId ) = 0; + + /** + * Change IAP settings. + * + * @param aIapId ID of the IAP. + * @param aSettings Settings of the IAP. + * @return KErrNone if HotSpot FW was able to receive message; + * otherwise one of the other system-wide error codes. + */ + virtual TInt ChangeSettings( const TUint aIapId, + const THssIapSettings &aSettings ) = 0; + + /** + * Associate IAP with network. + * + * @param aIapId ID of the IAP. + * @return KErrNone if HotSpot FW was able to receive message; + * otherwise one of the other system-wide error codes. + */ + virtual TInt Join( const TUint aIapId ) = 0; + + /** + * Cancel IAP association. + * + * @param aIapId ID of the IAP. + * @return KErrNone if HotSpot FW was able to receive message; + * otherwise one of the other system-wide error codes. + */ + virtual TInt CancelStart( const TUint aIapId ) = 0; + + /** + * Stop associating IAP. + * + * @param aIapId ID of the IAP. + * @return KErrNone if HotSpot FW was able to receive message; + * otherwise one of the other system-wide error codes. + */ + virtual TInt Stop( const TUint aIapId ) = 0; + + /** + * Inform login completion. + * + * @param aIapId ID of the IAP. + * @param aStatus, Result of login procedure. + * @return KErrNone if HotSpot FW was able to receive message; + * otherwise one of the other system-wide error codes. + */ + virtual TInt LoginComplete( const TUint aIapId, const TInt aStatus ) = 0; + + /** + * Inform logout completion. + * + * @param aIapId ID of the IAP. + * @return KErrNone if HotSpot FW was able to receive message; + * otherwise one of the other system-wide error codes. + */ + virtual TInt LogoutComplete( const TUint aIapId ) = 0; + + /** + * Check status of BackgroundScan. + * @return 0 if off, otherwise number as scan interval in seconds. + */ + virtual TUint32 CheckBackgroundScan() = 0; + + /** + * Get the BSSID of the currently connected AP. + * @param aBssId, MAC address of a connection + * @return KErrNone if successful, + * otherwise one of the other system-wide error codes. + */ + virtual TInt GetConnectionBssid( THssBssid& aBssId ) = 0; + + /** + * Add an SSID list to the given IAP. + * @param aIapId, IAP ID given. + * @param aSsidList, SSID list to add to the IAP. + * @return KErrNone if successful, + * otherwise one of the other system-wide error codes. + */ + virtual TInt AddIapSsidList( + TUint aIapId, + const CArrayFixFlat& aSsidList ) = 0; + + /** + * Gets all Iaps of client + * @param aUId, UID of client + * @param aIapIdArray, Array for client's Iaps + * @return None + */ + virtual TInt GetClientIaps( const TUid aUid, RArray& aIapIdArray ) = 0; + + /** + * Set login and logout timer values of this client. + * If given values aren't suitable, the default values are set. + * @param aClientUid, Client's UID: clients may have own timer values, + * @param aLoginTimerValue, login timer value in seconds, + * @param aLogoutTimerValue, logout timer value in seconds. + * @return KErrNone if successful, + * otherwise one of the other system-wide error codes. + */ + virtual TInt SetTimerValues ( + TUid aClientUid, + TUint aLoginTimerValue, + TUint aLogoutTimerValue ) = 0; + + }; + +#endif // HSSMGMTINTERFACE_H + +// End of File diff -r 000000000000 -r 56b72877c1cb hsfw_plat/hotspot_framework_client_api/inc/hssmgmtscaninfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/hotspot_framework_client_api/inc/hssmgmtscaninfo.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2002-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: Wrapper class for instantiating an implementation of +* MHssScanInfoBase and MHssScanInfoIteratorBase +* via ECom framework. +* +*/ + + + +#ifndef HSSMGMTSCANINFO_H +#define HSSMGMTSCANINFO_H + +// INCLUDES +#include +#include "hssmgmtscaninfointerface.h" + +// CLASS DECLARATION +/** +* @brief Class for instantiating an implementation of MHssScanInfoBase +* and MHssScanInfoIteratorBase via ECom. +* +* This class encapsulates both the HSS scan results and methods +* needed for parsing and iterating through them. +* +* Scan results consist of a list of all the BSSs that the scan discovered +* and their parameters. Methods from MHssScanInfoIteratorBase are used +* to iterate through list of BSSs. Parameters of an individual BSS are +* parsed with methods from MHssScanInfoBase. +*/ +class CHssMgmtScanInfo : public CBase, public MHssMgmtScanInfoBase, + public MHssMgmtScanInfoIteratorBase + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + * @return Pointer to the constructed object. + */ + inline static CHssMgmtScanInfo* NewL(); + + /** + * Destructor. + */ + inline virtual ~CHssMgmtScanInfo(); + + + private: // Data + + /** + * Identifies the instance of an implementation created by + * the ECOM framework. + */ + TUid iInstanceIdentifier; + }; + +#include "hssmgmtscaninfo.inl" + +#endif // HSSMGMTSCANINFO_H + +// End of File diff -r 000000000000 -r 56b72877c1cb hsfw_plat/hotspot_framework_client_api/inc/hssmgmtscaninfo.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/hotspot_framework_client_api/inc/hssmgmtscaninfo.inl Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2002-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: Inline functions of CHssMgmtScanInfo class. +* +*/ + + + +#ifndef HSSMGMTSCANINFO_INL +#define HSSMGMTSCANINFO_INL + + +// Static constructor. +inline CHssMgmtScanInfo* CHssMgmtScanInfo::NewL() + { + const TUid KCHssMgmtScanInfoUid = { 0x10282ed0 }; + + TAny* interface = REComSession::CreateImplementationL( + KCHssMgmtScanInfoUid, + _FOFF( CHssMgmtScanInfo, + iInstanceIdentifier ) ); + return reinterpret_cast( interface ); + } + +// Destructor +inline CHssMgmtScanInfo::~CHssMgmtScanInfo() + { + REComSession::DestroyedImplementation( iInstanceIdentifier ); + } + +#endif // HSSMGMTSCANINFO_INL + +// End of File diff -r 000000000000 -r 56b72877c1cb hsfw_plat/hotspot_framework_client_api/inc/hssmgmtscaninfointerface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/hotspot_framework_client_api/inc/hssmgmtscaninfointerface.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,161 @@ +/* +* Copyright (c) 2002-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: Interface definition for HotSpot scan results. +* +*/ + + + +#ifndef HSSMGMTSCANINFOINTERFACE_H +#define HSSMGMTSCANINFOINTERFACE_H + +// INCLUDES +#include "hssmgmtcommon.h" + +// DATA TYPES +typedef TUint8 THssMgmtScanInfoFrame; + +// CLASS DECLARATION +/** +* @brief ECom interface class for HSS scan results iterator. +* +* This class contains the methods for iterating through +* HSS scan results. +*/ +class MHssMgmtScanInfoIteratorBase + { + public: // Methods + + /** + * Return the size of the scan info. The size includes Status Info, + * MAC header and Frame Body. + * @return The size of the scan info in bytes. + */ + virtual TUint16 Size() const = 0; + + /** + * 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. + */ + virtual const THssMgmtScanInfoFrame* First() = 0; + + /** + * 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. + */ + virtual const THssMgmtScanInfoFrame* Next() = 0; + + /** + * Find the data of the current access point. + * @return Pointer at the beginning of the current access point stored + * in the scan list. NULL if not any. + */ + virtual const THssMgmtScanInfoFrame* Current() const = 0; + + /** + * Find is there any more unhandled access points. + * @return EFalse if there is access points in the list left, + * ETrue if not. + */ + virtual TBool IsDone() const = 0; + + }; + +/** +* @brief ECom interface class for HSS scan results. +* +* This class contains the methods for parsing the scan results +* of a HSS network. +*/ +class MHssMgmtScanInfoBase + { + public: // Methods + + /** + * Return RX level of the BSS. + * @return RX level. + */ + virtual TUint8 RXLevel() const = 0; + + /** + * 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. + */ + virtual void Bssid( THssBssid& aBssid ) const = 0; + + /** + * Get beacon interval of the BSS. + * @return the beacon interval. + */ + virtual TUint16 BeaconInterval() const = 0; + + /** + * Get capability of the BSS (see IEEE 802.11 section 7.3.1.4. + * @return The capability information. + */ + virtual TUint16 Capability() const = 0; + + /** + * Get security mode of the BSS. + * @return security mode. + */ + virtual THssConnectionSecurityMode SecurityMode() const = 0; + + /** + * 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 code. + */ + virtual TInt InformationElement( TUint8 aIE, + TUint8& aLength, + const TUint8** aData ) = 0; + /** + * Return WPA information element. + * @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 code. + */ + virtual TInt WpaIE( TUint8& aLength, + const TUint8** aData ) = 0; + + /** + * Return the first information element. + * @param aIE Id of the IE. See IEEE 802.11 section 7.3.2. + * @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 code. + */ + virtual TInt FirstIE( TUint8& aIE, + TUint8& aLength, + const TUint8** aData ) = 0; + /** + * Return next information element. + * @param aIE Id of the IE. See IEEE 802.11 section 7.3.2. + * @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 code. + */ + virtual TInt NextIE( TUint8& aIE, + TUint8& aLength, + const TUint8** aData ) = 0; + }; + +#endif // HSSMGMTSCANINFOINTERFACE_H + +// End of File diff -r 000000000000 -r 56b72877c1cb hsfw_plat/hotspot_framework_client_plugin_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/hotspot_framework_client_plugin_api/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,28 @@ +/* +* 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: File that exports the files belonging to +: HotSpot Framework Client Plugin API +* +*/ + + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/hssclientinterface.h MW_LAYER_PLATFORM_EXPORT_PATH(hssclientinterface.h) diff -r 000000000000 -r 56b72877c1cb hsfw_plat/hotspot_framework_client_plugin_api/hotspot_framework_client_plugin_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/hotspot_framework_client_plugin_api/hotspot_framework_client_plugin_api.metaxml Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,17 @@ + + + HotSpot Framework Client Plugin API + An Ecom plug-in interface for HotSpot Framework to notify registered clients of WLAN events and to request actions from the clients. + c++ + hotspotfw + + + + + + + + yes + no + + diff -r 000000000000 -r 56b72877c1cb hsfw_plat/hotspot_framework_client_plugin_api/inc/hssclientinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/hotspot_framework_client_plugin_api/inc/hssclientinterface.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2002-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: ECom interface for clients to implement and inherit. +* +*/ + + + +#ifndef HSSCLIENTINTERFACE_H +#define HSSCLIENTINTERFACE_H + +// INCLUDES +#include "hssmgmtcommon.h" +#include "hssmgmtscaninfo.h" + +// CLASS DECLARATION +/** +* @brief ECom interface class for HSS management services. +* +* This class contains the methods for managing HSS connections +* and querying the statuses of various connection variables. +* ECom Interface UID to be used: 10282ED1 +*/ +class MHssClientInterface + { + public: + + /** + * Request to provide login information.. + * + * @param aIapID ID of the IAP. + * @param aNetworkeID ID of the selected network. + */ + virtual void Login( const TUint aIapID, const TUint aNetworkID ) = 0; + + /** + * Cancel Login request. + * + * @param aIapID ID of the IAP. + */ + virtual void CancelLogin( const TUint aIapID ) = 0; + + /** + * Start associating IAP. + * + * @param aIapID ID of the IAP. + */ + virtual void Start( const TUint aIapID ) = 0; + + /** + * Update request of IAP associating. + * + * @param aIapID ID of the IAP. + */ + virtual void Update( const TUint aIapID ) = 0; + + /** + * Do end of connection procedures. + * + * @param aIapID ID of the IAP. + */ + virtual void Logout( const TUint aIapID ) = 0; + + /** + * Send connection opening status to client + * Extended API "HSFWExt". + * + * @param aIapID ID of the IAP. + * @param aAssociated ETrue if associated ok, otherwise EFalse. + */ + virtual void WlanAssociationStatus( const TUint aIapID, TBool aAssociated ) = 0; + }; + +#endif // HSSCLIENTINTERFACE_H + +// End of File diff -r 000000000000 -r 56b72877c1cb hsfw_plat/internet_connectivity_test_service_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/internet_connectivity_test_service_api/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,28 @@ +/* +* 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: File that exports the files belonging to +: Internet Connectivity Test Service API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/ictscommon.h MW_LAYER_PLATFORM_EXPORT_PATH(ictscommon.h) +../inc/ictsclientinterface.h MW_LAYER_PLATFORM_EXPORT_PATH(ictsclientinterface.h) diff -r 000000000000 -r 56b72877c1cb hsfw_plat/internet_connectivity_test_service_api/inc/ictsclientinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/internet_connectivity_test_service_api/inc/ictsclientinterface.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,113 @@ +/* +* 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: Domain API +* +*/ + + + + +#ifndef ICTSCLIENTINTERFACE_H +#define ICTSCLIENTINTERFACE_H + +#include +#include +#include + +class CIctsEngine; + +/** + * Interface class for clients to use + * + * @lib ictsclientinterface.lib + */ +class CIctsClientInterface : public CBase + { + + public: + + /** + * Static constructor. + */ + IMPORT_C static CIctsClientInterface* NewL( TUint32 aIapId, + TUint32 aNetworkId, + MIctsObserver& aClient ); + + /** + * Destructor. + */ + virtual ~CIctsClientInterface(); + + /** + * Starts internet connectivity test. + * + * @return None + */ + IMPORT_C void StartL(); + + /** + * Cancels the internet connectivity test. + * + * @return None + */ + IMPORT_C void CancelStartL(); + + /** + * Starts polling. + * + * @param aTime Polling time used + * @param aInterval Time interval of execution + * @return None + */ + IMPORT_C void StartPolling( TInt aTime, + TInt aInterval ); + + /** + * Stops polling + * + * @return None + */ + IMPORT_C void StopPolling(); + + + private: + + /** + * C++ default constructor. + */ + CIctsClientInterface(); + + /** + * By default Symbian 2nd phase constructor is private. + * @param aIapId IAP id + * @param aNetworkId Network id + * @param aClient Client using test service + */ + void ConstructL( TUint32 aIapId, + TUint32 aNetworkId, + MIctsObserver& aClient ); + + + private: // data + + /** + * Intance of engine that handles ECom and protocols -> all tests. + * Own. + */ + CIctsEngine* iEngine; + + }; + + +#endif // ICTSCLIENTINTERFACE_H diff -r 000000000000 -r 56b72877c1cb hsfw_plat/internet_connectivity_test_service_api/inc/ictscommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/internet_connectivity_test_service_api/inc/ictscommon.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,77 @@ +/* +* 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: Contains common data structures used by Internet Connectivity +* Test Service. +* +*/ + + +#ifndef ICTSCOMMON_H +#define ICTSCOMMON_H + +// INCLUDES +#include + +// CONSTANTS + +// Length of HTTP FW response +const TInt KHttpResponseLength = 1024; + +// HTTP::HEAD max response time for timer. 5 seconds. +const TInt KHttpResponseTime = 5000000; + +// DATA TYPES + +// Values of testing result +enum TIctsTestResult + { + // Test successful + EConnectionOk, + // Browser (or other) authentication was needed. + EHttpAuthenticationNeeded, + // Test was not successful + EConnectionNotOk, + // Timeout + ETimeout + }; + +// CLASS DECLARATION +/** +* Callback interface for Internet Connectivity Test Service notifications. +* +* This virtual methods should be inherited and implemented by the +* client. +* +* The client enables observer calls when creating an instance of Icts. +* @see CIctsClientInterface::NewL. +* @lib ictsclientinterface.dll +* @since S60 5.0 +*/ +class MIctsObserver + { + public: + + /** + * Connectivity test result will become here + * @param aResult Result of connectivity test + * @param aString String containing location information when redirect + */ + virtual void ConnectivityObserver( TIctsTestResult aResult, + const TDesC& aString ) = 0; + + }; + +#endif // ICTSCOMMON_H + +// End of File diff -r 000000000000 -r 56b72877c1cb hsfw_plat/internet_connectivity_test_service_api/internet_connectivity_test_service_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/internet_connectivity_test_service_api/internet_connectivity_test_service_api.metaxml Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,18 @@ + + + Internet Connectivity Test Service API + An API for requesting connectivity test services from Internet Connectivity Test Service. + c++ + hotspotfw + + + + + + + + + yes + no + + diff -r 000000000000 -r 56b72877c1cb hsfw_plat/internet_connectivity_test_service_settings_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/internet_connectivity_test_service_settings_api/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -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: File that exports the files belonging to +: Internet Connectivity Test Service Settings API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/internetconnectivitycrkeys.h MW_LAYER_PLATFORM_EXPORT_PATH(internetconnectivitycrkeys.h) diff -r 000000000000 -r 56b72877c1cb hsfw_plat/internet_connectivity_test_service_settings_api/inc/internetconnectivitycrkeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/internet_connectivity_test_service_settings_api/inc/internetconnectivitycrkeys.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,64 @@ +/* +* 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: Key values for testing internet connectivity +* +* +*/ + + +#ifndef INTERNETCONNECTIVITYCRKEYS_H +#define INTERNETCONNECTIVITYCRKEYS_H + +// INCLUDES +#include + +/** +* Internet Connectivity Test Service settings +*/ +const TUid KCRUidInternetConnectivitySettings = {0x10282EC7}; + +/** +* CenRep key for storing test server IP address +* +* Text +* +* Default value: "http://connectivity-test.ext.nokia.com/" +*/ +const TUint32 KIctsIpDestination = 0x00000001; + +/** +* CenRep key for internet connectivity test permission +* +* Integer +* +* Run automatically: 0 +* Never run: 1 +* +* Default value: 0 +*/ +const TUint32 KIctsTestPermission = 0x00000002; + +// Values for internet connectivity testing permission +enum TIctsTestPermission + { + // Run automatically. No permission asked. + EIctsRunAutomatically = 0, + // Do not run internet connectivity test at all. + EIctsNeverRun + }; + +#endif // INTERNETCONNECTIVITYCRKEYS_H + + +// End of File diff -r 000000000000 -r 56b72877c1cb hsfw_plat/internet_connectivity_test_service_settings_api/internet_connectivity_test_service_settings_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hsfw_plat/internet_connectivity_test_service_settings_api/internet_connectivity_test_service_settings_api.metaxml Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,17 @@ + + + Internet Connectivity Test Service Settings API + ICTS Central Repository settings + c++ + hotspotfw + + + + + + + + yes + no + + diff -r 000000000000 -r 56b72877c1cb layers.sysdef.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/layers.sysdef.xml Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,14 @@ + + +]> + + + + + + + + + + diff -r 000000000000 -r 56b72877c1cb package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 56b72877c1cb sysdef_1_4_0.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_4_0.dtd Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 56b72877c1cb wlanutilities/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlanindicatorplugin/data/2001247E.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/data/2001247E.rss Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlanindicatorplugin/data/wlanindicator.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/data/wlanindicator.rss Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlanindicatorplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,30 @@ +/* +* 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: Build information file for project wlanindicatorplugin +* +*/ + + +#include + +PRJ_PLATFORMS +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 000000000000 -r 56b72877c1cb wlanutilities/wlanindicatorplugin/group/wlanindicatorplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/group/wlanindicatorplugin.mmp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,64 @@ +/* +* 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 commdb.lib +LIBRARY charconv.lib +LIBRARY connmon.lib +LIBRARY cmmanager.lib +LIBRARY cmmanagerdatabase.lib +LIBRARY bafl.lib + diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlanindicatorplugin/inc/wlanindicatorpluginimplementation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/inc/wlanindicatorpluginimplementation.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,177 @@ +/* +* 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 +#include +#include + +// CONSTANTS +const TInt KWlanMaxAccessPointNameLength = 50; + +// FORWARD DECLARATIONS +class CCoeEnv; + +// CLASS DECLARATIONS +struct TWliWlanInfo + { + // Network name (unknown: SSID, known: IAP name), TBuf8 + TWlanSsid iSsid; + + //Internet Access Point Id. 0 if the IAP has not been defined. + TUint32 iIapId; + + // The name of the WLAN IAP, TBuf16 + TBuf iNetworkName; +}; + + +/** +* 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 cases + * - "WLAN network found" + * - "WLAN networks found" + * - "'myNetwork' found" + * @return Descriptor for the current "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 required info for the "networks available" case: + * - name of the known network (null if all unknown) + * - number of available networks + * @param aAvailableCount Number of available networks + */ + HBufC* AvailableNetworksInfoL( TInt& aAvailableCount ); + + /** + * Finds the network name based on the IAP id + * @param Struct for storing the IAP information + */ + void GetWlanInfoFromIapL( TWliWlanInfo& aWlanInfo ); + + /** + * 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; + + /** + * Owned. Used for getting WLAN available networks info + */ + CWlanMgmtClient* iWlanMgmtClient; + + + }; + +#endif // CWLANINDICATORPLUGINIMPLEMENTATION_H + +// End of File diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlanindicatorplugin/loc/wlanindicatorplugin.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/loc/wlanindicatorplugin.loc Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlanindicatorplugin/rom/wlanindicatorplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/rom/wlanindicatorplugin.iby Thu Dec 17 09:20:28 2009 +0200 @@ -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: Image description file for WlanIndicatorPlugin +* +*/ + +#ifndef __WLANINDICATORPLUGIN_IBY__ +#define __WLANINDICATORPLUGIN_IBY__ + + +#include + +ECOM_PLUGIN( wlanindicatorplugin.dll, wlanindicatorplugin.rsc ) + +#endif // __WLANINDICATORPLUGIN_IBY__ + diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlanindicatorplugin/rom/wlanindicatorpluginresources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/rom/wlanindicatorpluginresources.iby Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlanindicatorplugin/src/dllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/src/dllmain.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlanindicatorplugin/src/wlanindicatorpluginimplementation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/src/wlanindicatorpluginimplementation.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,478 @@ +/* +* 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 +#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(); + + iWlanMgmtClient = CWlanMgmtClient::NewL(); + + } + +// ----------------------------------------------------------------------------- +// 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(); + + delete iWlanMgmtClient; + + } + + +// --------------------------------------------------------------------------- +// 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; + HBufC* knownNetworkName = NULL; + TInt availableCount( 0 ); + + knownNetworkName = AvailableNetworksInfoL( availableCount ); + + CleanupStack::PushL( knownNetworkName ); + + if ( !knownNetworkName ) + { + if ( availableCount == 1 ) + { + // dynText: "qtn_uni_ind_wlan_avail_unknown WLAN network found" + dynText = StringLoader::LoadL ( + R_QTN_UNI_IND_WLAN_AVAIL_UNKNOWN, iCoeEnv ); + } + else + { + // dynText: "qtn_uni_ind_wlan_avail_unknown_many WLAN networks found" + dynText = StringLoader::LoadL ( + R_QTN_UNI_IND_WLAN_AVAIL_UNKNOWN_MANY, iCoeEnv ); + } + } + else + { + // dynText: "qtn_uni_ind_wlan_avail_known '%U' found" + dynText = StringLoader::LoadL ( + R_QTN_UNI_IND_WLAN_AVAIL_KNOWN, *knownNetworkName, iCoeEnv ); + + } + + CleanupStack::PopAndDestroy( knownNetworkName ); + + 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::AvailableNetworksInfoL() +// --------------------------------------------------------------------------- +// +HBufC* CWlanIndicatorPluginImplementation::AvailableNetworksInfoL( + TInt& aAvailableCount ) + { + + HBufC* knownNetworkName = NULL; + + // get available iaps + RArray availableIaps; + TInt iapError( 0 ); + iapError = iWlanMgmtClient->GetAvailableIaps( availableIaps ); + + if ( iapError == KErrNone ) + { + // if there are known networks, get the name of the first one + // in an alphabetical order + if ( availableIaps.Count() ) + { + // get all network names and put them into a sorted array + + // use one TWliWlanInfo struct to point to each IAP in a loop + TWliWlanInfo* availableInfo = new ( ELeave ) TWliWlanInfo(); + CleanupStack::PushL( availableInfo ); + + // descriptor array with granularity 2 + CDesCArray* networkNames = new (ELeave)CDesCArrayFlat( 2 ); + CleanupStack::PushL( networkNames ); + + for ( TInt i = 0; i < availableIaps.Count() ; i++ ) + { + availableInfo->iIapId = availableIaps[i]; + GetWlanInfoFromIapL( *availableInfo ); + + // insert the name into the proper place + // in alphabetical order + networkNames->InsertIsqL( + ( availableInfo->iNetworkName ), ECmpFolded ); + } + + knownNetworkName = ( networkNames->MdcaPoint(0) ).AllocL(); + + CleanupStack::PopAndDestroy( networkNames ); + CleanupStack::PopAndDestroy( availableInfo ); + + } + + else // unknown networks only + { + CWlanScanInfo* scanInfo = CWlanScanInfo::NewL(); + + TInt scanError( 0 ); + scanError = iWlanMgmtClient->GetScanResults( *scanInfo ); + if ( scanError == KErrNone ) + { + // Find if we have 1 or more networks available, + // we don't have to know the exact amount + scanInfo->Next() ? aAvailableCount = 2 : aAvailableCount = 1; + } + + delete scanInfo; + + } + } + + availableIaps.Close(); + + return knownNetworkName; + + } + +// --------------------------------------------------------------------------- +// CWlanIndicatorPluginImplementation::GetWlanInfoFromIapL() +// --------------------------------------------------------------------------- +// +void CWlanIndicatorPluginImplementation::GetWlanInfoFromIapL( TWliWlanInfo& aWlanInfo ) + { + CCommsDatabase* commsDb = CCommsDatabase::NewL(); + CleanupStack::PushL( commsDb ); + + CCommsDbTableView* commsDbIapTableView = commsDb->OpenViewMatchingUintLC( + TPtrC( IAP ), TPtrC( COMMDB_ID ), aWlanInfo.iIapId ); + + User::LeaveIfError( commsDbIapTableView->GotoFirstRecord() ); + + commsDbIapTableView->ReadTextL( TPtrC( COMMDB_NAME ), aWlanInfo.iNetworkName ); + + CleanupStack::PopAndDestroy( commsDbIapTableView ); + CleanupStack::PopAndDestroy( commsDb ); + } + +// --------------------------------------------------------------------------- +// 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 ); + + connName = connMethod.GetStringAttributeL( ECmName ); + + 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 000000000000 -r 56b72877c1cb wlanutilities/wlanplugin/data/10281BCB.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/data/10281BCB.rss Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlanplugin/data/wlanpluginrsc.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/data/wlanpluginrsc.rss Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlanplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlanplugin/group/wlanplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/group/wlanplugin.mmp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,81 @@ +/* +* 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 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 000000000000 -r 56b72877c1cb wlanutilities/wlanplugin/group/wlanpluginicons.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/group/wlanpluginicons.mk Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlanplugin/inc/wlanplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/inc/wlanplugin.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlanplugin/inc/wlanplugindbobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/inc/wlanplugindbobserver.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlanplugin/inc/wlanpluginlogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/inc/wlanpluginlogger.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlanplugin/inc/wlanplugintimeshifter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/inc/wlanplugintimeshifter.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlanplugin/inc/wlanpluginwlanstate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/inc/wlanpluginwlanstate.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,347 @@ +/* +* 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 + * @param TDesC aAccesspointName. + */ + virtual void WlanConnectionActivatedL( const + TDesC& aAccessPointName ); + + /* + * 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 000000000000 -r 56b72877c1cb wlanutilities/wlanplugin/loc/wlanplugin.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/loc/wlanplugin.loc Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlanplugin/rom/wlanplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/rom/wlanplugin.iby Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlanplugin/rom/wlanpluginresources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/rom/wlanpluginresources.iby Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlanplugin/src/wlanplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/src/wlanplugin.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,482 @@ +/* +* 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 = AknsUtils::CreateGulIconL( + AknsUtils::SkinInstance(), + itemid, + iconsFileName, + pic, + picmask ); + + } + //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 000000000000 -r 56b72877c1cb wlanutilities/wlanplugin/src/wlanplugindbobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/src/wlanplugindbobserver.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlanplugin/src/wlanpluginimplementationtable.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/src/wlanpluginimplementationtable.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlanplugin/src/wlanplugintimeshifter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/src/wlanplugintimeshifter.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlanplugin/src/wlanpluginwlanstate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanplugin/src/wlanpluginwlanstate.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,783 @@ +/* +* 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() ) + { + iConnected = ETrue; + iEngine->GetConnectedWlanDetailsL( iConnectedWlanInfo ); + } + + 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()" ); + + iScanning = EFalse; + + CLOG_LEAVEFN( "CWlanPluginWlanState::NotifyEngineError()" ); + } + +// --------------------------------------------------------- +// CWlanPluginWlanState::ScanDisabledL +// --------------------------------------------------------- +void CWlanPluginWlanState::ScanDisabledL() + { + CLOG_ENTERFN( "CWlanPluginWlanState::ScanDisabledL()" ); + + iScanning = EFalse; + //UpdateWlanListL(); + 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( + const TDesC& /*aAccessPointName*/ ) + { + CLOG_ENTERFN( "CWlanPluginWlanState::WlanConnectionActivatedL()" ); + + iConnected = ETrue; + iEngine->GetConnectedWlanDetailsL( iConnectedWlanInfo ); + 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 ); + } + + 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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/bwinscw/wlansettingsuiu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/bwinscw/wlansettingsuiu.def Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/data/wlansettingsui.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/data/wlansettingsui.rss Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/eabi/wlansettingsuiu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/eabi/wlansettingsuiu.def Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/group/wlansettingsui.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/group/wlansettingsui.mmp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/inc/wlansettingsui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsui.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/inc/wlansettingsui.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsui.hrh Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/inc/wlansettingsuibinarypopupsettingitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuibinarypopupsettingitem.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/inc/wlansettingsuidefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuidefs.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/inc/wlansettingsuidlg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuidlg.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/inc/wlansettingsuidlg.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuidlg.inl Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/inc/wlansettingsuiimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuiimpl.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/inc/wlansettingsuimainviewdlg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuimainviewdlg.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/inc/wlansettingsuimainviewdlg.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuimainviewdlg.inl Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/inc/wlansettingsuimodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuimodel.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/inc/wlansettingsuimodel.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuimodel.inl Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/inc/wlansettingsuipanic.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuipanic.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/inc/wlansettingsuiscanintervalsettingitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuiscanintervalsettingitem.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/inc/wlansettingsuisettingitemlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuisettingitemlist.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/inc/wlansettingsuisettingitemlist.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuisettingitemlist.inl Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/inc/wlansettingsuistatuspane.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/inc/wlansettingsuistatuspane.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/loc/wlansettingsui.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/loc/wlansettingsui.loc Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/rom/wlansettingsui.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/rom/wlansettingsui.iby Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/rom/wlansettingsuiresources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/rom/wlansettingsuiresources.iby Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/src/wlansettingsui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/src/wlansettingsui.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/src/wlansettingsuibinarypopupsettingitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/src/wlansettingsuibinarypopupsettingitem.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/src/wlansettingsuidlg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/src/wlansettingsuidlg.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/src/wlansettingsuiimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/src/wlansettingsuiimpl.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/src/wlansettingsuimainviewdlg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/src/wlansettingsuimainviewdlg.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/src/wlansettingsuimodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/src/wlansettingsuimodel.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,323 @@ +/* +* 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; + 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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/src/wlansettingsuipanic.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/src/wlansettingsuipanic.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/src/wlansettingsuiscanintervalsettingitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/src/wlansettingsuiscanintervalsettingitem.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/src/wlansettingsuisettingitemlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/src/wlansettingsuisettingitemlist.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansettingsui/src/wlansettingsuistatuspane.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansettingsui/src/wlansettingsuistatuspane.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aihelper/data/wsfaihelper.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/data/wsfaihelper.rss Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,132 @@ +/* +* 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_qtn_sniffer_wait_connecting +// String for connecting waitnote +//---------------------------------------------------------------------------- +RESOURCE TBUF r_qtn_sniffer_wait_connecting + { + buf = qtn_sniffer_wait_connecting; + } + +//---------------------------------------------------------------------------- +// r_qtn_sniffer_wait_connecting_user_conn +// String for connecting waitnote when WLAN usage is set as Forced +//---------------------------------------------------------------------------- +RESOURCE TBUF r_qtn_sniffer_wait_connecting_user_conn + { + buf = qtn_sniffer_wait_connecting_user_conn; + } + + +//---------------------------------------------------------------------------- +// 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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aihelper/group/aihelper.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/group/aihelper.mmp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aihelper/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aihelper/inc/wsfaihelper.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/inc/wsfaihelper.hrh Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aihelper/inc/wsfaihelperapplication.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/inc/wsfaihelperapplication.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aihelper/inc/wsfaihelperappui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/inc/wsfaihelperappui.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,233 @@ +/* +* 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 + * @param aAccesspointName The name of the active connection + */ + void WlanConnectionActivatedL( const TDesC& aAccessPointName ); + + /** + * 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aihelper/inc/wsfaihelpercontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/inc/wsfaihelpercontainer.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aihelper/inc/wsfaihelperdocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/inc/wsfaihelperdocument.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,173 @@ +/* +* 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(); + + /** + * Returns whether Connect or Start Web browsing was selected + * @since S60 5.0 + * @return ETrue if Connect was selected (browser doesn't need to be + * launched, EFalse otherwise. + */ + inline TBool ShouldConnectOnly(); + + /** + * Returns whether default connection should be used + * @return ETrue if default should be used, EFalse otherwise. + */ + inline TBool UseDefaultConnection(); + + + private: // data + + /** + * Model object (owned) + */ + CWsfModel* iModel; + + /** + * Data of the currently used WLAN network + */ + TWsfWlanInfo iWlanInfo; + + /** + * Indicates whether Connect or Start Web browsing was selected + */ + TBool iConnectOnly; + + /** + * Indicates whether default connection should be used + */ + TBool iUseDefaultConnection; + + }; + + +#include "wsfaihelperdocument.inl" + +#endif // C_WSFAIHELPERDOCUMENT_H diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aihelper/inc/wsfaihelperdocument.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/inc/wsfaihelperdocument.inl Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,60 @@ +/* +* 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; + } + + +// --------------------------------------------------------------------------- +// CWsfAiHelperDocument::ShouldConnectOnly() +// --------------------------------------------------------------------------- +// +TBool CWsfAiHelperDocument::ShouldConnectOnly() + { + return iConnectOnly; + } + +// --------------------------------------------------------------------------- +// CWsfAiHelperDocument::UseDefaultConnection() +// --------------------------------------------------------------------------- +// +TBool CWsfAiHelperDocument::UseDefaultConnection() + { + return iUseDefaultConnection; + } + + diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aihelper/inc/wsfaihelperview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/inc/wsfaihelperview.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aihelper/rom/wsfaihelperapp.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/rom/wsfaihelperapp.iby Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aihelper/rom/wsfaihelperappresources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/rom/wsfaihelperappresources.iby Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aihelper/src/wsfaihelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/src/wsfaihelper.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aihelper/src/wsfaihelperapplication.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/src/wsfaihelperapplication.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aihelper/src/wsfaihelperappui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/src/wsfaihelperappui.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,440 @@ +/* +* 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 ); + + 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( + const TDesC& /*aAccessPointName*/ ) + { + // 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aihelper/src/wsfaihelpercontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/src/wsfaihelpercontainer.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aihelper/src/wsfaihelperdocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/src/wsfaihelperdocument.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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: 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; + TPckgBuf connecting; + TPckgBuf connectOnly; + info.Copy( aFilename.Left( sizeof( TWsfWlanInfo ) ) ); + connecting.Copy( aFilename.Mid( sizeof( TWsfWlanInfo ), sizeof( TBool ) ) ); + connectOnly.Copy( aFilename.Right( sizeof( TBool ) ) ); + + iWlanInfo = info(); + iUseDefaultConnection = connecting(); + iConnectOnly = connectOnly(); + static_cast( iAppUi )->NotifyFileName(); + + return NULL; + } + + + diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aihelper/src/wsfaihelperview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aihelper/src/wsfaihelperview.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/data/10281cae.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/data/10281cae.rss Thu Dec 17 09:20:28 2009 +0200 @@ -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 = AI_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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/data/wsfaipluginrsc.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/data/wsfaipluginrsc.rss Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,391 @@ +/* +* 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_qtn_sniffer_quest_restart_browsing_with_wlan +// String for Web application needs to be restarted query +//---------------------------------------------------------------------------- +RESOURCE TBUF r_qtn_sniffer_quest_restart_browsing_with_wlan + { + buf = qtn_sniffer_quest_restart_browsing_with_wlan; + } + + +//---------------------------------------------------------------------------- +// 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/group/aiplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/group/aiplugin.mmp Thu Dec 17 09:20:28 2009 +0200 @@ -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 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 + + +// 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 + + +DEBUGLIBRARY flogger.lib + +// End of File. diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/inc/wsfactivewaiter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfactivewaiter.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/inc/wsfaicontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaicontroller.h Thu Dec 17 09:20:28 2009 +0200 @@ -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: Class header for TWsfAiController +* +*/ + +#ifndef T_WSFAICONTROLLER_H +#define T_WSFAICONTROLLER_H + +// EXTERNAL INCLUDES +#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; + + +/** + * 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 appicaton level model reference + * @param aAiModel model reference of AiPlugin + */ + void InitializeL( CWsfModel* aModel, CWsfAiModel* aAiModel, + CWsfDbObserver* aObserver ); + + /** + * 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(); + + /** + * Propagates the connected network data from the sniffer model + * to the AI model + * @since S60 5.0 + */ + void StartupRefreshL(); + + /** + * Dismisses the AI menu/other dialogs if there was any open + * @since S60 5.0 + */ + void DismissDialogsL(); + + /** + * Refreshes the refreshing icon + * @since S60 5.0 + */ + void RefreshRefreshingL(); + + /** + * Refreshes the connecting icon + * @since S60 5.2 + */ + void RefreshConnectingL(); + + + 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 + * @param aAccesspointName The name of the active connection + */ + void WlanConnectionActivatedL( const TDesC& aAccessPointName ); + + /** + * 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 ); + + /* + * Connect to the given wlan + * @since S60 5.0 + * @param aInfo Wlaninfo to connect with + */ + void ConnectL( TWsfWlanInfo& aInfo, TBool aShoulConnectOnly ); + + /** + * Cleanup function to release connecting state + * @param aPtr Pointer for this class + */ + static void CleanUpConnectingL( TAny* aPtr ); + + /** + * Launches and helper application to create an accesspoint + * @since S60 5.2 + * @param aWlanInfo The WlanInfo object to be passed to the helper app + */ + void LaunchAiHelperAppL( TWsfWlanInfo& aInfo ); + + /* + * 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(); + + /* + * Disconnect active wlan connections + */ + void DisconnectL(); + + /** + * 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 + + 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 iShouldConnectOnly; + + /** + * Indicates whether access point needs testing + */ + TBool iTestAccessPoint; + }; + +#endif // T_WSFAICONTROLLER_H + +// End of file diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/inc/wsfaicontrollercmds.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaicontrollercmds.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/inc/wsfaimodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaimodel.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/inc/wsfaimodel.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaimodel.inl Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/inc/wsfaiplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaiplugin.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,465 @@ +/* +* 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 +#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 CAiContentPublisher, + public MAiPropertyExtension, + public MAiEventHandlerExtension, + 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 CWsfAiPlugin::DoRefreshingStepL( TAny* ptr ); + + /** + * Steps the refresh animation + */ + void CWsfAiPlugin::DoRefreshingStepL(); + + /** + * Steps + * @param ptr Pointer to an instance of this class + */ + static TInt CWsfAiPlugin::DoConnectingStepL( TAny* ptr ); + + /** + * Steps the refresh animation + */ + void CWsfAiPlugin::DoConnectingStepL(); + + public: // from CAiContentPublisher + + /** + * This method transit the plugin to "Alive" state. + * The method is called by the framework to instruct plug-in that it is + * allowed to actively publish its data to its observers. This means the plugin + * is allowed to consume memory and CPU resources, e.g plug-in is able load + * engines, run timers, perform asynchronous operations, etc. The method + * transits the plug-in to "Alive" state. There can be many concurrent + * calls to resume, with different or the same reason code, this allows + * the plugin to properly respond to enviroment change that raise the + * need to re-publish content (changes like date/time change etc). + * + * @param aReason reason for state change, see TAiTransitionChange. + */ + void Resume( TAiTransitionReason aReason ); + + /** + * This method transits the plug-in to "Suspendend" state. + * The method is called by the framework to instruct plug-in that it is + * not allowed to consume CPU resources, e.g plug-in MUST stop each + * timer, cancel outstanding asynchronous operations, etc. + * + * @param aReason reason for state change, see TAiTransitionChange. + */ + void Suspend( TAiTransitionReason aReason ); + + /** + * This method transits the plug-in to "Idle" state. + * The method is called by the framework to request the plug-in free all + * memory and CPU resources and close all its open files, the plug-in + * should unload its engines during backup operation. + * + * @param aReason reason for state change, see TAiTransitionChange. + */ + void Stop( TAiTransitionReason aReason ); + + /** + * Adds the content observer / subscriber to plug-in. The plug-in MUST + * maintain a registry of subscribers and send notification to all them + * whenever the plug-in changes state or new content available. + * + * @param aObserver content observer to register. + */ + void SubscribeL( MAiContentObserver& aObserver ); + + /** + * Configures the plug-in. + * + * @param aSettings setting items defined in the UI definition. + * This plugin takes ownership of the + * MAiPluginSettings objects in the array. + * If this method leaves the caller will handle the cleanup. + */ + void ConfigureL( RAiSettingsItemArray& aSettings ); + + /** + * Returns interface extension. In S60 3.2 only event & property + * extensions are supported. See MAiEventHandlerExtension & MAiPropertyExtension + * interfaces. + * + * @param aUid - UID of the extension interface to access. + * @return the extension interface. Actual type depends on the passed aUid + * argument. + */ + TAny* Extension( TUid aUid ); + + + public: // from MAiPropertyExtension + + /** + * Read property of publisher plug-in. + * + * @param aProperty - identification of property. + * @return Pointer to property value. + */ + TAny* GetPropertyL( TInt aProperty ); + + /** + * Write property value. + * + * @param aProperty - identification of property. + * @param aValue - contains pointer to property value. + */ + void SetPropertyL( TInt aProperty, TAny* aValue ); + + + public: // from MAiEventHandlerExtension + + /** + * See aieventhandlerextension.h for detailed description. + * @since S60 5.0 + */ + 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 signal strenght and the security string + * @since S60 5.0 + * @param aStrength siganl strength string + * @param aSecure security string + */ + void SetStrengthAndSecure( TDesC* aStrength, TDesC* aSecure ); + + /** + * 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 ); + + /** + * Callback function for carrying out refresh at startup + * @since S60 5.0 + * @param aPtr Pointer to this class + * @return Error code + */ + static TInt StartupRefresh( TAny* aPtr ); + + /** + * Callback function for carrying out refresh at startup + * @since S60 5.0 + * @return Error code + */ + TInt StartupRefreshL(); + + + private: // Data + + /** + * 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; + + /** + * Information about the content publisher (this plug-in) + */ + TAiPublisherInfo iInfo; + + /** + * 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 obseving changes in + * show WLAN availablity + */ + CWsfDbObserver* iDbObserver; + + /** + * The resource file offset + */ + TInt iResourceFileOffset; + + /** + * Constants for Signal Strength text + * Own. + */ + HBufC* iCurrentSignalStrength; + + /** + * Constants for Secure Information text + * Own. + */ + HBufC* iCurrentSecureInfo; + + /** + * Constants for Title text + * Own. + */ + HBufC* iWlanTitle; + + /** + * 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; + + /** + * Active Object callback for displaying data at startup + */ + CAsyncCallBack* iStartupRefresh; + + /* + * 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; + + }; + + +#endif // C_WSFAIPLUGIN_H + +// End of File. diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/inc/wsfaiplugincommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaiplugincommon.h Thu Dec 17 09:20:28 2009 +0200 @@ -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.r*" ); +// 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/inc/wsfaiplugincontentmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaiplugincontentmodel.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,98 @@ +/* +* 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 + { + EAiWizardContentFullText + ,EAiWizardContentNaviBarIcon + ,EAiWizardContentTitleText + ,EAiWizardContentStatusIcon + ,EAiWizardContentStatusText + ,EAiWizardContentTypeIcon // Transparent icon + ,EAiWizardContentTypeText + ,EAiWizardContentStrengthIcon + ,EAiWizardContentStrengthText + ,EAiWizardContentSecureIcon + ,EAiWizardContentSecureText + ,EAiWizardContentNetworkStatus + ,EAiWizardContentNetworkName + }; + +/** + * Content that the plugin will publish + */ +const TAiContentItem KAiWizardContent[] = + { + { EAiWizardContentFullText, L"FullText", KAiContentTypeText } + ,{ EAiWizardContentNaviBarIcon, L"NaviBarIcon", KAiContentTypeBitmap } + ,{ EAiWizardContentTitleText, L"TitleText", KAiContentTypeText } + ,{ EAiWizardContentStatusIcon, L"StatusIcon", KAiContentTypeBitmap } + ,{ EAiWizardContentStatusText, L"StatusText", KAiContentTypeText } + ,{ EAiWizardContentTypeIcon, L"TypeIcon", KAiContentTypeBitmap } + ,{ EAiWizardContentTypeText, L"TypeText", KAiContentTypeText } + ,{ EAiWizardContentStrengthIcon, L"StrengthIcon", KAiContentTypeBitmap } + ,{ EAiWizardContentStrengthText, L"StrengthText", KAiContentTypeText } + ,{ EAiWizardContentSecureIcon, L"SecureIcon", KAiContentTypeBitmap } + ,{ EAiWizardContentSecureText, L"SecureText", KAiContentTypeText } + ,{ 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/inc/wsfaipluginuids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaipluginuids.hrh Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/inc/wsfaipublishobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaipublishobserver.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 MWsfAiPublishObserver +* +*/ + + +#ifndef M_WSFAIPUBLISHOBSERVER_H +#define M_WSFAIPUBLISHOBSERVER_H + +#include + +class CAknIconArray; +class CEikLabel; +class CArrayFix< TInt >; +/** + * 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 signal strenght and the security string + * @since S60 5.0 + * @param aStrength siganl strength string + * @param aSecure security string + */ + virtual void SetStrengthAndSecure( TDesC* aStrength, + TDesC* aSecure ) = 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 refreshing status on/off. + * @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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/inc/wsfaiuiobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaiuiobserver.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/inc/wsfaiview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfaiview.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/inc/wsfdbobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfdbobserver.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,136 @@ +/* +* 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 +#include + +//forward declaration +class TWsfAiController; + +/** +* Database observer class. +*/ +NONSHARABLE_CLASS( CWsfDbObserver ) : public CActive + { + public: + /** + * The Constructor. + * @param aState Pointer to the WLAN State object. + */ + CWsfDbObserver( ); + + /** + * First phase of two phased construction. + * @param aState Pointer to the WLAN State object. + */ + 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(); + + private: + /** + * Second phase of two phase construction. + */ + void ConstructL(); + + /* + * Get default scanning interval + */ + TInt DefaultScanIntervalL(); + + 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; + + /** + * 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/inc/wsficonarraycreator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsficonarraycreator.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,56 @@ +/* +* 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/inc/wsfsearchwlansdialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/inc/wsfsearchwlansdialog.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/loc/wsfaiplugin.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/loc/wsfaiplugin.loc Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/rom/wsfaiplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/rom/wsfaiplugin.iby Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/rom/wsfaipluginresources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/rom/wsfaipluginresources.iby Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/src/wsfactivewaiter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfactivewaiter.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/src/wsfaicontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfaicontroller.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,1296 @@ +/* +* 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 + +// 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" + + +// 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; + +// 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; +static const TInt KSuppressRefreshIndex = 1024; + + + +// -------------------------------------------------------------------------- +// TWsfAiController::TWsfAiController +// -------------------------------------------------------------------------- +// +TWsfAiController::TWsfAiController(): + iModel( NULL ), + iAiModel( NULL ), + iUi( NULL ), + iDbObserver( NULL ), + iShouldConnectOnly( EFalse ), + iTestAccessPoint( EFalse ) + { + // null the pointers + iConnectedWlan.iConnectionState = ENotConnected; + } + + +// --------------------------------------------------------- +// CWsfActiveWaiter::DeInitializeL +// --------------------------------------------------------- +// +void TWsfAiController::DeInitializeL() + { + LOG_ENTERFN( "TWsfAiController::DeInitializeL" ); + iModel->AbortConnectingL(); + iModel->AbortScanningL(); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::Initialize +// -------------------------------------------------------------------------- +// +void TWsfAiController::InitializeL( CWsfModel* aModel, CWsfAiModel* aAiModel, + CWsfDbObserver* aObserver ) + { + LOG_ENTERFN( "TWsfAiController::InitializeL" ); + iModel = aModel; + iAiModel = aAiModel; + iDbObserver = aObserver; + iDbObserver->SetController( this ); + iDbObserver->ActivateItL(); + iModel->SetEngineObserver( this ); + + iAiModel->SetConnected( iModel->IsConnectedL() ); + } + + +// --------------------------------------------------------------------------- +// 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::StartupRefreshL +// -------------------------------------------------------------------------- +// +void TWsfAiController::StartupRefreshL() + { + LOG_ENTERFN( "TWsfAiController::StartupRefreshL" ); + iModel->GetConnectedWlanDetailsL( iConnectedWlan ); + iAiModel->SetConnectedWlanInfo( iConnectedWlan ); + + iInfoArray = iModel->GetWlanListL(); + MDesCArray* data = iAiModel->FormatSingleLineWlanListL( iInfoArray ); + + // index value to suppress 1 second refreshing state + const TInt KSuppressRefreshIndex = 1024; + + 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::DismissDialogsL +// -------------------------------------------------------------------------- +// +void TWsfAiController::DismissDialogsL() + { + LOG_ENTERFN("TWsfAiController::DismissDialogsL" ); + TKeyEvent key; + key.iCode = EKeyEscape; + key.iModifiers = 0; + CEikonEnv::Static()->SimulateKeyEventL( key, EEventKey ); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::WlanListChangedL +// -------------------------------------------------------------------------- +// +void TWsfAiController::WlanListChangedL() + { + LOG_ENTERFN("TWsfAiController::WlanListChangedL" ); + + _ASS_D( iAiModel ); + + if ( !iAiModel->ScanningOn() ) + { + 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; + } + } + } + iInfoArray = iModel->GetWlanListL(); + TBool connected = iModel->GetConnectedWlanDetailsL( iConnectedWlan ); + iAiModel->SetConnected( connected ); + iAiModel->SetConnectedWlanInfo( iConnectedWlan ); + + 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" ); + iModel->RefreshScanL(); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::WlanConnectionActivatedL +// -------------------------------------------------------------------------- +// +void TWsfAiController::WlanConnectionActivatedL( + const TDesC& /*aAccessPointName*/ ) + { + LOG_ENTERFN( "TWsfAiController::WlanConnectionActivatedL" ); + iModel->SetConnecting( EFalse ); + iModel->GetConnectedWlanDetailsL( iConnectedWlan ); + iAiModel->SetConnectedWlanInfo( iConnectedWlan ); + iAiModel->SetConnected( ETrue ); + iAiModel->SetConnecting( EFalse ); + + RefreshUiL(); + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::WlanConnectionClosedL +// -------------------------------------------------------------------------- +// +void TWsfAiController::WlanConnectionClosedL() + { + LOG_ENTERFN( "TWsfAiController::WlanConnectionClosedL" ); + iModel->SetConnecting( EFalse ); + iAiModel->SetConnected( EFalse ); + iAiModel->SetConnecting( EFalse ); + if ( iAiModel->ScanningOn() ) + { + // update the model and refresh ui + if ( iInfoArray ) + { + // check if the array has any items + if ( iInfoArray->Count() ) + { + iInfoArray->SortArrayL(); + TWsfWlanInfo* firstItem = iInfoArray->At( KFirstItemArrayIndex ); + if ( firstItem && firstItem->Connected() ) + { + firstItem->iConnectionState = ENotConnected; + } + } + } + // Abort current scan if exists so that we get + // newest scan results propagated to ui + iModel->AbortScanningL(); + iModel->RefreshScanL(); + RefreshUiL(); + } + 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 ); + iModel->FinalizeConnectL(); + if ( !iShouldConnectOnly ) + { + StartWebBrowserL( iUsedInfo ); + } + if ( iTestAccessPoint ) + { + iModel->TestConnectedAccessPointL( iUsedInfo, iShouldConnectOnly ); + } + } + else + { + iAiModel->SetConnected( EFalse ); + } + RefreshUiL(); + // 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 ); + } + else + { + LOG_WRITE("Start browser to connected network..."); + iShouldConnectOnly = 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 ); + } + + const TUid KBrowserUid = { 0x10008D39 }; + TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); + TApaTask task = taskList.FindApp( KBrowserUid ); + + // Check if the Browser application is already running. + if ( task.Exists() ) + { + HBufC* queryText = StringLoader::LoadLC( + R_QTN_SNIFFER_QUEST_RESTART_BROWSING_WITH_WLAN ); + + CAknQueryDialog* dlg = CAknQueryDialog::NewL(); + TInt ret = dlg->ExecuteLD( + R_RESTART_BROWSING_CONFIRMATION_QUERY, + *queryText ); + + CleanupStack::PopAndDestroy( queryText ); + + if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) ) + { + // User Press OK or Yes and launch the browser + iModel->LaunchBrowserL( passedIap ); + } + else + { + // clean up the temporary IAP if any + iModel->CleanUpCancelledLaunchL(); + + // we are at this point then we can disconnect + // and iModel->DisconnectL() handles view refreshing + iModel->DisconnectL(); + } + } + else + { + // finally launch the browser + iModel->LaunchBrowserL( passedIap ); + } + } + + +// -------------------------------------------------------------------------- +// TWsfAiController::ConnectL +// -------------------------------------------------------------------------- +// +void TWsfAiController::ConnectL( TWsfWlanInfo& aInfo, TBool aShoulConnectOnly ) + { + LOG_ENTERFN( "TWsfAiController::ConnectL" ); + + _ASS_D( iModel ); + iTestAccessPoint = EFalse; + iShouldConnectOnly = aShoulConnectOnly; + 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 ); + iTestAccessPoint = ETrue; + } + else if ( !iUsedInfo.iIapId ) + { + // let the helper app do the query if necessary + LOG_WRITE("AiHelper needs to be launched"); + LaunchAiHelperAppL( iUsedInfo ); + ConnectingL( iUsedInfo.iIapId ); + iTestAccessPoint = ETrue; + } + + // Connect + if ( iUsedInfo.iIapId ) + { + TInt result = KErrNone; + result = iModel->ConnectWithoutConnWaiterL( iUsedInfo.iIapId, + !iTestAccessPoint ); + + if ( result != KErrNone ) + { + LOG_WRITEF( "Connect failed with error = %d", result ); + User::Leave( result ); + } + } + // 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::LaunchAiHelperAppL +// -------------------------------------------------------------------------- +// +void TWsfAiController::LaunchAiHelperAppL( TWsfWlanInfo& aInfo ) + { + LOG_ENTERFN( "TWsfAiController::LaunchAiHelperAppL" ); + + CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewL(); + CleanupStack::PushL( waiter ); + + RProperty aiHelperApp; + User::LeaveIfError( aiHelperApp.Attach( + KWsfAiHelperCategoryUid, + KWsfAiHelperExitCodeKey ) ); + CleanupClosePushL( aiHelperApp ); + + aiHelperApp.Subscribe( waiter->iStatus ); + + LOG_WRITE("launching..."); + iModel->LaunchHelperApplicationL( aInfo, ETrue, EFalse ); + waiter->WaitForRequest(); + + TInt exitCode( KErrNone ); + aiHelperApp.Get( exitCode ); + + LOG_WRITEF("AiHelper returned %d", exitCode ); + + if ( exitCode == KErrNone ) + { + User::LeaveIfError( aiHelperApp.Attach( + KWsfAiHelperCategoryUid, + KWsfAiHelperIapIdKey ) ); + TInt iapId( 0 ); + aiHelperApp.Get( iapId ); + aInfo.iIapId = TUint32( iapId ); + LOG_WRITEF("AiHelper iap id = %d", iapId ); + } + else + { + User::Leave( exitCode ); + } + + CleanupStack::PopAndDestroy( &aiHelperApp ); + CleanupStack::PopAndDestroy( waiter ); + } + + +// -------------------------------------------------------------------------- +// 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 + { + // check that the model still has the entry + if ( selectedWlan < iAiModel->GetInfoArray()->Count() ) + { + // get wlan info + aInfo = *iAiModel->GetInfoArray()->At( selectedWlan ); + } + else + { + // other unlisted item was selected + } + } + } + + RefreshUiL(); + + 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( iModel->GetWlanListL(), 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(); + 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::DisconnectL +// -------------------------------------------------------------------------- +// +void TWsfAiController::DisconnectL() + { + LOG_ENTERFN( "TWsfAiController::DisconnectL" ); + + _ASS_D( iModel ); + + iModel->DisconnectL(); + } + + +// -------------------------------------------------------------------------- +// 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... + CEikonEnv::Static()->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( CEikonEnv::Static()->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->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->Count() || + !wlanArray->At( KFirstItemArrayIndex )->Known() ) + { + // no known networks, let the user choose one + TWsfWlanInfo info; + + if ( LaunchSearchDialogL( info ) ) + { + ConnectL( info, ETrue ); + } + } + else + { + // there are known networks + ConnectL( *wlanArray->At( KFirstItemArrayIndex ), ETrue ); + } + + break; + } + + case EAiOfflineSearchWlans: + { + // Search for wlans was selected + if ( !wlanArray || !wlanArray->Count() ) + { + // there are no available networks + HBufC* infoText = StringLoader::LoadLC( + R_QTN_WLAN_INFO_NO_NETWORKS_FOUND ); + CAknInformationNote* infoNote = new (ELeave) + CAknInformationNote( ETrue ); + infoNote->ExecuteLD( *infoText ); + CleanupStack::PopAndDestroy( infoText ); + } + + // launch the search dialog + TWsfWlanInfo info; + + if ( LaunchSearchDialogL( info ) ) + { + ConnectL( info, ETrue ); + } + + 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 + iModel->DisconnectL(); + } + } + } + + +// -------------------------------------------------------------------------- +// 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->IsConnectedL() ) + { + // disconnect wlan + iModel->DisconnectL(); + } + 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 + iModel->DisconnectL(); + } + } + } + +// -------------------------------------------------------------------------- +// TWsfAiController::RefreshRefreshingL +// -------------------------------------------------------------------------- +// +void TWsfAiController::RefreshRefreshingL() + { + LOG_ENTERFN( "TWsfAiController::RefreshRefreshingL" ); + MDesCArray *data = iAiModel->FormatRefreshingL(); + iUi->UpdateViewL( data ); + } + +// -------------------------------------------------------------------------- +// TWsfAiController::RefreshConnectingL +// -------------------------------------------------------------------------- +// +void TWsfAiController::RefreshConnectingL() + { + LOG_ENTERFN( "TWsfAiController::RefreshConnectingL" ); + MDesCArray *data = iAiModel->FormatConnectingL(); + iUi->UpdateViewL( data ); + } + +// End of file diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/src/wsfaimodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfaimodel.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,673 @@ +/* +* 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" ); + + // Function expects that items in list are already in proper order + iWlanInfoArray = aWlanList; + + 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 ); + } + + 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; + } + + // 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; + 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( aWlanList, 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/src/wsfaiplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfaiplugin.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,1057 @@ +/* +* 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" + + +// define icon id for Navigation Bar icon +LOCAL_D const TInt KNaviBarIcon = EWlanOffIcon; +LOCAL_D const TInt KTransparentIcon = ETransparentIcon; +LOCAL_D const TUid KUidSnifferApp = {0x10281CAA}; +LOCAL_D const TInt KRefreshStepTime = 200 * 1000; +LOCAL_D const TInt KConnectingStepTime = 200 * 1000; +_LIT8( KWlanWizardName, "WLANWizard" ); + + + +// -------------------------------------------------------------------------- +// 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() + { + // Cancel periodic animation update + if ( iAnimationPeriodic ) + { + LOG_WRITE( "Cancel animation update" ); + iAnimationPeriodic->Cancel(); + delete iAnimationPeriodic; + iAnimationPeriodic = NULL; + } + + delete iDbObserver; + + // Cancel start up refresh + if ( iStartupRefresh ) + { + LOG_WRITE( "Cancel start up refresh" ); + iStartupRefresh->Cancel(); + delete iStartupRefresh; + iStartupRefresh = NULL; + } + + delete iModel; + delete iAiModel; + delete iUi; + + delete iCurrentSignalStrength; + delete iCurrentSecureInfo; + + if ( iWlanTitle ) + { + delete iWlanTitle; + } + + if ( iMskActivate ) + { + delete iMskActivate; + } + + if ( iConnectedTo ) + { + delete iConnectedTo; + } + + if ( iKnownNetworkFound ) + { + delete iKnownNetworkFound; + } + + CCoeEnv::Static()->DeleteResourceFile( iResourceFileOffset ); + + iObservers.Close(); + + Release( iContent ); + Release( iEvents ); + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::CWsfAiPlugin +// -------------------------------------------------------------------------- +// +CWsfAiPlugin::CWsfAiPlugin() + { + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::ConstructL +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::ConstructL() + { + LOG_ENTERFN( "CWsfAiPlugin::ConstructL" ); + AllocateResourcesL(); + + iInfo.iUid = KUidWlanWizardPlugin; + iInfo.iName.Copy( KWlanWizardName ); + + 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 ); + iStartupRefresh = new (ELeave) CAsyncCallBack( + TCallBack( StartupRefresh, this ), + CActive::EPriorityIdle ); + iDbObserver = CWsfDbObserver::NewL(); + iController.SetUi( *static_cast( iUi ) ); + iController.InitializeL( iModel, iAiModel, iDbObserver ); + } + + +// -------------------------------------------------------------------------- +// 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* localCurrentTypeText( 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 ) + { + TPtrC begin = fullText.Mid( leftBoundary, + rightBoundary - leftBoundary + 1 ); + localCurrentStatusText = begin.AllocLC(); + localCurrentNetworkName = begin.AllocLC(); + + TPtrC end = fullText.Mid( rightBoundary + 1 ); + localCurrentTypeText = end.AllocLC(); + } + else + { + localCurrentStatusText = fullText.AllocLC(); + delete localCurrentTypeText; + localCurrentTypeText = NULL; + } + + //Connected + if ( localCurrentNetworkName ) + { + if ( iAiModel->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 ); + } + localCurrentNetworkStatus = iKnownNetworkFound; + } + } + else + { + localCurrentNetworkStatus = localCurrentStatusText; + } + + 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]; + observer->StartTransaction( reinterpret_cast( this ) ); + // make sure we cancel the tracsaction if leaves + CleanupStack::PushL( TCleanupItem( PublishCleanup, this ) ); + + // Publish Full Text if Classic or Navigation Bar Classic used + if ( localFullText ) + { + published = PublishText( observer, + EAiWizardContentFullText, + *localFullText ) || published; + } + + // Publish Navigation Bar Icon: EAiWizardContentNaviBarIcon + published = PublishIconL( observer, + EAiWizardContentNaviBarIcon, + KNaviBarIcon ) || published; + + // Publish Application Title: EAiWizardContentTitleText + if ( !iWlanTitle ) + { + iWlanTitle = StringLoader::LoadL( R_QTN_AI_WIZARD_TITLE ); + } + if ( iWlanTitle ) + { + published = PublishText( observer, + EAiWizardContentTitleText, + *iWlanTitle ) || published; + } + + if ( localCurrentStatusText ) + { + // Publish Status icon: EAiWizardContentStatusIcon + iconId = aPublishIconArray->At( 0 ); + published = PublishIconL( observer, + EAiWizardContentStatusIcon, + iconId ) || published; + + // Publish Status text: EAiWizardContentStatusText + published = PublishText( observer, + EAiWizardContentStatusText, + *localCurrentStatusText ) || published; + } + + if ( localCurrentTypeText ) + { + // Publish Type icon: EAiWizardContentTypeIcon + published = PublishIconL( observer, + EAiWizardContentTypeIcon, + KTransparentIcon ) || published; + + // Publish Type text: EAiWizardContentTypeText + published = PublishText( observer, + EAiWizardContentTypeText, + *localCurrentTypeText ) || published; + } + + // Publish Strength icon: EAiWizardContentStrengthIcon + iconId = aPublishIconArray->At( 2 ); + published = PublishIconL( observer, + EAiWizardContentStrengthIcon, + iconId ) || published; + + // Publish Strength text: EAiWizardContentStrengthText + if ( iCurrentSignalStrength && iScanState ) + { + published = PublishText( observer, + EAiWizardContentStrengthText, + *iCurrentSignalStrength ) || published; + } + + // Publish Secure icon: EAiWizardContentSecureIcon + iconId = aPublishIconArray->At( 1 ); + published = PublishIconL( observer, + EAiWizardContentSecureIcon, + iconId ) || published; + + // Publish Secure text: EAiWizardContentSecureText + if ( iCurrentSecureInfo && iScanState ) + { + published = PublishText( observer, + EAiWizardContentSecureText, + *iCurrentSecureInfo ) || published; + } + + if ( localCurrentNetworkName ) + { + // Publish NetworkName text: EAiWizardContentNetworkName + published = PublishText( observer, + EAiWizardContentNetworkName, + *localCurrentNetworkName ) || published; + } + + if ( localCurrentNetworkStatus ) + { + // Publish NetworkName text: EAiWizardContentNetworkName + published = PublishText( observer, + EAiWizardContentNetworkStatus, + *localCurrentNetworkStatus ) || published; + } + + // If we published something then commit, + // otherwise cancel transaction + if ( published ) + { + observer->Commit( reinterpret_cast( this ) ); + published = EFalse; + } + else + { + observer->CancelTransaction( reinterpret_cast( this ) ); + } + CleanupStack::Pop( 1 ); // PublishCleanup() + } + + if ( localCurrentTypeText ) + { + CleanupStack::PopAndDestroy( localCurrentTypeText ); + } + + if ( localCurrentNetworkName ) + { + CleanupStack::PopAndDestroy( localCurrentNetworkName ); + } + + if ( localCurrentStatusText ) + { + CleanupStack::PopAndDestroy( localCurrentStatusText ); + } + + CleanupStack::PopAndDestroy( localFullText ); + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::AllocateResourcesL +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::AllocateResourcesL() + { + LOG_ENTERFN( "CWsfAiPlugin::AllocateResourcesL" ); + // create resourcefile + CCoeEnv* env = CCoeEnv::Static(); + TFindFile finder( env->FsSession() ); + CDir* fileEntries; + User::LeaveIfError( finder.FindWildByDir( KResourceFile, + KDC_RESOURCE_FILES_DIR, + fileEntries ) ); + + TParse pathParse; + pathParse.Set( (*fileEntries)[0].iName, &finder.File(), NULL ); + + TFileName resourceFile = pathParse.FullName(); + delete fileEntries; + + BaflUtils::NearestLanguageFile( env->FsSession(), resourceFile ); + iResourceFileOffset = env->AddResourceFileL( resourceFile ); + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::Resume +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::Resume( TAiTransitionReason aReason ) + { + LOG_ENTERFN( "CWsfAiPlugin::Resume" ); + switch ( aReason ) + { + case EAiSystemStartup: + { + LOG_WRITE( "Resume - EAiSystemStartup"); + iStartupRefresh->CallBack(); + break; + } + + case EAiIdleForeground: + { + // AI came to foreground -> make refresh scan + if ( !iAiModel->Connected() && !iModel->IsConnecting() ) + { + LOG_WRITE( "Call Refresh scan" ); + TRAP_IGNORE( iModel->RefreshScanL() ); + } + else + { + LOG_WRITE( "Connected no need to refresh scan results" ); + } + break; + } + + case EAiIdleBackground: + { + // AI went to background -> dismiss open dialogs/menus + TRAP_IGNORE( iController.DismissDialogsL() ); + break; + } + + default: + { + break; + } + } + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::Suspend +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::Suspend( TAiTransitionReason /*aReason*/ ) + { + LOG_ENTERFN( "CWsfAiPlugin::Suspend" ); + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::Stop +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::Stop( TAiTransitionReason /*aReason*/ ) + { + LOG_ENTERFN( "CWsfAiPlugin::Stop" ); + TRAP_IGNORE( iController.DeInitializeL() ); + if ( iAnimationPeriodic ) + { + LOG_WRITE( "Cancel animation update" ); + iAnimationPeriodic->Cancel(); + delete iAnimationPeriodic; + iAnimationPeriodic = NULL; + } + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::SubscribeL +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::SubscribeL( MAiContentObserver& aObserver ) + { + LOG_ENTERFN( "CWsfAiPlugin::Subscribe" ); + return iObservers.AppendL( &aObserver ); + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::ConfigureL +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::ConfigureL( RAiSettingsItemArray& /*aSettings*/ ) + { + LOG_ENTERFN( "CWsfAiPlugin::ConfigureL" ); + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::Extension +// -------------------------------------------------------------------------- +// +TAny* CWsfAiPlugin::Extension( TUid aUid ) + { + LOG_ENTERFN( "CWsfAiPlugin::Extension" ); + if ( aUid == KExtensionUidProperty ) + { + return static_cast( this ); + } + else if ( aUid == KExtensionUidEventHandler ) + { + return static_cast( this ); + } + + return NULL; + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::GetPropertyL +// -------------------------------------------------------------------------- +// +TAny* CWsfAiPlugin::GetPropertyL( TInt aProperty ) + { + switch ( aProperty ) + { + case EAiPublisherInfo: + { + return &iInfo; + } + + case EAiPublisherContent: + { + return static_cast( iContent ); + } + + case EAiPublisherEvents: + { + return static_cast( iEvents ); + } + + default: + { + User::Leave( KErrNotSupported ); + } + } + + return NULL; + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::SetPropertyL +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::SetPropertyL( TInt aProperty, TAny* aValue ) + { + LOG_ENTERFN( "CWsfAiPlugin::SetProperty" ); + if ( aValue && ( aProperty == EAiPublisherInfo ) ) + { + const TAiPublisherInfo* info = + static_cast( aValue ); + iInfo = *info; + } + } + + +// -------------------------------------------------------------------------- +// 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, EAiWizardContentNaviBarIcon, + EAiWizardContentNaviBarIcon ); + observer->Clean( *this, EAiWizardContentTitleText, + EAiWizardContentTitleText ); + observer->Clean( *this, EAiWizardContentStatusIcon, + EAiWizardContentStatusIcon ); + observer->Clean( *this, EAiWizardContentStatusText, + EAiWizardContentStatusText ); + observer->Clean( *this, EAiWizardContentTypeIcon, + EAiWizardContentTypeIcon ); + observer->Clean( *this, EAiWizardContentTypeText, + EAiWizardContentTypeText ); + observer->Clean( *this, EAiWizardContentStrengthIcon, + EAiWizardContentStrengthIcon ); + observer->Clean( *this, EAiWizardContentStrengthText, + EAiWizardContentStrengthText ); + observer->Clean( *this, EAiWizardContentSecureIcon, + EAiWizardContentSecureIcon ); + observer->Clean( *this, EAiWizardContentSecureText, + EAiWizardContentSecureText ); + observer->Clean( *this, EAiWizardContentNetworkName, + EAiWizardContentNetworkName ); + observer->Commit( reinterpret_cast( this ) ); + } + } + + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::SetStrengthAndSecure +// -------------------------------------------------------------------------- +// +void CWsfAiPlugin::SetStrengthAndSecure( TDesC* aStrength, TDesC* aSecure ) + { + LOG_ENTERFN( "CWsfAiPlugin::SetStrengthAndSecure" ); + delete iCurrentSignalStrength; + iCurrentSignalStrength = NULL; + if ( aStrength && aStrength->Length() > 0) + { + iCurrentSignalStrength = aStrength->Alloc(); + } + + delete iCurrentSecureInfo; + iCurrentSecureInfo = NULL; + if ( aSecure && aSecure->Length() > 0) + { + // r_qtn_sniffer_plug_in_content_secure + iCurrentSecureInfo = aSecure->Alloc(); + } + } + + +// -------------------------------------------------------------------------- +// 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; + } + iAiModel->InitializeRefreshAnimation(); + iAnimationPeriodic = CPeriodic::NewL( + CActive::EPriorityStandard ); + + iAnimationPeriodic->Start( + TTimeIntervalMicroSeconds32( KRefreshStepTime ), + TTimeIntervalMicroSeconds32( KRefreshStepTime ), + TCallBack( + CWsfAiPlugin::DoRefreshingStepL, + this + ) ); + } + else + { + 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; + } + + 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( CEikonEnv::Static()->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::PublishClearup" ); + CWsfAiPlugin* self = static_cast( aPtr ); + self->iObservers[self->iCurrentObserverIndex] + ->CancelTransaction( reinterpret_cast( self ) ); + } + + +// --------------------------------------------------------------------------- +// CWsfAiPlugin::StartupRefresh +// --------------------------------------------------------------------------- +// +TInt CWsfAiPlugin::StartupRefresh( TAny* aPtr ) + { + LOG_ENTERFN( "CWsfAiPlugin::StartupRefresh" ); + CWsfAiPlugin* self = static_cast( aPtr ); + TRAP_IGNORE( self->StartupRefreshL(); ); + + return 0; + } + + +// --------------------------------------------------------------------------- +// CWsfAiPlugin::StartupRefreshL +// --------------------------------------------------------------------------- +// +TInt CWsfAiPlugin::StartupRefreshL() + { + LOG_ENTERFN( "CWsfAiPlugin::StartupRefresh" ); + iController.StartupRefreshL(); + + return 0; + } + +// --------------------------------------------------------------------------- +// 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 we published something then commit, + // otherwise cancel transaction + if ( published ) + { + published = EFalse; + } + } + } + + +// End of File. diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/src/wsfaipluginproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfaipluginproxy.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/src/wsfaiview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfaiview.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,463 @@ +/* +* 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 ); + iPublishObserver->PublishContentL( iPublishIconArray, iTextLabel ); + } + + +// -------------------------------------------------------------------------- +// 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() + { + 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... + + TInt secVal = 0; + //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 ); + + secVal = secureicon; + HBufC* secureString = NULL; + + iPublishObserver->SetStrengthAndSecure( NULL, secureString ); + if ( secVal == ESecureNetworkIcon ) + { + delete secureString; + secureString = NULL; + } + + // 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(); + iPublishObserver->PublishContentL( iPublishIconArray, iTextLabel ); + 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(); + iPublishObserver->PublishContentL( iPublishIconArray, iTextLabel ); + } + + +// -------------------------------------------------------------------------- +// 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; + } + +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 ); + + iUpdateStatusIconDeferred = statusIcon; + + MakeTransparentPublishIconsL(); + + iPublishObserver->PublishStatusIconL( iPublishIconArray, iTextLabel ); + } + +// END OF FILE diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/src/wsfdbobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfdbobserver.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,255 @@ +/* +* 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; + +// --------------------------------------------------------- +// CWlanPluginDbObserver::CWlanPluginDbObserver +// Constructor +// --------------------------------------------------------- +CWsfDbObserver::CWsfDbObserver( ) +: CActive( EPriorityNormal ), +iOuterScanState( EFalse ) + { + } + +// --------------------------------------------------------- +// CWlanPluginDbObserver::NewL +// --------------------------------------------------------- +CWsfDbObserver* CWsfDbObserver::NewL( ) + { + CWsfDbObserver* self = new ( ELeave ) CWsfDbObserver( ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------- +// CWlanPluginDbObserver::ConstructL +// --------------------------------------------------------- +void CWsfDbObserver::ConstructL() + { +#ifndef __WINS__ // client is not available on wins + iWlanMgmtClient = CWlanMgmtClient::NewL(); +#endif + + FeatureManager::InitializeLibL(); + + CActiveScheduler::Add(this); + + } + +// --------------------------------------------------------- +// CWlanPluginDbObserver::~CWlanPluginDbObserver +// Destructor +// --------------------------------------------------------- +CWsfDbObserver::~CWsfDbObserver() + { + + + Cancel(); + + delete iRecord; + + delete iSession; + + delete iWlanMgmtClient; + + FeatureManager::UnInitializeLib(); + } + +// --------------------------------------------------------- +// CWlanPluginDbObserver::RunL +// --------------------------------------------------------- +void CWsfDbObserver::RunL() + { + LOG_ENTERFN( "CWsfDbObserver::RunL" ); + //iSession->OpenTransactionL(); + //iRecord->RefreshL( *iSession ); + iRecord->LoadL( *iSession ); + //iSession->CommitTransactionL(); + + //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); + + } + +// --------------------------------------------------------- +// CWlanPluginDbObserver::DoCancel +// --------------------------------------------------------- +void CWsfDbObserver::DoCancel() + { + + iRecord->CancelNotification( *iSession, iStatus ); + + } + +// --------------------------------------------------------- +// CWlanPluginDbObserver::ActivateIt +// --------------------------------------------------------- +void 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); + + } + +// --------------------------------------------------------- +// CWlanPluginDbObserver::SetController +// --------------------------------------------------------- +void CWsfDbObserver::SetController( TWsfAiController* aController ) + { + iController = aController; + } + +// --------------------------------------------------------- +// CWlanPluginDbObserver::EnableScanL +// --------------------------------------------------------- +void CWsfDbObserver::EnableScanL() + { + if( !iOuterScanState ) + { + iSession->OpenTransactionL(); + 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; + } + iSession->CommitTransactionL(); +#ifndef __WINS__ + // Notifying WLAN Engine about changes in settings + iWlanMgmtClient->NotifyChangedSettings(); +#endif + } + } + +// --------------------------------------------------------- +// CWlanPluginDbObserver::DisableScanL +// --------------------------------------------------------- +void CWsfDbObserver::DisableScanL() + { + if( iOuterScanState ) + { + iSession->OpenTransactionL(); + iRecord->RefreshL( *iSession ); + if ( iRecord->iBgScanInterval != 0 ) // scanning + { + TInt i; + i = iRecord->iBgScanInterval; + iRecord->iBgScanInterval = 0; + iRecord->iSavedBgScanInterval = i; + iRecord->ModifyL( *iSession ); + iOuterScanState = EFalse; + } + iSession->CommitTransactionL(); +#ifndef __WINS__ + // Notifying WLAN Engine about changes in settings + iWlanMgmtClient->NotifyChangedSettings(); +#endif + } + } + +// --------------------------------------------------------- +// CWlanPluginDbObserver::DefaultScanInterval +// --------------------------------------------------------- +TInt 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; + } + } + diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/src/wsficonarraycreator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsficonarraycreator.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,370 @@ +/* +* 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( ) + { + // try to locate the resorce file + TFindFile finder( CEikonEnv::Static()->FsSession() ); + User::LeaveIfError( finder.FindByDir( + KBitmapFile, KDC_APP_BITMAP_DIR ) ); + TFileName bitmapFileName = finder.File(); + + 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 ) + { + + // try to locate the resorce file + TFindFile finder( CEikonEnv::Static()->FsSession() ); + User::LeaveIfError( finder.FindByDir( KBitmapFile, + KDC_APP_BITMAP_DIR ) ); + TFileName bitmapFileName = finder.File(); + 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/aiplugin/src/wsfsearchwlansdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfsearchwlansdialog.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,197 @@ +/* +* 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" + +// 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 ) + { + CAknListQueryDialog::ProcessCommandL( aCommandId ); + } + +// -------------------------------------------------------------------------- +// CWsfSearchWlansDialog::UpdateHotSpotsL +// -------------------------------------------------------------------------- +// +void CWsfSearchWlansDialog::UpdateHotSpotsL( MDesCArray* aItemTextArray, + TInt aCurrentItem ) + { + _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() + { + _ASS_D( ListBox() ); + + return ListBox()->CurrentItemIndex(); + } + +// -------------------------------------------------------------------------- +// CWsfAiPlugin::StartConnectingAnimationL +// -------------------------------------------------------------------------- +// +void CWsfSearchWlansDialog::StartConnectingAnimationL() + { + } + +// -------------------------------------------------------------------------- +// CWsfSearchWlansDialog::ForceRefreshingL +// -------------------------------------------------------------------------- +// +void CWsfSearchWlansDialog::ForceRefreshingL() + { + } + + +// -------------------------------------------------------------------------- +// CWsfSearchWlansDialog::MultilineControl +// -------------------------------------------------------------------------- +// +TBool CWsfSearchWlansDialog::MultilineControl() + { + return ETrue; + } + + +// -------------------------------------------------------------------------- +// CWsfSearchWlansDialog::UpdateViewL +// -------------------------------------------------------------------------- +// +void CWsfSearchWlansDialog::UpdateViewL( MDesCArray* /*aItemTextArray*/ ) + { + } + +// -------------------------------------------------------------------------- +// CWsfSearchWlansDialog::DisplayEngineOffL +// -------------------------------------------------------------------------- +// +void CWsfSearchWlansDialog::DisplayEngineOffL() + { + } + + + +// -------------------------------------------------------------------------- +// CWsfSearchWlansDialog::PreLayoutDynInitL +// -------------------------------------------------------------------------- +// +void 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/apwizard/bwins/wsfapwizardu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/bwins/wsfapwizardu.def Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/apwizard/data/wsfapwizard.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/data/wsfapwizard.rss Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/apwizard/eabi/wsfapwizardu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/eabi/wsfapwizardu.def Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/apwizard/group/apwizard.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/group/apwizard.mmp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/apwizard/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/apwizard/inc/wsfactivewaiter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/inc/wsfactivewaiter.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/apwizard/inc/wsfapwizard.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/inc/wsfapwizard.hrh Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/apwizard/inc/wsfwlaniapcreator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/inc/wsfwlaniapcreator.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/apwizard/inc/wsfwlaniapwizard.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/inc/wsfwlaniapwizard.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/apwizard/inc/wsfwlanssiddiscovery.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/inc/wsfwlanssiddiscovery.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/apwizard/loc/wsfapwizard.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/loc/wsfapwizard.loc Thu Dec 17 09:20:28 2009 +0200 @@ -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: 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:Confirmation query, displayed if user skipped the test. +//l:popup_note_window +//w: +//r:5.0 +// +#define qtn_netw_conset_ict_quest_skipped_save "Save connection method for later use?" + +//d: Note to indicate to user that the connection method/access point +//d: will not be saved +//l: popup_note_window +//w: +//r:5.0 +// +#define qtn_netw_conset_ict_info_method_not_saved "Connection method will not be saved" + +//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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/apwizard/rom/wsfapwizard.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/rom/wsfapwizard.iby Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/apwizard/rom/wsfapwizardresources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/rom/wsfapwizardresources.iby Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/apwizard/src/wsfactivewaiter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/src/wsfactivewaiter.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/apwizard/src/wsfwlaniapcreator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/src/wsfwlaniapcreator.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,575 @@ +/* +* 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* 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, *ssid16 ); + 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 ); + 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, *ssid16 ); + 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 ); + aWlanInfo.iNetworkName.Copy( *cmName ); + + delete cmName; + + CleanupStack::PopAndDestroy( &cm ); + CleanupStack::PopAndDestroy( &destination ); + } + + CleanupStack::PopAndDestroy( ssid16 ); + + aWlanInfo.iIapId = iapId; + LOG_WRITEF( "new iapId = %d", iapId ); + + return iapId; + } + + diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/apwizard/src/wsfwlaniapwizard.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/src/wsfwlaniapwizard.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,682 @@ +/* +* 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 info note: No WLAN networks found + HBufC* infoText = StringLoader::LoadLC( + R_QTN_WLAN_INFO_NO_NETWORKS_FOUND ); + CAknInformationNote* informationNote = + new (ELeave) CAknInformationNote( ETrue ); + informationNote->ExecuteLD( *infoText ); + CleanupStack::PopAndDestroy( infoText ); + + + // 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/apwizard/src/wsfwlanssiddiscovery.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/apwizard/src/wsfwlanssiddiscovery.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,24 @@ +EXPORTS + ??0RWsfSession@@QAE@XZ @ 1 NONAME ; RWsfSession::RWsfSession(void) + ?AbortConnectingL@RWsfSession@@QAEXXZ @ 2 NONAME ; void RWsfSession::AbortConnectingL(void) + ?AbortScanningL@RWsfSession@@QAEXXZ @ 3 NONAME ; void RWsfSession::AbortScanningL(void) + ?CancelAll@RWsfSession@@QAEXXZ @ 4 NONAME ; void RWsfSession::CancelAll(void) + ?CancelNotifyEvent@RWsfSession@@QAEXXZ @ 5 NONAME ; void RWsfSession::CancelNotifyEvent(void) + ?Close@RWsfSession@@QAEXXZ @ 6 NONAME ; void RWsfSession::Close(void) + ?Connect@RWsfSession@@QAEHXZ @ 7 NONAME ; int RWsfSession::Connect(void) + ?ConnectWlanBearerL@RWsfSession@@QAEHKW4TWsfIapPersistence@@@Z @ 8 NONAME ; int RWsfSession::ConnectWlanBearerL(unsigned long, enum TWsfIapPersistence) + ?ConnectedAccountNameL@RWsfSession@@QAEPAVHBufC16@@XZ @ 9 NONAME ; class HBufC16 * RWsfSession::ConnectedAccountNameL(void) + ?ControlDisconnectTimerL@RWsfSession@@QAEHI@Z @ 10 NONAME ; int RWsfSession::ControlDisconnectTimerL(unsigned int) + ?DisableScanL@RWsfSession@@QAEHXZ @ 11 NONAME ; int RWsfSession::DisableScanL(void) + ?DisconnectWlanBearerL@RWsfSession@@QAEHXZ @ 12 NONAME ; int RWsfSession::DisconnectWlanBearerL(void) + ?EnableScanL@RWsfSession@@QAEHXZ @ 13 NONAME ; int RWsfSession::EnableScanL(void) + ?GetConnectedWlanDetailsL@RWsfSession@@QAEHAAVTWsfWlanInfo@@@Z @ 14 NONAME ; int RWsfSession::GetConnectedWlanDetailsL(class TWsfWlanInfo &) + ?IsConnectedL@RWsfSession@@QAEHXZ @ 15 NONAME ; int RWsfSession::IsConnectedL(void) + ?IsScanEnabledL@RWsfSession@@QAEHXZ @ 16 NONAME ; int RWsfSession::IsScanEnabledL(void) + ?MonitorAccessPointL@RWsfSession@@QAEXK@Z @ 17 NONAME ; void RWsfSession::MonitorAccessPointL(unsigned long) + ?NotifyEventL@RWsfSession@@QAEXAAVMWsfStateChangeObserver@@@Z @ 18 NONAME ; void RWsfSession::NotifyEventL(class MWsfStateChangeObserver &) + ?RequestScanL@RWsfSession@@QAEHXZ @ 19 NONAME ; int RWsfSession::RequestScanL(void) + ?SetIapPersistenceL@RWsfSession@@QAEHW4TWsfIapPersistence@@@Z @ 20 NONAME ; int RWsfSession::SetIapPersistenceL(enum TWsfIapPersistence) + ?UpdateWlanListL@RWsfSession@@QAEXPAVCWsfWlanInfoArray@@@Z @ 21 NONAME ; void RWsfSession::UpdateWlanListL(class CWsfWlanInfoArray *) + ?ConnectWlanBearerWithoutConnWaiterL@RWsfSession@@QAEHKW4TWsfIapPersistence@@@Z @ 22 NONAME ; int RWsfSession::ConnectWlanBearerWithoutConnWaiterL(unsigned long, enum TWsfIapPersistence) + diff -r 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,24 @@ +EXPORTS + _ZN11RWsfSession11EnableScanLEv @ 1 NONAME + _ZN11RWsfSession12DisableScanLEv @ 2 NONAME + _ZN11RWsfSession12IsConnectedLEv @ 3 NONAME + _ZN11RWsfSession12NotifyEventLER23MWsfStateChangeObserver @ 4 NONAME + _ZN11RWsfSession12RequestScanLEv @ 5 NONAME + _ZN11RWsfSession14AbortScanningLEv @ 6 NONAME + _ZN11RWsfSession14IsScanEnabledLEv @ 7 NONAME + _ZN11RWsfSession15UpdateWlanListLEP17CWsfWlanInfoArray @ 8 NONAME + _ZN11RWsfSession16AbortConnectingLEv @ 9 NONAME + _ZN11RWsfSession17CancelNotifyEventEv @ 10 NONAME + _ZN11RWsfSession18ConnectWlanBearerLEm18TWsfIapPersistence @ 11 NONAME + _ZN11RWsfSession18SetIapPersistenceLE18TWsfIapPersistence @ 12 NONAME + _ZN11RWsfSession19MonitorAccessPointLEm @ 13 NONAME + _ZN11RWsfSession21ConnectedAccountNameLEv @ 14 NONAME + _ZN11RWsfSession21DisconnectWlanBearerLEv @ 15 NONAME + _ZN11RWsfSession23ControlDisconnectTimerLEj @ 16 NONAME + _ZN11RWsfSession24GetConnectedWlanDetailsLER12TWsfWlanInfo @ 17 NONAME + _ZN11RWsfSession5CloseEv @ 18 NONAME + _ZN11RWsfSession7ConnectEv @ 19 NONAME + _ZN11RWsfSessionC1Ev @ 20 NONAME + _ZN11RWsfSessionC2Ev @ 21 NONAME + _ZN11RWsfSession35ConnectWlanBearerWithoutConnWaiterLEm18TWsfIapPersistence @ 22 NONAME + diff -r 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,164 @@ +/* +* 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(); + + /** + * 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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,286 @@ +/* +* 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 ); + + /** + * 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 ); + + /** + * 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 aPersistence The value of the persistence property + * @return KErrNone if managed to connect, otherwise error code + */ + IMPORT_C TInt ConnectWlanBearerL( TUint32 aIapId, + TWsfIapPersistence aPersistence = EIapPersistent ); + + /** + * Connect to the given WLAN IAP. The function requests connection from + * server without waiting the connection process to finish + * @since S60 5.2 + * @param aIapId The id of the IAP to connect to + * @param aPersistence The value of the persistence property + * @return KErrNone if connection request is succesfully sent to server + */ + IMPORT_C TInt ConnectWlanBearerWithoutConnWaiterL( TUint32 aIapId, + TWsfIapPersistence aPersistence = EIapPersistent ); + + /** + * 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(); + + /** + * Request the server to make a forced scan + * @since S60 5.0 + * @return ETrue on success + */ + IMPORT_C TBool RequestScanL(); + + /** + * 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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,91 @@ +/* +* 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 + * @param aAccesspointName The name of the active connection + */ + virtual void WlanConnectionActivatedL( + const TDesC& aAccessPointName ) = 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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,329 @@ +/* +* 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 + // get the connection name + HBufC* accessPointName = iSession->ConnectedAccountNameL(); + CleanupStack::PushL( accessPointName ); + iObserver->WlanConnectionActivatedL( *accessPointName ); + CleanupStack::PopAndDestroy( accessPointName ); + } + 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() + { + if ( iConnecting ) + { + // set the flag only if we are the ones who are connecting + iBlockConnectedEvent = ETrue; + } + } + + +// --------------------------------------------------------------------------- +// CWsfEventHandler::SetConnecting +// --------------------------------------------------------------------------- +// +void CWsfEventHandler::SetConnecting( TBool aConnecting ) + { + iConnecting = aConnecting; + } + + +// --------------------------------------------------------------------------- +// CWsfEventHandler::Connecting +// --------------------------------------------------------------------------- +// +TBool CWsfEventHandler::Connecting() const + { + return iConnecting; + } + diff -r 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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: 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; + + + +// --------------------------------------------------------------------------- +// 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(); + + if ( err == KErrNone ) + { + LOG_WRITE( "server started" ); + + err = CreateSession( KWlanSnifferServerName, Version(), KIPCSlots ); + + LOG_WRITEF( "CreateSession() returned %d", err ); + + if ( err == KErrNone ) + { + TRAP( err, iConnWaiter = new (ELeave) CActiveSchedulerWait() ); + } + } + else + { + LOG_WRITEF( "server starting failed with error %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::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::MonitorAccessPointL +// --------------------------------------------------------------------------- +// +EXPORT_C void RWsfSession::MonitorAccessPointL( TUint32 aMonitoredIap ) + { + LOG_ENTERFN("RWsfSession::MonitorAccessPointL"); + + CWsfActiveWaiter *waiter = CWsfActiveWaiter::NewL(); + CleanupStack::PushL( waiter ); + + SendReceive( ESnifferCmdMonitorAp, TIpcArgs( aMonitoredIap ), + waiter->iStatus ); + waiter->WaitForRequest(); + LOG_WRITEF( "message[%d] call returned %d", + ESnifferCmdMonitorAp, + waiter->iStatus.Int() ); + User::LeaveIfError( waiter->iStatus.Int() ); + + CleanupStack::PopAndDestroy( waiter ); + } + + +// --------------------------------------------------------------------------- +// 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::ConnectWlanBearerL +// --------------------------------------------------------------------------- +// +EXPORT_C TInt RWsfSession::ConnectWlanBearerL( TUint32 aIapId, + TWsfIapPersistence aPersistence ) + { + LOG_ENTERFN( "RWsfSession::ConnectWlanBearerL" ); + LOG_WRITEF( "IAP id = %d", aIapId ); + + // mark the beginning of the connection process + iEventHandler->SetConnecting( ETrue ); + + TInt res( KErrNone ); + TPckgBuf pckg; + + CWsfActiveWaiter *waiter = CWsfActiveWaiter::NewL(); + CleanupStack::PushL( waiter ); + + SendReceive( ESnifferCmdConnect, TIpcArgs( &pckg, aIapId, 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::ConnectWlanBearerWithoutConnWaiterL +// --------------------------------------------------------------------------- +// +EXPORT_C TInt RWsfSession::ConnectWlanBearerWithoutConnWaiterL( TUint32 aIapId, + TWsfIapPersistence aPersistence ) + { + LOG_ENTERFN( "RWsfSession::ConnectWlanBearerWithoutConnWaiterL" ); + LOG_WRITEF( "IAP id = %d", aIapId ); + + // mark the beginning of the connection process + iEventHandler->SetConnecting( ETrue ); + + TInt res( KErrNone ); + TPckgBuf pckg; + + CWsfActiveWaiter *waiter = CWsfActiveWaiter::NewL(); + CleanupStack::PushL( waiter ); + + SendReceive( ESnifferCmdConnect, TIpcArgs( &pckg, aIapId, 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 ); + } + + return res; + } + + +// --------------------------------------------------------------------------- +// 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::Close +// --------------------------------------------------------------------------- +// +EXPORT_C void RWsfSession::Close() + { + LOG_ENTERFN("RWsfSession::Close"); + delete iEventHandler; iEventHandler = NULL; + delete iConnWaiter; iConnWaiter = NULL; + + 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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,81 @@ +/* +* 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 AllFiles + +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 + + +// 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 euser.lib +LIBRARY bafl.lib +LIBRARY estor.lib +LIBRARY ecom.lib +LIBRARY commsdat.lib +LIBRARY commdb.lib +LIBRARY cmmanagerdatabase.lib +LIBRARY cmmanager.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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,348 @@ +/* +* 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 aPersistence Persistence property of the IAP + * @return KErrNone if successful, otherwise error code + */ + TInt ConnectWlanL( TUint32 aIapId, 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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,413 @@ +/* +* 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 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, + + /** + * Application connection preferences and default connection + * has been changed + */ + ECsPreferencesChanged, + + /** + * 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 + * @return KErrNone on success, error code otherwise + */ + TInt ConnectBearer( TUint32 aIapId ); + + /* + * 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 + */ + void 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; + + }; + + +#endif // C_WSFWLANBEARERCONNECTIONMONITOR_H + diff -r 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 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; + + }; + +#endif // M_WSFWLANCONNECTIONDETAILSPROVIDER_H + +// End of file diff -r 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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: 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, + E802Dot11ExtendedRatesIE = 50, + E802Dot11AironetIE = 133, + E802Dot11ApIpAddressIE = 149, + E802Dot11RsnIE = 221 + }; + + +#endif // WSFWLANSCANINFODEFINES_H + diff -r 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,504 @@ +/* +* 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" + + +// 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, + + /** + * Processing broadcast scan results + */ + EBroadcastScan, + + /** + * 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 ); + + /** + * Parses the scan results for the transfer rate + * @since S60 5.0 + * @param aWlanInfo The wlaninfo to put the results in + */ + void RefreshMaxRate( 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; + + }; + + +#endif // C_WSFWLANSCANNER_H + +// End of file diff -r 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,705 @@ +/* +* 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(); + + 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, + 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 ); + + 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"); + + iWlanBearerMonitor->AbortConnecting(); + + if ( 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; + } + } + } + + +// --------------------------------------------------------------------------- +// 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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,715 @@ +/* +* 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 ) + { + 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 + 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() ); + TWsfIapPersistence persistence( TWsfIapPersistence( aMessage.Int2() ) ); + TPckgBuf p( iServer.Engine()->ConnectWlanL( iapId, 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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,1153 @@ +/* +* 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 + + + +// CLASS HEADER +#include "wsfwlanbearerconnectionmonitor.h" + +// INTERNAL INCLUDES +#include "wsfwlanmonitorobserver.h" +#include "wsflogger.h" +#include "wsfactivewaiter.h" +#include "wsfservercloseradapter.h" +#include "wsfcommon.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) + }; + + + +// 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; + + 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 ); + 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 ) + { + 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 ); + + 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 +// --------------------------------------------------------------------------- +// +void CWsfWlanBearerConnectionMonitor::AbortConnecting() + { + LOG_ENTERFN( "CWsfWlanBearerConnectionMonitor::AbortConnecting" ); + + if ( iConnectingState != ECsIdle ) + { + LOG_WRITE( "connection in progress, aborting"); + iAborting = ETrue; + + if ( IsActive() && iConnectingState == ECsSocketOpened ) + { + LOG_WRITE( "forcing connection to stop" ); + iConnection.Stop(); + } + } + } + + +// --------------------------------------------------------------------------- +// 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 ) + { + // 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 ); + + // 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" ); + + 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 ( iAutoDisconnect ) + { + if ( iClientCount ) + { + // 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 ECsPreferencesChanged: // fall-through + { + // restoring default connection + TCmDefConnValue defConn; + TInt error = KErrNone; + + LOG_WRITE( "reading default connection" ); + TRAP( error, iCmMgr.ReadDefConnL( defConn ) ); + if ( error ) + { + // Ignore possible failure and continue the cleanup + LOG_WRITEF( "ReadDefConnL returned error %d", error ); + } + + if ( error == KErrNone && defConn == iCurrentDefConn ) + { + // nobody has overwritten our setting so it's our duty to + // restore the original value + LOG_WRITE( "restoring default connection" ); + TRAP( error, iCmMgr.WriteDefConnL( iOriginalDefConn ) ); + if ( error ) + { + // Ignore possible failure and continue the cleanup + LOG_WRITEF( "WriteDefConnL returned error %d", error ); + } + } + } + + case ECsConnectionCreated: // fall-through + { + + } + + case ECsSocketOpened: // fall-through + { + // 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: + { +#ifdef __WINSCW__ + User::After(5000000); +#endif + 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( "" ); + + // changing connection preferences + // start monitoring the iap + MonitorAccessPoint( iConnIap ); + + TInt error = KErrNone; + + // store previous default connection value + TRAP( error, iCmMgr.ReadDefConnL( iOriginalDefConn ) ); + if ( error ) + { + // Ignore possible failure and continue + LOG_WRITEF( "RunL ReadDefConnL returned error %d", error ); + } + else + { + LOG_WRITEF( "original default connection type/id = %d/%d", + iOriginalDefConn.iType, + iOriginalDefConn.iId ); + + // set the new connection as default + iCurrentDefConn.iType = ECmDefConnConnectionMethod; + iCurrentDefConn.iId = iConnIap; + + TRAP( error, iCmMgr.WriteDefConnL( iCurrentDefConn ) ); + if ( error ) + { + // Ignore possible failure and continue + LOG_WRITEF( "RunL WriteDefConnL returned error %d", error ); + } + + LOG_WRITEF( "current default connection set to type/id = %d/%d", + iCurrentDefConn.iType, + iCurrentDefConn.iId ); + } + + iConnectingState = ECsPreferencesChanged; + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + break; + } + + case ECsPreferencesChanged: + { + LOG_WRITE( "" ); + + // 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 ); + + 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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,1749 @@ +/* +* 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(); + 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->CancelGetScanResults(); +#endif + iScanState = EIdle; + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::RunL +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::RunL() + { + LOG_ENTERFN( "CWsfWlanScanner::RunL" ); + + /* + * Scan logic + * 1. Do broadcast scan - state = EIdle + * 2. Get available IAPs - state = EBroadcastScan + * 3. Process broadcast scan results state = EBroadcastScan + * 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( "broadcast scan phase" ); + + // prepare things for direct scans + PrepareDirectScan(); + + // notify clients + if ( iObserver ) + { + iObserver->WlanScanStarted(); + } + + // do broadcast scan +#ifndef __WINS__ + iWlanMgmtClient->GetScanResults( iStatus, *iScanInfo ); + SetActive(); +#else + // for testing + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); +#endif + + iScanState = EBroadcastScan; + } + + else if ( iScanState == EBroadcastScan ) + { + // 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; + + // we may let go the scan array contents... + iScanArray->Reset(); + +#ifdef _DEBUG + DumpScanResultsL( iScanArray ); +#endif + // 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(); + SetActive(); + } + + iScanState = EIdle; + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::AddConnectedWLANInfo +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::AddConnectedWLANInfoL() + { + // Get the possible connection + if ( iConnectionDetailsProvider ) + { + 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. + TWlanSsid connectedSsid; + iWlanMgmtClient->GetConnectionSsid( 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, + iScanArray->Count(), + matchArray ); + } + + } + else + { + LOG_WRITE( "Easy WLAN connection" ); + iScanArray->MatchL( connectedInfo->iSsid, + connectedInfo->iSecurityMode, + connectedInfo->iNetMode, iScanArray->Count(), + matchArray ); + } + + if ( matchArray.Count() ) + { + LOG_WRITE( "Info found" ); + TWsfWlanInfo* temp = matchArray[0]; + temp->iConnectionState = EConnected; + 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 ) + { + _LIT( Kopen, "open" ); + _LIT( Kwep, "wep" ); + _LIT( Kwpa, "wpa" ); + _LIT( Kwpa2, "wpa2" ); + _LIT( K802, "802.1x" ); + const TDesC* secModes[4] = { &Kopen, &Kwep, &K802, &Kwpa }; + _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; + } + + 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] %S %S %S", ssid, 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 ) ); + 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 + 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 ); + + if ( iScanState == EIdle && ( IsActive() || iShowAvailability ) ) + { + // we have been waiting for the timer to complete + // cancel it manually + Cancel(); + + // then complete ourselves + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + restarted = ETrue; + } + + 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 ) ); + 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() ) + { + // complete ourselves + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::BssLost +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::BssLost() + { + LOG_ENTERFN( "CWsfWlanScanner::BssLost" ); + if ( iScanState == EIdle && !IsActive() ) + { + // complete ourselves + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::BssRegained +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::BssRegained() + { + LOG_ENTERFN( "CWsfWlanScanner::BssRegained" ); + if ( iScanState == EIdle && !IsActive() ) + { + // complete ourselves + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::NewNetworksDetected +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::NewNetworksDetected() + { + LOG_ENTERFN( "CWsfWlanScanner::NewNetworksDetected" ); + if ( iScanState == EIdle && !IsActive() ) + { + // complete ourselves + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + } + + +// --------------------------------------------------------------------------- +// CWsfWlanScanner::OldNetworksLost +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::OldNetworksLost() + { + LOG_ENTERFN( "CWsfWlanScanner::OldNetworksLost" ); + if ( iScanState == EIdle && !IsActive() ) + { + // 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() ) + { + // 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() ) + { + // 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 ); + RefreshMaxRate( *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 %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 + User::Leave( iStatus.Int() ); + } + + TInt nElem = 0; + TBool isHidden( EFalse ); + + // 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) + RArray availableIaps; + iWlanMgmtClient->GetAvailableIaps(availableIaps); + TInt avIapCount = availableIaps.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 = availableIaps[i]; + 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 = EWlanSignalUnavailable; + availableInfo->iTransferRate = 0; + availableInfo->iConnectionState = ENotConnected; + iScanArray->AppendL(availableInfo); + nElem++; + + if ( availableInfo->iIapId ) + { + LOG_WRITEF( "Append available iap [%d] for direct scan", availableInfo->iIapId ); + iDirectScanIapIDs.Append( availableInfo->iIapId ); + iDirectScanSsids.Append( availableInfo->iSsid ); + } + + CleanupStack::Pop( availableInfo ); + } + else + { + LOG_WRITE( "Info not added" ); + CleanupStack::PopAndDestroy( availableInfo ); + } + } + + // 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 ); + RefreshMaxRate( *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, nElem, matchArray ); + + TInt matchcount = matchArray.Count(); + + // if not found + if( matchcount == 0 ) + { + wlanInfo->iCoverage = 1; + RefreshSignalStrength( *wlanInfo ); + RefreshMaxRate( *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 ); + RefreshMaxRate( *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" ); + + 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 ); + + // 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); + + // 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 ); + 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::RefreshMaxRate +// --------------------------------------------------------------------------- +// +void CWsfWlanScanner::RefreshMaxRate( TWsfWlanInfo& aWlanInfo ) + { + LOG_ENTERFN( "CWsfWlanScanner::RefreshMaxRate" ); + + TUint8 ieLen( 0 ); + const TUint8* ieData; + TUint8 dataRates[KMaxNumberOfRates]; + TUint8 maxDataRate( aWlanInfo.iTransferRate * 2 ); + + Mem::FillZ( &dataRates[0], sizeof( dataRates ) ); + + // Supported Rates + iScanInfo->InformationElement( E802Dot11SupportedRatesIE, ieLen, &ieData ); + + Mem::Copy( dataRates, ieData, ieLen ); + + for ( TInt a = 0; a < ieLen; a++ ) + { + // ignore the highest bit + dataRates[a] &= 0x7f; + if ( maxDataRate < dataRates[a] ) + { + maxDataRate = dataRates[a]; + } + } + + // Extended Supported Rates + Mem::FillZ( &dataRates[0], sizeof( dataRates ) ); + + iScanInfo->InformationElement( E802Dot11ExtendedRatesIE, ieLen, &ieData ); + + Mem::Copy( dataRates, ieData, ieLen ); + + if ( ieData ) + { + for ( TInt a = 0; a < ieLen; a++ ) + { + dataRates[a] &= 0x7f; + if ( maxDataRate < dataRates[a] ) + { + maxDataRate = dataRates[a]; + } + } + } + aWlanInfo.iTransferRate = maxDataRate / 2; + LOG_WRITEF( "maxRate = %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 ) ); + 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 ) ); + SetActive(); + } + } + } + +// End of file + diff -r 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/group/wsficons.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/group/wsficons.mk Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/group/wsficons_aif.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/group/wsficons_aif.mk Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/help/data/xhtml.zip Binary file wlanutilities/wlansniffer/help/data/xhtml.zip has changed diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/help/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/help/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/inc/wsflogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/inc/wsflogger.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/data/wlansniffer.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/data/wlansniffer.rss Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,696 @@ +/* +* 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_detailsview +// Details +// +// --------------------------------------------------------- +// +RESOURCE AVKON_VIEW r_sniffer_detailsview + { + menubar = r_sniffer_menubar; + cba = R_AVKON_SOFTKEYS_OK_EMPTY; + } + +// --------------------------------------------------------- +// +// 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; + } + }; + } + +//----------------------------------------------------------------------------- +// +// 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; + } + +//----------------------------------------------------------------------------- +// +// 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 = EAknListBoxMenuList | + EAknListBoxDisableHighlight; + }; + 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_wait_connecting + { + buf = qtn_sniffer_wait_connecting; + } + +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 TBUF r_qtn_sniffer_quest_restart_browsing_with_wlan + { + buf = qtn_sniffer_quest_restart_browsing_with_wlan; + } + +RESOURCE TBUF r_qtn_sniffer_wait_connecting_user_conn + { + buf = qtn_sniffer_wait_connecting_user_conn; + } + +//----------------------------------------------------------------------------- + +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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/group/mainapplication.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/group/mainapplication.mmp Thu Dec 17 09:20:28 2009 +0200 @@ -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 + + +// 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfactivetimerhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfactivetimerhandler.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfactivetimeupdater.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfactivetimeupdater.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfactivewaiter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfactivewaiter.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfapplication.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfapplication.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfappui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfappui.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailscontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailscontroller.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailscontroller.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailscontroller.inl Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailsdialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailsdialog.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,137 @@ +/* +* 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 ); + + 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailsmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailsmodel.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfdetailscontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailscontainer.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfdetailscontainerif.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailscontainerif.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsview.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewcontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewcontroller.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewcontrollerif.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewcontrollerif.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewcontrollerpartner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewcontrollerpartner.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewmodel.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 speed to string + * @since S60 v5.0 + * @return formated string + */ + HBufC* FormatSpeedLC(); + + /** + * 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewpartner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewpartner.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfdocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfdocument.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfdocument.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfdocument.inl Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfmainapplication.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmainapplication.hrh Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfmaincontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmaincontroller.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,318 @@ +/* +* 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" + + + +// 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 + * @param aAccesspointName The name of the active connection + */ + void WlanConnectionActivatedL( const TDesC& aAccessPointName ); + + /** + * 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 ); + + 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfmainuiobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmainuiobserver.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfmainview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmainview.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,200 @@ +/* +* 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(); + + private: + + /** + * Check if the Browser application is already running and + * using the selected connection. + * @since S60 5.0 + * @return EFalse if Start Web Browsing menu item should be shown + * ETrue if Start Web Browsing menu item should not be shown + */ + TBool StartWebBrowsingVisibleL(); + + 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; + }; + + +#endif // C_WSFMAINVIEW_H diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontainer.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,318 @@ +/* +* 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 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 ); + + /** + * 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 ); + + /** + * 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 ); + + 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 CWsfMainViewContainer::DoConnectingAnimationStepL( + TAny* ptr ); + + /** + * Steps the connecting animation + */ + void CWsfMainViewContainer::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; + + }; + + + +#endif // C_WSFMAINVIEWCONTAINER_H + +// End of file diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontroller.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,158 @@ +/* +* 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 ); + + /** + * 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontrollerif.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontrollerif.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 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; + + /** + * 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontrollerpartner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontrollerpartner.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewinternals.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewinternals.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewmodel.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,191 @@ +/* +* 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. + * @return Formatted WLAN list + */ + CDesCArrayFlat* 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewpartner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewpartner.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/loc/wsfmainapplication.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/loc/wsfmainapplication.loc Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,429 @@ +/* +* 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:During connection creation a wait note Connecting via... is shown +//l:popup_note_wait_window +//r:3.0 +// +#define qtn_sniffer_wait_connecting "Connecting via '%U'" + +//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:" + + +//d:During connection creation the wait note is shown while +//d:connecting to an IAP if WLAN usage option is selected as Forced +//l:popup_note_wait_window +//r:5.0.1 +// +#define qtn_sniffer_wait_connecting_user_conn "Connecting. All applications will use this connection" + + + + +//------------------------------------------------------------------------------ +// 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/rom/wsfmainapplication.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/rom/wsfmainapplication.iby Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/rom/wsfmainapplicationresources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/rom/wsfmainapplicationresources.iby Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/src/wsfactivetimeupdater.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfactivetimeupdater.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/src/wsfactivewaiter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfactivewaiter.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/src/wsfapplication.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfapplication.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/src/wsfappui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfappui.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,542 @@ +/* +* 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 "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( *CEikonEnv::Static() ); + 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::HandleCommandL +// --------------------------------------------------------------------------- +// +void CWsfAppUi::HandleForegroundEventL( TBool aForeground ) + { + LOG_ENTERFN( "CWsfAppUi::HandleForegroundEventL" ); + //Application switched to foreground. + if ( aForeground ) + { + 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" ); + HBufC* infoText = StringLoader::LoadLC( + R_QTN_WLAN_INFO_NO_NETWORKS_FOUND ); + CAknInformationNote* infoNote = new (ELeave) CAknInformationNote( ETrue ); + infoNote->ExecuteLD( *infoText ); + CleanupStack::PopAndDestroy( infoText ); + } + + +// --------------------------------------------------------------------------- +// 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/src/wsfconnecteddetailscontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfconnecteddetailscontroller.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/src/wsfconnecteddetailsdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfconnecteddetailsdialog.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,183 @@ +/* +* 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) +// Time item's place in the listbox. +LOCAL_D const TInt KActiveTimeItem = 1; +// Transferred data item's place in the listbox. +LOCAL_D const TInt KTransferredAmountItem = 2; + + +// ================= 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() ) + { + iList->Reset(); + iModel->SetItemTextArray( aItemTextArray ); + iModel->SetOwnershipType( ELbmDoesNotOwnItemArray ); + // draw updated items + iList->DrawItem( KActiveTimeItem ); + iList->DrawItem( KTransferredAmountItem ); + + DrawNow(); + } + } + +// --------------------------------------------------------- +// CWsfConnectedDetailsContainer::Controller +// --------------------------------------------------------- +// +MWsfDetailsViewControllerIf& CWsfConnectedDetailsDialog::Controller() + { + return iController; + } + +// End of File + diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/src/wsfconnecteddetailsmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfconnecteddetailsmodel.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/src/wsfdetailscontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfdetailscontainer.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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; + 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/src/wsfdetailsview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfdetailsview.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/src/wsfdetailsviewcontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfdetailsviewcontroller.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,243 @@ +/* +* 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(); + 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/src/wsfdetailsviewmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfdetailsviewmodel.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,692 @@ +/* +* 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 + +// 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(); + + // If Wlan if suppilied && arrays has items + if ( aWlanInfo && VisibleWlans( *iWlanArray ) ) + { + iWlanInfo = *aWlanInfo; + TWsfWlanInfo* temp = iWlanArray->Match( aWlanInfo->iSsid, + VisibleWlans( *iWlanArray ) ); + 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 ); + + if( iIndex < VisibleWlans( *iWlanArray ) - 1 ) + { + iFormattedWlanInfo->Reset(); + iIndex++; + + if( iIndex >= VisibleWlans( *iWlanArray ) -1 ) + { + iIndex = VisibleWlans( *iWlanArray ) -1; + } + else if ( iWlanInfo.SignalStrength() == ENoSignal ) + { + iIndex = 0; + } + + 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; + } + + 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 + { + if( VisibleWlans( *iWlanArray ) ) + { + paneText = HBufC::NewLC( KPaneFormater().Length() + + KNumberLegth + + KNumberLegth ); + + TPtr paneTextPrt = paneText->Des(); + + // Format string ( KListItemFormat = %i/%i ) + paneTextPrt.Format( KPaneFormater, + iIndex + 1, + ( iWlanArray ) ? + VisibleWlans( *iWlanArray ) : 0 ); + } + 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 ); + TUint 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 = FormatSpeedLC(); + 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::FormatSpeedLC +// --------------------------------------------------------------------------- +// +HBufC* CWsfDetailsViewModel::FormatSpeedLC() + { + LOG_ENTERFN( "CWsfDetailsViewModel::FormatSpeedLC" ); + //if data rate is allowed to be a fraction, + //rewrite this format string + _LIT( KRateFmt, "%d" ); + + const TInt KMaxRateStringWidth = 8; + TBuf rate; + rate.Format( KRateFmt, iWlanInfo.iTransferRate ); + + return StringLoader::LoadLC( R_QTN_SNIFFER_WLAN_MAX_DATA_RATE, + rate, iCoeEnv ); + } + +// --------------------------------------------------------------------------- +// CWsfDetailsViewModel::VisibleWlans +// --------------------------------------------------------------------------- +// +TInt CWsfDetailsViewModel::VisibleWlans( CWsfWlanInfoArray& aArray ) + { + LOG_ENTERFN( "CWsfDetailsViewModel::VisibleWlans" ); + TInt i = 0; + TBool hiddenFound = EFalse; + TWsfWlanInfo* wlanInfo; + LOG_WRITEF( "Number of Wlans: %d", aArray.Count() ); + while ( i < aArray.Count() && !hiddenFound ) + { + wlanInfo = aArray[i]; + if ( wlanInfo->Hidden() && !wlanInfo->Known() ) + { + hiddenFound = ETrue; + } + else + { + ++i; + } + } + + LOG_WRITEF( "VisibleWlans: %d", aArray.Count() ); + return i; + } + +// END OF FILE + diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/src/wsfdocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfdocument.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/src/wsfentrypoint.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfentrypoint.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/src/wsfmaincontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfmaincontroller.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,903 @@ +/* +* 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 ); + 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() ) + { + iModel->SetRefreshState( EFalse ); + if ( iAppUi ) + { + iAppUi->HideWaitNoteL(); + iInfoArray = iModel->GetWlanListL(); + if ( !iInfoArray->Count() ) + { + iAppUi->ShowNoWlansFoundInfoL(); + } + UpdateViewL(); + } + } + } + +// --------------------------------------------------------------------------- +// 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( + const TDesC& aAccessPointName ) + { + 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 for aAccessPointName + // mark it connected - sort the array and refresh + TBuf8 ssid; + CnvUtfConverter::ConvertFromUnicodeToUtf8( ssid, aAccessPointName ); + + TWsfWlanInfo* temp = iInfoArray->Match( ssid, iInfoArray->Count() ); + if ( temp ) + { + temp->iConnectionState = EConnected; + 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 = ENotConnected; + 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 ); + return; + } + + TInt result( KErrNone ); + + if ( !info.Known() && !info.Connected() ) + { + // if not known yet, create an IAP + if ( iModel->CreateAccessPointL( info, EFalse ) ) + { + // update iapID to list + TWsfWlanInfo* temp = iInfoArray->Match( info.iSsid, + iInfoArray->Count() ); + if ( temp && !info.Hidden() ) + { + LOG_WRITE( "Info found" ); + temp->iIapId = info.iIapId; + } + else + { + LOG_WRITE( "Info not found" ); + TWsfWlanInfo* createdInfo = new (ELeave) TWsfWlanInfo( info ); + createdInfo->iVisibility = ETrue; + createdInfo->iStrengthLevel = EWlanSignalStrengthMax; + iInfoArray->AppendL( createdInfo ); + } + // on success, test it and save it as well + result = iModel->TestAccessPointL( info, ETrue, EFalse ); + } + else + { + result = KErrGeneral; + } + } + else if ( info.iIapId && !info.Connected() ) + { + // hopefully we have a valid IAP id inside + result = iModel->ConnectL( info.iIapId ); + } + + // 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 ); + } + + const TInt KBrowserUid = 0x10008D39; + TUid id( TUid::Uid( KBrowserUid ) ); + TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); + TApaTask task = taskList.FindApp( id ); + + // Check if the Browser application is already running. + if ( task.Exists() ) + { + HBufC* queryText = StringLoader::LoadLC( + R_QTN_SNIFFER_QUEST_RESTART_BROWSING_WITH_WLAN ); + + CAknQueryDialog* dlg = CAknQueryDialog::NewL(); + TInt ret = dlg->ExecuteLD( + R_RESTART_BROWSING_CONFIRMATION_QUERY, + *queryText ); + + CleanupStack::PopAndDestroy( queryText ); + + if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) ) + { + // User Press OK or Yes and launch the browser + iModel->LaunchBrowserL( passedIap ); + } + else + { + // clean up the temporary IAP if any + iModel->CleanUpCancelledLaunchL(); + + // if we are here then we can disconnect + // and iModel->DisconnectL() handles view refreshing + iModel->DisconnectL(); + } + } + else + { + // finally 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 ); + return; + } + + if ( !info.Known() ) + { + // a new access point needs to be created + if ( iModel->CreateAccessPointL( info, EFalse ) ) + { + // update iapID to list + TWsfWlanInfo* temp = iInfoArray->Match( info.iSsid, + iInfoArray->Count() ); + if ( temp && !info.Hidden() ) + { + LOG_WRITE( "Info found" ); + temp->iIapId = info.iIapId; + + if ( info.iNetworkName.Length() ) + { + // Replace ssid as well since scanner does this same thing + temp->iSsid.Copy( info.iNetworkName ); + } + } + else + { + LOG_WRITE( "Info not found" ); + TWsfWlanInfo* createdInfo = new (ELeave) TWsfWlanInfo( info ); + createdInfo->iVisibility = ETrue; + createdInfo->iStrengthLevel = EWlanSignalStrengthMax; + iInfoArray->AppendL( createdInfo ); + } + + // on success, test it and save it as well + // (testing actually creates the connection) + if ( iModel->TestAccessPointL( info, ETrue, ETrue ) == KErrCancel ) + { + // connection creation was cancelled, refresh the view + iModel->RefreshScanL(); + } + } + } + else if ( info.iIapId ) + { + // hopefully we have a valid IAP id inside + iModel->ConnectL( info.iIapId ); + } + + // pop cleanup item ReleaseSuppressingKeyEvents + CleanupStack::Pop(); + iAppUi->SetSuppressingKeyEvents( EFalse ); + + } + +// --------------------------------------------------------------------------- +// 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 ); + 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; + iInfoArray->SortArrayL(); + UpdateViewL( iInfoArray ); + 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() ); + } + +// End of file diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/src/wsfmainview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfmainview.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,490 @@ +/* +* 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 "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() + { + // 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: + { + 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() ); + // 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 ) + { + iController.UpdateSelectedItemL(); + + if ( aResourceId == R_SNIFFER_MENU ) + { + LOG_ENTERFN( "CWsfMainView::DynInitMenuPaneL" ); + const CWsfDocument* doc = static_cast( + AppUi()->Document() ); + TBool blacklistEmpty( !doc->WlanInfoBranding().BlackListItemCount() ); + TWsfWlanInfo *selectedItem = iController.SelectedItem(); + CWsfWlanInfoArray *infoArray = iModel->GetInfoArray(); + + CWsfAppUi* appui = static_cast( AppUi() ); + TBool connecting( appui->SuppressingKeyEvents() ); + + 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 ); + aMenuPane->SetItemDimmed( ESnifferCmdFilterWlans, + connecting || !infoArray || blacklistEmpty ); + aMenuPane->SetItemDimmed( ESnifferCmdDetails, ETrue ); + aMenuPane->SetItemDimmed( ESnifferCmdSettings, connecting ); + return; + } + + TBool connectedAndUsed( StartWebBrowsingVisibleL() ); + TBool connected( selectedItem->Connected() ); + TBool known( selectedItem->Known() ); + + TBool selectedItemConnecting ( + selectedItem->ConnectionStatus() == EConnecting ); + + 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 no scan has been performed + // or there is nothing to filter + 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 ) + { + TWsfWlanInfo *selectedItem = iController.SelectedItem(); + + // there must be always at least one item: "Other (unlisted)..." + TBool connectedAndUsed( StartWebBrowsingVisibleL() ); + TBool connected( EFalse ); + TBool known( EFalse ); + TBool hidden( ETrue ); + + CWsfAppUi* appui = static_cast( AppUi() ); + TBool connecting( appui->SuppressingKeyEvents() ); + 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(); + known = selectedItem->Known(); + hidden = selectedItem->Hidden(); + selectedItemConnecting = + ( selectedItem->ConnectionStatus() == EConnecting ); + } + + 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 ) + { + switch ( aEventType ) + { + case EEventEnterKeyPressed: + case EEventItemSingleClicked: + { + HandleCommandL( EAknSoftkeyContextOptions ); + } + break; + default: + break; + } + } + + +// --------------------------------------------------------------------------- +// CWsfMainView::SelectionKeyPressed +// --------------------------------------------------------------------------- +// +void CWsfMainView::SelectionKeyPressed() + { + iSelectionKey = ETrue; + } + + +// --------------------------------------------------------------------------- +// CWsfMainView::StartWebBrowsingVisibleL +// --------------------------------------------------------------------------- +// +TBool CWsfMainView::StartWebBrowsingVisibleL() + { + LOG_ENTERFN( "CWsfMainView::StartWebBrowsingVisibleL" ); + 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 ); + TBool isBrowserRuning( EFalse ); + +#ifndef __WINS__ + + if ( task.Exists() ) + { + LOG_WRITE( "The Browser is running." ); + // The Browser is already running. + // Check if the selected WLAN is connected. + TWsfWlanInfo* selectedItem = iController.SelectedItem(); + TBool connected( EFalse ); + if( selectedItem ) + { + connected = selectedItem->Connected(); + } + LOG_WRITEF("Selected network 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() ); + + TUint i; + for ( 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 ) + { + isBrowserRuning = ETrue; + } + } + CleanupStack::PopAndDestroy( waiter ); + appSess.Close(); + connectionMonitor.Close(); + } + } + else + { + LOG_WRITE( "No Browser running." ); + } + +#endif // __WINS__ + + LOG_WRITEF( "isBrowserRuning: %d", isBrowserRuning ); + return isBrowserRuning; + } + + + +// End of file diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/src/wsfmainviewcontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfmainviewcontainer.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,803 @@ +/* +* 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 + +#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 ) + { + LOG_ENTERFN( "CWsfMainViewContainer::NewL" ); + CWsfMainViewContainer* self = CWsfMainViewContainer::NewLC( aRect ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------- +// CWsfMainViewContainer::NewLC +// --------------------------------------------------------- +// +CWsfMainViewContainer* CWsfMainViewContainer::NewLC( const TRect& aRect ) + { + LOG_ENTERFN( "CWsfMainViewContainer::NewLC" ); + CWsfMainViewContainer* self = new( ELeave ) CWsfMainViewContainer; + CleanupStack::PushL( self ); + self->ConstructL( aRect ); + 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 ) + { + LOG_ENTERFN( "CWsfMainViewContainer::ConstructL" ); + CreateWindowL(); + + 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() ) + { + TUint 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); + } + 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/src/wsfmainviewcontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfmainviewcontroller.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,222 @@ +/* +* 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 + CDesCArray* formattedList = iModel->FormatWlanListL( aWlanList ); + + 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::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 = 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/mainapplication/src/wsfmainviewmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfmainviewmodel.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,378 @@ +/* +* 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 +// --------------------------------------------------------------------------- +// +CDesCArrayFlat* 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 ); + return iFormattedWlanList; + } + +// --------------------------------------------------------------------------- +// 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/model/bwins/wsfmodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/bwins/wsfmodelu.def Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,38 @@ +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) + ?SetRefreshState@CWsfModel@@QAEXH@Z @ 7 NONAME ; void CWsfModel::SetRefreshState(int) + ?SetEngineObserver@CWsfModel@@QAEXPAVMWsfModelObserver@@@Z @ 8 NONAME ; void CWsfModel::SetEngineObserver(class MWsfModelObserver *) + ?ConnectL@CWsfModel@@QAEHK@Z @ 9 NONAME ; int CWsfModel::ConnectL(unsigned long) + ?SetActiveViewL@CWsfModel@@QAEXH@Z @ 10 NONAME ; void CWsfModel::SetActiveViewL(int) + ?NewLC@CWsfModel@@SAPAV1@AAVMWsfStateChangeObserver@@H@Z @ 11 NONAME ; class CWsfModel * CWsfModel::NewLC(class MWsfStateChangeObserver &, int) + ?IsScanEnabledL@CWsfModel@@QAEHXZ @ 12 NONAME ; int CWsfModel::IsScanEnabledL(void) + ?AbortScanningL@CWsfModel@@QAEXXZ @ 13 NONAME ; void CWsfModel::AbortScanningL(void) + ?TestAccessPointL@CWsfModel@@QAEHAAVTWsfWlanInfo@@HH@Z @ 14 NONAME ; int CWsfModel::TestAccessPointL(class TWsfWlanInfo &, int, int) + ?CancelNotifyEvents@CWsfModel@@QAEXXZ @ 15 NONAME ; void CWsfModel::CancelNotifyEvents(void) + ??1CWsfModel@@UAE@XZ @ 16 NONAME ; CWsfModel::~CWsfModel(void) + ?CleanUpCancelledLaunchL@CWsfModel@@QAEXXZ @ 17 NONAME ; void CWsfModel::CleanUpCancelledLaunchL(void) + ?LaunchHelperApplicationL@CWsfModel@@QAEXAAVTWsfWlanInfo@@HH@Z @ 18 NONAME ; void CWsfModel::LaunchHelperApplicationL(class TWsfWlanInfo &, int, int) + ?DisableScanL@CWsfModel@@QAEHXZ @ 19 NONAME ; int CWsfModel::DisableScanL(void) + ?GetWlanListL@CWsfModel@@QAEPAVCWsfWlanInfoArray@@XZ @ 20 NONAME ; class CWsfWlanInfoArray * CWsfModel::GetWlanListL(void) + ?GetConnectedWlanDetailsL@CWsfModel@@QAEHAAVTWsfWlanInfo@@@Z @ 21 NONAME ; int CWsfModel::GetConnectedWlanDetailsL(class TWsfWlanInfo &) + ?NewL@CWsfModel@@SAPAV1@AAVMWsfStateChangeObserver@@H@Z @ 22 NONAME ; class CWsfModel * CWsfModel::NewL(class MWsfStateChangeObserver &, int) + ?Refreshing@CWsfModel@@QAEHXZ @ 23 NONAME ; int CWsfModel::Refreshing(void) + ?ContinueBrowsingL@CWsfModel@@QAEXK@Z @ 24 NONAME ; void CWsfModel::ContinueBrowsingL(unsigned long) + ?IctsTestPermission@CWsfModel@@SAHXZ @ 25 NONAME ; int CWsfModel::IctsTestPermission(void) + ?DisconnectL@CWsfModel@@QAEXXZ @ 26 NONAME ; void CWsfModel::DisconnectL(void) + ?IsConnectedL@CWsfModel@@QAEHXZ @ 27 NONAME ; int CWsfModel::IsConnectedL(void) + ?CreateAccessPointL@CWsfModel@@QAEHAAVTWsfWlanInfo@@H@Z @ 28 NONAME ; int CWsfModel::CreateAccessPointL(class TWsfWlanInfo &, int) + ?NewLC@CWsfAppLauncher@@SAPAV1@XZ @ 29 NONAME ; class CWsfAppLauncher * CWsfAppLauncher::NewLC(void) + ?RequestNotifyEventsL@CWsfModel@@QAEXAAVMWsfStateChangeObserver@@@Z @ 30 NONAME ; void CWsfModel::RequestNotifyEventsL(class MWsfStateChangeObserver &) + ?LaunchBrowserL@CWsfModel@@UAEXK@Z @ 31 NONAME ; void CWsfModel::LaunchBrowserL(unsigned long) + ?RefreshScanL@CWsfModel@@QAEHXZ @ 32 NONAME ; int CWsfModel::RefreshScanL(void) + ?SetObservedWlanL@CWsfModel@@QAEXABVTDesC8@@@Z @ 33 NONAME ; void CWsfModel::SetObservedWlanL(class TDesC8 const &) + ?TestConnectedAccessPointL@CWsfModel@@QAEHAAVTWsfWlanInfo@@H@Z @ 34 NONAME ; int CWsfModel::TestConnectedAccessPointL(class TWsfWlanInfo &, int) + ?FinalizeConnectL@CWsfModel@@QAEXXZ @ 35 NONAME ; void CWsfModel::FinalizeConnectL(void) + ?ConnectWithoutConnWaiterL@CWsfModel@@QAEHKH@Z @ 36 NONAME ; int CWsfModel::ConnectWithoutConnWaiterL(unsigned long, int) + diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/model/eabi/wsfmodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/eabi/wsfmodelu.def Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,41 @@ +EXPORTS + _ZN15CWsfAppLauncher4NewLEv @ 1 NONAME + _ZN15CWsfAppLauncher5NewLCEv @ 2 NONAME + _ZN9CWsfModel10RefreshingEv @ 3 NONAME + _ZN9CWsfModel11ActiveViewLEv @ 4 NONAME + _ZN9CWsfModel11DisconnectLEv @ 5 NONAME + _ZN9CWsfModel11EnableScanLEv @ 6 NONAME + _ZN9CWsfModel12DisableScanLEv @ 7 NONAME + _ZN9CWsfModel12GetWlanListLEv @ 8 NONAME + _ZN9CWsfModel12IsConnectedLEv @ 9 NONAME + _ZN9CWsfModel12ObservedWlanEv @ 10 NONAME + _ZN9CWsfModel12RefreshScanLEv @ 11 NONAME + _ZN9CWsfModel14AbortScanningLEv @ 12 NONAME + _ZN9CWsfModel14IsScanEnabledLEv @ 13 NONAME + _ZN9CWsfModel14LaunchBrowserLEm @ 14 NONAME + _ZN9CWsfModel14SetActiveViewLEi @ 15 NONAME + _ZN9CWsfModel15SetRefreshStateEi @ 16 NONAME + _ZN9CWsfModel16AbortConnectingLEv @ 17 NONAME + _ZN9CWsfModel16FinalizeConnectLEv @ 18 NONAME + _ZN9CWsfModel16SetObservedWlanLERK6TDesC8 @ 19 NONAME + _ZN9CWsfModel16TestAccessPointLER12TWsfWlanInfoii @ 20 NONAME + _ZN9CWsfModel17ContinueBrowsingLEm @ 21 NONAME + _ZN9CWsfModel17ContinueBrowsingLEv @ 22 NONAME + _ZN9CWsfModel17SetEngineObserverEP17MWsfModelObserver @ 23 NONAME + _ZN9CWsfModel18CancelNotifyEventsEv @ 24 NONAME + _ZN9CWsfModel18CreateAccessPointLER12TWsfWlanInfoi @ 25 NONAME + _ZN9CWsfModel18IctsTestPermissionEv @ 26 NONAME + _ZN9CWsfModel20RequestNotifyEventsLER23MWsfStateChangeObserver @ 27 NONAME + _ZN9CWsfModel23CleanUpCancelledLaunchLEv @ 28 NONAME + _ZN9CWsfModel24GetConnectedWlanDetailsLER12TWsfWlanInfo @ 29 NONAME + _ZN9CWsfModel24LaunchHelperApplicationLER12TWsfWlanInfoii @ 30 NONAME + _ZN9CWsfModel25ConnectWithoutConnWaiterLEmi @ 31 NONAME + _ZN9CWsfModel25TestConnectedAccessPointLER12TWsfWlanInfoi @ 32 NONAME + _ZN9CWsfModel4NewLER23MWsfStateChangeObserveri @ 33 NONAME + _ZN9CWsfModel5NewLCER23MWsfStateChangeObserveri @ 34 NONAME + _ZN9CWsfModel8ConnectLEm @ 35 NONAME + _ZN9CWsfModelD0Ev @ 36 NONAME + _ZN9CWsfModelD1Ev @ 37 NONAME + _ZN9CWsfModelD2Ev @ 38 NONAME + _ZThn12_N9CWsfModel14LaunchBrowserLEm @ 39 NONAME + diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/model/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/model/group/model.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/group/model.mmp Thu Dec 17 09:20:28 2009 +0200 @@ -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: 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 ictsclientinterface.lib +LIBRARY sysutil.lib +LIBRARY efsrv.lib + +LIBRARY wsfwlaninfo.lib +LIBRARY wsfclient.lib +LIBRARY wsfapwizard.lib + +DEBUGLIBRARY flogger.lib + +// End of file diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/model/inc/wsfactivewaiter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/inc/wsfactivewaiter.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/model/inc/wsfapplauncher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/inc/wsfapplauncher.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,339 @@ +/* +* 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; +class CMDBSession; + + +/** +* 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 aWapId WAP id passed as a parameter + * @param aURL User defined WWW address to be used as start-up page + */ + void LaunchBrowserL( MWsfBrowserLaunchObserver& aObserver, + TUint aIapId, + TUint aWapId, + 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 ); + + /** + * Gets the access point selection mode + * @since S60 5.0 + * @return 0=User defined, 1=Always ask, 2=Destination + */ + TInt ApSelectionMode(); + + /** + * Defines the access point selection mode + * @since S60 5.0 + * @param aEnable Selection mode: 0=User defined, 1=Always ask, + * 2=Destination + */ + void SetApSelectionMode( TInt aApSelectionMode ); + + /** + * Restores Access Point selection mode + * @since S60 5.0 + */ + void RestoreApSelectionMode(); + + /** + * Configures browser access point using central repository + * @since S60 5.0 + * @param aAccessPointId Access Point's IAP id + */ + void SetAccessPoint( TUint aAccessPointId ); + + /* + * Restores original accesspoint id if one is set + * @since S60 5.0 + */ + void RestoreAccessPoint(); + + + 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; + + /** + * WAP id for browser's default connection id + */ + TUint iWapId; + + /** + * State of browser launching + */ + TWsfLaunchState iLaunchState; + + /** + * Stored original selection mode + */ + TBool iRestoreSelectionMode; + + /** + * Indicates whether to restore access point + */ + TBool iRestoreAccessPoint; + + /** + * The original IAP id used by the browser + */ + TUint iOriginalApId; + + /** + * 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; + + /** + * Indicates which AP selection mode was originally used. + */ + TUint iOriginalApSelectionMode; + + /** + * 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/model/inc/wsfbrowserlaunchadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/inc/wsfbrowserlaunchadapter.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/model/inc/wsfbrowserlaunchobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/inc/wsfbrowserlaunchobserver.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/model/inc/wsfmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/inc/wsfmodel.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,534 @@ +/* +* 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 +#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 MIctsObserver + { + 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(); + + /** + * 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. + */ + IMPORT_C int ConnectL( TUint32 aIapId ); + + /** + * Connects to the given WLAN IAP + * @since S60 5.2 + * @param aIapId WLAN IAP id to connect to. + */ + IMPORT_C int ConnectWithoutConnWaiterL( TUint32 aIapId, + TBool aTestedAccessPoint ); + /** + * Starts auto-disconnect timer for connected network + * @since S60 5.2 + */ + IMPORT_C void FinalizeConnectL(); + + /** + * Disconnects WLAN + * @since S60 5.0 + */ + IMPORT_C void DisconnectL(); + + /** + * 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 ); + + /** + * Tests the WLAN access point and offers to save it to a destination + * @since S60 5.0 + * @param aWlan Reference to wlaninfo to test + * @param aKeepConnection Indicates whether to keep alive the connection. + * @param aConnectOnly ETrue if the helper app is expected to connect + * only, EFalse if it should also launch the browser + * on successful connection. + * @return KErrNone if successful, system-wide error code otherwise + */ + IMPORT_C TInt TestAccessPointL( TWsfWlanInfo& aWlan, + TBool aKeepConnection, + TBool aConnectOnly ); + + /** + * Tests the connected WLAN access point + * @since S60 5.0 + * @param aWlan Reference to wlaninfo to test + * @param aConnectOnly ETrue if connect only case, + * EFalse if launch browser case after successful connection. + * @return KErrNone if successful, system-wide error code otherwise + */ + IMPORT_C TInt TestConnectedAccessPointL( TWsfWlanInfo& aWlan, + TBool aConnectOnly ); + + /** + * Requests a rescan for available wlans + * @since S60 5.0 + * @return ETrue on success + */ + IMPORT_C TBool RefreshScanL(); + + /** + * Launches and helper application to create an accesspoint + * @since S60 5.0 + * @param aWlanInfo The WlanInfo object to be passed to the helper app + * @param aConnecting ETrue if default connection is used, EFalse otherwise. + * @param aConnectOnly ETrue if the helper app is expected to connect + * only, EFalse if it should also launch the browser + * on successful connection. + */ + IMPORT_C void LaunchHelperApplicationL( TWsfWlanInfo& aWlanInfo, + TBool aConnecting, + TBool aConnectOnly ); + + /** + * 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 ); + + /** + * 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(); + + /** + * Gets the ICTS test permission setting value + * @since S60 5.0 + * @return The ICTS setting + */ + IMPORT_C static TInt IctsTestPermission(); + + + + 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 ); + + + /** + * Cleans up the possibly temporary IAP after user cancelled + * the browser launch + * @since S60 5.0 + */ + IMPORT_C void CleanUpCancelledLaunchL(); + + + 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 ); + + + public: // from MIctsObserver + + /** + * Called by ICTS during/after connectivity test + * @since S60 5.0 + * @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 ); + + /** + * Makes the temporary IAP created for ICT persistent, i.e. notifies + * the server not to delete it when the connection terminates. + * @since S60 5.0 + * @param aPersistence The persistence property for the IAP + */ + void MakeIctIapPersistentL( TWsfIapPersistence aPersistence ); + + /** + * Moves the IAP to internet SNAP + * @param aIapId Id of the connection method + */ + void MoveToInternetSnapL( const TUint32 aIapId ); + + /** + * 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; + + /** + * Network id of currently connected IAP (if applicable) + */ + TUint iConnectedNetId; + + /** + * Refreshing status + */ + TBool iRefreshing; + + /** + * Persistent WlanInfo for ICT cleanup + */ + TWsfWlanInfo iIctWlanInfo; + + /** + * Indicates whether connection creation has been started but not + * finished yet. + */ + TBool iConnecting; + + /** + * Waiter for ICT + */ + CActiveSchedulerWait iIctWait; + + /** + * Indicates that connectivity test if over. + */ + TBool iIctEnded; + + /** + * Indicates if connection will be kept when launching browser. + */ + TBool iKeepConnection; + + /** + * Indicates if "Connect" or "Start Web browsing" is selected. + */ + TBool iConnectOnly; + + }; + + +#include "wsfmodel.inl" + + + +#endif // C_WSFMODEL_H + +// End of file diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/model/inc/wsfmodel.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/inc/wsfmodel.inl Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/model/inc/wsfmodelobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/inc/wsfmodelobserver.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/model/inc/wsfscreensaverstateobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/inc/wsfscreensaverstateobserver.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/model/inc/wsfscreensaverwatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/inc/wsfscreensaverwatcher.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/model/rom/wsfmodel.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/rom/wsfmodel.iby Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/model/src/wsfactivewaiter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/src/wsfactivewaiter.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/model/src/wsfapplauncher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/src/wsfapplauncher.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,637 @@ +/* +* 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 +#include +#include +#include +#include + +// CLASS HEADER +#include "wsfapplauncher.h" + +// INTERNAL INCLUDES +#include "wsfbrowserlaunchobserver.h" +#include "wsflogger.h" +#include "wsfactivewaiter.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::EPriorityLow ), + iIapId( 0 ), + iWapId( 0 ), + iLaunchState( EIdle ), + iRestoreSelectionMode( EFalse ), + iRestoreAccessPoint( EFalse ), + 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, + TUint aWapId, + const TDesC& aURL ) + { + LOG_ENTERFN( "CWsfAppLauncher::LaunchBrowserL_3" ); + Cancel(); + SetAccessPoint( aWapId ); + LOG_WRITE( "CWsfAppLauncher::LaunchBrowserL_3 -->> afer cancel" ); + iObserver = &aObserver; + iIapId = aIapId; + iWapId = aWapId; + 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" ); + + // Browser uses WAP id instead of IAP id so + // we need to pass wap id to browser + TUint wapId = plugin.GetIntAttributeL( CMManager::ECmWapId ); + LOG_WRITEF( "CWsfAppLauncher::LaunchBrowserL_2 -->> ECmWapId %d", wapId ); + + // 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 ); + } + + if ( ApSelectionMode() !=0 ) + { + // Set AP selection mode to user defined + LOG_WRITE( "CWsfAppLauncher::LaunchBrowserL_2 -->> ap selection mode" ); + SetApSelectionMode( 0 ); + iRestoreSelectionMode = ETrue; + } + LOG_WRITE( "CWsfAppLauncher::LaunchBrowserL_2 -->> before setAP" ); + SetAccessPoint( wapId ); + + LaunchBrowserL( aObserver, aIapId, wapId, *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 %d" ); + 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, iWapId ); + } + + 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::ApSelectionModeL +// --------------------------------------------------------------------------- +// +TInt CWsfAppLauncher::ApSelectionMode() + { + LOG_ENTERFN( "CWsfAppLauncher::ApSelectionMode" ); + TInt currentState = 0; + iRepository->Get( KBrowserAccessPointSelectionMode, currentState ); + return currentState; + } + + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::SetApSelectionModeL +// --------------------------------------------------------------------------- +// +void CWsfAppLauncher::SetApSelectionMode( TInt aApSelectionMode ) + { + LOG_ENTERFN( "CWsfAppLauncher::SetApSelectionMode" ); + // Valid values: 0 = User Defined, 1 = Always Ask, 2=Destination + if ( !iRestoreSelectionMode ) + { + //Store original setting + TInt OriginalApSelectionMode = 0; + iRepository->Get( KBrowserAccessPointSelectionMode, + OriginalApSelectionMode ); + iOriginalApSelectionMode = OriginalApSelectionMode; + } + iRepository->Set( KBrowserAccessPointSelectionMode, aApSelectionMode ); + } + + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::RestoreApSelectionMode +// --------------------------------------------------------------------------- +// +void CWsfAppLauncher::RestoreApSelectionMode() + { + LOG_ENTERFN( "CWsfAppLauncher::RestoreApSelectionMode" ); + if ( iRestoreSelectionMode ) + { + SetApSelectionMode( iOriginalApSelectionMode ); + iRestoreSelectionMode = EFalse; + } + } + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::SetAccessPoint +// --------------------------------------------------------------------------- +// +void CWsfAppLauncher::SetAccessPoint( TUint aAccessPointId ) + { + LOG_ENTERFN( "CWsfAppLauncher::SetAccessPoint" ); + LOG_WRITEF( "aAccessPointId %d", aAccessPointId ); + CRepository* repository( iRepository ); + TUint defaultAccessPointUid = KBrowserDefaultAccessPoint; + + if ( !iRestoreAccessPoint ) + { + // Store Access point so it can be restored after the launch + TInt id( 0 ); + TInt err = repository->Get( defaultAccessPointUid, id ); + if ( err != KErrNotFound ) + { + iOriginalApId = (TUint)id; + iRestoreAccessPoint = ETrue; + } + } + + repository->Set( defaultAccessPointUid, (TInt)aAccessPointId ); + repository = NULL; + } + + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::RestoreAccessPoint +// --------------------------------------------------------------------------- +// +void CWsfAppLauncher::RestoreAccessPoint() + { + LOG_ENTERFN( "CWsfAppLauncher::RestoreAccessPoint" ); + if ( iRestoreAccessPoint ) + { + SetAccessPoint( iOriginalApId ); + iRestoreAccessPoint = EFalse; + } + } + + +// --------------------------------------------------------------------------- +// CWsfAppLauncher::DoCancel +// --------------------------------------------------------------------------- +// +void CWsfAppLauncher::DoCancel() + { + LOG_ENTERFN( "CWsfAppLauncher::DoCancel" ); + iThread.LogonCancel( iStatus ); + + iThread.Close(); + iTimer.Cancel(); + RestoreApSelectionMode(); + RestoreAccessPoint(); + 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(); + RestoreAccessPoint(); + RestoreApSelectionMode(); + 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 + { + RestoreApSelectionMode(); + RestoreAccessPoint(); + iObserver->BrowserLaunchFailed( aError ); + break; + } + default: + { + _ASSERTD( EFalse ); + } + } + + iLaunchState = EIdle; + return aError; + } + diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/model/src/wsfmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/src/wsfmodel.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,1130 @@ +/* +* 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 }; + +/** +* UID of Wlan Login application (hsbrowser) +* used when launching WLAN Login application +*/ +static const TInt KBrowserUid = { 0x2000AFCC }; + +/** +* 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() + { + iSession.CancelNotifyEvent(); + iSession.Close(); + delete iScreenSaverWatcher; + delete iArray; + delete iObservedWlan; + delete iBrowserLauncher; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::CWsfModel +// ---------------------------------------------------------------------------- +// +CWsfModel::CWsfModel(): + iEikEnv( CEikonEnv::Static() ), + iRefreshing( EFalse ), + iIctEnded( EFalse ), + iKeepConnection( EFalse ), + iConnectOnly( 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 ) + { + iObserver = aObserver; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::GetWlanListL +// ---------------------------------------------------------------------------- +// +EXPORT_C CWsfWlanInfoArray* CWsfModel::GetWlanListL() + { + LOG_ENTERFN( "CWsfModel::GetWlanListL" ); + iArray->Reset(); + iSession.UpdateWlanListL( iArray ); + return iArray; + } + + +// ---------------------------------------------------------------------------- +// 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 ) + { + LOG_ENTERFN( "CWsfModel::ConnectL" ); + + if ( iObserver ) + { + iObserver->ConnectingL( aIapId ); + } + + TInt err = iSession.ConnectWlanBearerL( aIapId, EIapPersistent ); + if ( err == KErrNone ) + { + iConnectedIapId = aIapId; + } + else + { + if ( iObserver ) + { + iObserver->BrowserLaunchFailed( err ); + } + } + + if ( iObserver ) + { + iObserver->ConnectingFinishedL( err ); + } + + TBool timerStarted( EFalse ); + timerStarted = iSession.ControlDisconnectTimerL( + EAdcStartTimer | EAdcTimerReset ); + + if ( !timerStarted ) + { + LOG_WRITE( "auto-disconnect timer couldn't be started!" ); + } + + + iRefreshing = iSession.RequestScanL(); + + return err; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::ConnectWithoutConnWaiterL +// ---------------------------------------------------------------------------- +// +EXPORT_C int CWsfModel::ConnectWithoutConnWaiterL( TUint32 aIapId, + TBool aTestedAccessPoint ) + { + LOG_ENTERFN( "CWsfModel::ConnectWithoutConnWaiterL" ); + + if ( iObserver ) + { + iObserver->ConnectingL( aIapId ); + } + if ( aTestedAccessPoint ) + { + return iSession.ConnectWlanBearerWithoutConnWaiterL( aIapId, + EIapPersistent ); + } + else + { + return iSession.ConnectWlanBearerWithoutConnWaiterL( aIapId, + EIapExpireOnDisconnect ); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::FinalizeConnectL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::FinalizeConnectL() + { + LOG_ENTERFN( "CWsfModel::FinalizeConnectL" ); + + TBool timerStarted( EFalse ); + timerStarted = iSession.ControlDisconnectTimerL( + EAdcStartTimer | EAdcTimerReset ); + + if ( !timerStarted ) + { + LOG_WRITE( "auto-disconnect timer couldn't be started!" ); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::DisconnectL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::DisconnectL() + { + LOG_ENTERFN( "CWsfModel::DisconnectL" ); + iSession.DisconnectWlanBearerL(); + iConnectedIapId = 0; + iConnectedNetId = 0; + iConnectOnly = EFalse; + iRefreshing = iSession.RequestScanL(); + } + + +// ---------------------------------------------------------------------------- +// 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; + iSession.MonitorAccessPointL( aIapId ); + iSession.ControlDisconnectTimerL( EAdcStopTimer ); + iBrowserLauncher->LaunchBrowserL( *this, aIapId ); + } + else if ( iBrowserLauncher->BrowserIap() == aIapId ) + { + LOG_WRITE( "bringing browser to foreground..." ); + ContinueBrowsingL(); + } + + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::CleanUpCancelledLaunchL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::CleanUpCancelledLaunchL() + { + LOG_ENTERFN( "CWsfModel::CleanUpCancelledLaunchL" ); + iSession.SetIapPersistenceL( EIapForcedExpiry ); + } + + +// ---------------------------------------------------------------------------- +// 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::ConnectivityObserver +// ---------------------------------------------------------------------------- +// +void CWsfModel::ConnectivityObserver( TIctsTestResult aResult, + const TDesC& aString ) + { + LOG_ENTERFN( "CWsfModel::ConnectivityObserver" ); + LOG_WRITEF( "ICTS result: %d", aResult ); + + TBool makePersistent( EFalse ); + // check the result + switch ( aResult ) + { + case EConnectionOk: + { + // test succeeded + TRAP_IGNORE( MoveToInternetSnapL( iConnectedIapId ) ); + makePersistent = ETrue; + 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 ); + } + } + + if ( makePersistent ) + { + TWsfIapPersistence pt = ( iConnectedIapId )? + EIapPersistent: + EIapExpireOnShutdown; + + TRAPD( err, MakeIctIapPersistentL( pt ) ); + if ( err ) + { + LOG_WRITEF( "MakeIctIapPersistentL leaved with error = %d", err ); + } + } + + if ( iKeepConnection ) + { + // trigger the auto-disconnect timer as well + TBool timerStarted( EFalse ); + TRAP_IGNORE( timerStarted = iSession.ControlDisconnectTimerL( + EAdcStartTimer | EAdcTimerReset ) ); + + if ( !timerStarted ) + { + LOG_WRITE( "auto-disconnect timer couldn't be started!" ); + } + } + + LOG_WRITE( "before AsyncStop" ); + // finally stop blocking the caller + iIctEnded = ETrue; + if ( iIctWait.IsStarted() ) + { + LOG_WRITE( "ICT: AsyncStop" ); + iIctWait.AsyncStop(); + } + + + } + +// ----------------------------------------------------------------------------- +// CWsfModel::LaunchWlanLoginL() +// ----------------------------------------------------------------------------- +// +void CWsfModel::LaunchWlanLoginL( const TDesC& aString ) + { + LOG_ENTERFN( "WsfModel::LaunchWlanLoginL" ); + HBufC* param = HBufC::NewLC( KMaxFileName ); + _LIT(tmpString, "%d, %d, %S"); + param->Des().Format( tmpString, + iConnectedIapId, + iConnectedNetId, + &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( "WsfModel::LaunchWlanLoginL failed" ); + } + CleanupStack::PopAndDestroy( &appArcSession ); + CleanupStack::PopAndDestroy( param ); + } + +// ---------------------------------------------------------------------------- +// CWsfModel::MakeIctIapPersistentL +// ---------------------------------------------------------------------------- +// +void CWsfModel::MakeIctIapPersistentL( TWsfIapPersistence aPersistence ) + { + LOG_ENTERFN( "CWsfModel::MakeIctIapPersistentL" ); + LOG_WRITEF( "temp ICT IAP id = %d", iIctWlanInfo.iIapId ); + + if ( !iSession.SetIapPersistenceL( aPersistence ) ) + { + LOG_WRITE( "setting temporary flag FAILED" ); + } + + } + +// ---------------------------------------------------------------------------- +// CWsfModel::MoveToInternetSnapL +// ---------------------------------------------------------------------------- +// +void CWsfModel::MoveToInternetSnapL( const TUint32 aIapId ) + { + LOG_ENTERFN( "CWsfModel::MoveToInternetSnapL" ); + // Read all destination(SNAP) settings into an array + RArray destinations; + CleanupClosePushL(destinations); + RCmManagerExt cmManager; + cmManager.OpenL(); + CleanupClosePushL( cmManager ); + 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( &cmManager ); + CleanupStack::PopAndDestroy( &destinations ); + } + +// ---------------------------------------------------------------------------- +// 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 ); + +#pragma message("TODO: oursource UI to client interfaces!") + 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::IctsTestPermission +// ---------------------------------------------------------------------------- +// +EXPORT_C TInt CWsfModel::IctsTestPermission() + { + LOG_ENTERFN( "CWsfModel::IctsTestPermission" ); + TInt ictTestPermission( 0 ); + CRepository* repository( NULL ); + + TRAPD( err, repository = CRepository::NewL( + KCRUidInternetConnectivitySettings ) ); + if ( err == KErrNone ) + { + repository->Get( KIctsTestPermission, ictTestPermission ); + delete repository; + LOG_WRITEF( "ICT is set to %d", ictTestPermission ); + } + return ictTestPermission; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::TestAccessPointL +// ---------------------------------------------------------------------------- +// +EXPORT_C TInt CWsfModel::TestAccessPointL( TWsfWlanInfo& aWlan, + TBool aKeepConnection, + TBool aConnectOnly ) + { + LOG_ENTERFN( "CWsfModel::TestAccessPointL" ); + TInt err( KErrNone ); + iKeepConnection = aKeepConnection; + iConnectOnly = aConnectOnly; + if ( !aWlan.iIapId ) + { + // the wlaninfo must already contain a valid IAP id + LOG_WRITE( "invalid IAP id" ); + return KErrCorrupt; + } + + // the wlaninfo must be persistent to avoid nullpointer crashes due to + // background refreshing + iIctWlanInfo = aWlan; + + // create connection and test connectivity if needed + + // check ICT settings + TInt ictTestPermission( IctsTestPermission() ); + + + if ( aKeepConnection || ictTestPermission != EIctsNeverRun ) + { + // make connection if Connect was selected or if ICT needs it + LOG_WRITE( "creating connection..." ); + if ( iObserver ) + { + iObserver->ConnectingL( iIctWlanInfo.iIapId ); + } + + // create the connection with temporary IAP by default + err = iSession.ConnectWlanBearerL( iIctWlanInfo.iIapId, + EIapExpireOnDisconnect ); + + if ( err == KErrNone ) + { + LOG_WRITE( "connection OK." ) + } + else + { + LOG_WRITEF( "connection creation failed with error = %d", err ); + // either the connection creation failed or was aborted, + // the server already cleaned up the mess, so nothing to do + } + + if ( iObserver ) + { + iObserver->ConnectingFinishedL( err ); + } + + } + + if ( err == KErrNone && ictTestPermission != EIctsNeverRun ) + { + // do the connectivity test + iConnectedIapId = iIctWlanInfo.iIapId; + + RCmManagerExt cmManager; + cmManager.OpenL(); + CleanupClosePushL( cmManager ); + + RCmConnectionMethodExt cm = cmManager.ConnectionMethodL( + iConnectedIapId ); + CleanupClosePushL( cm ); + + iConnectedNetId = cm.GetIntAttributeL( CMManager::ECmNetworkId ); + + CleanupStack::PopAndDestroy( &cm ); + CleanupStack::PopAndDestroy( &cmManager ); + + LOG_WRITE( "starting ICT test..." ); + CIctsClientInterface* ict = CIctsClientInterface::NewL( + iConnectedIapId, + iConnectedNetId, + *this ); + LOG_WRITE( "ICT created" ); + CleanupStack::PushL( ict ); + ict->StartL(); + LOG_WRITE( "ICT: started" ); + + // enter a waitloop since ICT is a kind of asynchronous service + if ( !iIctEnded ) + { + LOG_WRITE( "ICT: iIctWait started" ); + iIctWait.Start(); + } + + iIctEnded = EFalse; + CleanupStack::PopAndDestroy( ict ); + LOG_WRITE( "ICT test done." ); + } + + + if ( ( err == KErrNone && !aKeepConnection && + ictTestPermission != EIctsNeverRun ) || + ( err != KErrNone && err != KErrCancel ) ) + { + // drop the connection in case of Start web browsing, and if an error + // different from KErrCancel occured (on cancel the connection is + // closed automatically) + LOG_WRITE( "disconnecting..." ); + iSession.DisconnectWlanBearerL(); + LOG_WRITE( "Disconnected." ); + } + + + + if ( err == KErrNone && ictTestPermission == EIctsNeverRun ) + { + LOG_WRITE( "ICT is set to never run, IAP remains temporary" ); + + if ( !iKeepConnection ) + { + //get the engine monitor the IAP + iSession.MonitorAccessPointL( iIctWlanInfo.iIapId ); + iSession.SetIapPersistenceL( EIapExpireOnShutdown ); + iSession.MonitorAccessPointL( iIctWlanInfo.iIapId ); + } + + ConnectivityObserver( EConnectionNotOk, KNullDesC ); + } + + return err; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::TestConnectedAccessPointL +// ---------------------------------------------------------------------------- +// +EXPORT_C TInt CWsfModel::TestConnectedAccessPointL( TWsfWlanInfo& aWlan, + TBool aConnectOnly ) + { + LOG_ENTERFN( "CWsfModel::TestConnectedAccessPointL" ); + TInt err( KErrNone ); + iConnectOnly = aConnectOnly; + if ( !aWlan.iIapId ) + { + // the wlaninfo must already contain a valid IAP id + LOG_WRITE( "invalid IAP id" ); + return KErrCorrupt; + } + + // the wlaninfo must be persistent to avoid nullpointer crashes due to + // background refreshing + iIctWlanInfo = aWlan; + + // check ICT settings + TInt ictTestPermission( IctsTestPermission() ); + + if ( ictTestPermission != EIctsNeverRun ) + { + // do the connectivity test + iConnectedIapId = iIctWlanInfo.iIapId; + + RCmManagerExt cmManager; + cmManager.OpenL(); + CleanupClosePushL( cmManager ); + + RCmConnectionMethodExt cm = cmManager.ConnectionMethodL( + iConnectedIapId ); + CleanupClosePushL( cm ); + + iConnectedNetId = cm.GetIntAttributeL( CMManager::ECmNetworkId ); + + CleanupStack::PopAndDestroy( &cm ); + CleanupStack::PopAndDestroy( &cmManager ); + + LOG_WRITE( "starting ICT test..." ); + CIctsClientInterface* ict = CIctsClientInterface::NewL( + iConnectedIapId, + iConnectedNetId, + *this ); + LOG_WRITE( "ICT created" ); + CleanupStack::PushL( ict ); + ict->StartL(); + LOG_WRITE( "ICT: started" ); + + // enter a waitloop since ICT is a kind of asynchronous service + if ( !iIctEnded ) + { + LOG_WRITE( "ICT: iIctWait started" ); + iIctWait.Start(); + } + + iIctEnded = EFalse; + CleanupStack::PopAndDestroy( ict ); + LOG_WRITE( "ICT test done." ); + } + + if ( ictTestPermission == EIctsNeverRun ) + { + LOG_WRITE( "ICT is set to never run, IAP remains temporary" ); + ConnectivityObserver( EConnectionNotOk, KNullDesC ); + } + + return err; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::RefreshScanL +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CWsfModel::RefreshScanL() + { + LOG_ENTERFN( "CWsfModel::RefreshScanL" ); + iRefreshing = iSession.RequestScanL(); + return iRefreshing; + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::LaunchHelperApplicationL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::LaunchHelperApplicationL( TWsfWlanInfo &aWlanInfo, + TBool aConnecting, + TBool aConnectOnly ) + { + LOG_ENTERFN( "CWsfModel::LaunchHelperApplicationL" ); + TPckgC param( aWlanInfo ); + TPckgC param2( aConnecting ); + TPckgC param3( aConnectOnly ); + + TBuf8 temp; + temp.Copy( param ); + temp.Append( param2 ); + temp.Append( param3 ); + + 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( CEikonEnv::Static()->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 ); + + // do the cleanup if necessary + TRAP_IGNORE( + iSession.SetIapPersistenceL( EIapForcedExpiry ); + iSession.ControlDisconnectTimerL( EAdcStartTimer | EAdcTimerReset ); + ); + + if ( iObserver ) + { + iObserver->BrowserLaunchFailed( aError ); + } + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::BrowserLaunchCompleteL +// ---------------------------------------------------------------------------- +// +void CWsfModel::BrowserLaunchCompleteL() + { + LOG_ENTERFN( "CWsfModel::BrowserLaunchCompleteL" ); + + 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 ); + iSession.ControlDisconnectTimerL( EAdcStartTimer | EAdcTimerReset ); + + 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::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 ); + } + } + +// End of file diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/model/src/wsfscreensaverwatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/model/src/wsfscreensaverwatcher.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/rom/wlansniffer.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/rom/wlansniffer.iby Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/widget/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/widget/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,38 @@ + + + + vga + qvga + + 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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,39 @@ + + + + + + + + + + diff -r 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,5 @@ + + + + + diff -r 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,96 @@ +/******************** + WIZARD PLUGIN AREA +*********************/ + +widget#wizardPluginContainer{ + height: 10u; + display: block; + nav-index: appearance; + width: auto; + padding-top: 0.5u; + block-progression: tb; +} + +widget#wizardPluginContainer:focus { + background-image: "SKIN(268458534 24576)"; + background-color: "SKIN(268458534 5120 9)"; + touchfeedbackdown: basic; + touchfeedbackdrag: sensitive; +} + +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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,11 @@ + + + E029CF57 + 101FB657 + 2001E637 + WLAN wizard + wsfwidget + 1.0 + wsfwidget.xml + wsfwidget.css + \ No newline at end of file diff -r 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,96 @@ +/******************** + WIZARD PLUGIN AREA +*********************/ + +widget#wizardPluginContainer{ + height: 10u; + display: block; + nav-index: appearance; + width: auto; + padding-top: 0.5u; + block-progression: tb; +} + +widget#wizardPluginContainer:focus { + background-image: "SKIN(268458534 24576)"; + background-color: "SKIN(268458534 5120 9)"; + touchfeedbackdown: basic; + touchfeedbackdrag: sensitive; +} + +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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,96 @@ +/******************** + WIZARD PLUGIN AREA +*********************/ + +widget#wizardPluginContainer{ + height: 10u; + display: block; + nav-index: appearance; + width: auto; + padding-top: 0.5u; + block-progression: tb; +} + +widget#wizardPluginContainer:focus { + background-image: "SKIN(268458534 24576)"; + background-color: "SKIN(268458534 5120 9)"; + touchfeedbackdown: basic; + touchfeedbackdrag: sensitive; +} + +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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,96 @@ +/******************** + WIZARD PLUGIN AREA +*********************/ + +widget#wizardPluginContainer{ + height: 10u; + display: block; + nav-index: appearance; + width: auto; + padding-top: 0.5u; + block-progression: tb; +} + +widget#wizardPluginContainer:focus { + background-image: "SKIN(268458534 24576)"; + background-color: "SKIN(268458534 5120 9)"; + touchfeedbackdown: basic; + touchfeedbackdrag: sensitive; +} + +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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,96 @@ +/******************** + WIZARD PLUGIN AREA +*********************/ + +widget#wizardPluginContainer{ + height: 10u; + display: block; + nav-index: appearance; + width: auto; + padding-top: 0.5u; + block-progression: tb; +} + +widget#wizardPluginContainer:focus { + background-image: "SKIN(268458534 24576)"; + background-color: "SKIN(268458534 5120 9)"; + touchfeedbackdown: basic; + touchfeedbackdrag: sensitive; +} + +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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,39 @@ + + + + + + + + + + diff -r 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,5 @@ + + + + + diff -r 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,102 @@ +/******************** + WIZARD PLUGIN AREA +*********************/ + +widget#wizardPluginContainer{ + display: block; + width: auto; + height: auto; + padding-left: 7px; + padding-right: 7px; + padding-top: 7%; + padding-bottom: 7%; + nav-index: appearance; + block-progression: tb; +} + +widget#wizardPluginContainer:focus { + touchfeedbackdown: basic; + touchfeedbackdrag: sensitive; + background-color: "SKIN(268458534 9896)"; +} + +button.wizardStatusBox1 { + display: block; + visibility: visible; + width: auto; + height: adaptive; + position: absolute; + top: 0u; + block-progression: lr; + direction: ltr; +} + +button.wizardStatusBox2{ + display: block; + visibility: visible; + width: auto; + height: adaptive; + position: absolute; + 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; + height: 4.0u; + margin-top: 4%; + margin-left: 1.0u; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + color: "SKIN(268458534 13056 74)"; + text-align: left; + direction: ltr; +} + +text.wizardEntryText2 { + display: block; + visibility: visible; + position: static; + width: auto; + height: 4.0u; + margin-left: 6.0u; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + color: "SKIN(268458534 13056 74)"; + text-align: left; + direction: ltr; +} + +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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,11 @@ + + + E029CF57 + 101FB657 + 20026F45 + WLAN wizard + wsfwidget + 1.0 + wsfwidget.xml + wsfwidget.css + \ No newline at end of file diff -r 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,102 @@ +/******************** + WIZARD PLUGIN AREA +*********************/ + +widget#wizardPluginContainer{ + display: block; + width: auto; + height: auto; + padding-left: 7px; + padding-right: 7px; + padding-top: 7%; + padding-bottom: 7%; + nav-index: appearance; + block-progression: tb; +} + +widget#wizardPluginContainer:focus { + touchfeedbackdown: basic; + touchfeedbackdrag: sensitive; + background-color: "SKIN(268458534 9896)"; +} + +button.wizardStatusBox1 { + display: block; + visibility: visible; + width: auto; + height: adaptive; + position: absolute; + top: 0u; + block-progression: rl; + direction: rtl; +} + +button.wizardStatusBox2{ + display: block; + visibility: visible; + width: auto; + height: adaptive; + position: absolute; + 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; + height: 4.0u; + margin-top: 4%; + margin-right: 1.0u; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + color: "SKIN(268458534 13056 74)"; + text-align: right; + direction: ltr; +} + +text.wizardEntryText2 { + display: block; + visibility: visible; + position: static; + width: auto; + height: 4.0u; + margin-right: 6.0u; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + color: "SKIN(268458534 13056 74)"; + text-align: right; + direction: ltr; +} + +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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,102 @@ +/******************** + WIZARD PLUGIN AREA +*********************/ + +widget#wizardPluginContainer{ + display: block; + width: auto; + height: auto; + padding-left: 7px; + padding-right: 7px; + padding-top: 7%; + padding-bottom: 7%; + nav-index: appearance; + block-progression: tb; +} + +widget#wizardPluginContainer:focus { + touchfeedbackdown: basic; + touchfeedbackdrag: sensitive; + background-color: "SKIN(268458534 9896)"; +} + +button.wizardStatusBox1 { + display: block; + visibility: visible; + width: auto; + height: adaptive; + position: absolute; + top: 0u; + block-progression: rl; + direction: rtl; +} + +button.wizardStatusBox2{ + display: block; + visibility: visible; + width: auto; + height: adaptive; + position: absolute; + 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; + height: 4.0u; + margin-top: 4%; + margin-right: 1.0u; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + color: "SKIN(268458534 13056 74)"; + text-align: right; + direction: ltr; +} + +text.wizardEntryText2 { + display: block; + visibility: visible; + position: static; + width: auto; + height: 4.0u; + margin-right: 6.0u; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + color: "SKIN(268458534 13056 74)"; + text-align: right; + direction: ltr; +} + +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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,102 @@ +/******************** + WIZARD PLUGIN AREA +*********************/ + +widget#wizardPluginContainer{ + display: block; + width: auto; + height: auto; + padding-left: 7px; + padding-right: 7px; + padding-top: 7%; + padding-bottom: 7%; + nav-index: appearance; + block-progression: tb; +} + +widget#wizardPluginContainer:focus { + touchfeedbackdown: basic; + touchfeedbackdrag: sensitive; + background-color: "SKIN(268458534 9896)"; +} + +button.wizardStatusBox1 { + display: block; + visibility: visible; + width: auto; + height: adaptive; + position: absolute; + top: 0u; + block-progression: rl; + direction: rtl; +} + +button.wizardStatusBox2{ + display: block; + visibility: visible; + width: auto; + height: adaptive; + position: absolute; + 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; + height: 4.0u; + margin-top: 4%; + margin-right: 1.0u; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + color: "SKIN(268458534 13056 74)"; + text-align: right; + direction: ltr; +} + +text.wizardEntryText2 { + display: block; + visibility: visible; + position: static; + width: auto; + height: 4.0u; + margin-right: 6.0u; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + color: "SKIN(268458534 13056 74)"; + text-align: right; + direction: ltr; +} + +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 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,102 @@ +/******************** + WIZARD PLUGIN AREA +*********************/ + +widget#wizardPluginContainer{ + display: block; + width: auto; + height: auto; + padding-left: 7px; + padding-right: 7px; + padding-top: 7%; + padding-bottom: 7%; + nav-index: appearance; + block-progression: tb; +} + +widget#wizardPluginContainer:focus { + touchfeedbackdown: basic; + touchfeedbackdrag: sensitive; + background-color: "SKIN(268458534 9896)"; +} + +button.wizardStatusBox1 { + display: block; + visibility: visible; + width: auto; + height: adaptive; + position: absolute; + top: 0u; + block-progression: rl; + direction: rtl; +} + +button.wizardStatusBox2{ + display: block; + visibility: visible; + width: auto; + height: adaptive; + position: absolute; + 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; + height: 4.0u; + margin-top: 4%; + margin-right: 1.0u; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + color: "SKIN(268458534 13056 74)"; + text-align: right; + direction: ltr; +} + +text.wizardEntryText2 { + display: block; + visibility: visible; + position: static; + width: auto; + height: 4.0u; + margin-right: 6.0u; + font-family: EAknLogicalFontSecondaryFont; + font-size: 3.5u; + color: "SKIN(268458534 13056 74)"; + text-align: right; + direction: ltr; +} + +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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfo/bwins/wsfwlaninfou.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/bwins/wsfwlaninfou.def Thu Dec 17 09:20:28 2009 +0200 @@ -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) + ?MatchL@CWsfWlanInfoArray@@QAEXABVTDesC8@@W4TWlanSecMode@CMManager@@W4TWlanNetMode@4@HAAV?$RPointerArray@VTWsfWlanInfo@@@@@Z @ 20 NONAME ; void CWsfWlanInfoArray::MatchL(class TDesC8 const &, enum CMManager::TWlanSecMode, enum CMManager::TWlanNetMode, int, class RPointerArray &) + ?SortArrayL@CWsfWlanInfoArray@@QAEXAAVMWsfWlanInfoArrayFilterVisitor@@@Z @ 21 NONAME ; void CWsfWlanInfoArray::SortArrayL(class MWsfWlanInfoArrayFilterVisitor &) + ?GetArrayIndex@CWsfWlanInfoArray@@QBEHPAVTWsfWlanInfo@@@Z @ 22 NONAME ; int CWsfWlanInfoArray::GetArrayIndex(class TWsfWlanInfo *) const + ?SortArrayL@CWsfWlanInfoArray@@QAEXXZ @ 23 NONAME ; void CWsfWlanInfoArray::SortArrayL(void) + ?NewL@CWsfWlanInfoArray@@SAPAV1@XZ @ 24 NONAME ; class CWsfWlanInfoArray * CWsfWlanInfoArray::NewL(void) + ?GetUIPrioritySort@CWsfWlanInfoArray@@QAEHXZ @ 25 NONAME ; int CWsfWlanInfoArray::GetUIPrioritySort(void) + ?GetIapNameAsUnicodeLC@TWsfWlanInfo@@QAEPAVHBufC16@@XZ @ 26 NONAME ; class HBufC16 * TWsfWlanInfo::GetIapNameAsUnicodeLC(void) + ??0TWsfWlanInfo@@QAE@XZ @ 27 NONAME ; TWsfWlanInfo::TWsfWlanInfo(void) + ?SignalStrengthPercentage@TWsfWlanInfo@@QAEHXZ @ 28 NONAME ; int TWsfWlanInfo::SignalStrengthPercentage(void) + ?InternalizeL@TWsfWlanInfo@@QAEXAAVRReadStream@@@Z @ 29 NONAME ; void TWsfWlanInfo::InternalizeL(class RReadStream &) + ?SerializeContentLC@CWsfWlanInfoArray@@QAEPAVHBufC8@@XZ @ 30 NONAME ; class HBufC8 * CWsfWlanInfoArray::SerializeContentLC(void) + ?Match@CWsfWlanInfoArray@@QAEPAVTWsfWlanInfo@@ABVTDesC8@@H@Z @ 31 NONAME ; class TWsfWlanInfo * CWsfWlanInfoArray::Match(class TDesC8 const &, int) + ?Match@CWsfWlanInfoArray@@QAEPAVTWsfWlanInfo@@KH@Z @ 32 NONAME ; class TWsfWlanInfo * CWsfWlanInfoArray::Match(unsigned long, int) + diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfo/eabi/wsfwlaninfou.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/eabi/wsfwlaninfou.def Thu Dec 17 09:20:28 2009 +0200 @@ -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 + _ZN17CWsfWlanInfoArray5NewLCEv @ 25 NONAME + _ZN17CWsfWlanInfoArray5ResetEv @ 26 NONAME + _ZN17CWsfWlanInfoArray6DeleteEP12TWsfWlanInfo @ 27 NONAME + _ZN17CWsfWlanInfoArray6MatchLERK6TDesC8N9CMManager12TWlanSecModeENS3_12TWlanNetModeEiR13RPointerArrayI12TWsfWlanInfoE @ 28 NONAME + _ZN17CWsfWlanInfoArray7AppendLEP12TWsfWlanInfo @ 29 NONAME + _ZNK12TWsfWlanInfo12ExternalizeLER12RWriteStream @ 30 NONAME + _ZNK17CWsfWlanInfoArray13GetArrayIndexEP12TWsfWlanInfo @ 31 NONAME + _ZNK17CWsfWlanInfoArray2AtEi @ 32 NONAME + _ZNK17CWsfWlanInfoArrayixEj @ 33 NONAME + _ZN17CWsfWlanInfoArray5MatchEmi @ 34 NONAME + diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfo/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfo/group/wlaninfo.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/group/wlaninfo.mmp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfo.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,357 @@ +/* +* 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; + }; + + +#include "wsfwlaninfo.inl" + + +#endif // T_WSFWLANINFO_H + +// End of file diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfo.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfo.inl Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfoarray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfoarray.h Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,249 @@ +/* +* 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 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, + 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfoarrayfiltervisitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfoarrayfiltervisitor.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfoarraysortkey.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfoarraysortkey.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfo/src/wsfwlaninfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/src/wsfwlaninfo.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,246 @@ +/* +* 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 ) + { + } + + +// --------------------------------------------------------------------------- +// 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 ) + { + } + +// --------------------------------------------------------------------------- +// 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; + } + + +// --------------------------------------------------------------------------- +// 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; + } + + +// --------------------------------------------------------------------------- +// 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfo/src/wsfwlaninfoarray.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/src/wsfwlaninfoarray.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,493 @@ +/* +* 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, + 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); + } + } + } +// --------------------------------------------------------------------------- +// 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfo/src/wsfwlaninfoarraysortkey.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfo/src/wsfwlaninfoarraysortkey.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/bwins/wsfwlaninfosortingu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/bwins/wsfwlaninfosortingu.def Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/data/2000cf30.spd Binary file wlanutilities/wlansniffer/wlaninfosorting/data/2000cf30.spd has changed diff -r 000000000000 -r 56b72877c1cb 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 Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,4 @@ + + + + diff -r 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/data/wsfwlaninfosorting.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/data/wsfwlaninfosorting.rss Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/eabi/wsfwlaninfosortingu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/eabi/wsfwlaninfosortingu.def Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/group/bld.inf Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/group/wlaninfosorting.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/group/wlaninfosorting.mmp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/group/wlaninfosortingicons.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/group/wlaninfosortingicons.mk Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfoarrayvisitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfoarrayvisitor.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosorting.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosorting.hrh Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingblacklist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingblacklist.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingbrand.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingbrand.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingdbchangenotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingdbchangenotifier.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingdefault.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingdefault.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingfiltervisitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingfiltervisitor.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlansortingbrand.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlansortingbrand.rh Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlanssidselectiondlg2.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlanssidselectiondlg2.h Thu Dec 17 09:20:28 2009 +0200 @@ -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 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 MEikListBoxObserver + { + 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 + void PreLayoutDynInitL(); + + + public: // From MEikListBoxObserver + void HandleListBoxEventL( CEikListBox* aListBox, + TListBoxEvent aEventType ); + + 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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/rom/wsfwlaninfosorting.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/rom/wsfwlaninfosorting.iby Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/rom/wsfwlaninfosortingresources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/rom/wsfwlaninfosortingresources.iby Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfoarrayvisitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfoarrayvisitor.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingblacklist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingblacklist.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingbrand.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingbrand.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingdbchangenotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingdbchangenotifier.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingdefault.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingdefault.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -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 000000000000 -r 56b72877c1cb wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlanssidselectiondlg2.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlanssidselectiondlg2.cpp Thu Dec 17 09:20:28 2009 +0200 @@ -0,0 +1,283 @@ +/* +* 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::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; + } + + +// ---------------------------------------------------------------------------- +// CWsfWlanSsidSelectionDlg2::HandleListBoxEventL +// ---------------------------------------------------------------------------- +// +void CWsfWlanSsidSelectionDlg2::HandleListBoxEventL( CEikListBox* aListBox, + TListBoxEvent aEventType ) + { + LOG_ENTERFN( "CWsfWlanSsidSelectionDlg2::HandleListBoxEventL" ); + + switch ( aEventType ) + { + case EEventEnterKeyPressed: + case EEventItemClicked: + // both handled in the same way for now... + { + // An item should be marked/unmarked. + LOG_WRITE( "selection toggle" ); + CEikListBox* listBox = ListBox(); + TInt index = listBox->View()->CurrentItemIndex(); + + if ( listBox->View()->ItemIsSelected( index ) ) + { + // if the item was unmarked select + listBox->View()->SelectItemL( index ); + } + else + { + // if the item was marked deselect + listBox->View()->DeselectItem( index ); + } + + listBox->DrawDeferred(); + break; + } + case EEventItemDoubleClicked: + { + break; + } + case EEventEditingStarted: + { + break; + } + case EEventEditingStopped: + { + break; + } + default: + { + CAknListQueryDialog::HandleListBoxEventL( aListBox, aEventType ); + break; + }; + }; + } +