Revision: 201019
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 14 May 2010 17:41:09 +0300
changeset 19 629e60dfa279
parent 17 41a8eba36f74
child 22 c6a1762761b8
child 23 2e79b4af3f09
child 26 978808ad7180
Revision: 201019 Kit: 201019
wlan_bearer/wlandbif_cd/src/wdbifwlansettings.cpp
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/bwinscw/wlmplatformu.def
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/eabi/wlmplatformu.def
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanbgscan.h
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanbgscanstates.h
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanscanproviderinterface.h
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmplatform.h
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmplatformdata.h
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmserver.h
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmsystemnotify.h
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanbgscan.cpp
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanbgscanstates.cpp
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmplatform.cpp
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmplatformdata.cpp
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmserver.cpp
wlan_bearer/wlanldd/wlan_common/osa_common/inc/osaheap.h
wlan_bearer/wlanldd/wlan_common/osa_common/inc/osalist.inl
wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacContextImpl.h
wlan_bearer/wlanldd/wlan_common/umac_common/src/Umac.cpp
wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacContextImpl.cpp
wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Idle.cpp
wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11InitPhase1.cpp
wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11MacError.cpp
wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/WlanLogicalChannel.h
wlan_plat/wlan_info_api/inc/wlaninternalpskeys.h
wlan_plat/wlan_management_api/inc/wlanerrorcodes.h
--- a/wlan_bearer/wlandbif_cd/src/wdbifwlansettings.cpp	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlandbif_cd/src/wdbifwlansettings.cpp	Fri May 14 17:41:09 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 12 %
+* %version: 12.1.1 %
 */
 
 //  INCLUDE FILES
@@ -110,49 +110,72 @@
     ClearWepKeys( aSettings);
     
     aSettings.Id = iWLANRecord->RecordId();
+    TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL() - aSettings.Id: %d"),
+        aSettings.Id));
 
     aSettings.Name = *((CMDBField<TDesC>*)iWLANRecord->GetFieldByIdL(KCDTIdRecordName));
+    TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL() - aSettings.Name: %S [%d]"),
+        &aSettings.Name, aSettings.Name.Length()));
 
     aSettings.ServiceID = *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanServiceId));
+    TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL() - aSettings.ServiceID: %d"),
+        aSettings.ServiceID));
     
     aSettings.ConnectionMode = *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanConnMode));
+    TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL() - aSettings.ConnectionMode: %d"),
+        aSettings.ConnectionMode));
     
     aSettings.SSID = *((CMDBField<TDesC>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanSSID));
+    TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL() - aSettings.SSID: %S [%d]"),
+        &aSettings.SSID, aSettings.SSID.Length()));
     
     // new
     aSettings.UsedSSID = *((CMDBField<TDesC>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanUsedSSID));
+    TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL() - aSettings.UsedSSID: %S [%d]"),
+        &aSettings.UsedSSID, aSettings.UsedSSID.Length()));
     
     aSettings.ScanSSID = *((CMDBField<TBool>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanScanSSID));
-    TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL ScanSSID = %d"),aSettings.ScanSSID));
+    TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL() - aSettings.ScanSSID: %d"),
+        aSettings.ScanSSID));
     
     aSettings.ChannelID = *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanChannelID));
+    TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL() - aSettings.ChannelID: %d"),
+        aSettings.ChannelID));
+
     // end new
 
     aSettings.AuthenticationMode = EWepAuthModeOpen; // defaults to open (in case of wep, the value will be read from db later)
     aSettings.EnableWpaPsk = EFalse;
     aSettings.WPAKeyLength = 0;
+    aSettings.WPAPreSharedKey.Zero();
+    aSettings.PresharedKeyFormat = EWlanPresharedKeyFormatAscii;
 
     aSettings.SecurityMode = *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanSecMode));
+    TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL() - aSettings.SecurityMode: %d"),
+        aSettings.SecurityMode));
     
-    TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL, SecurityMode = %d"),aSettings.SecurityMode));
-
     if( aSettings.SecurityMode == Wep)
         {    
         // authentication mode can be != open only when WEP in use
         aSettings.AuthenticationMode = *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanAuthMode));
+        TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL() - aSettings.AuthenticationMode: %d"),
+            aSettings.AuthenticationMode));
 
         aSettings.WepIndex = *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanWepIndex));
-        ReadWepKeysL(aSettings);
+        TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL() - aSettings.WepIndex: %d"),
+            aSettings.WepIndex));
+        ReadWepKeysL(aSettings);           
         TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL, Wep keys succesfully read")));
         }
     else if( aSettings.SecurityMode > Wep)
         {
         aSettings.WPAKeyLength = *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanWpaKeyLength));
+        TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL() - aSettings.WPAKeyLength: %d"),
+            aSettings.WPAKeyLength));       
         aSettings.EnableWpaPsk = *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanEnableWpaPsk));
-        aSettings.PresharedKeyFormat = EWlanPresharedKeyFormatAscii;
-        aSettings.WPAPreSharedKey.Zero();
-        CMDBField<TDesC8>* wpaKey = static_cast<CMDBField<TDesC8>*>(iWLANRecord->GetFieldByIdL(KCDTIdWlanWpaPreSharedKey));
-         
+        TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL() - aSettings.EnableWpaPsk: %d"),
+            aSettings.EnableWpaPsk));       
+        CMDBField<TDesC8>* wpaKey = static_cast<CMDBField<TDesC8>*>(iWLANRecord->GetFieldByIdL(KCDTIdWlanWpaPreSharedKey));        
         aSettings.WPAPreSharedKey.Append( *wpaKey);
         
         // In WPA-PSK case the preshared key can be either 8 - 63 characters in ASCII
@@ -171,6 +194,9 @@
                 aSettings.PresharedKeyFormat = EWlanPresharedKeyFormatHex;
                 }
             }            
+        
+        TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL() - aSettings.PresharedKeyFormat: %d"),
+            aSettings.PresharedKeyFormat));       
         }
     
     TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL end")));
@@ -1085,6 +1111,7 @@
 EXPORT_C void CWLanSettings::GetIAPWlanServicesL( RArray<SWlanIAPId>& aServices)
     {
     TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetIAPWlanServicesL start")));
+    CleanupClosePushL( aServices );
     
     CMDBRecordSet<CCDIAPRecord>* iapRecSet = new (ELeave) CMDBRecordSet<CCDIAPRecord>(KCDTIdIAPRecord);
     CleanupStack::PushL( iapRecSet);
@@ -1098,7 +1125,7 @@
     iapPrimer->iServiceType.SetL( servType);
     iapRecSet->iRecords.AppendL( iapPrimer);
     
-    CleanupStack::Pop( ); // iapPrimer
+    CleanupStack::Pop( iapPrimer );
     iapPrimer = 0;
     
     TBool found( EFalse);
@@ -1123,7 +1150,8 @@
                 }
             }
         }
-    CleanupStack::PopAndDestroy( ); // iapRecSet
+    CleanupStack::PopAndDestroy( iapRecSet );
+    CleanupStack::Pop( &aServices );
     TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetIAPWlanServicesL end")));
     }
 
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/bwinscw/wlmplatformu.def	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/bwinscw/wlmplatformu.def	Fri May 14 17:41:09 2010 +0300
@@ -10,3 +10,5 @@
 	?SetIconState@CWlmPlatform@@QAEHW4TWlmIconStatus@@@Z @ 9 NONAME ; int CWlmPlatform::SetIconState(enum TWlmIconStatus)
 	?InitializeSystemTimeHandler@CWlmPlatform@@QAEXXZ @ 10 NONAME ; void CWlmPlatform::InitializeSystemTimeHandler(void)
 	?PublishBgScanInterval@CWlmPlatform@@QAEXAAK@Z @ 11 NONAME ; void CWlmPlatform::PublishBgScanInterval(unsigned long &)
+	?GetWlanOnOffState@CWlmPlatform@@QAE?AW4TWlanOnOffState@@XZ @ 12 NONAME ; enum TWlanOnOffState CWlmPlatform::GetWlanOnOffState(void)
+
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/eabi/wlmplatformu.def	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/eabi/wlmplatformu.def	Fri May 14 17:41:09 2010 +0300
@@ -11,4 +11,6 @@
 	_ZN12CWlmPlatformD1Ev @ 10 NONAME
 	_ZN12CWlmPlatformD2Ev @ 11 NONAME
 	_ZN12CWlmPlatform27InitializeSystemTimeHandlerEv @ 12 NONAME
-	_ZN12CWlmPlatform21PublishBgScanIntervalERm @ 13 NONAME
\ No newline at end of file
+	_ZN12CWlmPlatform21PublishBgScanIntervalERm @ 13 NONAME
+	_ZN12CWlmPlatform17GetWlanOnOffStateEv @ 14 NONAME
+
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanbgscan.h	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanbgscan.h	Fri May 14 17:41:09 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 10 %
+* %version: 11 %
 */
 
 #ifndef WLANBGSCAN_H
@@ -93,7 +93,7 @@
      * 
      * @param aState New WLAN state
      */
-    void WlanStateChanged( const MWlanBgScanProvider::TWlanBgScanWlanState &aState );
+    void WlanSetBgScanState( const MWlanBgScanProvider::TWlanBgScanState &aState );
     
     /**
      * From MWlanBgScanProvider.
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanbgscanstates.h	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanbgscanstates.h	Fri May 14 17:41:09 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 3 %
+* %version: 4 %
 */
 
 #ifndef WLANBGSCANSTATES_H
@@ -533,7 +533,7 @@
     /**
      * Current WLAN state. 
      */
-    MWlanBgScanProvider::TWlanBgScanWlanState iWlanState;
+    MWlanBgScanProvider::TWlanBgScanState iWlanBgScanState;
     
     };
 
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanscanproviderinterface.h	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanscanproviderinterface.h	Fri May 14 17:41:09 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 8 %
+* %version: 9 %
 */
 
 
@@ -78,11 +78,10 @@
 
 public:
     
-    enum TWlanBgScanWlanState
+    enum TWlanBgScanState
         {
-        EWlanStateConnected = 1,
-        EWlanStateDisconnected,
-        EWlanStateMax // not used
+        EWlanBgScanOff,
+        EWlanBgScanOn
         };
     
     struct TWlanBgScanSettings
@@ -132,13 +131,13 @@
     virtual void ScanComplete() = 0;
         
     /**
-     * Called to indicate that WLAN state has changed.
+     * Called to set BG scan state (on/off).
      *
      * @since S60 v5.2
      * 
      * @param aState New WLAN state
      */
-    virtual void WlanStateChanged( const TWlanBgScanWlanState &aState ) = 0;
+    virtual void WlanSetBgScanState( const TWlanBgScanState &aState ) = 0;
     
     /**
      * Whether background scan is enabled.
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmplatform.h	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmplatform.h	Fri May 14 17:41:09 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 12 %
+* %version: 13 %
 */
 
 #ifndef WLMPLATFORM_H
@@ -103,6 +103,16 @@
          */
         virtual void ClearRegionCache() = 0;
         
+        /**
+         * WLAN has been set ON.
+         */
+        virtual void WlanOn() = 0;
+        
+        /**
+         * WLAN has been set OFF.
+         */
+        virtual void WlanOff() = 0;
+        
     };
 
 /**
@@ -185,6 +195,12 @@
          * @param aInterval WLAN BG scan interval in seconds.
          */
         IMPORT_C void PublishBgScanInterval( TUint32& aInterval );
+        
+        /**
+         * Get current WLAN on/off state.
+         * @return WLAN on/off state.
+         */
+        IMPORT_C TWlanOnOffState GetWlanOnOffState();
 
     protected:  // Methods
 
@@ -221,6 +237,16 @@
         void BtConnectionDisabled();
         
         /**
+         * (From MWlmSystemNotify) WLAN has been set ON.
+         */
+        void WlanOn();
+        
+        /**
+         * (From MWlmSystemNotify) WLAN has been set OFF.
+         */
+        void WlanOff();
+        
+        /**
          * (From MWlanSystemTimeCallback) 
          * User has changed the time and therefore cached WLAN region is not valid anymore.
          */
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmplatformdata.h	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmplatformdata.h	Fri May 14 17:41:09 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 12 %
+* %version: 13 %
 */
 
 #ifndef WLMPLATFORMDATA_H
@@ -26,6 +26,7 @@
 #include "802dot11.h"
 #include "wlmsystemnotify.h"
 #include "wlmplatformsubscriber.h"
+#include "wlaninternalpskeys.h"
 
 /**
 * Interface class to PubSub and CenRep.
@@ -99,6 +100,12 @@
          */
         TInt PublishBgScanInterval(
             TUint32& aInterval );
+            
+        /**
+         * Method for reading WLAN on/off state.
+         * @return WLAN on/off state
+         */
+        TWlanOnOffState GetWlanOnOffState();
 
     private:   // Methods
 
@@ -112,6 +119,31 @@
         * Symbian 2nd phase constructor.
         */
         void ConstructL();
+        
+        /**
+         * Notifies WLAN on/off observer of the changes
+         */
+        void NotifyWlanOnOffObserver();
+        
+        /**
+         * Method for publishing WLAN on/off state.
+         * @since S60^4
+         * @param aWlanState WLAN state to be published.
+         * @return Symbian error code.
+         */
+        TInt PublishWlanOnOff( TPSWlanOnOff aWlanState );
+
+    private:  // Definitions
+        
+        /**
+         * Last WLAN on/off state notified to the observer.
+         */
+        enum TWlanNotifiedState
+            {
+            EWlanNotifiedNone,  // Initial value, Observer not yet notified anything
+            EWlanNotifiedOff,   // Observer notified that WLAN is set OFF
+            EWlanNotifiedOn     // Observer notified that WLAN is set ON
+            };
 
     private:  // Data
         
@@ -124,6 +156,12 @@
         /** Subscriber for watching KCTSYEmergencyCallInfo via P&S. */
         CWlmPlatformSubscriber* iEmergencyCall;
 
+        /** Subscriber for watching WLAN master switch via CenRep. */
+        CWlmPlatformSubscriber* iWlanOnOff;
+        
+        /** Subscriber for watching WLAN force disable switch via CenRep. */
+        CWlmPlatformSubscriber* iWlanForceDisable;
+
         /** Handle to KPropertyWlanMacAddress property via P&S. */
         RProperty iPsMacAddress;
         
@@ -133,6 +171,9 @@
         /** Handle to KPropertyWlanBgScanInterval property via P&S. */
         RProperty iPsBgScanInterval;
 
+        /** Handle to KPropertyWlanOnOffState property via P&S. */
+        RProperty iPsOnOffState;
+
         /** Callback for notifications. */
         MWlmSystemNotify& iCallback;
 
@@ -153,6 +194,9 @@
 
         /** Whether Emergency Call is active. */
         TBool iIsEmergencyCall;
+        
+        /** Last WLAN on/off state notified to the observer. */
+        TWlanNotifiedState iNotifiedWlanState;
                 
     };
 
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmserver.h	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmserver.h	Fri May 14 17:41:09 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 55 %
+* %version: 56 %
 */
 
 #ifndef WLMSERVER_H
@@ -1171,6 +1171,40 @@
          */
         void PublishBgScanInterval( TUint32& aInterval );
 
+        /**
+         * Callback method for indicating WLAN Server that WLAN has been
+         * set ON.
+         *
+         * @see MWlmPlatformCallback
+         */
+         void WlanOn();
+         
+         /**
+          * Callback method for indicating WLAN Server that WLAN has been
+          * set OFF.
+          *
+          * @see MWlmPlatformCallback
+          */
+         void WlanOff();
+         
+         /**
+          * Method for cancelling external requests by type.
+          * 
+          * @param aCommand Commands that need to be cancelled
+          */
+         void CancelExternalRequestsByType(
+             const TWLMCommands aCommand );
+         
+         /**
+          * Method for sending notifications to the subscribers
+          * 
+          * @param amNotification Notification to be sent.
+          * @param aParams Notification parameters.
+          */
+         void SendNotification(
+             TWlmNotify amNotification,
+             TBuf8<KMaxNotificationLength>& aParams );
+
     private:    // Data
     
         /**
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmsystemnotify.h	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmsystemnotify.h	Fri May 14 17:41:09 2010 +0300
@@ -20,6 +20,7 @@
 #define WLMSYSTEMNOTIFY_H
 
 #include "wlmclientserver.h"
+#include "wlanerrorcodes.h"
 
 enum TWlmIconStatus
     {
@@ -29,6 +30,18 @@
     EWlmIconStatusConnectedSecure
     };
 
+/**
+ * WLAN on/off states are used as status codes for status
+ * requests and therefore they are mapped directly to
+ * corresponding error codes.
+ */
+enum TWlanOnOffState
+    {
+    EWlanOff = KErrWlanOff,
+    EWlanForceOff = KErrWlanForceOff,
+    EWlanOn = 0
+    };
+
 /** 
 * Callback interface for system data notification services.
 *
@@ -67,6 +80,16 @@
         * BT connection has been disconnected.        
         */
         virtual void BtConnectionDisabled() = 0;
+        
+        /**
+         * WLAN has been set ON.
+         */
+        virtual void WlanOn() = 0;
+        
+        /**
+         * WLAN has been set OFF.
+         */
+        virtual void WlanOff() = 0;
     };
 
 #endif // WLMSYSTEMNOTIFY_H
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanbgscan.cpp	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanbgscan.cpp	Fri May 14 17:41:09 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 16 %
+* %version: 17 %
 */
 
 #include <e32base.h>
@@ -156,15 +156,15 @@
 
 // ---------------------------------------------------------------------------
 // From class MWlanBgScanProvider.
-// CWlanBgScan::WlanStateChanged
+// CWlanBgScan::WlanSetBgScanState
 // ---------------------------------------------------------------------------
 //
-void CWlanBgScan::WlanStateChanged( const MWlanBgScanProvider::TWlanBgScanWlanState &aState )
+void CWlanBgScan::WlanSetBgScanState( const MWlanBgScanProvider::TWlanBgScanState &aState )
     {
-    DEBUG2( "CWlanBgScan::WlanStateChanged() - old state: %u, new state: %u", iWlanState, aState );
+    DEBUG2( "CWlanBgScan::WlanSetBgScanState() - old state: %u, new state: %u", iWlanBgScanState, aState );
     
     // store state
-    iWlanState = aState;
+    iWlanBgScanState = aState;
 
     RefreshUsedInterval();
 
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanbgscanstates.cpp	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanbgscanstates.cpp	Fri May 14 17:41:09 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 4 %
+* %version: 5 %
 */
 
 #include <e32base.h>
@@ -58,7 +58,7 @@
     iIntervalChangeRequestId( 0 ),
     iCompletedAwsCommand( MWlanBgScanAwsComms::EAwsCommandMax ),
     iAwsCommandCompletionCode( KErrNone ),
-    iWlanState( MWlanBgScanProvider::EWlanStateMax )
+    iWlanBgScanState( MWlanBgScanProvider::EWlanBgScanOff )
     {
     DEBUG( "CWlanBgScanStates::CWlanBgScanStates()" );
     }
@@ -837,13 +837,13 @@
     {
     TUint oldInterval = iUsedBgScanInterval;
     
-    DEBUG4( "CWlanBgScanStates::RefreshUsedInterval() - agg: %u, normal: %u, used: %u, wlan state: %u",
-        iAggressiveBgScanInterval, iBgScanInterval, iUsedBgScanInterval, iWlanState );
+    DEBUG4( "CWlanBgScanStates::RefreshUsedInterval() - agg: %u, normal: %u, used: %u, bg scan state: %u",
+        iAggressiveBgScanInterval, iBgScanInterval, iUsedBgScanInterval, iWlanBgScanState );
     
-    // If      ( WLAN state is connected )               -> use interval: KWlanNoScanning 
+    // If      ( WLAN BG scanning is OFF )               -> use interval: KWlanNoScanning 
     // Else If ( aggressive interval < normal interval ) -> use interval: aggressive interval
     // Otherwise                                         -> use interval: background scan interval
-    if( iWlanState == MWlanBgScanProvider::EWlanStateConnected )
+    if( iWlanBgScanState == MWlanBgScanProvider::EWlanBgScanOff )
         {
         iUsedBgScanInterval = KWlanNoScanning;
         }
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmplatform.cpp	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmplatform.cpp	Fri May 14 17:41:09 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 12 %
+* %version: 13 %
 */
 
 
@@ -195,6 +195,15 @@
     {
     iPlatformData->PublishBgScanInterval( aInterval );
     }
+    
+// ---------------------------------------------------------
+// CWlmPlatform::GetWlanOnOffState
+// ---------------------------------------------------------
+//
+EXPORT_C TWlanOnOffState CWlmPlatform::GetWlanOnOffState()
+    {
+	return iPlatformData->GetWlanOnOffState();
+	}
 
 // ---------------------------------------------------------
 // CWlmPlatform::SystemModeChanged
@@ -336,3 +345,26 @@
     
     iCallback.ClearRegionCache();
     }
+    
+// ---------------------------------------------------------
+// CWlmPlatform::WlanOn
+// ---------------------------------------------------------
+//
+void CWlmPlatform::WlanOn()
+    {
+	DEBUG( "CWlmPlatform::WlanOn()" );
+	
+	iCallback.WlanOn();
+	}
+
+// ---------------------------------------------------------
+// CWlmPlatform::WlanOff
+// ---------------------------------------------------------
+//
+void CWlmPlatform::WlanOff()
+    {
+	DEBUG( "CWlmPlatform::WlanOff()" );
+	
+	iCallback.WlanOff();
+	}
+
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmplatformdata.cpp	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmplatformdata.cpp	Fri May 14 17:41:09 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 12 %
+* %version: 13 %
 */
 
 // INCLUDE FILES
@@ -27,6 +27,7 @@
 #include <startupdomainpskeys.h>
 #include <ctsydomainpskeys.h>
 #include "wlaninternalpskeys.h"
+#include "wlandevicesettingsinternalcrkeys.h"
 #include "wlmplatformdata.h"
 #include "am_debug.h"
 
@@ -43,7 +44,8 @@
     iCurrentIcon( EWlmIconStatusNotAvailable ),
     iIsStartupComplete( EFalse ),
     iIsInOffline( EFalse ),
-    iIsEmergencyCall( EFalse )
+    iIsEmergencyCall( EFalse ),
+    iNotifiedWlanState( CWlmPlatformData::EWlanNotifiedNone )
     {
     DEBUG( "CWlmPlatformData::CWlmPlatformData()" );
     }
@@ -76,6 +78,18 @@
         KPSUidCtsyEmergencyCallInfo, KCTSYEmergencyCallInfo );
     iEmergencyCall->IssueRequest();
 
+	// Create subscriber for WLAN master switch
+	iWlanOnOff = CWlmPlatformSubscriber::NewL(
+	    EWlmSubscribeTypeCenRep, *this,
+		KCRUidWlanDeviceSettingsRegistryId, KWlanOnOff );
+	iWlanOnOff->IssueRequest();
+	
+	// Create subscriber for WLAN force disable
+	iWlanForceDisable = CWlmPlatformSubscriber::NewL(
+	    EWlmSubscribeTypeCenRep, *this,
+		KCRUidWlanDeviceSettingsRegistryId, KWlanForceDisable );
+	iWlanForceDisable->IssueRequest();
+
     // Create PubSub property for publishing MAC address
     TInt ret( KErrNone );
     ret = RProperty::Define( KPSWlanMacAddress, KPSWlanMacAddressType,
@@ -106,6 +120,17 @@
         }
     User::LeaveIfError( iPsBgScanInterval.Attach( KPSUidWlan,
         KPSWlanBgScanInterval, EOwnerThread ) );
+    
+    // Create PubSub property for publishing WLAN on/off state
+    ret = RProperty::Define( KPSWlanOnOffState, KPSWlanOnOffStateType,
+        KWlmPSReadPolicy, KWlmPSWritePolicy );
+    if( ret != KErrAlreadyExists )
+        {
+        User::LeaveIfError( ret );
+        }
+    User::LeaveIfError( iPsOnOffState.Attach( KPSUidWlan,
+        KPSWlanOnOffState, EOwnerThread ) );
+    
     }
 
 // ---------------------------------------------------------
@@ -137,7 +162,9 @@
     RProperty::Delete( KPSUidWlan, KPSWlanBgScanInterval );
     delete iPropertySystemState;
     delete iBtConnections;
-    delete iEmergencyCall;    
+    delete iEmergencyCall;
+    delete iWlanOnOff;
+    delete iWlanForceDisable;    
     }
 
 // ---------------------------------------------------------
@@ -305,6 +332,11 @@
                 }
             }
         }
+    else if( aCategory == KCRUidWlanDeviceSettingsRegistryId ) // WLAN on/off
+        {
+        // Notify WLAN on/off observer
+        NotifyWlanOnOffObserver();
+        }
     }
 
 // ---------------------------------------------------------
@@ -378,6 +410,9 @@
         KPropertyKeyBluetoothGetPHYCount ) );
     TRAP_IGNORE( HandlePropertyChangedL( KPSUidStartup,
         KPSGlobalSystemState ) );
+    // Call NotifyWlanOnOffObserver to inform observer WLAN on/off
+    // state and to get it also published via P&S
+    NotifyWlanOnOffObserver();
     }
 
 // ---------------------------------------------------------
@@ -408,3 +443,103 @@
     
     return iPsBgScanInterval.Set( aInterval );
     }
+
+
+// ---------------------------------------------------------
+// CWlmPlatformData::GetWlanOnOffState
+// Status : Draft
+// ---------------------------------------------------------
+//	
+TWlanOnOffState CWlmPlatformData::GetWlanOnOffState()
+    {
+	DEBUG( "CWlmPlatformData::GetWlanOnOffState()" );
+	
+	TWlanOnOffState wlanState( EWlanOff );
+	
+	// Read WLAN master switch
+	TInt wlanOn( EFalse );
+	iWlanOnOff->Get( wlanOn );
+	
+	// Read WLAN force disable switch
+	TInt wlanForceDisable( EFalse );
+	iWlanForceDisable->Get( wlanForceDisable );
+	
+	DEBUG2( "CWlmPlatformData::GetWlanOnOffState() - WlanOnOff: %d, WlanForceDisable: %d",
+	    wlanOn, wlanForceDisable );
+	
+	// Check first if WLAN is forcibly disabled as it overrides all the other settings
+	if( wlanForceDisable )
+	    {
+		wlanState = EWlanForceOff;
+		}
+	// Check if WLAN master switch is ON
+	else if( wlanOn )
+	    {
+		wlanState = EWlanOn;
+		}
+	
+	DEBUG1( "CWlmPlatformData::GetWlanOnOffState() return value: %d",
+	    wlanState );
+	
+	return wlanState;
+	}
+	
+// ---------------------------------------------------------
+// CWlmPlatformData::NotifyWlanOnOffObserver
+// Status : Draft
+// ---------------------------------------------------------
+//
+void CWlmPlatformData::NotifyWlanOnOffObserver()
+    {
+	DEBUG( "CWlmPlatformData::NotifyWlanOnOffObserver()" );
+	
+	// Read WLAN master switch
+	TInt wlanOn( EFalse );
+	iWlanOnOff->Get( wlanOn );
+	
+	// Read WLAN force disable switch
+	TInt wlanForceDisable( EFalse );
+	iWlanForceDisable->Get( wlanForceDisable );
+	
+	DEBUG3( "    WlanOnOff: %d, WlanForceDisable: %d, NotifiedToObserver: %d",
+	    wlanOn, wlanForceDisable, iNotifiedWlanState );
+	
+	// Note that the observer is only notified if the
+	// state really changes 
+	
+	// If WLAN is set ON and it is not forcibly disabled
+	if( wlanOn &&                        // WLAN set ON
+	    wlanForceDisable == EFalse &&    // WLAN force disable not set
+	    iNotifiedWlanState != CWlmPlatformData::EWlanNotifiedOn ) // WLAN ON not notified yet
+	    {
+		// Notify observer that WLAN is set ON
+		iCallback.WlanOn();
+		iNotifiedWlanState = CWlmPlatformData::EWlanNotifiedOn;
+		(void)PublishWlanOnOff( EPSWlanOn );
+		// Note! P&S write operation return value is not checked
+		DEBUG( "CWlmPlatformData::NotifyWlanOnOffObserver() - WLAN ON notified, P&S updated" );
+		}
+    // WLAN is set OFF
+	else if( iNotifiedWlanState != CWlmPlatformData::EWlanNotifiedOff ) // WLAN OFF not notified yet
+	    {
+		// Notify observer that WLAN is set OFF
+	    iCallback.WlanOff();
+	    iNotifiedWlanState = CWlmPlatformData::EWlanNotifiedOff;
+	    (void)PublishWlanOnOff( EPSWlanOff );
+	    // Note! P&S write operation return value is not checked
+	    DEBUG( "CWlmPlatformData::NotifyWlanOnOffObserver() - WLAN OFF notified, P&S updated" );
+		}
+    }
+
+// ---------------------------------------------------------
+// CWlmPlatformData::PublishWlanOnOff
+// Status : Draft
+// ---------------------------------------------------------
+//
+TInt CWlmPlatformData::PublishWlanOnOff( TPSWlanOnOff aWlanState )
+    {
+    DEBUG1( "CWlmPlatformData::PublishWlanOnOff( wlanState = %d )",
+        aWlanState );
+
+    return iPsOnOffState.Set( aWlanState );
+    }
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmserver.cpp	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmserver.cpp	Fri May 14 17:41:09 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 105 %
+* %version: 106 %
 */
 
 #include <e32def.h>
@@ -464,6 +464,19 @@
     {
     DEBUG( "CWlmServer::Connect()" );
 
+    // Check that WLAN is ON
+    TWlanOnOffState wlanState( iPlatform->GetWlanOnOffState() );
+	if( wlanState != EWlanOn )
+	    {
+		// WLAN is OFF
+		DEBUG1( "CWlmServer::Connect() refused due to WLAN is OFF (%d)",
+		    wlanState );
+		// WLAN state enumerations map one to one to WLAN error code
+		aMessage.Complete( wlanState );
+		
+		return;
+		}
+
     // Get WlanSettings and secondarySSID list
     // (lanServiceId specifies the table row in wlansettings)
     SWLANSettings iapData;
@@ -1814,9 +1827,11 @@
                         iAggressiveScanningAfterLinkLoss = EFalse;
                         }
                     
-                    // If background scan is on, this call will cause a background scan to occur.
-					// The icon is updated after the background scan is completed.
-                    iBgScanProvider->WlanStateChanged( MWlanBgScanProvider::EWlanStateDisconnected );
+					// If WLAN is ON, enable background scanning
+					if( iPlatform->GetWlanOnOffState() == EWlanOn )
+					    {
+                        iBgScanProvider->WlanSetBgScanState( MWlanBgScanProvider::EWlanBgScanOn );
+                        }
                     
                     break;
                 case EWlanStateInfrastructure:
@@ -2325,7 +2340,7 @@
                 // If background scan is currently on, background scan
                 // will be disabled and it's request will be removed
                 // from the request map.
-                iBgScanProvider->WlanStateChanged( MWlanBgScanProvider::EWlanStateConnected );
+                iBgScanProvider->WlanSetBgScanState( MWlanBgScanProvider::EWlanBgScanOff );
                 
                 }
             }
@@ -3505,12 +3520,15 @@
     DEBUG1( "CWlmServer::ScanSchedulingTimerExpired() - iRequestId %u", self->iRequestMap[index].iRequestId );
     
     TUint indexNextScan( 0 );
-    // If roaming is ongoing, scanning is not started for GetScanResults. 
-    if ( self->iRequestMap[index].iRequestId >= KWlanExtCmdBase && 
-         self->iRequestMap[index].iFunction == EGetScanResults && 
-    	 self->IsRoaming() )
+    // If roaming is ongoing or WLAN is OFF, scanning is not started for
+    // GetScanResults but instead empty scan list is returned. 
+    if ( ( self->iRequestMap[index].iRequestId >= KWlanExtCmdBase && 
+           self->iRequestMap[index].iFunction == EGetScanResults ) && 
+    	 ( self->IsRoaming() || self->iPlatform->GetWlanOnOffState() != EWlanOn ) )
         {
-        DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - GetScanResults, roam in progress, returning empty scan results" );
+        DEBUG2( "CWlmServer::ScanSchedulingTimerExpired() - GetScanResults, returning empty list; roaming: %d, WLAN on/off: %d",
+            self->IsRoaming(),
+            self->iPlatform->GetWlanOnOffState() );
 
         ScanList* completedScanList = reinterpret_cast<ScanList*>( self->iRequestMap[index].iParam0 );
         core_ssid_s* completedSsid =  reinterpret_cast<core_ssid_s*>( self->iRequestMap[index].iParam1 );
@@ -3553,19 +3571,27 @@
     if ( self->iRequestMap[index].iRequestId >= KWlanExtCmdBase && 
          self->iRequestMap[index].iFunction == EGetAvailableIaps )
         {
-        DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - GetAvailableIaps requested" );
-
+        DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - GetAvailableIaps" );
+            
         core_type_list_c<core_iap_data_s>* iapDataList = reinterpret_cast<core_type_list_c<core_iap_data_s>*>( self->iRequestMap[index].iParam0 );
         core_type_list_c<u32_t>* iapIdList =  reinterpret_cast<core_type_list_c<u32_t>*>( self->iRequestMap[index].iParam1 );
         ScanList* scanList =  reinterpret_cast<ScanList*>( self->iRequestMap[index].iParam2 );
         core_type_list_c<core_ssid_entry_s>* iapSsidList =  reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( self->iRequestMap[index].iParam3 );
         TTime* scanTime =  reinterpret_cast<TTime*>( self->iRequestMap[index].iTime );        
-        
-        // If the device is roaming OR there are not WLAN IAPs defined in the device
+
+        // If the device is roaming OR
+        // there are not WLAN IAPs defined in the device OR
+        // WLAN is OFF
         // --> return empty list
-        if( self->IsRoaming() || iapDataList->count() == 0 )
+        if( self->IsRoaming() ||
+            iapDataList->count() == 0 ||
+            self->iPlatform->GetWlanOnOffState() != EWlanOn )
             {
-            DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - Device is roaming or no IAPs defined, returning empty list" );
+            DEBUG3( "CWlmServer::ScanSchedulingTimerExpired() - GetAvailableIaps, returning empty list; roaming: %d, iaps: %d, WLAN on/off: %d",
+                self->IsRoaming(),
+                iapDataList->count(),
+                self->iPlatform->GetWlanOnOffState() );    
+            
             // Only the triggering request is completed and then scan scheduling timer is set again 
             if( self->IsSessionActive( self->iRequestMap[index] ) )
                 {
@@ -4351,6 +4377,18 @@
     {
     DEBUG( "CWlmServer::RunProtectedSetup()" );
     
+    // Check that WLAN is ON
+	TWlanOnOffState wlanState( iPlatform->GetWlanOnOffState() );
+	if( wlanState != EWlanOn )
+	    {
+		// WLAN is OFF and therefore request is not served.
+		DEBUG1( "CWlmServer::RunProtectedSetup() rejected due to WLAN is OFF (%d)",
+		    wlanState );
+		// WLAN states map one to one to WLAN error codes.
+		aMessage.Complete( wlanState );
+		return;
+		}
+    
     // Get WlanSettings and secondarySSID list
     // (lanServiceId specifies the table row in wlansettings)
     SWLANSettings iapData;
@@ -4972,6 +5010,12 @@
      */
     UpdateWlanSettings();
 
+    // If WLAN is set ON, enable background scanning
+    if( iPlatform->GetWlanOnOffState() == EWlanOn )
+        {
+        iBgScanProvider->WlanSetBgScanState( MWlanBgScanProvider::EWlanBgScanOn );
+        }
+
     iPlatform->InitializeSystemTimeHandler();
     }
 
@@ -5174,3 +5218,87 @@
     iPlatform->PublishBgScanInterval( aInterval );
     }
     
+// ---------------------------------------------------------
+// CWlmServer::WlanOn
+// ---------------------------------------------------------
+//
+void CWlmServer::WlanOn()
+    {
+	DEBUG( "CWlmServer::WlanOn()" );
+	
+	// BG scan can be set ON only after BG scan interval has been
+	// set and that does not happen until startup has been
+	// completed.
+	if( iIsStartupComplete )
+	    {
+	    // Enable background scanning
+	    iBgScanProvider->WlanSetBgScanState( MWlanBgScanProvider::EWlanBgScanOn );
+	    }
+	}
+
+// ---------------------------------------------------------
+// CWlmServer::WlanOff
+// ---------------------------------------------------------
+//
+void CWlmServer::WlanOff()
+    {
+	DEBUG( "CWlmServer::WlanOff()" );
+	
+	// Disable background scanning
+	iBgScanProvider->WlanSetBgScanState( MWlanBgScanProvider::EWlanBgScanOff );
+	
+	// Cancel all running operations that are forbidden in WLAN OFF
+    CancelExternalRequestsByType( ERunProtectedSetup );
+    CancelExternalRequestsByType( EJoinByProfileId );
+    
+	// If WLAN is connected...
+    if( iConnectionState != EWlanStateNotConnected )
+        {
+        //...send out disconnected indication, which brings down
+        // the connection gracefully
+        TBuf8<KMaxNotificationLength> buf;
+        buf.Append( static_cast<u8_t>( EWlanStateNotConnected ) );
+        SendNotification( EWlmNotifyConnectionStateChanged, buf );
+        }
+	}
+    
+// ---------------------------------------------------------
+// CWlmServer::CancelRequestsByType
+// ---------------------------------------------------------
+//
+void CWlmServer::CancelExternalRequestsByType(
+    const TWLMCommands aCommand )
+    {
+    DEBUG1( "CWlmServer::CancelExternalRequestsByType( aCommand=%u )", aCommand );
+
+    // Go through request map and cancel the command given as a parameter
+    for( TInt i( 0 ); i < iRequestMap.Count(); i++ )
+        {
+        if( iRequestMap[i].iFunction == aCommand )
+            {
+            DEBUG1( "CWlmServer::CancelExternalRequestsByType() - request found (id=%u), cancelling",
+                iRequestMap[i].iRequestId );
+            
+            iCoreServer->cancel_request( iRequestMap[i].iRequestId );
+            }
+        }
+    }
+
+// ---------------------------------------------------------
+// CWlmServer::SendNotification
+// ---------------------------------------------------------
+//
+void CWlmServer::SendNotification(
+    TWlmNotify amNotification,
+    TBuf8<KMaxNotificationLength>& aParams )
+    {
+    DEBUG1( "CWlmServer::SendNotification( notification=%u )",
+        amNotification );
+    
+    // Notify subscribees
+    for ( TInt i = 0; i < iNotificationArray.Count(); i++ )
+        {
+        iNotificationArray[i]->AddNotification( amNotification, aParams );
+        }
+    }
+ 
--- a/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osaheap.h	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osaheap.h	Fri May 14 17:41:09 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 3 %
+* %version: 4 %
 */
 
 #ifndef WLAN_OSA_HEAP_H
@@ -113,7 +113,7 @@
 
     RWlanHeap(TInt aInitialSize, TInt aAllocationUnit );
     
-    TAny* RWlanHeap::operator new(TUint aSize, TAny* aBase);
+    TAny* operator new(TUint aSize, TAny* aBase);
     
     void Initialise();
     
--- a/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osalist.inl	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osalist.inl	Fri May 14 17:41:09 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 5 %
+* %version: 6 %
 */
 
 #include <wlanosa.h>
@@ -37,7 +37,7 @@
 // -----------------------------------------------------------------------------
 //
 template<class T>
-inline list<T>::iterator list<T>::begin()
+inline typename list<T>::iterator list<T>::begin()
     {
     // for empty ranges begin() == end()
     return ( !(empty()) ? list_iterator<Node, T>( iFirst ) : end() );
@@ -48,7 +48,7 @@
 // -----------------------------------------------------------------------------
 //
 template<class T>
-inline list<T>::const_iterator list<T>::begin() const
+inline typename list<T>::const_iterator list<T>::begin() const
     {
     // for empty ranges begin() == end()
     return ( !(empty()) ? list_iterator<Node, T>( iFirst ) : end() );
@@ -59,7 +59,7 @@
 // -----------------------------------------------------------------------------
 //
 template<class T>
-inline list<T>::iterator list<T>::end()
+inline typename list<T>::iterator list<T>::end()
     {
     return list_iterator<Node, T>();
     }
@@ -69,7 +69,7 @@
 // -----------------------------------------------------------------------------
 //
 template<class T>
-inline list<T>::const_iterator list<T>::end() const
+inline typename list<T>::const_iterator list<T>::end() const
     {
     return list_iterator<Node, T>();
     }
@@ -79,7 +79,7 @@
 // -----------------------------------------------------------------------------
 //
 template<class T>
-inline list<T>::size_type list<T>::size() const
+inline typename list<T>::size_type list<T>::size() const
     {
     return iNumOfElems;
     }
@@ -99,7 +99,7 @@
 // -----------------------------------------------------------------------------
 //
 template<class T>
-inline list<T>::reference list<T>::front()
+inline typename list<T>::reference list<T>::front()
     {
     // front() for empty sequence is undefined so assert
     MWlanOsa::Assert( 
@@ -112,7 +112,7 @@
 // -----------------------------------------------------------------------------
 //
 template<class T>
-inline list<T>::const_reference list<T>::front()  const
+inline typename list<T>::const_reference list<T>::front()  const
     {
     // front() for empty sequence is undefined so assert
     MWlanOsa::Assert( 
@@ -125,7 +125,7 @@
 // -----------------------------------------------------------------------------
 //
 template<class T>
-inline list<T>::reference list<T>::back()
+inline typename list<T>::reference list<T>::back()
     {
     // back() for empty sequence is undefined so assert
     MWlanOsa::Assert( 
@@ -138,7 +138,7 @@
 // -----------------------------------------------------------------------------
 //
 template<class T>
-inline list<T>::const_reference list<T>::back() const
+inline typename list<T>::const_reference list<T>::back() const
     {
     // back() for empty sequence is undefined so assert
     MWlanOsa::Assert( 
@@ -304,7 +304,9 @@
 // -----------------------------------------------------------------------------
 //
 template<class T>
-inline list<T>::iterator list<T>::insert( iterator aPos, const T& aElem )
+inline typename list<T>::iterator list<T>::insert( 
+    iterator aPos, 
+    const T& aElem )
     {
     // allocate a new node for the element
     Node* node = new Node( aElem );
@@ -355,7 +357,7 @@
 // -----------------------------------------------------------------------------
 //
 template<class T>
-inline list<T>::iterator list<T>::erase( iterator aPos )
+inline typename list<T>::iterator list<T>::erase( iterator aPos )
     {
     // extract node to be erased
     Node* node = aPos();
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacContextImpl.h	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacContextImpl.h	Fri May 14 17:41:09 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 104 %
+* %version: 105 %
 */
 
 #ifndef WLANCONTEXTIMPL_H
@@ -473,7 +473,7 @@
     WlanWhaConfigureQueue&          WhaConfigureQueue();
     WlanWsaSetPsMode&               WsaSetPsMode();
     WlanWhaConfigureAc&             WhaConfigureAc();
-    WlanWhaRelease&                 WlanWhaRelease();
+    WlanWhaRelease&                 WhaRelease();
 
     inline void WHASettings( const WHA::SSettings& aSettings );
     inline WHA::SSettings& WHASettings();
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/Umac.cpp	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/Umac.cpp	Fri May 14 17:41:09 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 56 %
+* %version: 57 %
 */
 
 #include "config.h"
@@ -267,7 +267,16 @@
     {
     OsTracePrint( KInitLevel, (TUint8*)("UMAC: * FinitSystem()"));  
     iManagementRequestPending = ETrue;
-    iPimpl->CurrentState().FinitSystem( *iPimpl );
+
+    if ( iPimpl )
+        {
+        iPimpl->CurrentState().FinitSystem( *iPimpl );
+        }
+    else
+        {
+        // nothing to do. Just complete the WLAN Mgmt client request 
+        CompleteManagementCommand( KErrNone );
+        }
     }
 
 // ---------------------------------------------------------------------------
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacContextImpl.cpp	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacContextImpl.cpp	Fri May 14 17:41:09 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 71 %
+* %version: 72 %
 */
 
 #include "config.h"
@@ -60,7 +60,7 @@
     WlanWsaSetPsMode                iWsaSetPsMode;
     WlanWhaConfigureQueue           iWhaConfigureQueue;
     WlanWhaConfigureAc              iWhaConfigureAc;
-    WlanWhaRelease                  iWlanWhaRelease;
+    WlanWhaRelease                  iWhaRelease;
     };
 
 // ================= MEMBER FUNCTIONS =======================
@@ -281,9 +281,9 @@
 // 
 // ---------------------------------------------------------------------------
 //
-WlanWhaRelease& WlanContextImpl::WlanWhaRelease()
+WlanWhaRelease& WlanContextImpl::WhaRelease()
     {
-    return iWsaCommands->iWlanWhaRelease;
+    return iWsaCommands->iWhaRelease;
     }
 
 // ---------------------------------------------------------------------------
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Idle.cpp	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Idle.cpp	Fri May 14 17:41:09 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-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"
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 41 %
+* %version: 42 %
 */
 
 #include "config.h"
@@ -697,7 +697,7 @@
     // and execute transition
     ChangeState( aCtxImpl, 
         *this,                      // prev state
-        aCtxImpl.WlanWhaRelease()   // next state
+        aCtxImpl.WhaRelease()       // next state
         );      
     }
 
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11InitPhase1.cpp	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11InitPhase1.cpp	Fri May 14 17:41:09 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 35 %
+* %version: 36 %
 */
 
 #include "config.h"
@@ -416,7 +416,7 @@
             }
         else    // -- aCommandId == WHA::EReadMIBResponse
             {
-            // nothing else is no interest to us
+            // nothing else is of interest to us
             }
         }
     else    // -- aAct != WlanDot11State::KCompleteManagementRequest
@@ -617,6 +617,8 @@
         os_memcpy( iPda, aPda, iPdaLen );
         // set ctx for fw upload
         aCtxImpl.WsaInitiliaze().Set( aCtxImpl, aFw, aFwLength );
+        // manually start the fsm
+        Entry( aCtxImpl );
         }
     else
         {
@@ -625,9 +627,6 @@
             ("UMAC * dot11-initphase * pda memory allocation failure") );
         Fsm( aCtxImpl, EABORT );
         }
-
-    // manually start the fsm
-    Entry( aCtxImpl );
     }
 
 // -----------------------------------------------------------------------------
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11MacError.cpp	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11MacError.cpp	Fri May 14 17:41:09 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-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"
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 22 %
+* %version: 23 %
 */
 
 #include "config.h"
@@ -97,7 +97,7 @@
     // execute transition
     ChangeState( aCtxImpl, 
         *this,                      // prev state
-        aCtxImpl.WlanWhaRelease()   // next state
+        aCtxImpl.WhaRelease()       // next state
         );      
     }
 
--- a/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/WlanLogicalChannel.h	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/WlanLogicalChannel.h	Fri May 14 17:41:09 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-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"
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 31 %
+* %version: 32 %
 */
 
 #ifndef DWLANLOGICALCHANNEL_H
@@ -667,12 +667,12 @@
 
 private:    // data
 
-    const TUint32   KFreeOpenParamsMask            = ( 1 << 0 );
-    const TUint32   KFreeScanResponseFramebodyMask = ( 1 << 1 );    
-    const TUint32   KDfcCancelledMask              = ( 1 << 2 );
-    const TUint32   KFreeIeDataMask                = ( 1 << 3 );
-    const TUint32   KPowerHandlerRegistered        = ( 1 << 4 );
-    const TUint32   KTxTriggerArmed                = ( 1 << 5 );
+    static const TUint32   KFreeOpenParamsMask            = ( 1 << 0 );
+    static const TUint32   KFreeScanResponseFramebodyMask = ( 1 << 1 );    
+    static const TUint32   KDfcCancelledMask              = ( 1 << 2 );
+    static const TUint32   KFreeIeDataMask                = ( 1 << 3 );
+    static const TUint32   KPowerHandlerRegistered        = ( 1 << 4 );
+    static const TUint32   KTxTriggerArmed                = ( 1 << 5 );
 
     TOpenParam      iOpenParam;
 
--- a/wlan_plat/wlan_info_api/inc/wlaninternalpskeys.h	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_plat/wlan_info_api/inc/wlaninternalpskeys.h	Fri May 14 17:41:09 2010 +0300
@@ -18,7 +18,7 @@
 */
 
 /*
-* %version: 6 %
+* %version: 7 %
 */
 
 #ifndef WLANINTERNALPSKEYS_H
@@ -67,6 +67,23 @@
 const TUint KPSWlanBgScanInterval = 0x00000003;
 const RProperty::TType KPSWlanBgScanIntervalType = RProperty::EInt;
 
+/**
+ * WLAN on/off state
+ */
+const TUint KPSWlanOnOffState = 0x00000004;
+const RProperty::TType KPSWlanOnOffStateType = RProperty::EInt;
+
+/**
+ * Possible values for WLAN on/off state
+ */
+enum TPSWlanOnOff
+    {
+    /** WLAN is OFF */
+    EPSWlanOff = 0,
+    /** WLAN is ON */
+    EPSWlanOn
+    };
+
 #endif // WLANINTERNALPSKEYS_H
            
 //  End of File
--- a/wlan_plat/wlan_management_api/inc/wlanerrorcodes.h	Mon May 03 14:14:02 2010 +0300
+++ b/wlan_plat/wlan_management_api/inc/wlanerrorcodes.h	Fri May 14 17:41:09 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 5 %
+* %version: 6 %
 */
 
 #ifndef WLANERRORCODES_H
@@ -277,6 +277,19 @@
  * @ingroup rconn_cfg
  */
 const TInt KErrWlanEapFastPacStoreCorrupted                           = -30234;
+/**
+ * The received request cannot be serviced as WLAN is OFF. In typical case
+ * WLAN is OFF because the end-user has set it OFF from WLAN UI.
+ * @ingroup rconn_cfg
+ */
+const TInt KErrWlanOff                                                = -30235;
+/**
+ * The received request cannot be serviced as WLAN is forcibly disabled.
+ * In typical case the Device Management has disabled WLAN based on operator
+ * configuration.
+ * @ingroup rconn_cfg
+ */
+const TInt KErrWlanForceOff                                           = -30236;
 
 /**
  * @}