# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1271423276 -10800 # Node ID 10810c91db26f49a4643277fce91870fe1ec505a # Parent ff3b3772260050f2160ff30eb1bdc1fdc28a9b0a Revision: 201011 Kit: 201015 diff -r ff3b37722600 -r 10810c91db26 group/bld.inf --- a/group/bld.inf Tue Jan 26 13:04:04 2010 +0200 +++ b/group/bld.inf Fri Apr 16 16:07:56 2010 +0300 @@ -24,7 +24,6 @@ PRJ_MMPFILES #include "../hotspotfw/group/bld.inf" #include "../hsfw_plat/group/bld.inf" -#include "../wlanutilities/group/bld.inf" PRJ_TESTMMPFILES diff -r ff3b37722600 -r 10810c91db26 hotspotfw/group/bld.inf --- a/hotspotfw/group/bld.inf Tue Jan 26 13:04:04 2010 +0200 +++ b/hotspotfw/group/bld.inf Fri Apr 16 16:07:56 2010 +0300 @@ -24,6 +24,8 @@ PRJ_EXPORTS ../rom/hotspot.iby CORE_MW_LAYER_IBY_EXPORT_PATH(hotspot.iby) ../rom/hotspotResources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(hotspotResources.iby) +../rom/hotspotfwstub.sis /epoc32/data/z/system/install/hotspotfwstub.sis +../rom/ictsstub.sis /epoc32/data/z/system/install/ictsstub.sis // Localisation files of whole Hotspot localised here ../hsbrowser/loc/hsbrowser.loc MW_LAYER_LOC_EXPORT_PATH(hsbrowser.loc) diff -r ff3b37722600 -r 10810c91db26 hotspotfw/hsbrowser/inc/hsbrowserspecialloadobserver.h --- a/hotspotfw/hsbrowser/inc/hsbrowserspecialloadobserver.h Tue Jan 26 13:04:04 2010 +0200 +++ b/hotspotfw/hsbrowser/inc/hsbrowserspecialloadobserver.h Fri Apr 16 16:07:56 2010 +0300 @@ -22,7 +22,7 @@ #define HSBROWSERSPECIALLOADOBSERVER_H // INCLUDES -#include +#include #include // CLASS DECLARATION diff -r ff3b37722600 -r 10810c91db26 hotspotfw/hsbrowser/src/hsbrowserloadeventobserver.cpp --- a/hotspotfw/hsbrowser/src/hsbrowserloadeventobserver.cpp Tue Jan 26 13:04:04 2010 +0200 +++ b/hotspotfw/hsbrowser/src/hsbrowserloadeventobserver.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -92,9 +92,6 @@ // no break, fall through } case TBrCtlDefs::EEventNewContentDisplayed: - { - DEBUG( "CHsBrowserLoadEventObserver::HandleBrowserLoadEventL() EEventNewContentDisplayed" ); - } case TBrCtlDefs::EEventNewContentStart: { DEBUG( "CHsBrowserLoadEventObserver::HandleBrowserLoadEventL() EEventNewContentStart" ); diff -r ff3b37722600 -r 10810c91db26 hotspotfw/hsclient/NetCfgExtnHotSpot/inc/NetCfgExtnHotSpot.h --- a/hotspotfw/hsclient/NetCfgExtnHotSpot/inc/NetCfgExtnHotSpot.h Tue Jan 26 13:04:04 2010 +0200 +++ b/hotspotfw/hsclient/NetCfgExtnHotSpot/inc/NetCfgExtnHotSpot.h Fri Apr 16 16:07:56 2010 +0300 @@ -11,13 +11,11 @@ * * Contributors: * -* Description: NIFMAN configuration +* Description: NIFMAN configuration daemon * */ - - #ifndef __NET_CFG_EXTN_HOTSPOT_H__ #define __NET_CFG_EXTN_HOTSPOT_H__ @@ -35,68 +33,80 @@ * @since S60 5.0 */ class CNetworkConfigExtensionHotSpot : public CNetworkConfigExtensionBase - { + { public: /** * Two-phased constructor. */ - static CNetworkConfigExtensionHotSpot* NewL( TAny* aMNifIfNotify ); - - /** + static CNetworkConfigExtensionHotSpot* NewL( TAny* aMNifIfNotify ); + + /** * Destructor. */ - virtual ~CNetworkConfigExtensionHotSpot(); + virtual ~CNetworkConfigExtensionHotSpot(); - /** + /** * From CNetworkConfigExtensionBase * @since S60 5.0 * @param aMessage the message * @return None */ - void SendIoctlMessageL( const ESock::RLegacyResponseMsg& aMessage ); + void SendIoctlMessageL( const ESock::RLegacyResponseMsg& aMessage ); + /** + * From CNetworkConfigExtensionBase + * @since S60 5.2 + * @param aCause Specifies what caused the deregistration request + * @return None + */ + void Deregister( TInt aCause ); + protected: /** * C++ default constructor. */ - CNetworkConfigExtensionHotSpot( MNifIfNotify& aNifIfNotify ); - - /** + CNetworkConfigExtensionHotSpot( MNifIfNotify& aNifIfNotify ); + + /** * By default Symbian 2nd phase constructor is private. */ - void ConstructL(); - + void ConstructL(); + /** - * From CTimer. Waits for StartLogin() completion from Hotspot Server + * From CNetworkConfigExtensionBase. HotspotFW handling add ons. + * @since S60 5.0 + * @return None + */ + virtual void RunL(); + + /** + * From CNetworkConfigExtensionBase. HotspotFW handling add ons. * @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; - + virtual void DoCancel(); + private: - // Hotspot client interface + // Flag for Authentication + TBool iNotAuthenticated; + + // Flag for Deregistering + TBool iNotDeregistered; + + // Defines if StartLogin() is ongoing + TBool iIsStartLoginActive; + + // Defines if HotspotFW session is created + TInt iHotspotConnect; + + // Handle to HotspotFW client interface RHssInterface iClient; - }; + + }; /** * CNetworkConfigExtensionBase - constructor @@ -104,8 +114,8 @@ */ inline CNetworkConfigExtensionHotSpot::CNetworkConfigExtensionHotSpot( MNifIfNotify& aNifIfNotify ) : CNetworkConfigExtensionBase( aNifIfNotify ) - { - } + { + } #endif diff -r ff3b37722600 -r 10810c91db26 hotspotfw/hsclient/NetCfgExtnHotSpot/src/NetCfgExtnHotSpot.cpp --- a/hotspotfw/hsclient/NetCfgExtnHotSpot/src/NetCfgExtnHotSpot.cpp Tue Jan 26 13:04:04 2010 +0200 +++ b/hotspotfw/hsclient/NetCfgExtnHotSpot/src/NetCfgExtnHotSpot.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -11,10 +11,11 @@ * * Contributors: * -* Description: Implements Network Config Extension for HotSpot +* Description: Implements Network Config Extension for HotspotFW * */ + // INCLUDE FILES #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS #include @@ -24,11 +25,11 @@ #include "am_debug.h" -// ============================ MEMBER FUNCTIONS =============================== +// ============================ MEMBER FUNCTIONS ============================== -// ----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // NewL -// ----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // CNetworkConfigExtensionHotSpot* CNetworkConfigExtensionHotSpot::NewL( TAny* aMNifIfNotify ) @@ -42,9 +43,9 @@ return pDaemon; } -// ----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // ConstructL -// ----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // void CNetworkConfigExtensionHotSpot::ConstructL() { @@ -52,17 +53,17 @@ CNetworkConfigExtensionBase::ConstructL(); iNotAuthenticated = ETrue; iNotDeregistered = ETrue; + iIsStartLoginActive = EFalse; iHotspotConnect = KErrNotFound; - DEBUG( "CNetworkConfigExtensionHotSpot::ConstructL() Done" ); } -// ----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // SendIoctlMessageL -// Forwards Ioctl request to the daemon and activates the AO to wait for response -// ----------------------------------------------------------------------------- +// Forwards Ioctl request to the daemon. Activates the AO to wait for response. +// ---------------------------------------------------------------------------- // -void CNetworkConfigExtensionHotSpot::SendIoctlMessageL( const ESock::RLegacyResponseMsg& aMessage ) - +void CNetworkConfigExtensionHotSpot::SendIoctlMessageL( + const ESock::RLegacyResponseMsg& aMessage ) { TInt name = aMessage.Int1(); if ( aMessage.Int0() != KCOLConfiguration ) @@ -85,109 +86,128 @@ CNetworkConfigExtensionBase::SendIoctlMessageL( aMessage ); } -// ----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // ~CNetworkConfigExtensionHotSpot -// ----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // CNetworkConfigExtensionHotSpot::~CNetworkConfigExtensionHotSpot() + { + DEBUG( "CNetworkConfigExtensionHotSpot::~CNetworkConfigExtensionHotSpot" ); + iClient.Close(); + } - { - DEBUG( "CNetworkConfigExtensionHotSpot::~CNetworkConfigExtensionHotSpot()" ); - } - -// ----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // ImplementationTable -// ----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // const TImplementationProxy ImplementationTable[] = { - IMPLEMENTATION_PROXY_ENTRY(0x10282ECA, CNetworkConfigExtensionHotSpot::NewL) + IMPLEMENTATION_PROXY_ENTRY( 0x10282ECA, + CNetworkConfigExtensionHotSpot::NewL ) }; -// ----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // ImplementationGroupProxy -// ----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount ) { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + aTableCount = sizeof( ImplementationTable ) / + sizeof( TImplementationProxy ); return ImplementationTable; } +// ---------------------------------------------------------------------------- +// Deregister +// ---------------------------------------------------------------------------- +// +void CNetworkConfigExtensionHotSpot::Deregister( TInt aCause ) + { + DEBUG1( "CNetworkConfigExtensionHotSpot::Deregister() aCause: %d", aCause ); + CNetworkConfigExtensionBase::Deregister( aCause ); // to parent + + if ( iIsStartLoginActive ) + { + DEBUG( "CNetworkConfigExtensionHotSpot::Deregister() LoginComplete" ); + iClient.LoginComplete( iConnectionInfoBuf().iIapId, KErrNone ); + } + iIsStartLoginActive = EFalse; + } -// ----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // 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; + { + DEBUG( "CNetworkConfigExtensionHotSpot::RunL()" ); + if ( iLastGenericProgressStage == KConfigDaemonStartingRegistration ) + { + if( iNotAuthenticated ) + { + DEBUG( "CNetworkConfigExtensionHotSpot::RunL() StartLogin" ); + iHotspotConnect = iClient.Connect(); + + if ( KErrNone == iHotspotConnect ) + { + iIsStartLoginActive = ETrue; + iClient.StartLogin( iConnectionInfoBuf().iIapId, + iConnectionInfoBuf().iNetId, + iStatus ); + SetActive(); + } + else // to parent + { + CNetworkConfigExtensionBase::RunL(); + } + iNotAuthenticated = EFalse; } - else - { - DEBUG( "CNetworkConfigExtensionHotSpot::RunL() close" ); - CNetworkConfigExtensionBase::RunL(); - } - - } - else if (iLastGenericProgressStage == KConfigDaemonStartingDeregistration) + else // to parent + { + DEBUG( "CNetworkConfigExtensionHotSpot::RunL() authenticated" ); + iIsStartLoginActive = EFalse; + CNetworkConfigExtensionBase::RunL(); + } + + } + else if ( iLastGenericProgressStage == + KConfigDaemonStartingDeregistration ) { - if(iNotDeregistered) - { - DEBUG( "CNetworkConfigExtensionHotSpot::RunL() dereg" ); + if( iNotDeregistered ) + { + DEBUG( "CNetworkConfigExtensionHotSpot::RunL() CloseConnection" ); 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(); - } + TUint networkId = iConnectionInfoBuf().iNetId; + + if ( KErrNone == iHotspotConnect ) + { + iClient.CloseConnection( iapId, iStatus ); + SetActive(); + } + else // to parent + { + CNetworkConfigExtensionBase::RunL(); + } + iNotDeregistered = EFalse; + } + else // to parent + { + DEBUG( "CNetworkConfigExtensionHotSpot::RunL() deregistered" ); + CNetworkConfigExtensionBase::RunL(); + } } - else // original ========================================================= - { - DEBUG( "CNetworkConfigExtensionHotSpot::RunL() original" ); - CNetworkConfigExtensionBase::RunL(); - } - } - -// ----------------------------------------------------------------------------- + else // to parent + { + DEBUG( "CNetworkConfigExtensionHotSpot::RunL() original" ); + CNetworkConfigExtensionBase::RunL(); + } + } + +// ---------------------------------------------------------------------------- // DoCancel -// ----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // void CNetworkConfigExtensionHotSpot::DoCancel() { diff -r ff3b37722600 -r 10810c91db26 hotspotfw/hsclient/inc/hssinterface.h --- a/hotspotfw/hsclient/inc/hssinterface.h Tue Jan 26 13:04:04 2010 +0200 +++ b/hotspotfw/hsclient/inc/hssinterface.h Fri Apr 16 16:07:56 2010 +0300 @@ -279,13 +279,7 @@ * @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 /** diff -r ff3b37722600 -r 10810c91db26 hotspotfw/hsclient/src/hssinterface.cpp --- a/hotspotfw/hsclient/src/hssinterface.cpp Tue Jan 26 13:04:04 2010 +0200 +++ b/hotspotfw/hsclient/src/hssinterface.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -108,7 +108,7 @@ error = CreateSession( KHotSpotDataServerName, Version(), KDefaultMsgSlots ); - DEBUG1( "RHssInterface::Connect() CreateSession: %d", error ); + DEBUG1( "RHssInterface::Connect() CreateSession: %d", error ); } return error; } @@ -412,75 +412,50 @@ // TInt RHssInterface::StartServer() { - DEBUG( "RHssInterface::StartServer" ); - TInt result; - - TFindServer findHotSpotServer( KHotSpotDataServerName ); + TInt res( KErrNone ); + // create server - if one of this name does not already exist + TFindServer findServer( 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 ) + if ( findServer.Next( name ) != KErrNone ) // we don't exist already { - return result; - } + RProcess server; + // Create the server process + res = server.Create( KHotSpotServerExe, KNullDesC ); - 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; - } + if ( res != KErrNone ) // thread created ok - now start it going + { + return res; + } -// ----------------------------------------------------------------------------- -// RHssInterface::CreateServerProcess() -// Creates a server process -// ----------------------------------------------------------------------------- -// -TInt RHssInterface::CreateServerProcess() - { - const TUidType serverUid( KNullUid,KNullUid, KHotspotServerUid3 ); - - RProcess server; + // Rendezvous is used to detect server start + TRequestStatus status; + server.Rendezvous( status ); + + if ( status != KRequestPending ) + { + DEBUG1( "StartServer Rendezvous ERROR: %d", status.Int() ); + server.Kill( 0 ); // abort startup + } + else + { + server.Resume(); // logon OK - start the server + } + + DEBUG( "StartServer wait for start" ); + User::WaitForRequest( status ); // wait for start or death - 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 + // 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(); } - - DEBUG("**** RHssInterface: Started"); - - User::WaitForRequest(stat); - r = ( server.ExitType()==EExitPanic ) ? KErrGeneral : stat.Int(); - server.Close(); - return r; + + return res; + } // --------------------------------------------------------- diff -r ff3b37722600 -r 10810c91db26 hotspotfw/hsclient/src/hssmgmtscaninfoimpl.cpp --- a/hotspotfw/hsclient/src/hssmgmtscaninfoimpl.cpp Tue Jan 26 13:04:04 2010 +0200 +++ b/hotspotfw/hsclient/src/hssmgmtscaninfoimpl.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -124,9 +124,9 @@ // void CHssMgmtScanInfoImpl::Bssid( THssBssid& aBssid ) const { - TMacAddress bssid; - iScanInfo->BSSID( bssid.iMacAddress ); - aBssid.Copy( &bssid.iMacAddress[0], KMacAddressLength ); + TUint8 bssid[KHssMacAddressLength]; + iScanInfo->BSSID( bssid ); + aBssid.Copy( &bssid[0], KHssMacAddressLength ); } // --------------------------------------------------------- diff -r ff3b37722600 -r 10810c91db26 hotspotfw/hsfw_sis/cenrep.pkg --- a/hotspotfw/hsfw_sis/cenrep.pkg Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -; -; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: ; 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 ff3b37722600 -r 10810c91db26 hotspotfw/hsfw_sis/hotspot.pkg --- a/hotspotfw/hsfw_sis/hotspot.pkg Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -; -; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: ;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 ff3b37722600 -r 10810c91db26 hotspotfw/hsfw_sis/hotspotfwupdater.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsfw_sis/hotspotfwupdater.pkg Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,50 @@ +; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: Hotspot FW updater +; + +;Languages +; - None (English only by default) + +;Header +#{"Hotspot FW updater"},(0x10282ECB),1,0,1, TYPE=SP + +; Product / platform version compatibility - S60 5.2 +[0x20022e6d],0,0,0,{"Series60ProductID"} + +; Localised Vendor Name +%{"Nokia"} + +;Unique Vendor Name +:"Nokia" + +;Server +"\epoc32\release\armv5\udeb\HotSpotServer.exe"-"c:\sys\bin\HotSpotServer.exe" + +; Client +"\epoc32\release\armv5\udeb\hotspotclient.dll"-"c:\sys\bin\hotspotclient.dll" + +; ECOM plugin for daemon +"\epoc32\data\z\resource\plugins\NetCfgExtnHotSpot.rsc"-"c:\resource\plugins\NetCfgExtnHotSpot.rsc" +"\epoc32\release\armv5\udeb\NetCfgExtnHotSpot.dll"-"c:\sys\bin\NetCfgExtnHotSpot.dll" + +; ECOM plugin for Mgmt API +"\epoc32\data\z\resource\plugins\HssMgmtImpl.rsc"-"c:\resource\plugins\HssMgmtImpl.rsc" +"\epoc32\release\armv5\udeb\hssmgmtimpl.dll"-"c:\sys\bin\hssmgmtimpl.dll" + +; ECOM plugin for Agent +"\epoc32\data\z\resource\plugins\WlanAgtHotSpotImpl.rsc"-"c:\resource\plugins\WlanAgtHotSpotImpl.rsc" +"\epoc32\release\armv5\udeb\wlanagthotspotimpl.dll"-"c:\sys\bin\wlanagthotspotimpl.dll" + + + diff -r ff3b37722600 -r 10810c91db26 hotspotfw/hsfw_sis/ictsupdater.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsfw_sis/ictsupdater.pkg Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,33 @@ +; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: Internet Connectivity Test Service updater +; + +;Languages +; - None (English only by default) + +;Header +#{"ICTS updater"},(0x10282EC5),1,0,1, TYPE=SP + +; Product / platform version compatibility - S60 5.2 +[0x20022e6d],0,0,0,{"Series60ProductID"} + +; Localised Vendor Name +%{"Nokia"} + +;Unique Vendor Name +:"Nokia" + +"\epoc32\release\armv5\udeb\ictsclientinterface.dll"-"c:\sys\bin\ictsclientinterface.dll" + + diff -r ff3b37722600 -r 10810c91db26 hotspotfw/hsserver/inc/802dot11.h --- a/hotspotfw/hsserver/inc/802dot11.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3713 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 hotspotfw/hsserver/inc/algorithm.h --- a/hotspotfw/hsserver/inc/algorithm.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,283 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 hotspotfw/hsserver/inc/hotspotclientserver.h --- a/hotspotfw/hsserver/inc/hotspotclientserver.h Tue Jan 26 13:04:04 2010 +0200 +++ b/hotspotfw/hsserver/inc/hotspotclientserver.h Fri Apr 16 16:07:56 2010 +0300 @@ -23,38 +23,18 @@ #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(KHotSpotServerImg,"HotSpotServer"); _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 TUint8 KHssMacAddressLength = 6; const TUid KInternetConnectivityUid={0x10282EC5}; const TUid K3rdPartyEcomInterfaceUid={0x10282ED1}; @@ -77,10 +57,7 @@ const TUint KHotSpotBuildVersionNumber = 1; const TInt KIapNameLength = 128; -const TUint KConnectivityTestedId = 20; -const TUint KConnectivityTestNeededId = 30; -const TUint KNoRedirect = 40; -const TUint KRedirect = 50; +const TInt KUidLength = 10; /** * Commands from client to server. diff -r ff3b37722600 -r 10810c91db26 hotspotfw/hsserver/inc/hotspotserver.h --- a/hotspotfw/hsserver/inc/hotspotserver.h Tue Jan 26 13:04:04 2010 +0200 +++ b/hotspotfw/hsserver/inc/hotspotserver.h Fri Apr 16 16:07:56 2010 +0300 @@ -86,20 +86,34 @@ void PanicClient(const RMessagePtr2& aMessage,THotspotPanic aPanic); +/** +* Stores RMessage entries +*/ struct SRequestMapEntry { RMessagePtr2 iMessage; THotSpotCommands iFunction; TUint iIapId; }; - +/** +* Stores timer values for each client +*/ struct SLoginLogoutTimers { - TUid clientUid; - TUint loginTimeMicroSecs; - TUint logoutTimeMicroSecs; + TBuf iClientUid; + TUint iLoginTimeMicroSecs; + TUint iLogoutTimeMicroSecs; }; - + +/** +* Stores all registered IAPs and their client UIDs +*/ +struct SClientIaps + { + TUint iIapId; + TBuf iClientUid; + }; + // CLASS DECLARATION /** @@ -209,54 +223,79 @@ * @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 + * Finds HotspotFW created client IAPs. + * @since Series 60 5.2 * @return None */ - void SetServiceId( TInt aServiceId ); + void FindClientIapsL(); /** - * 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 + * @since Series 60 3.2 * @return None */ void CheckIapsL(); /** * Get login timer value for the specified client. - * @param aClientUid, client's user ID, + * @since Series 60 5.2 + * @param aClientUid, clients user id * @return Login timer value. */ - TUint GetLoginTimeMicroSecs( TUid aClientUid ); + TUint GetLoginTimeMicroSecs( TDes& aClientUid ); /** * Get logout timer value for the specified client. - * @param aClientUid, client's user ID, + * @since Series 60 5.2 + * @param aClientUid, clients user id * @return Logout timer value. */ - TUint GetLogoutTimeMicroSecs( TUid aClientUid ); + TUint GetLogoutTimeMicroSecs( TDes& aClientUid ); /** * Set both login and logout timer values for the specified client. - * @param aClientUid, client's user ID, - * @param aLoginTimerValue, set login timer value, + * @since Series 60 5.2 + * @param aClientUid, clients user id + * @param aLoginTimerValue, set login timer value * @param aLogoutTimerValue, set logout timer value. */ - void CHotSpotServer::SetTimerValues( - TUid aClientUid, + void SetTimerValues( + TDes& aClientUid, TUint aLoginTimerValue, TUint aLogoutTimerValue ); + /** + * Finds if given IAP id has an existing client. + * @since Series 60 5.2 + * @param aClientUid, clients user id + * @return KErrNone if client is found, otherwise KErrNotFound + */ + TInt GetClientUid( TUint aIapId, TDes& aUid ); + + /** + * Adds client IAP to the array. + * @since Series 60 5.2 + * @param aIapId, IAP id + * @param aUid, clients user id + */ + void SetClientIap( TUint aIapId, TDes& aUid ); + + /** + * Removes client IAP from the array. + * @since Series 60 5.2 + * @param aIapId, IAP id + */ + void RemoveClientIap( TUint aIapId ); + + /** + * Returns Easy WLAN IAP id. + * @since Series 60 5.2 + * @return Easy WLAN id + */ + TInt GetEasyWlanId(); + private: /** @@ -264,7 +303,7 @@ * @param aClientUid, client UID to find. * @return matching index if UID was found, otherwise KErrNotFound. */ - TInt CHotSpotServer::FindClientUid( TUid aClientUid ); + TInt FindClientUid( TDes& aClientUid ); public: // Functions from base classes @@ -331,24 +370,34 @@ TBool iAssociationValue; /** - * Boolean flag whether the IAPs has been checked or not + * Flag for the IAP check */ TBool iIapCheckValue; + + /** + * Flag for client IAP search + */ + TInt iClientIapsChecked; /** * WLAN management API */ CWlanMgmtClient* iMgtClient; - - /** - * Service id of IAP in use - */ - TInt iCurrentServiceIdInUse; - + /** * Array for storing client dependent login and logout timer values. */ RArray iLoginLogoutTimerArray; + + /** + * Array for storing client IAPs and their UIDs. + */ + RArray iClientIaps; + + /** + * Easy WLAN IAP Id + */ + TInt iEasyWlanId; }; #endif diff -r ff3b37722600 -r 10810c91db26 hotspotfw/hsserver/inc/hotspotsession.h --- a/hotspotfw/hsserver/inc/hotspotsession.h Tue Jan 26 13:04:04 2010 +0200 +++ b/hotspotfw/hsserver/inc/hotspotsession.h Fri Apr 16 16:07:56 2010 +0300 @@ -65,16 +65,20 @@ */ static CHotSpotSession* NewL( CHotSpotServer& aServer ); - /** + /** * Destructor. */ ~CHotSpotSession(); - struct TNotification - { - TInt id; - TBuf8 data; - }; + /** + * Struct for notifications. + */ + struct TNotification + { + TInt id; + TBuf8 data; + }; + public: // Functions from base classes /** @@ -116,18 +120,18 @@ void LogoutTimeout(); /** - * From MWlanMgmtNotifications - * @since Series 60 3.0 - * @param aNewState State of WLAN - * @return None - */ - virtual void ConnectionStateChanged( TWlanConnectionMode aNewState ); + * 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 + * Methods for handling passthrough notifications */ void HandleCancelNotifications( const RMessage2& aMessage ); void AddNotification( TInt aNotification, TDes8& aData ); @@ -191,7 +195,7 @@ * @param aIapId, IAP id * @return KErrNone, if successful, otherwice one of system wide errorcodes. */ - TInt ProcessStartAgain( const TUint aIapId ); + TInt ProcessStartAgain( const TUint aIapId ); /** * Sends WLAN association status to client @@ -206,7 +210,7 @@ * @param aIapId, IAP id * @return KErrNone, if successful, otherwice one of system wide errorcodes. */ - TInt ProcessCloseL( const TUint aIapId ); + TInt ProcessCloseL( const TUint aIapId ); /** * Creates client instance through ECom @@ -234,20 +238,32 @@ void AuthenticateL( const TDesC& aString ); /** - * Reads EasyWLAN IAP id - * @return None + * Removes brackets from the UID + * @param aUid, UID of the client */ - void EasyWlanIdL(); + void ModifyClientUid( TDes& aUid ); + + /** + * Convert descriptor to TUid and saves it to member variable + * @param aUid, UID of the client + */ + void ConvertTBufToTUid( TDes& aUid ); private: // Data - /** List of pending (not sent) notifications. */ + /** + * List of pending (not sent) notifications. + */ RArray iPendingNotifications; - /** The request from the client pending for a notification. */ + /** + * The request from the client pending for a notification. + */ RMessagePtr2 iPendingNotificationRequest; - /** Is there a pending request from the client. */ + /** + * Is there a pending request from the client. + */ TBool iIsNotificationRequestPending; /** @@ -262,11 +278,13 @@ CHssClientPlugin* iClient; /** - * handle to MHssSrvNotifications + * Handle to MHssSrvNotifications */ MHssSrvNotifications *iSrvNotifications; - /** Handle to remove notification. */ + /** + * Handle to remove notification. + */ CSessionNotification* iNotificationHandle; /** @@ -294,12 +312,6 @@ */ HssNotifications *iNotifications; - - /** - * statusinformation of Async call - */ - TRequestStatus iStatus; - /** * Handler for changing IAP settings * Own @@ -338,11 +350,7 @@ * Flag for indicate if extended HSFW API is used */ TBool iHotspotExtension; - - /** - * Easy WLAN IAP Id - */ - TUint32 iEasyWlanId; + }; #endif diff -r ff3b37722600 -r 10810c91db26 hotspotfw/hsserver/inc/hssiapsettingshandler.h --- a/hotspotfw/hsserver/inc/hssiapsettingshandler.h Tue Jan 26 13:04:04 2010 +0200 +++ b/hotspotfw/hsserver/inc/hssiapsettingshandler.h Fri Apr 16 16:07:56 2010 +0300 @@ -45,8 +45,8 @@ _LIT8(KEapPlus,"+0"); _LIT8(KDot,", "); -_LIT8(KMark1, "[" ); -_LIT8(KMark2, "]" ); +_LIT(KMark1, "[" ); +_LIT(KMark2, "]" ); _LIT8(KEapNone,"0"); _LIT8(KEapGtc,"6"); @@ -130,7 +130,9 @@ * @param aUid, UID of the client * @return Iap ID, Otherwise aIapId will be null */ - void CreateClientIapL( const TDesC& aIapName, TUint32& aIapId, const TUid aUid ); + void CreateClientIapL( const TDesC& aIapName, + TUint32& aIapId, + const TDesC& aUid ); /** * Create new IAP to Internet SNAP. @@ -142,16 +144,7 @@ * @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: /** diff -r ff3b37722600 -r 10810c91db26 hotspotfw/hsserver/inc/hssscanoffsets.h --- a/hotspotfw/hsserver/inc/hssscanoffsets.h Tue Jan 26 13:04:04 2010 +0200 +++ b/hotspotfw/hsserver/inc/hssscanoffsets.h Fri Apr 16 16:07:56 2010 +0300 @@ -20,44 +20,36 @@ #ifndef HSSSCANOFFSETS_H #define HSSSCANOFFSETS_H -#include "802dot11.h" + +/** Offset for RCPI value. */ +const TUint32 RX_LEVEL_OFFSET = 0; -// Offsets for the static header. -const TUint32 RX_LEVEL_OFFSET = 0; // 0 -const TUint32 RX_SNR_OFFSET = RX_LEVEL_OFFSET + sizeof(TUint32); // 4 +/** Offset for SNR value. Deprecated. */ +const TUint32 RX_SNR_OFFSET = 4; -// Offsets for scan results. -const TUint32 LENGTH_OFFSET = RX_SNR_OFFSET + sizeof(TUint32); // 8 +/** Offset for beacon/probe response frame data length. */ +const TUint32 LENGTH_OFFSET = 8; -// length of the control information proceeding the DOT11 header (DOT11_BASE_OFFSET) +/** Length of the control information header. */ const TUint32 CNTRL_HEADER_LEN = 12; +/** Start of beacon/probe response frame data. */ const TUint32 DOT11_BASE_OFFSET = CNTRL_HEADER_LEN; -// start of BSSID + +/** Start of BSSID field (6 octets ). */ 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 (8 octets). */ +const TUint32 TIMESTAMP_OFFSET = DOT11_BASE_OFFSET + 24; -// start of timestamp field -const TUint32 TIMESTAMP_OFFSET = DOT11_BASE_OFFSET + sizeof(SManagementFrameHeader); +/** Start of Beacon Interval field (2 octets). */ +const TUint32 BEACON_INTERVAL_OFFSET = DOT11_BASE_OFFSET + 32; + +/** Start of Capability field (2 octets). */ +const TUint32 CAPABILITY_OFFSET = DOT11_BASE_OFFSET + 34; -// 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; +/** Start of first IE in beacon/probe response frame. */ +const TUint32 BODY_OFFSET = DOT11_BASE_OFFSET + 36; + + #endif // HSSSCANOFFSETS_H diff -r ff3b37722600 -r 10810c91db26 hotspotfw/hsserver/inc/pack.h --- a/hotspotfw/hsserver/inc/pack.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 hotspotfw/hsserver/src/hotspotserver.cpp --- a/hotspotfw/hsserver/src/hotspotserver.cpp Tue Jan 26 13:04:04 2010 +0200 +++ b/hotspotfw/hsserver/src/hotspotserver.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -11,15 +11,12 @@ * * Contributors: * -* Description: Implementation of HotSpot Plugin Server +* Description: Implementation of HotSpot Server * */ - - - // INCLUDE FILES #include #include @@ -49,11 +46,8 @@ // 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 @@ -73,39 +67,24 @@ // 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 ); - } + // Create and install the active scheduler + CActiveScheduler *scheduler = new (ELeave) CActiveScheduler; + CleanupStack::PushL( scheduler ); + CActiveScheduler::Install( scheduler ); + + // Create server + CHotSpotServer::NewLC(); + + // Initialisation complete, now signal the client + User::LeaveIfError( RThread().RenameMe( KHotSpotServerName ) ); + RProcess::Rendezvous( KErrNone ); - __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(); - + // Ready to run DEBUG("**** HotspotServer: server fully running"); CActiveScheduler::Start(); - CleanupStack::PopAndDestroy( 2, s ); // Cleanup both server and scheduler + + // Cleanup the server and scheduler + CleanupStack::PopAndDestroy( 2, scheduler ); REComSession::FinalClose(); } @@ -149,11 +128,12 @@ // CHotSpotServer::~CHotSpotServer() { - DEBUG("**** HotSpotServer: CHotSpotServer::~CHotSpotServer"); + DEBUG( "**** HotSpotServer: CHotSpotServer::~CHotSpotServer" ); iMap.Close(); iNotificationArray.Close(); iLoginLogoutTimerArray.Close(); + iClientIaps.Close(); if ( iMgtClient != NULL ) { @@ -170,17 +150,20 @@ // void CHotSpotServer::ConstructL() { - DEBUG("**** HotSpotServer: CHotSpotServer::ConstructL"); + DEBUG( "**** HotSpotServer: CHotSpotServer::ConstructL" ); StartL( KHotSpotServerName ); iIapCheckValue = EFalse; iLogoutSent = EFalse; iLoginValue = ETrue; iAssociationValue = EFalse; - + iClientIapsChecked = KErrNone; + iEasyWlanId = KEasyWlanServiceId; // Set to default value just in case + + TRAP( iClientIapsChecked, FindClientIapsL() ); + // Activate notifications for IAP check purposes. Done with every server startup. - // When EWlanConnectionModeNotConnected is received we can cancel this and - // we know that it safe to go through IAPs. + // When EWlanConnectionModeNotConnected is received we can cancel this. iMgtClient = CWlanMgmtClient::NewL(); #ifndef __WINS__ iMgtClient->ActivateNotificationsL( *this ); @@ -202,94 +185,119 @@ iMgtClient->CancelNotifications(); #endif } - - TRAPD(err, CheckIapsL()); - if ( err != KErrNone ) - { - DEBUG1("CHotSpotServer::ConnectionStateChanged(): %d", err); - } + if ( iClientIapsChecked != KErrNone ) + { + TRAP_IGNORE( FindClientIapsL() ); + } + TRAPD(err, CheckIapsL()); + if ( err != KErrNone ) + { + DEBUG1("CHotSpotServer::ConnectionStateChanged(): %d", err); + } } } // ----------------------------------------------------------------------------- +// FindClientIapsL +// ----------------------------------------------------------------------------- +// +void CHotSpotServer::FindClientIapsL() + { + DEBUG("CHotSpotServer::FindClientIapsL()"); + RCmManagerExt cmManager; + cmManager.OpenL(); + CleanupClosePushL(cmManager); + + RArray cmArray; + CleanupClosePushL( cmArray ); + TBool supportedBearersOnly = ETrue; + TBool legacyCmsOnly = EFalse; + + cmManager.ConnectionMethodL( cmArray, supportedBearersOnly, legacyCmsOnly ); + DEBUG1("CHotSpotServer::FindClientIapsL count: %d", cmArray.Count()); + + for( TInt i = 0; i < cmArray.Count(); i++ ) + { + RCmConnectionMethodExt cm = cmManager.ConnectionMethodL( cmArray[i] ); + CleanupClosePushL( cm ); + HBufC* daemonName = cm.GetStringAttributeL( + ECmConfigDaemonManagerName ); + CleanupStack::PushL( daemonName ); + if ( daemonName ) + { + if ( daemonName->Compare( KHotSpotPlugin ) == 0 ) + { + DEBUG("CHotSpotServer::FindClientIapsL() Client found"); + TBuf clientUid; + TUid uid(TUid::Null()); + TUint iapId = cm.GetIntAttributeL( ECmIapId ); + HBufC* client = cm.GetStringAttributeL( + EWlanServiceExtensionTableName ); + clientUid.Copy( client->Des() ); + delete client; + SetClientIap( iapId, clientUid ); + DEBUG1("CHotSpotServer::FindClientIapsL() iapId: %d", iapId ); + } + } + CleanupStack::PopAndDestroy( daemonName ); + CleanupStack::PopAndDestroy( &cm ); + } + CleanupStack::PopAndDestroy( &cmArray ); + + // Read Easy WLAN IAP ID + iEasyWlanId = cmManager.EasyWlanIdL(); + CleanupStack::PopAndDestroy( &cmManager ); + DEBUG1("CHotSpotServer::FindClientIapsL() iEasyWlanId: % d", iEasyWlanId); + } + +// ----------------------------------------------------------------------------- // CheckIapsL // ----------------------------------------------------------------------------- // void CHotSpotServer::CheckIapsL() { DEBUG("CHotSpotServer::CheckIapsL"); - - _LIT(KMarkFirst, "[" ); - _LIT(KMarkLast, "]" ); - // This is needed to be checked only once per boot - if ( iIapCheckValue == EFalse ) + // This is needed to be checked only once per boot + iIapCheckValue = ETrue; + TInt count = iClientIaps.Count(); + + // Check the array. Not supposed to be many elements. + for( TInt i = 0; i < count; i++ ) { - iIapCheckValue = ETrue; + TLex lex( iClientIaps[i].iClientUid ); + TUint value( 0 ); + lex.Val( value, EHex ); + TUid client = TUid::Null(); + client.iUid = value; - RCmManagerExt cmManager; - cmManager.OpenL(); - CleanupClosePushL(cmManager); + // Try to find if plugin exists + CHssClientPlugin* plugin(NULL); + TBuf8 nullBuf; + TRAPD( error, plugin = CHssClientPlugin::NewL( client, nullBuf ) ); + delete plugin; - 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++ ) + DEBUG1("CHotSpotServer::CheckIapsL find client error: %d", error ); + if ( error == KErrNotFound ) { + // Remove from database + RCmManagerExt cmManager; + cmManager.OpenL(); + CleanupClosePushL(cmManager); + 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"); + cm = cmManager.ConnectionMethodL( iClientIaps[i].iIapId ); + CleanupClosePushL( cm ); + cmManager.RemoveAllReferencesL( cm ); + cm.DeleteL(); + + CleanupStack::PopAndDestroy( &cm ); + CleanupStack::PopAndDestroy( &cmManager ); + + // Remove from array + RemoveClientIap( iClientIaps[i].iIapId ); + count--; + i--; } - CleanupStack::PopAndDestroy( &cmArray ); - CleanupStack::PopAndDestroy( &cmManager ); } DEBUG("CHotSpotServer::CheckIapsL Done"); } @@ -472,33 +480,14 @@ 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 ) { + DEBUG1( "HotspotServer::RunError = %d", aError ); // error from CHotSpotSession::ServiceL Message().Complete( aError ); // Continue reading client requests @@ -510,16 +499,17 @@ // GetLoginTimerMicroSecs // ----------------------------------------------------------------------------- // -TUint CHotSpotServer::GetLoginTimeMicroSecs( TUid aClientUid ) +TUint CHotSpotServer::GetLoginTimeMicroSecs( TDes& aClientUid ) { + DEBUG("HotspotServer::GetLoginTimeMicroSecs()"); // Default timer value will be returned if matching client UID isn't found. TUint retval = KHssDefaultLoginTimeMicroSecs ; - TInt ret = CHotSpotServer::FindClientUid( aClientUid ); + TInt ret = FindClientUid( aClientUid ); if (ret != KErrNotFound) { // ret is the matching element's index. - retval = iLoginLogoutTimerArray[ret].loginTimeMicroSecs; + retval = iLoginLogoutTimerArray[ret].iLoginTimeMicroSecs; } return retval; @@ -529,16 +519,17 @@ // GetLogoutTimerMicroSecs // ----------------------------------------------------------------------------- // -TUint CHotSpotServer::GetLogoutTimeMicroSecs( TUid aClientUid ) +TUint CHotSpotServer::GetLogoutTimeMicroSecs( TDes& aClientUid ) { + DEBUG("HotspotServer::GetLogoutTimeMicroSecs()"); // Default timer value will be returned if matching client UID isn't found. TUint retval = KHssDefaultLogoutTimeMicroSecs ; - TInt ret = CHotSpotServer::FindClientUid( aClientUid ); + TInt ret = FindClientUid( aClientUid ); if (ret != KErrNotFound) { // ret is the matching element's index. - retval = iLoginLogoutTimerArray[ret].logoutTimeMicroSecs; + retval = iLoginLogoutTimerArray[ret].iLogoutTimeMicroSecs; } return retval; @@ -549,11 +540,12 @@ // ----------------------------------------------------------------------------- // void CHotSpotServer::SetTimerValues( - TUid aClientUid, + TDes& aClientUid, TUint aLoginTimerValue, // in seconds TUint aLogoutTimerValue ) // in seconds { - TInt ret = CHotSpotServer::FindClientUid( aClientUid ); + DEBUG("HotspotServer::SetTimerValues()"); + TInt ret = FindClientUid( aClientUid ); TUint loginTimeMicroSecs = KHssDefaultLoginTimeMicroSecs ; TUint logoutTimeMicroSecs = KHssDefaultLogoutTimeMicroSecs ; @@ -574,8 +566,8 @@ { DEBUG("CHotSpotServer::SetTimerValues(): Existing client modified."); // ret is the matching element's index. - iLoginLogoutTimerArray[ret].loginTimeMicroSecs = loginTimeMicroSecs; - iLoginLogoutTimerArray[ret].logoutTimeMicroSecs = logoutTimeMicroSecs; + iLoginLogoutTimerArray[ret].iLoginTimeMicroSecs = loginTimeMicroSecs; + iLoginLogoutTimerArray[ret].iLogoutTimeMicroSecs = logoutTimeMicroSecs; } else { @@ -593,16 +585,18 @@ // FindClientUid // ----------------------------------------------------------------------------- // -TInt CHotSpotServer::FindClientUid( TUid aClientUid ) +TInt CHotSpotServer::FindClientUid( TDes& aClientUid ) { + DEBUG("CHotspotServer::FindClientUid()"); TInt count = iLoginLogoutTimerArray.Count(); TInt i = 0; TInt ret = KErrNotFound; - while (i < count) + while ( i < count ) { - if (aClientUid == iLoginLogoutTimerArray[i].clientUid) + if ( aClientUid.Compare( iLoginLogoutTimerArray[i].iClientUid ) == 0 ) { + DEBUG("CHotspotServer::FindClientUid() FOUND"); ret = i; break; } @@ -612,6 +606,75 @@ return ret; } +// ----------------------------------------------------------------------------- +// GetClientUid +// ----------------------------------------------------------------------------- +// +TInt CHotSpotServer::GetClientUid( TUint aIapId, TDes& aUid ) + { + DEBUG("CHotspotServer::GetClientUid()"); + TInt ret( KErrNotFound ); + TInt count = iClientIaps.Count(); + TInt i = 0; + + while ( i < count ) + { + if ( aIapId == iClientIaps[i].iIapId ) + { + DEBUG("CHotspotServer::GetClientUid() FOUND"); + aUid = iClientIaps[i].iClientUid; + ret = KErrNone; + break; + } + i++; + } + + return ret; + } + +// ----------------------------------------------------------------------------- +// SetClientIap +// ----------------------------------------------------------------------------- +// +void CHotSpotServer::SetClientIap( TUint aIapId, TDes& aUid ) + { + DEBUG("CHotspotServer::SetClientIap()"); + SClientIaps clientElement = { aIapId, aUid }; + iClientIaps.Append( clientElement ); + } + +// ----------------------------------------------------------------------------- +// RemoveClientIap +// ----------------------------------------------------------------------------- +// +void CHotSpotServer::RemoveClientIap( TUint aIapId ) + { + DEBUG("CHotspotServer::RemoveClientIap()"); + TInt count = iClientIaps.Count(); + TInt i = 0; + + while ( i < count ) + { + if ( aIapId == iClientIaps[i].iIapId ) + { + DEBUG("CHotspotServer:::RemoveClientIap() FOUND"); + iClientIaps.Remove( i ); + break; + } + i++; + } + } + +// ----------------------------------------------------------------------------- +// GetEasyWlanId +// ----------------------------------------------------------------------------- +// +TInt CHotSpotServer::GetEasyWlanId() + { + DEBUG("CHotspotServer::GetEasyWlanId()"); + return iEasyWlanId; + } + // ========================== OTHER EXPORTED FUNCTIONS ========================= // ----------------------------------------------------------------------------- diff -r ff3b37722600 -r 10810c91db26 hotspotfw/hsserver/src/hotspotsession.cpp --- a/hotspotfw/hsserver/src/hotspotsession.cpp Tue Jan 26 13:04:04 2010 +0200 +++ b/hotspotfw/hsserver/src/hotspotsession.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -148,29 +148,29 @@ void CHotSpotSession::DispatchMessageL( const RMessage2& aMessage ) { DEBUG( "CHotSpotSession::DispatchMessageL()" ); - TUint value1(NULL); - TInt value2(NULL); - TInt err(KErrNone); - TInt indx(KErrNone); + TInt value( NULL ); + TInt err( KErrNone ); + TInt indx( KErrNone ); TPckgBuf iapPackage( iIapId ); switch ( aMessage.Function() ) { case EHssActivateNotifications : + DEBUG( "CHotSpotSession::ActivateNotificationsL" ); iAllowNotifications = EFalse; - DEBUG( "CHotSpotSession::ActivateNotificationsL" ); + if ( iNotifications == NULL ) { - DEBUG( "CHotSpotSession::DispatchMessageL activated !!!" ); - iNotifications = new (ELeave) HssNotifications(*this); + iNotifications = new ( ELeave ) HssNotifications( *this ); iMgtClient->ActivateNotificationsL( *iNotifications ); } HandleOrderNotifications( aMessage ); break; case EHssCancelNotifications : + DEBUG( "CHotSpotSession::CancelNotifications" ); iAllowNotifications = EFalse; - DEBUG( "CHotSpotSession::CancelNotifications" ); iMgtClient->CancelNotifications( ); + if ( iNotifications != NULL ) { delete iNotifications; @@ -178,9 +178,6 @@ iNotifications = NULL; HandleCancelNotifications( aMessage ); break; - case EHssGetScanResults : - // Handled now in client side. Left here for future use. - break; case EHssRegister : ProcessRegisterL( aMessage ); break; @@ -189,17 +186,16 @@ break; case EHssJoin : iAllowNotifications = EFalse; - // IAP id - value1 = ( TInt )aMessage.Int0(); - iIapId = value1; - indx = iServer.FindMessage(value1, EHssStart ); + iIapId = ( TInt )aMessage.Int0(); + + indx = iServer.FindMessage( iIapId, EHssStart ); if ( indx >= 0 ) { iServer.CompleteMessage( indx , KErrNone ); } else { - indx = iServer.FindMessage(value1, EHssStartAgain ); + indx = iServer.FindMessage( iIapId, EHssStartAgain ); if ( indx >= 0 ) { iServer.CompleteMessage( indx , KErrNone ); @@ -211,8 +207,8 @@ 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 ) { @@ -226,42 +222,38 @@ 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); + 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(); + iIapId = ( TInt )aMessage.Int0(); + value = ( TInt )aMessage.Int1(); - iLoginTimer->Cancel(); - - DEBUG1( "EHssLoginComplete value2: %d", value2 ); - indx = iServer.FindMessage( value1, EHssStartLogin ); + DEBUG1( "EHssLoginComplete return value: %d", value ); + indx = iServer.FindMessage( iIapId, EHssStartLogin ); if ( KErrNotFound != indx ) { - if (value2 == KErrNone) + if ( value == KErrNone ) { DEBUG( "EHssLoginComplete1" ); iServer.CompleteMessage( indx, KErrNone ); @@ -279,11 +271,9 @@ case EHssLogoutComplete : iAllowNotifications = EFalse; iLogoutTimer->Cancel(); + iIapId = ( TInt )aMessage.Int0(); - // IAP id - value1 = ( TInt )aMessage.Int0(); - - indx = iServer.FindMessage( value1, EHssCloseConnection ); + indx = iServer.FindMessage( iIapId, EHssCloseConnection ); if ( KErrNotFound != indx ) { iServer.CompleteMessage( indx, KErrNone ); @@ -294,10 +284,9 @@ 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 ) { @@ -339,18 +328,17 @@ aMessage.Complete( KErrNone ); break; case EHssStart: - // IAP id iServer.SetLoginFlag( ETrue ); iIapId = ( TInt )aMessage.Int0(); err = iServer.SaveMessage( iIapId, aMessage, EHssStart ); - if ( err != KErrNone) + + if ( err != KErrNone) { aMessage.Complete( err ); } else { TRAPD( startLeaved, err = ProcessStartL( iIapId ) ); - if ( startLeaved != KErrNone) { indx = iServer.FindMessage(iIapId, EHssStart ); @@ -363,7 +351,6 @@ aMessage.Complete( KErrNotSupported ); } } - else if ( err != KErrNone) { indx = iServer.FindMessage(iIapId, EHssStart ); @@ -376,16 +363,14 @@ 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) + + if ( err != KErrNone) { aMessage.Complete( err ); } @@ -406,12 +391,11 @@ } } break; + case EHssCancel: + iLoginTimer->Cancel(); + iLogoutTimer->Cancel(); + iIapId = ( TInt )aMessage.Int0(); - 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 @@ -433,17 +417,11 @@ { iServer.CompleteMessage( indx , KErrCancel ); } - //Not needed to send Logout() - //iServer.SetLogoutFlag( ETrue ) - //ProcessCloseL( iIapId ) aMessage.Complete( KErrNone ); - break; - + break; case EHssCloseConnection: iLoginTimer->Cancel(); iLogoutTimer->Cancel(); - - // IAP id iIapId = ( TInt )aMessage.Int0(); if ( iServer.GetAssociationFlagValue() ) @@ -476,21 +454,18 @@ } } 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(); @@ -502,26 +477,25 @@ AuthenticateL( ptr ); CleanupStack::PopAndDestroy(buf); + break; } - break; - case EHssSetTimerValues: { TUid clientUid( TUid::Uid( aMessage.Int0() ) ); + TBuf uid; + uid.Copy( clientUid.Name() ); + ModifyClientUid( uid ); TUint loginTimerValue = aMessage.Int1(); TUint logoutTimerValue = aMessage.Int2(); - iServer.SetTimerValues( clientUid, loginTimerValue, logoutTimerValue ); + iServer.SetTimerValues( uid, loginTimerValue, logoutTimerValue ); aMessage.Complete( KErrNone ); + break; } - break; - default: aMessage.Complete( KErrNotSupported ); - //PanicClient( aMessage, EBadRequest ) break; } iAllowNotifications = TRUE; - } // --------------------------------------------------------- @@ -698,16 +672,17 @@ iServer.CompleteMessage( indx, KErrCancel ); } - TUid clientUid; TBuf8 extAPI; - TRAP_IGNORE( iIapSettingsHandler->FindClientL( iIapId, clientUid, extAPI ) ); - - // 3rd party client was found - if ( clientUid != TUid::Null() ) + TBuf clientUid; + TInt err = iServer.GetClientUid( iIapId, clientUid ); + + if ( err != KErrNotFound ) { DEBUG("CHotSpotSession::LoginTimeout clientUid = CLIENT"); + ConvertTBufToTUid( clientUid ); TBuf8 nullBuf; - TInt ret = CreateClient( clientUid, nullBuf ); + + TInt ret = CreateClient( iClientUid, nullBuf ); DEBUG1("CHotSpotSession::LoginTimeout CreateClient ret: %d", ret); if ( KErrNone == ret ) { @@ -754,21 +729,24 @@ aMessage.ReadL( 1, iapPckg ); iapName = iapPckg().IapName(); + TBuf bufUid; + bufUid.Copy( clientUid.Name() ); + ModifyClientUid( bufUid ); + 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 )); + TRAP( ret, iIapSettingsHandler->CreateClientIapL( iapName, iapId, bufUid )); DEBUG1( "CHotSpotSession::EHssRegister iapId: %d", iapId ); DEBUG1( "CHotSpotSession::EHssRegister ret: %d", ret ); if ( KErrNone == ret ) { + iServer.SetClientIap( iapId, bufUid ); 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 ); @@ -787,10 +765,10 @@ // Read message TInt iapId = ( TInt )aMessage.Int0(); - + iServer.RemoveClientIap( iapId ); // Check that this is not Easy WLAN - TRAP_IGNORE( EasyWlanIdL() ); - if ( iEasyWlanId != iapId ) + TInt easyWlan = iServer.GetEasyWlanId(); + if ( easyWlan != iapId ) { TRAPD( err, iIapSettingsHandler->DeleteIapL( iapId ) ); // return KErrGeneral if IAP removal is not successful @@ -802,9 +780,9 @@ else { ret = KErrPermissionDenied; - } - + } aMessage.Complete( ret ); + DEBUG("CHotSpotSession::ProcessUnRegisterL DONE"); } // ----------------------------------------------------------------------------- @@ -815,13 +793,12 @@ { DEBUG("CHotSpotSession::ProcessStartLogin"); TInt ret( KErrNotFound ); - TUid clientUid; TBuf8 extAPI; iIapId = aIapId; // Check if Easy WLAN. - TRAP_IGNORE( EasyWlanIdL() ); - if ( iEasyWlanId == aIapId ) + TInt easyWlan = iServer.GetEasyWlanId(); + if ( easyWlan == aIapId ) { DEBUG("CHotSpotSession::ProcessStartLogin Easy WLAN detected"); // Just test internet connectivity and complete message later @@ -830,14 +807,16 @@ return ret; } - iIapSettingsHandler->FindClientL( aIapId, clientUid, extAPI ); + TBuf clientUid; + TInt err = iServer.GetClientUid( aIapId, clientUid ); - // 3rd party client was found - if ( clientUid != TUid::Null() ) + if ( err != KErrNotFound ) { DEBUG("CHotSpotSession::ProcessStartLogin clientUid = CLIENT"); + ConvertTBufToTUid( clientUid ); TBuf8 nullBuf; - ret = CreateClient( clientUid, nullBuf ); + + ret = CreateClient( iClientUid, nullBuf ); if ( KErrNone == ret && iServer.GetLoginFlagValue() ) { @@ -865,9 +844,10 @@ TInt ret( KErrNone ); TBuf8 extAPI; + TBuf clientUid; - iIapSettingsHandler->FindClientL( aIapId, iClientUid, extAPI ); - if ( iClientUid == TUid::Null() ) + TInt err = iServer.GetClientUid( aIapId, clientUid ); + if ( err != KErrNone ) { DEBUG("CHotSpotSession::ProcessStartL clientUid = EMPTY"); @@ -876,6 +856,8 @@ else { DEBUG("CHotSpotSession::ProcessStartL clientUid = CLIENT"); + ConvertTBufToTUid( clientUid ); + TBuf8 nullBuf; // Try first with API extension defined ret = CreateClient( iClientUid, extAPI ); @@ -911,7 +893,7 @@ // Client exists if StartAgain is called. if ( iClient == NULL ) { - TBuf8 nullBuf; + TBuf8 nullBuf; ret = CreateClient( iClientUid, nullBuf ); } @@ -978,11 +960,11 @@ { DEBUG("CHotSpotSession::ProcessCloseL"); TInt ret( KErrNone ); - TUid clientUid; TBuf8 extAPI; - - iIapSettingsHandler->FindClientL( aIapId, clientUid, extAPI ); - if ( clientUid == TUid::Null() ) + TBuf clientUid; + + TInt err = iServer.GetClientUid( aIapId, clientUid ); + if ( err != KErrNone ) { DEBUG("CHotSpotSession::ProcessCloseL clientUid = EMPTY"); // do nothing @@ -993,8 +975,15 @@ DEBUG("CHotSpotSession::ProcessCloseL clientUid = CLIENT"); if ( iClient == NULL ) { + //Convert TBuf to TUid + TLex lex( clientUid ); + TUint value( 0 ); + lex.Val( value, EHex ); + iClientUid = TUid::Null(); + iClientUid.iUid = value; TBuf8 nullBuf; - ret = CreateClient( clientUid, nullBuf ); + + ret = CreateClient( iClientUid, nullBuf ); } else { @@ -1142,22 +1131,36 @@ } // ----------------------------------------------------------------------------- -// EasyWlanIdL +// ModifyClientUid // ----------------------------------------------------------------------------- // -void CHotSpotSession::EasyWlanIdL() +void CHotSpotSession::ModifyClientUid( TDes& aUid ) { - DEBUG("CHotSpotSession::EasyWlanIdL()"); - // Set to default value just in case - iEasyWlanId = KEasyWlanServiceId; - - RCmManagerExt cmManager; - cmManager.OpenL(); - CleanupClosePushL( cmManager ); - - iEasyWlanId = cmManager.EasyWlanIdL(); - DEBUG1("CHotSpotSession::EasyWlanIdL() ret: % d", iEasyWlanId); - CleanupStack::PopAndDestroy( &cmManager ); + DEBUG("CHotSpotSession::ModifyClientUid"); + TInt indx = aUid.Find( KMark1 ); + if ( KErrNotFound != indx ) + { + aUid.Delete( indx, 1 ); + indx = aUid.Find( KMark2 ); + if ( KErrNotFound != indx ) + { + aUid.Delete( indx, 1 ); + } + } + } + +// ----------------------------------------------------------------------------- +// ConvertTBufToTUid +// ----------------------------------------------------------------------------- +// +void CHotSpotSession::ConvertTBufToTUid( TDes& aUid ) + { + DEBUG("CHotSpotSession::ConvertTBufToTUid"); + TLex lex( aUid ); + TUint value( 0 ); + lex.Val( value, EHex ); + iClientUid = TUid::Null(); + iClientUid.iUid = value; } // ----------------------------------------------------------------------------- @@ -1168,32 +1171,32 @@ { DEBUG1( "CHotSpotSession::ConnectionStateChanged() aNewState=%d", aNewState ); switch ( aNewState ) + { + case EWlanConnectionModeSearching: { - 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 ); - } + 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 ff3b37722600 -r 10810c91db26 hotspotfw/hsserver/src/hssiapsettingshandler.cpp --- a/hotspotfw/hsserver/src/hssiapsettingshandler.cpp Tue Jan 26 13:04:04 2010 +0200 +++ b/hotspotfw/hsserver/src/hssiapsettingshandler.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -77,8 +77,8 @@ // ----------------------------------------------------------------------------- // void CHssIapSettingsHandler::CreateClientIapL( const TDesC& aIapName, - TUint32& aIapId, - const TUid aUid ) + TUint32& aIapId, + const TDesC& aUid ) { DEBUG("CHssIapSettingsHandler::CreateClientIapL"); @@ -106,7 +106,7 @@ plugin.SetStringAttributeL( ECmName, aIapName ); plugin.SetStringAttributeL( EWlanSSID, aIapName ); - plugin.SetStringAttributeL( EWlanServiceExtensionTableName, aUid.Name() ); + plugin.SetStringAttributeL( EWlanServiceExtensionTableName, aUid ); plugin.SetStringAttributeL( ECmConfigDaemonManagerName, KHotSpotPlugin ); plugin.SetBoolAttributeL( ECmProtected, ETrue ); @@ -164,8 +164,7 @@ HBufC* ssid( NULL ); TWlanSsid ssidConn; - wlanMgmtClient->GetConnectionSsid( ssidConn ); - + User::LeaveIfError( wlanMgmtClient->GetConnectionSsid( ssidConn ) ); ssid = HBufC::NewLC( ssidConn.Length() ); ssid->Des().Copy( ssidConn ); @@ -235,60 +234,11 @@ 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" + DEBUG1("CHssIapSettingsHandler:::DeleteIapL result = %d ", result); + CleanupStack::PopAndDestroy( &plugin ); CleanupStack::PopAndDestroy( &cmManager ); - DEBUG("CHssIapSettingsHandler::FindClientL"); - - return ret; } // --------------------------------------------------------- diff -r ff3b37722600 -r 10810c91db26 hotspotfw/internetconnectivitytestservice/src/ictshttphandler.cpp --- a/hotspotfw/internetconnectivitytestservice/src/ictshttphandler.cpp Tue Jan 26 13:04:04 2010 +0200 +++ b/hotspotfw/internetconnectivitytestservice/src/ictshttphandler.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -90,6 +90,11 @@ CIctsHttpHandler::~CIctsHttpHandler() { DEBUG("CIctsHttpHandler::~CIctsHttpHandler()"); + RHTTPTransaction notActive; + if ( iHttpTransaction != notActive ) + { + iHttpTransaction.Close(); + } iHttpSession.Close(); CTimer::Cancel(); iConnection.Close(); @@ -243,7 +248,11 @@ { DEBUG("CIctsHttpHandler::CancelHttpRequestL()"); CTimer::Cancel(); - iHttpTransaction.Cancel(); + RHTTPTransaction notActive; + if ( iHttpTransaction != notActive ) + { + iHttpTransaction.Close(); + } } // --------------------------------------------------------------------------- @@ -253,7 +262,11 @@ void CIctsHttpHandler::RunL() { DEBUG("CIctsHttpHandler::RunL()"); - iHttpSession.Close(); + RHTTPTransaction notActive; + if ( iHttpTransaction != notActive ) + { + iHttpTransaction.Close(); + } iString = KNullDesC; iOwner.HttpEventL( ETimeout, iString ); } @@ -296,10 +309,6 @@ { 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; } @@ -332,23 +341,17 @@ 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 ); } @@ -371,24 +374,21 @@ 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 ); - } + { + DEBUG1( "CIctsHttpHandler::MHFRunL::default iStatus: %d", aEvent.iStatus ); + CTimer::Cancel(); + if ( aEvent.iStatus < 0 ) + { + _LIT(string, "Unknown error"); + iString = string; + iOwner.HttpEventL( EConnectionNotOk, iString ); + } + else + { + _LIT(string, "Default"); + iString = string; + iOwner.HttpEventL( EConnectionNotOk, iString ); + } } break; } diff -r ff3b37722600 -r 10810c91db26 hotspotfw/rom/hotspot.iby --- a/hotspotfw/rom/hotspot.iby Tue Jan 26 13:04:04 2010 +0200 +++ b/hotspotfw/rom/hotspot.iby Fri Apr 16 16:07:56 2010 +0300 @@ -44,6 +44,8 @@ S60_APP_AIF_ICONS( hsbrowsericon ) data=ZPRIVATE\10282EC5\backup_registration.xml private\10282EC5\backup_registration.xml +data=DATAZ_\system\install\hotspotfwstub.sis system\install\hotspotfwstub.sis +data=DATAZ_\system\install\ictsstub.sis system\install\ictsstub.sis #endif // __PROTOCOL_WLAN #endif // HOTSPOTS_IBY \ No newline at end of file diff -r ff3b37722600 -r 10810c91db26 hotspotfw/rom/hotspotfwstub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/rom/hotspotfwstub.pkg Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,50 @@ +; +; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies 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 stub package file for Hotspot Framework +; + +;Languages +; - None (English only by default) + +;Header +#{"Hotspot Framework"},(0x10282ECB),1,0,0,TYPE=SA + +; Product / platform version compatibility - S60 5.2 +[0x20022e6d],0,0,0,{"Series60ProductID"} + +; Localised Vendor Name +%{"Nokia"} + +;Unique Vendor Name +:"Nokia" + +; Server stub +""-"z:\sys\bin\HotSpotServer.exe" + +; Client stub +""-"z:\sys\bin\hotspotclient.dll" + +; Hotspot daemon plugin stub +""-"z:\sys\bin\NetCfgExtnHotSpot.dll" +""-"z:\resource\plugins\NetCfgExtnHotSpot.RSC" + +; Hotspot Management API stub +""-"z:\sys\bin\hssmgmtimpl.dll" +""-"z:\resource\plugins\HssMgmtImpl.rsc" + +; Plugin interface for WLAN Agent stub +""-"z:\sys\bin\wlanagthotspotimpl.dll" +""-"z:\resource\plugins\WlanAgtHotSpotImpl.RSC" + + diff -r ff3b37722600 -r 10810c91db26 hotspotfw/rom/hotspotfwstub.sis Binary file hotspotfw/rom/hotspotfwstub.sis has changed diff -r ff3b37722600 -r 10810c91db26 hotspotfw/rom/ictsstub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/rom/ictsstub.pkg Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,35 @@ +; +; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies 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 stub package file for +; Internet Connectivity Test Service +; + +;Languages +; - None (English only by default) + +;Header +#{"Internet Connectivity Test"},(0x10282EC5),1,0,0,TYPE=SA + +; Product / platform version compatibility - S60 5.2 +[0x20022e6d],0,0,0,{"Series60ProductID"} + +; Localised Vendor Name +%{"Nokia"} + +;Unique Vendor Name +:"Nokia" + +; Internet Connectivity Test stub +""-"z:\sys\bin\ictsclientinterface.dll" + diff -r ff3b37722600 -r 10810c91db26 hotspotfw/rom/ictsstub.sis Binary file hotspotfw/rom/ictsstub.sis has changed diff -r ff3b37722600 -r 10810c91db26 layers.sysdef.xml --- a/layers.sysdef.xml Tue Jan 26 13:04:04 2010 +0200 +++ b/layers.sysdef.xml Fri Apr 16 16:07:56 2010 +0300 @@ -1,13 +1,14 @@ - ]> - + - + + diff -r ff3b37722600 -r 10810c91db26 package_definition.xml --- a/package_definition.xml Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r ff3b37722600 -r 10810c91db26 sysdef_1_4_0.dtd --- a/sysdef_1_4_0.dtd Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r ff3b37722600 -r 10810c91db26 sysdef_1_5_1.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_5_1.dtd Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r ff3b37722600 -r 10810c91db26 wirelessacc.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wirelessacc.pro Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,25 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = subdirs + +SUBDIRS += wlanutilities + +CONFIG += ordered + +symbian*: { + SYMBIAN_PLATFORMS = WINSCW ARMV5 +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/cpwlansettingsplugin/cpwlansettingsplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/cpwlansettingsplugin/cpwlansettingsplugin.pro Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,63 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = cpwlansettingsplugin +CONFIG += hb plugin + +INCLUDEPATH += traces + +HEADERS += inc/cpwlansettingsplugin.h \ + inc/cpwlansettingsgroupitemdata.h \ + inc/wlansettings.h \ + inc/wlansettings_s60_p.h \ + traces/OstTraceDefinitions.h + +SOURCES += src/cpwlansettingsplugin.cpp \ + src/cpwlansettingsgroupitemdata.cpp \ + src/wlansettings.cpp \ + src/wlansettings_s60.cpp + +TRANSLATIONS = cpwlansettingsplugin.ts + +LIBS += -lcpframework \ + -lcentralrepository \ + -lCOMMSDAT \ + -lcmmanagerdatabase \ + -lcmmanager \ + -lecom \ + -lxqsettingsmanager + +symbian: { + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.UID3 = 0x2002DC79 + SYMBIAN_PLATFORMS = WINSCW ARMV5 + + BLD_INF_RULES.prj_exports += "rom/cpwlansettingsplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(cpwlansettingsplugin.iby)" + BLD_INF_RULES.prj_exports += "rom/cpwlansettingsplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(cpwlansettingsplugin_resources.iby)" +} +symbian { + deploy.path = C: + qtplugins.path = /resource/qt/plugins/controlpanel + qtplugins.sources += qmakepluginstubs/cpwlansettingsplugin.qtplugin + + # This is for new exporting system coming in garden + for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin $$deploy.path$$qtplugins.path/$$basename(qtplugin)" +} +TARGET.CAPABILITY = CAP_GENERAL_DLL +plugin.sources = cpwlansettingsplugin.dll +plugin.path = /resource/qt/plugins/controlpanel +DEPLOYMENT += plugin diff -r ff3b37722600 -r 10810c91db26 wlanutilities/cpwlansettingsplugin/inc/cpwlansettingsgroupitemdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/cpwlansettingsplugin/inc/cpwlansettingsgroupitemdata.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef WLANSETTINGSGROUPITEMDATA_H_ +#define WLANSETTINGSGROUPITEMDATA_H_ + +// System includes + +#include +#include +#include +#include + +// User includes + +// Forward declarations + +class WlanSettings; + +// External data types + +// Constants + +// Class declaration + +class CpWlanSettingsGroupItemData: public CpSettingFormItemData +{ + Q_OBJECT + +public: + explicit CpWlanSettingsGroupItemData(CpItemDataHelper &itemDataHelper); + + virtual ~CpWlanSettingsGroupItemData(); + +private slots: + void scanItemChanged(const QString &text); + + void powerSavingItemChanged(int index); + + void joinWlanItemChanged(int index); + + void scanSliderPressed(); + + void scanValueChanged(int value); + + void scanSliderReleased(); + +private: + + Q_DISABLE_COPY(CpWlanSettingsGroupItemData) + + void createScanIntervalItem(); + + void initialise(); + + void createWlanSettingItems(); + +private: // data + + CpSettingFormItemData *mJoinWlanItem; + CpSettingFormItemData *mScanNetworkItem; + CpSettingFormItemData *mPowerSavingItem; + CpSettingFormItemData *mUserDefinedItem; + + CpItemDataHelper &mItemDataHelper; + + int mScanInterval; + + //WlanSettings *mWlanSettings; + QScopedPointer mWlanSettings; +}; + +#endif /* WLANSETTINGSGROUPITEMDATA_H_ */ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/cpwlansettingsplugin/inc/cpwlansettingsplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/cpwlansettingsplugin/inc/cpwlansettingsplugin.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef WLANSETTINGSPLUGIN_H_ +#define WLANSETTINGSPLUGIN_H_ + +// System includes + +#include +#include +#include + +// User includes + +// Forward declarations + +// External data types + +// Constants + +// Class declaration + +class CpWlanSettingsPlugin + : public QObject, + public CpPluginInterface +{ + Q_OBJECT + Q_INTERFACES(CpPluginInterface) +public: + CpWlanSettingsPlugin(); + virtual ~CpWlanSettingsPlugin(); + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; + +private: + + Q_DISABLE_COPY(CpWlanSettingsPlugin) + +private: //data + + QTranslator *translator; + +}; + + +#endif /* WLANSETTINGSPLUGIN_H_ */ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/cpwlansettingsplugin/inc/wlansettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/cpwlansettingsplugin/inc/wlansettings.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef WLANSETTINGS_H_ +#define WLANSETTINGS_H_ + +// System includes + +#include + +// User includes + +#include "wlansettings_s60_p.h" + +// Forward declarations + +// External data types + +// Constants + +// Class declaration + +class WlanSettings : public QObject +{ + Q_OBJECT + +public: + + enum ScanNetworkType { + EScanNetworkAuto = 0, + EScanNetworkUserDefined + }; + + WlanSettings(); + + ~WlanSettings(); + + int init(); + + int loadSettings(); + + ScanNetworkType scanNetworkType(); + + uint scanInterval(); + + int joinWlanMode() const; + + int setJoinWlanMode(int mode); + + int isPowerSavingEnabled() const; + + int isPsmEnabled() const; + + int setWlanPowerSaving(int powerSavingOption); + + int setWlanScanInterval(uint scanInterval); + +private: + + void readPsmKey(); + + Q_DISABLE_COPY(WlanSettings) + +private: //data + + CWlanSettingsPrivate *mImpl; + + int mPsmKeyValue; + +}; + + +#endif /* WLANSETTINGS_H_ */ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/cpwlansettingsplugin/inc/wlansettings_s60_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/cpwlansettingsplugin/inc/wlansettings_s60_p.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,120 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef WLANSETTINGS_S60_H_ +#define WLANSETTINGS_S60_H_ + +// System includes + +#include +#include +#include +#include +#include + +// User includes + +// Forward declarations + +// External data types + +// Constants +/** Value for automatic scanning. */ +LOCAL_D const TUint KWlanSettingsScanNetworkAuto = 0xFFFFFFFF; + +/** Default "Scan Networks" setting. */ +LOCAL_D const TUint KWlanSettingsDefaultScanNetwork = + KWlanSettingsScanNetworkAuto; + +/** Default "Power saving" setting. */ +LOCAL_D const TBool KWlanSettingsDefaultPowerSaving = ETrue; + +// Class declaration + +class CWlanSettingsPrivate : public CBase +{ +public: + + enum JoinWlanType { + EJoinWlanKnown = 0, + EJoinWlanManual + }; + + enum WlanOption { + EWlanPowerSaving = 0, + EWlanScanInterval + }; + + static CWlanSettingsPrivate* NewL(int psmKeyValue); + + ~CWlanSettingsPrivate(); + + void LoadDBSettingsL(); + + void SaveDBSettingsL(TInt option); + + TUint ScanInterval(); + + TBool PowerSaving(); + + TInt JoinWlanMode(); + + void SaveJoinWlanSettingL(TInt mode); + + void SetScanInterval(TUint interval); + + void SetPowerSaving(TBool powerSavingOption); + + TBool IsPsmEnabled(); + +private: + + CWlanSettingsPrivate(int psmKeyValue); + + void ConstructL(); + + void CheckPsmModeL(); + + void LoadJoinWlanSettingL(); + +private: //data + + CommsDat::CMDBSession *mSession; + + //Wlan management + CWlanMgmtClient *mWlanMgmtClient; + + // Full or partial PSM mode. + TBool mPsmMode; + + // Power saving. + TBool mPowerSaving; + + // Scan networks interval in seconds. 0 for no scan, 0xFFFFFFFF for automatic. + TUint mScanInterval; + + JoinWlanType mJoinWlanType; + + //Struct to hold current settings + TCmGenConnSettings mCmSettings; + + int mPsmKeyMode; + +}; + +#endif /* WLANSETTINGS_S60_H_ */ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/cpwlansettingsplugin/rom/cpwlansettingsplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/cpwlansettingsplugin/rom/cpwlansettingsplugin.iby Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CPWLANSETTINGPLUGIN_IBY +#define CPWLANSETTINGPLUGIN_IBY + +#include +#include + +file=ABI_DIR/BUILD_DIR/cpwlansettingsplugin.dll SHARED_LIB_DIR/cpwlansettingsplugin.dll +data=/epoc32/data/c/resource/qt/plugins/controlpanel/cpwlansettingsplugin.qtplugin resource/qt/plugins/controlpanel/cpwlansettingsplugin.qtplugin + +#endif // CPWLANSETTINGPLUGIN_IBY diff -r ff3b37722600 -r 10810c91db26 wlanutilities/cpwlansettingsplugin/rom/cpwlansettingsplugin_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/cpwlansettingsplugin/rom/cpwlansettingsplugin_resources.iby Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CPWLANSETTINGPLUGIN_RESOURCES_IBY +#define CPWLANSETTINGPLUGIN_RESOURCES_IBY + +#include +#include + +//For localization resource +data=DATAZ_/QT_TRANSLATIONS_DIR/cpwlansettingsplugin.qm QT_TRANSLATIONS_DIR/cpwlansettingsplugin.qm + +#endif // CPWLANSETTINGPLUGIN_RESOURCES_IBY diff -r ff3b37722600 -r 10810c91db26 wlanutilities/cpwlansettingsplugin/src/cpwlansettingsgroupitemdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/cpwlansettingsplugin/src/cpwlansettingsgroupitemdata.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,333 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// System includes + +#include +#include +#include +#include +#include +#include +#include + +// User includes + +#include "cpwlansettingsgroupitemdata.h" +#include "wlansettings.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cpwlansettingsgroupitemdataTraces.h" +#endif + +/*! + \class CpWlanSettingsGroupItemData + \brief CpWlanSettingsGroupItemData class creates all widgets required for Manage + WLAN Settings. +*/ + +// External function prototypes + +// Local constants +/** Maximum Value for Scan Interval. */ +const int KMaximumScanInterval = 30; +/** Minimum Value for Scan Interval. */ +const int KMinimumScanInterval = 0; +/** To Enable the setting of a widget propery. */ +const int KEnableOption = 1; +/** Maximum widgets allowed for this Item Data. */ +const int KMaxWidgets = 4; +/** Index of Slider widget for Scan Interval. */ +const int KSliderIndex = 2; + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. +*/ + +CpWlanSettingsGroupItemData::CpWlanSettingsGroupItemData( + CpItemDataHelper &itemDataHelper) : + CpSettingFormItemData(HbDataFormModelItem::GroupItem, hbTrId( + "txt_occ_subhead_wlan_settings")), + mItemDataHelper(itemDataHelper) +{ + OstTraceFunctionEntry1(CPWLANSETTINGSGROUPITEMDATA_CPWLANSETTINGSGROUPITEMDATA_ENTRY, this); + + initialise(); + + createWlanSettingItems(); + + OstTraceFunctionExit1(CPWLANSETTINGSGROUPITEMDATA_CPWLANSETTINGSGROUPITEMDATA_EXIT, this); +} + +/*! + Destructor. +*/ + +CpWlanSettingsGroupItemData::~CpWlanSettingsGroupItemData() +{ + OstTraceFunctionEntry1(DUP1_CPWLANSETTINGSGROUPITEMDATA_CPWLANSETTINGSGROUPITEMDATA_ENTRY, this); + OstTraceFunctionExit1(DUP1_CPWLANSETTINGSGROUPITEMDATA_CPWLANSETTINGSGROUPITEMDATA_EXIT, this); +} + +/*! + Initialises the member variables and reads the values of WLAN Settings. +*/ + +void CpWlanSettingsGroupItemData::initialise() +{ + OstTraceFunctionEntry1(CPWLANSETTINGSGROUPITEMDATA_INITIALISE_ENTRY, this); + + mWlanSettings.reset(new WlanSettings); + + //Error needs to be handled. + int error = mWlanSettings->init(); + + //Error needs to be handled. + error = mWlanSettings->loadSettings(); + + mUserDefinedItem = NULL; + + OstTraceFunctionExit1(CPWLANSETTINGSGROUPITEMDATA_INITIALISE_EXIT, this); +} + +/*! + Creates the Widgets for displaying WLAN Settings. +*/ + +void CpWlanSettingsGroupItemData::createWlanSettingItems() +{ + OstTraceFunctionEntry1(CPWLANSETTINGSGROUPITEMDATA_CREATEWLANSETTINITEMS_ENTRY, this); + + mJoinWlanItem = new CpSettingFormItemData( + HbDataFormModelItem::ComboBoxItem, hbTrId( + "txt_occ_setlabel_join_wlan_networks"), this); + + QStringList joinWlanItems; + + joinWlanItems.append(hbTrId( + "txt_occ_setlabel_join_wlan_networks_val_known")); + + joinWlanItems.append(hbTrId( + "txt_occ_setlabel_join_wlan_networks_val_manual")); + + mJoinWlanItem->setContentWidgetData("items", joinWlanItems); + + mItemDataHelper.addConnection(mJoinWlanItem, + SIGNAL(currentIndexChanged (int)), this, + SLOT(joinWlanItemChanged (int))); + + mJoinWlanItem->setContentWidgetData("currentIndex", + mWlanSettings->joinWlanMode()); + + this->appendChild(mJoinWlanItem); + + mScanNetworkItem = new CpSettingFormItemData( + HbDataFormModelItem::ComboBoxItem, hbTrId( + "txt_occ_setlabel_scan_for_networks"), this); + + QStringList scanNetworkItems; + + scanNetworkItems.append(hbTrId( + "txt_occ_setlabel_scan_for_networks_val_automatic")); + + scanNetworkItems.append(hbTrId( + "txt_occ_setlabel_scan_for_networks_val_userdefine")); + + mScanNetworkItem->setContentWidgetData("items", scanNetworkItems); + + mItemDataHelper.addConnection(mScanNetworkItem, + SIGNAL(currentIndexChanged (const QString &)), this, + SLOT(scanItemChanged (const QString &))); + + this->appendChild(mScanNetworkItem); + + WlanSettings::ScanNetworkType scanType = mWlanSettings->scanNetworkType(); + + mScanNetworkItem->setContentWidgetData("currentIndex", scanType); + + if (scanType == WlanSettings::EScanNetworkUserDefined) { + createScanIntervalItem(); + this->appendChild(mUserDefinedItem); + } + + mPowerSavingItem = new CpSettingFormItemData( + HbDataFormModelItem::ComboBoxItem, hbTrId( + "txt_occ_setlabel_power_saving"), this); + + QStringList powerSavingItems; + + powerSavingItems.append(hbTrId( + "txt_occ_setlabel_power_saving_val_disabled")); + + powerSavingItems.append(hbTrId( + "txt_occ_setlabel_power_saving_val_enabled")); + + mPowerSavingItem->setContentWidgetData("items", powerSavingItems); + + mPowerSavingItem->setContentWidgetData("currentIndex", + mWlanSettings->isPowerSavingEnabled()); + + mItemDataHelper.addConnection(mPowerSavingItem, + SIGNAL(currentIndexChanged (int)), this, + SLOT(powerSavingItemChanged (int))); + + this->appendChild(mPowerSavingItem); + + OstTraceFunctionExit1(CPWLANSETTINGSGROUPITEMDATA_CREATEWLANSETTINITEMS_EXIT, this); +} + +/*! + Creates the slider widget for displaying scan interval value. +*/ + +void CpWlanSettingsGroupItemData::createScanIntervalItem() +{ + OstTraceFunctionEntry1(CPWLANSETTINGSGROUPITEMDATA_CREATESCANINTERVALITEM_ENTRY, this); + + mUserDefinedItem = new CpSettingFormItemData( + HbDataFormModelItem::SliderItem, hbTrId( + "txt_occ_setlabel_scan_interval_minutes"), this); + + mUserDefinedItem->setContentWidgetData("maximum", KMaximumScanInterval); + mUserDefinedItem->setContentWidgetData("minimum", KMinimumScanInterval); + mUserDefinedItem->setContentWidgetData("toolTipVisible", KEnableOption); + mUserDefinedItem->setContentWidgetData("tracking", KEnableOption); + + mItemDataHelper.addConnection(mUserDefinedItem, + SIGNAL(valueChanged (int)), this, SLOT(scanValueChanged (int))); + + mItemDataHelper.addConnection(mUserDefinedItem, + SIGNAL(sliderReleased ()), this, SLOT(scanSliderReleased ())); + + mItemDataHelper.addConnection(mUserDefinedItem, SIGNAL(sliderPressed ()), + this, SLOT(scanSliderPressed ())); + + mScanInterval = mWlanSettings->scanInterval(); + + mUserDefinedItem->setContentWidgetData("value", mScanInterval); + + OstTraceFunctionExit1(CPWLANSETTINGSGROUPITEMDATA_CREATESCANINTERVALITEM_EXIT, this); +} + +/*! + Slot for handling pressed singal of scan interval slider widget. +*/ + +void CpWlanSettingsGroupItemData::scanSliderPressed() +{ + OstTraceFunctionEntry1(CPWLANSETTINGSGROUPITEMDATA_SCANSLIDERPRESSED_ENTRY, this); + + mUserDefinedItem->setContentWidgetData("text",QString("%1").arg(mScanInterval)); + + OstTraceFunctionExit1(CPWLANSETTINGSGROUPITEMDATA_SCANSLIDERPRESSED_EXIT, this); +} + +/*! + Slot for handling value changed singal of scan interval slider widget. +*/ + +void CpWlanSettingsGroupItemData::scanValueChanged(int value) +{ + OstTraceFunctionEntry1(CPWLANSETTINGSGROUPITEMDATA_SCANVALUECHANGED_ENTRY, this); + + mUserDefinedItem->setContentWidgetData("text",QString("%1").arg(value)); + mScanInterval = value; + + OstTraceFunctionExit1(CPWLANSETTINGSGROUPITEMDATA_SCANVALUECHANGED_EXIT, this); +} + +/*! + Slot for handling Released singal of scan interval slider widget. + Current value will be commited to database. +*/ + +void CpWlanSettingsGroupItemData::scanSliderReleased() +{ + OstTraceFunctionEntry1(CPWLANSETTINGSGROUPITEMDATA_SCANSLIDERRELEASED_ENTRY, this); + + mWlanSettings->setWlanScanInterval(mScanInterval); + + OstTraceFunctionExit1(CPWLANSETTINGSGROUPITEMDATA_SCANSLIDERRELEASED_EXIT, this); +} + +/*! + Slot for handling item changed singal of Scan for network combo box widget. +*/ + +void CpWlanSettingsGroupItemData::scanItemChanged(const QString &text) +{ + OstTraceFunctionEntry1(CPWLANSETTINGSGROUPITEMDATA_SCANITEMCHANGED_ENTRY, this); + + if (hbTrId("txt_occ_setlabel_scan_for_networks_val_userdefine") == text) { + //In case of PSM mode for device user-defined value is not + //allowed,make it automatic forcefully. + if (mWlanSettings->isPsmEnabled()) { + //Need to check for dimming of the combobox option. + mScanNetworkItem->setContentWidgetData("currentIndex", + WlanSettings::EScanNetworkAuto); + } + else { + //Add Scan Interval Slider, if it was not added. + if (this->childCount() < KMaxWidgets) { + createScanIntervalItem(); + this->insertChild(KSliderIndex,mUserDefinedItem); + mWlanSettings->setWlanScanInterval(mWlanSettings->scanInterval()); + } + } + } + else { + //Remove Scan Interval slider, if user selects automatic option + //for Scan network setting and if slider was added earlier. + if (KMaxWidgets == this->childCount()) { + this->removeChild(KSliderIndex); + mUserDefinedItem = NULL; //removeChild() will delete the item. + mWlanSettings->setWlanScanInterval(KWlanSettingsScanNetworkAuto); + } + } + + OstTraceFunctionExit1(CPWLANSETTINGSGROUPITEMDATA_SCANITEMCHANGED_EXIT, this); +} + +/*! + Slot for handling item changed singal of Power saving combo box widget. +*/ + +void CpWlanSettingsGroupItemData::powerSavingItemChanged(int index) +{ + OstTraceFunctionEntry1(CPWLANSETTINGSGROUPITEMDATA_POWERSAVINGITEMCHANGED_ENTRY, this); + + mWlanSettings->setWlanPowerSaving(index); + + OstTraceFunctionExit1(CPWLANSETTINGSGROUPITEMDATA_POWERSAVINGITEMCHANGED_EXIT, this); +} + +/*! + Slot for handling item changed singal of Join WLAN networks combo box widget. +*/ + +void CpWlanSettingsGroupItemData::joinWlanItemChanged(int index) +{ + OstTraceFunctionEntry1(CPWLANSETTINGSGROUPITEMDATA_JOINWLANITEMCHANGED_ENTRY, this); + + mWlanSettings->setJoinWlanMode(index); + + OstTraceFunctionExit1(CPWLANSETTINGSGROUPITEMDATA_JOINWLANITEMCHANGED_EXIT, this); +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/cpwlansettingsplugin/src/cpwlansettingsplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/cpwlansettingsplugin/src/cpwlansettingsplugin.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// System includes + +#include +#include +#include +#include + +// User includes + +#include "cpwlansettingsplugin.h" +#include "cpwlansettingsgroupitemdata.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cpwlansettingspluginTraces.h" +#endif + +/*! + \class CpWlanSettingsPlugin + \brief CpWlanSettingsPlugin implements the WLAN Settings Control Panel Plugin + which will allow viewing/editing of Manage WLAN Settings. +*/ + +// External function prototypes + +// Local constants + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. +*/ + +CpWlanSettingsPlugin::CpWlanSettingsPlugin() : + QObject() +{ + OstTraceFunctionEntry1(CPWLANSETTINGSPLUGIN_CPWLANSETTINGSPLUGIN_ENTRY, this); + + translator = new QTranslator(this); + + OstTraceFunctionExit1(CPWLANSETTINGSPLUGIN_CPWLANSETTINGSPLUGIN_EXIT, this); +} + +/*! + Destructor. +*/ + +CpWlanSettingsPlugin::~CpWlanSettingsPlugin() +{ + + OstTraceFunctionEntry1(DUP1_CPWLANSETTINGSPLUGIN_CPWLANSETTINGSPLUGIN_ENTRY, this); + OstTraceFunctionExit1(DUP1_CPWLANSETTINGSPLUGIN_CPWLANSETTINGSPLUGIN_EXIT, this); +} + +/*! + Plugin function for creating the WLAN Settings form item data. +*/ + +QList CpWlanSettingsPlugin::createSettingFormItemData( + CpItemDataHelper &itemDataHelper) const +{ + OstTraceFunctionEntry1(CPWLANSETTINGSPLUGIN_CREATESETTINGFORMITEMDATA_ENTRY, this); + + // Locale + QString lang = QLocale::system().name(); + QString path = "Z:/resource/qt/translations/"; + translator->load("cpwlansettingsplugin_" + lang, path); + qApp->installTranslator(translator); + + QList settingFormData; + settingFormData.append(new CpWlanSettingsGroupItemData(itemDataHelper)); + + OstTraceFunctionExit1(CPWLANSETTINGSPLUGIN_CREATESETTINGFORMITEMDATA_EXIT, this); + return settingFormData; + +} + +Q_EXPORT_PLUGIN2(cpwlansettingsplugin, CpWlanSettingsPlugin); diff -r ff3b37722600 -r 10810c91db26 wlanutilities/cpwlansettingsplugin/src/wlansettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/cpwlansettingsplugin/src/wlansettings.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,241 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// System includes + +#include +#include +#include + +// User includes + +#include "wlansettings.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlansettingsTraces.h" +#endif + +/*! + \class WlanSettings + \brief WlanSettings is a wrapper class for CWlanSettingsImpl. +*/ + +// External function prototypes + +// Local constants +/** Default value for Scan Interval. */ +const int KDefaultScanInterval = 5; + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. +*/ + +WlanSettings::WlanSettings() : + QObject(), mPsmKeyValue(0) +{ + + OstTraceFunctionEntry1(WLANSETTINGS_WLANSETTINGS_ENTRY, this); + OstTraceFunctionExit1(WLANSETTINGS_WLANSETTINGS_EXIT, this); +} + +/*! + Destructor. +*/ + +WlanSettings::~WlanSettings() +{ + OstTraceFunctionEntry1(DUP1_WLANSETTINGS_WLANSETTINGS_ENTRY, this); + + delete mImpl; + + OstTraceFunctionExit1(DUP1_WLANSETTINGS_WLANSETTINGS_EXIT, this); +} + +/*! + Creates the CWlanSettingsImpl object for reading/writing settings. + \return Error code. +*/ + +int WlanSettings::init() +{ + OstTraceFunctionEntry1(WLANSETTINGS_INIT_ENTRY, this); + + readPsmKey(); + + TRAPD(error,(mImpl = CWlanSettingsPrivate::NewL(mPsmKeyValue))); + + OstTraceFunctionExit1(WLANSETTINGS_INIT_EXIT, this); + return error; +} + + +void WlanSettings::readPsmKey() +{ + OstTraceFunctionEntry1(WLANSETTINGS_READPSMKEY_ENTRY, this); + + QScopedPointer settingsManager; + settingsManager.reset(new XQSettingsManager()); + + XQSettingsKey key(XQSettingsKey::TargetCentralRepository, + KCRUidPowerSaveMode.iUid, KPsmCurrentMode); + + QVariant keyValue = settingsManager->readItemValue(key); + + mPsmKeyValue = keyValue.toInt(); + + OstTraceFunctionExit1(WLANSETTINGS_READPSMKEY_EXIT, this); +} + +/*! + Reads the WLAN setting values. + \return Error code. +*/ + +int WlanSettings::loadSettings() +{ + OstTraceFunctionEntry1(WLANSETTINGS_LOADSETTINGS_ENTRY, this); + + TRAPD(error, mImpl->LoadDBSettingsL()); + + OstTraceFunctionExit1(WLANSETTINGS_LOADSETTINGS_EXIT, this); + return error; +} + +/*! + Function to get the scan network type. + \return ScanNetworkType which is automatic or user-defined. +*/ + +WlanSettings::ScanNetworkType WlanSettings::scanNetworkType() +{ + OstTraceFunctionEntry1(WLANSETTINGS_SCANNETWORKTYPE_ENTRY, this); + + ScanNetworkType scanType; + uint scanInterval = mImpl->ScanInterval(); + + if (scanInterval == KWlanSettingsScanNetworkAuto) { + scanType = EScanNetworkAuto; + } + else { + scanType = EScanNetworkUserDefined; + } + + OstTraceFunctionExit1(WLANSETTINGS_SCANNETWORKTYPE_EXIT, this); + return scanType; +} + +/*! + Function to get the scan interval. + \return Scan interval in minutes. +*/ + +uint WlanSettings::scanInterval() +{ + OstTraceFunctionEntry1(WLANSETTINGS_SCANINTERVAL_ENTRY, this); + + uint scanInterval = mImpl->ScanInterval(); + + if (scanInterval == KWlanSettingsScanNetworkAuto) { + scanInterval = KDefaultScanInterval; + } + + OstTraceFunctionExit1(WLANSETTINGS_SCANINTERVAL_EXIT, this); + return scanInterval; +} + +/*! + Function to get Power Saving Option. + \return True if Power Saving option is enabled, otherwise False. +*/ + +int WlanSettings::isPowerSavingEnabled() const +{ + return mImpl->PowerSaving(); +} + +/*! + Function to set Power Saving Option. + \param powerSavingOption True to enable or false to disable power saving option. + \return Error code. +*/ + +int WlanSettings::setWlanPowerSaving(int powerSavingOption) +{ + OstTraceFunctionEntry1(WLANSETTINGS_SETWLANPOWERSAVING_ENTRY, this); + + mImpl->SetPowerSaving(powerSavingOption); + TRAPD(error, mImpl->SaveDBSettingsL(CWlanSettingsPrivate::EWlanPowerSaving)); + + OstTraceFunctionExit1(WLANSETTINGS_SETWLANPOWERSAVING_EXIT, this); + return error; +} + +/*! + Function to set Scan interval. + \param scanInterval Scan interval in minutes. + \return Error code. +*/ + +int WlanSettings::setWlanScanInterval(uint scanInterval) +{ + OstTraceFunctionEntry1(WLANSETTINGS_SETWLANSCANINTERVAL_ENTRY, this); + + mImpl->SetScanInterval(scanInterval); + TRAPD(error, mImpl->SaveDBSettingsL(CWlanSettingsPrivate::EWlanScanInterval)); + + OstTraceFunctionExit1(WLANSETTINGS_SETWLANSCANINTERVAL_EXIT, this); + return error; +} + +/*! + Function to get Join WLAN networks option. + \return 0 for Known, 1 for Manual. +*/ + +int WlanSettings::joinWlanMode() const +{ + return mImpl->JoinWlanMode(); +} + +/*! + Function to set Join WLAN networks option. + \param mode 0 for Known, 1 for Manual. + \return Error code. +*/ + +int WlanSettings::setJoinWlanMode(int mode) +{ + OstTraceFunctionEntry1(WLANSETTINGS_SETJOINWLANMODE_ENTRY, this); + + TRAPD(error, mImpl->SaveJoinWlanSettingL(mode)); + + OstTraceFunctionExit1(WLANSETTINGS_SETJOINWLANMODE_EXIT, this); + return error; +} + +/*! + Function to get Power Saving status of the device. + \return True if Power Saving is enabled. +*/ + +int WlanSettings::isPsmEnabled() const +{ + return mImpl->IsPsmEnabled(); +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/cpwlansettingsplugin/src/wlansettings_s60.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/cpwlansettingsplugin/src/wlansettings_s60.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,398 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// System includes + +#include +#include +#include + +// User includes + +#include "wlansettings_s60_p.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlansettings_s60Traces.h" +#endif + +/*! + \class CWlanSettingsPrivate + \brief CWlanSettingsPrivate is the actual implementation for + reading/writing WLAN Settings from/to database. +*/ + +// External function prototypes + +// Local constants +/** Seconds per minute. */ +const TInt KWlanSettingsSecondsInMinute = 60; +/** Maximum value for scan interval in minutes. */ +const TInt KWlanSettingsScanNetworkMax = 30; + +// ======== MEMBER FUNCTIONS ======== + +/*! + Static NewL function for creating CWlanSettingsPrivate object. + \return Pointer to CWlanSettingsPrivate object. +*/ + +CWlanSettingsPrivate* CWlanSettingsPrivate::NewL(int psmKeyValue) +{ + OstTraceFunctionEntry1(CWLANSETINGPRIVATE_NEWL_ENTRY, this); + + CWlanSettingsPrivate* impl = new ( ELeave ) CWlanSettingsPrivate(psmKeyValue); + CleanupStack::PushL( impl ); + impl->ConstructL(); + CleanupStack::Pop( impl ); + + OstTraceFunctionExit1(CWLANSETINGPRIVATE_NEWL_EXIT, this); + return impl; +} + +/*! + Second phase Constructor. +*/ + +void CWlanSettingsPrivate::ConstructL() +{ + OstTraceFunctionEntry1(CWLANSETINGPRIVATE_CONSTRUCTL_ENTRY, this); + + mSession = CMDBSession::NewL( KCDLatestVersion ); + +#ifndef __WINS__ + mWlanMgmtClient = CWlanMgmtClient::NewL(); +#endif + + CheckPsmModeL(); + + OstTraceFunctionExit1(CWLANSETINGPRIVATE_CONSTRUCTL_EXIT, this); +} + +/*! + Constructor. +*/ + +CWlanSettingsPrivate::CWlanSettingsPrivate(int psmKeyValue) : + mPsmMode( EFalse ), + mPowerSaving(KWlanSettingsDefaultPowerSaving), + mScanInterval(KWlanSettingsDefaultScanNetwork), + mPsmKeyMode(psmKeyValue) +{ + + OstTraceFunctionEntry1(CWLANSETINGPRIVATE_CWLANSETINGPRIVATE_ENTRY, this); + OstTraceFunctionExit1(CWLANSETINGPRIVATE_CWLANSETINGPRIVATE_EXIT, this); + +} + +/*! + Destructor. +*/ + +CWlanSettingsPrivate::~CWlanSettingsPrivate() +{ + OstTraceFunctionEntry1(DUP1_CWLANSETINGPRIVATE_CWLANSETINGPRIVATE_ENTRY, this); + + delete mSession; +#ifndef __WINS__ + delete mWlanMgmtClient; +#endif + + OstTraceFunctionExit1(DUP1_CWLANSETINGPRIVATE_CWLANSETINGPRIVATE_EXIT, this); +} + +/*! + Function to get the Power Saving mode of the device. +*/ + +void CWlanSettingsPrivate::CheckPsmModeL() +{ + OstTraceFunctionEntry1(CWLANSETINGPRIVATE_CHECKPSMMODEL_ENTRY, this); + + TPsmsrvMode mode( EPsmsrvModeNormal ); + + mode = static_cast( mPsmKeyMode ); + if ( mode == EPsmsrvModePowerSave || mode == EPsmsrvPartialMode ) { + mPsmMode = ETrue; + } + else { + mPsmMode = EFalse; + } + + OstTraceFunctionExit1(CWLANSETINGPRIVATE_CHECKPSMMODEL_EXIT, this); +} + +/*! + Function to load the WLAN Settings from CommsDB. +*/ + +void CWlanSettingsPrivate::LoadDBSettingsL() +{ + OstTraceFunctionEntry1(CWLANSETINGPRIVATE_LOADDBSETTINGSL_ENTRY, this); + + TBool ownTransaction( EFalse ); + if ( !mSession->IsInTransaction() ) { + ownTransaction = ETrue; + mSession->OpenTransactionL(); + } + TMDBElementId tableId = 0; + + tableId = CCDWlanDeviceSettingsRecord::TableIdL( *mSession ); + + CCDWlanDeviceSettingsRecord* record = new( ELeave ) + CCDWlanDeviceSettingsRecord( tableId ); + CleanupStack::PushL( record ); + + record->iWlanDeviceSettingsType = KWlanUserSettings; + + if ( record->FindL( *mSession ) ) { + record->LoadL( *mSession ); + } + + // Read scan interval + + mScanInterval = record->iBgScanInterval; + //In Case of PSM mode Scan Interval should be set to Auto + if (mPsmMode) { + mScanInterval = KWlanSettingsScanNetworkAuto; + } + else { + mScanInterval = record->iSavedBgScanInterval; + //Safe check for scan interval, control should not come here. + if (mScanInterval > (KWlanSettingsScanNetworkMax + * KWlanSettingsSecondsInMinute)) { + mScanInterval = KWlanSettingsScanNetworkAuto; + } + } + + mPowerSaving = record->iWlanPowerMode; + CleanupStack::PopAndDestroy( record ); + + if ( ownTransaction ) { + mSession->CommitTransactionL(); + // Rollback operation. + } + + //To Load CM Settings. + LoadJoinWlanSettingL(); + + OstTraceFunctionExit1(CWLANSETINGPRIVATE_LOADDBSETTINGSL_EXIT, this); +} + +/*! + Function to load the Join WLAN networks Setting from CMManager. +*/ + +void CWlanSettingsPrivate::LoadJoinWlanSettingL() +{ + OstTraceFunctionEntry1(CWLANSETINGPRIVATE_LOADJOINWLANSETTINGL_ENTRY, this); + + RCmManager CmManager; + CmManager.CreateTablesAndOpenL(); + CleanupClosePushL(CmManager); + CmManager.ReadGenConnSettingsL( mCmSettings ); + CleanupStack::PopAndDestroy( 1 ); //CmManager + + OstTraceFunctionExit1(CWLANSETINGPRIVATE_LOADJOINWLANSETTINGL_EXIT, this); +} + +/*! + Function to write the Join WLAN networks Setting using CMManager. +*/ + +void CWlanSettingsPrivate::SaveJoinWlanSettingL(TInt mode) +{ + OstTraceFunctionEntry1(CWLANSETINGPRIVATE_SAVEJOINWLANSETTINGL_ENTRY, this); + + switch ( mode ) { + case EJoinWlanKnown: + mCmSettings.iUsageOfWlan = ECmUsageOfWlanKnown; + break; + + case EJoinWlanManual: + mCmSettings.iUsageOfWlan = ECmUsageOfWlanManual; + break; + + default: + break; + } + + RCmManager CmManager; + CmManager.CreateTablesAndOpenL(); + CleanupClosePushL(CmManager); + CmManager.WriteGenConnSettingsL( mCmSettings ); + CleanupStack::PopAndDestroy( 1 ); + + OstTraceFunctionExit1(CWLANSETINGPRIVATE_SAVEJOINWLANSETTINGL_EXIT, this); +} + +/*! + Function to get the Join WLAN network setting. + \return 0 for Known, 1 for Manual. +*/ + +TInt CWlanSettingsPrivate::JoinWlanMode() +{ + OstTraceFunctionEntry1(CWLANSETINGPRIVATE_JOINWLANMODE_ENTRY, this); + + TInt mode = 0; + + switch ( mCmSettings.iUsageOfWlan ) { + case ECmUsageOfWlanKnown: + mode = EJoinWlanKnown; + break; + + case ECmUsageOfWlanManual: + mode = EJoinWlanManual; + break; + + default: + break; + } + + OstTraceFunctionExit1(CWLANSETINGPRIVATE_JOINWLANMODE_EXIT, this); + return mode; +} + +/*! + Function to write the WLAN Settings to CommsDb. +*/ + +void CWlanSettingsPrivate::SaveDBSettingsL(TInt option) +{ + OstTraceFunctionEntry1(CWLANSETINGPRIVATE_SAVEDBSETTINGSL_ENTRY, this); + + TBool ownTransaction( EFalse ); + if ( !mSession->IsInTransaction() ) { + ownTransaction = ETrue; + mSession->OpenTransactionL(); + } + TMDBElementId tableId = 0; + tableId = CCDWlanDeviceSettingsRecord::TableIdL( *mSession ); + + CCDWlanDeviceSettingsRecord* record = new( ELeave ) + CCDWlanDeviceSettingsRecord( tableId ); + + CleanupStack::PushL( record ); + + record->iWlanDeviceSettingsType = KWlanUserSettings; + + if ( record->FindL( *mSession ) ) { + record->LoadL( *mSession ); + } + + switch (option) { + case EWlanScanInterval: + record->iBgScanInterval = mScanInterval; + if ( !mPsmMode ) { + record->iSavedBgScanInterval = mScanInterval; + } + break; + case EWlanPowerSaving: + record->iWlanPowerMode = mPowerSaving; + break; + default: + break; + } + + // Whenever settings are modified, iUseDefaultSettings must be set to false. + record->iUseDefaultSettings = EFalse; + + record->ModifyL( *mSession ); + + CleanupStack::PopAndDestroy( record ); + if ( ownTransaction ) { + mSession->CommitTransactionL(); + } + +#ifndef __WINS__ + // Notifying WLAN Engine about changes in settings + mWlanMgmtClient->NotifyChangedSettings(); +#endif + + OstTraceFunctionExit1(CWLANSETINGPRIVATE_SAVEDBSETTINGSL_EXIT, this); +} + +/*! + Function to get the scan interval. + \return Scan interval in minutes. +*/ + +TUint CWlanSettingsPrivate::ScanInterval() +{ + if ( mScanInterval == KWlanSettingsScanNetworkAuto ) { + return mScanInterval; + } + else { + // Return scan time in minutes + return ( mScanInterval / KWlanSettingsSecondsInMinute ); + } +} + +/*! + Function to get Power Saving Option. + \return True if Power Saving option is enabled, otherwise False. +*/ + +TBool CWlanSettingsPrivate::PowerSaving() +{ + return mPowerSaving; +} + +/*! + Function to set Scan interval. + \param interval Scan interval in minutes. +*/ + +void CWlanSettingsPrivate::SetScanInterval(TUint interval) +{ + OstTraceFunctionEntry1(CWLANSETINGPRIVATE_SETSCANINTERVAL_ENTRY, this); + + if ( interval == KWlanSettingsScanNetworkAuto ) { + mScanInterval = interval; + } + else { + // Scan time stored in seconds + mScanInterval = interval * KWlanSettingsSecondsInMinute; + } + + OstTraceFunctionExit1(CWLANSETINGPRIVATE_SETSCANINTERVAL_EXIT, this); +} + +/*! + Function to set Power Saving Option. + \param powerSavingOption True to enable or false to disable power saving option. +*/ + +void CWlanSettingsPrivate::SetPowerSaving(TBool powerSavingOption) +{ + OstTraceFunctionEntry1(CWLANSETINGPRIVATE_SETPOWERSAVING_ENTRY, this); + + mPowerSaving = powerSavingOption; + + OstTraceFunctionExit1(CWLANSETINGPRIVATE_SETPOWERSAVING_EXIT, this); +} + +/*! + Function to get Power Saving status of the device. + \return True if Power Saving is enabled. +*/ + +TBool CWlanSettingsPrivate::IsPsmEnabled() +{ + return mPsmMode; +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/cpwlansettingsplugin/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/cpwlansettingsplugin/traces/OstTraceDefinitions.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +#include +#endif diff -r ff3b37722600 -r 10810c91db26 wlanutilities/cpwlansettingsplugin/tsrc/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/cpwlansettingsplugin/tsrc/main.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "wlansettingstest.h" + + +int main(int /*argc*/, char *argv[]) +{ + WlanSettingsTest* test = new WlanSettingsTest; + + //Save test reults to a file + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\WlanSettingsTest.txt"; + + int res = QTest::qExec(test, 3, pass); + + delete test; + return res; +} + +#include "moc_wlansettingstest.cpp" diff -r ff3b37722600 -r 10810c91db26 wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,170 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include "wlansettingstest.h" + +//constructor +WlanSettingsTest::WlanSettingsTest() +{ + mSecuritySettings.reset(new WlanSettings); + + //Initialise the wlansettings + mSecuritySettings->init(); +} + + +//Test Scenario : 1 +void WlanSettingsTest::test_setWlanPowerMode() +{ + int powerSavingOption(ETrue); + + int error = mSecuritySettings->setWlanPowerSaving(powerSavingOption); + + QVERIFY(error == KErrNone); +} + +/////////////////////////////////////////Manual WLan joining Mode////////////////////////////////////////////////// + +//Test Scenario : 2 +void WlanSettingsTest::test_CheckJoinWlanModeManual() +{ + mJoinWlanMode = WlanSettings::EScanNetworkUserDefined; + int error = mSecuritySettings->setJoinWlanMode(mJoinWlanMode); + + QVERIFY(error == KErrNone); + + //Load the Settings + int loadError = mSecuritySettings->loadSettings(); + QVERIFY(loadError == KErrNone); + + //Verify Mode + int mode = mSecuritySettings->joinWlanMode(); + QVERIFY(mode == mJoinWlanMode ); +} + +/////////////////////////////////////////User-defined Scan Interval///////////////////////////////////// +//Test Scenario : 3 +void WlanSettingsTest::test_CheckWlanScanIntervalManual() +{ + + mScanIntervalManual = 16; + + //Set some user-defined Interval + int setError = mSecuritySettings->setWlanScanInterval(mScanIntervalManual); + QVERIFY(setError == KErrNone); + + //Load the Settings + int loadError = mSecuritySettings->loadSettings(); + QVERIFY(loadError == KErrNone); + + //Check if the interval set is right + uint scanIntervalset = mSecuritySettings->scanInterval(); + QVERIFY(scanIntervalset == mScanIntervalManual); + + //Verify the Network type, based on the scan interval set + int networkType = mSecuritySettings->scanNetworkType(); + QVERIFY(networkType == WlanSettings::EScanNetworkUserDefined); + +} + + +//////////////////////////////////////////Automatic WLAN joining Mode/////////////////////////////////////////// + +//Test Scenario : 4 +void WlanSettingsTest::test_CheckJoinWlanModeAuto() +{ + mJoinWlanMode = WlanSettings::EScanNetworkAuto; + int error = mSecuritySettings->setJoinWlanMode(mJoinWlanMode); + + QVERIFY(error == KErrNone); + + + //Load the Settings + int loadError = mSecuritySettings->loadSettings(); + QVERIFY(loadError == KErrNone); + + + //Verify Mode + int mode = mSecuritySettings->joinWlanMode(); + QVERIFY(mode == mJoinWlanMode ); + +} + +///////////////////////////////////////Automatic Scan Interval///////////////////////////////////////// +//Test Scenario : 5 +void WlanSettingsTest::test_CheckWlanScanIntervalAuto() +{ + uint KDefaultScanInterval(5); + + mScanIntervalAuto = KWlanSettingsScanNetworkAuto; + + //Set the Auto Interval + int setError = mSecuritySettings->setWlanScanInterval(mScanIntervalAuto); + QVERIFY(setError == KErrNone); + + //Load the Settings + int loadError = mSecuritySettings->loadSettings(); + QVERIFY(loadError == KErrNone); + + //Check the Auto Interval + uint scanIntervalset = mSecuritySettings->scanInterval(); + QVERIFY(scanIntervalset == KDefaultScanInterval ); + + //Verify the Network type, based on the scan interval set + int networkType = mSecuritySettings->scanNetworkType(); + QVERIFY(networkType == WlanSettings::EScanNetworkAuto); +} + +//Test Scenario : 6 +void WlanSettingsTest::test_CheckManualIntervalValidity() +{ + uint KDefaultScanInterval(5); + //Invalid User defined Interval + mScanIntervalManual = 45; + + int setError = mSecuritySettings->setWlanScanInterval(mScanIntervalManual); + QVERIFY(setError == KErrNone); + + //Load the Settings + int loadError = mSecuritySettings->loadSettings(); + QVERIFY(loadError == KErrNone); + + //Validate ;When User-defined Interval is invalid,Auto Interval should have been set + uint scanIntervalset = mSecuritySettings->scanInterval(); + QVERIFY(scanIntervalset == KDefaultScanInterval); + +} + +//Test Scenario : 7 +void WlanSettingsTest::test_CheckWlanPowerSavingMode() +{ + int wlanPowerSavingMode(ETrue); + + int setError = mSecuritySettings->setWlanPowerSaving(wlanPowerSavingMode); + QVERIFY(setError == KErrNone); + + //Verify Power saving mode parameter + int powerSavingMode = mSecuritySettings->isPowerSavingEnabled(); + QVERIFY(powerSavingMode == wlanPowerSavingMode); +} + +//Delete data members +WlanSettingsTest::~WlanSettingsTest() +{ + +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef WLANSETTINGSTEST_H_ +#define WLANSETTINGSTEST_H_ + + +#include +#include +#include "WlanSettings.h" + +class WlanSettingsTest: public QObject +{ + Q_OBJECT + +public: + WlanSettingsTest(); + ~WlanSettingsTest(); + +private slots: + void test_setWlanPowerMode(); + + void test_CheckJoinWlanModeManual(); + + void test_CheckWlanScanIntervalManual(); + + void test_CheckJoinWlanModeAuto(); + + void test_CheckWlanScanIntervalAuto(); + + void test_CheckManualIntervalValidity(); + + void test_CheckWlanPowerSavingMode(); + +private: //data + + QScopedPointer mSecuritySettings; + uint mScanIntervalAuto; + uint mScanIntervalManual; + int mJoinWlanMode; + +}; + + +#endif /* WLANSETTINGSTEST_H_ */ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.loc Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,13 @@ +// ============================================================================ +// * Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-03-03T16:18:22 +// * This file is generated by qmake and should not be modified by the +// * user. +// ============================================================================ + +#ifdef LANGUAGE_SC +#define STRING_r_short_caption "wlansettingstest" +#define STRING_r_caption "wlansettingstest" +#else +#define STRING_r_short_caption "wlansettingstest" +#define STRING_r_caption "wlansettingstest" +#endif diff -r ff3b37722600 -r 10810c91db26 wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.pro Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,48 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = app +TARGET = wlansettingstest +QT += core \ + gui +HEADERS += wlansettingstest.loc \ + ../inc/wlansettings.h \ + ../inc/wlansettings_s60_p.h \ + ../traces/OstTraceDefinitions.h \ + wlansettingstest.h + +SOURCES += wlansettingstest.cpp \ + wlansettingstest.rss \ + wlansettingstest_reg.rss \ + main.cpp \ + ../src/wlansettings.cpp \ + ../src/wlansettings_s60.cpp + +FORMS += +RESOURCES += +symbian:TARGET.UID3 = 0xE05A6280 + +TARGET.CAPABILITY = All -TCB + +CONFIG += qtestlib +LIBS += -lCOMMSDAT \ + -lcommdb \ + -lcpframework \ + -lCOMMSDAT \ + -lcmmanagerdatabase \ + -lcmmanager \ + -lecom \ + -lxqsettingsmanager diff -r ff3b37722600 -r 10810c91db26 wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.rss Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,21 @@ +// ============================================================================ +// * Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-03-03T16:18:22 +// * This file is generated by qmake and should not be modified by the +// * user. +// ============================================================================ + +#include +#include + +RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info + { + short_caption = STRING_r_short_caption; + caption_and_icon = + CAPTION_AND_ICON_INFO + { + caption = STRING_r_caption; + number_of_icons = 0; + icon_file = ""; + }; + } + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest_reg.rss Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,18 @@ +// ============================================================================ +// * Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-03-03T16:18:22 +// * This file is generated by qmake and should not be modified by the +// * user. +// ============================================================================ + +#include +#include + +UID2 KUidAppRegistrationResourceFile +UID3 0xE05A6280 + +RESOURCE APP_REGISTRATION_INFO + { + app_file="wlansettingstest"; + localisable_resource_file="\\resource\\apps\\wlansettingstest"; + + } diff -r ff3b37722600 -r 10810c91db26 wlanutilities/group/bld.inf --- a/wlanutilities/group/bld.inf Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanentryplugin/inc/cpwlanentryitemdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanentryplugin/inc/cpwlanentryitemdata.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CPWLANENTRYITEMDATA_H +#define CPWLANENTRYITEMDATA_H + +// System includes + +#include "cpsettingformentryitemdata.h" + +// User includes + +// Forward declarations + +class WlanStatusInfo; + +// External data types + +// Constants + +// Class declaration + +class CpWlanEntryItemData : public CpSettingFormEntryItemData +{ + Q_OBJECT + +public: + + // Data types + + explicit CpWlanEntryItemData(CpItemDataHelper &itemDataHelper); + + virtual ~CpWlanEntryItemData(); + +signals: + +public slots: + +protected: + +protected slots: + +private: + + Q_DISABLE_COPY(CpWlanEntryItemData) + + virtual CpBaseSettingView *createSettingView() const; + +private slots: + + void statusUpdate(); + +private: // data + + WlanStatusInfo *mWlanStatusInfo; + + // Friend classes + +}; + +#endif // CPWLANENTRYITEMDATA_H diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanentryplugin/inc/cpwlanentryplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanentryplugin/inc/cpwlanentryplugin.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPWLANENTRYPLUGIN_H +#define CPWLANENTRYPLUGIN_H + + +// System includes + +#include +#include + +// User includes + +// Forward declarations + +class QTranslator; + +// External data types + +// Constants + +// Class declaration + +class CpWlanEntryPlugin : public QObject, public CpPluginPlatInterface +{ + Q_OBJECT + Q_INTERFACES(CpPluginPlatInterface) + +public: + + // Data types + + CpWlanEntryPlugin(); + + virtual ~CpWlanEntryPlugin(); + + virtual CpSettingFormItemData *createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; + +signals: + +public slots: + +protected: + +protected slots: + +private: + + Q_DISABLE_COPY(CpWlanEntryPlugin) + +private slots: + +private: // data + + bool mWlanSupported; // WLAN dynamic ON/OFF configuration + QTranslator *mTranslator; // Translator for text ID's used in this plugin + + // Friend classes + +}; + +#endif // CPWLANENTRYPLUGIN_H diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanentryplugin/inc/wlanstatusinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanentryplugin/inc/wlanstatusinfo.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef WLANSTATUSINFO_H +#define WLANSTATUSINFO_H + +// System includes + +#include + +// User includes + +// Forward declarations + +class WlanQtUtils; + +// External data types + +// Constants + +// Class declaration + +class WlanStatusInfo : public QObject +{ + Q_OBJECT + +public: + + // Data types + + /** + * WLAN Status value. + */ + enum { + /** WLAN is configured OFF. */ + WlanStatusOff = 0, + /** No WLAN connections. */ + WlanStatusIdle, + /** WLAN IAP is connected. */ + WlanStatusConnected, + }; + + explicit WlanStatusInfo(QObject *parent = 0); + + ~WlanStatusInfo(); + + int status(); + + QString statusText(); + +signals: + + /** + * Signal that informs that the WLAN status has changed. + */ + void statusUpdated(); + +public slots: + +protected: + +protected slots: + +private: + + Q_DISABLE_COPY(WlanStatusInfo) + +private slots: + + void updateStatus(); + +private: // data + + WlanQtUtils *mWlanQtUtils; // WlanQtUtils instance. + QString mStatusText; // WLAN status text. + int mStatus; // WLAN status value WlanStatus*. + + // Friend classes + +}; + +#endif // WLANSTATUSINFO_H diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanentryplugin/rom/wlanentryplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanentryplugin/rom/wlanentryplugin.iby Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef WLANENTRYPLUGIN_IBY +#define WLANENTRYPLUGIN_IBY + +#include +#include + +#ifdef __PROTOCOL_WLAN + +file=ABI_DIR/BUILD_DIR/cpwlanentryplugin.dll SHARED_LIB_DIR/cpwlanentryplugin.dll +data=/epoc32/data/c/resource/qt/plugins/controlpanel/cpwlanentryplugin.qtplugin resource/qt/plugins/controlpanel/cpwlanentryplugin.qtplugin + +#endif // __PROTOCOL_WLAN + +#endif // WLANENTRYPLUGIN_IBY diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanentryplugin/rom/wlanentryplugin_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanentryplugin/rom/wlanentryplugin_resources.iby Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef WLANENTRYPLUGIN_RESOURCES_IBY +#define WLANENTRYPLUGIN_RESOURCES_IBY + +#include +#include + +#ifdef __PROTOCOL_WLAN + +data=DATAZ_/QT_TRANSLATIONS_DIR/wlanentryplugin.qm QT_TRANSLATIONS_DIR/wlanentryplugin.qm + +#endif // __PROTOCOL_WLAN + +#endif // WLANENTRYPLUGIN_RESOURCES_IBY diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanentryplugin/src/cpwlanentryitemdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanentryplugin/src/cpwlanentryitemdata.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// System includes + +#ifdef WLANENTRYPLUGIN_SERVICETRACES +#include +#endif +#include + +#include +#include + +#include +#include + +// User includes + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cpwlanentryitemdataTraces.h" +#endif + +#include "wlanstatusinfo.h" + +#include "cpwlanentryitemdata.h" + +/*! + \class CpWlanEntryItemData + \brief Implementation of WLAN Status Plugin entry item data. + +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. +*/ + +CpWlanEntryItemData::CpWlanEntryItemData(CpItemDataHelper &itemDataHelper) : + CpSettingFormEntryItemData(itemDataHelper, hbTrId("txt_occ_dblist_wireless_lan")), + mWlanStatusInfo(new WlanStatusInfo(this)) +{ + OstTraceFunctionEntry1(CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_ENTRY, this); + + // Listen for WLAN status updates + bool connectStatus = connect( + mWlanStatusInfo, + SIGNAL(statusUpdated()), + this, + SLOT(statusUpdate())); + Q_ASSERT(connectStatus == true); + + // Update to show initial WLAN status. + statusUpdate(); + + OstTraceFunctionExit1(CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_EXIT, this); +} + +/*! + Destructor. +*/ + +CpWlanEntryItemData::~CpWlanEntryItemData() +{ + OstTraceFunctionEntry1(DUP1_CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_ENTRY, this); + OstTraceFunctionExit1(DUP1_CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_EXIT, this); +} + +/*! + Function for handling the entry item click. +*/ + +CpBaseSettingView *CpWlanEntryItemData::createSettingView() const +{ + OstTraceFunctionEntry1(CPWLANENTRYITEMDATA_CREATESETTINGVIEW_ENTRY, this); + +#ifdef WLANENTRYPLUGIN_SERVICETRACES + qInstallMsgHandler(XQSERVICEMESSAGEHANDLER); + XQSERVICE_DEBUG_PRINT("CpWlanEntryItemData::createSettingView requesting listView()"); +#endif + + // Execute synchronous WLAN Sniffer list view + XQServiceRequest* snd = new XQServiceRequest("com.nokia.services.wlansniffer.list","listView()",true); + bool status = snd->send(); +#ifdef WLANENTRYPLUGIN_SERVICETRACES + XQSERVICE_DEBUG_PRINT("CpWlanEntryItemData::createSettingView listView() service request completed"); +#endif + Q_ASSERT(status); + delete snd; + + OstTraceFunctionExit1(CPWLANENTRYITEMDATA_CREATESETTINGVIEW_EXIT, this); + return 0; +} + +/*! + Slot for updating the status shown by the plugin. + Updates both the text and icon. + */ +void CpWlanEntryItemData::statusUpdate() +{ + OstTraceFunctionEntry1(CPWLANENTRYITEMDATA_STATUSUPDATE_ENTRY, this); + + // Build icon with (possible) badge + HbIcon wlanIcon("qtg_large_wlan"); + switch (mWlanStatusInfo->status()) { + case WlanStatusInfo::WlanStatusOff: +#ifdef WLANSTATUSICONBADGING // TODO: Remove flagging when icon badging is supported + wlanIcon.addBadge( + Qt::AlignTop | Qt::AlignRight, + HbIcon("pri_small_super_off")); +#endif + break; + + case WlanStatusInfo::WlanStatusConnected: +#ifdef WLANSTATUSICONBADGING // TODO: Remove flagging when icon badging is supported + wlanIcon.addBadge( + Qt::AlignTop | Qt::AlignRight, + HbIcon("qtg_small_online")); +#endif + break; + } + + // Set the updated WLAN status + this->setEntryItemIcon(wlanIcon); + this->setDescription(mWlanStatusInfo->statusText()); + + OstTraceFunctionExit1(CPWLANENTRYITEMDATA_STATUSUPDATE_EXIT, this); +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanentryplugin/src/cpwlanentryplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanentryplugin/src/cpwlanentryplugin.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +// System includes + +#include +#include +#include +#include "qsysteminfo.h" + +// User includes + +#include "cpwlanentryitemdata.h" +#include "cpwlanentryplugin.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cpwlanentrypluginTraces.h" +#endif + +using namespace QtMobility; + +/*! + \class CpWlanEntryPlugin + \brief CpWlanEntryPlugin implements the WLAN Status Control Panel Plugin + that shows the current WLAN status. +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. +*/ + +CpWlanEntryPlugin::CpWlanEntryPlugin() : QObject() +{ + OstTraceFunctionEntry1(CPWLANENTRYPLUGIN_CPWLANENTRYPLUGIN_ENTRY, this); + + // Check & store WLAN dynamic configuration + QtMobility::QSystemInfo sysinfo; + mWlanSupported = sysinfo.hasFeatureSupported(QSystemInfo::WlanFeature); + + if (mWlanSupported) { + // Install localization + mTranslator = new QTranslator(this); + QString lang = QLocale::system().name(); + QString path = "Z:/resource/qt/translations/"; + mTranslator->load("wlanentryplugin_" + lang, path); + qApp->installTranslator(mTranslator); + } + + OstTraceFunctionExit1(CPWLANENTRYPLUGIN_CPWLANENTRYPLUGIN_EXIT, this); +} + +/*! + Destructor. +*/ + +CpWlanEntryPlugin::~CpWlanEntryPlugin() +{ + OstTraceFunctionEntry1(DUP1_CPWLANENTRYPLUGIN_CPWLANENTRYPLUGIN_ENTRY, this); + OstTraceFunctionExit1(DUP1_CPWLANENTRYPLUGIN_CPWLANENTRYPLUGIN_EXIT, this); +} + +/*! + Plugin function for creating the entry plugin form item data. +*/ + +CpSettingFormItemData *CpWlanEntryPlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const +{ + OstTraceFunctionEntry1(CPWLANENTRYPLUGIN_CREATESETTINGFORMITEMDATA_ENTRY, this); + + CpWlanEntryItemData *entryItemData = 0; + + // The plugin is disabled if WLAN is not supported by the product. + if (mWlanSupported) { + entryItemData = new CpWlanEntryItemData(itemDataHelper); + } + + OstTraceFunctionExit1(CPWLANENTRYPLUGIN_CREATESETTINGFORMITEMDATA_EXIT, this); + return entryItemData; +} + +Q_EXPORT_PLUGIN2(cpwlanentryplugin, CpWlanEntryPlugin); diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanentryplugin/src/wlanstatusinfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanentryplugin/src/wlanstatusinfo.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,155 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +*/ + +// System includes + +#include + +// User includes + +#include "wlanqtutils.h" +#include "wlanqtutilswlaniap.h" + +#include "wlanstatusinfo.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanstatusinfoTraces.h" +#endif + +/*! + \class WlanStatusInfo + \brief Class for maintaining and updating the WLAN status for the WLAN + Status Control Panel Plugin. + +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. +*/ + +WlanStatusInfo::WlanStatusInfo(QObject *parent) : + QObject(parent), + mWlanQtUtils(new WlanQtUtils()), + mStatusText(""), + mStatus(WlanStatusOff) +{ + OstTraceFunctionEntry1(WLANSTATUSINFO_WLANSTATUSINFO_ENTRY, this); + + // Listen for WLAN ON/OFF switching + bool connectStatus = connect( + mWlanQtUtils, + SIGNAL(masterWlanStatus(bool)), + this, + SLOT(updateStatus())); + Q_ASSERT(connectStatus == true); + + // Listen for WLAN connection statuses + connectStatus = connect( + mWlanQtUtils, + SIGNAL(wlanNetworkOpened(int)), + this, + SLOT(updateStatus())); + Q_ASSERT(connectStatus == true); + connectStatus = connect( + mWlanQtUtils, + SIGNAL(wlanNetworkClosed(int)), + this, + SLOT(updateStatus())); + Q_ASSERT(connectStatus == true); + + // Set initial status + updateStatus(); + + OstTraceFunctionExit1(WLANSTATUSINFO_WLANSTATUSINFO_EXIT, this); +} + +/*! + Destructor. +*/ + +WlanStatusInfo::~WlanStatusInfo() +{ + OstTraceFunctionEntry1(DUP1_WLANSTATUSINFO_WLANSTATUSINFO_ENTRY, this); + + delete mWlanQtUtils; + + OstTraceFunctionExit1(DUP1_WLANSTATUSINFO_WLANSTATUSINFO_EXIT, this); +} + +/*! + Function for getting current WLAN status value (WlanStatusInfo::WlanStatus*). +*/ + +int WlanStatusInfo::status() +{ + OstTraceFunctionEntry1(WLANSTATUSINFO_STATUS_ENTRY, this); + OstTraceFunctionExit1(WLANSTATUSINFO_STATUS_EXIT, this); + return mStatus; +} + +/*! + Returns the current WLAN status text. +*/ + +QString WlanStatusInfo::statusText() +{ + OstTraceFunctionEntry1(WLANSTATUSINFO_STATUSTEXT_ENTRY, this); + OstTraceFunctionExit1(WLANSTATUSINFO_STATUSTEXT_EXIT, this); + return mStatusText; +} + +/*! + Slot used for updating the WLAN status. +*/ + +void WlanStatusInfo::updateStatus() +{ + OstTraceFunctionEntry1(WLANSTATUSINFO_UPDATESTATUS_ENTRY, this); + + // Backup old status to detect changes + QString oldStatusText = mStatusText; + int connectedIapId = mWlanQtUtils->connectedWlanId(); + + // Figure out current WLAN status + if (mWlanQtUtils->masterWlan() == false) { + // WLAN is switched OFF. + mStatus = WlanStatusOff; + mStatusText = hbTrId("txt_occ_dblist_wireless_lan_val_off"); + } else if (connectedIapId != WlanQtUtilsInvalidIapId) { + mStatus = WlanStatusConnected; + mStatusText = hbTrId("txt_occ_dblist_wireless_lan_val_connected_to_1") + .arg(mWlanQtUtils->iap(connectedIapId)->name()); + } else { + mStatus = WlanStatusIdle; + mStatusText = hbTrId("txt_occ_dblist_wireless_lan_val_wlan_is_on"); + } + + // Inform about update if the status really changed. + if (oldStatusText != mStatusText) { + emit statusUpdated(); + } + + OstTraceFunctionExit1(WLANSTATUSINFO_UPDATESTATUS_EXIT, this); +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanentryplugin/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanentryplugin/traces/OstTraceDefinitions.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +#include +#endif diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanentryplugin/wlanentryplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanentryplugin/wlanentryplugin.pro Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,64 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = cpwlanentryplugin +DEPENDPATH += . +INCLUDEPATH += . +INCLUDEPATH += traces +# wlanutilities Private API +INCLUDEPATH += ../inc +CONFIG += hb plugin +MOC_DIR = moc +OBJECTS_DIR = obj +RCC_DIR = rcc +LIBS += -lwlanqtutilities -lcpframework -lxqservice -lqtsysteminfo + +# Sources +HEADERS += \ + inc/cpwlanentryplugin.h \ + inc/cpwlanentryitemdata.h \ + inc/wlanstatusinfo.h \ + traces/OstTraceDefinitions.h +SOURCES += \ + src/cpwlanentryplugin.cpp \ + src/cpwlanentryitemdata.cpp \ + src/wlanstatusinfo.cpp + +TRANSLATIONS = wlanentryplugin.ts + +symbian: { + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.UID3 = 0x2002BCE0 + SYMBIAN_PLATFORMS = WINSCW ARMV5 + BLD_INF_RULES.prj_exports += "rom/wlanentryplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wlanentryplugin.iby)" + BLD_INF_RULES.prj_exports += "rom/wlanentryplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(wlanentryplugin_resources.iby)" + + # Enable for QtHighway tracing + # DEFINES += WLANENTRYPLUGIN_SERVICETRACES +} +symbian { + deploy.path = C: + qtplugins.path = /resource/qt/plugins/controlpanel + qtplugins.sources += qmakepluginstubs/cpwlanentryplugin.qtplugin + + # This is for new exporting system coming in garden + for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin $$deploy.path$$qtplugins.path/$$basename(qtplugin)" +} +TARGET.CAPABILITY = CAP_GENERAL_DLL +plugin.sources = cpwlanentryplugin.dll xqservice.dll +plugin.path = /resource/qt/plugins/controlpanel +DEPLOYMENT += plugin diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanindicatorplugin/data/2001247E.rss --- a/wlanutilities/wlanindicatorplugin/data/2001247E.rss Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanindicatorplugin/data/wlanindicator.rss --- a/wlanutilities/wlanindicatorplugin/data/wlanindicator.rss Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanindicatorplugin/group/bld.inf --- a/wlanutilities/wlanindicatorplugin/group/bld.inf Tue Jan 26 13:04:04 2010 +0200 +++ b/wlanutilities/wlanindicatorplugin/group/bld.inf Fri Apr 16 16:07:56 2010 +0300 @@ -22,9 +22,7 @@ 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanindicatorplugin/group/wlanindicatorplugin.mmp --- a/wlanutilities/wlanindicatorplugin/group/wlanindicatorplugin.mmp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanindicatorplugin/inc/wlanindicatorplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/inc/wlanindicatorplugin.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef WLANINDICATORPLUGIN_H +#define WLANINDICATORPLUGIN_H + +#include +#include +#include +#include + +const int wlanNotConnected = 0; +const int wlanConnected = 1; + +class WlanIndicatorPlugin : public HbIndicatorInterface, public HbIndicatorPluginInterface +{ + Q_OBJECT + Q_INTERFACES(HbIndicatorPluginInterface) + +#ifdef WLANINDICATOR_UT + friend class WlanIndicatorUtCases; +#endif + +public: + WlanIndicatorPlugin(); + ~WlanIndicatorPlugin(); + +public: + //from HbIndicatorPluginInterface + QStringList indicatorTypes() const; + bool accessAllowed(const QString &indicatorType, + const HbSecurityInfo *securityInfo) const; + HbIndicatorInterface* createIndicator(const QString &indicatorType); + int error() const; +public: + //from HbIndicatorInterface + bool handleClientRequest (RequestType type, const QVariant ¶meter); + bool handleInteraction (InteractionType type); + QVariant indicatorData(int role) const; + +private slots: + void processError(QProcess::ProcessError err); // handler for error codes + +private: + + Q_DISABLE_COPY(WlanIndicatorPlugin) + QStringList mIndicatorTypes; // Type of indicator + int mError; // Indicator error + QVariant mParameter; // Used to contain the status of wlan + QProcess process; // Process to start external programs +}; +#endif //WLANINDICATORPLUGIN_H diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanindicatorplugin/inc/wlanindicatorpluginimplementation.h --- a/wlanutilities/wlanindicatorplugin/inc/wlanindicatorpluginimplementation.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanindicatorplugin/loc/wlanindicatorplugin.loc --- a/wlanutilities/wlanindicatorplugin/loc/wlanindicatorplugin.loc Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanindicatorplugin/rom/wlanindicatorplugin.iby --- a/wlanutilities/wlanindicatorplugin/rom/wlanindicatorplugin.iby Tue Jan 26 13:04:04 2010 +0200 +++ b/wlanutilities/wlanindicatorplugin/rom/wlanindicatorplugin.iby Fri Apr 16 16:07:56 2010 +0300 @@ -1,27 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Image description file for WlanIndicatorPlugin -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ -#ifndef __WLANINDICATORPLUGIN_IBY__ -#define __WLANINDICATORPLUGIN_IBY__ - - -#include - -ECOM_PLUGIN( wlanindicatorplugin.dll, wlanindicatorplugin.rsc ) - -#endif // __WLANINDICATORPLUGIN_IBY__ - +file=ABI_DIR\BUILD_DIR\wlanindicatorplugin.dll SHARED_LIB_DIR\wlanindicatorplugin.dll +data=\epoc32\data\z\resource\plugins\indicators\WlanIndicatorPlugin.qtplugin RESOURCE_FILES_DIR\plugins\indicators\wlanindicatorplugin.qtplugin diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanindicatorplugin/rom/wlanindicatorplugin_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/rom/wlanindicatorplugin_resources.iby Fri Apr 16 16:07:56 2010 +0300 @@ -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: + * + */ + +#ifndef WLANINDICATORPLUGIN_RESOURCES_IBY +#define WLANINDICATORPLUGIN_RESOURCES_IBY + +#include +#include + +data=DATAZ_/QT_TRANSLATIONS_DIR/wlanindicatorplugin.qm QT_TRANSLATIONS_DIR/wlanindicatorplugin.qm + +#endif // WLANINDICATORPLUGIN_RESOURCES_IBY diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanindicatorplugin/rom/wlanindicatorpluginresources.iby --- a/wlanutilities/wlanindicatorplugin/rom/wlanindicatorpluginresources.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanindicatorplugin/src/dllmain.cpp --- a/wlanutilities/wlanindicatorplugin/src/dllmain.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanindicatorplugin/src/wlanindicatorplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/src/wlanindicatorplugin.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,248 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include "wlanindicatorplugin.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanindicatorpluginTraces.h" +#endif + +Q_EXPORT_PLUGIN(WlanIndicatorPlugin) + +const static char IndicatorType[] = "com.nokia.hb.indicator.connectivity.wlanindicatorplugin/1.0"; + + +/*! + WlanIndicatorPlugin constructor. +*/ +WlanIndicatorPlugin::WlanIndicatorPlugin() : + HbIndicatorInterface(IndicatorType, GroupPriorityAverage, InteractionActivated), + mError(0) +{ + OstTraceFunctionEntry1(WLANINDICATORPLUGIN_WLANINDICATORPLUGIN_ENTRY, this); + mIndicatorTypes << "com.nokia.hb.indicator.connectivity.wlanindicatorplugin/1.0"; + OstTraceFunctionExit1(WLANINDICATORPLUGIN_WLANINDICATORPLUGIN_ENTRY_EXIT, this); +} + +/*! + WlanIndicatorPlugin destructor. +*/ +WlanIndicatorPlugin::~WlanIndicatorPlugin() +{ + OstTraceFunctionEntry1(DUP1_WLANINDICATORPLUGIN_WLANINDICATORPLUGIN_ENTRY, this); + OstTraceFunctionExit1(DUP1_WLANINDICATORPLUGIN_WLANINDICATORPLUGIN_EXIT, this); +} + +/*! + The indicatorTypes returns type of indicator. In this case it is wlanindicatorplugin. +*/ +QStringList WlanIndicatorPlugin::indicatorTypes() const +{ + OstTraceFunctionEntry1(WLANINDICATORPLUGIN_INDICATORTYPES_ENTRY, this); + OstTraceFunctionExit1(WLANINDICATORPLUGIN_INDICATORTYPES_EXIT, this); + + return mIndicatorTypes; +} + +/*! + The handleClientRequest handles client request to change indicators parameters. +*/ +bool WlanIndicatorPlugin::accessAllowed(const QString &indicatorType, + const HbSecurityInfo *securityInfo) const +{ + OstTraceFunctionEntry1(WLANINDICATORPLUGIN_ACCESSALLOWED_ENTRY, this); + + Q_UNUSED(indicatorType) + Q_UNUSED(securityInfo) + + OstTraceFunctionExit1(WLANINDICATORPLUGIN_ACCESSALLOWED_EXIT, this); + + return true; +} + +/*! + The createIndicator creates indicator plugin instance. +*/ +HbIndicatorInterface* WlanIndicatorPlugin::createIndicator( + const QString &indicatorType) +{ + OstTraceFunctionEntry1(WLANINDICATORPLUGIN_CREATEINDICATOR_ENTRY, this); + Q_UNUSED(indicatorType) + + // Install localization + QTranslator *translator = new QTranslator(this); + QString lang = QLocale::system().name(); + QString path = "Z:/resource/qt/translations/"; + translator->load("wlanindicatorplugin_" + lang, path); + qApp->installTranslator(translator); + + OstTraceFunctionExit1(WLANINDICATORPLUGIN_CREATEINDICATOR_EXIT, this); + return this; +} + +/*! + The error returns indicator error to HbIndicatorPluginInterface. +*/ +int WlanIndicatorPlugin::error() const +{ + OstTraceFunctionEntry1(WLANINDICATORPLUGIN_ERROR_ENTRY, this); + OstTrace1( WLANINDICATORPLUGIN_ERR,ERROR,"WlanIndicatorPlugin error %u", mError); + OstTraceFunctionExit1(WLANINDICATORPLUGIN_ERROR_EXIT, this); + return mError; +} + +/*! + The handleInteraction is used launch WLAN list view. +*/ +bool WlanIndicatorPlugin::handleInteraction(InteractionType type) +{ + OstTraceFunctionEntry1(WLANINDICATORPLUGIN_HANDLEINTERACTION_ENTRY, this); + + bool handled = false; + switch (type) { + case InteractionActivated: + //connect error() to slot processError() to get error, + QObject::connect( &process, SIGNAL(error(QProcess::ProcessError)), + this, SLOT(processError(QProcess::ProcessError))); + + // Show WLAN list view + process.start("WlanSniffer"); + handled = true; + break; + default: + break; + } + + OstTraceFunctionExit1(WLANINDICATORPLUGIN_HANDLEINTERACTION_EXIT, this); + + return handled; +} + +/*! + The handleClientRequest handles client request to change indicators paramters. +*/ +bool WlanIndicatorPlugin::handleClientRequest(RequestType type, const QVariant ¶meter) +{ + OstTraceFunctionEntry1(WLANINDICATORPLUGIN_CLIENTREQUEST_ENTRY, this); + + Q_UNUSED(parameter) + bool handled(false); + switch (type) { + case RequestActivate: + if (mParameter != parameter) { + mParameter = parameter; + emit dataChanged(); + } + handled = true; + break; + default: + mParameter.clear(); + } + + OstTraceFunctionExit1(WLANINDICATORPLUGIN_CLIENTREQUEST_EXIT, this); + return handled; +} + +/*! + The indicatorData takes care of showing indicator's data. +*/ +QVariant WlanIndicatorPlugin::indicatorData(int role) const +{ + OstTraceFunctionEntry1(WLANINDICATORPLUGIN_INDICATORDATA_ENTRY, this); + + QVariant qvariant(""); + QList indicatorText; + bool validParameters = false; + + switch (role) { + case PrimaryTextRole: + qvariant = QString(hbTrId("txt_occ_dblist_indi_menu_wireless_lan")); + break; + case SecondaryTextRole: + if (mParameter.isValid() && mParameter.type() == QVariant::List) { + + indicatorText = mParameter.toList(); + validParameters = true; + } + if (validParameters && (indicatorText.size() > 0)) { + + if (indicatorText[0] == wlanNotConnected){ + qvariant = QString(hbTrId("txt_occ_dblist_wireless_lan_val_not_connected")); + } + + else if (indicatorText[0] == wlanConnected){ + QString iapName = indicatorText[1].toString(); + QString str = QString(hbTrId("txt_occ_dblist_wireless_lan_val_1_connected")); + qvariant = str.arg(iapName); + } + } + else + { + OstTrace0( WLANINDICATORPLUGIN_ERR,INVALID_PARAMS,"Invalid indicator parameters"); + } + break; + case IconNameRole: + if (mParameter.isValid()) { + OstTraceFunctionExit1(DUP1_WLANINDICATORPLUGIN_INDICATORDATA_EXIT, this); + qvariant = HbIcon("qtg_small_wlan"); + break; + } + case DecorationNameRole: + OstTraceFunctionExit1(DUP2_WLANINDICATORPLUGIN_INDICATORDATA_EXIT, this); + qvariant = HbIcon("qtg_small_wlan"); + break; + default: + OstTraceFunctionExit1(DUP3_WLANINDICATORPLUGIN_INDICATORDATA_EXIT, this); + break; + } + return qvariant; +} + +/*! + The processError is a handler for error codes. +*/ +void WlanIndicatorPlugin::processError(QProcess::ProcessError err) + { + OstTraceFunctionEntry1(WLANINDICATORPLUGIN_PROCESSERROR_ENTRY, this); + + switch (err) { + case QProcess::FailedToStart: + case QProcess::Crashed: + case QProcess::Timedout: + case QProcess::ReadError: + case QProcess::WriteError: + case QProcess::UnknownError: + OstTrace1( WLANINDICATORPLUGIN_ERR,PROCESSERROR_KNOWN,"Process Error %u", err); + break; + default: + OstTrace1( WLANINDICATORPLUGIN_ERR,PROCESSERROR_UNKNOWN,"Unknown Process Error %u", err); + break; + } + OstTraceFunctionExit1(WLANINDICATORPLUGIN_PROCESSERROR_EXIT, this); + } diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanindicatorplugin/src/wlanindicatorpluginimplementation.cpp --- a/wlanutilities/wlanindicatorplugin/src/wlanindicatorpluginimplementation.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,478 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanindicatorplugin/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/traces/OstTraceDefinitions.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +#include +#endif diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanindicatorplugin/wlanindicatorplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanindicatorplugin/wlanindicatorplugin.pro Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,45 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +CONFIG += plugin +CONFIG += hb + +# directories +DEPENDPATH += . +INCLUDEPATH += .\inc + +HEADERS += inc\wlanindicatorplugin.h \ + traces\OstTraceDefinitions.h + +SOURCES += src\wlanindicatorplugin.cpp + +TRANSLATIONS = wlanindicatorplugin.ts + +symbian*::LIBS += -HbCore -HbWidgets + +symbian*: { + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.CAPABILITY = CAP_GENERAL_DLL + TARGET.UID3 = 0x2002C39F + SYMBIAN_PLATFORMS = WINSCW ARMV5 + BLD_INF_RULES.prj_exports += "rom/wlanindicatorplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wlanindicatorplugin.iby)" + BLD_INF_RULES.prj_exports += "rom/wlanindicatorplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(wlanindicatorplugin_resources.iby)" + pluginstub.sources = wlanIndicatorplugin.dll + pluginstub.path = /resource/plugins/indicators + DEPLOYMENT += pluginstub +} + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanplugin/data/10281BCB.rss --- a/wlanutilities/wlanplugin/data/10281BCB.rss Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanplugin/data/wlanpluginrsc.rss --- a/wlanutilities/wlanplugin/data/wlanpluginrsc.rss Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanplugin/group/bld.inf --- a/wlanutilities/wlanplugin/group/bld.inf Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanplugin/group/wlanplugin.mmp --- a/wlanutilities/wlanplugin/group/wlanplugin.mmp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This is 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanplugin/group/wlanpluginicons.mk --- a/wlanutilities/wlanplugin/group/wlanpluginicons.mk Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -# -# Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanplugin/inc/wlanplugin.h --- a/wlanutilities/wlanplugin/inc/wlanplugin.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,246 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanplugin/inc/wlanplugindbobserver.h --- a/wlanutilities/wlanplugin/inc/wlanplugindbobserver.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanplugin/inc/wlanpluginlogger.h --- a/wlanutilities/wlanplugin/inc/wlanpluginlogger.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanplugin/inc/wlanplugintimeshifter.h --- a/wlanutilities/wlanplugin/inc/wlanplugintimeshifter.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanplugin/inc/wlanpluginwlanstate.h --- a/wlanutilities/wlanplugin/inc/wlanpluginwlanstate.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,347 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanplugin/loc/wlanplugin.loc --- a/wlanutilities/wlanplugin/loc/wlanplugin.loc Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Localization 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanplugin/rom/wlanplugin.iby --- a/wlanutilities/wlanplugin/rom/wlanplugin.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanplugin/rom/wlanpluginresources.iby --- a/wlanutilities/wlanplugin/rom/wlanpluginresources.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanplugin/src/wlanplugin.cpp --- a/wlanutilities/wlanplugin/src/wlanplugin.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,482 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanplugin/src/wlanplugindbobserver.cpp --- a/wlanutilities/wlanplugin/src/wlanplugindbobserver.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Implementation of 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanplugin/src/wlanpluginimplementationtable.cpp --- a/wlanutilities/wlanplugin/src/wlanpluginimplementationtable.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanplugin/src/wlanplugintimeshifter.cpp --- a/wlanutilities/wlanplugin/src/wlanplugintimeshifter.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanplugin/src/wlanpluginwlanstate.cpp --- a/wlanutilities/wlanplugin/src/wlanpluginwlanstate.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,783 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Implementation of 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/base/inc/wlanqtutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/base/inc/wlanqtutils.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,169 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +*/ + +#ifndef WLANQTUTILS_H +#define WLANQTUTILS_H + +#include + +#include "wlanqtutilscommon.h" + +class WlanQtUtilsIap; +class WlanQtUtilsWlanIap; +class WlanQtUtilsWlanAp; +class WlanQtUtilsPrivate; + +const int WlanQtUtilsInvalidIapId = -1; + +/** + * Wlan Qt Utilities. + * + * This class provides a Qt API to UI components for retrieving different kind of information + * related to WLAN functionality. + */ +class WLANQTUTILITIESDLL_EXPORT WlanQtUtils : public QObject +{ + Q_OBJECT + +public: + + /** + * Constructor. + */ + WlanQtUtils(); + + /** + * Destructor. + */ + ~WlanQtUtils(); + + /** + * Function to request details of available WLAN networks. Can be called at any time, calling right + * after wlanScanReady() signal ensures you get the most recent results. + * + * @param[out] wlanIapList List of available WLAN IAPs. + * @param[out] wlanApList List of unknown WLAN APs. + */ + void availableWlanAps( + QList &wlanIapList, + QList &wlanApList); + + /** + * Function to create an IAP from the given WLAN access point. + * + * @param[in] wlanAp Access point containing parameters to include in the new IAP. + * @return ID of the newly created IAP. + */ + int createWlanIap(const WlanQtUtilsWlanAp *wlanAp); + + /** + * Function to start connection creation for the given IAP. connectionStatus() signal will be emitted + * when connection creation succeeds or fails. + * + * @param[in] iapId ID of the IAP to be connected. + */ + void connectIap(int iapId); + + /** + * Function to disconnect the given IAP. + * + * @param[in] iapId ID of the IAP to be disconnected. + */ + void disconnectIap(int iapId); + + /** + * Function to retrieve a pointer to the IAP with the given ID. + * + * @param[in] iapId ID of the requested IAP. + * @return Pointer to the found IAP, NULL if not found. + */ + WlanQtUtilsIap *iap(int iapId) const; + + /** + * Function for getting the master WLAN status. + * + * @return Master WLAN status: true if enabled, otherwise false. + */ + bool masterWlan() const; + + /** + * Function for switching the master WLAN status ON or OFF. + * + * @param[in] enabled If set to true, WLAN is switched ON, and vice versa. + */ + void setMasterWlan(bool enabled); + + /** + * Function for getting the ID of the (possibly) connected WLAN IAP. + * + * @return ID of the connected IAP, WlanQtUtilsInvalidIapId if not valid. + */ + int connectedWlanId() const; + + /** + * Function for requesting a WLAN scan to be triggered. Currently triggers + * only a single scan, but can be extended to perform also periodic scans, + * if needed in the future. + * + * Signal wlanScanReady() is emitted when new scan results are available. + */ + void scanWlans(); + +signals: + + /** + * Signal indicating that WLAN scan results are available. + */ + void wlanScanReady(); + + /** + * Signal indicating that new WLAN network has been opened. + * + * @param[in] iapId ID of the opened IAP. + */ + void wlanNetworkOpened(int iapId); + + /** + * Signal indicating that a WLAN network has been closed. + * + * @param[in] iapId ID of the closed IAP. + */ + void wlanNetworkClosed(int iapId); + + /** + * Signal indicating that the WLAN master status has changed. + */ + void masterWlanStatus(bool enabled); + +private: // Data + + /** Pointer to private implementation */ + WlanQtUtilsPrivate *d_ptr; + +private: // Friend classes + + // This is defined as a friend class in order to be able to emit public signals + // directly from private implementation code. + friend class WlanQtUtilsPrivate; + + // This is defined as a friend class in order to be able to + // call event handlers of wrappers from test code. + friend class TestWlanQtUtils; +}; + +#endif /* WLANQTUTILS_H */ + +// End of File diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/base/inc/wlanqtutils_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/base/inc/wlanqtutils_p.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,239 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +*/ + +#ifndef WLANQTUTILS_P_H +#define WLANQTUTILS_P_H + +#include +#include + +#include "wlanqtutilscommon.h" + +class WlanQtUtils; +class WlanQtUtilsIap; +class WlanQtUtilsWlanIap; +class WlanQtUtilsWlanAp; +class WlanQtUtilsActiveConn; +class ConMonWrapper; +class CmmWrapper; +class EsockWrapper; +class ConnTestWrapper; + +/** + * Private implementation of Wlan Qt Utilities. + */ +class WlanQtUtilsPrivate : public QObject +{ + Q_OBJECT + +public: + + /** + * Constructor. + */ + WlanQtUtilsPrivate(WlanQtUtils *publicPtr); + + /** + * Destructor. + */ + ~WlanQtUtilsPrivate(); + + // Functions duplicating WlanQtUtils public interface + + /** + * Function to request details of available WLAN networks. Can be called at any time, calling right + * after wlanScanReady() signal ensures you get the most recent results. + * + * @param[out] wlanIapList List of available WLAN IAPs. + * @param[out] wlanApList List of unknown WLAN APs. + */ + void availableWlanAps( + QList &wlanIapList, + QList &wlanApList); + + /** + * Function to create an IAP from the given WLAN access point. + * + * @param[in] wlanAp Access point containing parameters to include in the new IAP. + * @return ID of the newly created IAP. + */ + int createWlanIap(const WlanQtUtilsWlanAp *wlanAp); + + /** + * Function to start connection creation for the given IAP. connectionStatus() signal will be emitted + * when connection creation succeeds or fails. + * + * @param[in] iapId ID of the IAP to be connected. + */ + void connectIap(int iapId); + + /** + * Function to disconnect the given IAP. + * + * @param[in] iapId ID of the IAP to be disconnected. + */ + void disconnectIap(int iapId); + + /** + * Function to retrieve a pointer to the IAP with the given ID. + * + * @param[in] iapId ID of the requested IAP. + * @return Pointer to the found IAP, NULL if not found. + */ + WlanQtUtilsIap *iap(int iapId) const; + + /** + * Function for getting the master WLAN status. + * + * @return Master WLAN status: true if enabled, otherwise false. + */ + bool masterWlan() const; + + /** + * Function for switching the master WLAN status ON or OFF. + * + * @param[in] enabled If set to true, WLAN is switched ON, and vice versa. + */ + void setMasterWlan(bool enabled); + + /** + * Function for getting the ID of the (possibly) connected WLAN IAP. + * + * @return ID of the connected IAP, WlanQtUtilsInvalidIapId if not valid. + */ + int connectedWlanId() const; + + /** + * Function for requesting a WLAN scan to be triggered. Currently triggers + * only a single scan, but can be extended to perform also periodic scans, + * if needed in the future. + * + * Signal wlanScanReady() is emitted when new scan results are available. + */ + void scanWlans(); + +private slots: + + /** + * Slot for handling WLAN scan result event from wrapper. Results are stored in member variable + * (possible duplicates are removed). + * + * @param[in] availableWlans WLAN networks found in scan. + */ + void updateAvailableWlanAps(QList &availableWlans); + + /** + * Slot for handling connection setup status event from wrapper. + * + * @param[in] isOpened Was connection setup successful? + */ + void updateConnectionStatus(bool isOpened); + + /** + * Slot for handling connectivity test result event from wrapper. Tested IAP is stored to + * Internet SNAP, if test was successful. + * + * @param[in] result Was the test successful? + */ + void updateConnectivityTestResult(bool result); + + /** + * Slot for updating active connection status from wrapper. + * + * @param[in] connectionId ID of the new connection. + */ + void addActiveConnection(uint connectionId); + + /** + * Slot for updating active connection status from wrapper. + * + * @param[in] connectionId ID of the deleted connection. + */ + void removeActiveConnection(uint connectionId); + + /** + * Slot for updating active connection status from wrapper. + * + * @param[in] connectionId ID of the updated connection. + * @param[in] connectionStatus New status of the connection. + */ + void updateActiveConnection(uint connectionId, WlanQtUtilsConnectionStatus connectionStatus); + +private: + + int fetchIaps(); + + /** + * This function searches for a WLAN IAP with the given WLAN parameters. + * + * @param[in] ssid SSID to search for. + * @param[in] secMode Security mode to search for. + * @return True, if suitable WLAN IAP found, false otherwise. + */ + bool wlanIapExists(QString ssid, WlanQtUtilsWlanSecMode secMode); + + /** + * This function updates the connection status of: + * - IAP with the given ID + * - all other IAPs, which represent the same network (SSID & security mode match) + * + * @param[in] iapId ID of the IAP whose status is to be updated. + * @param[in] status Updated connection status. + */ + void updateIapConnectionStatuses(int iapId, WlanQtUtilsConnectionStatus status); + +private: // Data + + /** Pointer to public implementation */ + WlanQtUtils *q_ptr; + + /** Wrapper object for Connection Method Manager. */ + CmmWrapper *cmmWrapper_; + + /** Wrapper object for Connection Monitor and other parts of connmon library. */ + ConMonWrapper *conMonWrapper_; + + /** Wrapper object for esock library. */ + EsockWrapper *esockWrapper_; + + /** Wrapper object for Internet Connectivity Test library. */ + ConnTestWrapper *connTestWrapper_; + + /** List of available WLAN APs according to the latest scan. */ + QList wlanScanList_; + + /** List of WLAN IAPs configured to the device. */ + QMap wlanIapList_; + + /** ID of IAP requiring ICT running, -1 if not valid. */ + int toBeTestedIapId_; + + /** ID of IAP being connected by us (requested by UI), -1 if not valid. */ + int connectingIapId_; + + /** Information of possible active connection. */ + WlanQtUtilsActiveConn *activeConnection_; + +private: // Friend classes + + // This is defined as a friend class in order to be able to + // call event handlers of wrappers from test code. + friend class TestWlanQtUtils; +}; + +#endif /* WLANQTUTILS_P_H */ + +// End of File diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/base/inc/wlanqtutilsactiveconn.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/base/inc/wlanqtutilsactiveconn.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,113 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is the header file for WlanQtUtilsActiveConn class. +*/ + +#ifndef WLANQTUTILSACTIVECONN_H +#define WLANQTUTILSACTIVECONN_H + +#include +#include "wlanqtutilscommon.h" + + +/** + * This class represents an active connection. + * TODO: consider deriving own classes for WLAN and Cellular connections. + * Still, we can keep the same interface and avoid dynamic_casts. + */ +class WlanQtUtilsActiveConn : public QObject +{ +public: + + /** + * Constructor. + */ + WlanQtUtilsActiveConn(); + + /** + * Destructor. + */ + virtual ~WlanQtUtilsActiveConn(); + + /** + * Getter. + * + * @return Connection ID specific for Connection Monitor Server. + */ + uint connectionId() const; + + /** + * Setter. + * + * @param[in] connectionId Connection ID specific for Connection Monitor Server. + */ + void setConnectionId(uint connectionId); + + /** + * Getter. + * + * @return IAP ID. + */ + uint iapId() const; + + /** + * Setter. + * + * @param[in] iapId IAP ID. + */ + void setIapId(uint iapId); + + /** + * Getter. + * + * @return Status of the connection. + */ + WlanQtUtilsConnectionStatus connectionStatus() const; + + /** + * Setter. + * + * @param[in] connectionStatus Status of the connection. + */ + void setConnectionStatus(WlanQtUtilsConnectionStatus connectionStatus); + + /** + * Getter. + * + * @return Bearer type. + */ + WlanQtUtilsBearerType bearerType() const; + + /** + * Setter. + * + * @param[in] bearerType Bearer type. + */ + void setBearerType(WlanQtUtilsBearerType bearerType); + +private: // Data + + /** Connection Monitor Server specific connection ID. */ + uint connectionId_; + /** IAP ID. */ + uint iapId_; + + /** Connection status. */ + WlanQtUtilsConnectionStatus connectionStatus_; + /** Bearer type. */ + WlanQtUtilsBearerType bearerType_; +}; + +#endif /* WLANQTUTILSACTIVECONN_H */ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/base/inc/wlanqtutilscommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/base/inc/wlanqtutilscommon.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef WLANQTUTILSCOMMON_H +#define WLANQTUTILSCOMMON_H + +#ifdef BUILD_WLANQTUTILITIES_DLL +#define WLANQTUTILITIESDLL_EXPORT Q_DECL_EXPORT +#else +#define WLANQTUTILITIESDLL_EXPORT Q_DECL_IMPORT +#endif + +// Maximum length of WLAN SSID (limit also for number of characters for user input) +static const int KMaxSsidLen = 32; +// Maximum length of WEP key +static const int KMaxWEPKeyLen = 64; +// Maximum length of WPA key +static const int KMaxWPAKeyLen = 256; + +/** + * Bearer type. + */ +enum WlanQtUtilsBearerType { + WlanQtUtilsBearerTypeNone = 0, ///< None of the bearer types. + WlanQtUtilsBearerTypeCellular , ///< Cellular (2G, 3G, 3.5G) bearer type. + WlanQtUtilsBearerTypeWlan ///< WLAN bearer type. +}; + +/** + * Connection status. + */ +enum WlanQtUtilsConnectionStatus { + WlanQtUtilsConnectionStatusNone = 0, ///< None of the connection statuses. + WlanQtUtilsConnectionStatusConnecting, ///< Connecting. + WlanQtUtilsConnectionStatusConnected, ///< Connected. + WlanQtUtilsConnectionStatusDisconnected ///< Disconnected. +}; + +/** + * Signal strength category boundaries in dB (absolute value). + * Smaller value means better signal. + */ +// TODO: WLAN signal level values valid are copied from 08wk41 Sniffer. OK? +// (WINS emulator gives just 0 which is equal to "Absolute max"...) +enum +{ + WlanQtUtilsWlanSignalStrengthAbsoluteMax = 0, ///< Absolute maximum signal strength. + WlanQtUtilsWlanSignalStrengthMax = 60, ///< Maximum signal strength. + WlanQtUtilsWlanSignalStrengthGood = 74, ///< Good signal strength. + WlanQtUtilsWlanSignalStrengthLow = 87, ///< signal strength. + WlanQtUtilsWlanSignalStrengthMin = 100, ///< Minimum signal strength. + WlanQtUtilsWlanSignalUnavailable = 9999, ///< Signal is unavailable. +}; + +/** WLAN signal is unknown. */ +const int WlanQtUtilsWlanSignalUnknown = 1000000; + +/** WLAN transmit power is unknown. */ +const unsigned WlanQtUtilsWlanTransmitPowerUnknown = 0xFFFFFFFF; + +/** + * WLAN security modes. + * Mapping functions exist for reading and writing these values + * from / to ConnMon and CMM. + */ +enum WlanQtUtilsWlanSecMode +{ + WlanQtUtilsWlanSecModeNone = 100, ///< None of the security modes. + WlanQtUtilsWlanSecModeOpen = 101, ///< Open security mode. + WlanQtUtilsWlanSecModeWep = 102, ///< WEP security mode. + WlanQtUtilsWlanSecMode802_1x = 103, ///< 802.1x security mode. + WlanQtUtilsWlanSecModeWpa = 104, ///< WPA security mode. + WlanQtUtilsWlanSecModeWpa2 = 105 ///< WPA@ security mode. +}; + +/** + * WLAN connection modes. + */ +enum WlanQtUtilsWlanConnMode +{ + WlanQtUtilsWlanConnModeNone = 200, ///< None of the connection modes. + WlanQtUtilsWlanConnModeInfraStructure = 201, ///< Infrastructure connection mode. + WlanQtUtilsWlanConnModeAdHoc = 202, ///< Adhoc connection mode. + WlanQtUtilsWlanConnModeSecureInfra = 203, ///< Secure infrastructure connection mode.´ +}; + +#endif // WLANQTUTILSCOMMON_H diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/base/inc/wlanqtutilsiap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/base/inc/wlanqtutilsiap.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is a header file for WlanQtUtilsIap class. +*/ + +#ifndef WLANQTUTILSIAP_H +#define WLANQTUTILSIAP_H + +#include +#include "wlanqtutilscommon.h" + +class QString; + +class WLANQTUTILITIESDLL_EXPORT WlanQtUtilsIap : public QObject +{ + +public: + + WlanQtUtilsIap(); + WlanQtUtilsIap( + int id, + int netId, + QString name, + WlanQtUtilsBearerType bearerType); + virtual ~WlanQtUtilsIap(); + + int id() const; + int networkId() const; + QString name() const; + WlanQtUtilsBearerType bearerType() const; + WlanQtUtilsConnectionStatus connectionStatus() const; + + void setId(int id); + void setNetworkId(int NetId); + void setName(QString name); + void setBearerType(WlanQtUtilsBearerType bearerType); + void setConnectionStatus(WlanQtUtilsConnectionStatus connectionStatus); + +private: + int id_; + int netId_; + QString name_; + WlanQtUtilsBearerType bearerType_; + WlanQtUtilsConnectionStatus connectionStatus_; + // TODO: SNAP ID list +}; + +#endif /* WLANQTUTILSIAP_H */ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/base/inc/wlanqtutilswlanap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/base/inc/wlanqtutilswlanap.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,167 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is the header file for WlanQtUtilsWlanAp class. +*/ + +#ifndef WLANQTUTILSWLANAP_H +#define WLANQTUTILSWLANAP_H + +#include +#include +#include "wlanqtutilscommon.h" + +class QString; + +/** + * This class represents WLAN access point (AP). + */ +class WLANQTUTILITIESDLL_EXPORT WlanQtUtilsWlanAp : public QObject +{ +public: + + /** + * Constructor. + */ + WlanQtUtilsWlanAp(); + + /** + * Copy constructor. + */ + WlanQtUtilsWlanAp(const WlanQtUtilsWlanAp &ref); + + /** + * Constructor. + * + * @param ssid SSID. + * @param bssid BSSID, that is, MAC address. + * @param signalStrength Signal strength. + * @param connectionMode Connection mode as TConnMonNetworkMode. + * @param securityMode WLAN Security mode. + */ + WlanQtUtilsWlanAp( + QString ssid, + QString bssid, + int signalStrength, + int connectionMode, + WlanQtUtilsWlanSecMode securityMode); + + /** + * Destructor. + */ + virtual ~WlanQtUtilsWlanAp(); + + /** + * Returns SSID. + * + * @return SSID. + */ + QString ssid() const; + + /** + * Getter. + * + * @return BSSID. + */ + QString bssid() const; + + /** + * Getter. + * + * @return Signal strength. + */ + int signalStrength() const; + + /** + * Getter. + * + * @return Connection mode as TConnMonNetworkMode. + */ + int connectionMode() const; + + /** + * Getter. + * + * @return Security mode as WlanQtUtilsWlanSecMode. + */ + WlanQtUtilsWlanSecMode securityMode() const; + + /** + * Getter. + * + * @return Security key. + */ + QString securityKey() const; + + /** + * Setter. + * + * @param SSID. + */ + void setSsid(QString ssid); + + /** + * Setter. + * + * @param BSSID. + */ + void setBssid(QString bssid); + + /** + * Setter. + * + * @param Signal strength. + */ + void setSignalStrength(int signalStrength); + + /** + * Setter. + * + * @param connectionMode Connection mode as TConnMonNetworkMode. + */ + void setConnectionMode(int connectionMode); + + /** + * Setter. + * + * @param securityMode WLAN Security mode. + */ + void setSecurityMode(WlanQtUtilsWlanSecMode securityMode); + + /** + * Setter. + * + * @param securityKey WLAN Security key. + */ + void setSecurityKey(QString securityKey); + +private: //data + + /** SSID */ + QString ssid_; + /** BSSID, that is, MAC address. */ + QString bssid_; // TODO: Check if QString is suitable + /** Signal strength. */ + int signalStrength_; + /** Connection mode as TConnMonNetworkMode. */ + int connectionMode_; + /** WLAN security mode. */ + WlanQtUtilsWlanSecMode securityMode_; + /** Security key, if available. */ + QString securityKey_; +}; + +Q_DECLARE_METATYPE(WlanQtUtilsWlanAp) + +#endif /* WLANQTUTILSWLANIAP_H */ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/base/inc/wlanqtutilswlaniap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/base/inc/wlanqtutilswlaniap.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is a header file for WlanQtUtilsWlanIap class. +*/ + +#ifndef WLANQTUTILSWLANIAP_H +#define WLANQTUTILSWLANIAP_H + +#include "wlanqtutilscommon.h" +#include "wlanqtutilsiap.h" + +class WLANQTUTILITIESDLL_EXPORT WlanQtUtilsWlanIap : public WlanQtUtilsIap +{ + // Q_OBJECT macro needed for qobject_cast to work + Q_OBJECT + +public: + WlanQtUtilsWlanIap(); + WlanQtUtilsWlanIap(int id, int netId, QString name, WlanQtUtilsBearerType bearerType, QString ssid, WlanQtUtilsWlanSecMode securityMode); + virtual ~WlanQtUtilsWlanIap(); + + QString ssid() const; + int signalStrength() const; + WlanQtUtilsWlanSecMode securityMode() const; + + void setSsid(QString ssid); + void setSignalStrength(int signalStrength); + void setSecurityMode(WlanQtUtilsWlanSecMode securityMode); + +private: + QString ssid_; + int signalStrength_; + WlanQtUtilsWlanSecMode securityMode_; + // TODO: secKey_ (type unknown) +}; + +#endif /* WLANQTUTILSWLANIAP_H */ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/base/src/wlanqtutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/base/src/wlanqtutils.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +*/ + +#include "wlanqtutilswlanap.h" +#include "wlanqtutilswlaniap.h" + +#include "wlanqtutils_p.h" +#include "wlanqtutils.h" + +WlanQtUtils::WlanQtUtils() +{ + d_ptr = new WlanQtUtilsPrivate(this); +} + +WlanQtUtils::~WlanQtUtils() +{ + delete d_ptr; +} + +void WlanQtUtils::availableWlanAps( + QList &wlanIapList, + QList &wlanApList) +{ + d_ptr->availableWlanAps(wlanIapList, wlanApList); +} + +int WlanQtUtils::createWlanIap(const WlanQtUtilsWlanAp *wlanAp) +{ + return d_ptr->createWlanIap(wlanAp); +} + +void WlanQtUtils::connectIap(int iapId) +{ + d_ptr->connectIap(iapId); +} + +void WlanQtUtils::disconnectIap(int iapId) +{ + d_ptr->disconnectIap(iapId); +} + +WlanQtUtilsIap *WlanQtUtils::iap(int iapId) const +{ + return d_ptr->iap(iapId); +} + +bool WlanQtUtils::masterWlan() const +{ + return d_ptr->masterWlan(); +} + +void WlanQtUtils::setMasterWlan(bool enabled) +{ + d_ptr->setMasterWlan(enabled); +} + +int WlanQtUtils::connectedWlanId() const +{ + return d_ptr->connectedWlanId(); +} + +void WlanQtUtils::scanWlans() +{ + d_ptr->scanWlans(); +} + +// End of File diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/base/src/wlanqtutils_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/base/src/wlanqtutils_p.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,490 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +*/ + +#include "wlanqtutilswlanap.h" +#include "wlanqtutilswlaniap.h" +#include "wlanqtutilsactiveconn.h" +#include "wlanqtutilscmmwrapper.h" +#include "wlanqtutilsconmonwrapper.h" +#include "wlanqtutilsesockwrapper.h" +#include "wlanqtutilsconntestwrapper.h" + +#include "wlanqtutils.h" +#include "wlanqtutils_p.h" + +#ifdef WLANQTUTILS_NO_OST_TRACES_FLAG +#include +#else +#include "OstTraceDefinitions.h" +#endif +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanqtutils_pTraces.h" +#endif + + +WlanQtUtilsPrivate::WlanQtUtilsPrivate(WlanQtUtils *publicPtr) : + q_ptr(publicPtr), + wlanScanList_(), + wlanIapList_(), + toBeTestedIapId_(WlanQtUtilsInvalidIapId), + connectingIapId_(WlanQtUtilsInvalidIapId), + activeConnection_(NULL) +{ + OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_WLANQTUTILSPRIVATE_ENTRY, this ); + + // Let's allocate memory for wrapper objects. + // Engine is set as a parent for wrapper objects. + cmmWrapper_ = new CmmWrapper(this); + conMonWrapper_ = new ConMonWrapper(this); + esockWrapper_ = new EsockWrapper(this); + connTestWrapper_ = new ConnTestWrapper(this); + + // Make all connections. + // Todo: having these as signals from the wrappers doesn't bring much benefit + // -> could be optimized as normal callbacks + connect( + conMonWrapper_, + SIGNAL(availableWlanApsFromWrapper(QList&)), + this, + SLOT(updateAvailableWlanAps(QList&))); + + connect( + esockWrapper_, + SIGNAL(connectionStatusFromWrapper(bool)), + this, + SLOT(updateConnectionStatus(bool))); + + connect( + connTestWrapper_, + SIGNAL(connectivityTestResult(bool)), + this, + SLOT(updateConnectivityTestResult(bool))); + + connect( + conMonWrapper_, + SIGNAL(connCreatedEventFromWrapper(uint)), + this, + SLOT(addActiveConnection(uint))); + + connect( + conMonWrapper_, + SIGNAL(connDeletedEventFromWrapper(uint)), + this, + SLOT(removeActiveConnection(uint))); + + connect( + conMonWrapper_, + SIGNAL(connStatusEventFromWrapper(uint, WlanQtUtilsConnectionStatus)), + this, + SLOT(updateActiveConnection(uint, WlanQtUtilsConnectionStatus))); + + // Fetch the initial IAP configuration + fetchIaps(); + + // Retrieve initial status of active connections and update IAPs, if needed. + activeConnection_ = conMonWrapper_->activeConnection(); + if (activeConnection_ != NULL) { + updateIapConnectionStatuses(activeConnection_->iapId(), activeConnection_->connectionStatus()); + } + + // TODO: error handling + + OstTraceFunctionExit1( WLANQTUTILSPRIVATE_WLANQTUTILSPRIVATE_EXIT, this ); +} + +WlanQtUtilsPrivate::~WlanQtUtilsPrivate() +{ + OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_WLANQTUTILSPRIVATEDESTR_ENTRY, this ); + + // Delete WLAN scan list + for (int i = 0; i < wlanScanList_.count(); i++) { + delete wlanScanList_[i]; + } + wlanScanList_.clear(); + + delete activeConnection_; + + delete cmmWrapper_; + delete conMonWrapper_; + delete esockWrapper_; + delete connTestWrapper_; + + OstTraceFunctionExit1( WLANQTUTILSPRIVATE_WLANQTUTILSPRIVATEDESTR_EXIT, this ); +} + +void WlanQtUtilsPrivate::availableWlanAps( + QList &wlanIapList, + QList &wlanApList) +{ + OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_AVAILABLEWLANAPS_ENTRY, this ); + + wlanIapList.clear(); + wlanApList.clear(); + + // Add possible connected or connecting IAP as the first item in the list + int activeIapId = WlanQtUtilsInvalidIapId; + if (activeConnection_ != NULL) { + activeIapId = activeConnection_->iapId(); + } else if (connectingIapId_ != WlanQtUtilsInvalidIapId) { + activeIapId = connectingIapId_; + } + if (wlanIapList_.contains(activeIapId)) { + wlanIapList_[activeIapId]->setSignalStrength(WlanQtUtilsWlanSignalStrengthMax); + wlanIapList_[activeIapId]->setConnectionStatus(WlanQtUtilsConnectionStatusConnected); + wlanIapList.append(wlanIapList_[activeIapId]); + } + + // Todo: IAPs with same SSID and security mode? probably we want to show only one of them? + + // Match IAPs against WLAN scan results + foreach (WlanQtUtilsWlanIap *iap, wlanIapList_) { + foreach (WlanQtUtilsWlanAp *scanAp, wlanScanList_) { + // Todo: security mode check + if (iap->ssid() == scanAp->ssid()) { + // IAP found, add it to caller's list of known IAPs (signal strength needs to be + // updated manually since the IAP in our list does not have that information yet) + iap->setSignalStrength(scanAp->signalStrength()); + if (iap->id() != activeIapId) { + wlanIapList.append(iap); + } // else: connected IAP, added as the first item in the list already + break; + } + } + } + + // Go through the scan results to find unknown APs + for (int i = 0; i < wlanScanList_.count(); i++) { + // Skip networks with empty SSID (hidden networks are handled by UI currently) + if (wlanScanList_[i]->ssid().isEmpty() == FALSE) { + // Check whether an IAP with these parameters exists in any SNAP (in which case this + // network should not be shown as available in this SNAP) + if (wlanIapExists(wlanScanList_[i]->ssid(), wlanScanList_[i]->securityMode()) == false) { + // No IAP found in any SNAP, copy the AP to caller's list of unknown APs + wlanApList.append(wlanScanList_[i]); + } + } + } + + // Sort APs by their SSIDs. + QMap wlanApMap; + // Loop the AP list copying the keys (lower case SSID) and elements + // into the map. + for (int i = 0; i < wlanApList.count(); i++ ) { + wlanApMap.insertMulti(wlanApList[i]->ssid().toLower(), wlanApList[i]); + } + wlanApList = wlanApMap.values(); + + OstTraceFunctionExit1( WLANQTUTILSPRIVATE_AVAILABLEWLANAPS_EXIT, this ); +} + +int WlanQtUtilsPrivate::createWlanIap(const WlanQtUtilsWlanAp *wlanAp) +{ + OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_CREATEWLANIAP_ENTRY, this ); + + // Create the new IAP. Store its ID, because we need to run ICT for it later + WlanQtUtilsWlanIap *newIap = cmmWrapper_->createWlanIap(wlanAp); + toBeTestedIapId_ = newIap->id(); + wlanIapList_.insert(newIap->id(), newIap); + + OstTrace1( + TRACE_API, + WLANQTUTILSPRIVATE_CREATEWLANIAP, + "WlanQtUtilsPrivate::createWlanIap;New IAP ID=%d", toBeTestedIapId_ ); + OstTraceFunctionExit1( WLANQTUTILSPRIVATE_CREATEWLANIAP_EXIT, this ); + return toBeTestedIapId_; +} + +void WlanQtUtilsPrivate::connectIap(int iapId) +{ + OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_CONNECTIAP_ENTRY, this ); + OstTrace1( TRACE_API, WLANQTUTILSPRIVATE_CONNECTIAP, "WlanQtUtilsPrivate::connectIap;IAP ID=%d", iapId ); + + Q_ASSERT(activeConnection_ == NULL); + connectingIapId_ = iapId; + esockWrapper_->connectIap(iapId); + + OstTraceFunctionExit1( WLANQTUTILSPRIVATE_CONNECTIAP_EXIT, this ); +} + +void WlanQtUtilsPrivate::disconnectIap(int iapId) +{ + OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_DISCONNECTIAP_ENTRY, this ); + OstTrace1( TRACE_API, WLANQTUTILSPRIVATE_DISCONNECTIAP, "WlanQtUtilsPrivate::disconnectIap;IAP ID=%d", iapId ); + + Q_ASSERT(activeConnection_ != NULL); + Q_ASSERT(activeConnection_->iapId() == iapId); + Q_ASSERT(wlanIapList_.contains(iapId)); + + // Todo: IAP may have been opened by someone else... how to know when to disconnect RConnection? + esockWrapper_->disconnectIap(); + + // In order to close connection even if there are other users for the IAP, close also via ConMon + conMonWrapper_->disconnectIap(iapId); + // Change status of the IAP to non-connected + wlanIapList_[iapId]->setConnectionStatus(WlanQtUtilsConnectionStatusDisconnected); + + OstTraceFunctionExit1( WLANQTUTILSPRIVATE_DISCONNECTIAP_EXIT, this ); +} + +WlanQtUtilsIap *WlanQtUtilsPrivate::iap(int iapId) const +{ + if (wlanIapList_.contains(iapId)) { + return wlanIapList_.value(iapId); + } + // else: no match + return NULL; +} + +bool WlanQtUtilsPrivate::masterWlan() const +{ + OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_MASTERWLAN_ENTRY, this ); + + // TODO: Add actual implementation, this is just temporary dummy for testing wlanentryplugin! + + OstTraceFunctionExit1( WLANQTUTILSPRIVATE_MASTERWLAN_EXIT, this ); + return true; +} + +void WlanQtUtilsPrivate::setMasterWlan(bool enabled) +{ + OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_SETMASTERWLAN_ENTRY, this ); + + // TODO: Add actual implementation. + (void)enabled; + + OstTraceFunctionExit1( WLANQTUTILSPRIVATE_SETMASTERWLAN_EXIT, this ); +} + +int WlanQtUtilsPrivate::connectedWlanId() const +{ + OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_CONNECTEDWLANID_ENTRY, this ); + + int retVal = WlanQtUtilsInvalidIapId; + if (activeConnection_ != NULL) { + retVal = activeConnection_->iapId(); + } + OstTraceFunctionExit1( WLANQTUTILSPRIVATE_CONNECTEDWLANID_EXIT, this ); + return retVal; +} + +void WlanQtUtilsPrivate::scanWlans() +{ + OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_SCANWLANS_ENTRY, this ); + + // Just forward the request to wrapper, which triggers a single WLAN scan + conMonWrapper_->scanAvailableWlanAPs(); + + OstTraceFunctionExit1( WLANQTUTILSPRIVATE_SCANWLANS_EXIT, this ); +} + +void WlanQtUtilsPrivate::updateAvailableWlanAps(QList &availableWlanList) +{ + OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_UPDATEAVAILABLEWLANAPS_ENTRY, this ); + + // Old results are removed + wlanScanList_.clear(); + // Copy available WLAN's to engine's scan result list (duplicates are removed) + for (int i = 0; i < availableWlanList.count(); i++) { + bool duplicate = false; + for (int j = 0; j < wlanScanList_.count(); j++) { + if (availableWlanList[i]->ssid() == wlanScanList_[j]->ssid() + && availableWlanList[i]->securityMode() == wlanScanList_[j]->securityMode()) { + duplicate = true; + break; + } + } + if (duplicate == false) { + wlanScanList_.append(availableWlanList[i]); + } + // Todo: else deallocate? + } + + // the information is forwarded to the UI + emit q_ptr->wlanScanReady(); + + OstTraceFunctionExit1( WLANQTUTILSPRIVATE_UPDATEAVAILABLEWLANAPS_EXIT, this ); +} + +void WlanQtUtilsPrivate::updateConnectionStatus(bool isOpened) +{ + OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_UPDATECONNECTIONSTATUS_ENTRY, this ); + OstTrace1( + TRACE_API, + WLANQTUTILSPRIVATE_UPDATECONNECTIONSTATUS, + "WlanQtUtilsPrivate::updateConnectionStatus;isOpened=%d", isOpened ); + + if (isOpened == false) { + // Opening failed, update connection statuses, but don't inform UI about + // connection closing here. It is done always in removeActiveConnection(). + if (activeConnection_ != NULL) { + activeConnection_->setConnectionStatus(WlanQtUtilsConnectionStatusDisconnected); + } + updateIapConnectionStatuses(connectingIapId_, WlanQtUtilsConnectionStatusDisconnected); + } else { + // Opening succeeded, update connection statuses and inform UI + if (activeConnection_ != NULL) { + activeConnection_->setConnectionStatus(WlanQtUtilsConnectionStatusConnected); + } + updateIapConnectionStatuses(connectingIapId_, WlanQtUtilsConnectionStatusConnected); + emit q_ptr->wlanNetworkOpened(connectingIapId_); + + // Start ICT, if needed + if (connectingIapId_ == toBeTestedIapId_) { + WlanQtUtilsIap *iap = WlanQtUtilsPrivate::iap(toBeTestedIapId_); + connTestWrapper_->startConnectivityTest(toBeTestedIapId_, iap->networkId()); + } + } + // IAP is no more in connecting state + connectingIapId_ = WlanQtUtilsInvalidIapId; + + OstTraceFunctionExit1( WLANQTUTILSPRIVATE_UPDATECONNECTIONSTATUS_EXIT, this ); +} + +void WlanQtUtilsPrivate::updateConnectivityTestResult(bool result) +{ + OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_UPDATECONNECTIVITYTESTRESULT_ENTRY, this ); + OstTrace1( + TRACE_API, + WLANQTUTILSPRIVATE_UPDATECONNECTIVITYTESTRESULT, + "WlanQtUtilsPrivate::updateConnectivityTestResult;result=%d", result ); + + if (result == true) { + // Move the tested IAP to Internet SNAP since the test passed + Q_ASSERT(toBeTestedIapId_ != WlanQtUtilsInvalidIapId); + cmmWrapper_->moveIapToInternetSnap(toBeTestedIapId_); + } // else: do nothing, IAP remains to be uncategorized + else + { + // TODO: Remove this. This is needed now since the connectivity test fails + // and thus the IAP is not shown correctly. + cmmWrapper_->moveIapToInternetSnap(toBeTestedIapId_); + + } + // This IAP is now tested + toBeTestedIapId_ = WlanQtUtilsInvalidIapId; + + OstTraceFunctionExit1( WLANQTUTILSPRIVATE_UPDATECONNECTIVITYTESTRESULT_EXIT, this ); +} + +void WlanQtUtilsPrivate::addActiveConnection(uint connectionId) +{ + OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_ADDACTIVECONNECTION_ENTRY, this ); + OstTrace1( + TRACE_API, + WLANQTUTILSPRIVATE_ADDACTIVECONNECTION, + "WlanQtUtilsPrivate::addActiveConnection;connectionId=%u", connectionId ); + + Q_ASSERT(activeConnection_ == NULL); + activeConnection_ = conMonWrapper_->connectionInfo(connectionId); + Q_ASSERT(wlanIapList_.contains(activeConnection_->iapId())); + updateIapConnectionStatuses(activeConnection_->iapId(), activeConnection_->connectionStatus()); + + OstTraceFunctionExit1( WLANQTUTILSPRIVATE_ADDACTIVECONNECTION_EXIT, this ); +} + +void WlanQtUtilsPrivate::removeActiveConnection(uint connectionId) +{ + OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_REMOVEACTIVECONNECTION_ENTRY, this ); + OstTrace1( + TRACE_API, + WLANQTUTILSPRIVATE_REMOVEACTIVECONNECTION, + "WlanQtUtilsPrivate::removeActiveConnection;connectionId=%u", connectionId ); + + Q_ASSERT(activeConnection_ != NULL); + if (activeConnection_->connectionId() == connectionId) { + // Connection is closed, update connection statuses and inform UI. + // wlanNetworkClosed is sent from here (and only from here), because, in some cases, + // connection may be removed without any connection status updates. + int closedIapId = activeConnection_->iapId(); + updateIapConnectionStatuses(activeConnection_->iapId(), WlanQtUtilsConnectionStatusDisconnected); + delete activeConnection_; + activeConnection_ = NULL; + emit q_ptr->wlanNetworkClosed(closedIapId); + } + + OstTraceFunctionExit1( WLANQTUTILSPRIVATE_REMOVEACTIVECONNECTION_EXIT, this ); +} + +void WlanQtUtilsPrivate::updateActiveConnection(uint connectionId, WlanQtUtilsConnectionStatus connectionStatus) +{ + OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_UPDATEACTIVECONNECTION_ENTRY, this ); + OstTraceExt2( + TRACE_API, + WLANQTUTILSPRIVATE_UPDATEACTIVECONNECTION, + "WlanQtUtilsPrivate::updateActiveConnection;connectionId=%u;connectionStatus=%u", connectionId, connectionStatus ); + + Q_ASSERT(activeConnection_ != NULL); + if (activeConnection_->connectionId() == connectionId + && activeConnection_->connectionStatus() != connectionStatus) { + // Update connection statuses and inform UI, if necessary + activeConnection_->setConnectionStatus(connectionStatus); + updateIapConnectionStatuses(activeConnection_->iapId(), connectionStatus); + if (connectionStatus == WlanQtUtilsConnectionStatusConnected) { + emit q_ptr->wlanNetworkOpened(activeConnection_->iapId()); + } + // Do not inform UI about connection closing here. It is done always in + // removeActiveConnection(), because that may occur without any connection status updates. + } // else: connection status did not change + + OstTraceFunctionExit1( WLANQTUTILSPRIVATE_UPDATEACTIVECONNECTION_EXIT, this ); +} + +int WlanQtUtilsPrivate::fetchIaps() +{ + OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_FETCHIAPS_ENTRY, this ); + + QList list; + int error = 0; + // Read the IAP list and store WLAN IAPs in our internal map data structure + error = cmmWrapper_->fetchIaps(list); + foreach (WlanQtUtilsIap *iap, list) { + if (iap->bearerType() == WlanQtUtilsBearerTypeWlan) { + // Notice that insertMulti not used, because IAP IDs should be unique + wlanIapList_.insert(iap->id(), qobject_cast(iap)); + } + } + + OstTraceFunctionExit1( WLANQTUTILSPRIVATE_FETCHIAPS_EXIT, this ); + return error; +} + +bool WlanQtUtilsPrivate::wlanIapExists(QString ssid, WlanQtUtilsWlanSecMode secMode) +{ + foreach (WlanQtUtilsWlanIap *iap, wlanIapList_) { + // todo: secmode + (void)secMode; + if (iap->ssid() == ssid) { + return true; + } + } + + return false; +} + +void WlanQtUtilsPrivate::updateIapConnectionStatuses(int iapId, WlanQtUtilsConnectionStatus status) +{ + OstTraceFunctionEntry1( WLANQTUTILSPRIVATE_UPDATEIAPCONNECTIONSTATUSES_ENTRY, this ); + + const WlanQtUtilsWlanIap *referenceIap = qobject_cast(iap(iapId)); + foreach (WlanQtUtilsWlanIap *iap, wlanIapList_) { + // todo: security mode checking + if (iap->id() == referenceIap->id() || iap->ssid() == referenceIap->ssid()) { + iap->setConnectionStatus(status); + } + } + + OstTraceFunctionExit1( WLANQTUTILSPRIVATE_UPDATEIAPCONNECTIONSTATUSES_EXIT, this ); +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/base/src/wlanqtutilsactiveconn.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/base/src/wlanqtutilsactiveconn.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is a source file for WlanQtUtilsActiveConn class. +*/ + +#include "wlanqtutilsactiveconn.h" + +WlanQtUtilsActiveConn::WlanQtUtilsActiveConn() : + connectionId_(0), + iapId_(0), + connectionStatus_(WlanQtUtilsConnectionStatusNone), + bearerType_(WlanQtUtilsBearerTypeNone) +{ +} + +WlanQtUtilsActiveConn::~WlanQtUtilsActiveConn() +{ +} + +uint WlanQtUtilsActiveConn::connectionId() const +{ + return connectionId_; +} + +void WlanQtUtilsActiveConn::setConnectionId(uint connectionId) +{ + connectionId_ = connectionId; +} + +uint WlanQtUtilsActiveConn::iapId() const +{ + return iapId_; +} + +void WlanQtUtilsActiveConn::setIapId(uint iapId) +{ + iapId_ = iapId; +} + +WlanQtUtilsConnectionStatus WlanQtUtilsActiveConn::connectionStatus() const +{ + return connectionStatus_; +} + +void WlanQtUtilsActiveConn::setConnectionStatus(WlanQtUtilsConnectionStatus connectionStatus) +{ + connectionStatus_ = connectionStatus; +} + +WlanQtUtilsBearerType WlanQtUtilsActiveConn::bearerType() const +{ + return bearerType_; +} + +void WlanQtUtilsActiveConn::setBearerType(WlanQtUtilsBearerType bearerType) +{ + bearerType_ = bearerType; +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/base/src/wlanqtutilsiap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/base/src/wlanqtutilsiap.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include "wlanqtutilsiap.h" + +WlanQtUtilsIap::WlanQtUtilsIap() : + id_(0), + netId_(0), + name_(""), + bearerType_(WlanQtUtilsBearerTypeNone), + connectionStatus_(WlanQtUtilsConnectionStatusNone) +{ + +} + +WlanQtUtilsIap::WlanQtUtilsIap( + int id, + int netId, + QString name, + WlanQtUtilsBearerType bearerType) : + id_(id), netId_(netId), name_(name), bearerType_(bearerType), connectionStatus_(WlanQtUtilsConnectionStatusNone) +{ +} + +WlanQtUtilsIap::~WlanQtUtilsIap() +{ +} + +int WlanQtUtilsIap::id() const +{ + return id_; +} + +int WlanQtUtilsIap::networkId() const +{ + return netId_; +} + +QString WlanQtUtilsIap::name() const +{ + return name_; +} + +WlanQtUtilsBearerType WlanQtUtilsIap::bearerType() const +{ + return bearerType_; +} + +WlanQtUtilsConnectionStatus WlanQtUtilsIap::connectionStatus() const +{ + return connectionStatus_; +} + +void WlanQtUtilsIap::setId(int id) +{ + id_ = id; +} + +void WlanQtUtilsIap::setNetworkId(int netId) +{ + netId_ = netId; +} + +void WlanQtUtilsIap::setName(QString name) +{ + name_ = name; +} + +void WlanQtUtilsIap::setBearerType(WlanQtUtilsBearerType bearerType) +{ + bearerType_ = bearerType; +} + +void WlanQtUtilsIap::setConnectionStatus(WlanQtUtilsConnectionStatus connectionStatus) +{ + connectionStatus_ = connectionStatus; +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/base/src/wlanqtutilswlanap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/base/src/wlanqtutilswlanap.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is the source file for WlanQtUtilsWlanAp class. +*/ + +#include +#include "wlanqtutilscommon.h" +#include "wlanqtutilswlanap.h" + +WlanQtUtilsWlanAp::WlanQtUtilsWlanAp() : ssid_(""), bssid_(""), signalStrength_(0), connectionMode_(0), + securityMode_(WlanQtUtilsWlanSecModeOpen), securityKey_("") +{ +} + +WlanQtUtilsWlanAp::WlanQtUtilsWlanAp(const WlanQtUtilsWlanAp &ref) : + ssid_(ref.ssid()), + bssid_(ref.bssid()), + signalStrength_(ref.signalStrength()), + connectionMode_(ref.connectionMode()), + securityMode_(ref.securityMode()), + securityKey_(ref.securityKey()) +{ +} + +WlanQtUtilsWlanAp::WlanQtUtilsWlanAp( + QString ssid, + QString bssid, + int signalStrength, + int connectionMode, + WlanQtUtilsWlanSecMode securityMode) : ssid_(ssid), bssid_(bssid), signalStrength_(signalStrength), + connectionMode_(connectionMode), securityMode_(securityMode), securityKey_("") +{ +} + +WlanQtUtilsWlanAp::~WlanQtUtilsWlanAp() +{ +} + +QString WlanQtUtilsWlanAp::ssid() const +{ + return ssid_; +} + +QString WlanQtUtilsWlanAp::bssid() const +{ + return bssid_; +} + +int WlanQtUtilsWlanAp::signalStrength() const +{ + return signalStrength_; +} + +int WlanQtUtilsWlanAp::connectionMode() const +{ + return connectionMode_; +} + +WlanQtUtilsWlanSecMode WlanQtUtilsWlanAp::securityMode() const +{ + return securityMode_; +} + +QString WlanQtUtilsWlanAp::securityKey() const +{ + return securityKey_; +} + +void WlanQtUtilsWlanAp::setSsid(QString ssid) +{ + ssid_ = ssid; +} + +void WlanQtUtilsWlanAp::setBssid(QString bssid) +{ + bssid_ = bssid; +} + +void WlanQtUtilsWlanAp::setSignalStrength(int signalStrength) +{ + signalStrength_ = signalStrength; +} + +void WlanQtUtilsWlanAp::setConnectionMode(int connectionMode) +{ + connectionMode_ = connectionMode; +} + +void WlanQtUtilsWlanAp::setSecurityMode(WlanQtUtilsWlanSecMode securityMode) +{ + securityMode_ = securityMode; +} + +void WlanQtUtilsWlanAp::setSecurityKey(QString securityKey) +{ + securityKey_ = securityKey; +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/base/src/wlanqtutilswlaniap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/base/src/wlanqtutilswlaniap.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is a source file for WlanQtUtilsWlanIap class. +*/ + +#include +#include "wlanqtutilscommon.h" +#include "wlanqtutilsiap.h" +#include "wlanqtutilswlaniap.h" + +WlanQtUtilsWlanIap::WlanQtUtilsWlanIap() : WlanQtUtilsIap(), ssid_(""), signalStrength_(WlanQtUtilsWlanSignalUnavailable), securityMode_(WlanQtUtilsWlanSecModeOpen) +{ +} + +WlanQtUtilsWlanIap::WlanQtUtilsWlanIap(int id, int netId, QString name, WlanQtUtilsBearerType bearerType, QString ssid, WlanQtUtilsWlanSecMode secMode) : + WlanQtUtilsIap(id, netId, name, bearerType), ssid_(ssid), signalStrength_(WlanQtUtilsWlanSignalUnavailable), securityMode_(secMode) +{ +} + +WlanQtUtilsWlanIap::~WlanQtUtilsWlanIap() +{ +} + +/** Returns IAP's SSID */ +QString WlanQtUtilsWlanIap::ssid() const +{ + return ssid_; +} + +/** Returns IAP's signal strength */ +int WlanQtUtilsWlanIap::signalStrength() const +{ + return signalStrength_; +} + +/** Returns IAP's security mode */ +WlanQtUtilsWlanSecMode WlanQtUtilsWlanIap::securityMode() const +{ + return securityMode_; +} + +/** Sets IAP's SSID */ +void WlanQtUtilsWlanIap::setSsid(QString ssid) +{ + ssid_ = ssid; +} + +/** Sets IAP's signal strength */ +void WlanQtUtilsWlanIap::setSignalStrength(int signalStrength) +{ + signalStrength_ = signalStrength; +} + +/** Sets IAP's security mode */ +void WlanQtUtilsWlanIap::setSecurityMode(WlanQtUtilsWlanSecMode securityMode) +{ + securityMode_ = securityMode; +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/bwins/wlanqtutilitiesu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/bwins/wlanqtutilitiesu.def Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,80 @@ +EXPORTS + ?getStaticMetaObject@WlanQtUtilsWlanIap@@SAABUQMetaObject@@XZ @ 1 NONAME ; struct QMetaObject const & WlanQtUtilsWlanIap::getStaticMetaObject(void) + ?connectedWlanId@WlanQtUtils@@QBEHXZ @ 2 NONAME ; int WlanQtUtils::connectedWlanId(void) const + ?masterWlanStatus@WlanQtUtils@@IAEX_N@Z @ 3 NONAME ; void WlanQtUtils::masterWlanStatus(bool) + ?Start@RConnection@@QAEXAAVTConnPref@@AAVTRequestStatus@@@Z @ 4 NONAME ; void RConnection::Start(class TConnPref &, class TRequestStatus &) + ?connectionMode@WlanQtUtilsWlanAp@@QBEHXZ @ 5 NONAME ; int WlanQtUtilsWlanAp::connectionMode(void) const + ??1WlanQtUtilsIap@@UAE@XZ @ 6 NONAME ; WlanQtUtilsIap::~WlanQtUtilsIap(void) + ??0WlanQtUtilsWlanAp@@QAE@VQString@@0HHW4WlanQtUtilsWlanSecMode@@@Z @ 7 NONAME ; WlanQtUtilsWlanAp::WlanQtUtilsWlanAp(class QString, class QString, int, int, enum WlanQtUtilsWlanSecMode) + ?staticMetaObject@WlanQtUtilsWlanIap@@2UQMetaObject@@B @ 8 NONAME ; struct QMetaObject const WlanQtUtilsWlanIap::staticMetaObject + ?qt_metacall@WlanQtUtils@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 9 NONAME ; int WlanQtUtils::qt_metacall(enum QMetaObject::Call, int, void * *) + ?metaObject@WlanQtUtilsWlanIap@@UBEPBUQMetaObject@@XZ @ 10 NONAME ; struct QMetaObject const * WlanQtUtilsWlanIap::metaObject(void) const + ?tr@WlanQtUtilsWlanIap@@SA?AVQString@@PBD0H@Z @ 11 NONAME ; class QString WlanQtUtilsWlanIap::tr(char const *, char const *, int) + ?networkId@WlanQtUtilsIap@@QBEHXZ @ 12 NONAME ; int WlanQtUtilsIap::networkId(void) const + ?qt_metacall@WlanQtUtilsWlanIap@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 13 NONAME ; int WlanQtUtilsWlanIap::qt_metacall(enum QMetaObject::Call, int, void * *) + ?staticMetaObject@WlanQtUtils@@2UQMetaObject@@B @ 14 NONAME ; struct QMetaObject const WlanQtUtils::staticMetaObject + ?disconnectIap@WlanQtUtils@@QAEXH@Z @ 15 NONAME ; void WlanQtUtils::disconnectIap(int) + ??0WlanQtUtilsIap@@QAE@HHVQString@@W4WlanQtUtilsBearerType@@@Z @ 16 NONAME ; WlanQtUtilsIap::WlanQtUtilsIap(int, int, class QString, enum WlanQtUtilsBearerType) + ?ssid@WlanQtUtilsWlanAp@@QBE?AVQString@@XZ @ 17 NONAME ; class QString WlanQtUtilsWlanAp::ssid(void) const + ??1WlanQtUtilsWlanAp@@UAE@XZ @ 18 NONAME ; WlanQtUtilsWlanAp::~WlanQtUtilsWlanAp(void) + ?bearerType@WlanQtUtilsIap@@QBE?AW4WlanQtUtilsBearerType@@XZ @ 19 NONAME ; enum WlanQtUtilsBearerType WlanQtUtilsIap::bearerType(void) const + ?GetPckgAttribute@RConnectionMonitor@@QBEXIIIAAVTDes16@@AAVTRequestStatus@@@Z @ 20 NONAME ; void RConnectionMonitor::GetPckgAttribute(unsigned int, unsigned int, unsigned int, class TDes16 &, class TRequestStatus &) const + ?signalStrength@WlanQtUtilsWlanIap@@QBEHXZ @ 21 NONAME ; int WlanQtUtilsWlanIap::signalStrength(void) const + ??_EWlanQtUtilsWlanIap@@UAE@I@Z @ 22 NONAME ; WlanQtUtilsWlanIap::~WlanQtUtilsWlanIap(unsigned int) + ?wlanNetworkOpened@WlanQtUtils@@IAEXH@Z @ 23 NONAME ; void WlanQtUtils::wlanNetworkOpened(int) + ?metaObject@WlanQtUtils@@UBEPBUQMetaObject@@XZ @ 24 NONAME ; struct QMetaObject const * WlanQtUtils::metaObject(void) const + ?setId@WlanQtUtilsIap@@QAEXH@Z @ 25 NONAME ; void WlanQtUtilsIap::setId(int) + ?setConnectionStatus@WlanQtUtilsIap@@QAEXW4WlanQtUtilsConnectionStatus@@@Z @ 26 NONAME ; void WlanQtUtilsIap::setConnectionStatus(enum WlanQtUtilsConnectionStatus) + ?createWlanIap@WlanQtUtils@@QAEHPBVWlanQtUtilsWlanAp@@@Z @ 27 NONAME ; int WlanQtUtils::createWlanIap(class WlanQtUtilsWlanAp const *) + ?setName@WlanQtUtilsIap@@QAEXVQString@@@Z @ 28 NONAME ; void WlanQtUtilsIap::setName(class QString) + ?setSsid@WlanQtUtilsWlanIap@@QAEXVQString@@@Z @ 29 NONAME ; void WlanQtUtilsWlanIap::setSsid(class QString) + ?setSecurityMode@WlanQtUtilsWlanIap@@QAEXW4WlanQtUtilsWlanSecMode@@@Z @ 30 NONAME ; void WlanQtUtilsWlanIap::setSecurityMode(enum WlanQtUtilsWlanSecMode) + ?tr@WlanQtUtils@@SA?AVQString@@PBD0H@Z @ 31 NONAME ; class QString WlanQtUtils::tr(char const *, char const *, int) + ?name@WlanQtUtilsIap@@QBE?AVQString@@XZ @ 32 NONAME ; class QString WlanQtUtilsIap::name(void) const + ?masterWlan@WlanQtUtils@@QBE_NXZ @ 33 NONAME ; bool WlanQtUtils::masterWlan(void) const + ?qt_metacast@WlanQtUtilsWlanIap@@UAEPAXPBD@Z @ 34 NONAME ; void * WlanQtUtilsWlanIap::qt_metacast(char const *) + ?securityKey@WlanQtUtilsWlanAp@@QBE?AVQString@@XZ @ 35 NONAME ; class QString WlanQtUtilsWlanAp::securityKey(void) const + ??0WlanQtUtilsIap@@QAE@XZ @ 36 NONAME ; WlanQtUtilsIap::WlanQtUtilsIap(void) + ?iap@WlanQtUtils@@QBEPAVWlanQtUtilsIap@@H@Z @ 37 NONAME ; class WlanQtUtilsIap * WlanQtUtils::iap(int) const + ??_EWlanQtUtilsWlanAp@@UAE@I@Z @ 38 NONAME ; WlanQtUtilsWlanAp::~WlanQtUtilsWlanAp(unsigned int) + ?tr@WlanQtUtilsWlanIap@@SA?AVQString@@PBD0@Z @ 39 NONAME ; class QString WlanQtUtilsWlanIap::tr(char const *, char const *) + ?setSecurityKey@WlanQtUtilsWlanAp@@QAEXVQString@@@Z @ 40 NONAME ; void WlanQtUtilsWlanAp::setSecurityKey(class QString) + ??0WlanQtUtilsWlanAp@@QAE@XZ @ 41 NONAME ; WlanQtUtilsWlanAp::WlanQtUtilsWlanAp(void) + ?qt_metacast@WlanQtUtils@@UAEPAXPBD@Z @ 42 NONAME ; void * WlanQtUtils::qt_metacast(char const *) + ?ssid@WlanQtUtilsWlanIap@@QBE?AVQString@@XZ @ 43 NONAME ; class QString WlanQtUtilsWlanIap::ssid(void) const + ?setNetworkId@WlanQtUtilsIap@@QAEXH@Z @ 44 NONAME ; void WlanQtUtilsIap::setNetworkId(int) + ?availableWlanAps@WlanQtUtils@@QAEXAAV?$QList@PAVWlanQtUtilsWlanIap@@@@AAV?$QList@PAVWlanQtUtilsWlanAp@@@@@Z @ 45 NONAME ; void WlanQtUtils::availableWlanAps(class QList &, class QList &) + ?trUtf8@WlanQtUtilsWlanIap@@SA?AVQString@@PBD0@Z @ 46 NONAME ; class QString WlanQtUtilsWlanIap::trUtf8(char const *, char const *) + ??0WlanQtUtilsWlanIap@@QAE@HHVQString@@W4WlanQtUtilsBearerType@@0W4WlanQtUtilsWlanSecMode@@@Z @ 47 NONAME ; WlanQtUtilsWlanIap::WlanQtUtilsWlanIap(int, int, class QString, enum WlanQtUtilsBearerType, class QString, enum WlanQtUtilsWlanSecMode) + ?tr@WlanQtUtils@@SA?AVQString@@PBD0@Z @ 48 NONAME ; class QString WlanQtUtils::tr(char const *, char const *) + ??0WlanQtUtilsWlanIap@@QAE@XZ @ 49 NONAME ; WlanQtUtilsWlanIap::WlanQtUtilsWlanIap(void) + ?setBssid@WlanQtUtilsWlanAp@@QAEXVQString@@@Z @ 50 NONAME ; void WlanQtUtilsWlanAp::setBssid(class QString) + ?setSsid@WlanQtUtilsWlanAp@@QAEXVQString@@@Z @ 51 NONAME ; void WlanQtUtilsWlanAp::setSsid(class QString) + ?signalStrength@WlanQtUtilsWlanAp@@QBEHXZ @ 52 NONAME ; int WlanQtUtilsWlanAp::signalStrength(void) const + ?setBearerType@WlanQtUtilsIap@@QAEXW4WlanQtUtilsBearerType@@@Z @ 53 NONAME ; void WlanQtUtilsIap::setBearerType(enum WlanQtUtilsBearerType) + ?setSignalStrength@WlanQtUtilsWlanAp@@QAEXH@Z @ 54 NONAME ; void WlanQtUtilsWlanAp::setSignalStrength(int) + ??1WlanQtUtils@@UAE@XZ @ 55 NONAME ; WlanQtUtils::~WlanQtUtils(void) + ?scanWlans@WlanQtUtils@@QAEXXZ @ 56 NONAME ; void WlanQtUtils::scanWlans(void) + ?setSignalStrength@WlanQtUtilsWlanIap@@QAEXH@Z @ 57 NONAME ; void WlanQtUtilsWlanIap::setSignalStrength(int) + ?EventType@CConnMonEventBase@@QBEHXZ @ 58 NONAME ; int CConnMonEventBase::EventType(void) const + ?setSecurityMode@WlanQtUtilsWlanAp@@QAEXW4WlanQtUtilsWlanSecMode@@@Z @ 59 NONAME ; void WlanQtUtilsWlanAp::setSecurityMode(enum WlanQtUtilsWlanSecMode) + ?trUtf8@WlanQtUtilsWlanIap@@SA?AVQString@@PBD0H@Z @ 60 NONAME ; class QString WlanQtUtilsWlanIap::trUtf8(char const *, char const *, int) + ?id@WlanQtUtilsIap@@QBEHXZ @ 61 NONAME ; int WlanQtUtilsIap::id(void) const + ??1WlanQtUtilsWlanIap@@UAE@XZ @ 62 NONAME ; WlanQtUtilsWlanIap::~WlanQtUtilsWlanIap(void) + ?securityMode@WlanQtUtilsWlanIap@@QBE?AW4WlanQtUtilsWlanSecMode@@XZ @ 63 NONAME ; enum WlanQtUtilsWlanSecMode WlanQtUtilsWlanIap::securityMode(void) const + ??_EWlanQtUtilsIap@@UAE@I@Z @ 64 NONAME ; WlanQtUtilsIap::~WlanQtUtilsIap(unsigned int) + ??_EWlanQtUtils@@UAE@I@Z @ 65 NONAME ; WlanQtUtils::~WlanQtUtils(unsigned int) + ?wlanScanReady@WlanQtUtils@@IAEXXZ @ 66 NONAME ; void WlanQtUtils::wlanScanReady(void) + ?wlanNetworkClosed@WlanQtUtils@@IAEXH@Z @ 67 NONAME ; void WlanQtUtils::wlanNetworkClosed(int) + ?bssid@WlanQtUtilsWlanAp@@QBE?AVQString@@XZ @ 68 NONAME ; class QString WlanQtUtilsWlanAp::bssid(void) const + ??0WlanQtUtilsWlanAp@@QAE@ABV0@@Z @ 69 NONAME ; WlanQtUtilsWlanAp::WlanQtUtilsWlanAp(class WlanQtUtilsWlanAp const &) + ??0WlanQtUtils@@QAE@XZ @ 70 NONAME ; WlanQtUtils::WlanQtUtils(void) + ?getStaticMetaObject@WlanQtUtils@@SAABUQMetaObject@@XZ @ 71 NONAME ; struct QMetaObject const & WlanQtUtils::getStaticMetaObject(void) + ?setConnectionMode@WlanQtUtilsWlanAp@@QAEXH@Z @ 72 NONAME ; void WlanQtUtilsWlanAp::setConnectionMode(int) + ?trUtf8@WlanQtUtils@@SA?AVQString@@PBD0@Z @ 73 NONAME ; class QString WlanQtUtils::trUtf8(char const *, char const *) + ?setMasterWlan@WlanQtUtils@@QAEX_N@Z @ 74 NONAME ; void WlanQtUtils::setMasterWlan(bool) + ?connectionStatus@WlanQtUtilsIap@@QBE?AW4WlanQtUtilsConnectionStatus@@XZ @ 75 NONAME ; enum WlanQtUtilsConnectionStatus WlanQtUtilsIap::connectionStatus(void) const + ?securityMode@WlanQtUtilsWlanAp@@QBE?AW4WlanQtUtilsWlanSecMode@@XZ @ 76 NONAME ; enum WlanQtUtilsWlanSecMode WlanQtUtilsWlanAp::securityMode(void) const + ?connectIap@WlanQtUtils@@QAEXH@Z @ 77 NONAME ; void WlanQtUtils::connectIap(int) + ?trUtf8@WlanQtUtils@@SA?AVQString@@PBD0H@Z @ 78 NONAME ; class QString WlanQtUtils::trUtf8(char const *, char const *, int) + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/eabi/wlanqtutilitiesu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/eabi/wlanqtutilitiesu.def Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,89 @@ +EXPORTS + _ZN11WlanQtUtils10connectIapEi @ 1 NONAME + _ZN11WlanQtUtils11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME + _ZN11WlanQtUtils11qt_metacastEPKc @ 3 NONAME + _ZN11WlanQtUtils13createWlanIapEPK17WlanQtUtilsWlanAp @ 4 NONAME + _ZN11WlanQtUtils13disconnectIapEi @ 5 NONAME + _ZN11WlanQtUtils13setMasterWlanEb @ 6 NONAME + _ZN11WlanQtUtils13wlanScanReadyEv @ 7 NONAME + _ZN11WlanQtUtils16availableWlanApsER5QListIP18WlanQtUtilsWlanIapERS0_IP17WlanQtUtilsWlanApE @ 8 NONAME + _ZN11WlanQtUtils16masterWlanStatusEb @ 9 NONAME + _ZN11WlanQtUtils16staticMetaObjectE @ 10 NONAME DATA 16 + _ZN11WlanQtUtils17wlanNetworkClosedEi @ 11 NONAME + _ZN11WlanQtUtils17wlanNetworkOpenedEi @ 12 NONAME + _ZN11WlanQtUtils19getStaticMetaObjectEv @ 13 NONAME + _ZN11WlanQtUtils9scanWlansEv @ 14 NONAME + _ZN11WlanQtUtilsC1Ev @ 15 NONAME + _ZN11WlanQtUtilsC2Ev @ 16 NONAME + _ZN11WlanQtUtilsD0Ev @ 17 NONAME + _ZN11WlanQtUtilsD1Ev @ 18 NONAME + _ZN11WlanQtUtilsD2Ev @ 19 NONAME + _ZN14WlanQtUtilsIap12setNetworkIdEi @ 20 NONAME + _ZN14WlanQtUtilsIap13setBearerTypeE21WlanQtUtilsBearerType @ 21 NONAME + _ZN14WlanQtUtilsIap19setConnectionStatusE27WlanQtUtilsConnectionStatus @ 22 NONAME + _ZN14WlanQtUtilsIap5setIdEi @ 23 NONAME + _ZN14WlanQtUtilsIap7setNameE7QString @ 24 NONAME + _ZN14WlanQtUtilsIapC1Eii7QString21WlanQtUtilsBearerType @ 25 NONAME + _ZN14WlanQtUtilsIapC1Ev @ 26 NONAME + _ZN14WlanQtUtilsIapC2Eii7QString21WlanQtUtilsBearerType @ 27 NONAME + _ZN14WlanQtUtilsIapC2Ev @ 28 NONAME + _ZN14WlanQtUtilsIapD0Ev @ 29 NONAME + _ZN14WlanQtUtilsIapD1Ev @ 30 NONAME + _ZN14WlanQtUtilsIapD2Ev @ 31 NONAME + _ZN17WlanQtUtilsWlanAp14setSecurityKeyE7QString @ 32 NONAME + _ZN17WlanQtUtilsWlanAp15setSecurityModeE22WlanQtUtilsWlanSecMode @ 33 NONAME + _ZN17WlanQtUtilsWlanAp17setConnectionModeEi @ 34 NONAME + _ZN17WlanQtUtilsWlanAp17setSignalStrengthEi @ 35 NONAME + _ZN17WlanQtUtilsWlanAp7setSsidE7QString @ 36 NONAME + _ZN17WlanQtUtilsWlanAp8setBssidE7QString @ 37 NONAME + _ZN17WlanQtUtilsWlanApC1E7QStringS0_ii22WlanQtUtilsWlanSecMode @ 38 NONAME + _ZN17WlanQtUtilsWlanApC1ERKS_ @ 39 NONAME + _ZN17WlanQtUtilsWlanApC1Ev @ 40 NONAME + _ZN17WlanQtUtilsWlanApC2E7QStringS0_ii22WlanQtUtilsWlanSecMode @ 41 NONAME + _ZN17WlanQtUtilsWlanApC2ERKS_ @ 42 NONAME + _ZN17WlanQtUtilsWlanApC2Ev @ 43 NONAME + _ZN17WlanQtUtilsWlanApD0Ev @ 44 NONAME + _ZN17WlanQtUtilsWlanApD1Ev @ 45 NONAME + _ZN17WlanQtUtilsWlanApD2Ev @ 46 NONAME + _ZN18WlanQtUtilsWlanIap11qt_metacallEN11QMetaObject4CallEiPPv @ 47 NONAME + _ZN18WlanQtUtilsWlanIap11qt_metacastEPKc @ 48 NONAME + _ZN18WlanQtUtilsWlanIap15setSecurityModeE22WlanQtUtilsWlanSecMode @ 49 NONAME + _ZN18WlanQtUtilsWlanIap16staticMetaObjectE @ 50 NONAME DATA 16 + _ZN18WlanQtUtilsWlanIap17setSignalStrengthEi @ 51 NONAME + _ZN18WlanQtUtilsWlanIap19getStaticMetaObjectEv @ 52 NONAME + _ZN18WlanQtUtilsWlanIap7setSsidE7QString @ 53 NONAME + _ZN18WlanQtUtilsWlanIapC1Eii7QString21WlanQtUtilsBearerTypeS0_22WlanQtUtilsWlanSecMode @ 54 NONAME + _ZN18WlanQtUtilsWlanIapC1Ev @ 55 NONAME + _ZN18WlanQtUtilsWlanIapC2Eii7QString21WlanQtUtilsBearerTypeS0_22WlanQtUtilsWlanSecMode @ 56 NONAME + _ZN18WlanQtUtilsWlanIapC2Ev @ 57 NONAME + _ZN18WlanQtUtilsWlanIapD0Ev @ 58 NONAME + _ZN18WlanQtUtilsWlanIapD1Ev @ 59 NONAME + _ZN18WlanQtUtilsWlanIapD2Ev @ 60 NONAME + _ZNK11WlanQtUtils10masterWlanEv @ 61 NONAME + _ZNK11WlanQtUtils10metaObjectEv @ 62 NONAME + _ZNK11WlanQtUtils15connectedWlanIdEv @ 63 NONAME + _ZNK11WlanQtUtils3iapEi @ 64 NONAME + _ZNK14WlanQtUtilsIap10bearerTypeEv @ 65 NONAME + _ZNK14WlanQtUtilsIap16connectionStatusEv @ 66 NONAME + _ZNK14WlanQtUtilsIap2idEv @ 67 NONAME + _ZNK14WlanQtUtilsIap4nameEv @ 68 NONAME + _ZNK14WlanQtUtilsIap9networkIdEv @ 69 NONAME + _ZNK17WlanQtUtilsWlanAp11securityKeyEv @ 70 NONAME + _ZNK17WlanQtUtilsWlanAp12securityModeEv @ 71 NONAME + _ZNK17WlanQtUtilsWlanAp14connectionModeEv @ 72 NONAME + _ZNK17WlanQtUtilsWlanAp14signalStrengthEv @ 73 NONAME + _ZNK17WlanQtUtilsWlanAp4ssidEv @ 74 NONAME + _ZNK17WlanQtUtilsWlanAp5bssidEv @ 75 NONAME + _ZNK18WlanQtUtilsWlanIap10metaObjectEv @ 76 NONAME + _ZNK18WlanQtUtilsWlanIap12securityModeEv @ 77 NONAME + _ZNK18WlanQtUtilsWlanIap14signalStrengthEv @ 78 NONAME + _ZNK18WlanQtUtilsWlanIap4ssidEv @ 79 NONAME + _ZTI11WlanQtUtils @ 80 NONAME + _ZTI14WlanQtUtilsIap @ 81 NONAME + _ZTI17WlanQtUtilsWlanAp @ 82 NONAME + _ZTI18WlanQtUtilsWlanIap @ 83 NONAME + _ZTV11WlanQtUtils @ 84 NONAME + _ZTV14WlanQtUtilsIap @ 85 NONAME + _ZTV17WlanQtUtilsWlanAp @ 86 NONAME + _ZTV18WlanQtUtilsWlanIap @ 87 NONAME + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/rom/wlanqtutilities.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/rom/wlanqtutilities.iby Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef WLANQTUTILITIES_IBY +#define WLANQTUTILITIES_IBY + +#include + +#ifdef __PROTOCOL_WLAN + +file=ABI_DIR\BUILD_DIR\wlanqtutilities.dll SHARED_LIB_DIR\wlanqtutilities.dll + +#endif // __PROTOCOL_WLAN + +#endif // WLANQTUTILITIES_IBY diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/traces/OstTraceDefinitions.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +#include +#endif diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/ut/context/commsdat_files/50_default.cre Binary file wlanutilities/wlanqtutilities/ut/context/commsdat_files/50_default.cre has changed diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/ut/context/commsdat_files/default.cre Binary file wlanutilities/wlanqtutilities/ut/context/commsdat_files/default.cre has changed diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/ut/context/wlanqtutilstestcontext.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/ut/context/wlanqtutilstestcontext.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,237 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is the source file for Connection Utilities test context. +*/ + +#include +#include +#include +#include +#include "wlanqtutilscommon.h" +#include "wlanqtutilstestcontext.h" +#include "wlanqtutilswlanap.h" +#include "wlanqtutilsactiveconn.h" + +// --------------------------------------------------------- +// class WlanQtUtilsCtxEsock +// --------------------------------------------------------- + +WlanQtUtilsCtxEsock::WlanQtUtilsCtxEsock() : startRetValue_(KErrNone) +{ +} + +WlanQtUtilsCtxEsock::~WlanQtUtilsCtxEsock() +{ +} + +void WlanQtUtilsCtxEsock::initialize() +{ + startRetValue_ = KErrNone; +} + +// --------------------------------------------------------- +// class WlanQtUtilsCtxActiveConn +// --------------------------------------------------------- + +WlanQtUtilsCtxActiveConn::WlanQtUtilsCtxActiveConn() : + WlanQtUtilsActiveConn(), + connMonBearerType_(EBearerUnknown), + connMonConnectionStatus_(KConnectionUninitialised), + connMonWlanConnectionMode_(-1), + connMonWlanSecurityMode_(-1), + applicationUids_() +{ +} + +WlanQtUtilsCtxActiveConn::~WlanQtUtilsCtxActiveConn() +{ +} + +// --------------------------------------------------------- +// class WlanQtUtilsCtxActiveConnections +// --------------------------------------------------------- + +WlanQtUtilsCtxActiveConnections::WlanQtUtilsCtxActiveConnections() : activeConnList_() +{ +} + +WlanQtUtilsCtxActiveConnections::~WlanQtUtilsCtxActiveConnections() +{ + clearActiveConnList(); +} + +void WlanQtUtilsCtxActiveConnections::initialize() +{ + clearActiveConnList(); +} + +void WlanQtUtilsCtxActiveConnections::createDefaultActiveConnList(int numberOfActiveConns, int firstIapId) +{ + clearActiveConnList(); + for (int i = 0; i < numberOfActiveConns; i++) { + WlanQtUtilsCtxActiveConn *activeConn = new WlanQtUtilsCtxActiveConn(); + + activeConn->setConnectionId((i + 1) * 100); + activeConn->setIapId(firstIapId + i); + activeConn->connMonConnectionStatus_ = KConnectionOpen; + activeConn->setConnectionStatus(WlanQtUtilsConnectionStatusConnected); + + // WLAN connection. + activeConn->connMonBearerType_ = EBearerWLAN; + activeConn->setBearerType(WlanQtUtilsBearerTypeWlan); + activeConn->connMonWlanSecurityMode_ = EConnMonSecurityOpen; + activeConn->connMonWlanConnectionMode_ = EConnMonInfraStructure; + activeConnList_.append(activeConn); + } +} + +void WlanQtUtilsCtxActiveConnections::clearActiveConnList() +{ + Q_FOREACH(WlanQtUtilsCtxActiveConn* activeConn, activeConnList_) { + delete activeConn; + } + activeConnList_.clear(); +} + +void WlanQtUtilsCtxActiveConnections::verifyActiveConnList(QList activeConnList) +{ + QCOMPARE(activeConnList.count(), activeConnList_.count()); + + for (int i = 0; i < activeConnList_.count(); i++) { + QCOMPARE(activeConnList[i]->connectionId(), activeConnList_[i]->connectionId()); + QCOMPARE(activeConnList[i]->iapId(), activeConnList_[i]->iapId()); + QCOMPARE(activeConnList[i]->connectionStatus(), activeConnList_[i]->connectionStatus()); + QCOMPARE(activeConnList[i]->bearerType(), activeConnList_[i]->bearerType()); + } +} + +WlanQtUtilsCtxActiveConn *WlanQtUtilsCtxActiveConnections::findActiveConn(uint connectionId) const +{ + WlanQtUtilsCtxActiveConn *activeConn = NULL; + for (int i = 0; i < activeConnList_.count(); i++) { + if (activeConnList_[i]->connectionId() == connectionId) { + activeConn = activeConnList_[i]; + } + } + Q_ASSERT(activeConn != NULL); + return activeConn; +} + +// --------------------------------------------------------- +// class WlanQtUtilsWlanScanResult +// --------------------------------------------------------- + +WlanQtUtilsWlanScanResult::WlanQtUtilsWlanScanResult() : wlanScanResultList_() +{ +} + +WlanQtUtilsWlanScanResult::~WlanQtUtilsWlanScanResult() +{ + clearWlanScanResultList(); +} + +void WlanQtUtilsWlanScanResult::initialize() +{ + clearWlanScanResultList(); +} + +void WlanQtUtilsWlanScanResult::createDefaultWlanScanResultList(int numberOfWlanAps) +{ + clearWlanScanResultList(); + for (int i = 0; i < numberOfWlanAps; i++) { + WlanQtUtilsWlanAp *ap = new WlanQtUtilsWlanAp(); + ap->setSsid("TestWlanAp" + QString::number(i+1)); + ap->setBssid("addMAC"); // TODO: Generate something when bssid retrieval works. + ap->setSignalStrength(20); + ap->setConnectionMode(EConnMonInfraStructure); + ap->setSecurityMode(WlanQtUtilsWlanSecModeOpen); + // TODO: Create constructor to WlanQtUtilsWlanAp which takes all member variables as parameter. + wlanScanResultList_.append(ap); + } +} + +void WlanQtUtilsWlanScanResult::clearWlanScanResultList() +{ + Q_FOREACH(WlanQtUtilsWlanAp* ap, wlanScanResultList_) { + delete ap; + } + wlanScanResultList_.clear(); +} + +void WlanQtUtilsWlanScanResult::verifyWlanScanResultList(QList wlanApList) +{ + QCOMPARE(wlanApList.count(), wlanScanResultList_.count()); + + for (int i = 0; i < wlanScanResultList_.count(); i++) { + QCOMPARE(wlanApList[i]->ssid(), wlanScanResultList_[i]->ssid()); + QCOMPARE(wlanApList[i]->bssid(), wlanScanResultList_[i]->bssid()); + QCOMPARE(wlanApList[i]->signalStrength(), wlanScanResultList_[i]->signalStrength()); + QCOMPARE(wlanApList[i]->connectionMode(), wlanScanResultList_[i]->connectionMode()); + QCOMPARE(wlanApList[i]->securityMode(), wlanScanResultList_[i]->securityMode()); + } +} + +// --------------------------------------------------------- +// class WlanQtUtilsCtxConnMon +// --------------------------------------------------------- + +WlanQtUtilsCtxConnMon::WlanQtUtilsCtxConnMon() : wlanScanResult_() +{ +} + +WlanQtUtilsCtxConnMon::~WlanQtUtilsCtxConnMon() +{ +} + +void WlanQtUtilsCtxConnMon::initialize() +{ + wlanScanResult_.initialize(); + activeConnections_.initialize(); +} + +// --------------------------------------------------------- +// class WlanQtUtilsCtxIct +// --------------------------------------------------------- + +WlanQtUtilsCtxIct::WlanQtUtilsCtxIct() +{ +} + +WlanQtUtilsCtxIct::~WlanQtUtilsCtxIct() +{ +} + +void WlanQtUtilsCtxIct::initialize() +{ +} + +// --------------------------------------------------------- +// class WlanQtUtilsTestContext +// --------------------------------------------------------- + +WlanQtUtilsTestContext::WlanQtUtilsTestContext() : esock_(), connMon_(), ict_() +{ +} + +WlanQtUtilsTestContext::~WlanQtUtilsTestContext() +{ +} + +void WlanQtUtilsTestContext::initialize() +{ + esock_.initialize(); + connMon_.initialize(); + ict_.initialize(); +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/ut/context/wlanqtutilstestcontext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/ut/context/wlanqtutilstestcontext.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,250 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is the header file for Wlan Qt Utilities test context. +*/ + +#ifndef WLANQTUTILSTESTCONTEXT_H +#define WLANQTUTILSTESTCONTEXT_H + +#include + +#include "wlanqtutilsactiveconn.h" + +class WlanQtUtilsWlanAp; + +/** + * This is context for esock library. + */ +class WlanQtUtilsCtxEsock : public QObject +{ + Q_OBJECT + +public: + WlanQtUtilsCtxEsock(); + ~WlanQtUtilsCtxEsock(); + + /** + * Initializes context. + */ + void initialize(); + + /** Return value of RConnection::Start(). */ + int startRetValue_; +}; + +/** + * This class is a helper class for testing purposes. It derives all properties of WlanQtUtilsActiveConn. + * In addition, this class contains member variables for setting some Connection Monitor specific + * values which cannot be easily generated from member variables of WlanQtUtilsActiveConn. + * E.g., connection status has different enum in Connection Monitor and Wlan Qt Utilities. This class + * enables setting both of those. Connmon version is set so that the stub can return it when + * requested, and Wlan Qt Utilities version is used for verifying that tested code returns right + * value. + */ +class WlanQtUtilsCtxActiveConn : public WlanQtUtilsActiveConn +{ +public: + WlanQtUtilsCtxActiveConn(); + ~WlanQtUtilsCtxActiveConn(); + + /** Bearer type in connmon format. */ + int connMonBearerType_; + /** Connection status in connmon format. */ + int connMonConnectionStatus_; + /** WLAN connection mode in connmon format. */ + int connMonWlanConnectionMode_; + /** WLAN security mode in connmon format. */ + int connMonWlanSecurityMode_; + /** Application UIDs that map to application strings. */ + QList applicationUids_; +}; + +/** + * This class represents active connections. + */ +class WlanQtUtilsCtxActiveConnections : public QObject +{ + Q_OBJECT + +public: + WlanQtUtilsCtxActiveConnections(); + ~WlanQtUtilsCtxActiveConnections(); + + /** + * Initializes context. + */ + void initialize(); + + /** + * Creates a list of active connections for scan results. + * + * @param[in] numberOfActiveConns Number of active connections that are created. + * @param[in] firstIapId IAP ID of the first connection to be created. + */ + void createDefaultActiveConnList(int numberOfActiveConns, int firstIapId); + + /** + * Verifies that the given active connection list returned by the real application matches + * with the one in the context. + * + * @param[in] activeConnList Active connections that are verified against the context. + */ + void verifyActiveConnList(QList activeConnList); + + /** + * Finds an active connection matching with the given connection ID from the context. + * Asserts if connection with given connection ID is not found. + * + * @param connectionId Connection ID. + * @return Active connection. + */ + WlanQtUtilsCtxActiveConn *findActiveConn(uint connectionId) const; + + /** + * List of active connections that RConnectionMonitor stub will return in response to + * RConnectionMonitor::Get*Attribute() functions. + */ + QList activeConnList_; + + // TODO: We need return values for all different RConnectionMonitor::Get*Attribute() functions + // to test error cases. + +private: + + /** + * Destroys and clears the list of WLAN APs. + */ + void clearActiveConnList(); +}; + +/** + * This class represents WLAN APs that represent the results of WLAN scanning triggered by + * RConnectionMonitor::GetPckgAttribute() + */ +class WlanQtUtilsWlanScanResult : public QObject +{ + Q_OBJECT + +public: + WlanQtUtilsWlanScanResult(); + ~WlanQtUtilsWlanScanResult(); + + /** + * Initializes context. + */ + void initialize(); + + /** + * Creates a list of WLAN APs for scan results. + * + * @param[in] numberOfWlanAps Number of WLAN APs that are created. + */ + void createDefaultWlanScanResultList(int numberOfWlanAps); + + /** + * Verifies that the given WLAN AP list returned by the real application matches + * with the one in the context. + * + * @param[in] wlanApList WLAN APs that are verified against the context. + */ + void verifyWlanScanResultList(QList wlanApList); // TODO: Maybe boolean return value + + /** + * List of WLAN access points that RConnectionMonitor stub will return in response to + * RConnectionMonitor::GetPckgAttribute(). + */ + QList wlanScanResultList_; + +private: + + /** + * Destroys and clears the list of WLAN APs. + */ + void clearWlanScanResultList(); +}; + +/** + * Test context for RConnectionMonitor. + */ +class WlanQtUtilsCtxConnMon : public QObject +{ + Q_OBJECT + +public: + WlanQtUtilsCtxConnMon(); + ~WlanQtUtilsCtxConnMon(); + + /** + * Initializes context. + */ + void initialize(); + + /** Results of WLAN scanning. */ + WlanQtUtilsWlanScanResult wlanScanResult_; + + /** List of active connections. */ + WlanQtUtilsCtxActiveConnections activeConnections_; +}; + +/** + * Test context for Internet connectivity test library. + */ +class WlanQtUtilsCtxIct : public QObject +{ + Q_OBJECT + +public: + WlanQtUtilsCtxIct(); + ~WlanQtUtilsCtxIct(); + + /** + * Initializes context. + */ + void initialize(); +}; + +/** + * Test context. The purpose of this context is to provide values that are used in stubs + * and in verification of outputs in test cases. + * + * In stubs, context is used to verify the inputs of parameters and to set output + * parameters into a specific value. + * + * In test cases, context is used to verify that the output parameters match with the once + * set in the stub. + */ +class WlanQtUtilsTestContext : public QObject +{ + Q_OBJECT + +public: + WlanQtUtilsTestContext(); + ~WlanQtUtilsTestContext(); + + /** + * Initializes context. + */ + void initialize(); + + /** Context for esock library. */ + WlanQtUtilsCtxEsock esock_; + /** Context for connmon library. */ + WlanQtUtilsCtxConnMon connMon_; + /** Context for ICTS library. */ + WlanQtUtilsCtxIct ict_; +}; + +#endif /* WLANQTUTILSTESTCONTEXT_H */ + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/ut/stubs/wlanqtutilsconnmonstub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/ut/stubs/wlanqtutilsconnmonstub.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,637 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is a source file for connmon library stub functions +*/ + +#include +#include +#include +#include +#include "wlanqtutilswlanap.h" + +#ifdef __WINS__ + +// TODO: This function is copied from ConnMonWLANNetworksArrayPckg_v2.cpp because this +// function, although being in rconnmon.h, is not in the interface because IMPORT_C/EXPORT_C +// declarations are not used for this particular constructor. The only change that was made to +// this version was to remove traces and some empty lines. This function is needed when +// creating output in RConnectionMonitor::GetPckgAttribute() for WLAN scan results. +// This is needed for both UT and emulator compilation. +CConnMonWlanNetworksPtrArrayPckg::CConnMonWlanNetworksPtrArrayPckg( + const RPointerArray& aRef, + TUint aBufLen ) + { + RPointerArray items; + TUint len( 0 ); + + for ( TUint i( 0 ); i < aRef.Count(); ++i ) + { + const HBufC* item( aRef[i]->ToBuf() ); + if ( item ) + { + // Is there room in buffer + TUint countFields( 3 ); // aRef.Count(); items->Count(); item->Length() + if ( (countFields + len + item->Length()) > aBufLen ) + { + delete item; + item = NULL; + break; + } + items.Append( item ); + ++( len += item->Length() ); // ++ is for item's size + } + else + { + ; // There was a trace. + } + } + // Check that given buflen (aBufLen) is not smaller than one + // item (TConnMonWLANNetwork) + aRef count + items count + // + item length + if ( items.Count() == 0 && aRef.Count() > 0 ) + { + aBufLen = 2; // aRef.Count(), items.Count() + } + + iBuf = HBufC::New( aBufLen ); // Set size exactly to a buffer length + if ( !iBuf ) + { + items.ResetAndDestroy(); + items.Close(); + return; + } + iBuf->Des().Append( aRef.Count() ); // Total amount of data + iBuf->Des().Append( items.Count() ); // Amount of transferring data + for ( TUint i(0); iDes().Append( items[i]->Length() ); + iBuf->Des().Append( *items[i] ); + } + items.ResetAndDestroy(); + items.Close(); + } + +// ----------------------------------------------------------------------------- +// CConnMonEventBase::CConnMonEventBase +// ----------------------------------------------------------------------------- +// +CConnMonEventBase::CConnMonEventBase( const TInt aEventType, const TUint aConnectionId ) + { + iEventType = aEventType; + iConnectionId = aConnectionId; + } + +// Destructor +CConnMonEventBase::~CConnMonEventBase() + { + } + +// ----------------------------------------------------------------------------- +// CConnMonEventBase::EventType +// ----------------------------------------------------------------------------- +// +TInt CConnMonEventBase::EventType() const + { + return iEventType; + } + +// ----------------------------------------------------------------------------- +// CConnMonConnectionStatusChange::CConnMonConnectionStatusChange +// ----------------------------------------------------------------------------- +// +CConnMonConnectionStatusChange::CConnMonConnectionStatusChange( + const TUint aConnectionId, + const TUint aSubConnectionId, + const TInt aConnectionStatus ) : + CConnMonEventBase(EConnMonConnectionStatusChange, aConnectionId) + { + iSubConnectionId = aSubConnectionId; + iConnectionStatus = aConnectionStatus; + } + +// Destructor +CConnMonConnectionStatusChange::~CConnMonConnectionStatusChange() + { + } + +#ifdef WLANQTUTILS_T_WLANQTUTILS_UT_FLAG + +// ---------------------------------------------- +// Stub functions for connmon library, used in UT +// ---------------------------------------------- + +#include "wlanqtutilstestcontext.h" + +extern WlanQtUtilsTestContext testContext; + +EXPORT_C void RConnectionMonitor::GetConnectionCount( + TUint& aConnectionCount, + TRequestStatus& aStatus) +{ + aConnectionCount = testContext.connMon_.activeConnections_.activeConnList_.count(); + User::RequestComplete(&aStatus, KErrNone); +} + +EXPORT_C TInt RConnectionMonitor::GetConnectionInfo( + const TUint aIndex, + TUint& aConnectionId, + TUint& aSubConnectionCount ) const +{ + aConnectionId = testContext.connMon_.activeConnections_.activeConnList_[aIndex - 1]->connectionId(); + aSubConnectionCount = 0; + return KErrNone; // TODO: put return value into context. +} + +EXPORT_C void RConnectionMonitor::GetIntAttribute( + const TUint aConnectionId, + const TUint /* aSubConnectionId */, + const TUint aAttribute, + TInt& aValue, + TRequestStatus& aStatus ) +{ + WlanQtUtilsCtxActiveConn *activeConn = testContext.connMon_.activeConnections_.findActiveConn(aConnectionId); + if (aAttribute == KBearer) { + aValue = activeConn->connMonBearerType_; + } else if (aAttribute == KConnectionStatus) { + aValue = activeConn->connMonConnectionStatus_; + } else { + Q_ASSERT(false); + } + User::RequestComplete(&aStatus, KErrNone); // TODO: Take return value from the context. +} + +EXPORT_C void RConnectionMonitor::GetUintAttribute( + const TUint aConnectionId, + const TUint /* aSubConnectionId */, + const TUint aAttribute, + TUint& aValue, + TRequestStatus& aStatus ) +{ + WlanQtUtilsCtxActiveConn *activeConn = testContext.connMon_.activeConnections_.findActiveConn(aConnectionId); + if (aAttribute == KIAPId) { + aValue = activeConn->iapId(); + } else { + Q_ASSERT(false); + } + + User::RequestComplete(&aStatus, KErrNone); // TODO: Take return value from the context. +} + +EXPORT_C void RConnectionMonitor::GetPckgAttribute( + const TUint aConnectionId, + const TUint aSubConnectionId, + const TUint aAttribute, + TDes8& aValue, + TRequestStatus& aStatus ) const +{ + // This is copy-paste from real implementation and we'll use that for other requests. + TIpcArgs args(aConnectionId, aSubConnectionId, aAttribute, &aValue); + SendReceive(EReqGetPckgAttribute, args, aStatus); +} + +// --------------------------------------------------------- +// connUtils2ConnMonSecModeMap() +// Local function to map WlanQtUtilsWlanSecMode into Connection +// monitor's security mode. Currently for UT use only. +// --------------------------------------------------------- +// +static TUint connUtils2ConnMonSecModeMap(WlanQtUtilsWlanSecMode connUtilsWlanSecMode) +{ + TUint ret; + switch (connUtilsWlanSecMode) { + case WlanQtUtilsWlanSecModeWep: + ret = EConnMonSecurityWep; + break; + case WlanQtUtilsWlanSecMode802_1x: + ret = EConnMonSecurity802d1x; + break; + case WlanQtUtilsWlanSecModeWpa: + ret = EConnMonSecurityWpa; + break; + case WlanQtUtilsWlanSecModeWpa2: + ret = EConnMonSecurityWpaPsk; + break; + default: + ret = EConnMonSecurityOpen; + break; + } + return ret; +} + + + +EXPORT_C void RConnectionMonitor::GetPckgAttribute( + const TUint /* aConnectionId */, + const TUint /* aSubConnectionId */, + const TUint /* aAttribute */, + TDes16& aValue, + TRequestStatus& aStatus ) const + { + // TODO: verify input parameters, i.e., first three params... + + RConnMonWlanNetworksPtrArray wlanPtrArray; + RBuf vendorData; + + for (int i = 0; i < testContext.connMon_.wlanScanResult_.wlanScanResultList_.count(); i++) { + WlanQtUtilsWlanAp* ap = testContext.connMon_.wlanScanResult_.wlanScanResultList_[i]; + TBufC name(ap->ssid().utf16()); + + TBufC bssid16(QString("addMAC").utf16()); + TBuf8 bssid; + bssid.Copy(bssid16); + + CConnMonWlanNetwork* wlanAp = CConnMonWlanNetwork::NewL( + name, + ap->connectionMode(), + ap->signalStrength(), + connUtils2ConnMonSecModeMap(ap->securityMode()), + bssid, + vendorData ); + wlanPtrArray.Append(wlanAp); + } + + CConnMonWlanNetworksPtrArrayPckg wlanBuf(wlanPtrArray, 2560); + aValue.Copy(wlanBuf.Buf()->Des()); + + User::RequestComplete(&aStatus, KErrNone); // TODO: enable return value modification. + } + +#else // WLANQTUTILS_T_WLANQTUTILS_UT_FLAG + +// ---------------------------------------------------- +// Stub functions for connmon library, used in emulator +// ---------------------------------------------------- + +#if 0 +// In emulator, there are always two active connections. +// The following functions return different properties of these active connection +// so that it's easy to test in emulator. + +EXPORT_C void RConnectionMonitor::GetConnectionCount( + TUint& aConnectionCount, + TRequestStatus& aStatus) +{ + aConnectionCount = 2; + User::RequestComplete(&aStatus, KErrNone); +} + +EXPORT_C TInt RConnectionMonitor::GetConnectionInfo( + const TUint aIndex, + TUint& aConnectionId, + TUint& aSubConnectionCount ) const +{ + if (aIndex == 1) { + aConnectionId = 10; + } else if (aIndex == 2) { + aConnectionId = 20; + } else { + Q_ASSERT(false); + } + + aSubConnectionCount = 0; + return KErrNone; +} + +EXPORT_C void RConnectionMonitor::GetIntAttribute( + const TUint aConnectionId, + const TUint /* aSubConnectionId */, + const TUint aAttribute, + TInt& aValue, + TRequestStatus& aStatus ) +{ + if (aAttribute == KBearer) { + if (aConnectionId == 10) { + aValue = EBearerGPRS; + } else if (aConnectionId == 20) { + aValue = EBearerWLAN; + } else { + Q_ASSERT(false); + } + } else if (aAttribute == KConnectionStatus) { + if (aConnectionId == 10) { + aValue = KConnectionOpen; + } else if (aConnectionId == 20) { + aValue = KStartingConnection; + } else { + Q_ASSERT(false); + } + } else if (aAttribute == KSignalStrength) { + if (aConnectionId == 10) { + Q_ASSERT(false); + } else if (aConnectionId == 20) { + aValue = 78; + } else { + Q_ASSERT(false); + } + } else if (aAttribute == KNetworkMode) { + if (aConnectionId == 10) { + Q_ASSERT(false); + } else if (aConnectionId == 20) { + aValue = EConnMonInfraStructure; + } else { + Q_ASSERT(false); + } + } else if (aAttribute == KSecurityMode) { + if (aConnectionId == 10) { + Q_ASSERT(false); + } else if (aConnectionId == 20) { + aValue = EConnMonSecurityWpaPsk; + } else { + Q_ASSERT(false); + } + } else { + Q_ASSERT(false); + } + User::RequestComplete(&aStatus, KErrNone); +} + +EXPORT_C void RConnectionMonitor::GetUintAttribute( + const TUint aConnectionId, + const TUint /* aSubConnectionId */, + const TUint aAttribute, + TUint& aValue, + TRequestStatus& aStatus ) +{ + if (aAttribute == KIAPId) { + if (aConnectionId == 10) { + aValue = 1; + } else if (aConnectionId == 20) { + aValue = 10; + } else { + Q_ASSERT(false); + } + } else if (aAttribute == KDownlinkData) { + if (aConnectionId == 10) { + aValue = 123; + } else if (aConnectionId == 20) { + aValue = 12345; + } else { + Q_ASSERT(false); + } + } else if (aAttribute == KUplinkData) { + if (aConnectionId == 10) { + aValue = 987654321; + } else if (aConnectionId == 20) { + aValue = 1234567890; + } else { + Q_ASSERT(false); + } + } else if (aAttribute == KTransmitPower) { + if (aConnectionId == 10) { + Q_ASSERT(false); + } else if (aConnectionId == 20) { + aValue = 50; + } else { + Q_ASSERT(false); + } + } else { + Q_ASSERT(false); + } + + User::RequestComplete(&aStatus, KErrNone); +} + +EXPORT_C void RConnectionMonitor::GetBoolAttribute( + const TUint aConnectionId, + const TUint /* aSubConnectionId */, + const TUint aAttribute, + TBool& aValue, + TRequestStatus& aStatus ) +{ + if (aAttribute == KConnectionActive) { + if (aConnectionId == 10) { + aValue = EFalse; + } else if (aConnectionId == 20) { + aValue = ETrue; + } else { + Q_ASSERT(false); + } + } else { + Q_ASSERT(false); + } + + User::RequestComplete(&aStatus, KErrNone); +} + +EXPORT_C void RConnectionMonitor::GetStringAttribute( + const TUint aConnectionId, + const TUint /* aSubConnectionId */, + const TUint aAttribute, + TDes& aValue, + TRequestStatus& aStatus ) const +{ + if (aAttribute == KIAPName) { + if (aConnectionId == 10) { + _LIT(iapNameLit, "PACKET DATA 1"); + TBufC iapName(iapNameLit); + aValue = iapName.Des(); + } else if (aConnectionId == 20) { + _LIT(iapNameLit, "WLAN IAP 3"); + TBufC iapName(iapNameLit); + aValue = iapName.Des(); + } else { + Q_ASSERT(false); + } + } else if (aAttribute == KNetworkName) { + if (aConnectionId == 10) { + Q_ASSERT(false); + } else if (aConnectionId == 20) { + _LIT(ssidLit, "WLAN SSID 3"); + TBufC ssid(ssidLit); + aValue = ssid.Des(); + } else { + Q_ASSERT(false); + } + } else if (aAttribute == KAccessPointName) { + if (aConnectionId == 10) { + _LIT(iapNameLit, "PACKET DATA 1"); + TBufC iapName(iapNameLit); + aValue = iapName.Des(); + } else if (aConnectionId == 20) { + Q_ASSERT(false); + } else { + Q_ASSERT(false); + } + } else { + Q_ASSERT(false); + } + + User::RequestComplete(&aStatus, KErrNone); +} + +EXPORT_C void RConnectionMonitor::GetPckgAttribute( + const TUint aConnectionId, + const TUint aSubConnectionId, + const TUint aAttribute, + TDes8& aValue, + TRequestStatus& aStatus ) const +{ + if (aAttribute == KStartTime) { + if (aConnectionId == 10) { + TDateTime dateTime(2009, EMarch, 31-1, 15, 15, 15, 0); + TTime time(dateTime); + TConnMonTimeBuf timePckg(time); + aValue.Copy(timePckg); + } else if (aConnectionId == 20) { + TTime time; + time.UniversalTime(); + TConnMonTimeBuf timePckg(time); + aValue.Copy(timePckg); + } else { + Q_ASSERT(false); + } + User::RequestComplete(&aStatus, KErrNone); + } else if (aAttribute == KClientInfo) { + TConnMonClientEnum applications; + if (aConnectionId == 10) { + applications.iCount = 1; + applications.iUid[0].iUid = 0x10008D39; // Web + applications.iUid[1].iUid = 0; + applications.iUid[2].iUid = 0; + applications.iUid[3].iUid = 0; + applications.iUid[4].iUid = 0; + applications.iUid[5].iUid = 0; + applications.iUid[6].iUid = 0; + applications.iUid[7].iUid = 0; + applications.iUid[8].iUid = 0; + applications.iUid[9].iUid = 0; + } else if (aConnectionId == 20) { + applications.iCount = 7; + applications.iUid[0].iUid = 0x101fd9c5; // KBannedServerUID + applications.iUid[1].iUid = 0x1020728E; // KFeedsServerUid + applications.iUid[2].iUid = 0x10008D60; // KDownloadMgrServerUid + applications.iUid[3].iUid = 0x1000484b; // KMessagingServerUid + applications.iUid[4].iUid = 0x102033E6; // KJavaVMUid + applications.iUid[5].iUid = 0x102073CA; // KSUPLServerUid + applications.iUid[6].iUid = 0x200212F3; // Connect Screen + applications.iUid[7].iUid = 0; + applications.iUid[8].iUid = 0; + applications.iUid[9].iUid = 0; + } else { + Q_ASSERT(false); + } + TPckgBuf< TConnMonClientEnum > applicationsPckg( applications ); + aValue.Copy(applicationsPckg); + User::RequestComplete(&aStatus, KErrNone); + } else { + // This is copy-paste from real implementation and we'll use that for other requests. + TIpcArgs args( aConnectionId, aSubConnectionId, aAttribute, &aValue ); + SendReceive( EReqGetPckgAttribute, args, aStatus ); + } +} +#endif + +// This function returns WLAN scan results. +// Six results in every second scan and the others have two. +EXPORT_C void RConnectionMonitor::GetPckgAttribute( + const TUint /* aConnectionId */, + const TUint /* aSubConnectionId */, + const TUint aAttribute, + TDes16& aValue, + TRequestStatus& aStatus ) const { + + if (aAttribute == KWlanNetworks) { + RConnMonWlanNetworksPtrArray wlanPtrArray; + RBuf vendorData; + + TBufC bssid16(QString("addMAC").utf16()); + TBuf8 bssid; + bssid.Copy(bssid16); + + _LIT(wlanAp1Name, "Test AP 1"); + TBufC name1(wlanAp1Name); + CConnMonWlanNetwork* wlanAp1 = CConnMonWlanNetwork::NewL( + name1, + EConnMonInfraStructure, + 20, + EConnMonSecurityOpen, + bssid, + vendorData ); + wlanPtrArray.Append(wlanAp1); + + _LIT(wlanAp2Name, "Test AP 2"); + TBufC name2(wlanAp2Name); + CConnMonWlanNetwork* wlanAp2 = CConnMonWlanNetwork::NewL( + name2, + EConnMonAdHoc, + 20, + EConnMonSecurityOpen, + bssid, + vendorData ); + wlanPtrArray.Append(wlanAp2); + + static bool refresh = true; + + if (refresh) { + _LIT(wlanAp3Name, "Test AP 3"); + TBufC name3(wlanAp3Name); + CConnMonWlanNetwork* wlanAp3 = CConnMonWlanNetwork::NewL( + name3, + EConnMonInfraStructure, + 20, + EConnMonSecurityWep, + bssid, + vendorData ); + wlanPtrArray.Append(wlanAp3); + + _LIT(wlanAp4Name, "Test AP 4"); + TBufC name4(wlanAp4Name); + CConnMonWlanNetwork* wlanAp4 = CConnMonWlanNetwork::NewL( + name4, + EConnMonInfraStructure, + 20, + EConnMonSecurityOpen, + bssid, + vendorData ); + wlanPtrArray.Append(wlanAp4); + + _LIT(wlanAp5Name, "Test AP 5"); + TBufC name5(wlanAp5Name); + CConnMonWlanNetwork* wlanAp5 = CConnMonWlanNetwork::NewL( + name5, + EConnMonInfraStructure, + 20, + EConnMonSecurityWpa, + bssid, + vendorData ); + wlanPtrArray.Append(wlanAp5); + + _LIT(wlanAp6Name, "Test AP 6"); + TBufC name6(wlanAp6Name); + CConnMonWlanNetwork* wlanAp6 = CConnMonWlanNetwork::NewL( + name6, + EConnMonInfraStructure, + 20, + EConnMonSecurityWpaPsk, + bssid, + vendorData ); + wlanPtrArray.Append(wlanAp6); + + refresh = false; + } else { + refresh = true; + } + + CConnMonWlanNetworksPtrArrayPckg wlanBuf(wlanPtrArray, 2560); // TODO: buffer size to more dynamic or use constant + aValue.Copy(wlanBuf.Buf()->Des()); + } else { + Q_ASSERT(false); + } + + User::RequestComplete(&aStatus, KErrNone); +} + +#endif // WLANQTUTILS_T_WLANQTUTILS_UT_FLAG +#endif // __WINS__ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/ut/stubs/wlanqtutilsconnteststub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/ut/stubs/wlanqtutilsconnteststub.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is a source file for connmon library stub functions +*/ + +#include + +#ifdef __WINS__ + +#ifdef WLANQTUTILS_T_WLANQTUTILS_UT_FLAG + +// ---------------------------------------------- +// Stub functions for ICT library, used in UT +// ---------------------------------------------- + +#include "wlanqtutilstestcontext.h" + +extern WlanQtUtilsTestContext testContext; + +// ---------------------------------------------------- +// NewL is not stubbed -> parameters are not checked at all +// ---------------------------------------------------- + +/** + * Empty implementation to prevent actual ICT from starting. Result callback is called directly + * in the test cases. + */ +EXPORT_C void CIctsClientInterface::StartL() + { + } + +#endif // WLANQTUTILS_T_WLANQTUTILS_UT_FLAG + +// ---------------------------------------------------- +// No stubs used in emulator +// ---------------------------------------------------- +#endif // __WINS__ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/ut/stubs/wlanqtutilsesockstub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/ut/stubs/wlanqtutilsesockstub.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is a source file for esock library stub functions +*/ + +#include + +#ifdef __WINS__ + +#ifdef WLANQTUTILS_T_WLANQTUTILS_UT_FLAG + +// ---------------------------------------------- +// Stub functions for esock library, used in UT +// ---------------------------------------------- + +#include "wlanqtutilstestcontext.h" + +extern WlanQtUtilsTestContext testContext; + +/** + * Returns value from test context. + * + * TConnPref value cannot be verified easily because the real value passed to the function is + * TCommDbConnPref. Dynamic cast from TConnPref to TCommDbConnPref does not work because + * TConnPref does not have virtual functions which means that type information for the + * class hierarchy is not created by the compiler. + */ +void RConnection::Start(class TConnPref &, class TRequestStatus &aStatus) +{ + User::RequestComplete(&aStatus, testContext.esock_.startRetValue_); +} + +#else // WLANQTUTILS_T_WLANQTUTILS_UT_FLAG + +// ---------------------------------------------------- +// Stub functions for esock library, used in emulator +// ---------------------------------------------------- + +/** + * Return always success in emulator. + */ +void RConnection::Start(class TConnPref &, class TRequestStatus &aStatus) +{ + User::RequestComplete(&aStatus, KErrNone); +} + +#endif // WLANQTUTILS_T_WLANQTUTILS_UT_FLAG +#endif // __WINS__ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/ut/t_wlanqtutils/t_wlanqtutils.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/ut/t_wlanqtutils/t_wlanqtutils.pro Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,99 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +QT += testlib + +TEMPLATE = app +TARGET = t_wlanqtutils + +TARGET.CAPABILITY = ALL -TCB + +DEPENDPATH += . + +#Store generated .moc files to their own directory +MOC_DIR = moc + +#BUILD_DLL macro is used to define export macro +DEFINES += BUILD_WLANQTUTILITIES_DLL + +#Following macros MW_LAYER_SYSTEMINCLUDE and OS_LAYER_SYSTEMINCLUDE are defined +#in X:\QT\mkspecs\features\symbian\platform_paths.prf that is always inluded in +#QT compilation + +INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \ + $$OS_LAYER_SYSTEMINCLUDE \ + . \ + ../../base/inc \ + ../../wrapper/inc \ + ../../traces \ + /epoc32/include/domain/osextensions + +# Input +HEADERS += testwlanqtutils.h \ + ../context/wlanqtutilstestcontext.h \ + ../../base/inc/wlanqtutils.h \ + ../../base/inc/wlanqtutils_p.h \ + ../../base/inc/wlanqtutilsiap.h \ + ../../base/inc/wlanqtutilswlaniap.h \ + ../../base/inc/wlanqtutilswlanap.h \ + ../../base/inc/wlanqtutilsactiveconn.h \ + ../../wrapper/inc/wlanqtutilscmmwrapper.h \ + ../../wrapper/inc/wlanqtutilsconmonwrapper.h \ + ../../wrapper/inc/wlanqtutilsconntestwrapper.h \ + ../../wrapper/inc/wlanqtutilsesockwrapper.h \ + ../../traces/OstTraceDefinitions.h + +SOURCES += testwlanqtutils.cpp \ + ../context/wlanqtutilstestcontext.cpp \ + ../../base/src/wlanqtutils.cpp \ + ../../base/src/wlanqtutils_p.cpp \ + ../../base/src/wlanqtutilsiap.cpp \ + ../../base/src/wlanqtutilswlaniap.cpp \ + ../../base/src/wlanqtutilswlanap.cpp \ + ../../base/src/wlanqtutilsactiveconn.cpp \ + ../../wrapper/src/wlanqtutilscmmwrapper.cpp \ + ../../wrapper/src/wlanqtutilsconmonwrapper.cpp \ + ../../wrapper/src/wlanqtutilsconntestwrapper.cpp \ + ../../wrapper/src/wlanqtutilsesockwrapper.cpp + +symbian: { + HEADERS += ../../wrapper/inc/wlanqtutilscmmwrapper_s60_p.h \ + ../../wrapper/inc/wlanqtutilsconmonwrapper_s60_p.h \ + ../../wrapper/inc/wlanqtutilsconntestwrapper_s60_p.h \ + ../../wrapper/inc/wlanqtutilsesockwrapper_s60_p.h + + SOURCES += ../../wrapper/src/wlanqtutilscmmwrapper_s60.cpp \ + ../../wrapper/src/wlanqtutilsconmonwrapper_s60.cpp \ + ../../wrapper/src/wlanqtutilsconntestwrapper_s60.cpp \ + ../../wrapper/src/wlanqtutilsesockwrapper_s60.cpp \ + ../stubs/wlanqtutilsconnmonstub.cpp \ + ../stubs/wlanqtutilsconnteststub.cpp \ + ../stubs/wlanqtutilsesockstub.cpp +} + +LIBS += -lcmmanager -lconnmon -lcommdb -lesock -lictsclientinterface + +#UT flag is set +DEFINES += WLANQTUTILS_T_WLANQTUTILS_UT_FLAG + +coverage_test: { +message(*** Coverage test mode build - no OST traces.) +#NO_OST_TRACES flag is set +DEFINES += WLANQTUTILS_NO_OST_TRACES_FLAG 'Q_ASSERT(test)=' +} +else { +message(*** Normal Symbian-mode build.) +} \ No newline at end of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/ut/t_wlanqtutils/testwlanqtutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/ut/t_wlanqtutils/testwlanqtutils.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,683 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is the source file for testing Wlan Qt Utilities library. +*/ + +#include +#include +#include +#include +#include +#include "wlanqtutilscommon.h" +#include "wlanqtutilswlanap.h" +#include "wlanqtutilsiap.h" +#include "wlanqtutilswlaniap.h" +#include "wlanqtutils.h" +#include "wlanqtutils_p.h" +#include "wlanqtutilsconmonwrapper.h" +#include "wlanqtutilsconmonwrapper_s60_p.h" +#include "wlanqtutilsconntestwrapper.h" +#include "wlanqtutilsconntestwrapper_s60_p.h" +#include "testwlanqtutils.h" +#include "wlanqtutilstestcontext.h" + +WlanQtUtilsTestContext testContext; + +const QString TestWlanQtUtils::commsDatDefault_ = "default.cre"; + +// --------------------------------------------------------- +// FRAMEWORK FUNCTIONS +// --------------------------------------------------------- + +/** + * This function will be called before the first test function is executed. + */ +void TestWlanQtUtils::initTestCase() +{ + wlanQtUtils_ = NULL; + signalScanReady_ = NULL; + signalWlanNetworkOpened_ = NULL; + signalWlanNetworkClosed_ = NULL; + + //If Active scheduler exists then don't install a new one as it will cause panic + if (CActiveScheduler::Current() == NULL) { + CActiveScheduler *scheduler = new CActiveScheduler(); + CActiveScheduler::Install(scheduler); + } +} + +/** + * This function will be called after the last test function was executed. + */ +void TestWlanQtUtils::cleanupTestCase() +{ + // CommsDat file is initialized. + subTestLoadCommsDatFile(commsDatDefault_); + + // TODO: Can we get rid of this delay? + QWARN(": \n *********** \n * PASSED! * \n *********** \n\n\n"); + QWARN(": \n *** Window will be closed in 5s... \n\n\n"); + QTest::qSleep(5000); +} + +/** + * This function will be called before each test function is executed. + */ +void TestWlanQtUtils::init() +{ + // CommsDat file is initialized. + subTestLoadCommsDatFile(commsDatDefault_); + + testContext.initialize(); + + QVERIFY(wlanQtUtils_ == NULL); + QVERIFY(signalScanReady_ == NULL); + QVERIFY(signalWlanNetworkOpened_ == NULL); + QVERIFY(signalWlanNetworkClosed_ == NULL); + subTestNewWlanQtUtils(); +} + +/** + * This function will be called after each test function is executed. + */ +void TestWlanQtUtils::cleanup() +{ + delete wlanQtUtils_; + wlanQtUtils_ = NULL; + + QCOMPARE(signalScanReady_->count(), 0); + delete signalScanReady_; + signalScanReady_ = NULL; + + QCOMPARE(signalWlanNetworkOpened_->count(), 0); + delete signalWlanNetworkOpened_; + signalWlanNetworkOpened_ = NULL; + + QCOMPARE(signalWlanNetworkClosed_->count(), 0); + delete signalWlanNetworkClosed_; + signalWlanNetworkClosed_ = NULL; +} + +// --------------------------------------------------------- +// TEST CASES +// --------------------------------------------------------- + +/** + * Test available WLAN APs when scan is triggered by client. + * Two scan results have the same SSID and the latter one of those will be removed. + * Two scan results have the same SSID but different security mode + * and both are included in the results. + */ +void TestWlanQtUtils::testAvailableWlanAps() +{ + testContext.connMon_.wlanScanResult_.createDefaultWlanScanResultList(10); + testContext.connMon_.wlanScanResult_.wlanScanResultList_[0]->setSsid("Same SSID"); + testContext.connMon_.wlanScanResult_.wlanScanResultList_[2]->setSsid("Same SSID"); + testContext.connMon_.wlanScanResult_.wlanScanResultList_[5]->setSsid("Same SSID, different SecMode"); + testContext.connMon_.wlanScanResult_.wlanScanResultList_[5]->setSecurityMode(WlanQtUtilsWlanSecModeWpa); + testContext.connMon_.wlanScanResult_.wlanScanResultList_[8]->setSsid("Same SSID, different SecMode"); + testContext.connMon_.wlanScanResult_.wlanScanResultList_[8]->setSecurityMode(WlanQtUtilsWlanSecModeOpen); + + // Request a scan to get result signal + wlanQtUtils_->scanWlans(); + + // Let active object run and verify signal. + subTestSignalWaitAndTake(signalScanReady_, NULL); + + // Get and verify the list of available WLAN APs. + QList iaps; + QList aps; + wlanQtUtils_->availableWlanAps(iaps, aps); + + // First remove AP that has duplicate SSID. + // Then order APs alphabetically. + testContext.connMon_.wlanScanResult_.wlanScanResultList_.removeAt(2); + testContext.connMon_.wlanScanResult_.wlanScanResultList_.move(4, 1); + testContext.connMon_.wlanScanResult_.wlanScanResultList_.move(7, 1); + testContext.connMon_.wlanScanResult_.wlanScanResultList_.move(8, 3); + testContext.connMon_.wlanScanResult_.verifyWlanScanResultList(aps); + QCOMPARE(iaps.count(), 0); + aps.clear(); // TODO: Free AP pointers too. +} + +/** + * Test available WLAN APs when there are also WLAN IAPs available. + */ +void TestWlanQtUtils::testAvailableWlanApsWithIaps() +{ + testContext.connMon_.wlanScanResult_.createDefaultWlanScanResultList(7); + testContext.connMon_.wlanScanResult_.wlanScanResultList_[1]->setSsid("WLAN IAP 3"); + testContext.connMon_.wlanScanResult_.wlanScanResultList_[1]->setSecurityMode(WlanQtUtilsWlanSecModeWpa); + testContext.connMon_.wlanScanResult_.wlanScanResultList_[3]->setSsid(""); + testContext.connMon_.wlanScanResult_.wlanScanResultList_[5]->setSsid("WLAN IAP 1"); + // Todo: security mode not compared yet due to an issue with CMM vs ConnMon WLAN security + // modes under investigation + // SSID is found in Internet Snap, but security mode does not match: + // testContext.connMon_.wlanScanResult_.wlanScanResultList_[6]->setSsid("WLAN IAP 2"); + // testContext.connMon_.wlanScanResult_.wlanScanResultList_[6]->setSecurityMode(WlanQtUtilsWlanSecModeWpa); + + // Request a scan to get result signal + wlanQtUtils_->scanWlans(); + + // Let active object run and verify signal. + subTestSignalWaitAndTake(signalScanReady_, NULL); + + // Get and verify the list of available WLAN APs. + QList iaps; + QList aps; + wlanQtUtils_->availableWlanAps(iaps, aps); + + // Verify WLAN AP list. First, remove scan results that will not appear + // because they are hidden WLANs or WLAN IAPs. + testContext.connMon_.wlanScanResult_.wlanScanResultList_.removeAt(5); + testContext.connMon_.wlanScanResult_.wlanScanResultList_.removeAt(3); + testContext.connMon_.wlanScanResult_.wlanScanResultList_.removeAt(1); + testContext.connMon_.wlanScanResult_.verifyWlanScanResultList(aps); + + // Verify WLAN IAP list + QCOMPARE(iaps.count(), 2); + QCOMPARE(iaps[0]->id(), 5); + QCOMPARE(iaps[0]->name(), QString("WLAN IAP 1")); + QCOMPARE(iaps[0]->bearerType(), WlanQtUtilsBearerTypeWlan); + QCOMPARE(iaps[0]->ssid(), QString("WLAN IAP 1")); + QCOMPARE(iaps[1]->id(), 7); + QCOMPARE(iaps[1]->name(), QString("WLAN IAP 3")); + QCOMPARE(iaps[1]->bearerType(), WlanQtUtilsBearerTypeWlan); + QCOMPARE(iaps[1]->ssid(), QString("WLAN IAP 3")); + iaps.clear(); // TODO: Free IAP pointers too. + aps.clear(); // TODO: Free AP pointers too. +} + +/** + * Test refereshing of WLAN APs when client requests sequential scans. + */ +void TestWlanQtUtils::testAvailableWlanApsSequence() +{ + // **************** Before 1st scan ******************** + QList iaps; + QList aps; + wlanQtUtils_->availableWlanAps(iaps, aps); + // Verify we have no results + QCOMPARE(aps.count(), 0); + QCOMPARE(iaps.count(), 0); + + // **************** 1st scan ******************** + // 6 APs are required for this scan + testContext.connMon_.wlanScanResult_.createDefaultWlanScanResultList(6); + + wlanQtUtils_->scanWlans(); + subTestSignalWaitAndTake(signalScanReady_, NULL); + + // Get the results for the 1st scan + wlanQtUtils_->availableWlanAps(iaps, aps); + // Verify the results for the scan + testContext.connMon_.wlanScanResult_.verifyWlanScanResultList(aps); + QCOMPARE(iaps.count(), 0); + aps.clear(); // TODO: free memory of pointers too. + + // **************** 2nd scan ******************** + // 2 APs are required for this scan + testContext.connMon_.wlanScanResult_.createDefaultWlanScanResultList(2); + + wlanQtUtils_->scanWlans(); + subTestSignalWaitAndTake(signalScanReady_, NULL); + + // Get the results for the 2nd scan + wlanQtUtils_->availableWlanAps(iaps, aps); + // Verify the results for the scan + testContext.connMon_.wlanScanResult_.verifyWlanScanResultList(aps); + QCOMPARE(iaps.count(), 0); + aps.clear(); // TODO: Free memory + + // **************** 3rd scan ******************** + // 4 APs are required for the 3rd scan + testContext.connMon_.wlanScanResult_.createDefaultWlanScanResultList(4); + + wlanQtUtils_->scanWlans(); + subTestSignalWaitAndTake(signalScanReady_, NULL); + + // Get the results for the 3rd scan + wlanQtUtils_->availableWlanAps(iaps, aps); + // Verify the results for the scan + testContext.connMon_.wlanScanResult_.verifyWlanScanResultList(aps); + QCOMPARE(iaps.count(), 0); + aps.clear(); // TODO: Free memory +} + +/** + * This function tests creation of WLAN IAP in a succesful manner. + * - WLAN scan is made because otherwise we cannot verify that IAP creation is successful. + * - Check that there are no available WLAN IAPs. + * - Fetch SNAP list. + * - Create WLAN IAP. + * - Check that WLAN IAP has been created and that this IAP is not in WLAN AP scan results. + */ +void TestWlanQtUtils::testCreateWlanIapOk() +{ + testContext.connMon_.wlanScanResult_.createDefaultWlanScanResultList(1); + testContext.connMon_.wlanScanResult_.wlanScanResultList_[0]->setSsid("New WLAN IAP"); + testContext.connMon_.wlanScanResult_.wlanScanResultList_[0]->setSecurityMode(WlanQtUtilsWlanSecModeWpa2); + + // Create a new instance in order to test functionality triggered in constructor. + WlanQtUtils *utils = new WlanQtUtils(); + QSignalSpy spy(utils, SIGNAL(wlanScanReady())); + QVERIFY(spy.isValid() == true); + subTestSignalWaitAndTake(&spy, NULL); + + // Ensure there are no WLAN IAPs but there is one scan result. + QList iaps; + QList aps; + utils->availableWlanAps(iaps, aps); + + QCOMPARE(iaps.count(), 0); + testContext.connMon_.wlanScanResult_.verifyWlanScanResultList(aps); + + // Execute createWlanIap() function + WlanQtUtilsWlanAp wlanAp("New WLAN IAP", "abcdef", 90, EConnMonInfraStructure, WlanQtUtilsWlanSecModeWpa2); + int iapId = utils->createWlanIap(&wlanAp); + + // Verify that created IAP is in the IAP list and AP list is empty. + utils->availableWlanAps(iaps, aps); + QCOMPARE(iaps.count(), 1); + QCOMPARE(iaps[0]->id(), iapId); + QCOMPARE(iaps[0]->name(), QString("New WLAN IAP")); + QCOMPARE(iaps[0]->bearerType(), WlanQtUtilsBearerTypeWlan); + QCOMPARE(iaps[0]->ssid(), QString("New WLAN IAP")); + // Todo: should be Wpa2, CMM vs ConnMon WLAN security modes under investigation + QCOMPARE(iaps[0]->securityMode(), WlanQtUtilsWlanSecModeWpa); + QCOMPARE(aps.count(), 0); + iaps.clear(); // TODO: memory leak. + delete utils; +} + +/** + * This function tests connecting to IAP in a succesful manner. + */ +void TestWlanQtUtils::testConnectIapOk() +{ + testContext.esock_.startRetValue_ = KErrNone; + + // Esock stub completes connection creation immediately + wlanQtUtils_->connectIap(5); + + // Connection creation in ConnMon interface + testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, 5); + wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonEventBase( + EConnMonCreateConnection, + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); + + // Connection status change in ConnMon interface + wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KConnectionOpen)); + + // Receive signal for connection opening (caused by connectIap, which completed immediately) + QList arguments; + subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); + QCOMPARE(arguments.at(0).toInt(), 5); + + // Connection status change to opened in ConnMon interface. Sub test cases between test + // cases check that no extra signals are sent + wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KLinkLayerOpen)); +} + +/** + * This function tests connecting to IAP in unsuccesful manner. + */ +void TestWlanQtUtils::testConnectIapErr() +{ + testContext.esock_.startRetValue_ = KErrGeneral; + + wlanQtUtils_->connectIap(7); + + testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, 7); + wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonEventBase( + EConnMonCreateConnection, + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); + wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KConnectionOpen)); + + wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonEventBase( + EConnMonDeleteConnection, + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); + + QList arguments; + subTestSignalWaitAndTake(signalWlanNetworkClosed_, &arguments); + QCOMPARE(arguments.at(0).toInt(), 7); +} + +// TODO: testDisconnectFail cases are needed when fail branches are +// implemented into the connmon wrapper +/** + * This function tests IAP disconnecting functionality. + */ +void TestWlanQtUtils::testDisconnectIapOk() +{ + // Create and connect an IAP we can then disconnect + WlanQtUtilsWlanAp wlanAp("Disconnect IAP", "abcdef", 90, EConnMonInfraStructure, WlanQtUtilsWlanSecModeWpa2); + int iapId = wlanQtUtils_->createWlanIap(&wlanAp); + testContext.esock_.startRetValue_ = KErrNone; + wlanQtUtils_->connectIap(iapId); + QList arguments; + subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); + QCOMPARE(arguments.at(0).toInt(), iapId); + + // The disconnect function does not have any return values or + // signals related to the disconnection, thus plain + // function call is done for the test. + wlanQtUtils_->disconnectIap(iapId); +} + +/** + * This function tests IAP getter with existing IAP ID. + */ +void TestWlanQtUtils::testIapFound() +{ + // Create the IAP we want to find with the getter + WlanQtUtilsWlanAp wlanAp("testIapFound", "abcdef", 90, EConnMonInfraStructure, WlanQtUtilsWlanSecModeWpa2); + int iapId = wlanQtUtils_->createWlanIap(&wlanAp); + + // Execute the function under test and check that we got the correct IAP + WlanQtUtilsIap *iap = wlanQtUtils_->iap(iapId); + QVERIFY(iap != NULL); + QCOMPARE(iap->id(), iapId); + QCOMPARE(iap->name(), QString("testIapFound")); + QCOMPARE(iap->bearerType(), WlanQtUtilsBearerTypeWlan); +} + +/** + * This function tests IAP getter with non-existing IAP ID. + */ +void TestWlanQtUtils::testIapNotFound() +{ + // Execute the function under test and check that we get no IAP as result + WlanQtUtilsIap *iap = wlanQtUtils_->iap(1000); + QVERIFY(iap == NULL); +} + +/** + * This function tests connected WLAN IAP getter with existing connection. + */ +void TestWlanQtUtils::testConnectedWlanIdFound() +{ + // Create the IAP we want to find with the getter + WlanQtUtilsWlanAp wlanAp("testConnectedWlanIdFound", "abcdef", 90, EConnMonInfraStructure, WlanQtUtilsWlanSecModeWpa2); + int iapId = wlanQtUtils_->createWlanIap(&wlanAp); + + testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, iapId); + + // Send event for connection creation. + wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonEventBase( + EConnMonCreateConnection, + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); + + // Send events for connection status change -> opened. + wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KStartingConnection)); + wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KLinkLayerOpen)); + + QList arguments; + subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); + QCOMPARE(arguments.at(0).toInt(), iapId); + + // Execute the function under test and check that we get valid ID as result + int id = wlanQtUtils_->connectedWlanId(); + QCOMPARE(id, iapId); +} + +/** + * This function tests connected WLAN IAP getter with connection existing already during dll construction. + */ +void TestWlanQtUtils::testConnectedWlanIdFoundConstructor() +{ + // IAP ID 5 exists in default commsdat file + testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, 5); + + // Create a new instance in order to test functionality triggered in constructor. + WlanQtUtils *utils = new WlanQtUtils(); + + // Execute the function under test and check that we get valid ID as result + int id = utils->connectedWlanId(); + QCOMPARE(id, 5); + + delete utils; +} + +/** + * This function tests connected WLAN IAP getter without existing connection. + */ +void TestWlanQtUtils::testConnectedWlanIdNotFound() +{ + // Execute the function under test and check that we get invalid ID as result + int id = wlanQtUtils_->connectedWlanId(); + QCOMPARE(id, WlanQtUtilsInvalidIapId); +} + +/** + * Test WLAN scan triggering interface. + */ +void TestWlanQtUtils::testScanWlans() +{ + // Execute function under test + wlanQtUtils_->scanWlans(); + + // No need to verify scan results here, testAvailableWlanAps* test cases + // are for that. Just make sure the result signal is received. + subTestSignalWaitAndTake(signalScanReady_, NULL); +} + +/** + * This function tests Wlan network opening signal when network is not opened by the dll. + */ +void TestWlanQtUtils::testWlanNetworkOpened() +{ + testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, 5); + + // Send event for connection creation. + wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonEventBase( + EConnMonCreateConnection, + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); + + // Send events for connection status change -> opened. + wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KConnectionOpen)); + wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KLinkLayerOpen)); + + QList arguments; + subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); + QCOMPARE(arguments.at(0).toInt(), 5); +} + +/** + * This function tests Wlan network closing signal when network is not closed by the dll. + */ +void TestWlanQtUtils::testWlanNetworkClosed() +{ + // First create a connection + testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, 5); + + // Send event for connection creation. + wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonEventBase( + EConnMonCreateConnection, + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); + + // Send events for connection status change -> opened. + wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KConnectionOpen)); + wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KLinkLayerOpen)); + + QList arguments; + subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); + QCOMPARE(arguments.at(0).toInt(), 5); + + // Send event for connection status change -> closed. + wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonConnectionStatusChange( + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), + 0, + KLinkLayerClosed)); + + // Send event for connection deletion. + wlanQtUtils_->d_ptr->conMonWrapper_->d_ptrConnInfo->EventL(CConnMonEventBase( + EConnMonDeleteConnection, + testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); + + subTestSignalWaitAndTake(signalWlanNetworkClosed_, &arguments); + QCOMPARE(arguments.at(0).toInt(), 5); +} + +/** + * This function tests ICT when connection test passes. + */ +void TestWlanQtUtils::testConnectionTestPass() +{ + // Create and connect an IAP we can then test + WlanQtUtilsWlanAp wlanAp("Connection test IAP", "abcdef", 90, EConnMonInfraStructure, WlanQtUtilsWlanSecModeWpa2); + int iapId = wlanQtUtils_->createWlanIap(&wlanAp); + testContext.esock_.startRetValue_ = KErrNone; + wlanQtUtils_->connectIap(iapId); + QList arguments; + subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); + QCOMPARE(arguments.at(0).toInt(), iapId); + + // Connection test automatically started at this point. Call result function explicitly + // No interface exists that we could check that the IAP is moved to Internet SNAP correctly + TBuf<5> string; + wlanQtUtils_->d_ptr->connTestWrapper_->d_ptr_->ConnectivityObserver(EConnectionOk, string); +} + +/** + * This function tests ICT when connection test fails. + */ +void TestWlanQtUtils::testConnectionTestFail() +{ + // Create and connect an IAP we can then test + WlanQtUtilsWlanAp wlanAp("Connection test IAP", "abcdef", 90, EConnMonInfraStructure, WlanQtUtilsWlanSecModeWpa2); + int iapId = wlanQtUtils_->createWlanIap(&wlanAp); + testContext.esock_.startRetValue_ = KErrNone; + wlanQtUtils_->connectIap(iapId); + QList arguments; + subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); + QCOMPARE(arguments.at(0).toInt(), iapId); + + // Connection test automatically started at this point. Call result function explicitly + // No interface exists that we could check that IAP is not moved to another SNAP + // Todo: Repeat for all possible error codes to gain coverage + TBuf<5> string; + wlanQtUtils_->d_ptr->connTestWrapper_->d_ptr_->ConnectivityObserver(EHttpAuthenticationNeeded, string); +} + +// --------------------------------------------------------- +// SUB TEST CASES +// --------------------------------------------------------- + +/** + * This function waits for active objects to get time to run, takes the arguments of the + * first signal and returns them from the given signal spy. + * This function also verifies that the number of signals is 1. + * + * @param[in] spy Signal spy. + * @param[out] arguments Arguments of the first signal in the given signal spy. NULL if arguments not needed. + */ +void TestWlanQtUtils::subTestSignalWaitAndTake(QSignalSpy* spy, QList* arguments) +{ + QTest::qWait(1); + QCOMPARE(spy->count(), 1); + QList arguments_tmp = spy->takeFirst(); + if (arguments != NULL) { + *arguments = arguments_tmp; + } +} + +/** + * This function loads given CommsDat file, replacing current one. + * If CommsDat file doesn't exist, it can be re-created by commanding WST script. + * Using help switch is a quick way: + * run_wst HELP + * + * @param newCommsdatFilename Filename of the new CommsDat to be loaded. + */ +void TestWlanQtUtils::subTestLoadCommsDatFile(QString newCommsdatFilename) +{ + // EPOC's CommsDat filename + const QString epocCommsdatFilename("cccccc00.cre"); + // EPOC's directory for CommsDat file + const QString commsdatDir("c:\\private\\10202be9\\persists\\"); + // Created backup directory under EPOC for CommsDat files + const QString storeDir("c:\\private\\10202be9\\persists\\backup\\"); + QString nameOld = commsdatDir + epocCommsdatFilename; + QString nameDefault = storeDir + newCommsdatFilename; + + // First remove the old CommsDat file. + Q_ASSERT(QFile::remove(nameOld) == TRUE); + + // Copy the stored default CommsDat file. + Q_ASSERT(QFile::copy(nameDefault, nameOld) == TRUE); +} + +/** + * + */ +void TestWlanQtUtils::subTestNewWlanQtUtils() +{ + if (wlanQtUtils_ != NULL) { + delete wlanQtUtils_; + } + wlanQtUtils_ = new WlanQtUtils(); + + if (signalScanReady_ != NULL) { + delete signalScanReady_; + } + signalScanReady_ = new QSignalSpy(wlanQtUtils_, SIGNAL(wlanScanReady())); + QVERIFY(signalScanReady_->isValid() == true); + + if (signalWlanNetworkOpened_ != NULL) { + delete signalWlanNetworkOpened_; + } + signalWlanNetworkOpened_ = new QSignalSpy(wlanQtUtils_, SIGNAL(wlanNetworkOpened(int))); + QVERIFY(signalWlanNetworkOpened_->isValid() == true); + + if (signalWlanNetworkClosed_ != NULL) { + delete signalWlanNetworkClosed_; + } + signalWlanNetworkClosed_ = new QSignalSpy(wlanQtUtils_, SIGNAL(wlanNetworkClosed(int))); + QVERIFY(signalWlanNetworkClosed_->isValid() == true); + + // Let first active objects to run. First WLAN scan is done in engine contructor. + subTestSignalWaitAndTake(signalScanReady_, NULL); +} + +// Create main function using QTest marco. +QTEST_MAIN(TestWlanQtUtils) diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/ut/t_wlanqtutils/testwlanqtutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/ut/t_wlanqtutils/testwlanqtutils.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is the header file for testing Wlan Qt Utilities library. +*/ + +#ifndef TESTWLANQTUTILS_H_ +#define TESTWLANQTUTILS_H_ + +#include + +class QSignalSpy; +class WlanQtUtils; + +class TestWlanQtUtils: public QObject +{ + Q_OBJECT + +private slots: + + // Functions from QTest framework. + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + + // Test functions for public interface. + void testAvailableWlanAps(); + void testAvailableWlanApsWithIaps(); + void testAvailableWlanApsSequence(); + + void testCreateWlanIapOk(); + + void testConnectIapOk(); + void testConnectIapErr(); + + void testDisconnectIapOk(); + + void testIapFound(); + void testIapNotFound(); + + void testConnectedWlanIdFound(); + void testConnectedWlanIdFoundConstructor(); + void testConnectedWlanIdNotFound(); + + void testScanWlans(); + + void testWlanNetworkOpened(); + void testWlanNetworkClosed(); + + // Test functions for private implementation (tested via public interface) + void testConnectionTestPass(); + void testConnectionTestFail(); + +private: + + // Helper functions, that is, sub test cases. + void subTestSignalWaitAndTake(QSignalSpy *spy, QList *arguments); + void subTestLoadCommsDatFile(QString newCommsdatFilename); + void subTestNewWlanQtUtils(); + + // Member variables. + WlanQtUtils *wlanQtUtils_; + QSignalSpy *signalScanReady_; + QSignalSpy *signalWlanNetworkOpened_; + QSignalSpy *signalWlanNetworkClosed_; + + /* Default CommsDat file name + SNAP ID=3: Internet: + IAP ID = 1: packet data 1 + IAP ID = 3: packet data 2 + IAP ID = 4: packet data 3 + IAP ID = 5: WLAN IAP 1, EWlanSecModeOpen + IAP ID = 6: WLAN IAP 2, EWlanSecModeWep, w2key + IAP ID = 7: WLAN IAP 3, EWlanSecModeWpa, wlan3key + SNAP ID = 4: Multimedia msg. + SNAP ID = 5: WAP services + SNAP ID = 6: My Snap: + IAP ID = 8: Home WLAN, EWlanSecModeOpen + IAP ID = 9: Streaming + */ + static const QString commsDatDefault_; +}; + +#endif /* TESTWLANQTUTILS_H_ */ + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/wlanqtutilities.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wlanqtutilities.pro Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,92 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = wlanqtutilities +TARGET.CAPABILITY = ALL -TCB + +#BUILD_DLL macro is used to define export macro +DEFINES += BUILD_WLANQTUTILITIES_DLL +DEPENDPATH += . + +#Store generated .moc files to their own directory +MOC_DIR = moc + +#Following macros MW_LAYER_SYSTEMINCLUDE and OS_LAYER_SYSTEMINCLUDE are defined +#in X:\QT\mkspecs\features\symbian\platform_paths.prf that is always inluded in +#QT compilation + +INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \ + $$OS_LAYER_SYSTEMINCLUDE \ + base/inc \ + wrapper/inc \ + traces + +HEADERS += base/inc/wlanqtutils.h \ + base/inc/wlanqtutils_p.h \ + base/inc/wlanqtutilsactiveconn.h \ + base/inc/wlanqtutilscommon.h \ + base/inc/wlanqtutilswlanap.h \ + base/inc/wlanqtutilswlaniap.h \ + base/inc/wlanqtutilsiap.h \ + wrapper/inc/wlanqtutilsconmonwrapper.h \ + wrapper/inc/wlanqtutilscmmwrapper.h \ + wrapper/inc/wlanqtutilsconntestwrapper.h \ + wrapper/inc/wlanqtutilsesockwrapper.h \ + traces/OstTraceDefinitions.h + +SOURCES += base/src/wlanqtutils.cpp \ + base/src/wlanqtutils_p.cpp \ + base/src/wlanqtutilsactiveconn.cpp \ + base/src/wlanqtutilswlanap.cpp \ + base/src/wlanqtutilswlaniap.cpp \ + base/src/wlanqtutilsiap.cpp \ + wrapper/src/wlanqtutilsconmonwrapper.cpp \ + wrapper/src/wlanqtutilscmmwrapper.cpp \ + wrapper/src/wlanqtutilsconntestwrapper.cpp \ + wrapper/src/wlanqtutilsesockwrapper.cpp + +mmpRuleDeffile = \ + "$${LITERAL_HASH}ifdef WINSCW" \ + "DEFFILE ./bwins/wlanqtutilities.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ./eabi/wlanqtutilities.def" \ + "$${LITERAL_HASH}endif" + +symbian: { + HEADERS += wrapper/inc/wlanqtutilsconmonwrapper_s60_p.h \ + wrapper/inc/wlanqtutilscmmwrapper_s60_p.h \ + wrapper/inc/wlanqtutilsconntestwrapper_s60_p.h \ + wrapper/inc/wlanqtutilsesockwrapper_s60_p.h + SOURCES += wrapper/src/wlanqtutilsconmonwrapper_s60.cpp \ + wrapper/src/wlanqtutilscmmwrapper_s60.cpp \ + wrapper/src/wlanqtutilsconntestwrapper_s60.cpp \ + wrapper/src/wlanqtutilsesockwrapper_s60.cpp \ + ut/stubs/wlanqtutilsconnmonstub.cpp \ + ut/stubs/wlanqtutilsesockstub.cpp + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.UID3 = 0x20029F52 + SYMBIAN_PLATFORMS = WINSCW ARMV5 + MMP_RULES += mmpRuleDeffile + BLD_INF_RULES.prj_exports += "rom/wlanqtutilities.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wlanqtutilities.iby)" + BLD_INF_RULES.prj_exports += "base/inc/wlanqtutils.h |../inc/wlanqtutils.h" \ + "base/inc/wlanqtutilscommon.h |../inc/wlanqtutilscommon.h" \ + "base/inc/wlanqtutilswlanap.h |../inc/wlanqtutilswlanap.h" \ + "base/inc/wlanqtutilsiap.h |../inc/wlanqtutilsiap.h" \ + "base/inc/wlanqtutilswlaniap.h |../inc/wlanqtutilswlaniap.h" +} + +symbian*::LIBS += -lconnmon -lcmmanager -lesock -lcommdb -lictsclientinterface \ No newline at end of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilscmmwrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilscmmwrapper.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +*/ + +#ifndef WLANQTUTILSCMMWRAPPER_H_ +#define WLANQTUTILSCMMWRAPPER_H_ + +// INCLUDES +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +// FORWARD DECLARATIONS +class CmmWrapperPrivate; +class WlanQtUtilsIap; +class WlanQtUtilsWlanIap; +class WlanQtUtilsWlanAp; + +// CLASS DECLARATION + +/** + * CmmWrapper class. + */ +class CmmWrapper : public QObject +{ +Q_OBJECT + +public: // Constructor and destructor + + /** + * Default constructor + */ + CmmWrapper( QObject *parent = 0 ); + + /** + * Destructor + */ + ~CmmWrapper(); + +public: + + /** + * Fetch all IAPs + * + * @param[in/out] iapList List of IAPs + */ + int fetchIaps( QList& iapList ); + + /** + * Create a new WLAN IAP as uncategorized + * + * @param[in] wlanAp Information about the WLAN AP + * @return New IAP class + */ + WlanQtUtilsWlanIap *createWlanIap(const WlanQtUtilsWlanAp *wlanAp); + + /** + * Move IAP to the Internet SNAP + * + * @param[in] iapId Which IAP to move + * @param[in] snapId Where to move it + */ + void moveIapToInternetSnap(int iapId); + +private: // Data + + /** + * d_ptr pointer to CmmWrapperPrivate + * Owned by CmmWrapper object, instantiated in + * constructor. + */ + CmmWrapperPrivate *d_ptr; +}; + +QT_END_HEADER + +QT_END_NAMESPACE + +#endif /* WLANQTUTILSCMMWRAPPER_H_ */ + +// End of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilscmmwrapper_s60_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilscmmwrapper_s60_p.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#ifndef WLANQTUTILSCMMWRAPPER_S60_P_H_ +#define WLANQTUTILSCMMWRAPPER_S60_P_H_ + +// INCLUDES +#include +#include "wlanqtutilscommon.h" + +QT_BEGIN_NAMESPACE + +//definitions taken from cmpluginwlandef.h and cmpluginpacketdatadef.h +const TUint KUidPacketDataBearerType = 0x10207378; + +class WlanQtUtilsIap; +class WlanQtUtilsWlanIap; + +// CLASS DECLARATION + +/** + * CmmWrapperPrivate class. + */ +class CmmWrapperPrivate + { + +public: + + /** + * Default constructor + */ + CmmWrapperPrivate(CmmWrapper *wrapper); + + /** + * Destructor + */ + ~CmmWrapperPrivate(); + +public: + // New functions + + /** + * Fetches IAPs from CMM + * + * @iapList, list of IAPs + * @return error code + */ + int fetchIaps(QList &iapList); + + /** + * Creates a new WLAN IAP through CMM + * + * @aWlanAp WLAN parameters to store in IAP + * @return Created IAP, NULL in error cases + */ + WlanQtUtilsWlanIap *createWlanIap(const WlanQtUtilsWlanAp *aWlanAp); + + /** + * Move IAP to the Internet SNAP + * + * @param[in] iapId Which IAP to move + */ + void moveIapToInternetSnap(TInt32 aIapId); + +private: + + /** + * Fetches IAPs from CMM, leaves in error cases + * + * @iapList, list of IAPs + */ + void fetchIapsL(QList &iapList); + + /** + * Creates a new WLAN IAP through CMM, leaves in error cases + * + * @aWlanAp WLAN parameters to store in IAP + * @return Created IAP + */ + WlanQtUtilsWlanIap *createWlanIapL(const WlanQtUtilsWlanAp *aWlanAp); + + /** + * Move IAP to the Internet SNAP, leaves in error cases + * + * @param[in] iapId Which IAP to move + */ + void moveIapToInternetSnapL(TInt32 aIapId); + + /** + * Fetches IAPs of the given SNAP from CMM + * + * @param[in] aSnapId ID of the SNAP whose IAPS are requested + * @param[out] aSnapsIapList Where to store IAPs + * @return Error code + */ + int getIapListFromSnap( + TUint32 aSnapId, + QList& aSnapsIapList); + + /** + * Fetches IAP information of the given ConnectionMethod from CMM + * + * @param[in] aConnectionMethod Where to read info + * @return Created IAP + */ + WlanQtUtilsIap *getIapInfoL( + RCmConnectionMethodExt aConnectionMethod); + + /** + * Maps CMManager's WLAN security mode into WlanQtUtilsWlanSecMode. + * + * @aSecModeFromCmManager security mode read from CMManager + * @return: Mapped security mode to be used in Wlan Qt Utilities. + */ + WlanQtUtilsWlanSecMode cmm2WlanQtUtilsSecModeMap(int aSecModeFromCmManager); + + /** + * Maps WlanQtUtilsWlanSecMode into CMManager's WLAN security mode. + * + * @aWlanQtUtilsSecMode: Wlan Qt Utilities' WLAN security mode + * @return: Mapped CMManager's WLAN security mode. + */ + int wlanQtUtils2CmmSecModeMap(WlanQtUtilsWlanSecMode aWlanQtUtilsSecMode); + +private: + // Data + + /** + * q_ptr pointer to CmmWrapper + * Owned by CmmWrapperPrivate object, instantiated in + * constructor. + */ + CmmWrapper *q_ptr; + + RCmManagerExt iCmManagerExt; + + }; + +QT_END_NAMESPACE + +#endif /* WLANQTUTILSCMMWRAPPER_S60_P_H_ */ + +// End of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconmonwrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconmonwrapper.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,184 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef WLANQTUTILSCONMONWRAPPER_H +#define WLANQTUTILSCONMONWRAPPER_H + +// INCLUDES +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +#include "wlanqtutilscommon.h" + +// FORWARD DECLARATIONS +class WlanQtUtilsWlanAp; +class WlanQtUtilsActiveConn; +class ConnMonScanWlanAps; +class ConnMonConnInfo; +class ConnMonConnDisconnect; + +// CLASS DECLARATION + +/** +* ConMonWrapper class. +*/ +class ConMonWrapper : public QObject +{ + Q_OBJECT + +public: + + /** + * Constructor. + */ + ConMonWrapper(QObject *parent = 0); + + /** + * Destructor. + */ + ~ConMonWrapper(); + + /** + * Requests wlan scanning + * + * @return ???. + */ + int scanAvailableWlanAPs(); + + /** + * Emits available WLANs to engine. + * + * @param[in] availableWlanAPs Available WLAN access points found in scan. + */ + void emitAvailableWlans(QList &availableWlanAPs); + + /** + * Emits signal indicating that a new connection has been created. + * + * @param[in] connectionId Connection ID. + */ + void emitConnCreatedEvent(uint connectionId); + + /** + * Emits signal indicating that a connection has been deleted. + * + * @param[in] connectionId Connection ID. + */ + void emitConnDeletedEvent(uint connectionId); + + /** + * Emits signal indicating that status of a connection has changed. + * + * @param[in] connectionId Connection ID. + * @param[in] connectionStatus Connection status. + */ + void emitConnStatusEvent(uint connectionId, WlanQtUtilsConnectionStatus connectionStatus); + + /** + * Return active connection information. + * + * @return Information of active connection, if one exists. + */ + WlanQtUtilsActiveConn *activeConnection(); + + /** + * Returns information of a connection with the given connection ID. + * + * @param[in] connectionId Connection ID. + * @return Information of the given connection, if one exists. + */ + WlanQtUtilsActiveConn *connectionInfo(uint connectionId); + + /** + * Stops given connection regardless of how many applications are using it. + * + * @param[in] iapId IAP ID to disconnect. + */ + void disconnectIap(int iapId); + +signals: + + /** + * Signal indicating available WLAN access points. + * + * @param[in] availableWlans Available WLAN access points found in scan. + */ + void availableWlanApsFromWrapper(QList &availableWlans); + + /** + * Signal indicating that a new connection has been created. + * + * @param[in] connectionId Connection ID. + */ + void connCreatedEventFromWrapper(uint connectionId); + + /** + * Signal indicating that a connection has been deleted. + * + * @param[in] connectionId Connection ID. + */ + void connDeletedEventFromWrapper(uint connectionId); + + /** + * Signal indicating that status of a connection has changed. + * + * @param[in] connectionId Connection ID. + * @param[in] connectionStatus Connection status. + */ + void connStatusEventFromWrapper(uint connectionId, WlanQtUtilsConnectionStatus connectionStatus); + +private: // Data + + /** + * d_ptrScanWlans pointer to ConMonWrapperPrivate + * Owned by ConMonWrapper object, instantiated in + * constructor. + */ + ConnMonScanWlanAps *d_ptrScanWlans; + + /** + * d_ptrConnInfo pointer to ConMonWrapperPrivate + * Owned by ConMonWrapper object, instantiated in + * constructor. + */ + ConnMonConnInfo *d_ptrConnInfo; + + /** + * d_ptrConnDisconnect pointer to ConMonWrapperPrivate + * Owned by ConMonWrapper object, instantiated in + * constructor. + */ + ConnMonConnDisconnect *d_ptrConnDisconnect; + +private: // Friend classes + // TestWlanQtUtils is defined as a friend class in order to be able to + // call event handlers of wrappers. + friend class TestWlanQtUtils; +}; + +QT_END_HEADER + +QT_END_NAMESPACE + +#endif /* WLANQTUTILSCONMONWRAPPER_H */ + +// End of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconmonwrapper_s60_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconmonwrapper_s60_p.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,291 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * This is a header file for following classes: + * ConnMonScanWlanAps. + */ + +#ifndef WLANQTUTILSCONMONWRAPPER_S60_P_H_ +#define WLANQTUTILSCONMONWRAPPER_S60_P_H_ + +// INCLUDES +#include +#include +#include "wlanqtutilscommon.h" + +class ConMonWrapper; + +QT_BEGIN_NAMESPACE + +// CLASS DECLARATION + +/** + * ConnMonScanWlanAps class. + */ +class ConnMonScanWlanAps : public CActive + { + +public: + // Constructor and destructor + + /** + * Default constructor + */ + ConnMonScanWlanAps(ConMonWrapper *wrapper); + + /** + * Destructor + */ + ~ConnMonScanWlanAps(); + +public: + // New functions + + /** + * scanAvailableWlanAPs + * scans all available WLAN APs + * @return error code + */ + int scanAvailableWlanAPs(); + +private: + // From CActive + + /** + * Implements cancellation of an outstanding request. + */ + void DoCancel(); + + /** + * Handles an active object's request completion event. + */ + void RunL(); + + /** + * conMon2WlanQtUtilsSecModeMap + * Maps Connection monitor's WLAN security mode value into WlanQtUtilsWlanSecMode. + * @aSecMode: security mode, ConnMon style, + * @return: security mode, Wlan Qt Utilities style. + */ + WlanQtUtilsWlanSecMode conMon2WlanQtUtilsSecModeMap(TUint aSecMode); + +private: + // Data + + /** + * q_ptr pointer to ConMonWrapper + * Owned by ConnMonScanWlanAps object, instantiated in + * constructor. + */ + ConMonWrapper *q_ptr; + + /** + * Handle to Connection Monitor Server + */ + RConnectionMonitor iMonitor; + + /** + * Scan package used with Connection Monitor Server scan request + * Owned by ConnMonScanWlanAps object. + */ + CConnMonWlanNetworksPtrArrayPckg* wlanBuf; + + /** + * wlan pointer variable used with Connection Monitor Server scan request + */ + TPtr wlanPtr; + }; + +// CLASS DECLARATION + +/** + * ConnMonConnInfo class. + */ +class ConnMonConnInfo : public MConnectionMonitorObserver + { +public: + // Constructor and destructor + + /** + * Default constructor + */ + ConnMonConnInfo(ConMonWrapper *wrapper); + + /** + * Destructor + */ + ~ConnMonConnInfo(); + +public: + // New functions + + /** + * Return active connection information. + * + * @return Information of active connection, if one exists. + */ + WlanQtUtilsActiveConn *activeConnection(); + + /** + * Returns information of a connection with the given connection ID. + * + * @param[in] connectionId Connection ID. + * @return Information of the given connection, if one exists. + */ + WlanQtUtilsActiveConn *connectionInfo(uint connectionId); + + /** + * Updates information of a given active connection. Missing information will be filled in + * and information that is dynamic in nature will be updated. + * + * @param[in] activeConn Current data of an active connection which will be updated. + * Connection ID and bearer type have to be valid. + */ + void activeConnInfoUpdate( WlanQtUtilsActiveConn *activeConn ); + +private: + // New private functions + + /** + * Starts monitoring observer events + */ + void StartMonitoringL(); + + /** + * Stops monitoring observer events + */ + void StopMonitoring(); + + /** + * Event method is called every time an event occures + */ + void EventL(const CConnMonEventBase& aConnMonEvent); + + /** + * Maps Connection Monitor's WLAN connection mode value into + * WlanQtUtilsWlanConnMode. + * + * @param aConnMode Connection mode in Connection Monitor's style. + * @return Connection mode in Wlan Qt Utilities style. + */ + static WlanQtUtilsWlanConnMode connMon2WlanQtUtilsConnModeMap(TInt aConnMode); + + /** + * Maps Connection Monitor's connection status value into WlanQtUtilsConnectionStatus. + * + * @param aConnectionStatus Connection status as used by Connection Monitor server. + * These status are defined in nifvar.h. + * @return Connection status in Wlan Qt Utilities style. + */ + static WlanQtUtilsConnectionStatus connMon2WlanQtUtilsConnectionStatusMap(TInt aConnectionStatus); + + /** + * Maps Connection Monitor's bearer type value into WlanQtUtilsBearerType. + * + * @param aBearerType Bearer type as used by Connection Monitor server. + * @return Bearer type in Wlan Qt Utilities style. + */ + static WlanQtUtilsBearerType connMon2WlanQtUtilsBearerTypeMap(TInt aBearerType); + +private: + // Data + + /** + * q_ptr pointer to ConMonWrapper + * Owned by ConMonWrapperPrivate object, instantiated in + * constructor. + */ + ConMonWrapper *q_ptr; + + /** Handle to Connection Monitor Server. */ + RConnectionMonitor iMonitor; + + /** Request status. */ + TRequestStatus iStatus; + + /** Indicates whether connection monitoring is ON. */ + TBool iMonitoring; + +private: // Friend classes + + // TestWlanQtUtils is defined as a friend class in order to be able to + // call event handlers of wrappers. + friend class TestWlanQtUtils; + }; + +// CLASS DECLARATION + +/** + * ConnMonConnDisconnect class. + */ +class ConnMonConnDisconnect : public CActive + { + +public: + // Constructor and destructor + + /** + * Default constructor + */ + ConnMonConnDisconnect(ConMonWrapper *wrapper); + + /** + * Destructor + */ + ~ConnMonConnDisconnect(); + +public: + // New functions + + /** + * disconnectConnection + * Stop connection + */ + void disconnectConnection(int iapId); + +private: + // From CActive + + /** + * Implements cancellation of an outstanding request. + */ + void DoCancel(); + + /** + * Handles an active object's request completion event. + */ + void RunL(); + +private: + // Data + + /** + * q_ptr pointer to ConMonWrapper + * Owned by ConMonWrapperPrivate object, instantiated in + * constructor. + */ + ConMonWrapper *q_ptr; + + /** + * Handle to Connection Monitor Server + */ + RConnectionMonitor iMonitor; + }; + +QT_END_NAMESPACE + +#endif /* WLANQTUTILSCONMONWRAPPER_S60_P_H_ */ + +// End of file + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconntestwrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconntestwrapper.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef WLANQTUTILSCONNTESTWRAPPER_H_ +#define WLANQTUTILSCONNTESTWRAPPER_H_ + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class ConnTestWrapperPrivate; + +/** +* ConnTestWrapper class. +*/ +class ConnTestWrapper: public QObject +{ + Q_OBJECT + + // TestWlanQtUtils is defined as a friend class in order to be able to + // call event handlers of wrappers. + friend class TestWlanQtUtils; + +public: // Constructor and destructor + + /** + * Default constructor + */ + ConnTestWrapper(QObject *parent = 0); + + /** + * Destructor + */ + ~ConnTestWrapper(); + +public: + + /** + * Called by private wrapper when connectivity test is ready. + * + * @param[in] result Result of internet connectivity test + */ + void connectivityTestDone(bool result); + +public slots: + + /** + * Starts internet connectivity test. + * + * @param[in] iapId iap id + * @param[in] netId network id + */ + void startConnectivityTest(int iapId, int netId); + +signals: + + /** + * Signal for emitting connectivity test result. + * + * @param[in] result Result of internet connectivity test + */ + void connectivityTestResult(bool result); + +private: + + /** + * d_ptr pointer to ConnTestWrapperPrivate + * Owned by ConnTestWrapper object, instantiated in constructor. + */ + ConnTestWrapperPrivate *d_ptr_; +}; + +QT_END_HEADER + +QT_END_NAMESPACE + +#endif /* WLANQTUTILSCONNTESTWRAPPER_H_ */ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconntestwrapper_s60_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsconntestwrapper_s60_p.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef WLANQTUTILSCONNTESTWRAPPER_S60_P_H_ +#define WLANQTUTILSCONNTESTWRAPPER_S60_P_H_ + +#include + +QT_BEGIN_NAMESPACE + +/** +* ConnTestWrapperPrivate class. +*/ +class ConnTestWrapperPrivate: public MIctsObserver +{ + + // TestWlanQtUtils is defined as a friend class in order to be able to + // call event handlers of wrappers. + friend class TestWlanQtUtils; + +public: + + /** + * Default constructor + */ + ConnTestWrapperPrivate(ConnTestWrapper *aWrapper); + + /** + * Destructor + */ + ~ConnTestWrapperPrivate(); + +public: // From MICTSObserver + + /** + * Called when internet connectivity tests are being done. + * + * @param[in] aResult Result of connectivity test + * @param[in] aString String containing possible HTML response + */ + void ConnectivityObserver( TIctsTestResult aResult, const TDesC& aString ); + +public: + + /** + * Starts internet connectivity test wrapped. + * + * @param[in] iapId iap id + * @param[in] netId network id + */ + void startConnectivityTest( int aIapId, int aNetId ); + + /** + * Starts the actual internet connectivity test. + * + * @param[in] iapId iap id + * @param[in] netId network id + */ + void startConnectivityTestL( TInt aIapId, TInt aNetId ); + +private: + + /** + * Pointer to ConnTestWrapper + * Owned by ConnTestWrapperPrivate object, instantiated in constructor. + */ + ConnTestWrapper *q_ptr; + + /** + * Pointer to Internet Connectivity Test Service + * Owned by ConnTestWrapperPrivate. + */ + CIctsClientInterface* iIct; + +}; + +QT_END_NAMESPACE + +#endif /* WLANQTUTILSCONNTESTWRAPPER_S60_P_H_ */ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsesockwrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsesockwrapper.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is a header file for EsockWrapper class. +*/ + +#ifndef ESOCKWRAPPER_H_ +#define ESOCKWRAPPER_H_ + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class EsockWrapperPrivate; + +/** + * Wrapper for connection handling. + */ +class EsockWrapper: public QObject +{ + Q_OBJECT + +public: + + /** + * Default constructor + */ + EsockWrapper(QObject *parent = 0); + + /** + * Destructor. + */ + ~EsockWrapper(); + +public: + + /** + * + */ + void updateConnection(bool isOpened); + +public slots: + + /** + * Starts connection creation to given IAP. + * + * @param[in] iapId IAP ID. + */ + void connectIap(int iapId); + + /** + * Disconnects connection. + */ + void disconnectIap(); + +signals: + + void connectionStatusFromWrapper(bool isOpened); + +private: // Data + + /** Private esock wrapper. */ + EsockWrapperPrivate *d_ptr; +}; + +QT_END_HEADER + +QT_END_NAMESPACE + +#endif /*ESOCKWRAPPER_H_*/ + +// End of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsesockwrapper_s60_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsesockwrapper_s60_p.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef ESOCKWRAPPER_S60_P_H_ +#define ESOCKWRAPPER_S60_P_H_ + +// INCLUDES +#include + +QT_BEGIN_NAMESPACE + +// CLASS DECLARATION + +/** +* EsockWrapperPrivate class. +*/ +class EsockWrapperPrivate: public CActive +{ + +public: // Constructor and destructor + + /** + * Default constructor + */ + EsockWrapperPrivate(EsockWrapper *aWrapper); + + /** + * Destructor + */ + ~EsockWrapperPrivate(); + +public: // New functions + + /** + * connectIap + * Starts connection creation. + */ + void connectIap(int aIapId); + + /** + * dsiconnectIap + * Stops connection. + */ + void disconnectIap(); + +private: // Functions from base class + + /** + * RunL + * Called when the scheduled function ends. + */ + void RunL(); + + /** + * DoCancel + * Cancels operations. + */ + void DoCancel(); + +private: // Data + + /** + * q_ptr pointer to ConnectionWrapper + * Owned by ConnectionWrapperPrivate object, instantiated in + * constructor. + */ + EsockWrapper *q_ptr; + + RSocketServ iSocketServer; + RConnection iConnection; +}; + +QT_END_NAMESPACE + +#endif /*ESOCKWRAPPER_S60_P_H_*/ + +// End of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilscmmwrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilscmmwrapper.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is a source file for CmmWrapper class. +*/ + +// INCLUDE FILES +#include "wlanqtutilscmmwrapper.h" +#include "wlanqtutilscmmwrapper_s60_p.h" +#include "wlanqtutilsiap.h" +#include "wlanqtutilswlaniap.h" +#include "wlanqtutilswlanap.h" + +// ================= MEMBER FUNCTIONS ======================= +// + +CmmWrapper::CmmWrapper( QObject *parent ) : + QObject( parent ) +{ + d_ptr = new CmmWrapperPrivate( this ); +} + +CmmWrapper::~CmmWrapper() +{ + delete d_ptr; +} + +int CmmWrapper::fetchIaps( QList& iapList ) +{ + int error = d_ptr->fetchIaps( iapList ); + return error; +} + +WlanQtUtilsWlanIap *CmmWrapper::createWlanIap( const WlanQtUtilsWlanAp *wlanAp ) +{ + return d_ptr->createWlanIap( wlanAp ); +} + +void CmmWrapper::moveIapToInternetSnap( int iapId ) +{ + return d_ptr->moveIapToInternetSnap( iapId ); +} + +//end of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilscmmwrapper_s60.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilscmmwrapper_s60.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,388 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * This is a source file for CmmWrapperPrivate class. + */ + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include "wlanqtutilscommon.h" +#include "wlanqtutilsiap.h" +#include "wlanqtutilswlanap.h" +#include "wlanqtutilswlaniap.h" +#include "wlanqtutilscmmwrapper.h" +#include "wlanqtutilscmmwrapper_s60_p.h" + +#ifdef WLANQTUTILS_NO_OST_TRACES_FLAG +#include +#else +#include "OstTraceDefinitions.h" +#endif +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanqtutilscmmwrapper_s60Traces.h" +#endif + + +// =========== PRIVATE CLASS MEMBER FUNCTIONS =============== +// +// --------------------------------------------------------- +// CmmWrapperPrivate::CmmWrapperPrivate() +// Constructor +// --------------------------------------------------------- +// +CmmWrapperPrivate::CmmWrapperPrivate(CmmWrapper *wrapper) : + q_ptr(wrapper) + { + OstTraceFunctionEntry1( CMMWRAPPERPRIVATE_CMMWRAPPERPRIVATE_ENTRY, this ); + + TRAPD(err, iCmManagerExt.OpenL()); + if (err != KErrNone) { + // todo + } + + OstTraceFunctionExit1( CMMWRAPPERPRIVATE_CMMWRAPPERPRIVATE_EXIT, this ); + } + +// --------------------------------------------------------- +// CmmWrapperPrivate::CmmWrapperPrivate() +// Destructor +// --------------------------------------------------------- +// +CmmWrapperPrivate::~CmmWrapperPrivate() + { + OstTraceFunctionEntry1( CMMWRAPPERPRIVATE_CMMWRAPPERPRIVATEDESTR_ENTRY, this ); + + iCmManagerExt.Close(); + + OstTraceFunctionExit1( CMMWRAPPERPRIVATE_CMMWRAPPERPRIVATEDESTR_EXIT, this ); + } + +// --------------------------------------------------------- +// CmmWrapperPrivate::fetchIaps() +// --------------------------------------------------------- +// +int CmmWrapperPrivate::fetchIaps(QList& iapList) + { + TRAPD(err, fetchIapsL(iapList)); + return err; + } + +// --------------------------------------------------------- +// CmmWrapperPrivate::fetchIapsL() +// --------------------------------------------------------- +// +void CmmWrapperPrivate::fetchIapsL(QList& iapList) + { + OstTraceFunctionEntry1( CMMWRAPPERPRIVATE_FETCHIAPSL_ENTRY, this ); + + // reset the list, just in case + iapList.clear(); + + //Array granularity 10 + RArray destinationIdArray = RArray (10); + + destinationIdArray.Reset(); + iCmManagerExt.AllDestinationsL(destinationIdArray); + + // looping all the SNAPs through + QList snapsIapList; + for (TInt i = 0; i < destinationIdArray.Count(); i++) + { + snapsIapList.clear(); + RCmDestinationExt dest; + dest = iCmManagerExt.DestinationL(destinationIdArray[i]); + TUint32 id = dest.Id(); + + if (getIapListFromSnap(id, snapsIapList) == KErrNone) + { + iapList.append(snapsIapList); + } + } + + OstTraceFunctionExit1( CMMWRAPPERPRIVATE_FETCHIAPSL_EXIT, this ); + } + +// --------------------------------------------------------- +// CmmWrapperPrivate::createWlanIap() +// Creates a new WLAN IAP +// --------------------------------------------------------- +// +WlanQtUtilsWlanIap *CmmWrapperPrivate::createWlanIap(const WlanQtUtilsWlanAp *aWlanAp) + { + WlanQtUtilsWlanIap *iap = NULL; + + TRAPD(err, iap = createWlanIapL(aWlanAp)); + + if (err != KErrNone) + { + // Todo: trace + } + return iap; + } + +// --------------------------------------------------------- +// CmmWrapperPrivate::createWlanIapL() +// Creates a new WLAN IAP +// --------------------------------------------------------- +// +WlanQtUtilsWlanIap *CmmWrapperPrivate::createWlanIapL(const WlanQtUtilsWlanAp *aWlanAp) + { + OstTraceFunctionEntry1( CMMWRAPPERPRIVATE_CREATEWLANIAPL_ENTRY, this ); + + // Create the new IAP + RCmConnectionMethodExt plugin = iCmManagerExt.CreateConnectionMethodL( + KUidWlanBearerType); + CleanupClosePushL(plugin); + + // Convert QString to Symbian buffer + TBufC buffer(aWlanAp->ssid().utf16()); + + WlanQtUtilsWlanSecMode secMode = aWlanAp->securityMode(); + int cmManagersSecMode = wlanQtUtils2CmmSecModeMap(secMode); + + plugin.SetStringAttributeL(CMManager::ECmName, buffer); + plugin.SetStringAttributeL(CMManager::EWlanSSID, buffer); + plugin.SetIntAttributeL(CMManager::EWlanSecurityMode, cmManagersSecMode); + // Todo: other parameters such as security keys +#if 0 + // TODO the security settings API plugin needs to be initialized here + // with the iap id. + // Check if the key value has been given + QString key = aWlanAp->securityKey(); + if ( key.length() > 0 ) + { + // Set the security key values here + if ( secMode == CMManager::EWlanSecModeWpa || + secMode == CMManager::EWlanSecModeWpa2 ) + { + // Store the WPA key to the database using the security settings API + TBufC bufKey(key.utf16()); + plugin.SetStringAttributeL( CMManager::EWlanWpaPreSharedKey, bufKey ); + + } + else if ( secMode == CMManager::EWlanSecModeWep ) + { + // Store the WPA key to the database using the security settings API + TBufC bufKey(key.utf16()); + plugin.SetStringAttributeL( CMManager::EWlanWepKey1, bufKey ); + } + } +#endif + + plugin.UpdateL(); + + TInt iapId = plugin.GetIntAttributeL(CMManager::ECmIapId); + + CleanupStack::PopAndDestroy(&plugin); // Close() called on "plugin" + + // Read details of the new IAP and create the WLAN IAP class + RCmConnectionMethodExt connectionMethod = iCmManagerExt.ConnectionMethodL( iapId ); + WlanQtUtilsIap *newIap = getIapInfoL(connectionMethod); + + OstTraceFunctionExit1( CMMWRAPPERPRIVATE_CREATEWLANIAPL_EXIT, this ); + return qobject_cast(newIap); + } + +// --------------------------------------------------------- +// CmmWrapperPrivate::moveIapToInternetSnap() +// --------------------------------------------------------- +// +void CmmWrapperPrivate::moveIapToInternetSnap( TInt32 aIapId ) + { + TRAPD( err, moveIapToInternetSnapL( aIapId ) ); + if (err != KErrNone) + { + // todo: add trace + } + } + +// --------------------------------------------------------- +// CmmWrapperPrivate::moveIapToInternetSnapL() +// --------------------------------------------------------- +// +void CmmWrapperPrivate::moveIapToInternetSnapL( TInt32 aIapId ) + { + OstTraceFunctionEntry1( CMMWRAPPERPRIVATE_MOVEIAPTOINTERNETSNAPL_ENTRY, this ); + + // Read all destination(SNAP) settings into an array + RArray destinations; + CleanupClosePushL(destinations); + iCmManagerExt.AllDestinationsL(destinations); + RCmDestinationExt destination; + // Loop through each destination + for(TInt i = 0; i < destinations.Count(); i++) + { + destination = iCmManagerExt.DestinationL(destinations[i]); + CleanupClosePushL(destination); + // Internet destination will always exist in the system. + // Internet destination will have ESnapPurposeInternet set in its metadata. + if (destination.MetadataL(CMManager::ESnapMetadataPurpose) == CMManager::ESnapPurposeInternet) + { + RCmConnectionMethodExt iap = iCmManagerExt.ConnectionMethodL( aIapId ); + CleanupClosePushL( iap ); + destination.AddConnectionMethodL( iap ); + destination.UpdateL(); + CleanupStack::PopAndDestroy(); // iap + } + CleanupStack::PopAndDestroy(); // destination + } + CleanupStack::PopAndDestroy(); // destinations + + OstTraceFunctionExit1( CMMWRAPPERPRIVATE_MOVEIAPTOINTERNETSNAPL_EXIT, this ); + } + +// --------------------------------------------------------- +// CmmWrapperPrivate::getIapListFromSnap() +// --------------------------------------------------------- +// +int CmmWrapperPrivate::getIapListFromSnap(TUint32 aDestId, + QList& iapList) + { + OstTraceFunctionEntry1( CMMWRAPPERPRIVATE_GETIAPLISTFROMSNAP_ENTRY, this ); + + RCmDestinationExt dest; + TRAPD(err, dest = iCmManagerExt.DestinationL(aDestId)); + if (err != KErrNone) + { + OstTraceFunctionExit1( CMMWRAPPERPRIVATE_GETIAPLISTFROMSNAP_EXIT, this ); + return err; + } + + // Copy IAPs from the SNAP into iapList. + int destIapCount = dest.ConnectionMethodCount(); + for (TInt i = 0; i < destIapCount; i++) + { + WlanQtUtilsIap* iap = NULL; + TRAP(err, iap = getIapInfoL(dest.ConnectionMethodL(i))); + + if (err == KErrNone) + { + iapList.append(iap); + } + } + + OstTraceFunctionExit1( DUP1_CMMWRAPPERPRIVATE_GETIAPLISTFROMSNAP_EXIT, this ); + return err; + } + +// --------------------------------------------------------- +// CmmWrapperPrivate::getIapInfoL() +// --------------------------------------------------------- +// +WlanQtUtilsIap *CmmWrapperPrivate::getIapInfoL( + RCmConnectionMethodExt aConnectionMethod) + { + OstTraceFunctionEntry1( CMMWRAPPERPRIVATE_GETIAPINFOL_ENTRY, this ); + + TUint iapId = aConnectionMethod.GetIntAttributeL(CMManager::ECmIapId); + + TUint netId = aConnectionMethod.GetIntAttributeL(CMManager::ECmNetworkId); + + HBufC* iapName = aConnectionMethod.GetStringAttributeL(CMManager::ECmName); + + TUint iapBearerType = aConnectionMethod.GetIntAttributeL(CMManager::ECmBearerType); + + QString name = QString::fromUtf16(iapName->Ptr(), iapName->Length()); + WlanQtUtilsBearerType bearer; + + WlanQtUtilsIap* newIap = NULL; + if (iapBearerType == KUidPacketDataBearerType) + { + bearer = WlanQtUtilsBearerTypeCellular; + newIap = new WlanQtUtilsIap(iapId, netId, name, bearer); + } + else + { + TInt secModeFromCmManager = + aConnectionMethod.GetIntAttributeL(CMManager::EWlanSecurityMode); + WlanQtUtilsWlanSecMode secMode = cmm2WlanQtUtilsSecModeMap(secModeFromCmManager); + bearer = WlanQtUtilsBearerTypeWlan; + //Note ssid is set same as iap name + WlanQtUtilsWlanIap* wlanIap = + new WlanQtUtilsWlanIap(iapId, netId, name, bearer, name, secMode); + newIap = wlanIap; + } + + OstTraceFunctionExit1( CMMWRAPPERPRIVATE_GETIAPINFOL_EXIT, this ); + return newIap; + } + +// --------------------------------------------------------- +// CmmWrapperPrivate::cmm2WlanQtUtilsSecModeMap() +// Maps CMManager's WLAN security mode into WlanQtUtilsWlanSecMode. +// CMManager uses sec mode type TConnMonSecurityMode defined +// in rconnmon.h. +// --------------------------------------------------------- +// +WlanQtUtilsWlanSecMode CmmWrapperPrivate::cmm2WlanQtUtilsSecModeMap(int aSecModeFromCmManager) + { + WlanQtUtilsWlanSecMode ret; + switch (aSecModeFromCmManager) + { + case CMManager::EWlanSecModeWep: + ret = WlanQtUtilsWlanSecModeWep; + break; + case CMManager::EWlanSecMode802_1x: + ret = WlanQtUtilsWlanSecMode802_1x; + break; + case CMManager::EWlanSecModeWpa: + ret = WlanQtUtilsWlanSecModeWpa; + break; + case CMManager::EWlanSecModeWpa2: + ret = WlanQtUtilsWlanSecModeWpa2; + break; + default: + ret = WlanQtUtilsWlanSecModeOpen; + break; + } + + return ret; + } + +// --------------------------------------------------------- +// Maps WlanQtUtilsWlanSecMode into CMManager's WLAN security mode +// (TWlanSecMode, defined in cmpluginwlandef.h). +// --------------------------------------------------------- +// +int CmmWrapperPrivate::wlanQtUtils2CmmSecModeMap(WlanQtUtilsWlanSecMode aWlanQtUtilsSecMode) + { + int ret; + switch (aWlanQtUtilsSecMode) + { + case WlanQtUtilsWlanSecModeWep: + ret = CMManager::EWlanSecModeWep; + break; + case WlanQtUtilsWlanSecMode802_1x: + ret = CMManager::EWlanSecMode802_1x; + break; + case WlanQtUtilsWlanSecModeWpa: + ret = CMManager::EWlanSecModeWpa; + break; + case WlanQtUtilsWlanSecModeWpa2: + ret = CMManager::EWlanSecModeWpa2; + break; + default: + ret = CMManager::EWlanSecModeOpen; + break; + } + + return ret; + } + +//end of file + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapper.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// INCLUDE FILES +#include +#include +#include "wlanqtutilsconmonwrapper.h" +#include "wlanqtutilsconmonwrapper_s60_p.h" + +// ================= MEMBER FUNCTIONS ======================= + +ConMonWrapper::ConMonWrapper(QObject *parent) + : QObject(parent) +{ + d_ptrScanWlans = new ConnMonScanWlanAps(this); + d_ptrConnInfo = new ConnMonConnInfo(this); + d_ptrConnDisconnect = new ConnMonConnDisconnect(this); +} + +ConMonWrapper::~ConMonWrapper() +{ + delete d_ptrScanWlans; + delete d_ptrConnInfo; + delete d_ptrConnDisconnect; +} + +int ConMonWrapper::scanAvailableWlanAPs() +{ + return d_ptrScanWlans->scanAvailableWlanAPs(); +} + +void ConMonWrapper::emitAvailableWlans(QList &availableWlanAPs) +{ + emit availableWlanApsFromWrapper(availableWlanAPs); +} + +void ConMonWrapper::emitConnCreatedEvent(uint connectionId) +{ + emit connCreatedEventFromWrapper(connectionId); +} + +void ConMonWrapper::emitConnDeletedEvent(uint connectionId) +{ + emit connDeletedEventFromWrapper(connectionId); +} + +void ConMonWrapper::emitConnStatusEvent(uint connectionId, WlanQtUtilsConnectionStatus connectionStatus) +{ + emit connStatusEventFromWrapper(connectionId, connectionStatus); +} + +WlanQtUtilsActiveConn *ConMonWrapper::activeConnection() +{ + return d_ptrConnInfo->activeConnection(); +} + +WlanQtUtilsActiveConn* ConMonWrapper::connectionInfo(uint connectionId) +{ + return d_ptrConnInfo->connectionInfo(connectionId); +} + +void ConMonWrapper::disconnectIap(int iapId) +{ + d_ptrConnDisconnect->disconnectConnection(iapId); +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapper_s60.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapper_s60.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,633 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * This is a source file for following classes: + * ConnMonScanWlanAps, + * ConnMonConnInfo, + * ConnMonConnDisconnect + */ + +// INCLUDE FILES +#include +#include +#include + +#include "wlanqtutilscommon.h" +#include "wlanqtutilswlanap.h" +#include "wlanqtutilsactiveconn.h" +#include "wlanqtutilsconmonwrapper.h" +#include "wlanqtutilsconmonwrapper_s60_p.h" + +#ifdef WLANQTUTILS_NO_OST_TRACES_FLAG +#include +#else +#include "OstTraceDefinitions.h" +#endif +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanqtutilsconmonwrapper_s60Traces.h" +#endif + + +// =========== PRIVATE CLASS MEMBER FUNCTIONS =============== +// +// --------------------------------------------------------- +// ConnMonScanWlanAps::ConnMonScanWlanAps() +// Constructor +// --------------------------------------------------------- +// +ConnMonScanWlanAps::ConnMonScanWlanAps(ConMonWrapper *wrapper) : + CActive(EPriorityStandard), q_ptr(wrapper), wlanPtr(0, 0) + { + OstTraceFunctionEntry1( CONNMONSCANWLANAPS_CONNMONSCANWLANAPS_ENTRY, this ); + + CActiveScheduler::Add(this); + // TBD: What if this leaves? + // Beware! iConnMon.ConnectL() can + // both leave AND return an error code.. + // User::LeaveIfError( iMonitor.ConnectL() ); + iMonitor.ConnectL(); + + OstTraceFunctionExit1( CONNMONSCANWLANAPS_CONNMONSCANWLANAPS_EXIT, this ); + } + +// --------------------------------------------------------- +// ConnMonScanWlanAps::ConnMonScanWlanAps() +// Destructor +// --------------------------------------------------------- +// +ConnMonScanWlanAps::~ConnMonScanWlanAps() + { + OstTraceFunctionEntry1( CONNMONSCANWLANAPS_CONNMONSCANWLANAPSDESTR_ENTRY, this ); + + Cancel(); + // Cancel notifications and close connection monitor session + iMonitor.Close(); + if (wlanBuf) + { + delete wlanBuf; + } + + OstTraceFunctionExit1( CONNMONSCANWLANAPS_CONNMONSCANWLANAPSDESTR_EXIT, this ); + } + +// --------------------------------------------------------- +// ConnMonScanWlanAps::DoCancel() +// +// --------------------------------------------------------- +// +void ConnMonScanWlanAps::DoCancel() + { + OstTraceFunctionEntry1( CONNMONSCANWLANAPS_DOCANCEL_ENTRY, this ); + // TODO: error handling + OstTraceFunctionExit1( CONNMONSCANWLANAPS_DOCANCEL_EXIT, this ); + } + +// --------------------------------------------------------- +// ConnMonScanWlanAps::RunL() +// Called when scan is ready. Emits scan results in a signal. +// --------------------------------------------------------- +// +void ConnMonScanWlanAps::RunL() + { + OstTraceFunctionEntry1( CONNMONSCANWLANAPS_RUNL_ENTRY, this ); + + if (iStatus == KErrNone) + { + RConnMonWlanNetworksPtrArray wlanPtrArray; + wlanBuf->UnpackToL(wlanPtrArray); + QList wlanScanResult; + + for (TInt i = 0; i < wlanPtrArray.Count(); i++) + { + WlanQtUtilsWlanAp *ap = new WlanQtUtilsWlanAp(); + + // Security mode values defined in enum TConnMonSecurityMode, rconnmon.h. + TUint connMonWlanSecMode; + WlanQtUtilsWlanSecMode wlanQtUtilsWlanSecMode; + + TBuf wlanName = + wlanPtrArray[i]->Name(); + + QString wlanNameInQt = QString::fromUtf16(wlanName.Ptr(), + wlanName.Length()); + + if (wlanNameInQt.length() == 1 && wlanNameInQt.at(0).unicode() + == 0) + { + // QString handles empty strings (single \0 char) strangely, + // so let's initialize them in a different way: + wlanNameInQt = ""; + } + + ap->setSsid(wlanNameInQt); + + // TODO: Won't compile to ARMV5 for some reason. Commented for awhile. + //TBuf8 wlanBssid = wlanPtrArray[i]->WlanBssid(); + //ap->setBssid(QString::fromUtf8(wlanBssid.Ptr(), wlanBssid.Length())); + ap->setBssid("addMAC"); + + TUint wlanConnectionMode = wlanPtrArray[i]->ConnectionMode(); + ap->setConnectionMode(wlanConnectionMode); + + TUint wlanSignalStrength = wlanPtrArray[i]->SignalStrength(); + ap->setSignalStrength(wlanSignalStrength); + + connMonWlanSecMode = wlanPtrArray[i]->SecurityMode(); + wlanQtUtilsWlanSecMode = conMon2WlanQtUtilsSecModeMap(connMonWlanSecMode); + ap->setSecurityMode(wlanQtUtilsWlanSecMode); + + wlanScanResult.append(ap); + delete wlanPtrArray[i]; + } + q_ptr->emitAvailableWlans(wlanScanResult); + wlanPtrArray.Close(); + delete wlanBuf; + wlanBuf = NULL; + // TODO: Is this enough for clearing QList containing ConnUtilsWlanAps? + wlanScanResult.clear(); + } + else + { + // TODO: add error handling + } + + OstTraceFunctionExit1( CONNMONSCANWLANAPS_RUNL_EXIT, this ); + } + +// --------------------------------------------------------- +// ConnMonScanWlanAps::scanAvailableWlanAPs() +// Gets APs from Connection Monitor +// --------------------------------------------------------- +// +int ConnMonScanWlanAps::scanAvailableWlanAPs() + { + OstTraceFunctionEntry1( CONNMONSCANWLANAPS_SCANAVAILABLEWLANAPS_ENTRY, this ); + + if (!IsActive()) + { + // TODO: What size for wlanBuf? How to know exact size? + // 2560 ~ 35 wlan APs + wlanBuf = new (ELeave) CConnMonWlanNetworksPtrArrayPckg(2560); + wlanPtr.Set(wlanBuf->Buf()->Des()); + + iMonitor.GetPckgAttribute(EBearerIdWLAN, 0, KWlanNetworks, wlanPtr, + iStatus); + SetActive(); + } + + OstTraceFunctionExit1( CONNMONSCANWLANAPS_SCANAVAILABLEWLANAPS_EXIT, this ); + return KErrNone; + } + +// --------------------------------------------------------- +// ConMonScanWlanAps::connMon2WlanQtUtilsSecModeMap() +// Map security mode from Connection Monitor into WlanQtUtilsWlanSecMode. +// --------------------------------------------------------- +// +WlanQtUtilsWlanSecMode ConnMonScanWlanAps::conMon2WlanQtUtilsSecModeMap(TUint connMonSecMode) + { + WlanQtUtilsWlanSecMode ret = WlanQtUtilsWlanSecModeNone; + switch (connMonSecMode) + { + case EConnMonSecurityWep: + ret = WlanQtUtilsWlanSecModeWep; + break; + case EConnMonSecurity802d1x: + ret = WlanQtUtilsWlanSecMode802_1x; + break; + case EConnMonSecurityWpa: + ret = WlanQtUtilsWlanSecModeWpa; + break; + case EConnMonSecurityWpaPsk: + ret = WlanQtUtilsWlanSecModeWpa2; + break; + default: + // TODO: should default be None/unknown or should there be assert against EConnMonSecurityOpen. + ret = WlanQtUtilsWlanSecModeOpen; + break; + } + + return ret; + } + + +// --------------------------------------------------------- +// ConnMonConnInfo::ConnMonConnInfo() +// Constructor +// --------------------------------------------------------- +// +ConnMonConnInfo::ConnMonConnInfo(ConMonWrapper *wrapper) : + q_ptr(wrapper) + { + OstTraceFunctionEntry1( CONNMONCONNINFO_CONNMONCONNINFO_ENTRY, this ); + + iMonitor.ConnectL(); + StartMonitoringL(); + + OstTraceFunctionExit1( CONNMONCONNINFO_CONNMONCONNINFO_EXIT, this ); + } + +// --------------------------------------------------------- +// ConnMonConnInfo::~ConnMonConnInfo() +// Destructor +// --------------------------------------------------------- +// +ConnMonConnInfo::~ConnMonConnInfo() + { + OstTraceFunctionEntry1( CONNMONCONNINFO_CONNMONCONNINFODESTR_ENTRY, this ); + + StopMonitoring(); + iMonitor.Close(); + + OstTraceFunctionExit1( CONNMONCONNINFO_CONNMONCONNINFODESTR_EXIT, this ); + } + +// --------------------------------------------------------- +// ConnMonConnInfo::StartMonitoringL() +// Starts monitoring of Connection Monitor Server events +// --------------------------------------------------------- +// +void ConnMonConnInfo::StartMonitoringL() + { + OstTraceFunctionEntry1( CONNMONCONNINFO_STARTMONITORINGL_ENTRY, this ); + + iMonitoring = ETrue; + iMonitor.NotifyEventL(*this); + + OstTraceFunctionExit1( CONNMONCONNINFO_STARTMONITORINGL_EXIT, this ); + } + +// --------------------------------------------------------- +// ConnMonConnInfo::StopMonitoring() +// Stops monitoring of Connection Monitor Server events +// --------------------------------------------------------- +// +void ConnMonConnInfo::StopMonitoring() + { + OstTraceFunctionEntry1( CONNMONCONNINFO_STOPMONITORING_ENTRY, this ); + + iMonitoring = EFalse; + iMonitor.CancelNotifications(); + + OstTraceFunctionExit1( CONNMONCONNINFO_STOPMONITORING_EXIT, this ); + } + +// --------------------------------------------------------- +// ConnMonConnInfo::EventL() +// Handler of Connection Monitor Server events +// --------------------------------------------------------- +// +void ConnMonConnInfo::EventL(const CConnMonEventBase& aConnMonEvent) + { + OstTraceFunctionEntry1( CONNMONCONNINFO_EVENTL_ENTRY, this ); + + TUint connectionId = aConnMonEvent.ConnectionId(); + OstTraceExt2( + TRACE_NORMAL, + CONNMONCONNINFO_EVENTL_EVENTTYPE, + "ConnMonConnInfo::EventL;connectionId=%u;aConnMonEvent.EventType()=%d", connectionId, aConnMonEvent.EventType() ); + + // Note: Conversions from CConnMonEventBase to sub classes cannot be made to use dynamic_cast + // because constructors of CConnMonEventBase and its sub classes are not public in + // connmon library's interface. + + switch (aConnMonEvent.EventType()) + { + case EConnMonCreateConnection: + q_ptr->emitConnCreatedEvent( connectionId ); + break; + case EConnMonDeleteConnection: + + // TODO: take the following into use. + // const CConnMonDeleteConnection* eventDelete; + // eventDelete = static_cast< const CConnMonDeleteConnection*>( &aConnMonEvent ); + //TUint totalDlVolume = eventDelete->DownlinkData(); + //TUint totalUlVolume = eventDelete->UplinkData(); + //TBool authDelete = eventDelete->AuthoritativeDelete(); + + q_ptr->emitConnDeletedEvent( connectionId ); + break; + case EConnMonConnectionStatusChange: + const CConnMonConnectionStatusChange* eventConnectionStatusChange; + eventConnectionStatusChange = + static_cast< const CConnMonConnectionStatusChange* >( &aConnMonEvent ); + WlanQtUtilsConnectionStatus connectionStatus; + connectionStatus = connMon2WlanQtUtilsConnectionStatusMap( + eventConnectionStatusChange->ConnectionStatus() ); + + OstTraceExt2( + TRACE_NORMAL, + CONNMONCONNINFO_EVENTL_CONNSTATUS, + "ConnMonConnInfo::EventL;connectionId=%u;eventConnectionStatusChange->ConnectionStatus()=%d", + connectionId, + eventConnectionStatusChange->ConnectionStatus() ); + + if (connectionStatus != WlanQtUtilsConnectionStatusNone) { + q_ptr->emitConnStatusEvent( connectionId, connectionStatus ); + } + break; + default: + break; + } + + OstTraceFunctionExit1( CONNMONCONNINFO_EVENTL_EXIT, this ); + } + +// --------------------------------------------------------- +// ConnMonConnInfo::activeConnection() +// --------------------------------------------------------- +// +WlanQtUtilsActiveConn *ConnMonConnInfo::activeConnection() + { + OstTraceFunctionEntry1( CONNMONCONNINFO_ACTIVECONNECTION_ENTRY, this ); + + // Get number of active connections + TRequestStatus status; + + TUint numConnections = 0; + iMonitor.GetConnectionCount( numConnections, status ); + User::WaitForRequest( status ); + if ( status.Int() == KErrNone ) + { + // Get connection info of this connection + for ( TUint i = 1; i <= numConnections; i++ ) + { + TUint numSubConnections = 0; + TUint connectionId = 0; + TInt ret = iMonitor.GetConnectionInfo( i, connectionId, numSubConnections ); + Q_ASSERT( ret == KErrNone ); // TODO: error handling + + WlanQtUtilsActiveConn* activeConn = connectionInfo( connectionId ); + if ( activeConn != NULL ) + { + // connectionInfo() only returns WLAN connections, and there may be only + // one active WLAN connection, so this is the one we want to return + OstTraceFunctionExit1( CONNMONCONNINFO_ACTIVECONNECTION_EXIT, this ); + return activeConn; + } + } + } + + OstTraceFunctionExit1( DUP1_CONNMONCONNINFO_ACTIVECONNECTION_EXIT, this ); + return NULL; + } + +// --------------------------------------------------------- +// ConnMonConnInfo::connectionInfo() +// --------------------------------------------------------- +// +WlanQtUtilsActiveConn *ConnMonConnInfo::connectionInfo( uint connectionId ) + { + OstTraceFunctionEntry1( CONNMONCONNINFO_CONNECTIONINFO_ENTRY, this ); + + TRequestStatus status; + WlanQtUtilsActiveConn *activeConn = NULL; + + // Get the connection bearer. + TInt bearer = 0; + iMonitor.GetIntAttribute( + connectionId, + 0, + KBearer, + bearer, + status ); + User::WaitForRequest( status ); + if ( status.Int() == KErrNone ) + { + // We are only interested in WLAN connections. + WlanQtUtilsBearerType bearerType = connMon2WlanQtUtilsBearerTypeMap( bearer ); + if ( bearerType == WlanQtUtilsBearerTypeWlan ) + { + activeConn = new WlanQtUtilsActiveConn(); + activeConn->setConnectionId( connectionId ); + activeConn->setBearerType( bearerType ); + activeConnInfoUpdate( activeConn ); + } + } + + OstTraceFunctionExit1( CONNMONCONNINFO_CONNECTIONINFO_EXIT, this ); + return activeConn; + } + +// --------------------------------------------------------- +// ConnMonConnInfo::activeConnInfoUpdate() +// Requests active connection info from Connection Monitor Server +// --------------------------------------------------------- +// +// TODO: divide this function into smaller pieces depending on the need. +// TODO: optimize so that all the information is not always requested from connmon. +// Only information that is missing is requested. +void ConnMonConnInfo::activeConnInfoUpdate( WlanQtUtilsActiveConn *activeConn ) + { + OstTraceFunctionEntry1( CONNMONCONNINFO_ACTIVECONNINFOUPDATE_ENTRY, this ); + + Q_ASSERT( activeConn != NULL ); + Q_ASSERT( activeConn->bearerType() != WlanQtUtilsBearerTypeNone ); + + TUint connectionId = activeConn->connectionId(); + TRequestStatus status; + + // Get connection IAP ID. + TUint iapId = 0; + iMonitor.GetUintAttribute( + connectionId, + 0, + KIAPId, + iapId, + status ); + User::WaitForRequest( status ); + if ( status.Int() == KErrNone ) + { + activeConn->setIapId( iapId ); + } + + // Get connection status. + TInt connectionStatus = 0; + iMonitor.GetIntAttribute( + connectionId, + 0, + KConnectionStatus, + connectionStatus, + status ); + User::WaitForRequest( status ); + if ( status.Int() == KErrNone ) { + activeConn->setConnectionStatus( connMon2WlanQtUtilsConnectionStatusMap( connectionStatus ) ); + } + + OstTraceFunctionExit1( CONNMONCONNINFO_ACTIVECONNINFOUPDATE_EXIT, this ); + } + +// --------------------------------------------------------- +// ConnMonConnInfo::connMon2WlanQtUtilsConnectionStatusMap() +// Maps connection status of Connection Monitor Server to connection +// status of Wlan Qt Utilities. +// --------------------------------------------------------- +// +WlanQtUtilsConnectionStatus ConnMonConnInfo::connMon2WlanQtUtilsConnectionStatusMap( TInt aConnectionStatus ) + { + // TODO: This mapping is not specific to current status which is unknown to wrapper. + // TODO: This is only current implementation and will need serious modifications and + // verification from connmon guys. + WlanQtUtilsConnectionStatus connUtilsConnectionStatus = WlanQtUtilsConnectionStatusNone; + switch (aConnectionStatus) + { + // KConnectionOpen is not final status for WLAN, because DHCP is run after that + case KConnectionOpen: + case KStartingConnection: + connUtilsConnectionStatus = WlanQtUtilsConnectionStatusConnecting; + break; + case KLinkLayerOpen: + connUtilsConnectionStatus = WlanQtUtilsConnectionStatusConnected; + break; + case KConnectionClosed: + case KLinkLayerClosed: + connUtilsConnectionStatus = WlanQtUtilsConnectionStatusDisconnected; + break; + default: + // Ignore all other values + connUtilsConnectionStatus = WlanQtUtilsConnectionStatusNone; + break; + } + + return connUtilsConnectionStatus; + } + +// --------------------------------------------------------- +// ConnMonConnInfo::connMon2WlanQtUtilsBearerTypeMap() +// Maps bearer type of Connection Monitor Server to bearer +// type of Wlan Qt Utilities. +// --------------------------------------------------------- +// +WlanQtUtilsBearerType ConnMonConnInfo::connMon2WlanQtUtilsBearerTypeMap( TInt aBearerType ) + { + WlanQtUtilsBearerType connUtilsBearerType = WlanQtUtilsBearerTypeNone; + switch ( aBearerType ) { + case EBearerWCDMA: + case EBearerGPRS: + case EBearerEdgeGPRS: + connUtilsBearerType = WlanQtUtilsBearerTypeCellular; + break; + case EBearerWLAN: + connUtilsBearerType = WlanQtUtilsBearerTypeWlan; + break; + default: + break; + } + + return connUtilsBearerType; + } + +// --------------------------------------------------------- +// ConnMonConnDisconnect::ConnMonConnDisconnect() +// Constructor +// --------------------------------------------------------- +// +ConnMonConnDisconnect::ConnMonConnDisconnect(ConMonWrapper *wrapper) : + CActive(EPriorityStandard), q_ptr(wrapper) + { + OstTraceFunctionEntry1( CONNMONCONNDISCONNECT_CONNMONCONNDISCONNECT_ENTRY, this ); + + CActiveScheduler::Add(this); + iMonitor.ConnectL(); + + OstTraceFunctionExit1( CONNMONCONNDISCONNECT_CONNMONCONNDISCONNECT_EXIT, this ); + } + +// --------------------------------------------------------- +// ConnMonConnDisconnect::ConnMonConnDisconnect() +// Destructor +// --------------------------------------------------------- +// +ConnMonConnDisconnect::~ConnMonConnDisconnect() + { + OstTraceFunctionEntry1( CONNMONCONNDISCONNECT_CONNMONCONNDISCONNECTDESTR_ENTRY, this ); + + // Cancel notifications and close connection monitor session + //iMonitor.CancelNotifications(); + iMonitor.Close(); + + OstTraceFunctionExit1( CONNMONCONNDISCONNECT_CONNMONCONNDISCONNECTDESTR_EXIT, this ); + } + +// --------------------------------------------------------- +// ConnMonConnDisconnect::DoCancel() +// +// --------------------------------------------------------- +// +void ConnMonConnDisconnect::DoCancel() + { + OstTraceFunctionEntry1( CONNMONCONNDISCONNECT_DOCANCEL_ENTRY, this ); + // TODO: error handling + OstTraceFunctionExit1( CONNMONCONNDISCONNECT_DOCANCEL_EXIT, this ); + } + +// --------------------------------------------------------- +// ConnMonConnDisconnect::RunL() +// +// --------------------------------------------------------- +// +void ConnMonConnDisconnect::RunL() + { + OstTraceFunctionEntry1( CONNMONCONNDISCONNECT_RUNL_ENTRY, this ); + // TODO: Is anything needed? + OstTraceFunctionExit1( CONNMONCONNDISCONNECT_RUNL_EXIT, this ); + } + +// --------------------------------------------------------- +// ConnMonConnDisconnect::disconnectConnection(int iapId) +// Stop active connection. +// --------------------------------------------------------- +// +void ConnMonConnDisconnect::disconnectConnection(int iapId) + { + OstTraceFunctionEntry1( CONNMONCONNDISCONNECT_DISCONNECTCONNECTION_ENTRY, this ); + OstTrace1( + TRACE_NORMAL, + CONNMONCONNDISCONNECT_DISCONNECTCONNECTION, + "ConnMonConnDisconnect::disconnectConnection;iapId=%d", iapId ); + + // TODO: Error handling + TUint count; + TRequestStatus status; + iMonitor.GetConnectionCount(count, status); + User::WaitForRequest(status); + + for (TInt i = 1; i <= count; i++) + { + TUint numSubConnections; + TUint iap = 0; + TUint connectionId = 0; + TInt ret = iMonitor.GetConnectionInfo(i, connectionId, + numSubConnections); + if (ret != KErrNone) + { + // error + } + iMonitor.GetUintAttribute(connectionId, 0, KIAPId, iap, status); + User::WaitForRequest(status); + if (status.Int() != KErrNone) + { + // error + } + if (iap == iapId) + { + TInt KErr = iMonitor.SetBoolAttribute(connectionId, 0, + KConnectionStop, ETrue); + } + } + + OstTraceFunctionExit1( CONNMONCONNDISCONNECT_DISCONNECTCONNECTION_EXIT, this ); + } + +//end of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconntestwrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconntestwrapper.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// INCLUDE FILES +#include "wlanqtutilsconntestwrapper.h" +#include "wlanqtutilsconntestwrapper_s60_p.h" + +ConnTestWrapper::ConnTestWrapper(QObject *parent) : QObject(parent) +{ + d_ptr_ = new ConnTestWrapperPrivate(this); +} + +ConnTestWrapper::~ConnTestWrapper() +{ + delete d_ptr_; +} + +void ConnTestWrapper::connectivityTestDone(bool result) +{ + emit connectivityTestResult(result); +} + +void ConnTestWrapper::startConnectivityTest(int iapId, int netId) +{ + d_ptr_->startConnectivityTest(iapId, netId); +} + +//end of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconntestwrapper_s60.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconntestwrapper_s60.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// INCLUDE FILES +#include +#include + +#include "wlanqtutilsconntestwrapper.h" +#include "wlanqtutilsconntestwrapper_s60_p.h" + +#ifdef WLANQTUTILS_NO_OST_TRACES_FLAG +#include +#else +#include "OstTraceDefinitions.h" +#endif +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanqtutilsconntestwrapper_s60Traces.h" +#endif + + +// =========== PRIVATE CLASS MEMBER FUNCTIONS =============== +// +ConnTestWrapperPrivate::ConnTestWrapperPrivate( + ConnTestWrapper *aWrapper ) +: q_ptr( aWrapper ), iIct( NULL ) + { + OstTraceFunctionEntry1( CONNTESTWRAPPERPRIVATE_CONNTESTWRAPPERPRIVATE_ENTRY, this ); + OstTraceFunctionExit1( CONNTESTWRAPPERPRIVATE_CONNTESTWRAPPERPRIVATE_EXIT, this ); + } + +ConnTestWrapperPrivate::~ConnTestWrapperPrivate() + { + OstTraceFunctionEntry1( CONNTESTWRAPPERPRIVATE_CONNTESTWRAPPERPRIVATEDESTR_ENTRY, this ); + + if ( !NULL ) + { + delete iIct; + } + + OstTraceFunctionExit1( CONNTESTWRAPPERPRIVATE_CONNTESTWRAPPERPRIVATEDESTR_EXIT, this ); + } + +void ConnTestWrapperPrivate::ConnectivityObserver( + TIctsTestResult aResult, + const TDesC& /*aString*/ ) + { + OstTraceFunctionEntry1( CONNTESTWRAPPERPRIVATE_CONNECTIVITYOBSERVER_ENTRY, this ); + OstTrace1( + TRACE_NORMAL, + CONNTESTWRAPPERPRIVATE_CONNECTIVITYOBSERVER, + "ConnTestWrapperPrivate::ConnectivityObserver;aResult=%u", aResult ); + + switch ( aResult ) + { + case EConnectionOk : + q_ptr->connectivityTestDone( ETrue ); + break; + case EHttpAuthenticationNeeded : + case EConnectionNotOk : + case ETimeout : + default: + q_ptr->connectivityTestDone( EFalse ); + break; + } + + delete iIct; + iIct = NULL; + + OstTraceFunctionExit1( CONNTESTWRAPPERPRIVATE_CONNECTIVITYOBSERVER_EXIT, this ); + } + +void ConnTestWrapperPrivate::startConnectivityTest( + int aIapId, int aNetId ) + { + OstTraceFunctionEntry1( CONNTESTWRAPPERPRIVATE_STARTCONNECTIVITYTEST_ENTRY, this ); + OstTraceExt2( + TRACE_NORMAL, + CONNTESTWRAPPERPRIVATE_STARTCONNECTIVITYTEST, + "ConnTestWrapperPrivate::startConnectivityTest;aIapId=%d;aNetId=%d", aIapId, aNetId ); + + TRAPD( err, startConnectivityTestL( aIapId, aNetId ) ); + + // Check if startConnectivityTestL() leaved. + if ( KErrNone != err ) + { + q_ptr->connectivityTestDone( EFalse ); + } + + OstTraceFunctionExit1( CONNTESTWRAPPERPRIVATE_STARTCONNECTIVITYTEST_EXIT, this ); + } + +void ConnTestWrapperPrivate::startConnectivityTestL( + TInt aIapId, TInt aNetId ) + { + OstTraceFunctionEntry1( CONNTESTWRAPPERPRIVATE_STARTCONNECTIVITYTESTL_ENTRY, this ); + + iIct = CIctsClientInterface::NewL( aIapId, aNetId, *this ); + iIct->StartL(); + + OstTraceFunctionExit1( CONNTESTWRAPPERPRIVATE_STARTCONNECTIVITYTESTL_EXIT, this ); + } + +//end of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsesockwrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsesockwrapper.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is a source file for EsockWrapper class. +*/ + +#include "wlanqtutilsesockwrapper.h" +#include "wlanqtutilsesockwrapper_s60_p.h" + +EsockWrapper::EsockWrapper(QObject *parent) + : QObject(parent) +{ + d_ptr = new EsockWrapperPrivate(this); +} + +EsockWrapper::~EsockWrapper() +{ + delete d_ptr; +} + +void EsockWrapper::updateConnection(bool isOpened) +{ + emit connectionStatusFromWrapper(isOpened); +} + +void EsockWrapper::connectIap(int iapId) +{ + d_ptr->connectIap(iapId); +} + +void EsockWrapper::disconnectIap() +{ + d_ptr->disconnectIap(); +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsesockwrapper_s60.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsesockwrapper_s60.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include +#include "wlanqtutilsesockwrapper.h" +#include "wlanqtutilsesockwrapper_s60_p.h" + +#ifdef WLANQTUTILS_NO_OST_TRACES_FLAG +#include +#else +#include "OstTraceDefinitions.h" +#endif +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanqtutilsesockwrapper_s60Traces.h" +#endif + + +// =========== PRIVATE CLASS MEMBER FUNCTIONS =============== +// +// --------------------------------------------------------- +// EsockWrapperPrivate::EsockWrapperPrivate() +// Constructor +// --------------------------------------------------------- +// +EsockWrapperPrivate::EsockWrapperPrivate(EsockWrapper *aWrapper) +: CActive(EPriorityStandard), q_ptr(aWrapper) + { + OstTraceFunctionEntryExt( ESOCKWRAPPERPRIVATE_ESOCKWRAPPERPRIVATE_ENTRY, this ); + + CActiveScheduler::Add(this); + + iSocketServer.Connect(); + + OstTraceFunctionExit1( ESOCKWRAPPERPRIVATE_ESOCKWRAPPERPRIVATE_EXIT, this ); + } + +// --------------------------------------------------------- +// EsockWrapperPrivate::EsockWrapperPrivate() +// Destructor +// --------------------------------------------------------- +// +EsockWrapperPrivate::~EsockWrapperPrivate() + { + OstTraceFunctionEntry1( ESOCKWRAPPERPRIVATE_ESOCKWRAPPERPRIVATEDESTR_ENTRY, this ); + + Cancel(); + // Closing active RConnection is not mandatory, but is recommended. + // ==> add checking here when implementing cancel/error cases. + iSocketServer.Close(); + + OstTraceFunctionExit1( ESOCKWRAPPERPRIVATE_ESOCKWRAPPERPRIVATEDESTR_EXIT, this ); + } + +// --------------------------------------------------------- +// EsockWrapperPrivate::connectIap() +// Start connection creation to given IAP. +// --------------------------------------------------------- +// +void EsockWrapperPrivate::connectIap(int aIapId) + { + OstTraceFunctionEntryExt( ESOCKWRAPPERPRIVATE_CONNECTIAP_ENTRY, this ); + + // Open an RConnection object. + iConnection.Open(iSocketServer); + + // Create overrides to force opening of the given IAP without any user prompts. + TCommDbConnPref prefs; + prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt); + prefs.SetDirection(ECommDbConnectionDirectionOutgoing); + prefs.SetIapId(aIapId); + + // Start the Connection with overrides + iConnection.Start(prefs, iStatus); + + // TODO: Currently SetActive Panics when connecting "furiously" in Visual view... + // Panicking line in SetActive was this: + // __ASSERT_ALWAYS(!(iStatus.iFlags&TRequestStatus::EActive),Panic(EReqAlreadyActive)); + SetActive(); + + OstTraceFunctionExit1( ESOCKWRAPPERPRIVATE_CONNECTIAP_EXIT, this ); + } + +// --------------------------------------------------------- +// EsockWrapperPrivate::disconnectIap() +// Stop connection. +// --------------------------------------------------------- +// +void EsockWrapperPrivate::disconnectIap() + { + OstTraceFunctionEntry1( ESOCKWRAPPERPRIVATE_DISCONNECTIAP_ENTRY, this ); + + // TODO: Error checking + iConnection.Close(); + + OstTraceFunctionExit1( ESOCKWRAPPERPRIVATE_DISCONNECTIAP_EXIT, this ); + } + +// --------------------------------------------------------- +// EsockWrapperPrivate::RunL() +// Called when connection creation has finished. +// --------------------------------------------------------- +// +void EsockWrapperPrivate::RunL() + { + OstTraceFunctionEntry1( ESOCKWRAPPERPRIVATE_RUNL_ENTRY, this ); + OstTrace1( TRACE_NORMAL, ESOCKWRAPPERPRIVATE_RUNL, "EsockWrapperPrivate::RunL;iStatus.Int()=%d", iStatus.Int() ); + + bool success = false; + + if (iStatus == KErrNone) + { + success = true; + } + + q_ptr->updateConnection(success); + + OstTraceFunctionExit1( ESOCKWRAPPERPRIVATE_RUNL_EXIT, this ); + } + +// --------------------------------------------------------- +// EsockWrapperPrivate::DoCancel() +// +// --------------------------------------------------------- +// +void EsockWrapperPrivate::DoCancel() + { + OstTraceFunctionEntry1( ESOCKWRAPPERPRIVATE_DOCANCEL_ENTRY, this ); + OstTraceFunctionExit1( ESOCKWRAPPERPRIVATE_DOCANCEL_EXIT, this ); + } + +//end of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/wst/run_wst.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wst/run_wst.bat Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,173 @@ +::============================================================================= +:: Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +:: All rights reserved. +:: This component and the accompanying materials are made available +:: under the terms of "Eclipse Public License v1.0" +:: which accompanies this distribution, and is available +:: at the URL "http://www.eclipse.org/legal/epl-v10.html". +:: +:: Initial Contributors: +:: Nokia Corporation - initial contribution. +:: +:: Contributors: +:: +:: Description: +:: +::============================================================================= + +:: Script(s) uses following environment settings: +:: - CD +:: - DATE +:: - TIME +:: - TEMP + + +::----------------------------------------------------------------------------- +:: Do the preparations: +:: - Don't show the commands +:: - Use local parameters -- don't pollute the global one +:: - Dim the lights for time of script execution +:: - Store the current working directory +::----------------------------------------------------------------------------- + +@echo off +echo *** RUN_WST: START: +setlocal +color 08 +pushd . +if not exist run_wst.bat goto INVALID_DIR + + +::----------------------------------------------------------------------------- +:: Set the local variables +::----------------------------------------------------------------------------- + +echo *** RUN_WST: SET VARIABLES: +set wst_root_dir=%cd% +set wst_log_dir=%wst_root_dir%\wst_log +set wst_report_dir=%wst_root_dir%\wst_report +set log_file=%wst_log_dir%\wst_log.txt +set build_script=%wst_root_dir%\wst_script\wst_make.bat +set epoc_commsdat_dir=\epoc32\winscw\c\private\10202be9\persists +if not exist %epoc_commsdat_dir% goto INVALID_DIR +set epoc_backup_dir=%epoc_commsdat_dir%\backup +set ut_commsdat_dir=%wst_root_dir%\..\ut\context\commsdat_files +if not exist %ut_commsdat_dir% goto INVALID_DIR +set ut_commsdat_file_default=%ut_commsdat_dir%\default.cre +if not exist %ut_commsdat_file_default% goto INVALID_DIR +set ut_commsdat_files=%ut_commsdat_dir%\*.cre +if not exist %ut_commsdat_files% goto INVALID_DIR + + +::----------------------------------------------------------------------------- +:: Copy commsdat file to emulator directory and also to backup directory +::----------------------------------------------------------------------------- + +echo *** RUN_WST: COPY FILES: +copy %ut_commsdat_file_default% %epoc_commsdat_dir%\cccccc00.cre /y +if not exist %epoc_backup_dir% mkdir %epoc_backup_dir% +copy %ut_commsdat_files% %epoc_backup_dir% /y + + +::----------------------------------------------------------------------------- +:: Check that script exists +::----------------------------------------------------------------------------- + +echo *** RUN_WST: SOME CHECKS: +if not exist %build_script% goto INVALID_DIR +:: Create output directory if it does not exist +if not exist %wst_log_dir% mkdir %wst_log_dir% +if not exist %wst_report_dir% mkdir %wst_report_dir% +:: Create log file +echo *** WST_LOG: BEGIN *** > %log_file% + + +::----------------------------------------------------------------------------- +:: Check parameters +::----------------------------------------------------------------------------- + +set command=ERROR +if [%1]==[] set command=CLEAN_OLD_FILES COMPILE_WLANQTUTILS COMPILE_TEST_CASES RUN_TEST_CASES GENERATE_REPORTS SHOW_RESULTS +if [%1]==[CLEAN_OLD] set command=CLEAN_OLD_FILES +if [%1]==[WLANQTUTILS] set command=COMPILE_WLANQTUTILS +if [%1]==[CASES] set command=COMPILE_TEST_CASES +if [%1]==[RUN] set command=RUN_TEST_CASES +if [%1]==[REPORTS] set command=GENERATE_REPORTS +if [%1]==[RESULTS] set command=SHOW_RESULTS +if [%1]==[BROWSE] set command=START_BROWSER +if [%1]==[/?] goto HELP +if [%1]==[HELP] goto HELP +if [%1]==[/h] goto HELP +if [%1]==[-h] goto HELP + +::----------------------------------------------------------------------------- +:PARSE_COMMANDS +::----------------------------------------------------------------------------- + +echo *** RUN_WST: COMMAND: %command% +echo *** RUN_WST: CALL SCRIPT: +for %%i IN ( %command% ) DO ( + call %build_script% %wst_root_dir% wst_log.txt %%i + for /f "tokens=3 delims= " %%x in ('find /C " Error " %log_file%') do ( + if not [%%x]==[0] goto ERROR + ) +) + +goto THE_END + + +::----------------------------------------------------------------------------- +:INVALID_DIR +::----------------------------------------------------------------------------- + +echo *** RUN_WST: INVALID DIR: +echo *** Test script sub-script not found! +echo *** Please be sure to run the script in same directory, +echo *** i.e. .\run_wst.bat , and NOT .\wst\run_wst.bat + +goto THE_END + + +::----------------------------------------------------------------------------- +:ERROR +::----------------------------------------------------------------------------- + +echo *** RUN_WST: ERROR: +color 48 +echo Error in compilation: +findstr /C:" Error " < %log_file% +echo. +Echo Quitting WST. + +goto THE_END + + +::----------------------------------------------------------------------------- +:HELP +::----------------------------------------------------------------------------- + +echo *** RUN_WST: HELP: +echo Run Wlan Qt Utilities Workstation Testing +echo. +echo RUN_WST [param] +echo. +echo param +echo [none] - Do all, from CLEAN_OLD to RESULTS +echo. +echo CLEAN_OLD - Clean metrics and other generated files +echo WLANQTUTILS - Build only Wlan Qt Utilities components +echo CASES - Build only Tester components +echo RUN - Run Tester +echo REPORTS - Generate reports +echo RESULTS - Show results +echo BROWSE - Start browser +echo. + + +::----------------------------------------------------------------------------- +:THE_END +::----------------------------------------------------------------------------- + +echo *** RUN_WST: END: +color +popd diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanqtutilities/wst/wst_script/wst_make.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wst/wst_script/wst_make.bat Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,199 @@ +::============================================================================= +:: Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +:: All rights reserved. +:: This component and the accompanying materials are made available +:: under the terms of "Eclipse Public License v1.0" +:: which accompanies this distribution, and is available +:: at the URL "http://www.eclipse.org/legal/epl-v10.html". +:: +:: Initial Contributors: +:: Nokia Corporation - initial contribution. +:: +:: Contributors: +:: +:: Description: +:: +::============================================================================= +:: +:: Following commands are implemented: +:: - CLEAN_OLD_FILES +:: - COMPILE_WLANQTUTILS +:: - COMPILE_TEST_CASES +:: - RUN_TEST_CASES +:: - GENERATE_REPORTS +:: - SHOW_RESULTS +:: - START_BROWSER +::============================================================================= + +::----------------------------------------------------------------------------- +:: Do the preparations: +:: - Don't show the commands +:: - Use local parameters -- don't pollute the global one +::----------------------------------------------------------------------------- +@echo off + +echo *** WST_MAKE: START: +setlocal + +::----------------------------------------------------------------------------- +:: Check input +:: +:: Parameters that are required: +:: 1) wst_root_dir +:: 2) log_file_name +:: 3) the command +::----------------------------------------------------------------------------- + +:: (1) +if not exist %1 goto ERROR +if [%1]==[] goto ERROR +set wst_root_dir=%1 +set wst_log_dir=%1\wst_log +set wst_report_dir=%1\wst_report +set wlanqtutils_root_dir=%1\.. +set wlanqtutils_test_dir=%1\..\ut\t_wlanqtutils + +:: (2) +if [%2]==[] goto ERROR +set log_file_name=%2 +set log_file=%wst_log_dir%\%log_file_name% +if not exist %log_file% goto ERROR +echo *** DATE AND TIME: %date%, %time% >> %log_file% +echo *** WST_MAKE: INFO: Wlan Qt Utilities root dir: %wlanqtutils_root_dir% +echo *** WST_MAKE: INFO: Wlan Qt Utilities test dir: %wlanqtutils_test_dir% +echo *** WST_MAKE: INFO: WST log dir: %wst_log_dir% +echo *** WST_MAKE: INFO: WST log file: %log_file% + +:: (3) +if [%3]==[] goto ERROR +goto %3 + +:: Error if label not found. +goto ERROR + +::----------------------------------------------------------------------------- +:CLEAN_OLD_FILES +::----------------------------------------------------------------------------- + +echo *** WST_MAKE: CLEAN_OLD_FILES: +echo *** WST_LOG: CLEAN_OLD_FILES >> %log_file% + +move %wst_log_dir%\%log_file_name% %wst_root_dir% +del /F /S /Q %wst_log_dir%\* +del /F /S /Q %wst_report_dir%\* +rmdir /S /Q %wst_log_dir%\CMTHTML +rmdir /S /Q %wst_log_dir%\CTCHTML +move %wst_root_dir%\%log_file_name% %wst_log_dir% +del \epoc32\winscw\c\data\wlanqtutils_qtest_log.txt + +goto THE_END + +::----------------------------------------------------------------------------- +:COMPILE_WLANQTUTILS +::----------------------------------------------------------------------------- + +echo *** WST_MAKE: COMPILE_WLANQTUTILS: +echo *** WST_LOG: COMPILE_WLANQTUTILS >> %log_file% + +cd %wlanqtutils_root_dir% +call qmake >> %log_file% 2>&1 +call bldmake bldfiles >> %log_file% 2>&1 +call abld reallyclean winscw >> %log_file% 2>&1 +call abld build winscw udeb >> %log_file% 2>&1 + +goto THE_END + +::----------------------------------------------------------------------------- +:COMPILE_TEST_CASES +::----------------------------------------------------------------------------- + +echo *** WST_MAKE: COMPILE_TEST_CASES: +echo *** WST_LOG: COMPILE_TEST_CASES >> %log_file% + +cd %wlanqtutils_test_dir% +call qmake "CONFIG += coverage_test" >> %log_file% 2>&1 +call bldmake bldfiles >> %log_file% 2>&1 +call abld reallyclean winscw >> %log_file% 2>&1 +:: Call CTC instrumentation script. Source directories hard coded, because NO_EXCLUDE does not like % characters... +call ctcwrap -C EXCLUDE=* -C NO_EXCLUDE+..\..\base\src\*.cpp,..\..\wrapper\src\*.cpp -n %wst_log_dir%\MON.sym -i m -v abld build winscw udeb >> %log_file% 2>&1 + +goto THE_END + +::----------------------------------------------------------------------------- +:RUN_TEST_CASES +::----------------------------------------------------------------------------- + +echo *** WST_MAKE: RUN_TEST_CASES: +echo *** WST_LOG: RUN_TEST_CASES >> %log_file% + +call \epoc32\release\winscw\udeb\t_wlanqtutils.exe -o c:\data\wlanqtutils_qtest_log.txt + +goto THE_END + +::----------------------------------------------------------------------------- +:GENERATE_REPORTS +::----------------------------------------------------------------------------- + +echo *** WST_MAKE: GENERATE_REPORTS: +echo *** WST_LOG: GENERATE_REPORTS >> %log_file% + +cd %wst_log_dir% + +call ctcpost -p %wst_log_dir%\ctc_coverage.txt +call ctc2html -nsb -i %wst_log_dir%\ctc_coverage.txt + +call dir /s /b %wlanqtutils_root_dir%\*.cpp > %wst_log_dir%\raw_filelist.txt + +call findstr /I /V "moc_" %wst_log_dir%\raw_filelist.txt > %wst_log_dir%\filelist.txt +call cmt -f %wst_log_dir%\filelist.txt -o cmt_metrics.txt >> %log_file% +call cmt2html -nsb -i cmt_metrics.txt + +:: Clean up temp files +call del %wst_log_dir%\*filelist.txt + +echo *** WST_MAKE: COPY LOGS: +call copy %TEMP%\epocwind.out %wst_log_dir%\epocwind.txt + +goto THE_END + +::----------------------------------------------------------------------------- +:SHOW_RESULTS +::----------------------------------------------------------------------------- + +echo *** WST_MAKE: SHOW_RESULTS: +echo *** WST_LOG: SHOW_RESULTS >> %log_file% +echo *** Module tests: +call findstr /C:"Totals: " \epoc32\winscw\c\data\wlanqtutils_qtest_log.txt +echo *** Coverage: +call findstr /C:"Number of " %wst_log_dir%\ctc_coverage.txt +call findstr /C:"TER " %wst_log_dir%\ctc_coverage.txt + +goto THE_END + +::----------------------------------------------------------------------------- +:START_BROWSER +::----------------------------------------------------------------------------- + +echo *** WST_MAKE: START_BROWSER: +echo *** WST_LOG: START_BROWSER >> %log_file% +echo. +echo Starting up browser to show the results + +start %wst_root_dir%\wst_report\coverage.html + +goto THE_END + +::----------------------------------------------------------------------------- +:ERROR +::----------------------------------------------------------------------------- + +echo *** WST_MAKE: ERROR: +endlocal +echo wst_make *** Error (unknown parameter) >> %log_file% + +goto THE_END + +::----------------------------------------------------------------------------- +:THE_END +::----------------------------------------------------------------------------- +echo *** WST_MAKE: END: diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/bwinscw/wlansettingsuiu.def --- a/wlanutilities/wlansettingsui/bwinscw/wlansettingsuiu.def Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/data/wlansettingsui.rss --- a/wlanutilities/wlansettingsui/data/wlansettingsui.rss Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,319 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/eabi/wlansettingsuiu.def --- a/wlanutilities/wlansettingsui/eabi/wlansettingsuiu.def Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -EXPORTS - _ZN15CWlanSettingsUi12RunSettingsLEPN8CommsDat11CMDBSessionE @ 1 NONAME - _ZN15CWlanSettingsUi12RunSettingsLEv @ 2 NONAME - _ZN15CWlanSettingsUi4NewLER9CEikonEnv @ 3 NONAME - _ZN15CWlanSettingsUiD0Ev @ 4 NONAME - _ZN15CWlanSettingsUiD1Ev @ 5 NONAME - _ZN15CWlanSettingsUiD2Ev @ 6 NONAME - diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/group/bld.inf --- a/wlanutilities/wlansettingsui/group/bld.inf Tue Jan 26 13:04:04 2010 +0200 +++ b/wlanutilities/wlansettingsui/group/bld.inf Fri Apr 16 16:07:56 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2001-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -16,19 +16,9 @@ */ - #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 @@ -36,6 +26,3 @@ PRJ_EXPORTS PRJ_MMPFILES -./wlansettingsui.mmp - -// End of File diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/group/wlansettingsui.mmp --- a/wlanutilities/wlansettingsui/group/wlansettingsui.mmp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/inc/wlansettingsui.h --- a/wlanutilities/wlansettingsui/inc/wlansettingsui.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/inc/wlansettingsui.hrh --- a/wlanutilities/wlansettingsui/inc/wlansettingsui.hrh Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/inc/wlansettingsuibinarypopupsettingitem.h --- a/wlanutilities/wlansettingsui/inc/wlansettingsuibinarypopupsettingitem.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/inc/wlansettingsuidefs.h --- a/wlanutilities/wlansettingsui/inc/wlansettingsuidefs.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/inc/wlansettingsuidlg.h --- a/wlanutilities/wlansettingsui/inc/wlansettingsuidlg.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/inc/wlansettingsuidlg.inl --- a/wlanutilities/wlansettingsui/inc/wlansettingsuidlg.inl Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/inc/wlansettingsuiimpl.h --- a/wlanutilities/wlansettingsui/inc/wlansettingsuiimpl.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/inc/wlansettingsuimainviewdlg.h --- a/wlanutilities/wlansettingsui/inc/wlansettingsuimainviewdlg.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/inc/wlansettingsuimainviewdlg.inl --- a/wlanutilities/wlansettingsui/inc/wlansettingsuimainviewdlg.inl Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/inc/wlansettingsuimodel.h --- a/wlanutilities/wlansettingsui/inc/wlansettingsuimodel.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,238 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/inc/wlansettingsuimodel.inl --- a/wlanutilities/wlansettingsui/inc/wlansettingsuimodel.inl Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/inc/wlansettingsuipanic.h --- a/wlanutilities/wlansettingsui/inc/wlansettingsuipanic.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/inc/wlansettingsuiscanintervalsettingitem.h --- a/wlanutilities/wlansettingsui/inc/wlansettingsuiscanintervalsettingitem.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/inc/wlansettingsuisettingitemlist.h --- a/wlanutilities/wlansettingsui/inc/wlansettingsuisettingitemlist.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/inc/wlansettingsuisettingitemlist.inl --- a/wlanutilities/wlansettingsui/inc/wlansettingsuisettingitemlist.inl Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/inc/wlansettingsuistatuspane.h --- a/wlanutilities/wlansettingsui/inc/wlansettingsuistatuspane.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/loc/wlansettingsui.loc --- a/wlanutilities/wlansettingsui/loc/wlansettingsui.loc Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/rom/wlansettingsui.iby --- a/wlanutilities/wlansettingsui/rom/wlansettingsui.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/rom/wlansettingsuiresources.iby --- a/wlanutilities/wlansettingsui/rom/wlansettingsuiresources.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/src/wlansettingsui.cpp --- a/wlanutilities/wlansettingsui/src/wlansettingsui.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/src/wlansettingsuibinarypopupsettingitem.cpp --- a/wlanutilities/wlansettingsui/src/wlansettingsuibinarypopupsettingitem.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/src/wlansettingsuidlg.cpp --- a/wlanutilities/wlansettingsui/src/wlansettingsuidlg.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/src/wlansettingsuiimpl.cpp --- a/wlanutilities/wlansettingsui/src/wlansettingsuiimpl.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/src/wlansettingsuimainviewdlg.cpp --- a/wlanutilities/wlansettingsui/src/wlansettingsuimainviewdlg.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/src/wlansettingsuimodel.cpp --- a/wlanutilities/wlansettingsui/src/wlansettingsuimodel.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,327 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Implementation of class TWlanSettingsUiModel. -* -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include -#include "wlansettingsuimodel.h" -#include "wlansettingsuipanic.h" - -#include -#include -#include -#include -#include - -// CONSTANTS - -const TInt KWlanSettingsUiSecondsInMinute = 60; - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CWlanSettingsUiModel::NewL -// --------------------------------------------------------- -// -CWlanSettingsUiModel* CWlanSettingsUiModel::NewL - ( - CMDBSession* aSession, - CWlanMgmtClient* aWlanMgmtClient, - CRepository* aRepository - ) - { - CWlanSettingsUiModel* self = new( ELeave ) - CWlanSettingsUiModel(aSession, - aWlanMgmtClient, - aRepository); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------- -// CWlanSettingsUiModel::CWlanSettingsUiModel -// --------------------------------------------------------- -// -CWlanSettingsUiModel::CWlanSettingsUiModel - ( - CMDBSession* aSession, - CWlanMgmtClient* aWlanMgmtClient, - CRepository* aRepository - ) -: iShowWlanAvail( KWlanSettingsUiDefaultShowWlanAvail ), - iScanNetworks( KWlanSettingsUiDefaultScanNetwork ), - iPowerSaving( KWlanSettingsUiDefaultPowerSaving ), - iPsmMode( EFalse ), - iSession( aSession ), - iWlanMgmtClient( aWlanMgmtClient ), - iRepository( aRepository ), - iPsmSupported( EFalse ) - { - } - -// --------------------------------------------------------- -// CWlanSettingsUiModel::ConstructL -// --------------------------------------------------------- -// -void CWlanSettingsUiModel::ConstructL() - { - FeatureManager::InitializeLibL(); - // Set the member variable to indicate if full/partial PSM is on. - // This value stays the same for the whole WLAN Settings session, - // i.e. we ignore any mode changes during the session. - CheckPsmModeL(); - } - - -// --------------------------------------------------------- -// CWlanSettingsUiModel::~CWlanSettingsUiModel() -// --------------------------------------------------------- -// -CWlanSettingsUiModel::~CWlanSettingsUiModel() - { - FeatureManager::UnInitializeLib(); - } - -// --------------------------------------------------------- -// CWlanSettingsUiModel::LoadSettingsL -// --------------------------------------------------------- -// -void CWlanSettingsUiModel::LoadSettingsL() - { - TBool ownTransaction( EFalse ); - if( !iSession->IsInTransaction() ) - { - ownTransaction = ETrue; - iSession->OpenTransactionL(); - } - TMDBElementId tableId = 0; - - tableId = CCDWlanDeviceSettingsRecord::TableIdL( *iSession ); - - CCDWlanDeviceSettingsRecord* record = new( ELeave ) - CCDWlanDeviceSettingsRecord( tableId ); - CleanupStack::PushL( record ); - - record->iWlanDeviceSettingsType = KWlanUserSettings; - - if( record->FindL( *iSession ) ) - { - record->LoadL( *iSession ); - } - - // Read scan interval - - iScanNetworks = record->iBgScanInterval; - FixScanNetworks( record->iSavedBgScanInterval ); - - iPowerSaving = record->iWlanPowerMode; - CleanupStack::PopAndDestroy( record ); - - if ( ownTransaction ) - { - iSession->CommitTransactionL(); - // Rollback operation. - } - } - -// --------------------------------------------------------- -// CWlanSettingsUiModel::SaveSettingsL -// --------------------------------------------------------- -// -void CWlanSettingsUiModel::SaveSettingsL() - { - TBool ownTransaction( EFalse ); - if( !iSession->IsInTransaction() ) - { - ownTransaction = ETrue; - iSession->OpenTransactionL(); - } - TMDBElementId tableId = 0; - tableId = CCDWlanDeviceSettingsRecord::TableIdL( *iSession ); - - CCDWlanDeviceSettingsRecord* record = new( ELeave ) - CCDWlanDeviceSettingsRecord( tableId ); - - CleanupStack::PushL( record ); - - record->iWlanDeviceSettingsType = KWlanUserSettings; - - if( record->FindL( *iSession ) ) - { - record->LoadL( *iSession ); - } - - if ( iShowWlanAvail ) - { - record->iBgScanInterval = iScanNetworks; - } - else - { - record->iBgScanInterval = KWlanSettingsUiScanNetworkNever; - - // Do not change the saved interval value if in full or partial PSM Mode. - // We want to preserve the previous user-selected value in memory, not the - // forced PSM mode value (automatic). - if ( !PsmModeOn() ) - { - record->iSavedBgScanInterval = iScanNetworks; - } - } - - record->iWlanPowerMode = iPowerSaving; - - // Whenever settings are modified, iUseDefaultSettings must be set to false. - record->iUseDefaultSettings = EFalse; - - record->ModifyL( *iSession ); - - CleanupStack::PopAndDestroy( record ); - if ( ownTransaction ) - { - iSession->CommitTransactionL(); - } - -#ifndef __WINS__ - // Notifying WLAN Engine about changes in settings - iWlanMgmtClient->NotifyChangedSettings(); -#endif - } - -// --------------------------------------------------------- -// CWlanSettingsUiModel::FixScanNetworks -// --------------------------------------------------------- -// -void CWlanSettingsUiModel::FixScanNetworks( TUint aSavedScanInterval ) - { - if ( iScanNetworks == KWlanSettingsUiScanNetworkNever ) - { - iShowWlanAvail = EFalse; - - if( aSavedScanInterval == KWlanSettingsUiScanNetworkNever - || iPsmMode ) - { - iScanNetworks = KWlanSettingsUiDefaultScanNetwork; - } - else - { - iScanNetworks = FixScanInterval( aSavedScanInterval ); - } - } - - else - { - iShowWlanAvail = ETrue; - iScanNetworks = FixScanInterval( iScanNetworks ); - } - } - - -// --------------------------------------------------------- -// CWlanSettingsUiModel::FixScanInterval -// --------------------------------------------------------- -// -TUint CWlanSettingsUiModel::FixScanInterval( TUint aScanInterval ) - { - if( aScanInterval <= - ( EWlanSettingsUiScanNetworkMax * KWlanSettingsUiSecondsInMinute ) ) - { - // Return only full minutes - return aScanInterval - - ( aScanInterval % KWlanSettingsUiSecondsInMinute ); - } - else - { - return KWlanSettingsUiScanNetworkAuto; - } - } - -// --------------------------------------------------------- -// CWlanSettingsUiModel::CheckPsmModeL -// --------------------------------------------------------- -// -void CWlanSettingsUiModel::CheckPsmModeL() - { - iPsmSupported = FeatureManager::FeatureSupported( KFeatureIdPowerSave ); - if( iPsmSupported ) - { - TPsmsrvMode mode( EPsmsrvModeNormal ); - - CRepository* cenrep = NULL; - - TRAP_IGNORE( cenrep = CRepository::NewL( KCRUidPowerSaveMode ) ); - - if ( cenrep ) - { - TInt crValue(0); - cenrep->Get( KPsmCurrentMode, crValue ); - mode = static_cast( crValue ); - if ( mode == EPsmsrvModePowerSave || mode == EPsmsrvPartialMode ) - { - iPsmMode = ETrue; - } - else - { - iPsmMode = EFalse; - } - - delete cenrep; - cenrep = NULL; - } - } - } - -// --------------------------------------------------------- -// CWlanSettingsUiModel::ScanNetworks -// --------------------------------------------------------- -// -TUint CWlanSettingsUiModel::ScanNetworks() - { - if ( iScanNetworks == KWlanSettingsUiScanNetworkAuto ) - { - return iScanNetworks; - } - else - { - // Return scan time in minutes - return ( iScanNetworks / KWlanSettingsUiSecondsInMinute ); - } - } - -// --------------------------------------------------------- -// CWlanSettingsUiModel::SetScanNetworks -// --------------------------------------------------------- -// -void CWlanSettingsUiModel::SetScanNetworks( TUint aScanNetworks ) - { - if ( aScanNetworks == KWlanSettingsUiScanNetworkAuto ) - { - iScanNetworks = aScanNetworks; - } - else - { - // Scan time stored in seconds - iScanNetworks = aScanNetworks * KWlanSettingsUiSecondsInMinute; - } - } diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/src/wlansettingsuipanic.cpp --- a/wlanutilities/wlansettingsui/src/wlansettingsuipanic.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/src/wlansettingsuiscanintervalsettingitem.cpp --- a/wlanutilities/wlansettingsui/src/wlansettingsuiscanintervalsettingitem.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,200 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/src/wlansettingsuisettingitemlist.cpp --- a/wlanutilities/wlansettingsui/src/wlansettingsuisettingitemlist.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,301 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansettingsui/src/wlansettingsuistatuspane.cpp --- a/wlanutilities/wlansettingsui/src/wlansettingsuistatuspane.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aihelper/data/wsfaihelper.rss --- a/wlanutilities/wlansniffer/aihelper/data/wsfaihelper.rss Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Resource definitions for project AiHelper -* -*/ - - -NAME SNAH - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "wsfaihelper.hrh" - - -// --------------------------------------------------------- -// Resource file signature -// --------------------------------------------------------- -RESOURCE RSS_SIGNATURE { } - - -// --------------------------------------------------------- -// Default Document Name -// --------------------------------------------------------- -RESOURCE TBUF r_default_document_name { buf=""; } - - -// --------------------------------------------------------- -// Default menu and CBA key. -// --------------------------------------------------------- -RESOURCE EIK_APP_INFO - { - menubar = r_snifferaihelper_menubar; - cba = R_AVKON_SOFTKEYS_EXIT; - } - -RESOURCE MENU_BAR r_snifferaihelper_menubar - { - titles = - { - }; - } - - -// --------------------------------------------------------- -// r_sniffer_ai_helper_view -// Resource for AiHelper main view -// --------------------------------------------------------- -RESOURCE AVKON_VIEW r_sniffer_ai_helper_view - { - menubar = r_snifferaihelper_menubar; - } - - -//---------------------------------------------------------------------------- -// r_waitnote_connecting -// Connecting waitnote -//---------------------------------------------------------------------------- -RESOURCE DIALOG r_waitnote_connecting - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EWaitNoteConnecting; - control = AVKON_NOTE - { - layout = EWaitLayout; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - - - -//---------------------------------------------------------------------------- -// r_aihelper_localisable_app_info -// Localised application info -//---------------------------------------------------------------------------- -RESOURCE LOCALISABLE_APP_INFO r_aihelper_localisable_app_info - { - short_caption = qtn_sniffer_title; - caption_and_icon = - CAPTION_AND_ICON_INFO - { - caption = qtn_sniffer_title; - icon_file = "Z:"APP_BITMAP_DIR"\\wsficons_aif.mif"; - }; - } - -// END OF FILE diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aihelper/data/wsfaihelper_reg.rss --- a/wlanutilities/wlansniffer/aihelper/data/wsfaihelper_reg.rss Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aihelper/group/aihelper.mmp --- a/wlanutilities/wlansniffer/aihelper/group/aihelper.mmp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aihelper/group/bld.inf --- a/wlanutilities/wlansniffer/aihelper/group/bld.inf Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aihelper/inc/wsfaihelper.hrh --- a/wlanutilities/wlansniffer/aihelper/inc/wsfaihelper.hrh Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aihelper/inc/wsfaihelperapplication.h --- a/wlanutilities/wlansniffer/aihelper/inc/wsfaihelperapplication.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aihelper/inc/wsfaihelperappui.h --- a/wlanutilities/wlansniffer/aihelper/inc/wsfaihelperappui.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,233 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aihelper/inc/wsfaihelpercontainer.h --- a/wlanutilities/wlansniffer/aihelper/inc/wsfaihelpercontainer.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aihelper/inc/wsfaihelperdocument.h --- a/wlanutilities/wlansniffer/aihelper/inc/wsfaihelperdocument.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,173 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aihelper/inc/wsfaihelperdocument.inl --- a/wlanutilities/wlansniffer/aihelper/inc/wsfaihelperdocument.inl Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aihelper/inc/wsfaihelperview.h --- a/wlanutilities/wlansniffer/aihelper/inc/wsfaihelperview.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aihelper/rom/wsfaihelperapp.iby --- a/wlanutilities/wlansniffer/aihelper/rom/wsfaihelperapp.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aihelper/rom/wsfaihelperappresources.iby --- a/wlanutilities/wlansniffer/aihelper/rom/wsfaihelperappresources.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aihelper/src/wsfaihelper.cpp --- a/wlanutilities/wlansniffer/aihelper/src/wsfaihelper.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aihelper/src/wsfaihelperapplication.cpp --- a/wlanutilities/wlansniffer/aihelper/src/wsfaihelperapplication.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aihelper/src/wsfaihelperappui.cpp --- a/wlanutilities/wlansniffer/aihelper/src/wsfaihelperappui.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,440 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aihelper/src/wsfaihelpercontainer.cpp --- a/wlanutilities/wlansniffer/aihelper/src/wsfaihelpercontainer.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aihelper/src/wsfaihelperdocument.cpp --- a/wlanutilities/wlansniffer/aihelper/src/wsfaihelperdocument.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aihelper/src/wsfaihelperview.cpp --- a/wlanutilities/wlansniffer/aihelper/src/wsfaihelperview.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/data/10281cae.rss --- a/wlanutilities/wlansniffer/aiplugin/data/10281cae.rss Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/data/wsfaipluginrsc.rss --- a/wlanutilities/wlansniffer/aiplugin/data/wsfaipluginrsc.rss Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,381 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Resource definitions for project AiPlugin -* -*/ - - - -NAME WLPL - -#include -#include -#include -#include -#include -#include - -#include -#include - - -RESOURCE RSS_SIGNATURE { } - - -RESOURCE TBUF16 { buf=""; } - - - -// -------------------------------------------------------------------------- -// Localised strings -// -------------------------------------------------------------------------- -// -RESOURCE TBUF r_qtn_sniffer_plug_in_refreshing - { - buf = qtn_sniffer_plug_in_refreshing; - } - -RESOURCE TBUF r_qtn_sniffer_plug_in_connecting - { - buf = qtn_sniffer_plug_in_connecting; - } - -RESOURCE TBUF r_qtn_status_no_wlans_available - { - buf = qtn_sniffer_plug_in_no_wlans_found; - } - -RESOURCE TBUF r_qtn_sniffer_plug_in_scanning_off - { - buf = qtn_sniffer_plug_in_scanning_off; - } - -RESOURCE TBUF r_qtn_sniffer_plug_in_ssid_found - { - buf = qtn_sniffer_plug_in_ssid_found; - } - -RESOURCE TBUF r_qtn_sniffer_plug_in_unknown_ssid_found - { - buf = qtn_sniffer_plug_in_unknown_wlan_found; - } - -RESOURCE TBUF r_qtn_sniffer_plug_in_unknown_ssids_found - { - buf = qtn_sniffer_plug_in_unknown_wlans_found; - } - -RESOURCE TBUF r_qtn_sniffer_plug_in_connected_to_ssid - { - buf = qtn_sniffer_plug_in_iap_connected; - } - -RESOURCE TBUF r_qtn_wlan_manual_ssid_input - { - buf = qtn_wlan_manual_ssid_input; - } - -RESOURCE TBUF r_qtn_msk_sniffer_activate - { - buf = qtn_msk_sniffer_activate; - } - -RESOURCE TBUF r_qtn_ai_wizard_title - { - buf = qtn_ai_wizard_title; - } - -RESOURCE TBUF r_qtn_wlan_info_no_networks_found - { - buf = qtn_wlan_info_no_networks_found; - } - -RESOURCE TBUF r_qtn_wlan_info_connection_already_active - { - buf = qtn_wlan_info_connection_already_active; - } - -RESOURCE TBUF r_qtn_sniffer_plug_in_connected_to - { - buf = qtn_sniffer_plug_in_connected_to; - } - -RESOURCE TBUF r_qtn_sniffer_plug_in_wlan_network_found - { - buf = qtn_sniffer_plug_in_wlan_network_found; - } - -RESOURCE TBUF r_ssid - { - buf = L"'%U[16]'"; - } - - -// -------------------------------------------------------------------------- -// r_qtn_aiplugin_options_offline_items -// Options menu items for 'Offline' state -// -------------------------------------------------------------------------- -// -RESOURCE ARRAY r_qtn_aiplugin_options_offline_items - { - items = - { - LBUF - { - txt = qtn_sniffer_opt_start_web_browsing; - }, - LBUF - { - txt = qtn_sniffer_opt_connect; - }, - LBUF - { - txt = qtn_sniffer_plug_in_options_search_wlan_networks; - }, - LBUF - { - txt = qtn_sniffer_opt_set_scanning_off; - } - }; - } - - -// -------------------------------------------------------------------------- -// r_qtn_aiplugin_options_connected_items -// Options menu items for 'Connected' state -// -------------------------------------------------------------------------- -// -RESOURCE ARRAY r_qtn_aiplugin_options_connected_items - { - items = - { - LBUF - { - txt = qtn_sniffer_opt_start_web_browsing; - }, - LBUF - { - txt = qtn_sniffer_opt_disconnect_wlan; - } - }; - } - - -// -------------------------------------------------------------------------- -// r_qtn_aiplugin_options_connecting_items -// Options menu items for 'Connecting' state -// -------------------------------------------------------------------------- -// -RESOURCE ARRAY r_qtn_aiplugin_options_connecting_items - { - items = - { - LBUF - { - txt = qtn_sniffer_opt_disconnect_wlan; - } - }; - } - - -// -------------------------------------------------------------------------- -// r_qtn_aiplugin_options_browsing_items -// Options menu items for 'Browsing' state -// -------------------------------------------------------------------------- -// -RESOURCE ARRAY r_qtn_aiplugin_options_browsing_items - { - items = - { - LBUF - { - txt = qtn_sniffer_opt_continue_web_browsing; - }, - LBUF - { - txt = qtn_sniffer_opt_disconnect_wlan; - } - }; - } - - -// -------------------------------------------------------------------------- -// r_qtn_aiplugin_options_offline -// Options menu in 'Offline' state -// -------------------------------------------------------------------------- -// -RESOURCE AVKON_LIST_QUERY r_qtn_aiplugin_options_offline - { - flags = EGeneralQueryFlags; - softkeys = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT; - items = - { - AVKON_LIST_QUERY_DLG_LINE - { - control = AVKON_LIST_QUERY_CONTROL - { - listtype = EAknCtSinglePopupMenuListBox; - listbox = AVKON_LIST_QUERY_LIST - { - array_id = r_qtn_aiplugin_options_offline_items; - }; - }; - } - }; - } - - -// -------------------------------------------------------------------------- -// r_qtn_aiplugin_options_connected -// Options menu in 'Connected' state -// -------------------------------------------------------------------------- -// -RESOURCE AVKON_LIST_QUERY r_qtn_aiplugin_options_connected - { - flags = EGeneralQueryFlags; - softkeys = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT; - items = - { - AVKON_LIST_QUERY_DLG_LINE - { - control = AVKON_LIST_QUERY_CONTROL - { - listtype = EAknCtSinglePopupMenuListBox; - listbox = AVKON_LIST_QUERY_LIST - { - array_id = r_qtn_aiplugin_options_connected_items; - }; - }; - } - }; - } - - -// -------------------------------------------------------------------------- -// r_qtn_aiplugin_options_connecting -// Options menu in 'Connecting' state -// -------------------------------------------------------------------------- -// -RESOURCE AVKON_LIST_QUERY r_qtn_aiplugin_options_connecting - { - flags = EGeneralQueryFlags; - softkeys = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT; - items = - { - AVKON_LIST_QUERY_DLG_LINE - { - control = AVKON_LIST_QUERY_CONTROL - { - listtype = EAknCtSinglePopupMenuListBox; - listbox = AVKON_LIST_QUERY_LIST - { - array_id = r_qtn_aiplugin_options_connecting_items; - }; - }; - } - }; - } - - -// -------------------------------------------------------------------------- -// r_qtn_aiplugin_options_browsing -// Options menu in 'Browsing' state -// -------------------------------------------------------------------------- -// -RESOURCE AVKON_LIST_QUERY r_qtn_aiplugin_options_browsing - { - flags = EGeneralQueryFlags; - softkeys = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT; - items = - { - AVKON_LIST_QUERY_DLG_LINE - { - control = AVKON_LIST_QUERY_CONTROL - { - listtype = EAknCtSinglePopupMenuListBox; - listbox = AVKON_LIST_QUERY_LIST - { - array_id = r_qtn_aiplugin_options_browsing_items; - }; - }; - } - }; - } - - -// -------------------------------------------------------------------------- -// r_qtn_plugin_search_wlan_networks -// Search for wlan networks query -// -------------------------------------------------------------------------- -// -RESOURCE AVKON_LIST_QUERY r_qtn_plugin_search_wlan_networks - { - flags = EGeneralQueryFlags; - softkeys = r_qtn_plugin_search_wlan_network_buttons; - items = - { - AVKON_LIST_QUERY_DLG_LINE - { - control = AVKON_LIST_QUERY_CONTROL - { - listtype = EAknCtSingleGraphicPopupMenuListBox; - heading = qtn_wlan_prmpt_select_network; - listbox = AVKON_LIST_QUERY_LIST - { - }; - }; - } - }; - } - - -// -------------------------------------------------------------------------- -// r_qtn_plugin_search_wlan_network_buttons -// CBA buttons for search for wlan networks query -// -------------------------------------------------------------------------- -// -RESOURCE CBA r_qtn_plugin_search_wlan_network_buttons - { - buttons = - { - CBA_BUTTON { id = EEikBidOk; txt = qtn_sniffer_softkey_connect; }, - CBA_BUTTON { id = EEikBidCancel; txt = text_softkey_cancel; }, - CBA_BUTTON { id = EEikBidOk; txt = ""; } - }; - } - - -//---------------------------------------------------------------------------- -// r_restart_browsing_confirmation_query -// Query to restart browser with WLAN -//---------------------------------------------------------------------------- -RESOURCE DIALOG r_restart_browsing_confirmation_query - { - flags=EGeneralQueryFlags; - buttons=R_AVKON_SOFTKEYS_YES_NO__YES; - items= - { - DLG_LINE - { - type=EAknCtQuery; - id = EGeneralQuery; - control= AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationQueryLayout; - }; - } - }; - } - - diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/group/aiplugin.mmp --- a/wlanutilities/wlansniffer/aiplugin/group/aiplugin.mmp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 -LIBRARY connectionuiutilities.lib - -DEBUGLIBRARY flogger.lib - -// End of File. diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/group/bld.inf --- a/wlanutilities/wlansniffer/aiplugin/group/bld.inf Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/inc/wsfactivewaiter.h --- a/wlanutilities/wlansniffer/aiplugin/inc/wsfactivewaiter.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/inc/wsfaicontroller.h --- a/wlanutilities/wlansniffer/aiplugin/inc/wsfaicontroller.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,366 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/inc/wsfaicontrollercmds.h --- a/wlanutilities/wlansniffer/aiplugin/inc/wsfaicontrollercmds.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/inc/wsfaimodel.h --- a/wlanutilities/wlansniffer/aiplugin/inc/wsfaimodel.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,358 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/inc/wsfaimodel.inl --- a/wlanutilities/wlansniffer/aiplugin/inc/wsfaimodel.inl Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/inc/wsfaiplugin.h --- a/wlanutilities/wlansniffer/aiplugin/inc/wsfaiplugin.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,465 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/inc/wsfaiplugincommon.h --- a/wlanutilities/wlansniffer/aiplugin/inc/wsfaiplugincommon.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/inc/wsfaiplugincontentmodel.h --- a/wlanutilities/wlansniffer/aiplugin/inc/wsfaiplugincontentmodel.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/inc/wsfaipluginuids.hrh --- a/wlanutilities/wlansniffer/aiplugin/inc/wsfaipluginuids.hrh Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/inc/wsfaipublishobserver.h --- a/wlanutilities/wlansniffer/aiplugin/inc/wsfaipublishobserver.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/inc/wsfaiuiobserver.h --- a/wlanutilities/wlansniffer/aiplugin/inc/wsfaiuiobserver.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/inc/wsfaiview.h --- a/wlanutilities/wlansniffer/aiplugin/inc/wsfaiview.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,263 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/inc/wsfdbobserver.h --- a/wlanutilities/wlansniffer/aiplugin/inc/wsfdbobserver.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/inc/wsficonarraycreator.h --- a/wlanutilities/wlansniffer/aiplugin/inc/wsficonarraycreator.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/inc/wsfsearchwlansdialog.h --- a/wlanutilities/wlansniffer/aiplugin/inc/wsfsearchwlansdialog.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/loc/wsfaiplugin.loc --- a/wlanutilities/wlansniffer/aiplugin/loc/wsfaiplugin.loc Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/rom/wsfaiplugin.iby --- a/wlanutilities/wlansniffer/aiplugin/rom/wsfaiplugin.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/rom/wsfaipluginresources.iby --- a/wlanutilities/wlansniffer/aiplugin/rom/wsfaipluginresources.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/src/wsfactivewaiter.cpp --- a/wlanutilities/wlansniffer/aiplugin/src/wsfactivewaiter.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/src/wsfaicontroller.cpp --- a/wlanutilities/wlansniffer/aiplugin/src/wsfaicontroller.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1259 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of TWsfAiController. -* -*/ - - -// EXTERNAL INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// CLASS HEADER -#include "wsfaicontroller.h" - -// INTERNAL INCLUDES -#include "wsfwlaninfo.h" -#include "wsfwlaninfoarray.h" -#include "wsfaiuiobserver.h" -#include "wsfaimodel.h" -#include "wsficonarraycreator.h" -#include "wsfmodel.h" -#include "wsfsearchwlansdialog.h" -#include "wsfaicontrollercmds.h" -#include "wsfactivewaiter.h" -#include "wsflogger.h" -#include "wsfdbobserver.h" - - -// 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 ); - } - - // 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 - CConnectionUiUtilities* connUiUtils = CConnectionUiUtilities::NewL(); - connUiUtils->NoWLANNetworksAvailableNote(); - delete connUiUtils; - } - - // 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/src/wsfaimodel.cpp --- a/wlanutilities/wlansniffer/aiplugin/src/wsfaimodel.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,673 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/src/wsfaiplugin.cpp --- a/wlanutilities/wlansniffer/aiplugin/src/wsfaiplugin.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1057 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/src/wsfaipluginproxy.cpp --- a/wlanutilities/wlansniffer/aiplugin/src/wsfaipluginproxy.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/src/wsfaiview.cpp --- a/wlanutilities/wlansniffer/aiplugin/src/wsfaiview.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,463 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/src/wsfdbobserver.cpp --- a/wlanutilities/wlansniffer/aiplugin/src/wsfdbobserver.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,255 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/src/wsficonarraycreator.cpp --- a/wlanutilities/wlansniffer/aiplugin/src/wsficonarraycreator.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,370 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/aiplugin/src/wsfsearchwlansdialog.cpp --- a/wlanutilities/wlansniffer/aiplugin/src/wsfsearchwlansdialog.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,197 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/apwizard/bwins/wsfapwizardu.def --- a/wlanutilities/wlansniffer/apwizard/bwins/wsfapwizardu.def Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/apwizard/data/wsfapwizard.rss --- a/wlanutilities/wlansniffer/apwizard/data/wsfapwizard.rss Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,369 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/apwizard/eabi/wsfapwizardu.def --- a/wlanutilities/wlansniffer/apwizard/eabi/wsfapwizardu.def Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -EXPORTS - _ZN17CWsfWlanIapWizard13LaunchWizardLER12TWsfWlanInfoi @ 1 NONAME - _ZN17CWsfWlanIapWizard18CreateAccessPointLEv @ 2 NONAME - _ZN17CWsfWlanIapWizard4NewLEv @ 3 NONAME - _ZN17CWsfWlanIapWizard5NewLCEv @ 4 NONAME - _ZN17CWsfWlanIapWizardD0Ev @ 5 NONAME - _ZN17CWsfWlanIapWizardD1Ev @ 6 NONAME - _ZN17CWsfWlanIapWizardD2Ev @ 7 NONAME - diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/apwizard/group/apwizard.mmp --- a/wlanutilities/wlansniffer/apwizard/group/apwizard.mmp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/apwizard/group/bld.inf --- a/wlanutilities/wlansniffer/apwizard/group/bld.inf Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/apwizard/inc/wsfactivewaiter.h --- a/wlanutilities/wlansniffer/apwizard/inc/wsfactivewaiter.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/apwizard/inc/wsfapwizard.hrh --- a/wlanutilities/wlansniffer/apwizard/inc/wsfapwizard.hrh Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/apwizard/inc/wsfwlaniapcreator.h --- a/wlanutilities/wlansniffer/apwizard/inc/wsfwlaniapcreator.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,174 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/apwizard/inc/wsfwlaniapwizard.h --- a/wlanutilities/wlansniffer/apwizard/inc/wsfwlaniapwizard.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,221 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/apwizard/inc/wsfwlanssiddiscovery.h --- a/wlanutilities/wlansniffer/apwizard/inc/wsfwlanssiddiscovery.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/apwizard/loc/wsfapwizard.loc --- a/wlanutilities/wlansniffer/apwizard/loc/wsfapwizard.loc Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,156 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Localization strings for project AP Wizard -* -*/ - - -//d: Query to make sure the user wants to create an IAP for the given WLAN network -//l: popup_note_window -//r:3.0 -// -#define qtn_cmon_quest_create_wlan_iap "Create internet access point for WLAN network '%U'?" - -//d: An information note with the text is shown if access point creation succeed -//d: %U = Name of the access point which was created. -//l: popup_note_window -//r:3.0 -// -#define qtn_cmon_conf_wlan_iap_created "Internet access point defined for WLAN network '%U'" - - - -//------------------------------------------------------------------------------ -// Following string are defined on networking specification * -//------------------------------------------------------------------------------ - - -//d: A data query prompt text -//d: copied from S60: qtn_wlan_prmpt_network_name -//l: popup_query_data_window -//r:3.0 -// -#define qtn_wlan_prmpt_network_name "WLAN network name:" - - - -//d: Title of the Network mode dialog -//d: in the manual configuration of a new WLAN connection method -//l: heading_pane_t1 -//w: -//r:3.2 -// -#define qtn_netw_conset_prmpt_wlan_nw_mode_and_status "Network mode and status:" - -//d:Network mode selection list, sets the network mode setting -//d:to 'infrastructure' and network status to 'Public' -//l:list_single_pane_t1_cp2 -//w: -//r:3.2 -// -#define qtn_wlan_network_mode_infra_public "Infrastructure (public)" - -//d:Network mode selection list, sets the network mode setting -//d:to 'infrastructure' and network status to 'hidden' -//l:list_single_pane_t1_cp2 -//w: -//r:3.2 -// -#define qtn_wlan_network_mode_infra_hidden "Infrastructure (hidden)" - -//d:Network mode selection list, sets the network mode setting -//d:to 'Ad-hoc' and network status to 'Public' -//l:list_single_pane_t1_cp2 -//w: -//r:3.2 -// -#define qtn_wlan_network_mode_adhoc_public "Ad-hoc (public)" - -//d: Title of the Security Mode selection dialog -//d: in the manual configuration of a new WLAN connection method -//l: heading_pane_t1 -//w: -//r:3.2 -// -#define qtn_netw_conset_prmpt_wlan_nw_security_mode "Security Mode:" - -//d:Default value for WLAN security mode -//l:list_single_pane_t1_cp2 -//w: -//r:3.2 -// -#define qtn_netw_conset_wlan_security_mode_open "Open network" - -//d:Security settings mode "WEP" -//l:list_single_pane_t1_cp2 -//w: -//r:3.2 -// -#define qtn_netw_conset_wlan_security_mode_wep "WEP" - -//d:Security settings mode "802.1x" -//l:list_single_pane_t1_cp2 -//w: -//r:3.2 -// -#define qtn_netw_conset_wlan_security_mode_802_1x "802.1x" - -//d:Security settings mode "WPA/WPA2" -//l:list_single_pane_t1_cp2 -//w: -//r:3.2 -// -#define qtn_netw_conset_wlan_security_mode_wpa "WPA/WPA2" - - - -//d: Title of the WPA/WPA2 mode selection dialog in the manual -//d: configuration of a new WLAN connection method -//l: heading_pane_t1 -//w: -//r:3.2 -// -#define qtn_netw_conset_prmpt_wlan_wpa_mode "WPA/WPA2 mode:" - -//d:EAP item in the WPA/WPA2 mode selection dialog -//l:list_single_pane_t1_cp2 -//w: -//r:3.2 -// -#define qtn_netw_conset_prmpt_wpa_mode_eap "EAP" - -//d:Pre-shared item item in the WPA/WPA2 mode selection dialog -//l:list_single_pane_t1_cp2 -//w: -//r:3.2 -// -#define qtn_netw_conset_prmpt_wpa_mode_psk "Pre-shared key" - -//d: Note to indicate to user that the default EAP values have -//d: been set and advanced values can be edited in the -//d: security settings of the connection method -//l: popup_note_window -//w: -//r:3.2 -// -#define qtn_netw_conset_info_eap_settings_default "Default EAP values set. Configure advanced settings by editing the method." - -//d: Text of an information note used to ensure the user the a new connection -//d: method has been added successfully. -//l: popup_note_window -//w: -//r: 5.0 -// -#define qtn_netw_conset_conf_new_method_added "New connection method for '%U' added" - diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/apwizard/rom/wsfapwizard.iby --- a/wlanutilities/wlansniffer/apwizard/rom/wsfapwizard.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/apwizard/rom/wsfapwizardresources.iby --- a/wlanutilities/wlansniffer/apwizard/rom/wsfapwizardresources.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/apwizard/src/wsfactivewaiter.cpp --- a/wlanutilities/wlansniffer/apwizard/src/wsfactivewaiter.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/apwizard/src/wsfwlaniapcreator.cpp --- a/wlanutilities/wlansniffer/apwizard/src/wsfwlaniapcreator.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,575 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/apwizard/src/wsfwlaniapwizard.cpp --- a/wlanutilities/wlansniffer/apwizard/src/wsfwlaniapwizard.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,679 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of CWsfWlanIapWizard -* -*/ - - - -// EXTERNAL INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// CLASS HEADER -#include "wsfwlaniapwizard.h" - -// INTERNAL INCLUDES -#include "wsfwlaniapcreator.h" -#include "wsfwlanssiddiscovery.h" -#include "wsflogger.h" - - - -using namespace CMManager; - - -/** -* ROM folder -*/ -_LIT( KDriveZ, "z:" ); - -/** -* Resource file name -*/ -_LIT( KResourceFileName, "wsfapwizard.rsc" ); - -/** -* the longest possible key is the 64 character long hex WPA key -*/ -static const TInt KMaxSecureKeyLength = 64; - - - -#ifdef _DEBUG - _LIT( KApWizardPanic, "wsfapwizard" ); - #define __ASSERTD( v ) __ASSERT_DEBUG( (v), \ - User::Panic( KApWizardPanic, 0 ) ) -#else - #define __ASSERTD( v ) -#endif - - - -// ---------------------------------------------------------------------------- -// CWsfWlanIapWizard::NewL -// ---------------------------------------------------------------------------- -// -EXPORT_C CWsfWlanIapWizard* CWsfWlanIapWizard::NewL() - { - CWsfWlanIapWizard* thisPtr = NewLC(); - CleanupStack::Pop( thisPtr ); - return thisPtr; - } - - -// ---------------------------------------------------------------------------- -// CWsfWlanIapWizard::NewLC -// ---------------------------------------------------------------------------- -// -EXPORT_C CWsfWlanIapWizard* CWsfWlanIapWizard::NewLC() - { - CWsfWlanIapWizard* thisPtr = new (ELeave) CWsfWlanIapWizard(); - CleanupStack::PushL( thisPtr ); - thisPtr->ConstructL(); - return thisPtr; - } - - -// ---------------------------------------------------------------------------- -// CWsfWlanIapWizard::CWsfWlanIapWizard -// ---------------------------------------------------------------------------- -// -CWsfWlanIapWizard::CWsfWlanIapWizard(): - iEnv( *CEikonEnv::Static() ), - iResourceFileOffset( -1 ), - iWlanInfo( NULL ) - { - } - - -// ---------------------------------------------------------------------------- -// CWsfWlanIapWizard::ConstructL -// ---------------------------------------------------------------------------- -// -void CWsfWlanIapWizard::ConstructL() - { - iResourceFileOffset = InitResourcesL( iEnv ); - - iCreator = CWsfWlanIapCreator::NewL(); - iSsidDiscovery = CWsfWlanSsidDiscovery::NewL(); - } - - -// ---------------------------------------------------------------------------- -// CWsfWlanIapWizard::~CWsfWlanIapWizard -// ---------------------------------------------------------------------------- -// -EXPORT_C CWsfWlanIapWizard::~CWsfWlanIapWizard() - { - delete iCreator; - - ReleaseResources( iEnv, iResourceFileOffset ); - - delete iUsedPassword; - delete iWaitDialog; - delete iSsidDiscovery; - } - - -// --------------------------------------------------------------------------- -// CWsfWlanIapWizard::InitResourcesL -// --------------------------------------------------------------------------- -// -TInt CWsfWlanIapWizard::InitResourcesL( CEikonEnv& aEnv ) - { - // The resource has to be loaded manually since it is not an application. - TFileName resourceFileName; - - resourceFileName.Append( KDriveZ ); - resourceFileName.Append( KDC_RESOURCE_FILES_DIR ); - resourceFileName.Append( KResourceFileName ); - - BaflUtils::NearestLanguageFile( aEnv.FsSession(), resourceFileName ); - - return aEnv.AddResourceFileL( resourceFileName ); - } - - -// --------------------------------------------------------------------------- -// CWsfWlanIapWizard::ReleaseResources -// --------------------------------------------------------------------------- -// -void CWsfWlanIapWizard::ReleaseResources( CEikonEnv& aEnv, TInt aResOffset ) - { - if ( aResOffset != -1 ) - { - aEnv.DeleteResourceFile( aResOffset ); - } - } - - -// ---------------------------------------------------------------------------- -// CWsfWlanIapWizard::LaunchWizardL -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool CWsfWlanIapWizard::LaunchWizardL( TWsfWlanInfo& aWlanInfo, - TBool aDefineNewAccessPoint ) - { - LOG_ENTERFN( "CWsfWlanIapWizard::LaunchWizardL" ); - LOG_WRITEF( "defineAp = %d", aDefineNewAccessPoint ); - - if ( aDefineNewAccessPoint && - !( aWlanInfo.Hidden() && !aWlanInfo.Known() ) ) - { - HBufC* ssid16 = aWlanInfo.GetSsidAsUnicodeLC(); - LOG_WRITEF( "ssid = %S", ssid16 ); - HBufC* infoText = StringLoader::LoadLC( - R_QTN_CMON_QUEST_CREATE_WLAN_IAP, - *ssid16 ); - - CAknQueryDialog* confirmQuery = CAknQueryDialog::NewL(); - TBool result = confirmQuery->ExecuteLD( - R_QTN_WIZARD_CONFIRMATION_QUERY, - *infoText ); - - CleanupStack::PopAndDestroy( infoText ); - CleanupStack::PopAndDestroy( ssid16 ); - - if ( !result ) - { - return result; - } - } - - iWlanInfo = &aWlanInfo; - iDefineNewAccessPoint = aDefineNewAccessPoint; - - TRAPD( err, AskNetworkDetailsL() ); - if ( err ) - { - // We are here also if selection of - // the hidden network AP leaves or is - // cancelled by the end-user - LOG_WRITE( "AskNetworkDetailsL failed" ); - } - - return ( !err ); - } - - -// ---------------------------------------------------------------------------- -// CWsfWlanIapWizard::CreateAccessPointL -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool CWsfWlanIapWizard::CreateAccessPointL() - { - LOG_ENTERFN( "CWsfWlanIapWizard::CreateAccessPointL" ); - __ASSERTD( iWlanInfo ); - - - if ( iWlanInfo->iIapId != 0 ) - { - // Access Point already exists - User::Leave( KErrAlreadyExists ); - } - - - // otherwise new Access Point will be created - if ( !iWlanInfo->iSsid.Length() ) - { - User::Leave( KErrGeneral ); - } - - TPtrC sharedKey = iUsedPassword ? *iUsedPassword : KNullDesC(); - - TUint32 destId( 0 ); - - if ( iDefineNewAccessPoint ) - { - // define access point was selected, select destination query follows - LOG_WRITE( "defineAp = ETrue, opening select destination dialog..." ); - - CCmSettingsUi* settings = CCmSettingsUi::NewL(); - CleanupStack::PushL( settings ); - - TBool result( EFalse ); - result = settings->SelectDestinationDlgL( destId ); - - CleanupStack::PopAndDestroy( settings ); //settings - - if ( !result ) - { - LOG_WRITE( "dialog cancelled" ); - // cancel was pressed, abort creation - return EFalse; - } - LOG_WRITEF( "target destination = %d", destId ); - } - - iCreator->SetDefaultDestination( destId ); - - iCreator->CreateAccessPointL( *iWlanInfo, sharedKey, iIsHexWep ); - - return ETrue; - } - - -// ---------------------------------------------------------------------------- -// CWsfWlanIapWizard::QueryTextL -// ---------------------------------------------------------------------------- -// -TInt CWsfWlanIapWizard::QueryTextL( TInt aQueryStringResource, - TDes& aVariable, - const TInt &aMaxLength ) - { - LOG_ENTERFN( "CWsfWlanIapWizard::QueryTextL" ); - HBufC* queryText = StringLoader::LoadLC( aQueryStringResource ); - CAknTextQueryDialog* textQuery = CAknTextQueryDialog::NewL( aVariable ); - CleanupStack::PushL( textQuery ); - textQuery->SetPromptL( *queryText ); - textQuery->SetMaxLength( aMaxLength ); - CleanupStack::Pop( textQuery ); - TInt result = textQuery->ExecuteLD( R_QTN_WIZARD_QUERY_GENERAL ); - CleanupStack::PopAndDestroy( queryText ); - return result; - } - - -// ---------------------------------------------------------------------------- -// CWsfWlanIapWizard::QuerySecureKeyL -// ---------------------------------------------------------------------------- -// -TBool CWsfWlanIapWizard::QuerySecureKeyL() - { - LOG_ENTERFN( "CWsfWlanIapWizard::QuerySecureKeyL" ); - TBool okPressed( ETrue ); - - switch ( iWlanInfo->iSecurityMode ) - { - case EWlanSecModeWep: - { - LOG_WRITE( "secmode WEP" ); - CConnectionUiUtilities* connUiUtils = - CConnectionUiUtilities::NewL(); - CleanupStack::PushL( connUiUtils ); - iUsedPassword = HBufC::NewL( KMaxSecureKeyLength ); - TPtr ptr( iUsedPassword->Des() ); - okPressed = connUiUtils->EasyWepDlg( &ptr, iIsHexWep ); - CleanupStack::PopAndDestroy( connUiUtils ); - break; - } - - case EWlanSecModeWpa: - case EWlanSecModeWpa2: - case EWlanSecMode802_1x: - { - if ( iWlanInfo->UsesPreSharedKey() ) - { - // WPA-PSK - LOG_WRITE( "secmode WPA-PSK" ); - - CConnectionUiUtilities* connUiUtils = - CConnectionUiUtilities::NewL(); - CleanupStack::PushL( connUiUtils ); - iUsedPassword = HBufC::NewL( KMaxSecureKeyLength ); - TPtr ptr( iUsedPassword->Des() ); - okPressed = connUiUtils->EasyWpaDlg( &ptr ); - CleanupStack::PopAndDestroy( connUiUtils ); - } - else - { - // no key prompt in EAP mode, but the usual note is shown - LOG_WRITE( "secmode WPA-EAP" ); - - HBufC* eapText = StringLoader::LoadLC( - R_QTN_NETW_CONSET_INFO_EAP_SETTINGS_DEFAULT ); - CAknInformationNote* informationNote = - new (ELeave) CAknInformationNote( ETrue ); - informationNote->ExecuteLD( *eapText ); - - CleanupStack::PopAndDestroy( eapText ); - } - - break; - } - - case EWlanSecModeOpen: - default: - { - LOG_WRITE( "secmode Open" ); - - delete iUsedPassword; - iUsedPassword = NULL; - } - } - - return okPressed; - } - - -// ---------------------------------------------------------------------------- -// CWsfWlanIapWizard::DismissWaitNote -// ---------------------------------------------------------------------------- -// -void CWsfWlanIapWizard::DismissWaitNote( TAny* aPtr ) - { - LOG_ENTERFN( "CWsfWlanIapWizard::DismissWaitNote" ); - CWsfWlanIapWizard* self = static_cast( aPtr ); - - if ( self->iWaitDialog ) - { - // close waitnote - LOG_WRITE( "closing waitnote..." ); - TRAP_IGNORE( self->iWaitDialog->ProcessFinishedL() ); - - // cleanup - delete self->iWaitDialog; - self->iWaitDialog = NULL; - } - } - - -// ---------------------------------------------------------------------------- -// CWsfWlanIapWizard::AskNetworkDetailsL -// ---------------------------------------------------------------------------- -// -void CWsfWlanIapWizard::AskNetworkDetailsL() - { - LOG_ENTERFN( "CWsfWlanIapWizard::AskNetworkDetailsL" ); - - - // check the wlan info, and make proper questions.... - if ( iWlanInfo->Hidden() && !iWlanInfo->Known() ) - { - LOG_WRITE( "unlisted network" ); - - // query network SSID - HBufC* ssid16 = AskSsidL(); - LOG_WRITEF( "SSID: [%S]", ssid16 ); - - // update SSID - CnvUtfConverter::ConvertFromUnicodeToUtf8( iWlanInfo->iSsid, *ssid16 ); - delete ssid16; - - // pop up waitnote - iWaitDialog = new ( ELeave ) CAknWaitDialog( - reinterpret_cast( &iWaitDialog ), ETrue ); - iWaitDialog->SetCallback( this ); - iWaitDialog->ExecuteLD( R_SEARCHING_WLAN_WAIT_NOTE ); - - CleanupStack::PushL( TCleanupItem( DismissWaitNote, this ) ); - - // start to scan for surrounding WLAN networks - TBool foundSsid( EFalse ); - TBool usePsk( EFalse ); - TWlanSsid ssid( iWlanInfo->iSsid ); - - // make a broadcast scan - LOG_WRITE( "broadcast scanning for SSID" ); - foundSsid = iSsidDiscovery->ScanForSsidL( ssid, ETrue, - iWlanInfo->iNetMode, - iWlanInfo->iSecurityMode, - usePsk ); - - // SSID found? - if ( !foundSsid ) - { - // must be really hidden, direct scan for SSID - LOG_WRITE( "broadcast scan failed, direct scanning for SSID" ); - foundSsid = iSsidDiscovery->ScanForSsidL( ssid, EFalse, - iWlanInfo->iNetMode, - iWlanInfo->iSecurityMode, - usePsk ); - - // it can only be found as hidden - iWlanInfo->iVisibility = EFalse; - - CleanupStack::PopAndDestroy( 1 ); // DismissWaitNote - - if ( !foundSsid ) - { - LOG_WRITE( "direct scan failed, entering fully manual mode" ); - - // pop up discreet popup: No WLANs found - CConnectionUiUtilities* connUiUtils = CConnectionUiUtilities::NewL(); - connUiUtils->NoWLANNetworksAvailableNote(); - delete connUiUtils; - - // now entering fully manual mode - - // query network mode - TInt mode( 0 ); - CAknListQueryDialog* listQuery = - new (ELeave) CAknListQueryDialog( &mode ); - listQuery->PrepareLC( R_QTN_WIZARD_NETWORK_MODE ); - TInt retval = listQuery->RunLD(); - if ( !retval ) - { - User::Leave( KErrCancel ); - } - - const TInt KModeInfraPublic = 0; - const TInt KModeInfraHidden = 1; - const TInt KModeAdhocPublic = 2; - - TBool adhoc( EFalse ); - - switch ( mode ) - { - case KModeInfraPublic: - { - LOG_WRITE( "infra public mode" ); - iWlanInfo->iNetMode = EInfra; - iWlanInfo->iVisibility = ETrue; - break; - } - - case KModeInfraHidden: - { - LOG_WRITE( "infra hidden mode" ); - iWlanInfo->iNetMode = EInfra; - iWlanInfo->iVisibility = EFalse; - break; - } - - case KModeAdhocPublic: - { - LOG_WRITE( "adhoc public mode" ); - adhoc = ETrue; - iWlanInfo->iNetMode = EAdhoc; - iWlanInfo->iVisibility = ETrue; - break; - } - } - - - // query security mode - const TInt KSecModeOpen = 0; - const TInt KSecModeWep = 1; - const TInt KSecMode8021x = 2; - const TInt KSecModeWpa = 3; - - mode = KSecModeOpen; - listQuery = new (ELeave) CAknListQueryDialog( &mode ); - - if ( adhoc ) - { - listQuery->PrepareLC( R_QTN_WIZARD_AUTH_MODE_AD_HOC ); - } - else - { - listQuery->PrepareLC( R_QTN_WIZARD_AUTH_MODE ); - } - - retval = listQuery->RunLD(); - - if ( !retval ) - { - User::Leave( KErrCancel ); - } - - // map the security mode - - switch ( mode ) - { - case KSecModeWep: - { - LOG_WRITE( "security: WEP" ); - iWlanInfo->iSecurityMode = EWlanSecModeWep; - break; - } - case KSecMode8021x: - { - LOG_WRITE( "security: 802.1x" ); - iWlanInfo->iSecurityMode = EWlanSecMode802_1x; - break; - } - case KSecModeWpa: - { - LOG_WRITE( "security: WPA" ); - iWlanInfo->iSecurityMode = EWlanSecModeWpa; - break; - } - - case KSecModeOpen: - default: - { - LOG_WRITE( "security: Open" ); - iWlanInfo->iSecurityMode = EWlanSecModeOpen; - } - } - - // if WPA, query WPA mode - if ( iWlanInfo->iSecurityMode == EWlanSecModeWpa ) - { - const TInt KWpaModeEap = 0; - const TInt KWpaModePsk = 1; - - mode = KWpaModeEap; - listQuery = new (ELeave) CAknListQueryDialog( &mode ); - listQuery->PrepareLC( R_QTN_WIZARD_WPA_MODE ); - retval = listQuery->RunLD(); - if ( !retval ) - { - User::Leave( KErrCancel ); - } - - // 0 - EAP, 1 - PSK - - usePsk = ( mode == KWpaModePsk ); - if ( usePsk ) - { - LOG_WRITE( "WPA-PSK" ); - } - else - { - LOG_WRITE( "WPA-EAP" ); - } - } - - } // if !foundssid (direct) - - - } // if !foundssid (broadcast) - else - { - // it was thought to be hidden but actually it isn't - LOG_WRITE( "broadcast scan succeeded, " - L"network isn't hidden as it was thought" ); - LOG_WRITEF( "netmode: %d, secmode: %d, usepsk: %d", - iWlanInfo->iNetMode, - iWlanInfo->iSecurityMode, - usePsk ); - - CleanupStack::PopAndDestroy( 1 ); // DismissWaitNote - - // set WLAN to public - iWlanInfo->iVisibility = ETrue; - } - - // convey PSK settings to iwlaninfo - // (netmode and secmode are already updated) - iWlanInfo->SetUsesPreSharedKey( usePsk ); - - } - else - { - // if NOT hidden - LOG_WRITE( "visible network" ); - LOG_WRITEF( "netmode: %d, secmode: %d, usepsk: %d", - iWlanInfo->iNetMode, - iWlanInfo->iSecurityMode, - iWlanInfo->UsesPreSharedKey() ); - } - - // query the key and leave if cancelled - if ( !QuerySecureKeyL() ) - { - User::Leave( KErrCancel ); - } - - } - - -// ---------------------------------------------------------------------------- -// CWsfWlanIapWizard::AskSsidL -// ---------------------------------------------------------------------------- -// -HBufC* CWsfWlanIapWizard::AskSsidL() - { - LOG_ENTERFN( "CWsfWlanIapWizard::AskSsidL" ); - - HBufC* apName = HBufC::NewLC( KWlanMaxSsidLength ); - TPtr namePtr( apName->Des() ); - if ( iWlanInfo->iSsid.Length() ) - { - CnvUtfConverter::ConvertToUnicodeFromUtf8( namePtr, iWlanInfo->iSsid ); - } - TInt response = QueryTextL( R_QTN_ENTER_NETWORK_SSID, - namePtr, - KWlanMaxSsidLength ); - if ( response != EEikBidOk ) - { - User::Leave( KErrCancel ); - } - - CleanupStack::Pop( apName ); - return apName; - } - - -// ---------------------------------------------------------------------------- -// CWsfWlanIapWizard::DialogDismissedL -// ---------------------------------------------------------------------------- -// -void CWsfWlanIapWizard::DialogDismissedL( TInt aButtonId ) - { - LOG_ENTERFN( "CWsfWlanIapWizard::DialogDismissedL" ); - iWaitDialog = NULL; - - if ( aButtonId == EEikBidCancel ) - { - // dialog was cancelled by the user - LOG_WRITE( "dialog was cancelled" ); - iSsidDiscovery->AbortScanning(); - } - } - - diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/apwizard/src/wsfwlanssiddiscovery.cpp --- a/wlanutilities/wlansniffer/apwizard/src/wsfwlanssiddiscovery.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,323 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/client/bwins/wsfclientu.def --- a/wlanutilities/wlansniffer/engine/client/bwins/wsfclientu.def Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/client/eabi/wsfclientu.def --- a/wlanutilities/wlansniffer/engine/client/eabi/wsfclientu.def Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/client/group/bld.inf --- a/wlanutilities/wlansniffer/engine/client/group/bld.inf Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/client/group/client.mmp --- a/wlanutilities/wlansniffer/engine/client/group/client.mmp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/client/inc/wsfactivewaiter.h --- a/wlanutilities/wlansniffer/engine/client/inc/wsfactivewaiter.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/client/inc/wsfeventhandler.h --- a/wlanutilities/wlansniffer/engine/client/inc/wsfeventhandler.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,164 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/client/inc/wsfsession.h --- a/wlanutilities/wlansniffer/engine/client/inc/wsfsession.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,286 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/client/inc/wsfstatechangeobserver.h --- a/wlanutilities/wlansniffer/engine/client/inc/wsfstatechangeobserver.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/client/rom/wsfclient.iby --- a/wlanutilities/wlansniffer/engine/client/rom/wsfclient.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/client/src/wsfactivewaiter.cpp --- a/wlanutilities/wlansniffer/engine/client/src/wsfactivewaiter.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/client/src/wsfeventhandler.cpp --- a/wlanutilities/wlansniffer/engine/client/src/wsfeventhandler.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,329 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/client/src/wsfsession.cpp --- a/wlanutilities/wlansniffer/engine/client/src/wsfsession.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,723 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/group/bld.inf --- a/wlanutilities/wlansniffer/engine/server/group/bld.inf Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/group/server.mmp --- a/wlanutilities/wlansniffer/engine/server/group/server.mmp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/inc/wsfactivewaiter.h --- a/wlanutilities/wlansniffer/engine/server/inc/wsfactivewaiter.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/inc/wsfcommon.h --- a/wlanutilities/wlansniffer/engine/server/inc/wsfcommon.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/inc/wsfengine.h --- a/wlanutilities/wlansniffer/engine/server/inc/wsfengine.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,348 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/inc/wsfengineobserver.h --- a/wlanutilities/wlansniffer/engine/server/inc/wsfengineobserver.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/inc/wsfserver.h --- a/wlanutilities/wlansniffer/engine/server/inc/wsfserver.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,273 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/inc/wsfservercloseradapter.h --- a/wlanutilities/wlansniffer/engine/server/inc/wsfservercloseradapter.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/inc/wsfservercommon.h --- a/wlanutilities/wlansniffer/engine/server/inc/wsfservercommon.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,235 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/inc/wsfsession.h --- a/wlanutilities/wlansniffer/engine/server/inc/wsfsession.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,323 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/inc/wsfwlanbearerconnectionmonitor.h --- a/wlanutilities/wlansniffer/engine/server/inc/wsfwlanbearerconnectionmonitor.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,407 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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, - - /** - * 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/inc/wsfwlanconnectiondetailsprovider.h --- a/wlanutilities/wlansniffer/engine/server/inc/wsfwlanconnectiondetailsprovider.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Class header for MWsfWlanConnectionDetailsProvider -* -*/ - - - -#ifndef M_WSFWLANCONNECTIONDETAILSPROVIDER_H -#define M_WSFWLANCONNECTIONDETAILSPROVIDER_H - - -// EXTERNAL INCLUDES -#include - - -// FORWARD DECLARATIONS -class TWsfWlanInfo; - - -// CLASS DEFINITION -/** -* Class acts as an interface to the WLAN bearer monitor to let different -* parts of the engine query the properties of the current WLAN connection. -* -* @since S60 5.0 -*/ -class MWsfWlanConnectionDetailsProvider - { - public: // Abstract methods - - /** - * Fills TWsfWlanInfo with the connected wlan's properties - * @since S60 5.0 - * @param aWlanInfo The wlaninfo structure to be filled - * @return ETrue if there is a connection and returned data is valid, - * EFalse otherwise - */ - virtual TBool ConnectedWlanConnectionDetailsL( - TWsfWlanInfo* aWlanInfo ) = 0; - - /** - * Queries if there is an active WLAN connection. - * @since S60 5.2 - * @return ETrue if there is an active WLAN connection, - * EFalse otherwise. - */ - virtual TBool IsConnected() = 0; - - }; - -#endif // M_WSFWLANCONNECTIONDETAILSPROVIDER_H - -// End of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/inc/wsfwlanmonitorobserver.h --- a/wlanutilities/wlansniffer/engine/server/inc/wsfwlanmonitorobserver.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/inc/wsfwlanscaninfodefines.h --- a/wlanutilities/wlansniffer/engine/server/inc/wsfwlanscaninfodefines.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/inc/wsfwlanscanintervalchangeobserver.h --- a/wlanutilities/wlansniffer/engine/server/inc/wsfwlanscanintervalchangeobserver.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/inc/wsfwlanscanner.h --- a/wlanutilities/wlansniffer/engine/server/inc/wsfwlanscanner.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,504 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/inc/wsfwlanscannerobserver.h --- a/wlanutilities/wlansniffer/engine/server/inc/wsfwlanscannerobserver.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/inc/wsfwlansettingsaccessor.h --- a/wlanutilities/wlansniffer/engine/server/inc/wsfwlansettingsaccessor.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,209 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/rom/wsfserver.iby --- a/wlanutilities/wlansniffer/engine/server/rom/wsfserver.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/src/wsfactivewaiter.cpp --- a/wlanutilities/wlansniffer/engine/server/src/wsfactivewaiter.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/src/wsfengine.cpp --- a/wlanutilities/wlansniffer/engine/server/src/wsfengine.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,705 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/src/wsfserver.cpp --- a/wlanutilities/wlansniffer/engine/server/src/wsfserver.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,351 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/src/wsfservercloser.cpp --- a/wlanutilities/wlansniffer/engine/server/src/wsfservercloser.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,141 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/src/wsfsession.cpp --- a/wlanutilities/wlansniffer/engine/server/src/wsfsession.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,715 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/src/wsfwlanbearerconnectionmonitor.cpp --- a/wlanutilities/wlansniffer/engine/server/src/wsfwlanbearerconnectionmonitor.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1083 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ECsConnectionCreated: // fall-through - { - - } - - case ECsSocketOpened: // fall-through - { - // closing the connection handle - LOG_WRITE( "closing the connection handle" ); - iConnection.Close(); - iSocketServ.Close(); - } - - case ECsNotConnected: // fall-through - { - // nothing to put here - } - - } - - - // reset the state machine - iConnectingState = ECsIdle; - iConnectionOwned = EFalse; - - // tell the engine we have released the IAP - iObserver->ConnectedIapReleasedL(); - - - iServerCloser.WaitForOwnedConnection( EFalse ); - - if ( !iAborting ) - { - // notify observers only if connection creation - // was not aborted - iObserver->ConnectionLostL(); - } - - iAborting = EFalse; - - CleanupStack::PopAndDestroy( 1 ); // ReleaseShutdownMutex() - } - - -// --------------------------------------------------------------------------- -// CWsfWlanBearerConnectionMonitor::RunL -// --------------------------------------------------------------------------- -// -void CWsfWlanBearerConnectionMonitor::RunL() - { - LOG_ENTERFN( "CWsfWlanBearerConnectionMonitor::RunL" ); - - if ( iAborting ) - { - // if connection creation was aborted, do the cleanup - ShutdownOwnedConnectionL(); - return; - } - - switch ( iConnectingState ) - { - case ECsNotConnected: - { -#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( "" ); - - // start monitoring the iap - MonitorAccessPoint( iConnIap ); - - // reset inactivity time - iInactivityStart.UniversalTime(); - iAutoDisconnect = EFalse; - - iClientPoll->Start( - TTimeIntervalMicroSeconds32( KClientPollInterval ), - TTimeIntervalMicroSeconds32( KClientPollInterval ), - TCallBack( CheckClientCount, this ) ); - - LOG_WRITE( "connection client polling started" ); - - // notify observers of the connection name - iObserver->ConnectionEstablishedL( iWlanNetworkName ); - - 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/src/wsfwlanscanner.cpp --- a/wlanutilities/wlansniffer/engine/server/src/wsfwlanscanner.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1766 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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() - { - LOG_ENTERFN( "CWsfWlanScanner::AddConnectedWLANInfoL" ); - // Get the possible connection - if ( iConnectionDetailsProvider ) - { - TWlanSsid connectedSsid; - TInt error = iWlanMgmtClient->GetConnectionSsid( connectedSsid ); - - LOG_WRITEF( "GetConnectionSsid returned=%d", error ); - - TBool connected = ( error == KErrNone && connectedSsid.Length() ); - - if ( !connected && !iConnectionDetailsProvider->IsConnected() ) - { - LOG_WRITEF( "Not connected [connected=%d]", connected ); - return; - } - - TWsfWlanInfo* connectedInfo = new (ELeave) TWsfWlanInfo(); - CleanupStack::PushL( connectedInfo ); - - if ( iConnectionDetailsProvider->ConnectedWlanConnectionDetailsL( - connectedInfo) ) - { - TBuf8 connectedSsidOrIap; - connectedSsidOrIap.Copy( connectedInfo->iSsid ); - // ConnectedWlanConnectionDetailsL() may have returned an IAP name instead of SSID. - // make sure that we really have SSID in connectedInfo->iSSID at this phase. - - connectedInfo->iRawSsid.Copy( connectedSsid ); - connectedInfo->iSsid.Copy( connectedSsid ); - connectedInfo->iCoverage = 0; - connectedInfo->iVisibility = 1; - - TBool connectedInfoAppended = EFalse; - - RPointerArray matchArray; - CleanupClosePushL( matchArray ); - - if ( connectedInfo->iIapId ) - { - LOG_WRITEF( "Connected iap [%d]", connectedInfo->iIapId ); - iScanArray->MatchWithIapIDL( connectedInfo->iIapId, - iScanArray->Count(), matchArray ); - - if ( !matchArray.Count() ) - { - LOG_WRITE( "Not found with Iap id" ); - iScanArray->MatchL( connectedInfo->iSsid, - connectedInfo->iSecurityMode, - connectedInfo->iNetMode, - 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 ); - aWlanInfo.iRawSsid.Copy( aWlanInfo.iSsid ); - - // security mode - TUint32 secMode(0); - wlanTableView->ReadUintL(TPtrC( WLAN_SECURITY_MODE), secMode); - // Map Wpa2 to Wpa - secMode = ( secMode == EWlanSecModeWpa2 )? EWlanSecModeWpa : secMode; - aWlanInfo.iSecurityMode = static_cast(secMode); - - // net mode - TUint32 netMode(0); - wlanTableView->ReadUintL(TPtrC( WLAN_CONNECTION_MODE), netMode); - aWlanInfo.iNetMode = static_cast(netMode); - - CleanupStack::PopAndDestroy(wlanTableView); - CleanupStack::PopAndDestroy(commsDbIapTableView); - CleanupStack::PopAndDestroy(commsDb); - } - - -// --------------------------------------------------------------------------- -// CWsfWlanScanner::SsidIdentity -// --------------------------------------------------------------------------- -// -TBool CWsfWlanScanner::SsidIdentity( const TWlanSsid& aSsid1, - const TWlanSsid& aSsid2 ) - { - return !aSsid1.Compare( aSsid2 ); - } - - -// --------------------------------------------------------------------------- -// CWsfWlanScanner::RefreshNetworkNameL -// --------------------------------------------------------------------------- -// -TBool CWsfWlanScanner::RefreshNetworkNameL( TWsfWlanInfo& aWlanInfo ) - { - LOG_ENTERFN( "CWsfWlanScanner::RefreshNetworkNameL" ); - - TBool isHidden( EFalse ); - - TUint8 ieLen( 0 ); - const TUint8* ieData; - TBuf8 ssid8; - - TInt ret = iScanInfo->InformationElement( E802Dot11SsidIE, ieLen, - &ieData ); - - if ( ret == KErrNone ) - { - isHidden = IsHiddenSsid( ieLen, ieData ); - - if ( ieLen ) - { - ssid8.Copy( ieData, ieLen ); - aWlanInfo.iSsid.Copy( ssid8 ); - aWlanInfo.iRawSsid.Copy( ssid8 ); - TBuf ssid16; - ssid16.Copy( ssid8 ); - LOG_WRITEF( "SSID: [%S]", &ssid16 ); - } - else - { - LOG_WRITE( "SSID: " ); - } - } - else - { - User::Leave( ret ); - } - - return isHidden; - } - - -// --------------------------------------------------------------------------- -// CWsfWlanScanner::IsHiddenSsid -// --------------------------------------------------------------------------- -// -TBool CWsfWlanScanner::IsHiddenSsid( TUint aSsidLength, const TUint8* aSsid ) - { - LOG_ENTERFN( "CWsfWlanScanner::IsHiddenSsid" ); - - - if ( !aSsidLength ) - { - LOG_WRITEF( "result: %d", ETrue ); - return ETrue; - } - - TInt count( 0 ); - for ( TUint i( 0 ); i < aSsidLength; ++i ) - { - count |= aSsid[i]; // in hidden networks characters are: 0x00 - } - - LOG_WRITEF( "result: %d", !count ); - - return !count; - } - - -// --------------------------------------------------------------------------- -// CWsfWlanScanner::RefreshSignalStrength -// --------------------------------------------------------------------------- -// -void CWsfWlanScanner::RefreshSignalStrength( TWsfWlanInfo& aWlanInfo ) - { - LOG_ENTERFN( "CWsfWlanScanner::RefreshSignalStrength" ); - - TInt rxLevel = iScanInfo->RXLevel(); - - LOG_WRITEF( "rxLevel = %d", rxLevel ); - - // yes, it is < and not >, because smaller value means stronger signal - - if ( rxLevel < aWlanInfo.iStrengthLevel ) - { - LOG_WRITEF( "updating %d to %d", aWlanInfo.iStrengthLevel, rxLevel ); - aWlanInfo.iStrengthLevel = rxLevel; - } - } - - -// --------------------------------------------------------------------------- -// CWsfWlanScanner::RefreshNetworkMode -// --------------------------------------------------------------------------- -// -void CWsfWlanScanner::RefreshNetworkMode( TWsfWlanInfo& aWlanInfo ) - { - LOG_ENTERFN( "CWsfWlanScanner::RefreshNetworkMode" ); - - aWlanInfo.iNetMode = ( iScanInfo->Capability() & - E802Dot11CapabilityEssMask ) ? - EInfra : EAdhoc ; - - LOG_WRITEF( "netmode = %d", TInt( aWlanInfo.iNetMode ) ); - } - - -// --------------------------------------------------------------------------- -// CWsfWlanScanner::RefreshSecurityMode -// --------------------------------------------------------------------------- -// -void CWsfWlanScanner::RefreshSecurityMode( TWsfWlanInfo& aWlanInfo ) - { - LOG_ENTERFN( "CWsfWlanScanner::RefreshSecurityMode" ); - - TWlanConnectionExtentedSecurityMode extSecMode = iScanInfo->ExtendedSecurityMode(); - - switch ( extSecMode ) - { - case EWlanConnectionExtentedSecurityModeWepOpen: - case EWlanConnectionExtentedSecurityModeWepShared: - { - aWlanInfo.iSecurityMode = EWlanSecModeWep; - break; - } - - case EWlanConnectionExtentedSecurityMode802d1x: - { - aWlanInfo.iSecurityMode = EWlanSecMode802_1x; - break; - } - - case EWlanConnectionExtentedSecurityModeWpa: - case EWlanConnectionExtentedSecurityModeWpa2: - { - aWlanInfo.iSecurityMode = EWlanSecModeWpa; - break; - } - - case EWlanConnectionExtentedSecurityModeWpaPsk: - case EWlanConnectionExtentedSecurityModeWpa2Psk: - { - aWlanInfo.iSecurityMode = EWlanSecModeWpa; - break; - } - - case EWlanConnectionExtentedSecurityModeWapi: - case EWlanConnectionExtentedSecurityModeWapiPsk: - { - aWlanInfo.iSecurityMode = EWlanSecModeWAPI; - break; - } - - case EWlanConnectionExtentedSecurityModeOpen: - default: - { - aWlanInfo.iSecurityMode = EWlanSecModeOpen; - } - } - - aWlanInfo.SetUsesPreSharedKey( - extSecMode == EWlanConnectionExtentedSecurityModeWpa2Psk || - extSecMode == EWlanConnectionExtentedSecurityModeWpaPsk ); - - LOG_WRITEF( "security mode %d (PSK: %d)", - (TInt)aWlanInfo.iSecurityMode, - (TInt)aWlanInfo.UsesPreSharedKey() ); - } - - -// --------------------------------------------------------------------------- -// CWsfWlanScanner::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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/engine/server/src/wsfwlansettingsaccessor.cpp --- a/wlanutilities/wlansniffer/engine/server/src/wsfwlansettingsaccessor.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,350 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/group/bld.inf --- a/wlanutilities/wlansniffer/group/bld.inf Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/group/wsficons.mk --- a/wlanutilities/wlansniffer/group/wsficons.mk Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -# -# Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/group/wsficons_aif.mk --- a/wlanutilities/wlansniffer/group/wsficons_aif.mk Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -# -# Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/help/data/xhtml.zip Binary file wlanutilities/wlansniffer/help/data/xhtml.zip has changed diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/help/group/bld.inf --- a/wlanutilities/wlansniffer/help/group/bld.inf Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - Initial contribution -* -* Contributors: -* -* -* Description: -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/help/inc/sniffer.hlp.hrh --- a/wlanutilities/wlansniffer/help/inc/sniffer.hlp.hrh Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -// -// 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/help/rom/wlansnifferhelps_variant.iby --- a/wlanutilities/wlansniffer/help/rom/wlansnifferhelps_variant.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: IBY file for Wlan 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/inc/wlansniffer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/inc/wlansniffer.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef WLANSNIFFER_H +#define WLANSNIFFER_H + +#include + +class QTranslator; +class WlanSnifferMainWindow; +class WlanQtUtils; + +class WlanSniffer : public HbApplication + { + Q_OBJECT + +public: + WlanSniffer(int argc, char* argv[]); + virtual ~WlanSniffer(); + + /** + * This function (from QObject) handles timers. Initiates a new WLAN scan. + * + * @param Unused. + */ + void timerEvent(QTimerEvent *event); + + WlanQtUtils *wlanQtUtils() const; + +private slots: + void exitApplication(); + +private: + QTranslator* mTranslator; + WlanQtUtils *mWlanQtUtils; + // Todo: why does the example use QSharedPointer for these? + WlanSnifferMainWindow *mMainWindow; // owned + int mScanTimerId; + }; + +#endif + +// End of File diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/inc/wlansnifferlistview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/inc/wlansnifferlistview.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef WLANSNIFFERLISTVIEW_H +#define WLANSNIFFERLISTVIEW_H + +#include +#include "wlanqtutilscommon.h" + +class HbListWidget; +class HbListWidgetItem; +class HbLabel; +class WlanSniffer; +class WlanQtUtilsWlanIap; +class WlanQtUtilsWlanAp; + +class WlanSnifferListView : public HbView + { + Q_OBJECT + +public: + WlanSnifferListView(WlanSniffer *appRef); + virtual ~WlanSnifferListView(); + + void update(); + void updateConnectionOpened(int iapId); + void updateConnectionClosed(int iapId); + +signals: + void detailsTriggered(int); + void completeServiceTriggered(); + +private slots: + void handleListItemActivated(HbListWidgetItem *item); + void handleListItemLongPressed(HbListWidgetItem *item, const QPointF &coords); + void handleDisconnect(); + +private: + QString signalStrengthIconChoose(int signalStrength, WlanQtUtilsWlanSecMode secMode); + HbListWidgetItem *wlanListItemIapCreate(const WlanQtUtilsWlanIap *iap); + HbListWidgetItem *wlanListItemApCreate(const WlanQtUtilsWlanAp *ap); + +private: + HbListWidget *mWlanList; + HbLabel *mStatusLabel; + WlanSniffer *mAppRef; + int mConnectingIapId; + bool mIapItemMenuOpen; + }; + +#endif diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/inc/wlansniffermainwindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/inc/wlansniffermainwindow.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef WLANSNIFFERMAINWINDOW_H +#define WLANSNIFFERMAINWINDOW_H + +#include + +#include + +class HbAction; +class WlanSnifferListView; +class WlanSniffer; +class WlanSnifferService; + +class WlanSnifferMainWindow : public HbMainWindow + { + Q_OBJECT + +public: + WlanSnifferMainWindow(WlanSniffer *appRef); + virtual ~WlanSnifferMainWindow(); + +public slots: + void toListView(); + void toDetailsView(int iapId); + + void updateListView(); + void updateListViewConnectionOpened(int iapId); + void updateListViewConnectionClosed(int iapId); + +signals: + void exitTriggered(); + +private slots: + void completeService(); + +private: + // Methods to add views to the main window + void addListView(); + +private: + WlanSniffer *mAppRef; + WlanSnifferListView *mListView; + WlanSnifferService* mService; + }; + +#endif diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/inc/wlansnifferservice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/inc/wlansnifferservice.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef WLANSNIFFERSERVICE_H +#define WLANSNIFFERSERVICE_H + +#include + +class WlanSnifferService: public XQServiceProvider +{ + Q_OBJECT + +public: + WlanSnifferService( QObject *parent = 0 ); + ~WlanSnifferService(); + void complete(); + +signals: + void toListView(); + void exitTriggered(); + +public slots: + void listView(); + +private: + int mAsyncRequestIndex; +}; + +#endif // WLANSNIFFERSERVICE_H diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/inc/wsflogger.h --- a/wlanutilities/wlansniffer/inc/wsflogger.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,257 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/data/wlansniffer.rss --- a/wlanutilities/wlansniffer/mainapplication/data/wlansniffer.rss Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,697 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Resource definitions for project MainApplication - * -*/ - -NAME HELL - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "wsfmainapplication.hrh" - -// --------------------------------------------------------- -// -// Define the resource file signature -// This resource should be empty. -// -// --------------------------------------------------------- -// -RESOURCE RSS_SIGNATURE - {} - -// --------------------------------------------------------- -// -// Default Document Name -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_default_document_name - { - buf=""; - } - -// --------------------------------------------------------- -// -// Define default menu and CBA key. -// -// --------------------------------------------------------- -// -RESOURCE EIK_APP_INFO - { - menubar = r_sniffer_menubar; - } - -// --------------------------------------------------------- -// -// r_sniffer_cp_mainview -// Control Panel Mainview -// -// --------------------------------------------------------- -// -RESOURCE CBA r_sniffer_cp_options_back_menu - { - buttons = - { - CBA_BUTTON - { - id=EAknSoftkeyOptions; txt = text_softkey_option; - }, - CBA_BUTTON - { - id=EAknSoftkeyExit; txt = text_softkey_back; - }, - CBA_BUTTON - { - id=EAknSoftkeyContextOptions; txt = text_softkey_option; - } - }; - } - -RESOURCE AVKON_VIEW r_sniffer_cp_mainview - { - menubar = r_sniffer_menubar; - cba = r_sniffer_cp_options_back_menu; - } - -// --------------------------------------------------------- -// -// r_Sniffer_mainview -// Mainview -// -// --------------------------------------------------------- -// -RESOURCE CBA r_sniffer_options_back_menu - { - buttons = - { - CBA_BUTTON - { - id=EAknSoftkeyOptions; txt = text_softkey_option; - }, - CBA_BUTTON - { - id=EAknSoftkeyExit; txt = text_softkey_exit; - }, - CBA_BUTTON - { - id=EAknSoftkeyContextOptions; txt = text_softkey_option; - } - }; - } - -RESOURCE AVKON_VIEW r_sniffer_mainview - { - menubar = r_sniffer_menubar; - cba = r_sniffer_options_back_menu; - } - -// --------------------------------------------------------- -// -// r_Sniffer_menubar -// Menubar for Sniffer example -// -// --------------------------------------------------------- -// -RESOURCE MENU_BAR r_sniffer_menubar - { - titles = - { - MENU_TITLE - { - menu_pane = r_sniffer_menu; - } - }; - } - -// --------------------------------------------------------- -// -// r_Sniffer_menu -// Menu for "Options" -// -// --------------------------------------------------------- -// -RESOURCE MENU_PANE r_sniffer_menu - { - items = - { - MENU_ITEM - { - command = ESnifferCmdStartBrowsing; - txt = qtn_sniffer_opt_start_web_browsing; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = ESnifferCmdContinueBrowsing; - txt = qtn_sniffer_opt_continue_web_browsing; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = ESnifferCmdConnect; - txt = qtn_sniffer_opt_connect; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = ESnifferCmdDisconnect; - txt = qtn_sniffer_opt_disconnect_wlan; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = ESnifferCmdRefresh; - txt = qtn_sniffer_opt_refresh; - }, - MENU_ITEM - { - command = ESnifferCmdFilterWlans; - txt = qtn_sniffer_opt_filter_out_wlans; - }, - MENU_ITEM - { - command = ESnifferCmdDetails; - txt = qtn_sniffer_opt_details; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = ESnifferCmdSettings; - txt = qtn_sniffer_opt_settings; - }, - MENU_ITEM - { - command = EAknCmdHelp; - txt = qtn_options_help; - }, - MENU_ITEM - { - command = EAknCmdExit; - txt = qtn_options_exit; - } - }; - } - -RESOURCE MENU_BAR r_sniffer_context_menubar - { - titles = - { - MENU_TITLE - { - menu_pane = r_sniffer_context_menu; - } - }; - } - -RESOURCE MENU_PANE r_sniffer_context_menu - { - items = - { - MENU_ITEM - { - command = ESnifferCmdStartBrowsing; - txt = qtn_sniffer_opt_start_web_browsing; - }, - MENU_ITEM - { - command = ESnifferCmdContinueBrowsing; - txt = qtn_sniffer_opt_continue_web_browsing; - }, - MENU_ITEM - { - command = ESnifferCmdConnect; - txt = qtn_sniffer_opt_connect; - }, - MENU_ITEM - { - command = ESnifferCmdDisconnect; - txt = qtn_sniffer_opt_disconnect_wlan; - }, - MENU_ITEM - { - command = ESnifferCmdDetails; - txt = qtn_sniffer_opt_details; - } - }; - } - -// --------------------------------------------------------- -// -// r_sniffer_detailsview -// Details -// -// --------------------------------------------------------- -// -RESOURCE AVKON_VIEW r_sniffer_detailsview - { - menubar = r_sniffer_detailsview_menubar; - cba = R_AVKON_SOFTKEYS_OK_EMPTY; - } - - -// --------------------------------------------------------- -// -// r_sniffer_detailsview_menubar -// -// --------------------------------------------------------- -// -RESOURCE MENU_BAR r_sniffer_detailsview_menubar - { - titles = - { - MENU_TITLE - { - menu_pane = R_AVKON_MENUPANE_EMPTY; - } - }; - } - -//----------------------------------------------------------------------------- -// -// Details view listbox headings resources -// -//----------------------------------------------------------------------------- - -RESOURCE TBUF r_qtn_cmon_heading_conn_name - { - buf = qtn_cmon_heading_conn_name; - } - -RESOURCE TBUF r_qtn_sniffer_heading_wlan_network_name - { - buf = qtn_cmon_heading_wlan_network_name; - } - -RESOURCE TBUF r_qtn_sniffer_heading_wlan_signal_strength - { - buf = qtn_cmon_heading_wlan_signal_strength; - } - -RESOURCE TBUF r_qtn_sniffer_heading_wlan_network_mode - { - buf = qtn_cmon_heading_wlan_network_mode; - } - -RESOURCE TBUF r_qtn_sniffer_heading_wlan_security_mode - { - buf = qtn_cmon_heading_wlan_security_mode; - } - -RESOURCE TBUF r_qtn_sniffer_heading_wlan_nw_ap_amount - { - buf = qtn_cmon_heading_wlan_nw_ap_amount; - } - -RESOURCE TBUF r_qtn_sniffer_heading_wlan_nw_max_rate - { - buf = qtn_cmon_heading_wlan_nw_max_rate; - } - -//----------------------------------------------------------------------------- -// -// Details View signal strength detail definitions -// -//----------------------------------------------------------------------------- - -RESOURCE TBUF r_qtn_sniffer_wlan_signal_strength_low - { - buf = qtn_cmon_wlan_signal_strength_low; - } - -RESOURCE TBUF r_qtn_sniffer_wlan_signal_strength_medium - { - buf = qtn_cmon_wlan_signal_strength_medium; - } - -RESOURCE TBUF r_qtn_sniffer_wlan_signal_strength_strong - { - buf = qtn_cmon_wlan_signal_strength_good; - } - -RESOURCE TBUF r_qtn_sniffer_wlan_signal_strength_no_signal - { - buf = qtn_cmon_wlan_signal_strength_no_signal; - } - -//----------------------------------------------------------------------------- -// -// Details View Wlan mode definitions -// -//----------------------------------------------------------------------------- - -RESOURCE TBUF r_qtn_sniffer_wlan_sett_newtwork_mode_adhoc - { - buf = qtn_cmon_wlan_network_mode_adhoc; - } - -RESOURCE TBUF r_qtn_sniffer_wlan_sett_newtwork_mode_infra - { - buf = qtn_cmon_wlan_network_mode_infra; - } - -//----------------------------------------------------------------------------- -// -// Details View Wlan security definitions -// -//----------------------------------------------------------------------------- - -RESOURCE TBUF r_qtn_sniffer_wlan_sett_security_mode_open - { - buf = qtn_wlan_sett_security_mode_open; - } - -RESOURCE TBUF r_qtn_sniffer_wlan_sett_security_mode_wep - { - buf = qtn_wlan_sett_security_mode_wep; - } - -RESOURCE TBUF r_qtn_sniffer_wlan_sett_security_mode_802_1x - { - buf = qtn_wlan_sett_security_mode_802_1x; - } - -RESOURCE TBUF r_qtn_sniffer_wlan_sett_security_mode_wpa - { - buf = qtn_wlan_sett_security_mode_wpa; - } - -RESOURCE TBUF r_qtn_sniffer_wlan_sett_security_mode_wapi - { - buf = qtn_wlan_sett_security_mode_wapi; - } - -//----------------------------------------------------------------------------- -// -// Details View Wlan security definitions -// -//----------------------------------------------------------------------------- - -RESOURCE TBUF r_qtn_sniffer_wlan_ap_amount_in_range - { - buf = qtn_cmon_wlan_ap_amount_in_range_1; - } - -RESOURCE TBUF r_qtn_sniffer_wlan_ap_amount_in_range_many - { - buf = qtn_cmon_wlan_ap_amount_in_range_many; - } - -//----------------------------------------------------------------------------- -// -// Details View Wlan speed definitions -// -//----------------------------------------------------------------------------- - -RESOURCE TBUF r_qtn_sniffer_wlan_max_data_rate - { - buf = qtn_cmon_wlan_max_data_rate; - } - -//----------------------------------------------------------------------------- -// -// 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_title - { - buf = qtn_sniffer_title; - } - -RESOURCE TBUF r_qtn_sniffer_navi_one_wlan_nw_available - { - buf = qtn_cmon_navi_one_wlan_nw_available; - } - -RESOURCE TBUF r_qtn_sniffer_navi_many_wlan_nws_available - { - buf = qtn_cmon_navi_many_wlan_nws_available; - } - -//----------------------------------------------------------------------------- - -RESOURCE LOCALISABLE_APP_INFO r_sniffer_localisable_app_info - { - short_caption = qtn_sniffer_title; - caption_and_icon = - CAPTION_AND_ICON_INFO - { - caption = qtn_sniffer_title; - icon_file = "Z:"APP_BITMAP_DIR"\\wsficons_aif.mif"; - }; - } - -// END OF FILE diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/data/wlansniffer_reg.rss --- a/wlanutilities/wlansniffer/mainapplication/data/wlansniffer_reg.rss Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/group/bld.inf --- a/wlanutilities/wlansniffer/mainapplication/group/bld.inf Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/group/mainapplication.mmp --- a/wlanutilities/wlansniffer/mainapplication/group/mainapplication.mmp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project definition file for project MainApplication -* -*/ - -#include -#include - -CAPABILITY ReadDeviceData NetworkServices NetworkControl ProtServ \ - ReadUserData WriteDeviceData WriteUserData SwEvent - -TARGET wlansniffer.exe -TARGETTYPE exe -UID 0x100039CE 0x10281CAA - -EPOCSTACKSIZE 0x5000 - -SOURCEPATH ../src -SOURCE wsfentrypoint.cpp -SOURCE wsfapplication.cpp -SOURCE wsfmainview.cpp -SOURCE wsfappui.cpp -SOURCE wsfdocument.cpp - -SOURCE wsfactivewaiter.cpp -SOURCE wsfmaincontroller.cpp -SOURCE wsfmainviewcontroller.cpp -SOURCE wsfmainviewmodel.cpp -SOURCE wsfmainviewcontainer.cpp - -// Details View Sources -SOURCE wsfdetailsview.cpp -SOURCE wsfdetailscontainer.cpp -SOURCE wsfdetailsviewmodel.cpp -SOURCE wsfdetailsviewcontroller.cpp - -// Connected Details Popup Sources -SOURCE wsfconnecteddetailsdialog.cpp -SOURCE wsfconnecteddetailsmodel.cpp -SOURCE wsfconnecteddetailscontroller.cpp -SOURCE wsfactivetimeupdater.cpp - - -// own headers -USERINCLUDE ../inc - -// inner API -USERINCLUDE ../../inc - -// private API -USERINCLUDE ../../../inc - - -//Macro to /epoc32 headers -APP_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY apparc.lib -LIBRARY cone.lib -LIBRARY bafl.lib -LIBRARY eikcore.lib -LIBRARY avkon.lib -LIBRARY eikcoctl.lib -LIBRARY eikctl.lib -LIBRARY egul.lib -LIBRARY aknicon.lib -LIBRARY eikdlg.lib -LIBRARY eikcdlg.lib -LIBRARY FeatMgr.lib -LIBRARY hlplch.lib -LIBRARY ConnMon.lib -LIBRARY aknskins.lib -LIBRARY commonengine.lib -LIBRARY cmmanager.lib -LIBRARY wlansettingsui.lib -LIBRARY charconv.lib -LIBRARY apgrfx.lib -LIBRARY commonui.lib - -LIBRARY wsfwlaninfo.lib -LIBRARY wsfwlaninfosorting.lib -LIBRARY wsfmodel.lib -LIBRARY connectionuiutilities.lib - -// Logger -DEBUGLIBRARY flogger.lib - -START RESOURCE ../data/wlansniffer.rss -HEADER -TARGETPATH APP_RESOURCE_DIR -LANGUAGE_IDS -END - -START RESOURCE ../data/wlansniffer_reg.rss -DEPENDS wlansniffer.rsg -TARGETPATH /private/10003a3f/apps -END - - diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfactivetimerhandler.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfactivetimerhandler.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfactivetimeupdater.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfactivetimeupdater.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfactivewaiter.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfactivewaiter.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfapplication.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfapplication.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfappui.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfappui.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,292 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailscontroller.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailscontroller.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailscontroller.inl --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailscontroller.inl Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailsdialog.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailsdialog.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailsmodel.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailsmodel.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,235 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfdetailscontainer.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailscontainer.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,249 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfdetailscontainerif.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailscontainerif.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsview.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsview.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,165 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewcontroller.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewcontroller.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,151 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewcontrollerif.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewcontrollerif.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewcontrollerpartner.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewcontrollerpartner.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewmodel.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewmodel.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,282 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewpartner.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfdetailsviewpartner.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfdocument.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfdocument.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfdocument.inl --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfdocument.inl Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfmainapplication.hrh --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfmainapplication.hrh Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfmaincontroller.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfmaincontroller.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,326 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Class header for TWsfMainController -* -*/ - -#ifndef T_WSFMAINCONTROLLER_H -#define T_WSFMAINCONTROLLER_H - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -#include "wsfmainuiobserver.h" -#include "wsfmodelobserver.h" -#include "wsfmainviewpartner.h" -#include "wsfstatechangeobserver.h" -#include "wsfdetailsviewpartner.h" -#include "wsfwlaninfo.h" - - - -// FORWARD DECLARATIONS -class CWsfAppUi; -class CWsfModel; -class MWsfMainViewControllerIf; -class MWsfDetailsViewControllerIf; -class CWsfWlanInfoArray; -class CWsfWlanInfoArrayVisitor; - -// CLASS DEFINITION -/** - * The main control class of the component. It is responsible for all - * the WLAN related functionalities. - * @since S60 v5.0 - */ -class TWsfMainController: public MWsfMainUiObserver, - public MWsfModelObserver, - public MWsfMainViewPartner, - public MWsfDetailsViewPartner, - public MWsfStateChangeObserver - { - public: // New methods - - /** - * PreInitialization for this class - * @since S60 5.0 - * @param aAppUi reference for the AppUI - * @param aModel reference for the Model - * @param aWlanInfoBranding reference for the WlanInfoArrayVisitor - */ - void Initialize( CWsfAppUi& aAppUi, - CWsfModel& aModel, - CWsfWlanInfoArrayVisitor& aWlanInfoBranding ); - - /** - * Updating the active View - * @since S60 5.0 - */ - void UpdateViewL(); - - /** - * Updating the active View - * @since S60 5.0 - * @param aInfoArray - Current Wlan Array - */ - void UpdateViewL( CWsfWlanInfoArray* aInfoArray ); - - public: //From MWsfMainUiObserver - - /** - * Activate (Switch back to) the Main View - * @since S60 5.0 - */ - void ShowWlanListL(); - - /** - * Incialize Main View - * @since S60 5.0 - */ - void MainViewCreatedL(); - - /** - * Sarts the Borwser - * @since S60 5.0 - */ - void StartBrowsingL(); - - /** - * Continues browsing (browser launched if needed) - * @since S60 5.0 - */ - void ContinueBrowsingL(); - - /** - * Connect to an IAP and create a WLAN connection - * @since S60 5.0 - */ - void ConnectL(); - - /** - * Disconnect a connection - * @since S60 5.0 - */ - void DisconnectL(); - - /** - * Start a refresh scanning - * @since S60 5.0 - */ - void RefreshL(); - - /** - * Start to display the diteils view of the selected connection - * @since S60 5.0 - */ - void ShowDetailsL(); - - /** - * Create an Access Point - * @since S60 5.0 - */ - void CreateAccessPointL(); - - /** - * Used in AppUi side to check if the - * wait dialog should be shown - * @since S60 5.0 - * @return ETrue if first refreshing - */ - TBool EngineRefreshing(); - - /** - * Callback function, when the Sniffer started - * @since S60 5.0 - */ - void AppLaunchCompleteL(); - - /** - * Enable Scanning - * @since S60 5.0 - */ - void AppSwitchedForegroundL(); - - /** - * Disable Scanning - * @since S60 5.0 - */ - void AppSwitchedBackgroundL(); - - /** - * Displays the "Filter out Wlan" dialog - * @since S60 5.0 - */ - void EditBlackListItemsL(); - - - public: //From MWsfModelObserver - - /** - * Called if the launch has been completed successfully - * @since S60 5.0 - */ - void BrowserLaunchCompleteL(); - - /** - * Called if the browser launch failed for some reason - * @since S60 5.0 - * @param aError error code - */ - void BrowserLaunchFailed( TInt aError ); - - /** - * Called when the previously launched browser exits - * @since S60 5.0 - */ - void BrowserExitL(); - - /** - * Notification that connection is going to be created - * @since S60 5.0 - * @param aIapId The IAP id of the connection being created - */ - void ConnectingL( TUint32 aIapId ); - - /** - * Notification that the connection creation process ended - * @since S60 5.0 - * @param aResult The result of the connection creation - */ - void ConnectingFinishedL( TInt aResult ); - - - public: //From MWsfMainViewPartner - - /** - * Mainview request to show manubar - * @since S60 5.0 - */ - void ShowMenuBarL(); - - public: //From MWsfDetailsViewPartner - - /** - * Detailsview requests to close view - * @since S60 5.0 - */ - void CloseDetailsViewL(); - - /** - * Refresh scanning - */ - void DetailsScanL(); - - public: // From MWsfStateChangeObserver - - /** - * The current wlan data has changed and it is ready to be retrieved - * @since S60 5.0 - */ - void WlanListChangedL(); - - /** - * Engine error occured - * @since S60 5.0 - * @param aError System wide error code - */ - void NotifyEngineError( TInt aError ); - - /** - * Scanning has been disabled - * @since S60 5.0 - */ - void ScanDisabledL(); - - /** - * Scanning has been enabled - * @since S60 5.0 - */ - void ScanEnabledL(); - - /** - * A WLAN connection has been established - * @since S60 5.0 - * @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 ); - - /** - * Updates iap id to wlan list - * @since S60 5.2 - * @param aInfo reference of TWsfWlanInfo class - */ - void UpdateIapIdToInfoArray( TWsfWlanInfo & aInfo ); - - private: // Data - - /** - * Reference to AppUi - */ - CWsfAppUi* iAppUi; - - /** - * Reference to Model - */ - CWsfModel* iModel; - - /** - * Reference to Main View - */ - MWsfMainViewControllerIf* iMainView; - - /** - * Reference to WlanInfoArrayVisitor - */ - CWsfWlanInfoArrayVisitor* iWlanInfoBranding; - - /** - * Reference to Deatils View - */ - MWsfDetailsViewControllerIf* iDetailsView; - - /** - * Reference to WlanInfoArray - */ - CWsfWlanInfoArray* iInfoArray; - - }; - - -#endif // T_WSFMAINCONTROLLER_H - -// End of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfmainuiobserver.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfmainuiobserver.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfmainview.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfmainview.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,200 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontainer.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontainer.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,318 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontroller.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontroller.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,158 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontrollerif.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontrollerif.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontrollerpartner.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewcontrollerpartner.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewinternals.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewinternals.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewmodel.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewmodel.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,191 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewpartner.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfmainviewpartner.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/loc/wsfmainapplication.loc --- a/wlanutilities/wlansniffer/mainapplication/loc/wsfmainapplication.loc Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,415 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Localization strings for project Wlan Sniffer -* -*/ - - - -// LOCALISATION STRINGS - -//------------------------------------------------------------------------------ -// Connected Details Pop-up heading texts * -//------------------------------------------------------------------------------ -//d: Heading text for Connected Details Pop-up -//l: heading_pane_t1 -//r:3.0 -// -#define qtn_wlan_heading_connection_details "Connection details:" - -//------------------------------------------------------------------------------ -// Connected Details Pop-up item heading texts * -//------------------------------------------------------------------------------ -//d:The name of the connected WLAN network (Ssid) -//d:%U is a name of a connected WLAN. -//l:list_single_heading_pane_t2_cp2 -//r:3.0 -// -#define qtn_wlan_item_heading_text_wlan "WLAN" - -//d:The duration of connection of the WLAN (Active time) -//d:%N is a duration time in format hh.mm.ss -//l:list_single_heading_pane_t2_cp2 -//r:3.0 -// -#define qtn_wlan_item_heading_duration "Duration" - -//d:The amount of the transferred data -//l:list_single_heading_pane_t2_cp2 -//r:3.0 -// -#define qtn_wlan_item_heading_transf "Transfd." - -//------------------------------------------------------------------------------ -// Connected Details Pop-up item texts * -//------------------------------------------------------------------------------ - -//d:The amount of the transferred data -//d:%U is an amount of transferred data e.g. "250 kB" -//l:list_single_heading_pane_t1_cp2 -//r:3.0 -// -#define qtn_wlan_item_kb "%U kB" - -//d:The amount of the transferred data -//d:%U is an amount of transferred data e.g. "250MB" -//l:list_single_heading_pane_t1_cp2 -//r:3.0 -// -#define qtn_wlan_item_mb "%U MB" - - -//----------------------------------------------------------------------------- -// Main View * -//----------------------------------------------------------------------------- - -//d:Navi pane text in Available WLAN networks main view, if only one network is available. -//d:copied from S60: qtn_cmon_navi_one_wlan_nw_available -//l:navi_navi_text_pane_t1 -//r:3.0 -// -#define qtn_cmon_navi_one_wlan_nw_available "1 network available" - - -//d:Navi pane text in Available WLAN networks main view, if more than one network is available -//d:(%N is the amount of networks). -//d:copied from S60: qtn_cmon_navi_many_wlan_nws_available -//l:navi_navi_text_pane_t1 -//r:3.0 -// -#define qtn_cmon_navi_many_wlan_nws_available "%N networks available" - - -//d: Menu item to disconnect WLAN network -//l: list_single_pane_t1_cp2 -//r:3.0 -// -#define qtn_sniffer_opt_disconnect_wlan "Disconnect WLAN" - - -//d: Menu item of WLAN Sniffer’s main view options menu -//d: The command is used to open WLAN settings view -//l: list_single_pane_t1_cp2 -//r:3.0 -// -#define qtn_sniffer_opt_settings "Settings" - - -//d: Menu item of WLAN Sniffer’s main view options menu -//d: The command is used to define new access point for the selected WLAN -//l: list_single_pane_t1_cp2 -//r:3.0 -// -#define qtn_sniffer_opt_define_access_point "Define access point" - -//d: Menu item of WLAN Sniffer’s main view options menu -//d: The command is used to edit access point for the selected WLAN -//l: list_single_pane_t1_cp2 -//r:3.0 -// -#define qtn_sniffer_opt_edit_access_point "Edit access point" - -//d: Menu item of WLAN Sniffer’s main view options menu -//d: The command is used to view details of WLAN networks -//l: list_single_pane_t1_cp2 -//r:3.0 -// -#define qtn_sniffer_opt_details "Details" - -//d: Menu item of WLAN Sniffer’s main view options menu -//d: The command is used to refresh list of WLAN hotspots -//l: list_single_pane_t1_cp2 -//r:3.0 -// -#define qtn_sniffer_opt_refresh "Refresh" - - -//d: Menu item. -//d: The command is used to connect WLAN using selected IAP -//l: list_single_pane_t1_cp2 -//r:3.0 -// -#define qtn_sniffer_opt_connect "Connect" - -//d: Menu item of WLAN Sniffer’s main view options menu -//d: The command is used to start web browser -//l: list_single_pane_t1_cp2 -//r:3.0 -// -#define qtn_sniffer_opt_start_web_browsing "Start Web browsing" - - -//d: Menu item of WLAN Sniffer’s main view options menu -//d: The command is used to continue web browsing with selected IAP -//l: list_single_pane_t1_cp2 -//r:3.0 -#define qtn_sniffer_opt_continue_web_browsing "Continue Web browsing" - -//d: Text for unknown WLAN network -//l:list_double_graphic_pane_t2 -//r:3.0 -// -#define qtn_sniffer_unknown "Unknown" - - -//d: Text for known WLAN network -//l:list_double_graphic_pane_t2 -//r:3.0 -// -#define qtn_sniffer_known "Known" - - -//d: Text for a network that a connection is being established -//l:list_double_graphic_pane_t2 -//r:5.2 -// -#define qtn_sniffer_connecting "Connecting" - - -//d: Text for connected WLAN network -//l:list_double_graphic_pane_t2 -//r:3.0 -// -#define qtn_sniffer_connected "Connected" - - -// d:label text for hidden ssid at select wlan network dialog list -// d:(one row) -// l:list_double_graphic_pane_t1 -#define qtn_sniffer_plug_in_hidden_ssid_label "Other (hidden netw.)" - -//d: Application title -//l: title_pane_t2/opt9 -//r:3.0 -// -#define qtn_sniffer_title "WLAN" - -//d: If no WLAN network have been found, The information note is displayed. -//l: popup_note_window -//r:3.0 -// -#define qtn_wlan_info_no_networks_found "No WLAN networks found" - -//d: This error note is displayed if the user wants to connect but -//d: there is already an active WLAN connection. -//l: popup_note_window/opt1 -//r:3.0 -// -#define qtn_wlan_info_connection_already_active "A WLAN connection is already active. Close connection and try again." - - -//d:The main view is empty and the application starts to search available WLAN -//d:networks. During scanning a wait note Searching WLAN networks... -//l:popup_note_wait_window -//r:3.0 -// -#define qtn_wlan_wait_searching_networks "Searching WLAN networks" - -//d: This confirmation query is displayed if the user selected Start web browsing -//d: on a WLAN network but the browser is already running and using -//d: a different connection. -//l: popup_note_window -//r:3.0 -// -#define qtn_sniffer_quest_restart_browsing_with_wlan "Web application needs to be restarted for WLAN usage. Continue?" - - -//d: Menu item of WLAN Sniffer’s main view options menu -//d: The command is used to set/edit wlans which are blocked away -//l: list_single_pane_t1_cp2 -//r:3.0 -#define qtn_sniffer_opt_filter_out_wlans "Filter out networks" - -//d: Title of Filter out wlans list -//l: heading_pane_t1 -//r:3.0 -// -#define qtn_note_title_filter_out_wlans "Hide selected networks:" - - - - -//------------------------------------------------------------------------------ -// Details view texts (specified in Networking spec) * -//------------------------------------------------------------------------------ - - -//d:Navi pane text in Available WLAN networks details view. -//d:The navi pane displays the “serial number” (%0N) of the -//d:network in question and the total amount of the connections -//d:(%1N) using the navigation text component: %0N/%1N -//l:navi_navi_text_pane_t1 -//w: -//r:3.0 -// -#define qtn_cmon_navi_nof_wlan_network "%0N/%1N" - -//d:The name of the WLAN IAP -//l:list_single_heading_pane_t2 -//w: -//r:5.0 -// -#define qtn_cmon_heading_conn_name "Name" - -//d: WLAN network name (SSID) detail of the network -//l:list_single_heading_pane_t2 -//w: -//r:3.0 -// -#define qtn_cmon_heading_wlan_network_name "Network" - -//d: WLAN network signal strength detail of the network -//l:list_single_heading_pane_t2 -//w: -//r:3.0 -// -#define qtn_cmon_heading_wlan_signal_strength "Signal" - -//d: WLAN network mode detail of the network -//l:list_single_heading_pane_t2 -//w: -//r:3.0 -// -#define qtn_cmon_heading_wlan_network_mode "Mode" - -//d:WLAN network Security mode used by the WLAN network detail of the network -//l:list_single_heading_pane_t2 -//w: -//r:3.0 -// -#define qtn_cmon_heading_wlan_security_mode "Security" - -//d:WLAN network Amount of physical WLAN access points detail of the network -//l:list_single_heading_pane_t2 -//w: -//r:3.0 -// -#define qtn_cmon_heading_wlan_nw_ap_amount "Coverage" - -//d:WLAN network Maximum data rate detail of the network -//l:list_single_heading_pane_t2 -//w: -//r:3.0 -// -#define qtn_cmon_heading_wlan_nw_max_rate "Max. rate" - -//d:WLAN network Amount of physical WLAN access points (AP) in range, if a single AP is in range -//l:list_single_heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_cmon_wlan_ap_amount_in_range_1 "1 access point" - -//d:WLAN network Amount of physical WLAN access points (AP) in range, if multiple APs in range (%N is the amount) -//l:list_single_heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_cmon_wlan_ap_amount_in_range_many "%N access points" - -//d:WLAN network Maximum data rate in network (of best AP in range) -//d:in megabits per secondin -//l:list_single_heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_cmon_wlan_max_data_rate "%U Mbit/s" - -//d:In details view, if a certain detail becomes unavailable this string is displayed -//l:list_single_heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_cmon_parameter_unavailable "(unavailable)" - -//d: WLAN network signal strength text if the network in question becomes unavailable while -//d:in details view, -//l:list_single_heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_cmon_wlan_signal_strength_no_signal "No signal" - -//d: WLAN network signal strength value text -//l:list_single_heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_cmon_wlan_signal_strength_low "Low (%N%)" - -//d: WLAN network signal strength value text -//l:list_single_heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_cmon_wlan_signal_strength_medium "Medium (%N%)" - -//d: WLAN network signal strength value text -//l:list_single_heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_cmon_wlan_signal_strength_good "Good (%N%)" - -//d: WLAN network security mode value text -//l:list_single_heading_pane_t1 -//w: -//r:3.1 -// -#define qtn_wlan_sett_security_mode_open "Open network" - -//d: WLAN network security mode value text, this is the abbrevation of a kind of security mode -//l:list_single_heading_pane_t1 -//w: -//r:3.1 -// -#define qtn_wlan_sett_security_mode_wep "WEP" - -//d: WLAN network security mode value text, this is the abbrevation of a kind of security mode -//l:list_single_heading_pane_t1 -//w: -//r:3.1 -// -#define qtn_wlan_sett_security_mode_802_1x "802.1x" - -//d: WLAN network security mode value text, this is the abbrevation of a kind of security mode -//l:list_single_heading_pane_t1 -//w: -//r:3.1 -// -#define qtn_wlan_sett_security_mode_wpa "WPA/WPA2" - -//d: WLAN network security mode value text, this is the abbrevation of a kind of security mode -//l:list_single_heading_pane_t1 -//w: -//r:5.2 -// -#define qtn_wlan_sett_security_mode_wapi "WAPI" - -//d: WLAN network network mode: with AP -//l:list_single_heading_pane_t1 -//w: -//r:3.1 -// -#define qtn_cmon_wlan_network_mode_infra "Infrastructure" - -//d: WLAN network network mode: without AP -//l:list_single_heading_pane_t1 -//w: -//r:3.1 -// -#define qtn_cmon_wlan_network_mode_adhoc "Ad-hoc" - - -// End of File diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/rom/wsfmainapplication.iby --- a/wlanutilities/wlansniffer/mainapplication/rom/wsfmainapplication.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/rom/wsfmainapplicationresources.iby --- a/wlanutilities/wlansniffer/mainapplication/rom/wsfmainapplicationresources.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/src/wsfactivetimeupdater.cpp --- a/wlanutilities/wlansniffer/mainapplication/src/wsfactivetimeupdater.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,139 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/src/wsfactivewaiter.cpp --- a/wlanutilities/wlansniffer/mainapplication/src/wsfactivewaiter.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/src/wsfapplication.cpp --- a/wlanutilities/wlansniffer/mainapplication/src/wsfapplication.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/src/wsfappui.cpp --- a/wlanutilities/wlansniffer/mainapplication/src/wsfappui.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,542 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of CWsfAppUi. -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "wlansettingsui.h" -#include "wsfappui.h" -#include "wsfmainview.h" -#include "wsfdetailsview.h" -#include "wsfmainviewcontrollerif.h" -#include "wsfdetailsviewcontrollerif.h" -#include "wsfmainuiobserver.h" -#include "wsfmainapplication.hrh" -#include "wsfdocument.h" -#include "wsfconnecteddetailsdialog.h" -#include "wsfconnecteddetailsmodel.h" -#include "wsfmodel.h" -#include "wsflogger.h" - -// LOCAL DEFINITIONS -#ifdef _DEBUG - _LIT( KAppUi, "CWsfAppUi" ); - #define _ASSERTD( cond ) __ASSERT_DEBUG( (cond), \ - User::Panic( KAppUi, __LINE__) ) -#else - #define _ASSERTD( cond ) {} -#endif //_DEBUG - -// --------------------------------------------------------------------------- -// CWsfAppUi::ConstructL -// --------------------------------------------------------------------------- -// -void CWsfAppUi::ConstructL() - { - LOG_CREATE; - LOG_WRITE( "Constructing Wlan Sniffer" ); - LOG_ENTERFN( "CWsfAppUi::ConstructL" ); - - BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible ); - - // Initialize feature manager - FeatureManager::InitializeLibL(); - iFeatureManagerInitialized = ETrue; - - iIdle = CIdle::NewL( CActive::EPriorityIdle ); - - // check if the app. launched in embedded mode - TBool isEmbeddedApp = IsEmbedded(); - LOG_WRITEF( "IsEmbedded(): %d", isEmbeddedApp ); - - //Create mainview - LOG_WRITE( "Creating main view" ); - CWsfMainView* mainView = CWsfMainView::NewLC( isEmbeddedApp ); - LOG_WRITE( "Adding main view" ); - AddViewL( mainView ); // transfer ownership to CAknViewAppUi - CleanupStack::Pop( mainView ); - LOG_WRITE( "main view creating done" ); - SetDefaultViewL( *mainView ); - iObserver->MainViewCreatedL(); - - //Create details view (not connected) - LOG_WRITE( "Create details view (not connected)" ); - CWsfDetailsView* detailsView = CWsfDetailsView::NewLC(); - LOG_WRITE( "Adding details view (not connected)" ); - AddViewL( detailsView ); // transfer ownership to CAknViewAppUi - CleanupStack::Pop( detailsView ); - LOG_WRITE( "details view (not connected) creating done" ); - - ActivateMainViewL(); - - iIdle->Start( TCallBack( AppLaunchCompleteL, this ) ); - } - - -// --------------------------------------------------------------------------- -// CWsfAppUi::CWsfAppUi -// --------------------------------------------------------------------------- -// -CWsfAppUi::CWsfAppUi(): - iConnectedDetailsDialog( NULL ), - iForeground( ETrue ), - iFeatureManagerInitialized( EFalse ) - { - // no implementation required - } - - -// --------------------------------------------------------------------------- -// CWsfAppUi::~CWsfAppUi -// --------------------------------------------------------------------------- -// -CWsfAppUi::~CWsfAppUi() - { - if ( iWaitDialog ) - { - iWaitDialog->SetCallback( NULL ); - TRAP_IGNORE( iWaitDialog->ProcessFinishedL() ); - } - - if ( iFeatureManagerInitialized ) - { - FeatureManager::UnInitializeLib(); - } - - delete iIdle; - delete iConnectedDetailsDialog; - LOG_WRITE( "CWsfAppUi::~CWsfAppUi" ); - } - - -// --------------------------------------------------------------------------- -// CWsfAppUi::HandleCommandL -// --------------------------------------------------------------------------- -// -void CWsfAppUi::HandleCommandL( TInt aCommand ) - { - LOG_ENTERFN( "CWsfAppUi::HandleCommandL" ); - switch ( aCommand ) - { - case EEikCmdExit: - case EAknCmdExit: - case EAknSoftkeyExit: - { - if ( iAppLaunchCompleted ) - { - Exit(); - } - break; - } - - case ESnifferCmdStartBrowsing: - { - iObserver->StartBrowsingL(); - break; - } - - case ESnifferCmdContinueBrowsing: - { - iObserver->ContinueBrowsingL(); - break; - } - - case ESnifferCmdShowWlans: - { - iObserver->ShowWlanListL(); - break; - } - - case ESnifferCmdConnect: - { - iObserver->ConnectL(); - break; - } - case ESnifferCmdDisconnect: - { - iObserver->DisconnectL(); - break; - } - case ESnifferCmdRefresh: - { - iObserver->RefreshL(); - break; - } - case ESnifferCmdDetails: - { - iObserver->ShowDetailsL(); - break; - } - case ESnifferCmdFilterWlans: - { - iObserver->EditBlackListItemsL(); - break; - } - case ESnifferCmdSettings: - { - // launch settings dialog - CWlanSettingsUi* wlanSettings = - CWlanSettingsUi::NewL( *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" ); - - CConnectionUiUtilities* connUiUtils = CConnectionUiUtilities::NewL(); - connUiUtils->NoWLANNetworksAvailableNote(); - delete connUiUtils; - } - - -// --------------------------------------------------------------------------- -// CWsfAppUi::ShowErrorNoteL -// --------------------------------------------------------------------------- -// -void CWsfAppUi::ShowErrorNoteL( TInt aResourceId ) - { - LOG_ENTERFN( "CWsfAppUi::ShowErrorNoteL" ); - HBufC* txt = StringLoader::LoadLC( aResourceId ); - - CAknErrorNote* errorNote = new (ELeave) CAknErrorNote; - errorNote->ExecuteLD( *txt ); - - CleanupStack::PopAndDestroy( txt ); - } - - -// --------------------------------------------------------------------------- -// CWsfAppUi::ShowGlobalErrorNoteL -// --------------------------------------------------------------------------- -// -void CWsfAppUi::ShowGlobalErrorNoteL( TInt aError ) - { - LOG_ENTERFN( "CWsfAppUi::ShowGlobalErrorNoteL" ); - CErrorUI* errorUi = CErrorUI::NewLC( *CCoeEnv::Static() ); - errorUi->ShowGlobalErrorNoteL( aError ); - CleanupStack::PopAndDestroy( errorUi ); - } - - -// --------------------------------------------------------------------------- -// CWsfAppUi::AppLaunchCompleteL -// --------------------------------------------------------------------------- -// -TInt CWsfAppUi::AppLaunchCompleteL( TAny* aObject ) - { - LOG_ENTERFN( "CWsfAppUi::AppLaunchCompleteL" ); - _ASSERTD( aObject ); - CWsfAppUi* appUi = static_cast( aObject ); - appUi->iAppLaunchCompleted = ETrue; - appUi->StartWaitNoteL( EFalse ); - return 0; // Return false (zero) value not be called again. (Stops timer) - } - - -// --------------------------------------------------------------------------- -// CWsfAppUi::IsEmbedded -// --------------------------------------------------------------------------- -// -TBool CWsfAppUi::IsEmbedded() const - { - LOG_ENTERFN( "CWsfAppUi::IsEmbedded" ); - return iEikonEnv->StartedAsServerApp(); - } - - -// --------------------------------------------------------------------------- -// CWsfAppUi::Doc -// --------------------------------------------------------------------------- -// -CWsfDocument* CWsfAppUi::Doc() - { - return static_cast( Document() ); - } - - -// --------------------------------------------------------------------------- -// CWsfAppUi::Foreground -// --------------------------------------------------------------------------- -// -TBool CWsfAppUi::Foreground() - { - return iForeground; - } - - -// --------------------------------------------------------------------------- -// CWsfAppUi::StartConnectedDetailsL -// --------------------------------------------------------------------------- -// -void CWsfAppUi::StartConnectedDetailsL( CWsfWlanInfoArray* aWlanArray, - const TDesC8& aSelectedWlanSsid ) - { - LOG_ENTERFN( "CWsfAppUi::StartConnectedDetailsL" ); - CWsfConnectedDetailsModel* model = CWsfConnectedDetailsModel::NewLC(); - iConnectedDetailsDialog = CWsfConnectedDetailsDialog::NewL(); - iConnectedDetailsDialog->SetListModel(model); - iConnectedDetailsDialog->Controller().SetWlanListL( aWlanArray, - aSelectedWlanSsid ); - iConnectedDetailsDialog->ExecuteLD( R_QTN_CONNECTED_DETAILS_DIALOG ); - iConnectedDetailsDialog = NULL; - CleanupStack::PopAndDestroy(model); - } - - -// --------------------------------------------------------------------------- -// CWsfAppUi::UpdateConnectedDetailsL -// --------------------------------------------------------------------------- -// -void CWsfAppUi::UpdateConnectedDetailsL( CWsfWlanInfoArray* aWlanArray ) - { - LOG_ENTERFN( "CWsfAppUi::UpdateConnectedDetailsL" ); - if ( iConnectedDetailsDialog != NULL ) - { - iConnectedDetailsDialog->Controller().WlanListChangedL( aWlanArray ); - } - } - - -// --------------------------------------------------------------------------- -// CWsfAppUi::SuppressingKeyEvents -// --------------------------------------------------------------------------- -// -TBool CWsfAppUi::SuppressingKeyEvents() const - { - return iSuppressingKeyEvents; - } - - -// --------------------------------------------------------------------------- -// CWsfAppUi::SetSuppressingKeyEvents -// --------------------------------------------------------------------------- -// -void CWsfAppUi::SetSuppressingKeyEvents( TBool aSuppressing ) - { - iSuppressingKeyEvents = aSuppressing; - } - -// End of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/src/wsfconnecteddetailscontroller.cpp --- a/wlanutilities/wlansniffer/mainapplication/src/wsfconnecteddetailscontroller.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/src/wsfconnecteddetailsdialog.cpp --- a/wlanutilities/wlansniffer/mainapplication/src/wsfconnecteddetailsdialog.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,183 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/src/wsfconnecteddetailsmodel.cpp --- a/wlanutilities/wlansniffer/mainapplication/src/wsfconnecteddetailsmodel.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,573 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/src/wsfdetailscontainer.cpp --- a/wlanutilities/wlansniffer/mainapplication/src/wsfdetailscontainer.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,388 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/src/wsfdetailsview.cpp --- a/wlanutilities/wlansniffer/mainapplication/src/wsfdetailsview.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,183 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/src/wsfdetailsviewcontroller.cpp --- a/wlanutilities/wlansniffer/mainapplication/src/wsfdetailsviewcontroller.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,243 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/src/wsfdetailsviewmodel.cpp --- a/wlanutilities/wlansniffer/mainapplication/src/wsfdetailsviewmodel.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,692 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/src/wsfdocument.cpp --- a/wlanutilities/wlansniffer/mainapplication/src/wsfdocument.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/src/wsfentrypoint.cpp --- a/wlanutilities/wlansniffer/mainapplication/src/wsfentrypoint.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/src/wsfmaincontroller.cpp --- a/wlanutilities/wlansniffer/mainapplication/src/wsfmaincontroller.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,901 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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; - TRAPD( error, iModel->CheckIsIapIdValidL( firstItem->iIapId ) ); - if ( error ) - { - LOG_WRITEF( "Iap Id is not valid - error=%d", error ); - if ( firstItem->iRawSsid.Length() ) - { - firstItem->iSsid.Copy( firstItem->iRawSsid ); - } - firstItem->iIapId = 0; - } - iInfoArray->SortArrayL(); - UpdateViewL( iInfoArray ); - } - } - } - - // Abort current scan if exists so that we get - // newest scan results propagated to ui - iModel->AbortScanningL(); - iModel->RefreshScanL(); - } - -// --------------------------------------------------------------------------- -// TWsfMainController::ConnectingFinishedL -// --------------------------------------------------------------------------- -// -void TWsfMainController::ConnectionCreationProcessFinishedL( TInt /*aResult*/ ) - { - // no implementation required - } - -// --------------------------------------------------------------------------- -// TWsfMainController::ShowMenuBarL -// --------------------------------------------------------------------------- -// -void TWsfMainController::ShowMenuBarL() - { - LOG_ENTERFN( "TWsfMainController::ShowMenuBarL" ); - iAppUi->ShowMenuBarL(); - } - -// --------------------------- Events from the details view ------------------ - -// --------------------------------------------------------------------------- -// TWsfMainController::CloseDetailsViewL -// --------------------------------------------------------------------------- -// -void TWsfMainController::CloseDetailsViewL() - { - LOG_ENTERFN( "TWsfMainController::CloseDetailsViewL" ); - ShowWlanListL(); - // After the Details View closed the mainview's - // WlanList will be refreshed. - iModel->RefreshScanL(); - } - -// ------------------------------- Menu press handler ------------------------ - - -// ---------------------------------------------------------------------------- -// TWsfMainController::StartBrowsingL -// ---------------------------------------------------------------------------- -// -void TWsfMainController::StartBrowsingL() - { - LOG_ENTERFN( "TWsfMainController::StartBrowsingL" ); - if ( iAppUi->SuppressingKeyEvents() || iModel->IsConnectedL() && - ( !iMainView->SelectedItem() || - !iMainView->SelectedItem()->Connected() ) ) - { - iAppUi->ShowErrorNoteL( R_QTN_WLAN_INFO_CONNECTION_ALREADY_ACTIVE ); - return; - } - - // make sure we don't suppress our key events forever - CleanupStack::PushL( TCleanupItem( ReleaseSuppressingKeyEvents, this ) ); - iAppUi->SetSuppressingKeyEvents( ETrue ); - - TWsfWlanInfo* selectedItem = iMainView->SelectedItem(); - TWsfWlanInfo info; - - if ( selectedItem ) - { - info = *selectedItem; - } - - // Prevent connections to ad-hoc + WPA - if ( info.iNetMode == CMManager::EAdhoc - && info.iSecurityMode == CMManager::EWlanSecModeWpa ) - { - iAppUi->ShowGlobalErrorNoteL( KErrNotSupported ); - 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 - UpdateIapIdToInfoArray( info ); - - // 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 ); - } - - // 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 - UpdateIapIdToInfoArray( info ); - - // 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::UpdateIapIdToInfoArray -// --------------------------------------------------------------------------- -// -void TWsfMainController::UpdateIapIdToInfoArray( TWsfWlanInfo& aInfo ) - { - LOG_ENTERFN( "TWsfMainController::UpdateIapIdToInfoArray" ); - TWsfWlanInfo* temp = iInfoArray->Match( aInfo.iSsid, iInfoArray->Count() ); - if ( temp && !aInfo.Hidden() ) - { - LOG_WRITE( "Info found" ); - - // Check that there aren't any IAPs with same id - TWsfWlanInfo* wlanInfoWithSameIapId = iInfoArray->Match( aInfo.iIapId, - iInfoArray->Count() ); - if ( wlanInfoWithSameIapId ) - { - // info with same id found set its iap id to zero - LOG_WRITE( "info with same id found" ); - wlanInfoWithSameIapId->iIapId = 0; - } - - temp->iIapId = aInfo.iIapId; - - if ( aInfo.iNetworkName.Length() ) - { - // Replace ssid as well since scanner does this same thing - temp->iSsid.Copy( aInfo.iNetworkName ); - } - } - else - { - LOG_WRITE( "Info not found" ); - TWsfWlanInfo* createdInfo = new (ELeave) TWsfWlanInfo( aInfo ); - createdInfo->iVisibility = ETrue; - createdInfo->iStrengthLevel = EWlanSignalStrengthMax; - iInfoArray->AppendL( createdInfo ); - } - } - -// --------------------------------------------------------------------------- -// TWsfMainController::DisconnectL -// --------------------------------------------------------------------------- -// -void TWsfMainController::DisconnectL() - { - LOG_ENTERFN( "TWsfMainController::DisconnectL" ); - if ( iModel->IsConnecting() ) - { - LOG_WRITE( "Abort connecting" ); - iModel->AbortConnectingL(); - } - else - { - LOG_WRITE( "Disconnect" ); - iModel->DisconnectL(); - } - } - -// --------------------------------------------------------------------------- -// TWsfMainController::RefreshL -// --------------------------------------------------------------------------- -// -void TWsfMainController::RefreshL() - { - LOG_ENTERFN( "TWsfMainController::RefreshL" ); - TBool refreshing = iModel->RefreshScanL(); - if ( refreshing ) - { - iAppUi->StartWaitNoteL( ETrue ); - } - } - -// --------------------------------------------------------------------------- -// TWsfMainController::ContinueBrowsingL -// --------------------------------------------------------------------------- -// -void TWsfMainController::ContinueBrowsingL() - { - LOG_ENTERFN( "TWsfMainController::ContinueBrowsingL" ); - // pass selected WLAN info to engine - TWsfWlanInfo *selectedItem = iMainView->SelectedItem(); - - if ( selectedItem ) - { - // Prevent connections to ad-hoc + WPA - if ( selectedItem->iNetMode == CMManager::EAdhoc - && selectedItem->iSecurityMode == CMManager::EWlanSecModeWpa ) - { - iAppUi->ShowGlobalErrorNoteL( KErrNotSupported ); - return; - } - - TUint iapId = selectedItem->iIapId; - iModel->ContinueBrowsingL( iapId ); - } - } - -// --------------------------------------------------------------------------- -// TWsfMainController::EngineRefreshing -// --------------------------------------------------------------------------- -// -TBool TWsfMainController::EngineRefreshing() - { - LOG_ENTERFN( "TWsfMainController::EngineRefreshing" ); - _ASSERTD( iModel ); - return iModel->Refreshing(); - } - -// --------------------------------------------------------------------------- -// TWsfMainController::AppLaunchCompleteL -// --------------------------------------------------------------------------- -// -void TWsfMainController::AppLaunchCompleteL() - { - LOG_ENTERFN( "TWsfMainController::AppLaunchCompleteL" ); - iAppUi->StartWaitNoteL( EFalse ); - iModel->EnableScanL(); - } - -// --------------------------------------------------------------------------- -// TWsfMainController::AppSwitchedForegroundL -// --------------------------------------------------------------------------- -// -void TWsfMainController::AppSwitchedForegroundL() - { - LOG_ENTERFN( "TWsfMainController::AppSwitchedForegroundL" ); - - //turn on scanning for our point of view - iModel->EnableScanL(); - - if ( !iModel->IsConnecting() ) - { - LOG_WRITE( "Scan now" ); - TBool scan = iModel->RefreshScanL(); - if( !scan ) - { - LOG_WRITE( "Set refresh state to true" ); - //if the refresh call was called when the server was - //actually making a scan then the refresh state of the - //model is turned to false, but in this case the scanning - //wait note will stuck on the screen, That's why the - //refresh state must be turned to true - iModel->SetRefreshState( ETrue ); - } - } - } - -// --------------------------------------------------------------------------- -// TWsfMainController::AppSwitchedBackgroundL -// --------------------------------------------------------------------------- -// -void TWsfMainController::AppSwitchedBackgroundL() - { - LOG_ENTERFN( "TWsfMainController::AppSwitchedBackgroundL" ); - iModel->DisableScanL(); - } - - -// --------------------------------------------------------------------------- -// TWsfMainController::BrowserLaunchCompleteL -// --------------------------------------------------------------------------- -// -void TWsfMainController::BrowserLaunchCompleteL() - { - LOG_ENTERFN( "TWsfMainController::BrowserLaunchCompleteL" ); - // no implementation required - } - - -// --------------------------------------------------------------------------- -// TWsfMainController::BrowserExitL -// --------------------------------------------------------------------------- -// -void TWsfMainController::BrowserExitL() - { - LOG_ENTERFN( "TWsfMainController::BrowserExitL" ); - iModel->AbortScanningL(); - iModel->RefreshScanL(); - } - - -// --------------------------------------------------------------------------- -// TWsfMainController::BrowserLaunchFailed -// --------------------------------------------------------------------------- -// -void TWsfMainController::BrowserLaunchFailed( TInt aError ) - { - LOG_ENTERFN( "TWsfMainController::BrowserLaunchFailed" ); - LOG_WRITEF( "error = %d", aError ); - switch ( aError ) - { - case KErrCancel: - { - // user pressed cancel to connection creation - break; - } - - default: - { - break; - } - } - } - -// --------------------------------------------------------------------------- -// TWsfMainController::ConnectingL -// --------------------------------------------------------------------------- -// -void TWsfMainController::ConnectingL( TUint32 aIapId ) - { - LOG_ENTERFN( "TWsfMainController::ConnectingL" ); - iModel->SetConnecting( ETrue ); - - // update the model and refresh ui - if ( iInfoArray ) - { - LOG_WRITEF( "Match array with iapID = %d", aIapId ); - // find the entry for aIapId - // mark it connecting - sort the array and refresh - TWsfWlanInfo* temp = iInfoArray->Match( aIapId, iInfoArray->Count() ); - if ( temp ) - { - LOG_WRITEF( "Info found iapID = %d", aIapId ); - temp->iConnectionState = EConnecting; - iInfoArray->SortArrayL(); - UpdateViewL( iInfoArray ); - } - } - } - - -// --------------------------------------------------------------------------- -// TWsfMainController::ConnectingFinishedL -// --------------------------------------------------------------------------- -// -void TWsfMainController::ConnectingFinishedL( TInt aResult ) - { - LOG_ENTERFN( "TWsfMainController::ConnectingFinishedL" ); - if ( iModel->IsConnecting() ) - { - iModel->SetConnecting( EFalse ); - iModel->SetRefreshState( ETrue ); - iAppUi->HideWaitNoteL(); - } - - if ( aResult != KErrNone && aResult != KErrCancel ) - { - LOG_WRITEF( "Connection failed with error=%d", aResult ); - if ( iInfoArray && iInfoArray->Count() && - iInfoArray->At(0)->iConnectionState == EConnecting ) - { - iInfoArray->At(0)->iConnectionState = ENotConnected; - TRAPD( error, iModel->CheckIsIapIdValidL( - iInfoArray->At(0)->iIapId ) ); - if ( error ) - { - LOG_WRITEF( "Iap Id %d is not valid - error=%d", - iInfoArray->At(0)->iIapId, error ); - - if ( iInfoArray->At(0)->iRawSsid.Length() ) - { - iInfoArray->At(0)->iSsid.Copy( - iInfoArray->At(0)->iRawSsid ); - } - - iInfoArray->At(0)->iIapId = 0; - } - iInfoArray->SortArrayL(); - UpdateViewL( iInfoArray ); - iModel->AbortScanningL(); - iModel->RefreshScanL(); - } - } - } - - -// --------------------------------------------------------------------------- -// TWsfMainController::EditBlackListItemsL -// --------------------------------------------------------------------------- -// -void TWsfMainController::EditBlackListItemsL() - { - LOG_ENTERFN( "TWsfMainController::EditBlackListItemsL" ); - _ASSERTD( iWlanInfoBranding ); - iWlanInfoBranding->EditBlackListL( *iInfoArray ); - iModel->RefreshScanL(); - } - -// --------------------------------------------------------------------------- -// TWsfMainController::DetailsScanL -// --------------------------------------------------------------------------- -// -void TWsfMainController::DetailsScanL() - { - LOG_ENTERFN( "TWsfMainController::DetailsScanL" ); - iModel->RefreshScanL(); - } - -// --------------------------------------------------------------------------- -// TWsfMainController::ReleaseSuppressingKeyEvents -// --------------------------------------------------------------------------- -// -void TWsfMainController::ReleaseSuppressingKeyEvents( TAny* aPtr ) - { - TWsfMainController* self = - static_cast( aPtr ); - self->iAppUi->SetSuppressingKeyEvents( EFalse ); - self->iModel->SetConnecting( EFalse ); - TRAP_IGNORE( self->iModel->RefreshScanL() ); - } - -// End of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/src/wsfmainview.cpp --- a/wlanutilities/wlansniffer/mainapplication/src/wsfmainview.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,490 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/src/wsfmainviewcontainer.cpp --- a/wlanutilities/wlansniffer/mainapplication/src/wsfmainviewcontainer.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,803 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/src/wsfmainviewcontroller.cpp --- a/wlanutilities/wlansniffer/mainapplication/src/wsfmainviewcontroller.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,222 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/mainapplication/src/wsfmainviewmodel.cpp --- a/wlanutilities/wlansniffer/mainapplication/src/wsfmainviewmodel.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,378 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/model/bwins/wsfmodelu.def --- a/wlanutilities/wlansniffer/model/bwins/wsfmodelu.def Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -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) - ?CheckIsIapIdValidL@CWsfModel@@QBEXI@Z @ 37 NONAME ; void CWsfModel::CheckIsIapIdValidL(unsigned int) const - diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/model/eabi/wsfmodelu.def --- a/wlanutilities/wlansniffer/model/eabi/wsfmodelu.def Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -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 - _ZNK9CWsfModel18CheckIsIapIdValidLEj @ 40 NONAME - diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/model/group/bld.inf --- a/wlanutilities/wlansniffer/model/group/bld.inf Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/model/group/model.mmp --- a/wlanutilities/wlansniffer/model/group/model.mmp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/model/inc/wsfactivewaiter.h --- a/wlanutilities/wlansniffer/model/inc/wsfactivewaiter.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/model/inc/wsfapplauncher.h --- a/wlanutilities/wlansniffer/model/inc/wsfapplauncher.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,339 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/model/inc/wsfbrowserlaunchadapter.h --- a/wlanutilities/wlansniffer/model/inc/wsfbrowserlaunchadapter.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/model/inc/wsfbrowserlaunchobserver.h --- a/wlanutilities/wlansniffer/model/inc/wsfbrowserlaunchobserver.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/model/inc/wsfmodel.h --- a/wlanutilities/wlansniffer/model/inc/wsfmodel.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,541 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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(); - - /** - * Check if Iap Id is valid - * Leaves with system wide error code if Iap ID is - * not valid or checking fails - * @since S60 5.2 - * @param aIapId IAP id passed as a parameter - */ - IMPORT_C void CheckIsIapIdValidL( TUint aIapId ) const; - - public: // from MWsfBrowserLaunchAdapter - /** - * Launches Browser application using selected iap - * @since S60 5.0 - * @param aIapId IAP id passed as a parameter - */ - IMPORT_C void LaunchBrowserL( TUint32 aIapId ); - - - /** - * 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/model/inc/wsfmodel.inl --- a/wlanutilities/wlansniffer/model/inc/wsfmodel.inl Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/model/inc/wsfmodelobserver.h --- a/wlanutilities/wlansniffer/model/inc/wsfmodelobserver.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/model/inc/wsfscreensaverstateobserver.h --- a/wlanutilities/wlansniffer/model/inc/wsfscreensaverstateobserver.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/model/inc/wsfscreensaverwatcher.h --- a/wlanutilities/wlansniffer/model/inc/wsfscreensaverwatcher.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/model/rom/wsfmodel.iby --- a/wlanutilities/wlansniffer/model/rom/wsfmodel.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/model/src/wsfactivewaiter.cpp --- a/wlanutilities/wlansniffer/model/src/wsfactivewaiter.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/model/src/wsfapplauncher.cpp --- a/wlanutilities/wlansniffer/model/src/wsfapplauncher.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,637 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/model/src/wsfmodel.cpp --- a/wlanutilities/wlansniffer/model/src/wsfmodel.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1155 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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(); - LOG_WRITEF( "iRefreshing = %d", iRefreshing ); - 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 ); - } - } - -// ---------------------------------------------------------------------------- -// CWsfModel::CheckIsIapIdValidL -// ---------------------------------------------------------------------------- -// -EXPORT_C void CWsfModel::CheckIsIapIdValidL( TUint aIapId ) const - { - LOG_ENTERFN( "CWsfModel::CheckIsIapIdValidL" ); - LOG_WRITEF( "Checking iapId= %d", aIapId ); - if( aIapId ) - { - RCmManagerExt cmManager; - cmManager.OpenL(); - CleanupClosePushL( cmManager ); - - RCmConnectionMethodExt cm = cmManager.ConnectionMethodL( aIapId ); - cm.Close(); - CleanupStack::PopAndDestroy( &cmManager ); - } - else - { - User::Leave( KErrArgument ); - } - } - -// End of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/model/src/wsfscreensaverwatcher.cpp --- a/wlanutilities/wlansniffer/model/src/wsfscreensaverwatcher.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/res/qgn_indi_wifi_protected_add.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/res/qgn_indi_wifi_protected_add.svg Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,10 @@ + + + + + + + + + + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/res/qgn_indi_wlan_secure_network_add.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/res/qgn_indi_wlan_secure_network_add.svg Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/res/qgn_indi_wlan_signal_good_add.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/res/qgn_indi_wlan_signal_good_add.svg Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,10 @@ + + + + + + + + + + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/res/qgn_indi_wlan_signal_low_add.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/res/qgn_indi_wlan_signal_low_add.svg Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/res/qgn_indi_wlan_signal_med_add.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/res/qgn_indi_wlan_signal_med_add.svg Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/res/qgn_prop_cmon_wlan_conn.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/res/qgn_prop_cmon_wlan_conn.svg Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/res/qgn_prop_wlan_bearer.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/res/qgn_prop_wlan_bearer.svg Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/res/service_conf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/res/service_conf.xml Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,7 @@ + + + WLAN Sniffer + + List View + + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/res/wlansniffer.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/res/wlansniffer.qrc Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,15 @@ + + + wlansnifferlistview.docml + + + + qgn_indi_wifi_protected_add.svg + qgn_indi_wlan_secure_network_add.svg + qgn_indi_wlan_signal_good_add.svg + qgn_indi_wlan_signal_low_add.svg + qgn_indi_wlan_signal_med_add.svg + qgn_prop_cmon_wlan_conn.svg + qgn_prop_wlan_bearer.svg + + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/rom/wlansniffer.iby --- a/wlanutilities/wlansniffer/rom/wlansniffer.iby Tue Jan 26 13:04:04 2010 +0200 +++ b/wlanutilities/wlansniffer/rom/wlansniffer.iby Fri Apr 16 16:07:56 2010 +0300 @@ -1,38 +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 WlanSniffer -* -*/ - + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ #ifndef WLANSNIFFER_IBY #define WLANSNIFFER_IBY -#ifdef __PROTOCOL_WLAN - -REM WlanSniffer - -#include #include +#ifdef __PROTOCOL_WLAN -// appshell icon -S60_APP_AIF_ICONS(wsficons) - -// all other bitmaps -data=DATAZ_\APP_BITMAP_DIR\wsficons.mif APP_BITMAP_DIR\wsficons.mif +file=ABI_DIR\BUILD_DIR\wlansniffer.exe PROGRAMS_DIR\wlansniffer.exe +data=\epoc32\data\z\private\10003a3f\import\Apps\wlansniffer_reg.rsc \private\10003a3f\import\apps\wlansniffer_reg.rsc +data=\epoc32\data\z\resource\apps\wlansniffer.rsc \resource\apps\wlansniffer.rsc #endif // __PROTOCOL_WLAN -#endif // WLANSNIFFER_IBY \ No newline at end of file +#endif // WLANSNIFFER_IBY diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/rom/wlansniffer_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/rom/wlansniffer_resources.iby Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef WLANSNIFFER_RESOURCES_IBY +#define WLANSNIFFER_RESOURCES_IBY + +#include +#include + +#ifdef __PROTOCOL_WLAN + +data=DATAZ_/QT_TRANSLATIONS_DIR/wlansniffer.qm QT_TRANSLATIONS_DIR/wlansniffer.qm + +#endif // __PROTOCOL_WLAN + +#endif // WLANSNIFFER_RESOURCES_IBY diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/src/main.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifdef WLANSNIFFER_SERVICETRACES +#include "xqservicelog.h" +#endif + +#include "qsysteminfo.h" + +#include "wlansniffer.h" + +using namespace QtMobility; + +int main(int argc, char *argv[]) +{ + // Check WLAN dynamic configuration & exit if WLAN is not enabled + QSystemInfo sysinfo; + if (!sysinfo.hasFeatureSupported(QSystemInfo::WlanFeature)) { + return -1; + } + +#ifdef WLANSNIFFER_SERVICETRACES + qInstallMsgHandler(XQSERVICEMESSAGEHANDLER); +#endif + + WlanSniffer app(argc, argv); + + return app.exec(); +} + +// End of File diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/src/wlansniffer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/src/wlansniffer.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include +#include + +#include "wlanqtutils.h" + +#include "wlansniffer.h" +#include "wlansniffermainwindow.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlansnifferTraces.h" +#endif + +// Scan interval is 10 seconds +const int scanTimerInterval = 10000; + +WlanSniffer::WlanSniffer(int argc, char* argv[]) : + HbApplication(argc, argv), + mWlanQtUtils(new WlanQtUtils()) +{ + OstTraceFunctionEntry0( WLANSNIFFER_WLANSNIFFER_ENTRY ); + + // Start the first scan immediately so that results are available as + // soon as possible. Start also the timer for periodic scanning. + mWlanQtUtils->scanWlans(); + mScanTimerId = startTimer(scanTimerInterval); + + // Install localization + mTranslator = new QTranslator(this); + QString lang = QLocale::system().name(); + QString path = "Z:/resource/qt/translations/"; + mTranslator->load("wlansniffer_" + lang, path); + qApp->installTranslator(mTranslator); + + mMainWindow = new WlanSnifferMainWindow(this); + + connect( + mWlanQtUtils, + SIGNAL(wlanScanReady()), + mMainWindow, + SLOT(updateListView())); + + connect( + mWlanQtUtils, + SIGNAL(wlanNetworkOpened(int)), + mMainWindow, + SLOT(updateListViewConnectionOpened(int))); + + connect( + mWlanQtUtils, + SIGNAL(wlanNetworkClosed(int)), + mMainWindow, + SLOT(updateListViewConnectionClosed(int))); + + connect( + mMainWindow, + SIGNAL(exitTriggered()), + this, + SLOT(exitApplication())); + + OstTraceFunctionExit0( WLANSNIFFER_WLANSNIFFER_EXIT ); +} + +WlanSniffer::~WlanSniffer() +{ + OstTraceFunctionEntry0( WLANSNIFFER_WLANSNIFFERDESTR_ENTRY ); + + killTimer(mScanTimerId); + + delete mMainWindow; + delete mWlanQtUtils; + + OstTraceFunctionExit0( WLANSNIFFER_WLANSNIFFERDESTR_EXIT ); +} + +void WlanSniffer::timerEvent(QTimerEvent *event) +{ + OstTraceFunctionEntry0( WLANSNIFFER_TIMEREVENT_ENTRY ); + + Q_UNUSED(event); + // Request a new scan. Timer events come periodically. + mWlanQtUtils->scanWlans(); + + OstTraceFunctionExit0( WLANSNIFFER_TIMEREVENT_EXIT ); +} + +WlanQtUtils *WlanSniffer::wlanQtUtils() const +{ + OstTraceFunctionEntry0( WLANSNIFFER_WLANQTUTILS_ENTRY ); + OstTraceFunctionExit0( WLANSNIFFER_WLANQTUTILS_EXIT ); + return mWlanQtUtils; +} + +void WlanSniffer::exitApplication() +{ + OstTraceFunctionEntry0( WLANSNIFFER_EXITAPPLICATION_ENTRY ); + + exit(); + + OstTraceFunctionExit0( WLANSNIFFER_EXITAPPLICATION_EXIT ); +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/src/wlansnifferlistview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/src/wlansnifferlistview.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,315 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "wlanqtutils.h" +#include "wlanqtutilswlanap.h" +#include "wlanqtutilswlaniap.h" +#include "wlanqtutilscommon.h" + +#include "wlansniffer.h" +#include "wlansnifferlistview.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlansnifferlistviewTraces.h" +#endif + +WlanSnifferListView::WlanSnifferListView(WlanSniffer *appRef) : + mWlanList(NULL), + mStatusLabel(NULL), + mAppRef(appRef), + mConnectingIapId(0), + mIapItemMenuOpen(false) +{ + OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_WLANSNIFFERLISTVIEW_ENTRY ); + + bool ok = false; + HbDocumentLoader loader; + loader.load(":/docml/wlansnifferlistview.docml", &ok); + Q_ASSERT_X(ok, "Wlan Sniffer", "Invalid docml file"); + + // Load the view by name from the xml file + QGraphicsWidget *widget = loader.findWidget("occ_list"); + Q_ASSERT_X(widget != 0, "Wlan Sniffer", "View not found"); + // Set the WlanListView view to be the widget that was loaded from the xml + setWidget(widget); + + HbMenu *viewMenu = qobject_cast(loader.findWidget("viewMenu")); + Q_ASSERT_X(viewMenu != 0, "Wlan Sniffer", "Menu not found"); + setMenu(viewMenu); + + mWlanList = qobject_cast(loader.findWidget("listWidget")); + Q_ASSERT_X(mWlanList != 0, "Wlan Sniffer", "List not found"); + + mStatusLabel = qobject_cast(loader.findWidget("statusLabel")); + Q_ASSERT_X(mStatusLabel != 0, "Wlan Sniffer", "Label not found"); + + connect( + mWlanList, + SIGNAL(activated(HbListWidgetItem *)), + this, + SLOT(handleListItemActivated(HbListWidgetItem *))); + connect( + mWlanList, + SIGNAL(longPressed(HbListWidgetItem *, const QPointF &)), + this, + SLOT(handleListItemLongPressed(HbListWidgetItem *, const QPointF &))); + + // Set correct orientation when drawing view first time. Orientation change + // on the fly is not yet implemented + if (HbInstance::instance()->allMainWindows().value(0)->orientation() == Qt::Horizontal) { + bool loaded = false; + loader.load( ":/docml/wlansnifferlistview.docml", "landscape", &loaded ); + } // else: portrait is ok by default + + // We need to create a custom navigation action in case the application was + // launched as embedded via QtHighway + if (XQServiceUtil::isEmbedded()) { + HbAction *completeAction = new HbAction(Hb::BackNaviAction, this); + setNavigationAction(completeAction); + connect( + completeAction, + SIGNAL(triggered(bool)), + this, + SIGNAL(completeServiceTriggered())); + // TODO: What to do when exit action is ran? Should we close whole control panel? + } + + OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_WLANSNIFFERLISTVIEW_EXIT ); +} + +WlanSnifferListView::~WlanSnifferListView() +{ + OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_WLANSNIFFERLISTVIEWDESTR_ENTRY ); + OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_WLANSNIFFERLISTVIEWDESTR_EXIT ); +} + +void WlanSnifferListView::update() +{ + OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_UPDATE_ENTRY ); + + if (mIapItemMenuOpen == false) { + QList aps; + QList iaps; + + mAppRef->wlanQtUtils()->availableWlanAps(iaps, aps); + + mWlanList->clear(); + + // Loop the IAPs and APs and create the list items (lists are ordered already by Wlan Qt Utilities) + foreach (WlanQtUtilsWlanIap *iap, iaps) { + mWlanList->addItem(wlanListItemIapCreate(iap)); + } + // Loop the AP's and create the list items + foreach (WlanQtUtilsWlanAp *ap, aps) { + mWlanList->addItem(wlanListItemApCreate(ap)); + } + } + + OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_UPDATE_EXIT ); +} + +void WlanSnifferListView::updateConnectionOpened(int iapId) +{ + OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_UPDATECONNECTIONOPENED_ENTRY ); + + mStatusLabel->setPlainText( + hbTrId("txt_occ_grid_connected_to_1").arg(mAppRef->wlanQtUtils()->iap(iapId)->name())); + // Redraw the list so that the connected network moves on top + update(); + mConnectingIapId = 0; + + OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_UPDATECONNECTIONOPENED_EXIT ); +} + +void WlanSnifferListView::updateConnectionClosed(int iapId) +{ + OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_UPDATECONNECTIONCLOSED_ENTRY ); + + (void)iapId; + mStatusLabel->setPlainText(hbTrId("txt_occ_grid_not_connected")); + mConnectingIapId = 0; + + OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_UPDATECONNECTIONCLOSED_EXIT ); +} + +void WlanSnifferListView::handleListItemActivated(HbListWidgetItem *item) +{ + OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_HANDLELISTITEMACTIVATED_ENTRY ); + + QVariant data = item->data(); + if (data.canConvert()) { + // Item was an IAP. Connect the IAP or show details view depending on connection state + WlanQtUtilsIap *iap = mAppRef->wlanQtUtils()->iap(data.toInt()); + if (iap->connectionStatus() == WlanQtUtilsConnectionStatusConnected) { + // Switch to details view + emit detailsTriggered(data.toInt()); + } else { + // Connect the IAP + mConnectingIapId = iap->id(); + mStatusLabel->setPlainText(hbTrId("txt_occ_grid_connecting_to_1").arg(iap->name())); + mAppRef->wlanQtUtils()->connectIap(mConnectingIapId); + } + } else { + // Item has to be a WLAN AP, which can't already be connected. Create an IAP and connect it. + Q_ASSERT(data.canConvert()); + WlanQtUtilsWlanAp ap = data.value(); + mConnectingIapId = mAppRef->wlanQtUtils()->createWlanIap(&ap); + WlanQtUtilsIap *iap = mAppRef->wlanQtUtils()->iap(mConnectingIapId); + Q_ASSERT(iap); + mStatusLabel->setPlainText(hbTrId("txt_occ_grid_connecting_to_1").arg(iap->name())); + mAppRef->wlanQtUtils()->connectIap(mConnectingIapId); + } + + OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_HANDLELISTITEMACTIVATED_EXIT ); +} + +void WlanSnifferListView::handleListItemLongPressed(HbListWidgetItem *item, const QPointF &coords) +{ + OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_HANDLELISTITEMLONGPRESSED_ENTRY ); + + // Disable list refreshing while context menu is shown + // Todo: Propably a more elegant way to do this is needed.. + mIapItemMenuOpen = true; + + (void)item; + HbMenu *contextMenu = new HbMenu(); + HbAction *actionDetails = contextMenu->addAction(hbTrId("txt_occ_menu_details")); + HbAction *actionSettings = contextMenu->addAction(hbTrId("txt_occ_menu_network_settings")); + HbAction *actionDisable = contextMenu->addAction(hbTrId("txt_occ_menu_disable_network")); + + // Add disconnect option if the IAP is connected + HbAction *actionDisconnect = 0; + WlanQtUtilsIap *iap = 0; + QVariant data = item->data(); + if (data.canConvert()) { + // Item was an IAP. + iap = mAppRef->wlanQtUtils()->iap(data.toInt()); + if (iap->connectionStatus() == WlanQtUtilsConnectionStatusConnected) { + actionDisconnect = contextMenu->addAction(hbTrId("txt_common_menu_disconnect")); + } + } + + // Show the menu + HbAction *selectedAction = contextMenu->exec(coords); + // Re-enable list refreshing + mIapItemMenuOpen = false; + + if (selectedAction) { + // Handle the "Disconnect" menu selection + if (selectedAction == actionDisconnect) { + mStatusLabel->setPlainText(hbTrId("txt_occ_grid_not_connected")); + mAppRef->wlanQtUtils()->disconnectIap(iap->id()); + // Redraw the list so that disconnected network is not shown anymore + update(); + } + } + + OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_HANDLELISTITEMLONGPRESSED_EXIT ); +} + +// Todo: This is a temporary solution - real WLAN status indication & listening +// is implemented later on. +void WlanSnifferListView::handleDisconnect() +{ + OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_HANDLEDISCONNECT_ENTRY ); + + mStatusLabel->setPlainText(hbTrId("txt_occ_grid_not_connected")); + // Redraw the list so that disconnected network is not shown anymore + update(); + + OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_HANDLEDISCONNECT_EXIT ); +} + +// Todo: no place for separate secure WLAN icon in the widget -> custom layout needed? +// Todo: check the signal strength values +QString WlanSnifferListView::signalStrengthIconChoose(int signalStrength, WlanQtUtilsWlanSecMode secMode) +{ + (void)secMode; + QString iconName; + if (signalStrength <= WlanQtUtilsWlanSignalStrengthGood) { + iconName = "qtg_small_signal_good"; + } else if (signalStrength <= WlanQtUtilsWlanSignalStrengthLow) { + iconName = "qtg_small_signal_medium"; + } else { + iconName = "qtg_small_signal_low"; + } + + return iconName; +} + +HbListWidgetItem *WlanSnifferListView::wlanListItemIapCreate(const WlanQtUtilsWlanIap *iap) +{ + OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_WLANLISTITEMIAPCREATE_ENTRY ); + + HbListWidgetItem* item = new HbListWidgetItem(); + item->setText(iap->name()); +#if 1 // TODO: How to show secure/open network info?? + if (iap->securityMode() == WlanQtUtilsWlanSecModeOpen) { + item->setSecondaryText("Open"); + } else { + item->setSecondaryText("Secure"); + } +#endif + + if (iap->connectionStatus() == WlanQtUtilsConnectionStatusConnected) { + item->setIcon(HbIcon("qtg_small_online")); + } else { + item->setIcon(HbIcon("qtg_small_wlan")); + } + item->setSecondaryIcon(HbIcon(signalStrengthIconChoose(iap->signalStrength(), iap->securityMode()))); + QVariant data(iap->id()); + item->setData(data); + + OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_WLANLISTITEMIAPCREATE_EXIT ); + return item; +} + +HbListWidgetItem *WlanSnifferListView::wlanListItemApCreate(const WlanQtUtilsWlanAp *ap) +{ + OstTraceFunctionEntry0( WLANSNIFFERLISTVIEW_WLANLISTITEMAPCREATE_ENTRY ); + + HbListWidgetItem* item = new HbListWidgetItem(); + item->setText(ap->ssid()); +#if 1 // TODO: How to show secure/open network info?? + if (ap->securityMode() == WlanQtUtilsWlanSecModeOpen) { + item->setSecondaryText("Open"); + } else { + item->setSecondaryText("Secure"); + } +#endif + item->setSecondaryIcon(HbIcon(signalStrengthIconChoose(ap->signalStrength(), ap->securityMode()))); + QVariant data; + data.setValue(*ap); + item->setData(data); + + OstTraceFunctionExit0( WLANSNIFFERLISTVIEW_WLANLISTITEMAPCREATE_EXIT ); + return item; +} + +// End of File diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/src/wlansniffermainwindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/src/wlansniffermainwindow.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include + +#include "wlansniffermainwindow.h" +#include "wlansnifferlistview.h" +#include "wlansnifferservice.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlansniffermainwindowTraces.h" +#endif + + +WlanSnifferMainWindow::WlanSnifferMainWindow(WlanSniffer *appRef) : + mAppRef(appRef), + mService(0) +{ + OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_WLANSNIFFERMAINWINDOW_ENTRY ); + + mService = new WlanSnifferService(this); + connect(mService,SIGNAL(toListView()),this,SLOT(toListView())); + connect(mService,SIGNAL(returnValueDelivered()),this,SIGNAL(exitTriggered())); + + // Add the views to the main window + addListView(); + + // Check if sniffer is used via a service + if (!XQServiceUtil::isEmbedded()) { + // Show the main window (which will display the first view that was added) + show(); + } + + OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_WLANSNIFFERMAINWINDOW_EXIT ); +} + +WlanSnifferMainWindow::~WlanSnifferMainWindow() +{ + OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_WLANSNIFFERMAINWINDOWDESTR_ENTRY ); + OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_WLANSNIFFERMAINWINDOWDESTR_EXIT ); +} + +void WlanSnifferMainWindow::toListView() +{ + OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_TOLISTVIEW_ENTRY ); + + setCurrentView(mListView); + show(); + + OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_TOLISTVIEW_EXIT ); +} + +void WlanSnifferMainWindow::toDetailsView(int iapId) +{ + OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_TODETAILSVIEW_ENTRY ); + + // TODO: Launch details view via QtHighway?? + (void)iapId; + + OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_TODETAILSVIEW_EXIT ); +} + +void WlanSnifferMainWindow::updateListView() +{ + OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_UPDATELISTVIEW_ENTRY ); + + mListView->update(); + + OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_UPDATELISTVIEW_EXIT ); +} + +void WlanSnifferMainWindow::updateListViewConnectionOpened(int iapId) +{ + OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_UPDATELISTVIEWCONNECTIONOPENED_ENTRY ); + + mListView->updateConnectionOpened(iapId); + + OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_UPDATELISTVIEWCONNECTIONOPENED_EXIT ); +} + +void WlanSnifferMainWindow::updateListViewConnectionClosed(int iapId) +{ + OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_UPDATELISTVIEWCONNECTIONCLOSED_ENTRY ); + + mListView->updateConnectionClosed(iapId); + + OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_UPDATELISTVIEWCONNECTIONCLOSED_EXIT ); +} + +void WlanSnifferMainWindow::completeService() +{ + OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_COMPLETESERVICE_ENTRY ); + + mService->complete(); + + OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_COMPLETESERVICE_EXIT ); +} + +void WlanSnifferMainWindow::addListView() +{ + OstTraceFunctionEntry0( WLANSNIFFERMAINWINDOW_ADDLISTVIEW_ENTRY ); + + mListView = new WlanSnifferListView(mAppRef); + addView(mListView); + + bool connectStatus = connect( + mListView, + SIGNAL(detailsTriggered(int)), + this, + SLOT(toDetailsView(int))); + Q_ASSERT(connectStatus == true); + connectStatus = connect( + mListView, + SIGNAL(completeServiceTriggered()), + this, + SLOT(completeService())); + Q_ASSERT(connectStatus == true); + + OstTraceFunctionExit0( WLANSNIFFERMAINWINDOW_ADDLISTVIEW_EXIT ); +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/src/wlansnifferservice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/src/wlansnifferservice.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "wlansnifferservice.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlansnifferserviceTraces.h" +#endif + + +WlanSnifferService::WlanSnifferService(QObject* parent) + : XQServiceProvider("com.nokia.services.wlansniffer.list", parent) +{ + OstTraceFunctionEntry0( WLANSNIFFERSERVICE_WLANSNIFFERSERVICE_ENTRY ); + + publishAll(); + + OstTraceFunctionExit0( WLANSNIFFERSERVICE_WLANSNIFFERSERVICE_EXIT ); +} + +WlanSnifferService::~WlanSnifferService() +{ + OstTraceFunctionEntry0( WLANSNIFFERSERVICE_WLANSNIFFERSERVICEDESTR_ENTRY ); + OstTraceFunctionExit0( WLANSNIFFERSERVICE_WLANSNIFFERSERVICEDESTR_EXIT ); +} + +void WlanSnifferService::complete() +{ + OstTraceFunctionEntry0( WLANSNIFFERSERVICE_COMPLETE_ENTRY ); + + QVariant returnValue(true); + bool status = completeRequest(mAsyncRequestIndex, returnValue); + Q_ASSERT(status); + + OstTraceFunctionExit0( WLANSNIFFERSERVICE_COMPLETE_EXIT ); +} + +void WlanSnifferService::listView() +{ + OstTraceFunctionEntry0( WLANSNIFFERSERVICE_LISTVIEW_ENTRY ); + + mAsyncRequestIndex = setCurrentRequestAsync(); + emit toListView(); + + OstTraceFunctionExit0( WLANSNIFFERSERVICE_LISTVIEW_EXIT ); +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/traces/OstTraceDefinitions.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +#include +#endif diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/group/bld.inf --- a/wlanutilities/wlansniffer/widget/group/bld.inf Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_2001E637/group/bld.inf --- a/wlanutilities/wlansniffer/widget/widget_2001E637/group/bld.inf Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_2001E637/hsps/00/manifest.dat --- a/wlanutilities/wlansniffer/widget/widget_2001E637/hsps/00/manifest.dat Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ - - - - vga_tch - - widget - - - 0x2001f48a - - - 0x101FB657 - - - 0x2001E637 - - - &qtn_hs_wlan_widget; - wsfwidget - 1.0 - &qtn_sniffer_wm_widget_description; - uid(0x10281CAA) - - - wsfwidgetconfiguration.xml - - - wsfwidgetconfiguration.dtd - - - - - - wsfwidget.o0000 - - - diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_2001E637/hsps/00/wsfwidgetconfiguration.dtd --- a/wlanutilities/wlansniffer/widget/widget_2001E637/hsps/00/wsfwidgetconfiguration.dtd Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ - - - - - - - - - - diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_2001E637/hsps/00/wsfwidgetconfiguration.xml --- a/wlanutilities/wlansniffer/widget/widget_2001E637/hsps/00/wsfwidgetconfiguration.xml Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - - - - - diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_2001E637/loc/wsfwidgetconfiguration.loc --- a/wlanutilities/wlansniffer/widget/widget_2001E637/loc/wsfwidgetconfiguration.loc Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_2001E637/rom/wsfwidget.iby --- a/wlanutilities/wlansniffer/widget/widget_2001E637/rom/wsfwidget.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_2001E637/rom/wsfwidget_customer.iby --- a/wlanutilities/wlansniffer/widget/widget_2001E637/rom/wsfwidget_customer.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_2001E637/rom/wsfwidget_resources.iby --- a/wlanutilities/wlansniffer/widget/widget_2001E637/rom/wsfwidget_resources.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_2001E637/rom/wsfwidget_variant.iby --- a/wlanutilities/wlansniffer/widget/widget_2001E637/rom/wsfwidget_variant.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/00/wsfwidget.css --- a/wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/00/wsfwidget.css Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/******************** - WIZARD PLUGIN AREA -*********************/ - -widget#wizardPluginContainer{ - height: 10u; - display: block; - nav-index: appearance; - width: auto; - padding-top: 0.5u; - block-progression: tb; -} - -button.wizardStatusBox1 { - display: block; - visibility: visible; - width: auto; - top: 0u; - block-progression: lr; - direction: ltr; -} - -button.wizardStatusBox2{ - display: block; - visibility: visible; - width: auto; - top: 5u; - block-progression: lr; - direction: ltr; -} - -image.wizardicon { - display: block; - visibility: visible; - position: static; - margin-top: 4%; - margin-left: 1.0u; - width: 4.0u; - height: 4.0u; -} - -text.wizardEntryText1 { - display: block; - visibility: visible; - position: static; - width: auto; - margin-top: 4%; - margin-left: 1.0u; - font-family: EAknLogicalFontSecondaryFont; - font-size: 3.5u; - text-align: left; - _s60-text-valign: top; - direction: ltr; - color: "SKIN(268458534 13056 74)"; -} - -text.wizardEntryText2 { - display: block; - visibility: visible; - position: static; - width: auto; - margin-left: 6.0u; - font-family: EAknLogicalFontSecondaryFont; - font-size: 3.5u; - text-align: left; - _s60-text-valign: top; - direction: ltr; - color: "SKIN(268458534 13056 74)"; -} - -image#wizardSecureIcon { - display: block; - visibility: visible; - position: static; - margin-top: 0.2%; - margin-right: 0.5u; - width: 4.0u; - height: 4.0u; -} - -image#wizardStrengthIcon { - display: block; - visibility: visible; - position: static; - margin-top: 0.2%; - margin-right: 1u; - width: 4.0u; - height: 4.0u; -} \ No newline at end of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/00/wsfwidget.dat --- a/wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/00/wsfwidget.dat Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ - - - E029CF57 - 101FB657 - 2001E637 - WLAN wizard - wsfwidget - 1.0 - wsfwidget.xml - wsfwidget.css - \ No newline at end of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/00/wsfwidget.xml --- a/wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/00/wsfwidget.xml Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/37/wsfwidget.css --- a/wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/37/wsfwidget.css Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/******************** - WIZARD PLUGIN AREA -*********************/ - -widget#wizardPluginContainer{ - height: 10u; - display: block; - nav-index: appearance; - width: auto; - padding-top: 0.5u; - block-progression: tb; -} - -button.wizardStatusBox1 { - display: block; - visibility: visible; - width: auto; - top: 0u; - block-progression: rl; - direction: rtl; -} - -button.wizardStatusBox2{ - display: block; - visibility: visible; - width: auto; - top: 5u; - block-progression: rl; - direction: rtl; -} - -image.wizardicon { - display: block; - visibility: visible; - position: static; - margin-top: 4%; - margin-right: 1.0u; - width: 4.0u; - height: 4.0u; -} - -text.wizardEntryText1 { - display: block; - visibility: visible; - position: static; - width: auto; - margin-top: 4%; - margin-right: 1.0u; - font-family: EAknLogicalFontSecondaryFont; - font-size: 3.5u; - text-align: right; - _s60-text-valign: top; - direction: ltr; - color: "SKIN(268458534 13056 74)"; -} - -text.wizardEntryText2 { - display: block; - visibility: visible; - position: static; - width: auto; - margin-right: 6.0u; - font-family: EAknLogicalFontSecondaryFont; - font-size: 3.5u; - text-align: right; - _s60-text-valign: top; - direction: ltr; - color: "SKIN(268458534 13056 74)"; -} - -image#wizardSecureIcon { - display: block; - visibility: visible; - position: static; - margin-top: 0.2%; - margin-left: 0.5u; - width: 4.0u; - height: 4.0u; -} - -image#wizardStrengthIcon { - display: block; - visibility: visible; - position: static; - margin-top: 0.2%; - margin-left: 1u; - width: 4.0u; - height: 4.0u; -} \ No newline at end of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/50/wsfwidget.css --- a/wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/50/wsfwidget.css Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/******************** - WIZARD PLUGIN AREA -*********************/ - -widget#wizardPluginContainer{ - height: 10u; - display: block; - nav-index: appearance; - width: auto; - padding-top: 0.5u; - block-progression: tb; -} - -button.wizardStatusBox1 { - display: block; - visibility: visible; - width: auto; - top: 0u; - block-progression: rl; - direction: rtl; -} - -button.wizardStatusBox2{ - display: block; - visibility: visible; - width: auto; - top: 5u; - block-progression: rl; - direction: rtl; -} - -image.wizardicon { - display: block; - visibility: visible; - position: static; - margin-top: 4%; - margin-right: 1.0u; - width: 4.0u; - height: 4.0u; -} - -text.wizardEntryText1 { - display: block; - visibility: visible; - position: static; - width: auto; - margin-top: 4%; - margin-right: 1.0u; - font-family: EAknLogicalFontSecondaryFont; - font-size: 3.5u; - text-align: right; - _s60-text-valign: top; - direction: ltr; - color: "SKIN(268458534 13056 74)"; -} - -text.wizardEntryText2 { - display: block; - visibility: visible; - position: static; - width: auto; - margin-right: 6.0u; - font-family: EAknLogicalFontSecondaryFont; - font-size: 3.5u; - text-align: right; - _s60-text-valign: top; - direction: ltr; - color: "SKIN(268458534 13056 74)"; -} - -image#wizardSecureIcon { - display: block; - visibility: visible; - position: static; - margin-top: 0.2%; - margin-left: 0.5u; - width: 4.0u; - height: 4.0u; -} - -image#wizardStrengthIcon { - display: block; - visibility: visible; - position: static; - margin-top: 0.2%; - margin-left: 1u; - width: 4.0u; - height: 4.0u; -} \ No newline at end of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/57/wsfwidget.css --- a/wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/57/wsfwidget.css Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/******************** - WIZARD PLUGIN AREA -*********************/ - -widget#wizardPluginContainer{ - height: 10u; - display: block; - nav-index: appearance; - width: auto; - padding-top: 0.5u; - block-progression: tb; -} - -button.wizardStatusBox1 { - display: block; - visibility: visible; - width: auto; - top: 0u; - block-progression: rl; - direction: rtl; -} - -button.wizardStatusBox2{ - display: block; - visibility: visible; - width: auto; - top: 5u; - block-progression: rl; - direction: rtl; -} - -image.wizardicon { - display: block; - visibility: visible; - position: static; - margin-top: 4%; - margin-right: 1.0u; - width: 4.0u; - height: 4.0u; -} - -text.wizardEntryText1 { - display: block; - visibility: visible; - position: static; - width: auto; - margin-top: 4%; - margin-right: 1.0u; - font-family: EAknLogicalFontSecondaryFont; - font-size: 3.5u; - text-align: right; - _s60-text-valign: top; - direction: ltr; - color: "SKIN(268458534 13056 74)"; -} - -text.wizardEntryText2 { - display: block; - visibility: visible; - position: static; - width: auto; - margin-right: 6.0u; - font-family: EAknLogicalFontSecondaryFont; - font-size: 3.5u; - text-align: right; - _s60-text-valign: top; - direction: ltr; - color: "SKIN(268458534 13056 74)"; -} - -image#wizardSecureIcon { - display: block; - visibility: visible; - position: static; - margin-top: 0.2%; - margin-left: 0.5u; - width: 4.0u; - height: 4.0u; -} - -image#wizardStrengthIcon { - display: block; - visibility: visible; - position: static; - margin-top: 0.2%; - margin-left: 1u; - width: 4.0u; - height: 4.0u; -} \ No newline at end of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/94/wsfwidget.css --- a/wlanutilities/wlansniffer/widget/widget_2001E637/xuikon/94/wsfwidget.css Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/******************** - WIZARD PLUGIN AREA -*********************/ - -widget#wizardPluginContainer{ - height: 10u; - display: block; - nav-index: appearance; - width: auto; - padding-top: 0.5u; - block-progression: tb; -} - -button.wizardStatusBox1 { - display: block; - visibility: visible; - width: auto; - top: 0u; - block-progression: rl; - direction: rtl; -} - -button.wizardStatusBox2{ - display: block; - visibility: visible; - width: auto; - top: 5u; - block-progression: rl; - direction: rtl; -} - -image.wizardicon { - display: block; - visibility: visible; - position: static; - margin-top: 4%; - margin-right: 1.0u; - width: 4.0u; - height: 4.0u; -} - -text.wizardEntryText1 { - display: block; - visibility: visible; - position: static; - width: auto; - margin-top: 4%; - margin-right: 1.0u; - font-family: EAknLogicalFontSecondaryFont; - font-size: 3.5u; - text-align: right; - _s60-text-valign: top; - direction: ltr; - color: "SKIN(268458534 13056 74)"; -} - -text.wizardEntryText2 { - display: block; - visibility: visible; - position: static; - width: auto; - margin-right: 6.0u; - font-family: EAknLogicalFontSecondaryFont; - font-size: 3.5u; - text-align: right; - _s60-text-valign: top; - direction: ltr; - color: "SKIN(268458534 13056 74)"; -} - -image#wizardSecureIcon { - display: block; - visibility: visible; - position: static; - margin-top: 0.2%; - margin-left: 0.5u; - width: 4.0u; - height: 4.0u; -} - -image#wizardStrengthIcon { - display: block; - visibility: visible; - position: static; - margin-top: 0.2%; - margin-left: 1u; - width: 4.0u; - height: 4.0u; -} \ No newline at end of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_20026F45/group/bld.inf --- a/wlanutilities/wlansniffer/widget/widget_20026F45/group/bld.inf Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_20026F45/hsps/00/manifest.dat --- a/wlanutilities/wlansniffer/widget/widget_20026F45/hsps/00/manifest.dat Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ - - - - 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_20026F45/hsps/00/wsfwidgetconfiguration.dtd --- a/wlanutilities/wlansniffer/widget/widget_20026F45/hsps/00/wsfwidgetconfiguration.dtd Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ - - - - - - - - - - diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_20026F45/hsps/00/wsfwidgetconfiguration.xml --- a/wlanutilities/wlansniffer/widget/widget_20026F45/hsps/00/wsfwidgetconfiguration.xml Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - - - - - diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_20026F45/loc/wsfwidgetconfiguration.loc --- a/wlanutilities/wlansniffer/widget/widget_20026F45/loc/wsfwidgetconfiguration.loc Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_20026F45/rom/wsfwidget.iby --- a/wlanutilities/wlansniffer/widget/widget_20026F45/rom/wsfwidget.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_20026F45/rom/wsfwidget_customer.iby --- a/wlanutilities/wlansniffer/widget/widget_20026F45/rom/wsfwidget_customer.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_20026F45/rom/wsfwidget_resources.iby --- a/wlanutilities/wlansniffer/widget/widget_20026F45/rom/wsfwidget_resources.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_20026F45/rom/wsfwidget_variant.iby --- a/wlanutilities/wlansniffer/widget/widget_20026F45/rom/wsfwidget_variant.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/00/wsfwidget.css --- a/wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/00/wsfwidget.css Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/******************** - 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; -} - -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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/00/wsfwidget.dat --- a/wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/00/wsfwidget.dat Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ - - - E029CF57 - 101FB657 - 20026F45 - WLAN wizard - wsfwidget - 1.0 - wsfwidget.xml - wsfwidget.css - \ No newline at end of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/00/wsfwidget.xml --- a/wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/00/wsfwidget.xml Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/37/wsfwidget.css --- a/wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/37/wsfwidget.css Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/******************** - 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; -} - -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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/50/wsfwidget.css --- a/wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/50/wsfwidget.css Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/******************** - 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; -} - -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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/57/wsfwidget.css --- a/wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/57/wsfwidget.css Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/******************** - 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; -} - -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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/94/wsfwidget.css --- a/wlanutilities/wlansniffer/widget/widget_20026F45/xuikon/94/wsfwidget.css Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/******************** - 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; -} - -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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfo/bwins/wsfwlaninfou.def --- a/wlanutilities/wlansniffer/wlaninfo/bwins/wsfwlaninfou.def Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfo/eabi/wsfwlaninfou.def --- a/wlanutilities/wlansniffer/wlaninfo/eabi/wsfwlaninfou.def Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfo/group/bld.inf --- a/wlanutilities/wlansniffer/wlaninfo/group/bld.inf Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfo/group/wlaninfo.mmp --- a/wlanutilities/wlansniffer/wlaninfo/group/wlaninfo.mmp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfo.h --- a/wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfo.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,360 +0,0 @@ -/* -* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Class header for TWsfWlanInfo -* -*/ - - - -#ifndef T_WSFWLANINFO_H -#define T_WSFWLANINFO_H - -// EXTERNAL INCLUDES -#include -#include -#include - - -// ENUMS - -/** - * Signal strength categories for UI - */ -enum TWsfWlanSignalStrengthLevel - { - ENoSignal, - EPoor, - EAverage, - EExcelent - }; - - -/** - * Connection status - */ -enum TWsfWlanConnectionState - { - ENotConnected, - EConnecting, - EConnected - }; - - -/** - * Signal strength category boundaries in dB (absolute value). - * Smaller value means better signal. - */ -enum TWsfWlanSignalStrength - { - EWlanSignalStrengthMax = 60, - EWlanSignalStrengthGood = 74, - EWlanSignalStrengthLow = 87, - EWlanSignalStrengthMin = 100, - EWlanSignalUnavailable = 9999 - }; - - -/** - * Flags for different types of networks - */ -enum TWsfBrandDataDefs - { - EBrandedItem = 0xFF, - EBlackListItem = 0x01, - EUserSortListItem = 0x02, - EFonSsid = 0x04, - EUsesPresharedKey = 0x08 - }; - - -/** - * Maximal length of IAP name that the class should be able to store - */ -const TInt KWlanMaxAccessPointNameLength = 50; - - -// FORWARD DECLARATIONS -class RReadStream; -class RWriteStream; - - -// CLASS DEFINITION -/** - * Class to encapsulate network parameters - * - * TWsfWlanInfo serves for transferring the WLAN network related data - * between the different submodules of Wlan Sniffer. - * - * @lib wsfwlaninfo.lib - * @since S60 5.0 - */ -NONSHARABLE_CLASS( TWsfWlanInfo ) - { - public: // Constructors - - IMPORT_C TWsfWlanInfo(); - - /** - * Constructor. - * - * @since S60 5.0 - * @param aSsid SSID of the WLAN network - * @param aStrengthLevel Signal strength in dB (absolute value) - * @param aSecurityMode Network security mode - * @param aVisibility ETrue for public networks, EFalse for hidden ones - * @param aNetMode Network mode (infrastructure or adhoc) - * @param aIapId IAP id if known, zero otherwise. - * @param aCoverage Number of APs with the same SSID - * @param aTransferRate Maximal transfer rate reported by the AP - */ - IMPORT_C TWsfWlanInfo( TDesC8& aSsid, - TUint16 aStrengthLevel, - CMManager::TWlanSecMode aSecurityMode, - TInt aVisibility, - CMManager::TWlanNetMode aNetMode, - TUint32 aIapId, - TUint8 aCoverage, - TUint32 aTransferRate ); - - public: // New methods - - /** - * Gets WLAN name (Ssid) as unicode format - * @since S60 5.0 - * @return Ssid as unicode format - */ - IMPORT_C HBufC* GetSsidAsUnicodeLC(); - - /** - * Gets WLAN name (Ssid) as unicode format - * @since S60 5.0 - * @return Ssid as unicode format - */ - IMPORT_C static HBufC* GetSsidAsUnicodeLC( const TWlanSsid& aSsid ); - - /** - * Gets WLAN name (Ssid) as 8-bit format - * @since S60 5.0 - * @return Ssid as 8-bit format - */ - IMPORT_C HBufC8* GetSsidAsUtf8LC(); - - /** - * Serializes data from the stream - * @since S60 5.0 - * @param aStream Stream from where data is serialized - */ - IMPORT_C void InternalizeL( RReadStream& aStream ); - - /** - * Serializes data to the stream - * @since S60 5.0 - * @param aStream Stream where data will be serialized - */ - IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; - - /** - * Get signal strength as enumeration - * @since S60 5.0 - * @return Signal stregth as enumeration - */ - IMPORT_C TWsfWlanSignalStrengthLevel SignalStrength(); - - /** - * Get signal strength as percentage - * @since S60 5.0 - * @return Signal stregth as percentage - */ - IMPORT_C TInt SignalStrengthPercentage(); - - /** - * Gets WLAN IAP name as unicode format - * @since S60 5.0 - * @return Ssid as unicode format - */ - IMPORT_C HBufC* GetIapNameAsUnicodeLC(); - - /** - * Gets WLAN IAP name as 8-bit format - * @since S60 5.0 - * @return Ssid as 8-bit format - */ - IMPORT_C HBufC8* GetIapNameAsUtf8LC(); - - /** - * Get WLAN connection state - * @since S60 5.0 - * @return ETrue if connected - */ - inline TBool Connected() const; - - /** - * Get WLAN connection state - * @since S60 5.2 - * @return TWsfWlanConnectionState - */ - inline TWsfWlanConnectionState ConnectionStatus() const; - - /** - * Get WLAN Known state - * @since S60 5.0 - * @return ETrue if access point has been defined - */ - inline TBool Known() const; - - /** - * Get WLAN visibility state - * @since S60 5.0 - * @return ETrue if WLAN is hidden - */ - inline TBool Hidden() const; - - /** - * Get WLAN security state - * @since S60 5.0 - * @return ETrue if WLAN is secured. - */ - inline TBool Secure() const; - - /** - * Set the brand id for entry - * @since S60 5.0 - * @param aBrandId The brand id. - */ - inline void SetBrand( const TInt8 aBrandId ); - - /** - * Get brand id - * @since S60 5.0 - * @return 8-bit value representing brand id - */ - inline TInt8 BrandId() const; - - /** - * Set blacklist entry flag - * @since S60 5.0 - * @param aBlackListEntry ETrue if the network is blacklisted. - */ - inline void SetBlackListEntry( const TBool aBlackListEntry ); - - /** - * Get blacklist flag - * @since S60 5.0 - * @return ETrue if the entry is marked as black list entry - */ - inline TBool BlackListEntry() const; - - /** - * Get Fon entry flag - * @since S60 5.0 - * @return ETrue if the network is recognised as FON. - */ - inline TBool FonSsid() const; - - /** - * Set Fon flag - * @since S60 5.0 - * @param aFonSsid ETrue if the entry is a Fon list entry - */ - inline void SetFonSsid( const TBool aFonSsid ); - - /** - * Query preshared key flag in WPA and 802.1x security modes. - * Note that the result is undefined in case of other security modes. - * @since S60 5.0 - * @return ETrue, if preshared key is used. - */ - inline TBool UsesPreSharedKey() const; - - /** - * Set preshared key flag for WPA and 802.1x security modes. - * @since S60 5.0 - * @param aUsePresharedKey ETrue if the network uses preshared key - */ - inline void SetUsesPreSharedKey( const TBool aUsePresharedKey ); - - /** - * Set the priority for entry - * @since S60 5.1 - * @param aPriority The priority id. - */ - inline void SetPriority( const TUint8 aPriority ); - - /** - * Get priority - * @since S60 5.1 - * @return 8-bit value representing priority - */ - inline TUint8 Priority() const; - - /** - * Get WLAN security mode - * @since S60 5.2 - * @return WLAN security mode - */ - inline CMManager::TWlanSecMode SecurityMode() const; - - - public: // Data - - // Network name (unknown: SSID, known: IAP name) - TWlanSsid iSsid; - - // Network strength - TUint16 iStrengthLevel; - - //Network encryption - CMManager::TWlanSecMode iSecurityMode; - - //Network visibility - TBool iVisibility; - - //Network capability - CMManager::TWlanNetMode iNetMode; - - //Internet Access Point Id. 0 if the IAP has not been defined. - TUint32 iIapId; - - // Available WLAN hotspots in this WLAN network - TUint8 iCoverage; - - // Transferrate - TUint32 iTransferRate; - - // Connection state - TWsfWlanConnectionState iConnectionState; - - // filter flags - TUint8 iFilterFlags; - - //brand id - TUint8 iBrandId; - - // The name of the WLAN IAP - TBuf8 iNetworkName; - - //UI priority for known networks - TUint8 iPriority; - - //Raw SSID - not converted - TWlanSsid iRawSsid; - }; - - -#include "wsfwlaninfo.inl" - - -#endif // T_WSFWLANINFO_H - -// End of file diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfo.inl --- a/wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfo.inl Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfoarray.h --- a/wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfoarray.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,249 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfoarrayfiltervisitor.h --- a/wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfoarrayfiltervisitor.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfoarraysortkey.h --- a/wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfoarraysortkey.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfo/src/wsfwlaninfo.cpp --- a/wlanutilities/wlansniffer/wlaninfo/src/wsfwlaninfo.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,248 +0,0 @@ -/* -* 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; - aStream >> iRawSsid; - } - - -// --------------------------------------------------------------------------- -// TWsfWlanInfo::ExternalizeL -// --------------------------------------------------------------------------- -// -EXPORT_C void TWsfWlanInfo::ExternalizeL(RWriteStream& aStream) const - { - aStream << iSsid; - aStream.WriteInt16L( iStrengthLevel ); - aStream.WriteInt32L( iSecurityMode ); - aStream.WriteInt8L( iVisibility ); - aStream.WriteInt32L( iNetMode ); - aStream.WriteInt32L( iIapId ); - aStream.WriteInt8L( iCoverage ); - aStream.WriteInt32L( iTransferRate ); - aStream.WriteInt8L( iConnectionState ); - aStream.WriteInt8L( iFilterFlags ); - aStream.WriteInt8L( iBrandId ); - aStream.WriteInt8L( iPriority ); - aStream << iNetworkName; - aStream << iRawSsid; - } - - -// --------------------------------------------------------------------------- -// TWsfWlanInfo::SignalStrength -// --------------------------------------------------------------------------- -// -EXPORT_C TWsfWlanSignalStrengthLevel TWsfWlanInfo::SignalStrength() - { - // check the absolute signal level and return symbolic representation - // smaller value means stronger signal - TWsfWlanSignalStrengthLevel level( EAverage ); - - if ( iStrengthLevel < EWlanSignalStrengthGood ) - { - level = EExcelent; - } - else if ( iStrengthLevel > EWlanSignalStrengthLow ) - { - if ( iStrengthLevel == EWlanSignalUnavailable ) - { - level = ENoSignal; - } - else - { - level = EPoor; - } - } - - return level; - } - - -// --------------------------------------------------------------------------- -// TWsfWlanInfo::SignalStrengthPercentage -// --------------------------------------------------------------------------- -// -EXPORT_C TInt TWsfWlanInfo::SignalStrengthPercentage() - { - // smaller value means stronger signal - TInt signalStrength( 0 ); - - if ( iStrengthLevel <= EWlanSignalStrengthMax ) - { - signalStrength = KMaxPercentage; - } - else if ( iStrengthLevel < EWlanSignalStrengthMin ) - { - TInt diff = EWlanSignalStrengthMin - iStrengthLevel; - signalStrength = diff * KMaxPercentage / - ( EWlanSignalStrengthMin - EWlanSignalStrengthMax ); - } - - return signalStrength; - } - - -// --------------------------------------------------------------------------- -// TWsfWlanInfo::GetSsidAsUnicodeLC -// --------------------------------------------------------------------------- -// -EXPORT_C HBufC* TWsfWlanInfo::GetIapNameAsUnicodeLC() - { - // This is essentially the same as ssid conversion - return GetSsidAsUnicodeLC( iNetworkName ); - } - - -// --------------------------------------------------------------------------- -// TWsfWlanInfo::GetSsidAsUtf8LC -// --------------------------------------------------------------------------- -// -EXPORT_C HBufC8* TWsfWlanInfo::GetIapNameAsUtf8LC() - { - HBufC8* networkName = iNetworkName.AllocLC(); - return networkName; - } - - -// End of file - diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfo/src/wsfwlaninfoarray.cpp --- a/wlanutilities/wlansniffer/wlaninfo/src/wsfwlaninfoarray.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,493 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfo/src/wsfwlaninfoarraysortkey.cpp --- a/wlanutilities/wlansniffer/wlaninfo/src/wsfwlaninfoarraysortkey.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,173 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/bwins/wsfwlaninfosortingu.def --- a/wlanutilities/wlansniffer/wlaninfosorting/bwins/wsfwlaninfosortingu.def Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/data/2000cf30.spd Binary file wlanutilities/wlansniffer/wlaninfosorting/data/2000cf30.spd has changed diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/data/backup_registration.xml --- a/wlanutilities/wlansniffer/wlaninfosorting/data/backup_registration.xml Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ - - - - diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/data/wsfwlaninfosorting.rss --- a/wlanutilities/wlansniffer/wlaninfosorting/data/wsfwlaninfosorting.rss Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/eabi/wsfwlaninfosortingu.def --- a/wlanutilities/wlansniffer/wlaninfosorting/eabi/wsfwlaninfosortingu.def Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/group/bld.inf --- a/wlanutilities/wlansniffer/wlaninfosorting/group/bld.inf Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/group/wlaninfosorting.mmp --- a/wlanutilities/wlansniffer/wlaninfosorting/group/wlaninfosorting.mmp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/group/wlaninfosortingicons.mk --- a/wlanutilities/wlansniffer/wlaninfosorting/group/wlaninfosortingicons.mk Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -# -# Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfoarrayvisitor.h --- a/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfoarrayvisitor.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,225 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosorting.hrh --- a/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosorting.hrh Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingblacklist.h --- a/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingblacklist.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingbrand.h --- a/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingbrand.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,229 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingdbchangenotifier.h --- a/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingdbchangenotifier.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingdefault.h --- a/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingdefault.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingfiltervisitor.h --- a/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingfiltervisitor.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* -* 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlansortingbrand.rh --- a/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlansortingbrand.rh Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlanssidselectiondlg2.h --- a/wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlanssidselectiondlg2.h Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Class header for CWsfWlanSsidSelectionDlg2 -* -*/ - - - -#ifndef C_WSFWLANSSIDSELECTIONDLG2_H -#define C_WSFWLANSSIDSELECTIONDLG2_H - - -// EXTERNAL INCLUDES -#include -#include - - -// FORWARD DECLARATIONS -class CAknTitlePane; -class CAknIconArray; -class CGulIcon; - - -// CLASS DEFINITION -/** -* Dialog for modifying the SSID blacklist -* -* @lib wsfwlaninfosorting.lib -* @since S60 5.0 -*/ -NONSHARABLE_CLASS( CWsfWlanSsidSelectionDlg2 ): public CAknListQueryDialog - { - public: - /** - * Factory function. - * @since S60 5.0 - * @param aSsidArray Array of all SSIDs. Ownership not passed. - * @param aSelectionIndexArray Array to indicate selected state of - * the SSIDs. Ownership not passed. - * @return Class instance - */ - static CWsfWlanSsidSelectionDlg2* NewL( CDesCArrayFlat& aSsidArray, - CListBoxView::CSelectionIndexArray& aSelectionIndexArray ); - - /** - * Factory function. - * @since S60 5.0 - * @param aSsidArray Array of all SSIDs. Ownership not passed. - * @param aSelectionIndexArray Array to indicate selected state of - * the SSIDS. Ownership not passed. - * @return Class instance - */ - static CWsfWlanSsidSelectionDlg2* NewLC( CDesCArrayFlat& aSsidArray, - CListBoxView::CSelectionIndexArray& aSelectionIndexArray ); - - ~CWsfWlanSsidSelectionDlg2(); - - - private: - /** - * Constructor. - * @since S60 5.0 - * @param aSsidArray Array of all SSIDs. Ownership not passed. - * @param aSelectionIndexArray Array to indicate selected state of - * the SSIDS. Ownership not passed. - * @return Class instance - */ - CWsfWlanSsidSelectionDlg2( CDesCArrayFlat& aSsidArray, - CListBoxView::CSelectionIndexArray& aSelectionIndexArray ); - - void ConstructL(); - - - public: // from CEikDialog - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ); - - void PreLayoutDynInitL(); - - - private: // new methods - - /** - * Creates a listbox item array of the SSID list - * @since S60 5.0 - * @param aSource The source SSID array. Ownership not passed. - * @param aDest The array to put the resulting listbox items in. - * Ownership not passed. - */ - void CopyAndFormatArrayContentsL( CDesCArrayFlat* aSource, - CDesCArrayFlat* aDest ); - - /** - * Function to create checkbox icons for the markable list - * @since S60 5.0 - * @param aFileName Path to the icon file - * @param aIcon Icon id - * @param aMask Mask id - * @param aID Item ID of the masked bitmap to be created. - * @return The constructed icon. Ownership passed. - */ - CGulIcon* CreateIconLC( const TDesC& aFileName, TInt aIcon, TInt aMask, - const TAknsItemID& aID ); - - /** - * Create an icon array of the checkbox icons - * @since S60 5.0 - * @return The constructed icon array. Ownership passed. - */ - CAknIconArray* CreateQueryIconArrayL(); - - - private: //data - - /** - * Array of SSIDs in the list - */ - CDesCArrayFlat* iSsidArray; - - /** - * Array of selection states - */ - CArrayFix* iSelectedItems; - - /** - * Reference to the title pane of the list. Not owned. - */ - CAknTitlePane* iPane; - - /** - * Title text. Owned. - */ - HBufC* iTitle; - - }; - - -#endif // C_WSFWLANSSIDSELECTIONDLG2_H diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/rom/wsfwlaninfosorting.iby --- a/wlanutilities/wlansniffer/wlaninfosorting/rom/wsfwlaninfosorting.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/rom/wsfwlaninfosortingresources.iby --- a/wlanutilities/wlansniffer/wlaninfosorting/rom/wsfwlaninfosortingresources.iby Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Image description file for project 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfoarrayvisitor.cpp --- a/wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfoarrayvisitor.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,319 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingblacklist.cpp --- a/wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingblacklist.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,451 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingbrand.cpp --- a/wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingbrand.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,458 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingdbchangenotifier.cpp --- a/wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingdbchangenotifier.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingdefault.cpp --- a/wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlaninfosortingdefault.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,210 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlanssidselectiondlg2.cpp --- a/wlanutilities/wlansniffer/wlaninfosorting/src/wsfwlanssidselectiondlg2.cpp Tue Jan 26 13:04:04 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,249 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of CWsfWlanSsidSelectionDlg2 -* -*/ - - - -// EXTERNAL INCLUDES -#include -#include -#include -#include // CAknIcon -#include // akntitle pane -#include // CAknSingleGraphicStyleListBox - -// CLASS HEADER -#include "wsfwlanssidselectiondlg2.h" - -// INTERNAL INCLUDES -#include "wsfwlaninfosorting.hrh" -#include "wsflogger.h" - - -/** -* Format string for listbox items -*/ -_LIT( KFormatString, "1\t%S" ); - -/** -* Number of icons used -*/ -static const TInt KNumIcons = 2; - - - -// ---------------------------------------------------------------------------- -// CWsfWlanSsidSelectionDlg2::NewL -// ---------------------------------------------------------------------------- -// -CWsfWlanSsidSelectionDlg2* CWsfWlanSsidSelectionDlg2::NewL( - CDesCArrayFlat& aSsidArray, - CListBoxView::CSelectionIndexArray& aSelectionIndexArray ) - { - CWsfWlanSsidSelectionDlg2* self = NewLC( aSsidArray, - aSelectionIndexArray ); - CleanupStack::Pop( self ); - return self; - } - - -// ---------------------------------------------------------------------------- -// CWsfWlanSsidSelectionDlg2::NewLC -// ---------------------------------------------------------------------------- -// -CWsfWlanSsidSelectionDlg2* CWsfWlanSsidSelectionDlg2::NewLC( - CDesCArrayFlat& aSsidArray, - CListBoxView::CSelectionIndexArray& aSelectionIndexArray ) - { - CWsfWlanSsidSelectionDlg2* self = new (ELeave) CWsfWlanSsidSelectionDlg2( - aSsidArray, aSelectionIndexArray ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - - -// ---------------------------------------------------------------------------- -// CWsfWlanSsidSelectionDlg2::ConstructL -// ---------------------------------------------------------------------------- -// -void CWsfWlanSsidSelectionDlg2::ConstructL() - { - } - - -// ---------------------------------------------------------------------------- -// CWsfWlanSsidSelectionDlg2::CWsfWlanSsidSelectionDlg2 -// ---------------------------------------------------------------------------- -// -CWsfWlanSsidSelectionDlg2::CWsfWlanSsidSelectionDlg2( - CDesCArrayFlat& aSsidArray, - CListBoxView::CSelectionIndexArray& aSelectionIndexArray ): - CAknListQueryDialog( &aSelectionIndexArray ), - iSsidArray( &aSsidArray ), - iSelectedItems( &aSelectionIndexArray ) - { - } - - -// ---------------------------------------------------------------------------- -// CWsfWlanSsidSelectionDlg2::~CWsfWlanSsidSelectionDlg2 -// ---------------------------------------------------------------------------- -// -CWsfWlanSsidSelectionDlg2::~CWsfWlanSsidSelectionDlg2() - { - // restore the title.... - if ( iTitle && iPane ) - { - iPane->SetText( iTitle ); - } - - iPane = NULL; - iTitle = NULL; - iSsidArray = NULL; - iSelectedItems = NULL; - } - - -// ---------------------------------------------------------------------------- -// CWsfWlanSsidSelectionDlg2::OfferKeyEventL -// ---------------------------------------------------------------------------- -// -TKeyResponse CWsfWlanSsidSelectionDlg2::OfferKeyEventL( - const TKeyEvent& aKeyEvent, - TEventCode aType ) - { - if ( aKeyEvent.iCode == EKeyApplicationF ) - { - return EKeyWasConsumed; - } - else - { - return CAknListQueryDialog::OfferKeyEventL( aKeyEvent, aType ); - } - } - - -// ---------------------------------------------------------------------------- -// CWsfWlanSsidSelectionDlg2::PreLayoutDynInitL -// ---------------------------------------------------------------------------- -// -void CWsfWlanSsidSelectionDlg2::PreLayoutDynInitL() - { - LOG_ENTERFN( "CWsfWlanSsidSelectionDlg2::PreLayoutDynInitL" ); - - CAknListQueryDialog::PreLayoutDynInitL(); - - CAknListQueryControl *control = static_cast( - Control( EListQueryControl ) ); - CEikListBox* listBox = control->Listbox(); - - CDesCArrayFlat *formattedSsids = new (ELeave) CDesCArrayFlat( - iSsidArray->Count() ); - CleanupStack::PushL( formattedSsids ); - CopyAndFormatArrayContentsL( iSsidArray, formattedSsids ); - - SetItemTextArray( formattedSsids ); - - CleanupStack::Pop( formattedSsids ); - - CAknIconArray* iconArray = CreateQueryIconArrayL(); - CleanupStack::PushL( iconArray ); - SetIconArrayL( iconArray ); - CleanupStack::Pop( iconArray ); - - for (TInt i = 0; i < iSelectedItems->Count(); i++) - { - listBox->View()->SelectItemL( (*iSelectedItems)[i] ); - } - - CEikStatusPane* statusPane = iAvkonAppUi->StatusPane(); - iPane = (CAknTitlePane*) statusPane->ControlL( - TUid::Uid( EEikStatusPaneUidTitle ) ); - iTitle = iPane->Text()->AllocL(); - } - - -// ---------------------------------------------------------------------------- -// CWsfWlanSsidSelectionDlg2::CopyAndFormatArrayContentsL -// ---------------------------------------------------------------------------- -// -void CWsfWlanSsidSelectionDlg2::CopyAndFormatArrayContentsL( - CDesCArrayFlat* aSource, - CDesCArrayFlat* aDest ) - { - TBuf<80> lineBuffer; - TInt sourceCount( aSource->Count() ); - for ( TInt i( 0 ) ; i < sourceCount ; i++ ) - { - const TDesC& item = aSource->MdcaPoint( i ); - lineBuffer.Format(KFormatString, &item ); - aDest->AppendL( lineBuffer ); - } - } - - -// ---------------------------------------------------------------------------- -// CWsfWlanSsidSelectionDlg2::CreateQueryIconArrayL -// ---------------------------------------------------------------------------- -// -CAknIconArray* CWsfWlanSsidSelectionDlg2::CreateQueryIconArrayL() - { - CAknIconArray* iconarray = new( ELeave )CAknIconArray( KNumIcons ); - CleanupStack::PushL( iconarray ); - - const TDesC& iconfilename = AknIconUtils::AvkonIconFileName(); - - // empty - iconarray->AppendL( CreateIconLC( iconfilename, - EMbmAvkonQgn_prop_checkbox_on, - EMbmAvkonQgn_prop_checkbox_on_mask, - KAknsIIDQgnPropEmpty )); - CleanupStack::Pop(); // icon - - // copying - iconarray->AppendL(CreateIconLC( iconfilename, - EMbmAvkonQgn_prop_checkbox_off, - EMbmAvkonQgn_prop_checkbox_off_mask, - KAknsIIDNone )); - CleanupStack::Pop(); // icon - CleanupStack::Pop(); // iconarray - - - return iconarray; - } - - -// ---------------------------------------------------------------------------- -// CWsfWlanSsidSelectionDlg2::CreateIconLC -// ---------------------------------------------------------------------------- -// -CGulIcon* CWsfWlanSsidSelectionDlg2::CreateIconLC( const TDesC& aFileName, - TInt aIcon, - TInt aMask, - const TAknsItemID& aID ) - { - MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); - - CGulIcon* icon = AknsUtils::CreateGulIconL( skinInstance, aID, aFileName, - aIcon, aMask ); - CleanupStack::PushL( icon ); - - return icon; - } - - - diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlansniffer/wlansniffer.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/wlansniffer.pro Fri Apr 16 16:07:56 2010 +0300 @@ -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: +# + +TEMPLATE = app +TARGET = wlansniffer +TARGET.CAPABILITY = ALL -TCB +DEPENDPATH += . +# Own headers +INCLUDEPATH += inc \ + traces +# wlanutilities Private API +INCLUDEPATH += ../inc +CONFIG += hb no_icon service + +#Store generated .moc files to their own directory +MOC_DIR = moc + +TRANSLATIONS = wlansniffer.ts + +# Input +SOURCES += src/main.cpp \ + src/wlansniffer.cpp \ + src/wlansnifferlistview.cpp \ + src/wlansniffermainwindow.cpp \ + src/wlansnifferservice.cpp + +HEADERS += inc/wlansniffer.h \ + inc/wlansnifferlistview.h \ + inc/wlansniffermainwindow.h \ + inc/wlansnifferservice.h \ + traces/OstTraceDefinitions.h + +RESOURCES = res/wlansniffer.qrc + +SERVICE.FILE = res/service_conf.xml +SERVICE.OPTIONS = embeddable + +symbian*::LIBS += -lwlanqtutilities -lxqservice -lxqserviceutil -lqtsysteminfo + +symbian*: { + TARGET.UID3 = 0x10281CAA + SYMBIAN_PLATFORMS = WINSCW ARMV5 + BLD_INF_RULES.prj_exports += "rom/wlansniffer.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wlansniffer.iby)" + BLD_INF_RULES.prj_exports += "rom/wlansniffer_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(wlansniffer_resources.iby)" + addFiles.sources = /epoc32/release/$(PLATFORM)/$(CFG)/wlanqtutilities.dll xqservice.dll xqserviceutil.dll + addFiles.path = /sys/bin + DEPLOYMENT += addFiles + # Enable for QtHighway tracing + # DEFINES += WLANSNIFFER_SERVICETRACES +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wlanutilities.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanutilities.pro Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,30 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = subdirs + +SUBDIRS += \ + wlanqtutilities \ + wlansniffer \ + wlanentryplugin \ + wlanindicatorplugin \ + cpwlansettingsplugin + +CONFIG += ordered + +symbian*: { + SYMBIAN_PLATFORMS = WINSCW ARMV5 +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/inc/cwpsactiverunner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/inc/cwpsactiverunner.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WPS Wizard: Wrapper for middleware calls +* +*/ + +#ifndef CWPSACTIVERUNNER_H_ +#define CWPSACTIVERUNNER_H_ + +// System includes +#include +#include +#include +#include + +// User includes +#include "mwpsactiverunnercallback.h" + +// Forward declarations +// External data types +// Constants + + +/*! + * The wrapper class for wlan management engine calls + */ +// Class declaration +class CWpsActiveRunner : public CActive + { + +public: + static CWpsActiveRunner* NewL(MWpsActiveRunnerCallback& aObserver); + virtual ~CWpsActiveRunner(); +public: + + void InitL(); + void RunL(); + void DoCancel(); + TInt RunError(TInt aError); + void StartSetup(RBuf8& aSsid, int aPin); + +private: + CWpsActiveRunner(MWpsActiveRunnerCallback& aObserver); + void ConstructL(); + void InitializeL(); +private: + MWpsActiveRunnerCallback& iObserver; +#ifdef __arm + CWlanMgmtClient* iWLANMgmtClient; + CArrayFixSeg* iIapParametersArray; +#else + //Temporary for testing in WINSCW. + RTimer iTimer; + void RunProtectedSetup_Stub(); +#endif + }; + +#endif /* CWPSACTIVERUNNER_H_ */ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/inc/mwpsactiverunnercallback.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/inc/mwpsactiverunnercallback.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface class for the middleware callback +* +*/ +#ifndef MWPSACTIVERUNNERCALLBACK_H_ +#define MWPSACTIVERUNNERCALLBACK_H_ + +// System includes +#include +#include + +// User includes +// Forward declarations +// External data types +// Constants + +// Class declaration +class MWpsActiveRunnerCallback + { +public: + /*! + * Callback to notify the completion of middleware API call + */ + IMPORT_C virtual void WpsActiveRunnerStopped(QList< + TWlanProtectedSetupCredentialAttribute>& aCredentials, + TInt aError) = 0; + }; + +#endif /* MWPSACTIVERUNNERCALLBACK_H_ */ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/inc/wpswizard.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/inc/wpswizard.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the License "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WPS Wizard API + * + */ + +/* + * %version: 1 % + */ + + +#ifndef WPSWIZARD_H_ +#define WPSWIZARD_H_ + + + +#include +#include "wlanwizardplugin.h" + +#ifdef BUILD_WPS_WIZARD_DLL +#define WPS_WIZARD_EXPORT Q_DECL_EXPORT +#else +#define WPS_WIZARD_EXPORT Q_DECL_IMPORT +#endif + +class WlanWizardHelpper; +class WpsWizardPrivate; + + +/*! + * @addtogroup group_ + * @{ + */ + +class WPS_WIZARD_EXPORT WpsWizard: public QObject, public WlanWizardPlugin +{ +private: + Q_OBJECT + friend class WpsWizardPrivate; +public: + enum BearerType + { + BearerTypeWlan, + }; +public: + WpsWizard( + WlanWizardHelpper *wizardHelpper, + BearerType bearerType, int referenceId); + ~WpsWizard(); + + void storeSettings(); + +public: // From WlanWizardPlugin + bool summary(WlanWizardPlugin::Summary sum, QString &item, QString &value); + + + +private: + Q_DISABLE_COPY(WpsWizard) + WpsWizardPrivate *d_ptr; +}; + +/*! @} */ + + + + +#endif /* WPSWIZARD_H_ */ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/inc/wpswizard_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/inc/wpswizard_p.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WPS wizard private implementation +* +*/ + +#ifndef WPSWIZARD_P_H_ +#define WPSWIZARD_P_H_ + +// System includes +#include +#include +#include +#include +#include + +// User includes +#include "wlanwizardhelpper.h" +#include "wpswizard.h" + +// Forward declarations +class HbStackedWidget; +class HbWidget; +class HbLabel; +class HbView; +class HbAction; +class HbDocumentLoader; +class WlanWizardHelpper; + + +// External data types +// Constants + +// Class declaration +class WpsWizardPrivate : public QObject + { + + friend class WpsWizard; + +public: + WpsWizardPrivate(WpsWizard* wizard, WlanWizardHelpper *wizardHelpper, int bearerType, int referenceId); + ~WpsWizardPrivate(); +public: + /*! + * Based on the input either disables or enables next button + */ + void enableNextButton(bool enable); + /*! + * Moves automatically to the next page + */ + void nextPage(); + /*! + * Returns the SSID of the network + */ + QString getSsid(); + /*! + * Stores the settings received from the AP + */ + void storeSettings(int aIndex); + /*! + * Stores multiple settings received from the AP + */ + void storeSettingsArray( + QList& aCredentials); + QList getSettingsArray(); + /*! + * Stores the generated PIN + */ + void setPin(int random); + /*! + * Returns the generated PIN + */ + int getPin(); + +private: + Q_DISABLE_COPY(WpsWizardPrivate) + /*! + * Returns id of next page. updates settings EapWizard. + */ + void createPages(); + +private: + WpsWizard *q_ptr; + WlanWizardHelpper *mWizardHelpper; + QTranslator *mTranslator; + TWlanProtectedSetupCredentialAttribute mWpsAttr; + QList mIapList; + int mBearerType; + int mReferenceId; + int mRandomNumber; + }; + +#endif /* WPSWIZARD_P_H_ */ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/inc/wpswizardpage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/inc/wpswizardpage.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: API for wizard pages +* +*/ + +#ifndef WPSWIZARDPAGE_H_ +#define WPSWIZARDPAGE_H_ + + +// System includes + +// User includes +#include "wlanwizardpage.h" + +// Forward declarations +class WpsWizardPrivate; +class HbWidget; + + +// External data types +// Constants + +// Class declaration +class WpsWizardPage : public QObject, public WlanWizardPage + { +public: + enum WpsPageIds + { + PageWpsWizardStep2 = WlanWizardPage::PageWpsStart, + PageWpsWizardStep3_Button, + PageWpsWizardStep3_Number, + PageWpsWizardStep4, + PageWpsWizardStep5, + PageWpsWizardStep6 + }; +public: + WpsWizardPage(WpsWizardPrivate* parent); + virtual ~WpsWizardPage(); + + /*! + * Creates a visualization of the page. + */ + virtual HbWidget* initializePage() = 0; + /*! + * Returns id of next page. updates settings EapWizard. + */ + virtual int nextId(bool &removeFromStack) const = 0; + /*! + * Returns how many steps should be gone backwars. + */ + virtual int stepsBackwards(); + /*! + * This method is called when a visualization is displayed to detect + * whether next button should be enabled or not. + */ + virtual bool validate() const; + /*! + * This method is called when Previous button has been pressed. + */ + virtual void previousTriggered() = 0; + /*! + * This method is called when Cancel button has been pressed. + */ + virtual void cancelTriggered() = 0; + WpsWizardPrivate* mWizard; +private: + Q_DISABLE_COPY(WpsWizardPage) + }; + +/*! @} */ + +#endif /* WPSWIZARDPAGE_H_ */ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/inc/wpswizardstepfive.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/inc/wpswizardstepfive.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WPS wizard page step 5 +* +*/ +#ifndef WPSWIZARDSTEPFIVE_H_ +#define WPSWIZARDSTEPFIVE_H_ + + +// System includes +#include + +// User includes +#include "wpswizardpage.h" + +// Forward declarations +class HbRadioButtonList; +class HbWidget; +class HbLabel; +class HbProgressBar; +class WpsWizardPrivate; + + +// External data types +// Constants + +// Class declaration +class WpsPageStepFive : public WpsWizardPage + { +Q_OBJECT +public: + WpsPageStepFive(WpsWizardPrivate* parent); + ~WpsPageStepFive(); + +public: + /*! + * Creates a visualization of the page. + */ + HbWidget* initializePage(); + /*! + * Returns id of next page. updates settings EapWizard. + */ + int nextId(bool &removeFromStack) const; + /*! + * Returns how many steps should be gone backwards. + */ + int stepsBackwards(); + /*! + * This method is called when Previous button has been pressed. + */ + void previousTriggered(); + /*! + * This method is called when Cancel button has been pressed. + */ + void cancelTriggered(); + /*! + * This method is called when a visualization is displayed to detect + * whether next button should be enabled or not. + */ + bool validate() const; + +public slots: + void itemSelected(int index); + +private: + Q_DISABLE_COPY(WpsPageStepFive) + HbWidget *mWidget; + HbRadioButtonList *mRadio; + HbLabel *mTitle; + HbLabel *mHeading; + bool mValid; + }; + +/*! @} */ + +#endif /* WPSWIZARDSTEPFIVE_H_ */ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/inc/wpswizardstepfour.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/inc/wpswizardstepfour.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WPS wizard page step 4 +* +*/ +#ifndef WPSWIZARDSTEPFOUR_H_ +#define WPSWIZARDSTEPFOUR_H_ + + +// System includes +#include +#include + +// User includes +#include "wpswizardpage.h" +#include "mwpsactiverunnercallback.h" +#include "cwpsactiverunner.h" + +// Forward declarations +class HbRadioButtonList; +class HbWidget; +class HbLabel; +class HbProgressBar; +class WpsWizardPrivate; + +// External data types +// Constants + +// Class declaration +class WpsPageStepFour : public WpsWizardPage, public MWpsActiveRunnerCallback + { +Q_OBJECT +public: + WpsPageStepFour(WpsWizardPrivate* parent); + ~WpsPageStepFour(); + +public: + /*! + * Creates a visualization of the page. + */ + HbWidget* initializePage(); + /*! + * Returns id of next page. updates settings EapWizard. + */ + int nextId(bool &removeFromStack) const; + /*! + * Returns how many steps should be gone backwards. + */ + int stepsBackwards(); + /*! + * This method is called when Previous button has been pressed. + */ + void previousTriggered(); + /*! + * This method is called when Cancel button has been pressed. + */ + void cancelTriggered(); + /*! + * This method is called when a visualization is displayed to detect + * whether next button should be enabled or not. + */ + bool validate() const; + /*! + * From mwpsactiverunnercallback.h + * This method is called from the active runner class to notify the end + * of operation + */ + void WpsActiveRunnerStopped( + QList& aCredentials, + TInt aError); + +public slots: + +private: + Q_DISABLE_COPY(WpsPageStepFour) + void StartWpsRunner(); + + HbWidget *mWidget; + HbRadioButtonList *mRadio; + HbLabel *mTitle; + HbLabel *mHeading; + HbProgressBar *mProgressBar; + CWpsActiveRunner *mWpsActiveRunner; + int mWpsErrorCode; + int countCredentials; + bool mValid; + + }; + +/*! @} */ + +#endif /* WPSWIZARDSTEPFOUR_H_ */ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/inc/wpswizardstepthreebutton.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/inc/wpswizardstepthreebutton.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Step 3 Button press mode +* +*/ + +#ifndef WPSWIZARDSTEPTHREEBUTTON_H_ +#define WPSWIZARDSTEPTHREEBUTTON_H_ + +// System includes +#include + +// User includes +#include "wpswizardpage.h" + +// Forward declarations +class HbRadioButtonList; +class HbWidget; +class HbLabel; +class WpsWizardPrivate; + +// External data types + +// Constants + +// Class declaration +class WpsPageStepThreeButton : public WpsWizardPage + { +Q_OBJECT +public: + WpsPageStepThreeButton(WpsWizardPrivate* parent); + ~WpsPageStepThreeButton(); + +public: + /*! + * Creates a visualization of the page. + */ + HbWidget* initializePage(); + /*! + * Returns id of next page. updates settings EapWizard. + */ + int nextId(bool &removeFromStack) const; + /*! + * Returns how many steps should be gone backwards. + */ + int stepsBackwards(); + /*! + * This method is called when Previous button has been pressed. + */ + void previousTriggered(); + /*! + * This method is called when Cancel button has been pressed. + */ + void cancelTriggered(); + /*! + * This method is called when a visualization is displayed to detect + * whether next button should be enabled or not. + */ + bool validate() const; + +public slots: + +private: + Q_DISABLE_COPY(WpsPageStepThreeButton) + HbWidget *mWidget; + HbRadioButtonList *mRadio; + HbLabel *mTitle; + HbLabel *mHeading; + bool mValid; + }; + +/*! @} */ + +#endif /* WPSWIZARDSTEPTHREEBUTTON_H_ */ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/inc/wpswizardstepthreenumber.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/inc/wpswizardstepthreenumber.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Step 3 Number mode +* +*/ + +#ifndef WPSWIZARDSTEPTHREENUMBER_H_ +#define WPSWIZARDSTEPTHREENUMBER_H_ + + +// System includes +#include + +// User includes +#include "wpswizardpage.h" + +// Forward declarations +class HbRadioButtonList; +class HbWidget; +class HbLabel; +class WpsWizardPrivate; + +// External data types +// Constants + +// Class declaration +class WpsPageStepThreeNumber : public WpsWizardPage + { + Q_OBJECT + public: + WpsPageStepThreeNumber(WpsWizardPrivate* parent); + ~WpsPageStepThreeNumber(); + public: + /*! + * Creates a visualization of the page. + */ + HbWidget* initializePage(); + /*! + * Returns id of next page. updates settings EapWizard. + */ + int nextId(bool &removeFromStack) const; + /*! + * Returns how many steps should be gone backwards. + */ + int stepsBackwards(); + /*! + * This method is called when Previous button has been pressed. + */ + void previousTriggered(); + /*! + * This method is called when Cancel button has been pressed. + */ + void cancelTriggered(); + /*! + * This method is called when a visualization is displayed to detect + * whether next button should be enabled or not. + */ + bool validate() const; + + private: + /*! + * This method computes a random number based on current syste time + */ + int computeRandNumber(); + /*! + * This method computes the check sum on the input number + */ + int computeCheckSum(int aPin); + + private slots: + + private: // data + Q_DISABLE_COPY(WpsPageStepThreeNumber) + HbWidget *mWidget; + HbRadioButtonList *mRadio; + HbLabel *mTitle; + HbLabel *mHeading; + bool mValid; + }; + +/*! @} */ + +#endif /* WPSWIZARDSTEPTHREENUMBER_H_ */ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/inc/wpswizardsteptwo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/inc/wpswizardsteptwo.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WPS wizard page 2 +* +*/ +#ifndef WPSWIZARDSTEPTWO_H_ +#define WPSWIZARDSTEPTWO_H_ + +// System includes +#include + +// User includes +#include "wpswizardpage.h" + +// Forward declarations +class HbRadioButtonList; +class HbWidget; +class HbLabel; +class WpsWizardPrivate; + + +// External data types +// Constants + + +// Class declaration +class WpsPageStepTwo : public WpsWizardPage + { +Q_OBJECT +public: + WpsPageStepTwo(WpsWizardPrivate* parent); + ~WpsPageStepTwo(); + +public: + /*! + * Creates a visualization of the page. + */ + HbWidget* initializePage(); + /*! + * Returns id of next page. updates settings EapWizard. + */ + int nextId(bool &removeFromStack) const; + /*! + * Returns how many steps should be gone backwards. + */ + int stepsBackwards(); + /*! + * This method is called when Previous button has been pressed. + */ + void previousTriggered(); + /*! + * This method is called when Cancel button has been pressed. + */ + void cancelTriggered(); + /*! + * This method is called when a visualization is displayed to detect + * whether next button should be enabled or not. + */ + bool validate() const; + +public slots: + /*! + * To receive the signal when an item is selected in the list view + */ + void itemSelected(int index); + +private: + Q_DISABLE_COPY(WpsPageStepTwo) + + HbWidget *mWidget; + HbRadioButtonList *mRadio; + HbLabel *mTitle; + HbLabel *mHeading; + bool mValid; + int mItemSelected; + }; + + +#endif /* WPSWIZARDSTEPTWO_H_ */ diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/resources/resource.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/resources/resource.qrc Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,14 @@ + + + occ_wps_P1.docml + occ_wps_P2.docml + occ_wps_P3.docml + occ_wps_P4.docml + occ_wps_P5.docml + occ_wps_P6.docml + + + + wpswizardplugin.qm + + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/resources/wpswizardplugin.qm Binary file wlanutilities/wpswizard/resources/wpswizardplugin.qm has changed diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/resources/wpswizardplugin.ts --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/resources/wpswizardplugin.ts Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,86 @@ + + + + + + + Configure manually + Configure manually + qtl_list_popup_sec_add + occ_wps_01 + list + oc + False + + + + Use PIN code + Use PIN code + qtl_list_popup_sec_add + occ_wps_01 + list + oc + False + + + + First, press button on the wireless station to initiate the setup process, then select ‘Next’. + First, press button on the wireless station to initiate the setup process, then select ‘Next’. + qtl_dialog_pri5 + occ_wps_02 + dialog + oc + False + + + + Settings received for multiple WLAN networks. Select the network to use: + Settings received for multiple WLAN networks. Select the network to use: + qtl_dialog_pri5 + occ_wps_05 + dialog + oc + False + + + + Enter ‘%1 on the wireless station then select ‘Next’. + Enter ‘%1 on the wireless station then select ‘Next’. + qtl_dialog_pri5 + occ_wps_03 + dialog + oc + False + + + + Selected network supports Wi-Fi Protected Setupâ„¢ for receiving settings automatically. + Selected network supports Wi-Fi Protected Setupâ„¢ for receiving settings automatically. + qtl_dialog_pri5 + occ_wps_01 + dialog + oc + False + + + + Negotiating + Negotiating + qtl_dialog_pri3 + occ_wps_04 + dialog + oc + False + + + + Use push-button + Use push-button + qtl_list_popup_sec_add + occ_wps_01 + list + oc + False + + + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/rom/wpswizard.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/rom/wpswizard.iby Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef WPSWIZARD_IBY +#define WPSWIZARD_IBY + +#include + +//#ifdef __PROTOCOL_WLAN + +file=ABI_DIR\BUILD_DIR\wpswizard.dll SHARED_LIB_DIR\wpswizard.dll + +//#endif // __PROTOCOL_WLAN + +#endif // WPSWIZARD_IBY diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/src/cwpsactiverunner.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/src/cwpsactiverunner.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,225 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the License "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation of middleware wrapper class + * + * + */ + + +// User includes +#include "cwpsactiverunner.h" +#include "wlanmgmtcommon.h" + +//Need to check this. +const TInt KArrayGranularity = 4; + +/*! + \class CWpsActiveRunner + \brief CWpsActiveRunner is a wrapper class wlan Mgmt engine interface + */ + + +/*! + * Creates the instance of active runner which encapsulates the wlan mgmt + * interface middleware calls + * + * + * \param MWpsActiveRunnerCallback call back interface to notify the completion of the middleware calls + */ +CWpsActiveRunner* CWpsActiveRunner::NewL(MWpsActiveRunnerCallback& aObserver) +{ + CWpsActiveRunner* self = new (ELeave) CWpsActiveRunner( aObserver ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; +} +/*! + * Creates the instance of active runner which encapsulates the wlan mgmt + * interface middleware calls + * + * + * \param MWpsActiveRunnerCallback call back interface to notify the completion of the middleware calls + */ +CWpsActiveRunner::CWpsActiveRunner(MWpsActiveRunnerCallback& aObserver) : + CActive(EPriorityStandard), iObserver(aObserver) +{ +#ifdef __arm + iIapParametersArray = NULL; + iWLANMgmtClient = NULL; +#endif +} + +/*! + * Initializes the member variables + * + * + * \return integer error code indicating the result of the operation + */ +void CWpsActiveRunner::InitL() +{ + CActiveScheduler::Add(this); +#ifdef __arm + InitializeL(); +#else + iTimer.CreateLocal(); +#endif + +} + +void CWpsActiveRunner::ConstructL() +{ + InitL(); +} + +/*! + * Initializes the member variables for making the middleware calls + * + */ + +void CWpsActiveRunner::InitializeL() +{ +#ifdef __arm + if (!iWLANMgmtClient) + iWLANMgmtClient = CWlanMgmtClient::NewL(); + if (!iIapParametersArray) + iIapParametersArray = new (ELeave) CArrayFixSeg< + TWlanProtectedSetupCredentialAttribute> (KArrayGranularity); +#endif +} + +/*! + * Destructor + * + */ + +CWpsActiveRunner::~CWpsActiveRunner() +{ + Cancel(); +#ifdef __arm + delete iWLANMgmtClient; + delete iIapParametersArray; +#else + iTimer.Cancel(); + iTimer.Close(); +#endif +} + +/*! + * Initiates the call to the middleware + */ +void CWpsActiveRunner::StartSetup(RBuf8& aSsid, int aPin) +{ +#ifdef __arm + TWlanSsid ssid; + TWlanWpsPin pin; + + ssid.Copy(aSsid); + TBuf8<32> pinCode; + pinCode.AppendNum(aPin); + pin.Copy(pinCode); + iWLANMgmtClient->RunProtectedSetup(iStatus,ssid,pin,*iIapParametersArray); +#else + iTimer.After(iStatus, 4 * 1000000); +#endif + SetActive(); + +} + +/*! + * RunL implementation + */ +void CWpsActiveRunner::RunL() +{ + TInt completionCode = iStatus.Int(); + QList credentials; + + if (completionCode < KErrNone) { + //Raise Error + iObserver.WpsActiveRunnerStopped(credentials, completionCode); + } + else { +#ifdef __arm + TInt len = iIapParametersArray->Length(); + TInt count; + for(count=0;countCount();count++) + { + TWlanProtectedSetupCredentialAttribute attr =(*iIapParametersArray)[count]; + credentials.append(attr); + } + iObserver.WpsActiveRunnerStopped(credentials,completionCode); +#else + + RunProtectedSetup_Stub(); +#endif + } + +} + +/*! + * Cancels the ongoing call + */ +void CWpsActiveRunner::DoCancel() +{ +#ifdef __arm + if(iWLANMgmtClient) + iWLANMgmtClient->CancelProtectedSetup(); +#else + iTimer.Cancel(); +#endif +} + +/*! + * Handles the error usecase + */ +TInt CWpsActiveRunner::RunError(TInt aError) +{ + QList credentials; +#ifdef __arm + if(iWLANMgmtClient) + iWLANMgmtClient->CancelProtectedSetup(); +#else + iTimer.Cancel(); +#endif + + iObserver.WpsActiveRunnerStopped(credentials, aError); +} + +#ifndef __arm +void CWpsActiveRunner::RunProtectedSetup_Stub() +{ + QList credentials; + TWlanProtectedSetupCredentialAttribute attr1 = { EWlanOperatingModeInfrastructure, // iOperatingMode + EWlanAuthenticationModeOpen, // iAuthenticationMode + EWlanIapSecurityModeWpa, // iSecurityMode, + _L8( "STUB01" ), // iSsid + _L8( "" ), // iWepKey1 + _L8( "" ), // iWepKey2 + _L8( "" ), // iWepKey3 + _L8( "" ), // iWepKey4 + EWlanDefaultWepKey1, // iWepDefaultKey + _L8( "testtest" ) + // iWpaPreSharedKey + }; + + TWlanProtectedSetupCredentialAttribute attr2 = { EWlanOperatingModeAdhoc, + EWlanAuthenticationModeOpen, EWlanIapSecurityModeWep, _L8( "STUB02" ), _L8( "12345" ), + _L8( "" ), _L8( "" ), _L8( "" ), EWlanDefaultWepKey1, _L8( "" ) }; + + credentials.append(attr1); + credentials.append(attr2); + + iObserver.WpsActiveRunnerStopped(credentials, KErrNone); +} +#endif diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/src/wpswizard.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/src/wpswizard.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the License "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WPS Wizard: API implementation. + * + */ + + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include + +// Trace includes +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wpswizardTraces.h" +#endif + +// User includes +// WLAN Wizard +#include "wlanwizardhelpper.h" + +// Wizard +#include "wpswizard.h" +#include "wpswizard_p.h" + +// Wizard Pages +#include "wpswizardsteptwo.h" +#include "wpswizardstepthreebutton.h" +#include "wpswizardstepthreenumber.h" +#include "wpswizardstepfour.h" +#include "wpswizardstepfive.h" + + +class WlanWizardHelpper; + +/*! +* Creates the WpsWizard object +* +* \param WlanWizardHelpper* Helper class to from the framework +* \param BearerType Indicates the bearer type Eg. Wlan +* +*/ + +WpsWizard::WpsWizard(WlanWizardHelpper *wizardHelpper, BearerType bearerType, + int referenceId) : + d_ptr(new WpsWizardPrivate(this, wizardHelpper, bearerType, referenceId)) + { + OstTraceFunctionEntry1(WPSWIZARD_WPSWIZARD_ENTRY, this) + OstTraceFunctionExit1(WPSWIZARD_WPSWIZARD_EXIT, this) + } + +/*! +* Destructor +* +*/ + +WpsWizard::~WpsWizard() + { + OstTraceFunctionEntry1(WPSWIZARD_WPSWIZARD_ENTRY, this); + delete d_ptr; + OstTraceFunctionExit1(WPSWIZARD_WPSWIZARD_EXIT, this); + } + +/*! +* StoreSettings: Stores the settings in the commsdat database +* +*/ + +void WpsWizard::storeSettings() + { + OstTraceFunctionEntry1(WPSWIZARD_STORESETTINGS_ENTRY, this); + OstTraceFunctionExit1(WPSWIZARD_STORESETTINGS_EXIT, this); + } + +/*! +* Creates the summary page, valid only for EAP usecase +* +* \param WlanWizardPlugin::Summary indicates the type of summary item +* \param QString &item item name +* \param QString &value item value +* +* \return the status of the summary operation +*/ + +bool WpsWizard::summary(WlanWizardPlugin::Summary sum, QString &item, + QString &value) + { + OstTraceFunctionEntry1(WPSWIZARD_SUMMARY_ENTRY, this); + OstTraceFunctionExit1(WPSWIZARD_SUMMARY_EXIT, this); + return true; + } diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/src/wpswizardpage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/src/wpswizardpage.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the License "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WPS Wizard: API for wizard pages. + * + */ + +// System includes +#include + +// User includes +#include "wpswizardpage.h" + +// Trace includes +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wpswizardpageTraces.h" +#endif + +#define WPS_DEFAULT_STEPBACK 1 + + /*! + * Constructor for the WPS page baseclass + * + * \param WpsWizardPrivate* pointer to the implementation class + */ + +WpsWizardPage::WpsWizardPage(WpsWizardPrivate* parent) : + mWizard(parent) +{ +OstTraceFunctionEntry1(WPSWIZARDPAGE_WPSWIZARDPAGE_ENTRY, this) +OstTraceFunctionExit1(WPSWIZARDPAGE_WPSWIZARDPAGE_EXIT, this) +} + +/*! +* Destructor +*/ +WpsWizardPage::~WpsWizardPage() +{ + OstTraceFunctionEntry1(WPSWIZARDPAGE_WPSWIZARDPAGE_ENTRY, this) + mWizard = NULL; +OstTraceFunctionExit1(WPSWIZARDPAGE_WPSWIZARDPAGE_EXIT, this) +} + +/*! +* Determines how many pages to step back. +* \return number of pages to step backwards +*/ +int WpsWizardPage::stepsBackwards() +{ + OstTraceFunctionEntry1(WPSWIZARDPAGE_STEPBACKWARDS_ENTRY, this) + OstTraceFunctionExit1(WPSWIZARDPAGE_STEPBACKWARDS_EXIT, this) + return WPS_DEFAULT_STEPBACK; +} + +/*! +* Validates the contents of the page +*/ +bool WpsWizardPage::validate() const +{ + OstTraceFunctionEntry1(WPSWIZARDPAGE_VALIDATE_ENTRY, this) + OstTraceFunctionExit1(WPSWIZARDPAGE_VALIDATE_EXIT, this) + return true; +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/src/wpswizardprivate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/src/wpswizardprivate.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,229 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the License "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WPS Wizard: Private implementation. + * + */ + +/* + * %version: 1 % + */ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include + +// Trace includes +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wpswizardprivateTraces.h" +#endif + +// User includes +#include "wlanwizardhelpper.h" +// Wizard +#include "wpswizard.h" +#include "wpswizard_p.h" +// Wizard Pages +#include "wpswizardsteptwo.h" +#include "wpswizardstepthreebutton.h" +#include "wpswizardstepthreenumber.h" +#include "wpswizardstepfour.h" +#include "wpswizardstepfive.h" + + +class WlanWizardHelpper; + +/*! + * Constructor for the private implementation of wps wiazard + * + * \param WpsWizard* pointer to the framework object + * \param WlanWizardHelpper * pointer to the wizard helpper class + * + */ +WpsWizardPrivate::WpsWizardPrivate(WpsWizard* wizard, + WlanWizardHelpper *wizardHelpper, int bearerType, int referenceId) : + q_ptr(wizard), mBearerType(bearerType), mReferenceId(referenceId), + mWizardHelpper(wizardHelpper), mRandomNumber(0) + + { + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_WPSWIZARDPRIVATE_ENTRY, this); + + // TODO: load localization file + mTranslator = new QTranslator(this); + mTranslator->load(":/loc/wpswizardplugin.qm"); + qApp->installTranslator(mTranslator); + + createPages(); + + OstTraceFunctionExit1(WPSWIZARDPRIVATE_WPSWIZARDPRIVATE_EXIT, this); + } + +/*! + * Destructor + */ +WpsWizardPrivate::~WpsWizardPrivate() + { + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_WPSWIZARDPRIVATE_ENTRY, this); + // have to delete the memory that was allocated in this object + mIapList.clear(); + delete mTranslator; + OstTraceFunctionExit1(WPSWIZARDPRIVATE_WPSWIZARDPRIVATE_EXIT, this); + } + +/*! + * Provides the caller with the functionality to enable/disable the 'Next' button + * + * \param bool to indicate whether to enable or disable the 'next button' + */ +void WpsWizardPrivate::enableNextButton(bool enable) + { + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_ENABLENEXTBUTTON_ENTRY, this); + mWizardHelpper->enableNextButton(enable); + OstTraceFunctionExit1(WPSWIZARDPRIVATE_ENABLENEXTBUTTON_EXIT, this); + } + +/*! + * Provides the functionality to automatically move to the next page. + */ +void WpsWizardPrivate::nextPage() + { + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_NEXTPAGE_ENTRY, this); + mWizardHelpper->nextPage(); + OstTraceFunctionExit1(WPSWIZARDPRIVATE_NEXTPAGE_EXIT, this); + } + +/*! + * Provides the functionality to store the recieved settings + * + * \param int indicates the index in the array of received settings to be stored + */ +void WpsWizardPrivate::storeSettings(int aIndex) + { + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_STORESETTINGS_ENTRY, this); + mWpsAttr = mIapList[aIndex]; + + QString ssid = QString::fromUtf8((const char*) mWpsAttr.iSsid.Ptr(), + mWpsAttr.iSsid.Length()); + + mWizardHelpper->setConfigurations(WlanWizardHelpper::ConfSsid, ssid); + mWizardHelpper->setConfigurations(WlanWizardHelpper::ConfNetworkMode, + mWpsAttr.iOperatingMode); + mWizardHelpper->setConfigurations(WlanWizardHelpper::ConfSecurityMode, + mWpsAttr.iSecurityMode); + mWizardHelpper->setConfigurations(WlanWizardHelpper::ConfKeyWepDefault, + mWpsAttr.iWepDefaultKey); + QString str = QString::fromUtf8((const char*) mWpsAttr.iWepKey1.Ptr(), + mWpsAttr.iWepKey1.Length()); + mWizardHelpper->setConfigurations(WlanWizardHelpper::ConfKeyWep1, str); + str = QString::fromUtf8((const char*) mWpsAttr.iWepKey2.Ptr(), mWpsAttr.iWepKey2.Length()); + mWizardHelpper->setConfigurations(WlanWizardHelpper::ConfKeyWep2, str); + str = QString::fromUtf8((const char*) mWpsAttr.iWepKey3.Ptr(), mWpsAttr.iWepKey3.Length()); + mWizardHelpper->setConfigurations(WlanWizardHelpper::ConfKeyWep3, str); + str = QString::fromUtf8((const char*) mWpsAttr.iWepKey4.Ptr(), mWpsAttr.iWepKey4.Length()); + mWizardHelpper->setConfigurations(WlanWizardHelpper::ConfKeyWep4, str); + + OstTraceFunctionExit1(WPSWIZARDPRIVATE_STORESETTINGS_EXIT, this); + } + +/*! + * Provides the functionality to retrieve the ssid of the network to connect + * \return returns the SSID as a QString + */ +QString WpsWizardPrivate::getSsid() + { + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_GETSSID_ENTRY, this); + QString ssid; + ssid = mWizardHelpper->configurations(WlanWizardHelpper::ConfSsid).toString(); + OstTraceFunctionExit1(WPSWIZARDPRIVATE_GETSSID_EXIT, this); + return ssid; + } + +/*! + * Provides functionality for the caller to store the array of recieved settings from AP + * \param QList& received settings + * + */ +void WpsWizardPrivate::storeSettingsArray(QList< + TWlanProtectedSetupCredentialAttribute>& aIapList) + { + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_STORESETTINGSARRAY_ENTRY, this); + mIapList = aIapList; + OstTraceFunctionExit1(WPSWIZARDPRIVATE_STORESETTINGSARRAY_EXIT, this); + } + +/*! + * Returns the array of settings received from the AP + * + * \return Array containing the settings + */ +QList WpsWizardPrivate::getSettingsArray() + { + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_GETSETTINGSARRAY_ENTRY, this); + OstTraceFunctionExit1(WPSWIZARDPRIVATE_GETSETTINGSARRAY_EXIT, this); + return mIapList; + } + + + +/*! + * Creates the required pages for WPS setup + */ +void WpsWizardPrivate::createPages() + { + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_CREATEPAGES_ENTRY, this); + mWizardHelpper->addPage(WpsWizardPage::PageWpsWizardStep2, + new WpsPageStepTwo(this)); + mWizardHelpper->addPage(WpsWizardPage::PageWpsWizardStep3_Button, + new WpsPageStepThreeButton(this)); + mWizardHelpper->addPage(WpsWizardPage::PageWpsWizardStep3_Number, + new WpsPageStepThreeNumber(this)); + mWizardHelpper->addPage(WpsWizardPage::PageWpsWizardStep4, + new WpsPageStepFour(this)); + mWizardHelpper->addPage(WpsWizardPage::PageWpsWizardStep5, + new WpsPageStepFive(this)); + OstTraceFunctionExit1(WPSWIZARDPRIVATE_CREATEPAGES_EXIT, this); + } + +/*! + * Provides with the functionality to store the PIN generated + * + * \param int The generated PIN code to be used in succesive steps + * + */ +void WpsWizardPrivate::setPin(int random) + { + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_SETPIN_ENTRY, this); + mRandomNumber = random; + OstTraceFunctionExit1(WPSWIZARDPRIVATE_SETPIN_EXIT, this); + } + +/*! + * Returns the PIN code stored in one of the WPS Pages + * + * \return PIN code to be used in the WPS operation. + */ +int WpsWizardPrivate::getPin() + { + OstTraceFunctionEntry1(WPSWIZARDPRIVATE_GETPIN_ENTRY, this); + OstTraceFunctionExit1(WPSWIZARDPRIVATE_GETPIN_EXIT, this); + return mRandomNumber; + + } diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/src/wpswizardstepfive.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/src/wpswizardstepfive.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the License "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WPS Wizard Page: Step 5 + * + */ + +// System includes +#include +#include +#include +#include +#include + +// User includes +#include "wpswizardstepfive.h" +#include "wpswizard_p.h" + +// Trace Includes +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wpspagestepfiveTraces.h" +#endif + +/*! + * Constructor for WPS page five + * + * \param WpsWizardPrivate* Pointer to the WPS wizard private implementation + */ +WpsPageStepFive::WpsPageStepFive(WpsWizardPrivate* parent) : + WpsWizardPage(parent), mWidget(NULL), mRadio(NULL), mValid(false) +{ +OstTraceFunctionEntry1(WPSPAGESTEPFIVE_WPSPAGESTEPFIVE_ENTRY, this) +OstTraceFunctionExit1(WPSPAGESTEPFIVE_WPSPAGESTEPFIVE_EXIT, this) + +} + +/*! + * Destructor + */ +WpsPageStepFive::~WpsPageStepFive() +{ + OstTraceFunctionEntry1(WPSPAGESTEPFIVE_WPSPAGESTEPFIVE_ENTRY, this) + OstTraceFunctionExit1(WPSPAGESTEPFIVE_WPSPAGESTEPFIVE_EXIT, this) + + delete mWidget; +} + +/*! + * Loads the page with all the widgets + * + * \return HbWidget* Returns the view widget + */ +HbWidget* WpsPageStepFive::initializePage() +{ + OstTraceFunctionEntry1(WPSPAGESTEPFIVE_INITIALIZEPAGE_ENTRY, this) + + if (!mWidget) { + bool ok; + HbDocumentLoader loader; + loader.load(":/docml/occ_wps_P5.docml", &ok); + Q_ASSERT_X(ok, "WPS Wizard", "Invalid docml file"); + + mWidget = qobject_cast (loader.findWidget("occ_wps_P5")); + Q_ASSERT_X(mWidget != 0, "WPS Wizard", "View not found"); + + //mTitle = qobject_cast (loader.findWidget("label_title")); + //Q_ASSERT_X(mTitle != 0, "WPS wizard", "title not found"); + + mHeading = qobject_cast (loader.findWidget("label_heading")); + Q_ASSERT_X(mTitle != 0, "WPS wizard", "Header not found"); + + mRadio = qobject_cast (loader.findWidget("radioButtonList")); + Q_ASSERT_X(mRadio != 0, "WPS Wizard", "List not found"); + + QList arr = mWizard->getSettingsArray(); + + QStringList ssidList; + for (int count = 0; count < arr.count(); count++) { + TWlanProtectedSetupCredentialAttribute attr = arr[count]; + //file.Write(attr.iSsid); + //Append (attr.iSsid) to a list and send to UI Engine. + QString ssid = QString::fromUtf8((const char*) attr.iSsid.Ptr(), attr.iSsid.Length()); + ssidList.append(ssid); + } + + mRadio->setItems(ssidList); + + connect(mRadio, SIGNAL(itemSelected(int)), this, SLOT(itemSelected(int))); + } + OstTraceFunctionExit1(WPSPAGESTEPFIVE_INITIALIZEPAGE_EXIT, this) + return mWidget; +} + +/*! + * Callback when the previous button is clicked + */ +void WpsPageStepFive::previousTriggered() +{ +OstTraceFunctionEntry1(WPSPAGESTEPFIVE_PREVIOUSTRIGGERED_ENTRY, this) +OstTraceFunctionExit1(WPSPAGESTEPFIVE_PREVIOUSTRIGGERED_EXIT, this) + +} +/*! + * CallBack when the cancel button is clicked + */ +void WpsPageStepFive::cancelTriggered() +{ +OstTraceFunctionEntry1(WPSPAGESTEPFIVE_CANCELTRIGGERED_ENTRY, this) +OstTraceFunctionExit1(WPSPAGESTEPFIVE_CANCELTRIGGERED_EXIT, this) + +} +/*! + * Funtion to determine the next page to be displayed in the wizard process + * + * \param bool& RemoveFromStack indicating whether the current page should be + * removed from the stack + * + * \return int Page Id of the next page to be displayed. + */ +int WpsPageStepFive::nextId(bool &removeFromStack) const +{ + OstTraceFunctionEntry1(WPSPAGESTEPFIVE_NEXTID_ENTRY, this) + + int id = WlanWizardPage::PageProcessSettings; + removeFromStack = false; + OstTraceFunctionExit1(WPSPAGESTEPFIVE_NEXTID_EXIT, this) + return id; +} + +/*! + * Determines the Number of steps to move backwards when 'Prev' Button + * is clicked + * + * \return int Number of pages to move backwards + */ +int WpsPageStepFive::stepsBackwards() +{ + OstTraceFunctionEntry1(WPSPAGESTEPFIVE_STEPSBACKWARDS_ENTRY, this) + OstTraceFunctionExit1(WPSPAGESTEPFIVE_STEPBACKWARDS_EXIT, this) + + return (PageWpsWizardStep5 - PageWpsWizardStep2) - 1; +} + +/*! + * Validates the content of the pages + * + * \return bool Indicating the result of the operation + */ +bool WpsPageStepFive::validate() const +{ + OstTraceFunctionEntry1(WPSPAGESTEPFIVE_VALIDATE_ENTRY, this) + OstTraceFunctionExit1(WPSPAGESTEPFIVE_VALIDATE_EXIT, this) + + return mValid; +} + +/*! + * Call back when an item is selected from the list on the UI + * + * \param int index Indcating the relative position in the list + */ +void WpsPageStepFive::itemSelected(int index) +{ + OstTraceFunctionEntry1(WPSPAGESTEPFIVE_ITEMSELECTED_ENTRY, this) + + mValid = true; + mWizard->storeSettings(index); + mWizard->enableNextButton(mValid); + + OstTraceFunctionExit1(WPSPAGESTEPFIVE_ITEMSELECTED_EXIT, this) +} + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/src/wpswizardstepfour.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/src/wpswizardstepfour.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,244 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the License "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WPS Wizard Page: Step 4 progress bar display + * + */ + +/* + * %version: 1 % + */ + +// System includes +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "wpswizardstepfour.h" +#include "wpswizard_p.h" + +// Trace includes +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wpspagestepfourTraces.h" +#endif + +/*! + * Constructor for WPS page four + * + * \param WpsWizardPrivate* Pointer to the WPS wizard private implementation + */ +WpsPageStepFour::WpsPageStepFour(WpsWizardPrivate* parent) : + WpsWizardPage(parent), mWidget(NULL), mRadio(NULL), mValid(false) +{ +OstTraceFunctionEntry1(WPSPAGESTEPFOUR_WPSPAGESTEPFOUR_ENTRY, this) +OstTraceFunctionExit1(WPSPAGESTEPFOUR_WPSPAGESTEPFOUR_EXIT, this) + +} + +/*! + * Destructor + */ +WpsPageStepFour::~WpsPageStepFour() +{ + OstTraceFunctionEntry1(WPSPAGESTEPFOUR_WPSPAGESTEPFOUR_ENTRY, this) + + delete mWidget; + delete mWpsActiveRunner; + +OstTraceFunctionExit1(WPSPAGESTEPFOUR_WPSPAGESTEPFOUR_EXIT, this) +} + +/*! + * Loads the page with all the widgets + * + * \return HbWidget* Returns the view widget + */ +HbWidget* WpsPageStepFour::initializePage() +{ + OstTraceFunctionEntry1(WPSPAGESTEPFOUR_INITIALIZEPAGE_ENTRY, this) + + if (!mWidget) { + bool ok; + HbDocumentLoader loader; + loader.load(":/docml/occ_wps_P4.docml", &ok); + Q_ASSERT_X(ok, "WPS Wizard", "Invalid docml file"); + + mWidget = qobject_cast (loader.findWidget("occ_wps_P4")); + Q_ASSERT_X(mWidget != 0, "WPS Wizard", "View not found"); + + //mTitle = qobject_cast (loader.findWidget("label_title")); + //Q_ASSERT_X(mTitle != 0, "WPS wizard", "title not found"); + + mHeading = qobject_cast (loader.findWidget("label_heading")); + Q_ASSERT_X(mTitle != 0, "WPS wizard", "Header not found"); + + mProgressBar = qobject_cast (loader.findWidget("horizontalProgressBar")); + Q_ASSERT_X(mRadio != 0, "WPS Wizard", "List not found"); + + // start the framework. + mWpsActiveRunner = CWpsActiveRunner::NewL(*this); + Q_ASSERT(error == NULL); + } + + mProgressBar->setRange(0, 0); + + StartWpsRunner(); + OstTraceFunctionExit1(WPSPAGESTEPFOUR_INITIALIZEPAGE_EXIT, this) + + return mWidget; +} + +/*! + * Funtion to determine the next page to be displayed in the wizard process + * + * \param bool& RemoveFromStack indicating whether the current page should be + * removed from the stack + * + * \return int Page Id of the next page to be displayed. + */ +int WpsPageStepFour::nextId(bool &removeFromStack) const +{ + OstTraceFunctionEntry1(WPSPAGESTEPFOUR_NEXTID_ENTRY, this) + + int id = WpsWizardPage::PageNone; + removeFromStack = false; + if (countCredentials >= 2) { + id = WpsWizardPage::PageWpsWizardStep5; + } + else { + // only one response received. So go to the summary page + mWizard->storeSettings(0); + id = WlanWizardPage::PageProcessSettings; + } + OstTraceFunctionExit1(WPSPAGESTEPFOUR_NEXTID_EXIT, this) + + return id; +} + + +/*! + * Determines the Number of steps to move backwards when 'Prev' Button + * is clicked + * + * \return int Number of pages to move backwards + */ +int WpsPageStepFour::stepsBackwards() +{ + OstTraceFunctionEntry1(WPSPAGESTEPFOUR_STEPSBACKWARDS_ENTRY, this) + OstTraceFunctionExit1(WPSPAGESTEPFOUR_STEPBACKWARDS_EXIT, this) + + return (PageWpsWizardStep4 - PageWpsWizardStep2) - 1; +} + +/*! + * Callback when the previous button is clicked + */ +void WpsPageStepFour::previousTriggered() +{ + OstTraceFunctionEntry1(WPSPAGESTEPFOUR_PREVIOUSTRIGGERED_ENTRY, this) + + mWpsActiveRunner->DoCancel(); +OstTraceFunctionExit1(WPSPAGESTEPFOUR_PREVIOUSTRIGGERED_EXIT, this) + +} + +/*! + * CallBack when the cancel button is clicked +*/ +void WpsPageStepFour::cancelTriggered() +{ + OstTraceFunctionEntry1(WPSPAGESTEPFOUR_CANCELTRIGGERED_ENTRY, this) + + mWpsActiveRunner->DoCancel(); +OstTraceFunctionExit1(WPSPAGESTEPFOUR_CANCELTRIGGERED_EXIT, this) + +} + +/*! + * Validates the content of the pages + * + * \return bool Indicating the result of the operation + */ +bool WpsPageStepFour::validate() const +{ + OstTraceFunctionEntry1(WPSPAGESTEPFOUR_VALIDATE_ENTRY, this) + OstTraceFunctionExit1(WPSPAGESTEPFOUR_VALIDATE_EXIT, this) + + return mValid; +} + + +/*! + * CallBack function when the middleware WPS call returns back + * + * \param QList An array of received settngs + * \param int Error indicating the result of the operation + * + */ +void WpsPageStepFour::WpsActiveRunnerStopped( + QList& aCredentials, TInt aError) +{ + OstTraceFunctionEntry1(WPSPAGESTEPFOUR_WPSACTIVERUNNERSTOPPED_ENTRY, this) + + mWpsErrorCode = aError; + if (aError == KErrNone) { + countCredentials = aCredentials.count(); + mWizard->storeSettingsArray(aCredentials); + mWizard->nextPage(); + } + else if (aError == KErrCancel) { + // operation was cancelled + + } + else { + QString str; + str = QString("Error: %1").arg(aError); + mProgressBar->setVisible(false); + //mHeading->setPlainText("General Error"); + mHeading->setPlainText(str); + mWizard->enableNextButton(false); + + } +OstTraceFunctionExit1(WPSPAGESTEPFOUR_WPSACTIVERUNNERSTOPPED_EXIT, this) +} + + +/*! + * Provides the functionality to initiate the WPS functionality + */ +void WpsPageStepFour::StartWpsRunner() +{ + + OstTraceFunctionEntry1(WPSPAGESTEPFOUR_STARTWPSRUNNER_ENTRY, this) + + // convert QString to symbian RBuf8 + + QString ssid = mWizard->getSsid(); + + TPtrC ptrName(reinterpret_cast (ssid.constData())); + + RBuf8 ssidName; + ssidName.Create(ptrName.Length()); + ssidName.Copy(ptrName); + + mWpsActiveRunner->StartSetup(ssidName, mWizard->getPin()); + ssidName.Close(); +OstTraceFunctionExit1(WPSPAGESTEPFOUR_STARTWPSRUNNER_EXIT, this) +} diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/src/wpswizardstepthreebutton.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/src/wpswizardstepthreebutton.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the License "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WPS Wizard Page: Step 3 Push button number + * + */ + +// System includes +#include +#include +#include +#include +#include + +// User includes +#include "wpswizardstepthreebutton.h" +#include "wpswizard_p.h" + +// Trace includes +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wpspagestepthreebuttonTraces.h" +#endif + + +/*! + * Constructor for WPS page three button + * + * \param WpsWizardPrivate* Pointer to the WPS wizard private implementation + */ +WpsPageStepThreeButton::WpsPageStepThreeButton(WpsWizardPrivate* parent) : + WpsWizardPage(parent), mWidget(NULL), mRadio(NULL), mValid(true) +{ +OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_WPSPAGESTEPTHREEBUTTON_ENTRY, this) +OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_WPSPAGESTEPTHREEBUTTON_EXIT, this) + +} + +/*! + * Destructor + */ +WpsPageStepThreeButton::~WpsPageStepThreeButton() +{ + OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_WPSPAGESTEPTHREEBUTTON_ENTRY, this) + + delete mWidget; + +OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_WPSPAGESTEPTHREEBUTTON_EXIT, this) +} + +/*! + * Loads the page with all the widgets + * + * \return HbWidget* Returns the view widget + */ +HbWidget* WpsPageStepThreeButton::initializePage() +{ + OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_INITIALIZEPAGE_ENTRY, this) + + if (!mWidget) { + bool ok; + HbDocumentLoader loader; + loader.load(":/docml/occ_wps_P2.docml", &ok); + Q_ASSERT_X(ok, "WPS Wizard", "Invalid docml file"); + + mWidget = qobject_cast (loader.findWidget("occ_wps_P2")); + Q_ASSERT_X(mWidget != 0, "WPS Wizard", "View not found"); + + //mTitle = qobject_cast (loader.findWidget("label_title")); + //Q_ASSERT_X(mTitle != 0, "WPS wizard", "title not found"); + + mHeading = qobject_cast (loader.findWidget("label_heading")); + Q_ASSERT_X(mHeading != 0, "WPS wizard", "Header not found"); + + mWizard->enableNextButton(true); + } + OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_INITIALIZEPAGE_EXIT, this) + + return mWidget; +} + +/*! + * Funtion to determine the next page to be displayed in the wizard process + * + * \param bool& RemoveFromStack indicating whether the current page should be + * removed from the stack + * + * \return int Page Id of the next page to be displayed. + */ +int WpsPageStepThreeButton::nextId(bool &removeFromStack) const +{ + OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_NEXTID_ENTRY, this) + int id = WlanWizardPage::PageNone; + removeFromStack = false; + id = WpsWizardPage::PageWpsWizardStep4; + OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_NEXTID_EXIT, this) + + return id; +} + +/*! + * Determines the Number of steps to move backwards when 'Prev' Button + * is clicked + * + * \return int Number of pages to move backwards +*/ +int WpsPageStepThreeButton::stepsBackwards() +{ + OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_STEPSBACKWARDS_ENTRY, this) + OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_STEPBACKWARDS_EXIT, this) + + return (PageWpsWizardStep3_Button - PageWpsWizardStep2); +} + +/*! + * Callback when the previous button is clicked + */ +void WpsPageStepThreeButton::previousTriggered() +{ +OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_PREVIOUSTRIGGERED_ENTRY, this) +OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_PREVIOUSTRIGGERED_EXIT, this) + +} + +/*! + * CallBack when the cancel button is clicked + */ +void WpsPageStepThreeButton::cancelTriggered() +{ +OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_CANCELTRIGGERED_ENTRY, this) +OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_CANCELTRIGGERED_EXIT, this) + +} + +/*! + * Validates the content of the pages + * + * \return bool Indicating the result of the operation +*/ +bool WpsPageStepThreeButton::validate() const +{ + OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_VALIDATE_ENTRY, this) + OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_VALIDATE_EXIT, this) + + return mValid; +} + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/src/wpswizardstepthreenumber.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/src/wpswizardstepthreenumber.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,225 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the License "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WPS Wizard Page: Step 3 Number enter mode. + * + */ + +// System includes +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "wpswizardstepthreenumber.h" +#include "wpswizard_p.h" + +// Trace includes +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wpspagestepthreenumberTraces.h" +#endif + +// Local constants +#define KMaxPINLength 8 + + +/*! + * Constructor for WPS page three number entry mode + * + * \param WpsWizardPrivate* Pointer to the WPS wizard private implementation + */ +WpsPageStepThreeNumber::WpsPageStepThreeNumber(WpsWizardPrivate* parent) : + WpsWizardPage(parent), mWidget(NULL), mRadio(NULL), mValid(true) +{ +OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_WPSPAGESTEPTHREENUMBER_ENTRY, this) +OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_WPSPAGESTEPTHREENUMBER_EXIT, this) + +} + + +/*! + * Destructor + */ +WpsPageStepThreeNumber::~WpsPageStepThreeNumber() +{ + OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_WPSPAGESTEPTHREENUMBER_ENTRY, this) + + delete mWidget; + +OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_WPSPAGESTEPTHREENUMBER_EXIT, this) + +} + + +/*! + * Loads the page with all the widgets + * + * \return HbWidget* Returns the view widget + */ +HbWidget* WpsPageStepThreeNumber::initializePage() +{ + OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_INITIALIZEPAGE_ENTRY, this) + + if (!mWidget) { + bool ok; + HbDocumentLoader loader; + loader.load(":/docml/occ_wps_P3.docml", &ok); + Q_ASSERT_X(ok, "WPS Wizard", "Invalid docml file"); + + mWidget = qobject_cast (loader.findWidget("occ_wps_P3")); + Q_ASSERT_X(mWidget != 0, "WPS Wizard", "View not found"); + + mHeading = qobject_cast (loader.findWidget("label_heading")); + Q_ASSERT_X(mHeading != 0, "WPS wizard", "Header not found"); + + int randomNumber = computeRandNumber(); + mHeading->setPlainText(hbTrId("txt_occ_dialog_enter_1_on_the_wireless_station_t").arg( + randomNumber)); + mWizard->setPin(randomNumber); + mWizard->enableNextButton(true); + } + OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_INITIALIZEPAGE_EXIT, this) + + return mWidget; +} + + +/*! + * Funtion to determine the next page to be displayed in the wizard process + * + * \param bool& RemoveFromStack indicating whether the current page should be + * removed from the stack + * + * \return int Page Id of the next page to be displayed. + */ +int WpsPageStepThreeNumber::nextId(bool &removeFromStack) const +{ + OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_NEXTID_ENTRY, this) + + int id = WlanWizardPage::PageNone; + removeFromStack = false; + id = WpsWizardPage::PageWpsWizardStep4; + OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_NEXTID_EXIT, this) + + return id; +} + +/*! + * Determines the Number of steps to move backwards when 'Prev' Button + * is clicked + * + * \return int Number of pages to move backwards +*/ +int WpsPageStepThreeNumber::stepsBackwards() +{ + OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_STEPSBACKWARDS_ENTRY, this) + OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_STEPBACKWARDS_EXIT, this) + + return (PageWpsWizardStep3_Number - PageWpsWizardStep2) - 1; +} + +/*! + * Callback when the previous button is clicked + */ +void WpsPageStepThreeNumber::previousTriggered() +{ + OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_PREVIOUSTRIGGERED_ENTRY, this) + + mWizard->setPin(0); +OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_PREVIOUSTRIGGERED_EXIT, this) + +} + +/*! + * CallBack when the cancel button is clicked +*/ +void WpsPageStepThreeNumber::cancelTriggered() +{ + OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_CANCELTRIGGERED_ENTRY, this) + + mWizard->setPin(0); +OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_CANCELTRIGGERED_EXIT, this) + +} + +/*! + * Validates the content of the pages + * + * \return bool Indicating the result of the operation +*/ +bool WpsPageStepThreeNumber::validate() const +{ + + OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_VALIDATE_ENTRY, this) + OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_VALIDATE_EXIT, this) + + return mValid; +} + +/*! + * Computes the Random number based on current system time + * + * \return int Returns the generated random number + */ +int WpsPageStepThreeNumber::computeRandNumber() +{ + + OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_COMPUTERANDNUMBER_ENTRY, this) + + int pin = 0; + QTime time(0, 0); + int seed = time.secsTo(QTime::currentTime()); + do { + qsrand(seed); + pin = qrand(); + } while (pin < (10 ^ (KMaxPINLength - 2)) || (((pin / 1000000) % 10)) == 0); + //last digit is checksum, so we need 7 digits + //and the first shouldn't be 0 + pin = pin % 10000000; + TInt checkSum = computeCheckSum(pin); + pin *= 10; + pin += checkSum; + OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_COMPUTERANDNUMBER_EXIT, this) + return pin; +} + +/*! + * Computes the checksum for a given pin + * + * \return Returns the generated checksum + */ +int WpsPageStepThreeNumber::computeCheckSum(int aPin) +{ + + OstTraceFunctionEntry1(WPSPAGESTEPTHREENUMBER_COMPUTECHECKSUM_ENTRY, this) + + int accum = 0; + aPin *= 10; + accum += 3 * ((aPin / 10000000) % 10); + accum += 1 * ((aPin / 1000000) % 10); + accum += 3 * ((aPin / 100000) % 10); + accum += 1 * ((aPin / 10000) % 10); + accum += 3 * ((aPin / 1000) % 10); + accum += 1 * ((aPin / 100) % 10); + accum += 3 * ((aPin / 10) % 10); + int digit = (accum % 10); + OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_COMPUTECHECKSUM_EXIT, this) + return (10 - digit) % 10; +} + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/src/wpswizardsteptwo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/src/wpswizardsteptwo.cpp Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the License "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * WPS Wizard Page: Step 2 + * + */ + +// System includes +#include +#include +#include +#include +#include + +// User includes +#include "wpswizardsteptwo.h" +#include "wpswizard_p.h" + +// Trace includes +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wpspagesteptwoTraces.h" +#endif + + +/*! + * Constructor for WPS page two + * + * \param WpsWizardPrivate* Pointer to the WPS wizard private implementation + */ +WpsPageStepTwo::WpsPageStepTwo(WpsWizardPrivate* parent) : + WpsWizardPage(parent), mWidget(NULL), mRadio(NULL), mValid(false) + { + OstTraceFunctionEntry1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_ENTRY, this) + OstTraceFunctionExit1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_EXIT, this) + + } + +/*! + * Destructor + */ +WpsPageStepTwo::~WpsPageStepTwo() + { + OstTraceFunctionEntry1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_ENTRY, this) + + delete mWidget; + OstTraceFunctionExit1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_EXIT, this) + + } + +/*! + * Loads the page with all the widgets + * + * \return HbWidget* Returns the view widget + */ +HbWidget* WpsPageStepTwo::initializePage() + { + OstTraceFunctionEntry1(WPSPAGESTEPTWO_INITIALIZEPAGE_ENTRY, this) + + if (!mWidget) + { + bool ok; + HbDocumentLoader loader; + loader.load(":/docml/occ_wps_P1.docml", &ok); + Q_ASSERT_X(ok, "WPS Wizard", "Invalid docml file"); + + mWidget = qobject_cast (loader.findWidget("occ_wps_P1")); + Q_ASSERT_X(mWidget != 0, "WPS Wizard", "View not found"); + + mHeading + = qobject_cast (loader.findWidget("label_heading")); + Q_ASSERT_X(mTitle != 0, "WPS wizard", "Header not found"); + + mRadio = qobject_cast (loader.findWidget( + "radioButtonList")); + Q_ASSERT_X(mRadio != 0, "WPS Wizard", "List not found"); + + connect(mRadio, SIGNAL(itemSelected(int)), this, + SLOT(itemSelected(int))); + + } + OstTraceFunctionExit1(WPSPAGESTEPTWO_INITIALIZEPAGE_EXIT, this) + + return mWidget; + } + + +/*! + * Funtion to determine the next page to be displayed in the wizard process + * + * \param bool& RemoveFromStack indicating whether the current page should be + * removed from the stack + * + * \return int Page Id of the next page to be displayed. + */ +int WpsPageStepTwo::nextId(bool &removeFromStack) const + { + OstTraceFunctionEntry1(WPSPAGESTEPTWO_NEXTID_ENTRY, this) + int id = WpsWizardPage::PageWpsWizardStep3_Button; + removeFromStack = false; + if (mItemSelected == 0) + id = WpsWizardPage::PageWpsWizardStep3_Button; + else + id = WpsWizardPage::PageWpsWizardStep3_Number; + OstTraceFunctionExit1(WPSPAGESTEPTWO_NEXTID_EXIT, this) + + + return id; + } + +/*! + * Determines the Number of steps to move backwards when 'Prev' Button + * is clicked + * + * \return int Number of pages to move backwards + */ +int WpsPageStepTwo::stepsBackwards() + { + OstTraceFunctionEntry1(WPSPAGESTEPTWO_STEPSBACKWARDS_ENTRY, this) + OstTraceFunctionExit1(WPSPAGESTEPTWO_STEPBACKWARDS_EXIT, this) + + return 1; + } + +/*! + * Callback when the previous button is clicked +*/ +void WpsPageStepTwo::previousTriggered() + { + OstTraceFunctionEntry1(WPSPAGESTEPTWO_PREVIOUSTRIGGERED_ENTRY, this) + OstTraceFunctionExit1(WPSPAGESTEPTWO_PREVIOUSTRIGGERED_EXIT, this) + + } + +/*! + * CallBack when the cancel button is clicked + */ +void WpsPageStepTwo::cancelTriggered() + { + OstTraceFunctionEntry1(WPSPAGESTEPTWO_CANCELTRIGGERED_ENTRY, this) + OstTraceFunctionExit1(WPSPAGESTEPTWO_CANCELTRIGGERED_EXIT, this) + + } + +/*! + * Validates the content of the pages + * + * \return bool Indicating the result of the operation + */ +bool WpsPageStepTwo::validate() const + { + OstTraceFunctionEntry1(WPSPAGESTEPTWO_VALIDATE_ENTRY, this) + OstTraceFunctionExit1(WPSPAGESTEPTWO_VALIDATE_EXIT, this) + + return mValid; + } + +/*! + * Call back when an item is selected from the list on the UI + * + * \param int index Indcating the relative position in the list + */ +void WpsPageStepTwo::itemSelected(int index) + { + OstTraceFunctionEntry1(WPSPAGESTEPTWO_ITEMSELECTED_ENTRY, this) + + mValid = true; + mWizard->enableNextButton(mValid); + mItemSelected = index; + OstTraceFunctionExit1(WPSPAGESTEPTWO_ITEMSELECTED_EXIT, this) + + } + diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/traces/OstTraceDefinitions.h Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +#include +#endif diff -r ff3b37722600 -r 10810c91db26 wlanutilities/wpswizard/wpswizard.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wpswizard/wpswizard.pro Fri Apr 16 16:07:56 2010 +0300 @@ -0,0 +1,59 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# Description: +# + +TEMPLATE = lib +TARGET = wpswizard +DEFINES += BUILD_WPS_WIZARD_DLL +VERSION = 0.0.1 +CONFIG += hb +MOC_DIR = _moc +RCC_DIR = _resources +RESOURCES += resources/resource.qrc +TRANSLATIONS += resources/wpswizardplugin.ts +HEADERS += ../inc/wpswizard.h \ + inc/wpswizard_p.h \ + inc/wpswizardpage.h \ + inc/wpswizardsteptwo.h \ + inc/wpswizardstepthreebutton.h \ + inc/wpswizardstepthreenumber.h \ + inc/wpswizardstepfour.h \ + inc/wpswizardstepfive.h \ + inc/cwpsactiverunner.h \ + inc/mwpsactiverunnercallback.h \ + traces/OstTraceDefinitions.h +SOURCES += src/wpswizardprivate.cpp \ + src/wpswizard.cpp \ + src/wpswizardpage.cpp \ + src/wpswizardsteptwo.cpp \ + src/wpswizardstepthreebutton.cpp \ + src/wpswizardstepthreenumber.cpp \ + src/wpswizardstepfour.cpp \ + src/wpswizardstepfive.cpp \ + src/cwpsactiverunner.cpp +LIBS += -lecom +symbian { + HEADERS += + SOURCES += + INCLUDEPATH += inc \ + ../../inc \ + ../wlanwizard/inc \ + $$MW_LAYER_SYSTEMINCLUDE \ + $$OS_LAYER_SYSTEMINCLUDE + TARGET.UID3 = 0x2003D2FE + TARGET.CAPABILITY = CAP_GENERAL_DLL + BLD_INF_RULES.prj_exports += "rom/wpswizard.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wpswizard.iby)" + TARGET.EPOCALLOWDLLDATA = 1 + MMP_RULES += EXPORTUNFROZEN +}